feat:生产入库,入库执行,库存拆批,库存合批

This commit is contained in:
周炼 2024-11-22 10:35:10 +08:00
parent 315720fe14
commit 0fab9871f6
5 changed files with 1150 additions and 43 deletions

View File

@ -166,5 +166,29 @@ export default [
meta: {
keepAlive: false
}
},{
path: '/mobile/wms/production-warehousing',
component: () =>
import(/* webpackChunkName: "page" */ '@/views/mobile/wms/production-warehousing/index'),
name: '生产入库',
meta: {
keepAlive: false
}
},{
path: '/mobile/wms/inventory-split',
component: () =>
import(/* webpackChunkName: "page" */ '@/views/mobile/wms/inventory-split'),
name: '拆批',
meta: {
keepAlive: false
}
},{
path: '/mobile/wms/inventory-merge',
component: () =>
import(/* webpackChunkName: "page" */ '@/views/mobile/wms/inventory-merge/index'),
name: '合批',
meta: {
keepAlive: false
}
}
]

View File

@ -188,9 +188,7 @@
p {
color: $font-gy1 !important;
}
}
//共用droplist template
@ -198,8 +196,8 @@
border-radius: $baseRadius1;
padding: $baseGap1;
position: absolute;
top: 32px!important;
margin-right: 8px!important;
top: 32px !important;
margin-right: 8px !important;
li {
border-radius: $baseRadius1;
@ -224,33 +222,28 @@
display: block;
border-radius: $baseRadius1;
font-weight: 400!important;
letter-spacing: 0px!important;
line-height: 22px!important;
text-align: left!important;
font-weight: 400 !important;
letter-spacing: 0px !important;
line-height: 22px !important;
text-align: left !important;
}
}
li:hover {
background-color: $brand8-normal !important;
color: $white1 !important;
}
}
.semi-router-icon {
display: inline !important;
padding: 0px !important;
font-size: 20px !important;
top: 5px;
position: relative;
margin-right: 8px
margin-right: 8px;
}
.login-float-icon-area {
position: fixed;
top: 40px;
@ -269,7 +262,7 @@
// height: 100%;
display: block;
position: relative;
width: calc(100% - (100%/36) - (100%/36) - 480px);
width: calc(100% - (100% / 36) - (100% / 36) - 480px);
height: auto;
padding-top: 52.63%;
/* 1000 / 1900 * 100 = 52.6315% */
@ -300,12 +293,11 @@
/* IE (non-standard property) */
}
.iep_login_icon_area {
display: table;
font-weight: 100;
font-size: 36px;
margin: 95px auto 0 ;
margin: 95px auto 0;
padding: 0px 35px;
.iep_login_menu_icon {
@ -317,7 +309,6 @@
background-repeat: no-repeat;
background-size: contain;
background-position: 50% 50%;
}
.iep_login_menu_title {
@ -328,11 +319,9 @@
vertical-align: middle;
font-size: $baseFont1;
font-weight: 400;
}
}
.el-select-dropdown__item {
font-size: $baseFont4;
}
@ -343,7 +332,6 @@
height: 40px;
}
.el-message-box {
min-width: 100px;
max-width: 1366px;
@ -362,7 +350,7 @@
padding-left: 0px !important;
padding-right: 0px !important;
button[aria-label='close'] {
button[aria-label="close"] {
i {
color: $font-gy1;
}
@ -398,30 +386,28 @@
color: white !important;
}
.el-button--primary.is-disabled,
.el-button--primary.is-disabled:hover{
background-color: $brand3-disabled!important;
border-color: $brand3-disabled!important;
.el-button--primary.is-disabled:hover {
background-color: $brand3-disabled !important;
border-color: $brand3-disabled !important;
}
.el-select-dropdown__item.selected{
span{
.el-select-dropdown__item.selected {
span {
display: block;
line-height: 34px;
padding-top: 5px;
}
span::after{
content: url('https://api.iconify.design/carbon:checkmark.svg?color=%230966c2');
span::after {
content: url("https://api.iconify.design/carbon:checkmark.svg?color=%230966c2");
font-family: "Carbon" !important;
float: right;
margin-right: 8px;
line-height: 34px;
}
.el-tree.tree-option{
span::after{
.el-tree.tree-option {
span::after {
content: "";
}
}
}
@ -432,10 +418,10 @@
border-radius: 12px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
height: 100%
height: 100%;
}
.flex-content{
.flex-content {
height: 100%;
width: 100%;
padding: 10px;
@ -444,14 +430,14 @@
-webkit-flex-direction: row;
flex-direction: column;
}
.flex-auto{
.flex-auto {
-webkit-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 0
min-height: 0;
}
.flex-none{
flex:none
.flex-none {
flex: none;
}
@media (max-width: 1024px) {
@ -464,10 +450,9 @@
}
}
.mobile-home {
height: calc(100% - 10px);
position: relative;
.content {
display: flex;
flex-flow: column;
@ -492,7 +477,15 @@
flex: 1;
}
}
.footer {
width: 100%;
margin: 10px 0;
display: flex;
justify-content: center;
position: absolute;
background-color: #ffffff;
bottom: 0;
}
.flex-auto {
-webkit-flex: 1 1 auto;
flex: 1 1 auto;
@ -542,7 +535,7 @@
font-size: 15px;
color: green;
width: 70%;
text-align: right
text-align: right;
}
}
}

View File

@ -0,0 +1,200 @@
<template>
<div class="mobile-home">
<div class="content">
<mobile-navbar title="库存合批"></mobile-navbar>
<div style="margin: 10px;">
<el-form ref="formObj" :model="formObj" label-width="auto">
<el-row>
<el-col :span="24">
<el-form-item label="站点:" prop="site">
<el-input placeHolder="站点" v-model="site" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="条码扫描:" prop="code" class="inputRequired">
<el-input v-model="formObj.code" autofocus @keyup.enter.native="scanCode" :disabled="codeDisabled">
<i slot="suffix" class="el-input__icon el-icon-full-screen"></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="合批后条码:" prop="inventoryId">
<el-input v-model="formObj.inventoryId" :disabled="!codeDisabled" :readonly="codeDisabled"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="汇总数量:" prop="qty">
<el-input type="number" v-model="formObj.qty" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table :data="inventoryList" border>
<el-table-column label="序号" align="center">
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="条码" prop="inventoryId"></el-table-column>
<el-table-column label="数量" prop="qtyOnHand"></el-table-column>
</el-table>
<div style="margin-top: 10px; display: flex; justify-content: center;">
<el-button type="primary" @click="doMerge">合批执行</el-button>
<el-button type="warning" @click="doClear">清除</el-button>
</div>
</div>
</div>
</div>
</template>
<script>
import { selectForSplit, mergeInventory } from '@/api/wms/inventory';
import { isBlank } from "@/util/string";
import { add, mul } from "@/util/number";
import { getStore } from '@/util/store';
import { showLoading, hideLoading } from '@/const/loading';
import { listByActivityId } from "@/api/admin/activity-option";
import {
mapGetters
} from 'vuex';
import MobileNavbar from "@/components/top-bar/mobile-navbar.vue";
export default {
components: { MobileNavbar },
data() {
return {
lableWidth: {
'width': '150px'
},
site: getStore({ name: 'tenantId' }),
formObj: {},
initData: {
qty: 0,
},
inventoryList: [],
codeDisabled: false
};
},
created() {
this.doClear();
},
beforeRouteEnter(to, from, next) {
next(vm => {
try {
//获取作业规则
let me = vm;
let activityId = me.$route.query.ACTIVITY_ID;
listByActivityId(activityId).then(response => {
if (response.data.code != 0) {
return me.$message.error(response.data.msg);
}
let data = response.data.data;
if (data && data.length > 0) {
for (let i = 0; i < data.length; i++) {
if (data[i].optionName && data[i].optionName.toUpperCase() === "PRINTER_D") {
me.printer = data[i].optionValue;
}
}
}
}).catch(e => {
console.log(e);
});
} catch (e) {
console.log(e);
}
});
},
computed: {
...mapGetters(["permissions"]),
permissionList() {
return {};
}
},
methods: {
//清除页面信息
doClear() {
this.formObj = Object.assign({}, this.initData);
this.inventoryList = [];
this.codeDisabled = false;
},
scanCode() {
let me = this;
let code = me.formObj.code;
me.formObj.inventoryId = "";
if (isBlank(code)) {
me.$message.error("不可扫描空条码");
} else if (me.inventoryList.findIndex(o => o.inventoryId === code) >= 0) {
me.formObj.code = '';
me.$message.error('条码已扫描');
} else {
showLoading();
selectForSplit({
inventoryId: code
}).then(res => {
hideLoading();
me.formObj.code = '';
let data = res.data.data;
if (me.inventoryList.length > 0) {
let firstData = me.inventoryList[0];
if (data.item !== firstData.item) {
return me.$message.error("物料不一致,请确认");
} else if (data.batchNo !== firstData.batchNo) {
return me.$message.error("批次不一致,请确认");
} else if (data.status !== firstData.status) {
return me.$message.error("状态不一致,请确认");
} else if (data.storageBinBo !== firstData.storageBinBo) {
return me.$message.error("存储区域不一致,请确认");
} else if (data.delayTime !== firstData.delayTime) {
return me.$message.error("推迟日期不一致,请确认");
} else if (data.qmsSpecialMarking !== firstData.qmsSpecialMarking) {
return me.$message.error("检验特殊标记不一致,请确认");
}
}
me.formObj.qty = add(me.formObj.qty, data.qtyOnHand);
me.inventoryList.push(data);
}).catch(e => hideLoading());
}
},
doMerge() {
let me = this;
if (me.inventoryList.length > 1) {
showLoading();
mergeInventory({
printer: me.printer,
inventoryIdList: me.inventoryList.map(o => o.inventoryId)
}).then(res => {
hideLoading();
let data = res.data.data;
me.codeDisabled = true;
me.$set(me.formObj, "inventoryId", data);
me.$message.success("合批成功");
}).catch(e => hideLoading());
} else {
me.$message.error("合批条码个数不足");
}
}
},
};
</script>
<style scoped lang="scss">
.inputRequired ::v-deep .el-form-item__label::before {
content: "*";
width: 10px;
height: 20px;
display: inline-block;
vertical-align: middle;
text-align: center;
line-height: 26px;
font-size: large;
color: #f00;
}
</style>

View File

@ -0,0 +1,203 @@
<template>
<div class="mobile-home">
<div class="content">
<mobile-navbar title="库存拆批"></mobile-navbar>
<div style="margin: 10px;">
<el-form ref="formObj" :model="formObj" label-width="auto">
<el-row>
<el-col :span="24">
<el-form-item label="站点:" prop="site">
<el-input placeHolder="站点" v-model="site" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="条码扫描:" prop="code" class="inputRequired">
<el-input v-model="formObj.code" autofocus @keyup.enter.native="scanCode" :disabled="codeDisabled">
<i slot="suffix" class="el-input__icon el-icon-full-screen"></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拆批数量:" prop="splitQty" class="inputRequired">
<el-input type="number" v-model="formObj.splitQty" @keyup.enter.native="checkQty"
:disabled="!codeDisabled && inventoryList.length === 0"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="拆批条数:" prop="splitNum" class="inputRequired">
<el-input type="number" v-model="formObj.splitNum" @keyup.enter.native="checkQty"
:disabled="!codeDisabled && inventoryList.length === 0"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table :data="inventoryList" border>
<el-table-column label="序号" align="center">
<template slot-scope="scope">
{{ scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="条码" prop="inventoryId"></el-table-column>
<el-table-column label="数量" prop="qtyOnHand"></el-table-column>
</el-table>
<div style="margin-top: 10px; display: flex; justify-content: center;">
<el-button type="primary" @click="doSplit">拆批执行</el-button>
<el-button type="warning" @click="doClear">清除</el-button>
</div>
</div>
</div>
</div>
</template>
<script>
import { selectForSplit, splitInventory } from '@/api/wms/inventory';
import { isBlank } from "@/util/string";
import { mul } from "@/util/number";
import { getStore } from '@/util/store';
import { showLoading, hideLoading } from '@/const/loading';
import { listByActivityId } from "@/api/admin/activity-option";
import {
mapGetters
} from 'vuex';
import MobileNavbar from "@/components/top-bar/mobile-navbar.vue";
export default {
components: { MobileNavbar },
data() {
return {
lableWidth: {
'width': '150px'
},
site: getStore({ name: 'tenantId' }),
formObj: {},
codeDisabled: false,
initData: {
splitQty: 0,
splitNum: 0
},
inventoryList: []
};
},
created() {
this.doClear();
},
beforeRouteEnter(to, from, next) {
next(vm => {
try {
//获取作业规则
let me = vm;
let activityId = me.$route.query.ACTIVITY_ID;
listByActivityId(activityId).then(response => {
if (response.data.code != 0) {
return me.$message.error(response.data.msg);
}
let data = response.data.data;
if (data && data.length > 0) {
for (let i = 0; i < data.length; i++) {
if (data[i].optionName && data[i].optionName.toUpperCase() === "PRINTER_D") {
me.printer = data[i].optionValue;
}
}
}
}).catch(e => {
console.log(e);
});
} catch (e) {
console.log(e);
}
});
},
computed: {
...mapGetters(["permissions"]),
permissionList() {
return {};
}
},
methods: {
//清除页面信息
doClear() {
this.formObj = Object.assign({}, this.initData);
this.inventoryList = [];
this.codeDisabled = false;
},
scanCode() {
let me = this;
let code = me.formObj.code;
if (isBlank(code)) {
me.$message.error("不可扫描空条码");
} else {
showLoading();
selectForSplit({
inventoryId: code
}).then(res => {
hideLoading();
let data = res.data.data;
me.formObj.qtyOnHand = data.qtyOnHand;
me.codeDisabled = true;
}).catch(e => hideLoading());
}
},
checkQty() {
let me = this;
if (me.formObj.splitQty > 0 && me.formObj.splitNum > 0) {
if (mul(me.formObj.splitQty, me.formObj.splitNum) > me.formObj.qtyOnHand) {
me.$message.error("拆批总量超过条码数量,请确认");
return false;
} else {
return true;
}
} else {
me.$message.error("数量和条数必须大于0");
return false;
}
},
doSplit() {
let me = this;
if (me.checkQty()) {
showLoading();
splitInventory({
parentInventoryId: me.formObj.code,
splitQty: me.formObj.splitQty,
splitNum: me.formObj.splitNum,
printer: me.printer
}).then(res => {
hideLoading();
let data = res.data.data;
me.inventoryList = data.map(o => {
return {
inventoryId: o,
qtyOnHand: me.formObj.splitQty
};
});
me.$message.success("拆批成功");
}).catch(e => hideLoading());
}
},
},
};
</script>
<style scoped lang="scss">
.inputRequired ::v-deep .el-form-item__label::before {
content: "*";
width: 10px;
height: 20px;
display: inline-block;
vertical-align: middle;
text-align: center;
line-height: 26px;
font-size: large;
color: #f00;
}
</style>

View File

@ -0,0 +1,687 @@
<template>
<div class="mobile-home">
<div class="content">
<input-select-dialog :modal-obj='productionRequisitionDialogObj'
:modal-fetch-fun='productionRequisitionDialogFetchFun' :modal-show.sync="productionRequisitionDialogVisible"
@inputDialogSelected="productionRequisitionSelect" ref="documentDialog">
</input-select-dialog>
<input-select-dialog :modal-obj='storageLocationDialogObj' :modal-fetch-fun='storageLocationDialogFetchFun'
:modal-show.sync="storageLocationDialogVisible" @inputDialogSelected="storageLocationSelect">
</input-select-dialog>
<!-- 生产入库 -->
<mobile-navbar title="生产入库"></mobile-navbar>
<div style="margin: 10px;">
<el-form ref="formObj" :model="formObj" label-width="auto">
<el-row :gutter="10">
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
<el-form-item label="站点:" prop="site">
<el-input placeHolder="站点" v-model="formObj.site" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
<el-form-item prop="documentNo" class="searchIpt">
<el-input v-model="formObj.documentNo" placeholder="单据号" autofocus
@keyup.enter.native="scanProductionRequisitionOrder">
<i slot="suffix" class="el-input__icon el-icon-full-screen"></i>
<el-button slot="append" icon="el-icon-search"
@click.stop="showProductionRequisitionDialog"></el-button>
</el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 执行卡片 -->
<div class="card-container">
<el-card-collapse v-for="item in formObj.itemList" :key="item.id" class="box-card" :is-collapse="isCollapse">
<div slot="header" class="flex-between">
<div>
<span class="label" style="color: #afafaf;">物料:</span><span>{{ item.item }}</span>
</div>
<el-tag v-if="item.state === 'CLOSE'" effect="dark" type="warning" disable-transitions>已执行</el-tag>
<el-tag v-if="item.state === 'SUBMIT'" effect="dark">待执行</el-tag>
<el-tag v-if="item.state === 'SAVING'" type="success" effect="dark">已保存</el-tag>
<el-button size="mini" @click.stop="showItemDialog(item)" type="text">入库执行</el-button>
</div>
<ul class="item">
<li class="flex-between" style="margin-top:10px ;">
<span class="text">物料描述</span>
<div>{{ item.itemDescription }}</div>
</li>
<li class="flex-between" style="margin-top:10px ;">
<span class="text">来源仓</span>
<span style="display: block;">{{ item.sourceWarehouse }}</span>
</li>
<li class="flex-between" style="margin-top:10px ;">
<span class="text">目标仓</span>
<span style="display: block;">{{ item.targetWarehouse }}</span>
</li>
<li class="flex-between" style="margin-top:10px ;">
<span class="text">入库仓</span>
<span style="display: block;">{{ item.applicationsQuantity }}</span>
</li>
</ul>
</el-card-collapse>
</div>
<!-- <el-table :data="formObj.itemList" border>
<el-table-column label="物料" prop="item">
</el-table-column>
<el-table-column label="物料描述" prop="itemDescription">
</el-table-column>
<el-table-column label="来源仓" prop="sourceWarehouse">
</el-table-column>
<el-table-column label="目标仓" prop="targetWarehouse">
</el-table-column>
<el-table-column label="入库数量" prop="applicationsQuantity">
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="showItemDialog(scope.$index, scope.row)">入库执行
</el-button>
</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.state === 'CLOSE'" type="warning" disable-transitions>
已执行
</el-tag>
<el-tag v-if="scope.row.state === 'SUBMIT'" disable-transitions>
待执行
</el-tag>
<el-tag v-if="scope.row.state === 'SAVING'" type="success" disable-transitions>
已保存
</el-tag>
</template>
</el-table-column>
</el-table> -->
</el-form>
<div class="footer">
<el-button type="danger" @click="reject">拒收</el-button>
<el-button type="primary" @click="submit">确认提交</el-button>
<el-button type="warning" @click="doClear">清除</el-button>
<el-button type="warning">完成过账</el-button>
</div>
<!--入库执行 -->
<el-dialog :visible.sync="dialogItemType1FormVisible" center fullscreen>
<div style="margin-top: 10px;">
<el-form ref="formObj" :model="itemForm" label-width="auto" style="padding: 10px;">
<el-form-item label="单据号:">
{{ documentNo }}
</el-form-item>
<el-form-item label-width="0">
<el-table :data="formObj.itemList" border>
<el-table-column label="物料" prop="item"></el-table-column>
<el-table-column label="需求数量" prop="applicationsQuantity"></el-table-column>
<el-table-column label="汇总数量" prop="sumQuantity"></el-table-column>
</el-table>
</el-form-item>
<el-form-item label="托条码:">
<el-input v-model="itemForm.code" placeholder="扫描托条码" autofocus @keyup.enter.native="scanCode"
:disabled="isUse">
<i slot="suffix" class="el-input__icon el-icon-full-screen"></i>
</el-input>
</el-form-item>
<h3 class="label" style="color: black;">执行信息</h3>
<div class="card-info-container">
<el-card-collapse v-for="(item, index) in itemForm.inventoryList" :key="item.seq" class="box-card"
:is-collapse="isCollapse">
<div slot="header" class="flex-between">
<div>
<span class="label" style="color: #afafaf;">物料:</span><span>{{ item.item }}</span>
</div>
<el-button size="mini" type="danger" icon="el-icon-delete" circle @click.stop="delRow(index, item)"
:disabled="item.isScan === 'N'">
</el-button>
</div>
<ul class="item">
<li class="flex-between" style="margin-top:10px ;">
<span class="text">条码</span>
<div>{{ item.inventoryIdOrCarrier }}</div>
</li>
<li class="flex-between" style="margin-top:10px ;">
<span class="text">托条码</span>
<div>{{ item.inventoryIdOrCarrier }}</div>
</li>
<li class="flex-between" style="margin-top:10px ;">
<span class="text">物料</span>
<span style="display: block;">{{ item.item }}</span>
</li>
<li class="flex-between" style="margin-top:10px ;">
<span class="text">数量</span>
<span style="display: block;">{{ item.inventoryQty }}</span>
</li>
<li class="flex-between" style="margin-top:10px ;">
<span class="text">等级</span>
<span style="display: block;">{{ item.inspectionLevel }}</span>
</li>
</ul>
</el-card-collapse>
</div>
<!-- <el-table :data="itemForm.inventoryList" border>
<el-table-column label="序号" prop="seq"></el-table-column>
<el-table-column label="托条码" prop="inventoryIdOrCarrier"></el-table-column>
<el-table-column label="物料" prop="item"></el-table-column>
<el-table-column label="数量" prop="inventoryQty"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="delRow(scope.$index, scope.row)"
:disabled="scope.row.isScan === 'N'">
删除
</el-button>
</template>
</el-table-column>
</el-table> -->
</el-form>
</div>
<div slot="footer" class="dialog-footer footer">
<el-button type="primary" @click="saveItemType1" :disabled="isUse">保存</el-button>
</div>
</el-dialog>
</div>
</div>
</div>
</template>
<script>
import {
fetchList as fetchProductionRequisitionList,
getDocumentDetail,
submit,
getFinishedProductQty,
getItemInventory,
rejectDocumentByNo
} from "@/api/wms/production-warehousing";
import {
fetchList as fetchStorageLocationList,
getStorageLocationPageBycode
} from '@/api/wms/storage-location';
import { hideLoading, showLoading } from '@/const/loading';
import { isBlank } from "@/util/string";
import { getStore } from '@/util/store';
import { add } from '@/util/bigNumber';
import { getByActivityOption } from "@/api/admin/activity-option";
import {
mapGetters
} from 'vuex';
import MobileNavbar from "@/components/top-bar/mobile-navbar.vue";
export default {
components: { MobileNavbar },
data() {
return {
isCollapse: true,
lableWidth: {
'width': '150px'
},
arr: [
{
seq: "1",
itemDescription: "wqewq",
item: "13245",
sourceWarehouse: "324",
targetWarehouse: "cs",
state: "CLOSE",
applicationsQuantity: "324",
sumQuantity: "324",
isScan: "N",
}
],
isUse: false,
//wms_document_save: false,
formObj: {},
documentNo: "",
itemForm: {},
submitList: [],
inventoryList: [],
storageLocationList: "",
dialogItemType1FormVisible: false,
productionRequisitionDialogFetchFun: fetchProductionRequisitionList,
productionRequisitionDialogVisible: false,
productionRequisitionDialogObj: {
"condition": "documentNo",
tableColumn: [
{ prop: "documentNo", label: "单据" },
{
prop: "state", label: "状态", formatter: (row, column, cellValue, index) => {
if (cellValue == "SUBMIT") {
return "提交";
}
if (cellValue == "CLOSE") {
return "关闭";
}
}
}
]
},
storageLocationDialogVisible: false,
storageLocationDialogFetchFun: fetchStorageLocationList,
storageLocationDialogObj: {
"condition": "storageLocation",
tableColumn: [
{ prop: "storageLocation", label: "存储位置", width: "200" },
{ prop: "description", label: "描述" }
]
},
initData: {
documentNo: "",
itemList: [{
id: 1,
item: "213213213",
applicationsQuantity: "23",
sumQuantity: "12",
qty: "12",
itemDesc: '物料描述',
state: 'SUBMIT'
}],
site: getStore({ name: 'tenantId' })
},
};
},
created() {
//this.wms_document_save = this.permissions["wms_document_save"];
this.formObj = Object.assign({}, this.initData);
this.itemForm = Object.assign({}, { "inventoryList": [], "code": "" });
this.documentNo = "";
let activityId = this.$route.query.ACTIVITY_ID;
getByActivityOption(activityId, 'STORAGE_LOCATION').then(response => {
if (response.data.code != 0) {
return this.$message.error(response.data.msg);
}
this.storageLocationList = response.data.data.optionValue;
}).catch(e => {
console.log(e);
});
},
computed: {
...mapGetters(["permissions"]),
permissionList() {
return {};
}
},
methods: {
//存储区域弹出框
showStorageLocationDialog() {
let me = this;
me.storageLocationDialogVisible = true;
if (this.storageLocationList != "") {
this.storageLocationDialogFetchFun = getStorageLocationPageBycode;
this.storageLocationDialogObj.queryParam = { "str": this.storageLocationList };
} else {
this.storageLocationDialogObj.queryParam = { "erpStorageLocation": me.itemForm.targetWarehouse };
}
},
storageLocationSelect(row) {
let me = this;
me.itemForm.storageLocation = row.storageLocation;
},
//单据号弹出框
showProductionRequisitionDialog() {
let me = this;
me.productionRequisitionDialogVisible = true;
me.$refs.documentDialog.clear();
me.productionRequisitionDialogObj.queryParam = { "documentType": "STOR_REQUEST" };
},
productionRequisitionSelect(row) {
let me = this;
me.formObj.itemList = [];
me.submitList = [];
me.formObj.documentNo = row.documentNo;
me.documentNo = me.formObj.documentNo;
getDocumentDetail(me.formObj.documentNo).then(res => {
if (res.data.code == 0) {
for (let i = 0; i < res.data.data.length; i++) {
let obj = Object.assign({}, {
"item": res.data.data[i].item,
"applicationsQuantity": res.data.data[i].applicationsQuantity,
"documentNo": me.documentNo,
"isPack": res.data.data[i].isPack,
"itemDescription": res.data.data[i].itemDescription,
"seq": res.data.data[i].seq,
"sourceWarehouse": res.data.data[i].sourceWarehouse,
"targetWarehouse": res.data.data[i].targetWarehouse,
"unitOfMeasure": res.data.data[i].unitOfMeasure,
"itemGroup": res.data.data[i].itemGroup,
"state": res.data.data[i].state,
"handle": res.data.data[i].handle,
"documentType": res.data.data[i].documentType,
"storageLocation": res.data.data[i].storageLocation,
"inventoryList": [],
"sumQuantity": 0,
});
me.formObj.itemList.push(obj);
}
}
});
},
showItemDialog(row) {
//判断是物料类型弹出不同的表单
let me = this;
console.log(row);
//判断行项目是否已经关闭,关闭则不可扫描条码和保存
me.isUse = row.state === "CLOSE";
// if (me.submitList.length === 0) {
// me.loadSaveData(me.formObj.itemList[0]);
// }
me.reSetDialogList();
me.dialogItemType1FormVisible = true;
},
loadSaveData(row) {
let me = this;
getItemInventory({
documentNo: row.documentNo,
documentType: row.documentType,
}).then(res => {
if (res.data.code == 0 && res.data.data.length > 0) {
for (let row of me.formObj.itemList) {
let sumInventoryQty = 0, array = [], length = res.data.length;
for (let data of res.data.data) {
if (row.item === data.item) {
sumInventoryQty = add(sumInventoryQty, data.inventoryQty);
array.push({
"inventoryIdOrCarrier": data.inventoryIdOrCarrier,
"inventoryQty": data.inventoryQty,
"item": data.item,
"isScan": "N",
"seq": length--
});
}
}
if (array.length > 0) {
row.sumQuantity = sumInventoryQty;
row.inventoryList = array;
me.submitList.push(row);
}
}
me.reSetDialogList();
}
});
},
reSetDialogList() {
let me = this;
me.itemForm.inventoryList = [];
for (let itemForm of me.submitList) {
me.itemForm.inventoryList = me.itemForm.inventoryList.concat(itemForm.inventoryList);
}
},
//扫描单据号
scanProductionRequisitionOrder() {
let me = this;
let code = me.formObj.documentNo;
me.formObj.itemList = [];
me.submitList = [];
if (isBlank(code)) {
me.$message.error("不可扫描空条码");
return;
}
if (me.documentNo === code) {
me.$message.error("不可重复扫描");
return;
}
me.formObj.itemList = [];
me.submitList = [];
getDocumentDetail(me.formObj.documentNo).then(res => {
if (res.data.code == 0) {
if (res.data.data[0].documentType != "STOR_REQUEST") {
return me.$message.error("单据类型不是生产入库");
}
for (let i = 0; i < res.data.data.length; i++) {
let obj = Object.assign({}, {
"item": res.data.data[i].item,
"applicationsQuantity": res.data.data[i].applicationsQuantity,
"documentNo": me.formObj.documentNo,
"isPack": res.data.data[i].isPack,
"itemDescription": res.data.data[i].itemDescription,
"seq": res.data.data[i].seq,
"sourceWarehouse": res.data.data[i].sourceWarehouse,
"targetWarehouse": res.data.data[i].targetWarehouse,
"unitOfMeasure": res.data.data[i].unitOfMeasure,
"itemGroup": res.data.data[i].itemGroup,
"state": res.data.data[i].state,
"handle": res.data.data[i].handle,
"documentType": res.data.data[i].documentType,
"storageLocation": res.data.data[i].storageLocation,
"inventoryList": [],
"sumQuantity": 0,
});
me.formObj.itemList.push(obj);
me.documentNo = me.formObj.documentNo;
}
}
});
},
getInventoryList() {
let me = this;
let obj = Object.assign({}, {
"documentNo": me.documentNo,
"inventoryIdOrCarrier": me.itemForm.code
});
showLoading();
getFinishedProductQty(obj).then(res => {
hideLoading();
me.itemForm.code = "";
if (res.data.code == 0) {
//库存总数大于需求数量
let data = res.data.data;
let itemForm = me.formObj.itemList.find(o => o.item === data.item);
if (itemForm) {
if (add(data.inventoryQty, itemForm.sumQuantity) > itemForm.applicationsQuantity) {
me.$message.error("汇总数量大于需求数量");
return;
} else {
itemForm.sumQuantity = add(data.inventoryQty, itemForm.sumQuantity);
let obj = {
"inventoryIdOrCarrier": data.inventoryIdOrCarrier,
"inventoryQty": data.inventoryQty,
"item": data.item,
"isScan": "Y",
"seq": itemForm.inventoryList.length + 1
};
itemForm.inventoryList.unshift(obj);
me.itemForm.inventoryList.unshift(obj);
}
} else {
me.$message.error("条码物料不符合任意行项目");
}
}
}).catch(e => hideLoading());
},
//扫描条码
scanCode() {
let me = this;
let sum = 0;
if (isBlank(me.itemForm.code)) {
me.$message.error("不可扫描空条码");
return;
}
if (me.itemForm.inventoryList.length > 0) {
let index = me.itemForm.inventoryList.findIndex(o => o.inventoryIdOrCarrier === me.itemForm.code);
if (index >= 0) {
me.$message.error("不可重复扫描");
return;
}
this.getInventoryList();
} else {
this.getInventoryList();
}
},
submit() {
let me = this;
if (me.submitList.length > 0) {
if (me.submitList.length != me.formObj.itemList.length) {
me.$message.error("未执行所有行项目");
return;
}
for (let i = 0; i < me.submitList.length; i++) {
let list = me.submitList[i].inventoryList;
for (let j = 0; j < list.length; j++) {
if (list[j].isScan === "N") {
me.submitList[i].inventoryList.splice(j, 1);
}
}
}
showLoading();
submit(me.submitList).then(res => {
hideLoading();
if (res.data.code == 0) {
me.$message.success("提交成功");
me.doClear();
}
}).catch(() => {
hideLoading();
});
} else {
me.$message.error("没有可提交的行");
return;
}
},
saveItemType1() {
let me = this;
for (let row of me.formObj.itemList) {
if (row.sumQuantity !== row.applicationsQuantity) {
return me.$message.error("未全部扫描,请确认");
}
}
me.submitList = me.formObj.itemList.map(o => {
o.state = "SAVING";
return o;
});
me.dialogItemType1FormVisible = false;
},
//拒收
reject() {
let me = this;
if (isBlank(me.formObj.documentNo)) {
me.$message.error("请选择单据");
return;
}
console.log(me.formObj.documentNo);
rejectDocumentByNo(me.formObj.documentNo).then(res => {
if (res.data.code == 0) {
me.$message.success("拒收成功");
me.doClear();
}
});
},
//清除页面信息
doClear() {
this.formObj = Object.assign({}, this.initData);
this.itemForm = Object.assign({}, { "inventoryList": [], "sumQuantity": 0, "code": "" });
this.documentNo = "";
this.submitList = [];
},
//
delRow(index, row) {
let me = this;
//删除已扫描过条码中集合的信息
me.itemForm.inventoryList.splice(index, 1);
for (let i = 0; i < me.itemForm.inventoryList.length; i++) {
me.itemForm.inventoryList[i].seq = me.itemForm.inventoryList.length - i;
}
let itemForm = me.formObj.itemList.find(o => o.item === row.item);
index = itemForm.inventoryList.findIndex(o => o.inventoryIdOrCarrier === row.inventoryIdOrCarrier);
itemForm.inventoryList.splice(index, 1);
itemForm.sumQuantity -= row.inventoryQty;
itemForm.state = "SUBMIT";
},
},
};
</script>
<style scoped>
ul,
li {
margin: 0;
padding: 0;
list-style: none;
}
.searchIpt ::v-deep .el-form-item__content {
margin: 0 !important;
}
.card-container {
/* height: calc(100vh-10vh); */
height: calc(100vh - 220px);
background-color: transparent !important;
padding: 2px;
}
.card-container::-webkit-scrollbar,.card-info-container::-webkit-scrollbar {
display: none;
}
.card-info-container {
height: calc(100vh - 340px);
background-color: transparent !important;
overflow-y: scroll;
padding: 2px;
}
.text {
font-size: 14px;
display: block;
color: #afafaf;
}
.item {
margin-bottom: 18px;
}
.label {
position: relative;
}
.label::after {
content: '\2022';
color: #0202ff;
font-weight: bold;
position: absolute;
left: -10px;
top: 0;
}
.flex-between {
display: flex;
justify-content: space-between;
align-items: center;
margin-right: 15px;
}
.box-card {
margin-bottom: 10px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
}
</style>