diff --git a/src/i18n/lang/cn.ts b/src/i18n/lang/cn.ts index 7317420..a8a87a0 100644 --- a/src/i18n/lang/cn.ts +++ b/src/i18n/lang/cn.ts @@ -73,6 +73,7 @@ export default { po_PleaseScanMATcode: '请扫描物料条码', PleaseScan: '请扫描', po_PleaseInput: '请输入内容', + materials:'请全部退料', po_PleaseInputcar: '请输入周转车', po_PleaseSlect: '请选择库存地点', po_Detailed: 'PO单明细', @@ -88,6 +89,7 @@ export default { Materiel: '物料', po_MaterielDes: '物料描述', returned: '应退货数量', + returneds: '应退数量', quantity: '累计退货数量', po_DemandQuantity: '需求数量', DemandQuantity: '需求', diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index 3f2b281..2046b34 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -68,7 +68,9 @@ export default { po_ReceivingGoods: 'PO receive', po_ReturnGoods: 'DN return', returned: 'Quantity to be returned', + returneds: 'Quantity to be returned', quantity: 'Cumulative return quantity', + materials:'Please return all materials', po_OddNumbers: 'PO No', po_Supplier: 'Supplier', po_OrderType: 'Order type', diff --git a/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue b/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue index 3f1fb73..0a21a3d 100644 --- a/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue +++ b/src/pages/product/outbound/stoOutbound/DN-delivergoods.vue @@ -148,7 +148,7 @@ export default class stoOutboundDom extends BasePage { model.queryReturningTypeList(); this.form.orderNo = JSON.parse(sessionStorage.getItem('SweepCode')); sessionStorage.removeItem('SweepCode'); - if (!this.form.orderNo) { + if (this.form.orderNo == null) { return; } else { this.query(); diff --git a/src/pages/raw/ingoods/dnReturnGoods/Location.vue b/src/pages/raw/ingoods/dnReturnGoods/Location.vue index aa958bc..2d6bf7b 100644 --- a/src/pages/raw/ingoods/dnReturnGoods/Location.vue +++ b/src/pages/raw/ingoods/dnReturnGoods/Location.vue @@ -2,57 +2,90 @@ - + {{ $t('message.rawMenu_ReturnGoods') }} - - - - - - - {{ $t('message.return_Type') }}: - {{ some.poType }} + + + + + {{ $t('message.InventoryOrderNo') }}: + + + + {{ $t('message.Query') }} + - - {{ $t('message.po_ReturnGoodsQuantity') }}: - {{ some.poAmount }} + + + + {{ $t('message.CommissionedMaterielNo') }}: + + - - - - - {{ $t('message.CommissionedLocation') }}: - + + + + {{ $t('message.CommissionedMaterielDesc') }}: + {{ some.materialDesc }} + - - {{ $t('message.CommissionedThisNumber') }} - + + + + {{ $t('message.returneds') }}: + {{ some.poAmount }} + + + + + {{ $t('message.po_OrderType') }}: + {{ some.poType }} + + + + + + {{ $t('message.po_Supplier') }}: + {{ some.supplyCode }} + + + + + + + {{ $t('message.po_Location') }}: + + + + + {{ $t('message.total') }}: + + + + + + + + {{ $t('message.CommissionedLocation') }}: + + + + + {{ $t('message.CommissionedThisNumber') }}: + + + + + + {{ $t('message.product_add') }} + + + - - - {{ $t('message.product_add') }} - - - - - {{ $t('message.product_Location') }} - {{ $t('message.product_Number') }} - {{ $t('message.operation') }} - - - {{ item.wlCode }} - {{ item.qty }} - -
- {{ $t('message.product_Delete') }} -
-
-
-
@@ -61,14 +94,17 @@
+ {{ $t('message.detailed') }} + {{ $t('message.po_Submit') }} + {{ $t('message.po_Return') }} @@ -108,14 +144,17 @@ export default class RawReceiptDetail extends BasePage { * 页面Module */ model = model; + materialList:any = [] type = 'text'; wlCode: any = ''; + wl:any = {} border = true; //添加库位和数量的列表 LocationList: any = []; //库位 Location: any = []; some: any = {}; + someIndex:any = 0 qty: any = ''; /** * 表单数据 @@ -124,36 +163,21 @@ export default class RawReceiptDetail extends BasePage { // locationCode: null, amount: null, }; - index() { - this.toPage(this.page.raw.ingoods.dnReturnGoods.index); - } - /** - * 表单校验 - */ rules: VFormRules = { - // locationCode: [{ required: true, message: '请选择库存地点!' }], amount: [ { required: true, message: this.$t('message.Pi_tip1') as string }, - // { type: 'integer', min: 1, transform: Number, message: this.$t('message.Pi_tip2') as string }, ], }; - - /** - * 库存地点选择 - */ locationCodeSelect = false; - - /** - * 表头 - */ headers = headers; //页面初始化 async onReady() { - let means: any = JSON.parse(localStorage.getItem('__GWMS_APP_STATE_DATA__') as any); - let user: any = session.user; + await this.GetLocation() + } + async GetLocation(){ let content = { - loginName: means.session.user.loginName, - factoryCode: means.session.user.factoryCode, + loginName: session.loginName, + factoryCode: session.factoryCode, workArea: session.workareaCode, }; let res: any = await this.model.queryByFactory(content); @@ -165,20 +189,50 @@ export default class RawReceiptDetail extends BasePage { this.Location.push(pickerName); }); } + onUpload(){ + uni.navigateBack({delta:1}) + } + async query(){ + if(!this.form.documentNo){ + this.customToast(this.$t('message.Commission_tips1') as any); + return + } + await this.model.queryOrder(this.form.documentNo).then(() =>{ + if(this.model.code == '1'){ + this.model.dnReturnList.forEach((item:any) =>{ + let arr = { + label:item.materialCode, + value:item.materialCode + '(' + item.poLine + ')', + Line:item.poLine, + poNo:item.poNo, + } + this.materialList.push(arr) + }) + this.wl = this.materialList[0] + this.some = this.model.dnReturnList[0] + console.log('this.some',this.some) + } + }) + } + materialChoice(e:any){ + console.log('e',e) + this.model.dnReturnList.forEach((item:any,index:any) =>{ + if(item.poLine == e.pickerName.Line && item.materialCode == e.pickerName.label && item.poNo == e.pickerName.poNo){ + this.some = item + this.someIndex = index + } + }) + console.log('this.some',this.some) + console.log('this.someIndex',this.someIndex) + } //选择库位触发事件 LocationChoice(e: any) { this.wlCode = e.pickerName; } - //表格单选触发事件 - handleRow({ data }: any) { - this.LocationList = []; - this.qty = ''; - this.some = data[0].lineData; - } //添加触发事件 Add() { if (this.qty == '' || this.wlCode == '') { - this.customToast(this.$t('message.Commission_tips2') as any); + this.customToast(this.$t('message.Commission_tips2') as any); return; } if (parseFloat(this.qty) <= 0) { @@ -193,67 +247,86 @@ export default class RawReceiptDetail extends BasePage { this.customToast(this.$t('message.Commission_tips6') as any); return; } - let num: number = parseFloat(this.qty); - this.LocationList.forEach((item: any) => { - num += parseFloat(item.qty); - }); + let num: number = parseFloat(this.qty) + parseFloat(this.some.receiptAmount) if (num > parseFloat(this.some.poAmount)) { this.customToast(this.$t('message.dn_Tip2') as any); return; } let arr = { - wlCode: this.wlCode.label, - qty: this.qty, - Code: this.wlCode.sendSpot, + poNo:this.some.poNo, + poLine:this.some.poLine, + materialCode:this.some.materialCode, + loginName:this.session.loginName, + factoryCode:this.session.factoryCode, + wlCode:this.wlCode.label, + nowAmount:this.qty, }; + this.model.dnReturnList[this.someIndex].receiptAmount += parseFloat(this.qty) + console.log('this.model.dnReturnList',this.model.dnReturnList) this.LocationList.push(arr); - let TEM = { - wlCode: this.wlCode.label, - nowAmount: this.qty, - }; - this.some.list.push(TEM); this.qty = ''; } //删除某一项 触发事件 - deleteItem(index: any) { - this.LocationList.splice(index, 1); - this.some.list.splice(index, 1); + deleteItem(e: any) { + console.log('e',e.contentIndex) + console.log('eeeee',e) + uni.showModal({ + content:this.$t('message.product_Delete') as any, + cancelText:this.$t('message.Cancel') as any, + confirmText:this.$t('message.workArea_Confirm') as any, + success:(res) =>{ + if(res.confirm){ + this.LocationList.splice(e.contentIndex,1) + this.model.dnReturnList.forEach((item:any) =>{ + if(item.materialCode == e.lineData.materialCode && item.poLine == e.lineData.poLine && item.poNo == e.lineData.poNo){ + item.receiptAmount -= parseFloat(e.lineData.nowAmount) + } + }) + } else if(res.cancel){ + return + } + } + }) } appoint() { this.redirectTo(this.page.raw.ingoods.dnReturnGoods.Local); } - /** - * 提交 - */ async onSubmit() { - let num = 0; - this.some.list.forEach((item: any) => { - num += parseFloat(item.nowAmount); - }); - if (num != parseFloat(this.some.poAmount)) { - this.customToast(this.$t('message.actual') as any); - return; + let isTrue = true + this.model.dnReturnList.forEach((item:any) =>{ + if(item.receiptAmount != null || item.receiptAmount != 0){ + if(item.receiptAmount != item.poAmount){ + this.customToast(this.$t('message.materials') as any); + return isTrue = false + } + } + }) + if(isTrue){ + await this.model.submit(this.LocationList).then(() =>{ + if(this.model.code == '1'){ + this.materialList = [] + this.some = {} + this.someIndex = 0 + this.LocationList = [] + this.qty = '' + this.Location = [] + this.wl = {} + this.wlCode = '' + this.query() + this.GetLocation() + } + }) } - await this.model.submit({ - poNo: this.some.poNo, - loginName: session.loginName, - factoryCode: session.factoryCode, - materialCode: this.some.materialCode, - poLine: this.some.poLine, - list: this.some.list, - }); } }