diff --git a/src/pages/purchaseReturn/coms/comReturnDetailCard.vue b/src/pages/purchaseReturn/coms/comReturnDetailCard.vue
new file mode 100644
index 00000000..b8aa17a7
--- /dev/null
+++ b/src/pages/purchaseReturn/coms/comReturnDetailCard.vue
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫描
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/purchaseReturn/coms/comReturnJobCard.vue b/src/pages/purchaseReturn/coms/comReturnJobCard.vue
index 2495e1fa..854422c4 100644
--- a/src/pages/purchaseReturn/coms/comReturnJobCard.vue
+++ b/src/pages/purchaseReturn/coms/comReturnJobCard.vue
@@ -1,6 +1,9 @@
-
+
diff --git a/src/pages/purchaseReturn/coms/comScanReturnPack.vue b/src/pages/purchaseReturn/coms/comScanReturnPack.vue
new file mode 100644
index 00000000..826d8ad4
--- /dev/null
+++ b/src/pages/purchaseReturn/coms/comScanReturnPack.vue
@@ -0,0 +1,614 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/purchaseReturn/job/returnDetail.vue b/src/pages/purchaseReturn/job/returnDetail.vue
index 3c6f0907..73ee9054 100644
--- a/src/pages/purchaseReturn/job/returnDetail.vue
+++ b/src/pages/purchaseReturn/job/returnDetail.vue
@@ -5,20 +5,35 @@
-
-
-
-
-
-
+
+
+
+
+
@@ -29,14 +44,14 @@
-
+
-
-
+
+
+
@@ -59,13 +74,20 @@
import {
getInventoryStatusName
} from '@/common/directory.js';
+
+ import {
+ getDataSource
+ } from '@/pages/issue/js/issue.js';
import {
- getDataSource,
createRecordInfo,
calcHandleQty,
getScanCount
} from '@/common/detail.js';
+
+ import {
+ calc
+ } from '@/common/calc.js';
import {
getManagementPrecisions
@@ -73,18 +95,21 @@
import winScanButton from '@/mycomponents/scan/winScanButton.vue'
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
- import comDetailCard from "@/mycomponents/detail/comDetailCard.vue"
import returnDetailInfoPopup from '@/pages/purchaseReturn/coms/returnDetailInfoPopup.vue'
import jobTop from '@/mycomponents/job/jobTop.vue'
-
+ import comReturnDetailCard from '@/pages/purchaseReturn/coms/comReturnDetailCard.vue'
+ import comScanReturnPack from '@/pages/purchaseReturn/coms/comScanReturnPack.vue'
+
export default {
name: 'returnDetail',
components: {
winScanButton,
winScanPackAndLocation,
- comDetailCard,
+ comReturnDetailCard,
returnDetailInfoPopup,
- jobTop
+ jobTop,
+ comScanReturnPack
+
},
data() {
return {
@@ -95,7 +120,9 @@
detailSource: [], //绑定在页面上的数据源
businessTypeInfo: {},
managementList: [],
- jobStatus: ""
+ jobStatus: "",
+ poNumber:"",
+ fromLocationCode:""
};
},
onLoad(option) {
@@ -183,7 +210,9 @@
that.jobStatus = res.data.status
that.subList = res.data.subList;
that.toLocationCode = that.jobContent.toLocationCode
- that.detailSource = getDataSource(that.subList);
+ that.detailSource = getDataSource(that.detailSource,that.subList);
+ that.fromLocationCode =that.subList[0].fromLocationCode
+ that.poNumber =that.subList[0].poNumber
} else {
that.showMessage('列表数据为0');
}
@@ -193,210 +222,131 @@
this.showErrorMessage(error)
})
},
-
- calcHandleQty() {
- calcHandleQty(this.detailSource)
- this.continueScan()
- this.$forceUpdate();
- },
-
- calcScanCount(closeScan) {
- let items = this.subList.filter(r => {
- if (r.scaned) {
- return r;
- }
- })
- this.scanCount = items != null ? items.length : 0;
- if (this.scanCount == this.subList.length) {
- this.closeScanPopup();
- }
- },
-
- //继续扫描
- continueScan() {
- this.scanCount = getScanCount(this.subList);
- if (this.scanCount == this.subList.length) {
- this.closeScanPopup();
- } else {
- this.scanPopupGetFocus();
- }
+
+ closeScan() {
+ this.resizeCollapse();
},
-
- updateData() {
- this.calcHandleQty();
+
+ resizeCollapse() {
+ this.$nextTick(r => {
+ this.$refs.comIssueDetailCard.forEach(r => {
+ r.resizeCollapse();
+ })
+ });
},
- getScanResult(result) {
- try {
- var packingNumber = result.label.packingNumber;
- var batch = result.label.batch;
- var qty = result.label.qty;
- var itemCode = result.label.itemCode;
- var itemDetail = undefined;
- var detail = this.detailSource.find(r => r.itemCode == itemCode);
- if (detail == undefined) {
- this.showMessage("物料号【" + itemCode + "】不在列表中")
- } else {
- //箱码、批次、库位、
- itemDetail = detail.subList.find(r => {
- return r.packingNumber == packingNumber &&
- r.batch == batch &&
- r.fromLocationCode == result.fromLocationCode
- })
- // let balanceStatus = getInventoryStatusName(result.balance.inventoryStatus);
- //不存在提示
- if (itemDetail == undefined) {
- this.showErrorMessage("箱码【" + packingNumber + "】\n批次【" + batch + "】\n库位【" + result
- .fromLocationCode + "】\n未找到明细")
- return;
- } else {
- if (itemDetail.scaned) {
- this.showErrorMessage("箱码【" + packingNumber + "】\n批次【" + batch + "】\n库位【" + result
- .fromLocationCode + "】已经扫描")
- return;
- } else {
- itemDetail.scaned = true;
- itemDetail.handleQty = Number(result.label.qty);
-
- itemDetail.toInventoryStatus = itemDetail.inventoryStatus;
- itemDetail.balance = {
- packQty: Number(result.package.packQty),
- uom: result.package.uom
- }
- // itemDetail.balance = result.balance;
- // itemDetail.balance.balanceQty = Number(result.balance.qty);
- // itemDetail.balance.packQty = Number(result.package.packQty)
- // itemDetail.balance.packUnit = result.package.packUnit
- // itemDetail.toInventoryStatus = result.balance.inventoryStatus;
- // itemDetail.inventoryStatus =result.balance.inventoryStatus;
- // itemDetail.toInventoryStatus = result.balance.inventoryStatus;
- // itemDetail.inventoryStatus =result.balance.inventoryStatus;
- // itemDetail.balance = result.balance;
- // itemDetail.balance.balanceQty = Number(result.balance.qty);
- // itemDetail.balance.packQty = Number(result.package.packQty)
- // itemDetail.balance.packUnit = result.package.packUnit
- this.calcHandleQty();
- }
-
-
- // if (itemDetail == undefined) {
- // itemDetail = detail.subList.find(r => {
- // return r.packingNumber == packingNumber &&
- // r.batch == batch &&
- // r.fromLocationCode == result.fromLocationCode
- // })
- // if (itemDetail.scaned) {
- // this.showErrorMessage("箱码【" + packingNumber + "】\n批次【" + batch + "】\n库位【" + result
- // .fromLocationCode + "】\n状态【" + balanceStatus + "】\n已经扫描")
- // return;
- // }
-
- // let itemStatus = getInventoryStatusName(itemDetail.inventoryStatus);
- // if (this.jobContent.allowModifyInventoryStatus == "TRUE") {
- // this.showQuestionMessage('实际库存状态[' + balanceStatus + ']与推荐库存状态[' + itemStatus +
- // ']不一致,是否继续退货?', res => {
- // if (res) {
- // itemDetail.scaned = true;
- // itemDetail.handleQty = Number(result.balance.qty);
- // itemDetail.toInventoryStatus = result.balance.inventoryStatus;
- // itemDetail.inventoryStatus =result.balance.inventoryStatus;
- // itemDetail.balance = result.balance;
- // itemDetail.balance.balanceQty = result.balance.qty;
- // itemDetail.balance.packQty = result.package.packQty
- // itemDetail.balance.packUnit = result.package.packUnit
- // this.calcHandleQty();
- // } else {
- // this.scanPopupGetFocus();
- // }
- // });
- // } else {
- // this.showQuestionMessage('任务中不允许修改库存状态,实际库存状态[' + balanceStatus + ']与推荐库存状态[' +
- // itemStatus +
- // ']不一致,不允许转移!', res => {
- // this.scanPopupGetFocus();
- // });
- // }
- // } else {
- // // 箱码、批次、库位、状态一致
- // if (itemDetail.scaned) {
- // this.showErrorMessage("箱码【" + packingNumber + "】\n批次【" + batch + "】\n库位【" + result
- // .fromLocationCode + "】\n状态【" + balanceStatus + "】\n已经扫描")
- // return;
- // } else {
- // itemDetail.scaned = true;
- // itemDetail.handleQty = Number(result.balance.qty);
- // itemDetail.toInventoryStatus = result.balance.inventoryStatus;
- // itemDetail.inventoryStatus =result.balance.inventoryStatus;
- // itemDetail.balance = result.balance;
- // itemDetail.balance.balanceQty = Number(result.balance.qty);
- // itemDetail.balance.packQty = Number(result.package.packQty)
- // itemDetail.balance.packUnit = result.package.packUnit
- // this.calcHandleQty();
- // }
- // }
-
+ updateData(record) {
+ let requestLocation = this.detailSource.find(r => r.toLocationCode == record.toLocationCode);
+ let item = requestLocation.Items.find(r => r.itemCode == record.itemCode);
+ let itemHandleQty = 0;
+ if (item != undefined) {
+ item.Locations.forEach(l => {
+ let batch = l.Batchs.find(b => (b.packingNumber == record.packingNumber || b
+ .packingNumber == null || b.packingNumber == '') && b.batch ==
+ record.batch);
+ let handleQty = 0;
+ if (batch != undefined) {
+ batch.Records.forEach(res => {
+ handleQty = calc.add(handleQty, res.qty)
+ })
+ batch.handleQty = handleQty;
+ itemHandleQty = calc.add(itemHandleQty, handleQty)
}
-
- }
- this.scanPopupGetFocus();
- } catch (e) {
- this.showErrorMessage(e.message);
+ })
}
+ // item.handleQty=itemHandleQty;
},
-
- commit() {
- this.scanCount = getScanCount(this.subList);
- if (this.scanCount == 0) {
- this.showErrorMessage("扫描数为0,请先扫描")
- return;
- }
+
+ submit(){
+ uni.showLoading({
+ title: "提交中....",
+ mask: true
+ });
+ var params = this.setParams()
+ console.log("提交参数", JSON.stringify(params));
- //允许部分提交
- //扫描数量和任务数量相等,直接提交
- if (this.scanCount == this.subList.length) {
- this.checkCount();
- } else if (this.scanCount < this.subList.length) {
- //扫描数量小于任务数量,判断是否允许部分提交
- if (this.jobContent.allowPartialComplete == "TRUE") {
- //提交
- this.checkCount();
- } else {
- //不允许部分提交,提示
- this.$refs.comMessage.showErrorMessage("任务明细未全部完成,不允许部分提交!", res => {
- if (res) {
- this.openScanPopup();
- }
- });
- }
+ if (params.subList.length == 0) {
+ uni.hideLoading()
+ this.$refs.comMessage.showConfirmMessageModal('请扫描箱码')
+ return
+ }
+ if(!this.checkCount()){
+ uni.hideLoading()
+ return ;
}
+ this.submitJob()
},
checkCount(){
- // 提交的数量和任务数量不一致提示
- let str = ''
- this.detailSource.forEach((item) => {
- item.subList.forEach(cur => {
- if (cur.qty != cur.handleQty) {
- var tempHandleQty =0
- if(cur.handleQty){
- tempHandleQty=cur.handleQty
- }else {
- tempHandleQty =0
+ let str=""
+ let commitHint=""
+ this.detailSource.forEach(detail => {
+ detail.Items.forEach(item => {
+ var taskQty =0;
+ item.taskQty =calc.add(taskQty,item.qty)
+ var totalQty =0;
+ item.Locations.forEach(lco => {
+ lco.Batchs.forEach(batch => {
+ batch.Records.forEach(record => {
+ // if (batch.qty != record.qty) {
+ // var tempHandleQty = 0
+ // if (record.qty) {
+ // tempHandleQty = record.qty
+ // } else {
+ // tempHandleQty = 0
+ // }
+ // if (batch.qty != 0) {
+ // str +=
+ // `包装号【${record.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${batch.qty}】不一致\n`
+ // }
+ // }
+ if(record){
+ var hanleQty =record.qty?record.qty:0
+ totalQty = calc.add(totalQty,hanleQty)
+ }
+
+ })
+ })
+ })
+ //实际扫描的数量
+ item.totalQty =totalQty
+
+ })
+ })
+ //如果允许部分提交任务有扫描记录就可以直接提交;如果不允许部分执行,任务数量和提交数量不一致给出提示
+ this.detailSource.forEach(detail=>{
+ detail.Items.forEach(item=>{
+ if(this.jobContent.allowPartialComplete=="FALSE"){
+ if(item.taskQty!=item.totalQty){
+ str += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致\n`
+ }
+ }else {
+ //允许部分提交,提交的数量和任务数量不一致,提示
+ if(item.taskQty!=item.totalQty){
+ commitHint += `物料号【${item.itemCode}】任务数量【${item.taskQty}】与实际提交数量【${item.totalQty}】不一致,是否提交\n`
}
- str += `包装号【${cur.packingNumber}】提交数量【${tempHandleQty}】与任务物料数量【${cur.qty}】不一致`
}
})
})
- if (str) {
- str = '任务明细未全部完成,是否提交?\n'+str
- this.$refs.comMessage.showQuestionMessage1(str, 'red', res => {
- if (res) {
+
+ if(str){
+ str = '不允许提交\n' + str
+ this.showErrorMessage(str)
+ }
+
+ if(commitHint){
+ this.showQuestionMessage(commitHint,res=>{
+ if(res){
this.submitJob()
}
- });
- } else {
- this.submitJob()
+ })
+ }
+ if(str||commitHint){
+ return false
+ }else {
+ return true
}
+
},
submitJob() {
@@ -423,52 +373,49 @@
setParams() {
var subList = []
+ var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
-
- this.detailSource.forEach(item => {
- item.subList.forEach(detail => {
- if (detail.scaned) {
- detail.toPackingNumber = detail.packingNumber;
- detail.toContainerNumber = detail.containerNumber;
- detail.toBatch = detail.batch;
-
- detail.toLocationCode = detail.toLocationCode;
- subList.push(detail)
- }
+ this.detailSource.forEach(toLocationCode => {
+ toLocationCode.Items.forEach(item => {
+ item.Locations.forEach(fromLocation => {
+ fromLocation.Batchs.forEach(batch => {
+ let subItem = batch.detail;
+ subItem.handleQty =batch.handleQty
+ subItem.recordList = [];
+ if (batch.Records.length > 0) {
+ batch.Records.forEach(r => {
+ let record = {};
+ record.handleQty = r.qty;
+ record.toContainerNumber = r
+ .ContainerNumber;
+ record.inventoryStatus = r
+ .inventoryStatus;
+ record.toLocationCode = subItem
+ .toLocationCode;
+ record.supplierCode = r.supplierCode;
+
+ //使用在途库不改变管理模式
+ record.toPackingNumber = r
+ .packingNumber;
+ record.fromBatch = r.batch;
+ record.fromPackingNumber = r.packingNumber
+ subItem.recordList.push(record);
+ })
+ subList.push(subItem);
+ }
+ })
+ })
})
})
+
this.jobContent.subList = subList
+ this.jobContent.createTime = createTime;
this.jobContent.creator = creator;
return this.jobContent;
},
- openScanPopup() {
- let fromlocationCode = '';
- let fromlocationList = [];
- for (var i = 0; i < this.detailSource.length; i++) {
- let item = this.detailSource[i];
- item.subList.forEach(l => {
- //重复的库位不往里面插入
- var location = fromlocationList.find(res => res == l.fromLocationCode)
- if (location == undefined) {
- fromlocationList.push(l.fromLocationCode);
- }
- //来源库位赋默认值
- if (fromlocationCode == '') {
- if (!l.scaned) {
- fromlocationCode = l.fromLocationCode;
- }
- }
- })
- }
-
- this.$refs.scanPopup.openScanPopupForJob(fromlocationCode, fromlocationList, this.jobContent);
- },
-
- closeScanPopup() {
- if(this.$refs.scanPopup){
- this.$refs.scanPopup.closeScanPopup();
- }
+ openScanDetailPopup() {
+ this.$refs.comScanIssuePack.openScanPopup(this.detailSource, this.jobContent);
},
scanPopupGetFocus() {
@@ -483,10 +430,6 @@
}
},
- openDetail(item) {
- this.$refs.jobDetailPopup.openPopup(item)
- },
-
showMessage(message) {
this.scanPopupLoseFocus();
this.$refs.comMessage.showMessage(message, res => {
@@ -517,7 +460,7 @@
},
showCommitSuccessMessage(number) {
- this.$refs.comMessage.showSuccessMessage('提交成功\n生成退货记录:' + number, res => {
+ this.$refs.comMessage.showSuccessMessage('提交成功\n生成退货记录\n' + number, res => {
navigateBack(1)
})
}
diff --git a/src/pages/purchaseReturn/job/returnDetail_0904.vue b/src/pages/purchaseReturn/job/returnDetail_0904.vue
new file mode 100644
index 00000000..3c6f0907
--- /dev/null
+++ b/src/pages/purchaseReturn/job/returnDetail_0904.vue
@@ -0,0 +1,530 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/purchaseReturn/job/returnJob_0904.vue b/src/pages/purchaseReturn/job/returnJob_0904.vue
new file mode 100644
index 00000000..97f80e7c
--- /dev/null
+++ b/src/pages/purchaseReturn/job/returnJob_0904.vue
@@ -0,0 +1,321 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/purchaseReturn/js/return.js b/src/pages/purchaseReturn/js/return.js
new file mode 100644
index 00000000..97b8b8b5
--- /dev/null
+++ b/src/pages/purchaseReturn/js/return.js
@@ -0,0 +1,111 @@
+ import {
+ calc
+ } from '@/common/calc.js';
+export function getDataSource(list, subList) {
+ for (var i = 0; i < subList.length; i++) {
+ let detail = subList[i];
+ var location = list.find(r =>
+ r.toLocationCode == detail.toLocationCode)
+ if (location == undefined) {
+ location = {
+ toLocationCode: detail.toLocationCode,
+ productionLineCode: detail.productionLineCode,
+ workStationCode: detail.workStationCode,
+ Items: []
+ }
+ list.push(location);
+ }
+ createDetailInfo(location, detail);
+ }
+ return list;
+}
+
+//树形结构:需求库位 -> 物料Items -> 库位 Locations-> 批次Batchs -> 记录Records
+export function createDetailInfo(location, detail) {
+ var item = location.Items.find(r =>
+ r.itemCode == detail.itemCode)
+ if (item == undefined) {
+ item = createItemInfo(detail);
+ location.Items.push(item)
+ } else {
+ item.qty = calc.add(item.qty,detail.qty)
+ //在物料下查找库位
+ let location = item.Locations.find(r => r.fromLocationCode == detail.fromLocationCode);
+ if (location == undefined) {
+ location = createLocationInfo(detail);
+ item.Locations.push(location);
+ } else {
+ //在库位下查找批次
+ let batch = location.Batchs.find(r => r.batch == detail.batch);
+ if (batch == undefined) {
+ let batch = createBatchInfo(detail);
+ location.Batchs.push(batch);
+ } else {
+ if (detail.packingNumber != "" && detail.packingNumber != null) {
+ batch.Recommends.push(detail);
+ }
+ }
+ }
+ }
+}
+
+export function createItemInfo(detail) {
+ let item = {
+ itemCode: detail.itemCode,
+ itemName: detail.itemName,
+ onTheWayLocationCode:detail.onTheWayLocationCode,
+ productionLineCode: detail.productionLineCode,
+ workStationCode: detail.workStationCode,
+ packQty: detail.packQty,
+ packUnit: detail.packUnit,
+ qty: detail.qty,
+ uom: detail.uom,
+ handleQty: 0,
+ Locations: []
+ }
+ let location = createLocationInfo(detail);
+ item.Locations.push(location);
+ return item;
+}
+
+export function createLocationInfo(detail) {
+ let location = {
+ fromLocationCode: detail.fromLocationCode,
+ qty: detail.qty,
+ uom: detail.uom,
+ handleQty: 0,
+ Batchs: []
+ }
+ let batch = createBatchInfo(detail);
+ location.Batchs.push(batch);
+ return location;
+}
+
+export function createBatchInfo(detail) {
+ let batch = {
+ detail: detail,
+ batch: detail.batch,
+ packingNumber: detail.packingNumber,
+ qty: detail.qty,
+ uom: detail.uom,
+ handleQty: 0,
+ Recommends: [],
+ Records: [],
+ }
+
+ //推荐到了箱码和批次
+ if (detail.packingNumber != "" && detail.packingNumber != null) {
+ batch.Recommends.push(detail);
+ }
+ return batch;
+}
+
+export function createRecordInfo(detail) {
+ var record = {}
+ detail.scaned = true;
+ // let record = JSON.parse(JSON.stringify(detail));
+ //克隆对象,深度克隆,防止双向绑定同一个变量
+ Object.assign(record, detail)
+ record.toLocationCode = this.toLocationCode;
+ return record;
+}