diff --git a/src/common/detail.js b/src/common/detail.js
index fdec3f45..bd53cc38 100644
--- a/src/common/detail.js
+++ b/src/common/detail.js
@@ -187,6 +187,7 @@ export function calcHandleNewQty(detailSource) {
item.handleQty = new Decimal(0).toNumber();
// item.qty = new Decimal(0).toNumber();
for (let detail of item.subList) {
+ detail.handleQty = detail.handleQty || new Decimal(0).toNumber();
if (detail ) {
if (!detail.isRecommend && detail.scaned) {
item.handleQty = calc.add(item.handleQty, detail.handleQty);
diff --git a/src/mycomponents/detail/comRecommendDetailCard.vue b/src/mycomponents/detail/comRecommendDetailCard.vue
index a3b56d0b..038a11c6 100644
--- a/src/mycomponents/detail/comRecommendDetailCard.vue
+++ b/src/mycomponents/detail/comRecommendDetailCard.vue
@@ -18,7 +18,7 @@
推
荐
-
+
@@ -27,12 +27,9 @@
实
际
-
-
+
-
-
@@ -109,6 +106,10 @@
type: Boolean,
default: true
},
+ formLocationTitle: {
+ type: String,
+ default: '库位'
+ },
},
watch: {
dataContent: {
diff --git a/src/mycomponents/recommend/recommend.vue b/src/mycomponents/recommend/recommend.vue
index 664d0e83..80b9d516 100644
--- a/src/mycomponents/recommend/recommend.vue
+++ b/src/mycomponents/recommend/recommend.vue
@@ -7,7 +7,7 @@
-->
-
+
@@ -90,6 +90,10 @@
type: String,
default: '库位'
},
+ formLocationTitle: {
+ type: String,
+ default: '来源库位'
+ },
},
watch: {
diff --git a/src/pages/purchaseReturn/job/returnDetailBatch.vue b/src/pages/purchaseReturn/job/returnDetailBatch.vue
index a891213e..8e7121ec 100644
--- a/src/pages/purchaseReturn/job/returnDetailBatch.vue
+++ b/src/pages/purchaseReturn/job/returnDetailBatch.vue
@@ -22,9 +22,13 @@
-
-
+
+
+
+
+
+
@@ -42,9 +46,8 @@
-
-
-
+
+
@@ -70,14 +73,16 @@
getInventoryStatusName
} from '@/common/directory.js';
- import {
- getDataSource
- } from '@/pages/issue/js/issue.js';
+ // import {
+ // getDataSource
+ // } from '@/pages/issue/js/issue.js';
import {
createRecordInfo,
calcHandleQty,
- getScanCount
+ getScanCount,
+ getDataSource,
+ calcHandleNewQty,
} from '@/common/detail.js';
import {
@@ -96,6 +101,7 @@
import comReturnDetailCardBatch from '@/pages/purchaseReturn/coms/comReturnDetailCardBatch.vue'
import comScanReturnPack from '@/pages/purchaseReturn/coms/comScanReturnPack.vue'
import comScanReturnPackBatch from '@/pages/purchaseReturn/coms/comScanReturnPackBatch.vue'
+ import comRecommendDetailCard from "@/mycomponents/detail/comRecommendDetailCard.vue"
export default {
name: 'returnDetail',
@@ -107,7 +113,8 @@
jobTop,
comScanReturnPack,
comScanReturnPackBatch,
- comReturnDetailCardBatch
+ comReturnDetailCardBatch,
+ comRecommendDetailCard
},
data() {
@@ -201,7 +208,7 @@
mask: true
});
- getPurchasereturnJobDetail(that.id).then(res => {
+ getPurchasereturnJobDetail(that.id).then(async res => {
uni.hideLoading();
if (res.data == null) {
that.showMessage('未获取到详情');
@@ -211,28 +218,14 @@
that.jobStatus = res.data.status
that.subList = res.data.subList;
that.toLocationCode = that.jobContent.toLocationCode
- that.detailSource = getDataSource(that.detailSource,that.subList);
+ that.subList.forEach(item=>{
+ item.isRecommend = true
+ })
+ that.detailSource = await getDataSource(that.subList)
+ console.log(222,that.detailSource)
that.fromLocationCode =that.subList[0].fromLocationCode
that.poNumber =that.subList[0].poNumber
- //获取管理模式,封装参数
- var itemCodes = []
- res.data.subList.forEach(item => {
- itemCodes.push(item.itemCode)
- item.scaned = false
- })
- getManagementPrecisions(itemCodes, that.fromLocationCode, ret => {
- if (ret.success) {
- this.managementList = ret.list;
- this.managementType = this.managementList.some(item => item.ManagementPrecision ==
- 'BY_BATCH') ? 'BY_BATCH' : ''
- if (this.managementType == 'BY_BATCH') {
- that.detailSource = res.data
- } else {
- that.detailSource = getDataSource(that.detailSource, that.subList);
- }
- }
- })
} else {
that.showMessage('列表数据为0');
}
@@ -254,109 +247,183 @@
// })
// });
},
-
- updateData(record) {
-
- if(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)
- // }
- // })
- // item.handleQty=itemHandleQty;
- // }
- // this.$forceUpdate()
- }else {
- //计算扫描数量
- 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(record){
- var handleQty =record.qty?record.qty:0
- totalQty = calc.add(totalQty,handleQty)
- }
-
- })
- })
- })
- //实际扫描的数量
- item.handleQty =totalQty
- })
- })
+getScanResult(result, managementPrecision) {
+ console.log(33, result, managementPrecision)
+ if (managementPrecision == 'BY_QUANTITY') {
+ result.label.batch = ''
+ this.setDataBatch(result)
+ } else if (managementPrecision == 'BY_BATCH') {
+ this.setDataBatch(result)
+ } else {
+ this.setData(result)
}
-
- //
},
-
- submit(){
- uni.showLoading({
- title: "提交中....",
- mask: true
- });
- var params = this.setParams()
- console.log("提交参数", JSON.stringify(params));
-
- if (params.subList.length == 0) {
- uni.hideLoading()
- this.$refs.comMessage.showConfirmMessageModal('请扫描箱码')
- return
- }
- if(!this.checkCount()){
- uni.hideLoading()
- return ;
+ setDataBatch(result) {
+ try {
+ var packingNumber = result.balance.packingNumber;
+ var batch = result.label.batch;
+ var qty = result.balance.qty;
+ var itemCode = result.balance.itemCode;
+ var locationCode = result.balance.locationCode;
+ var inventoryStatus = result.balance.inventoryStatus;
+ var detail = this.detailSource.find(r => r.itemCode == itemCode);
+
+ console.log(999, detail.subList)
+ if (detail == undefined) {
+ this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
+ } else {
+ var itemDetail = detail.subList.find(r => {
+ return r.batch == batch &&
+ r.fromLocationCode == result.fromLocationCode &&
+ r.isRecommend == false
+ })
+ if (itemDetail == undefined) {
+ var newAdd = {
+ itemCode: itemCode,
+ packingNumber: packingNumber,
+ batch: batch,
+ handleQty: Number(result.label.qty),
+ qty: detail.qty,
+ fromLocationCode: locationCode,
+ inventoryStatus: inventoryStatus,
+ toInventoryStatus: inventoryStatus,
+ balance: result.balance,
+ isRecommend: false,
+ isNewAdd: "newAdd"
+ }
+ newAdd.balance.balanceQty = Number(result.balance.qty);
+ newAdd.balance.packQty = Number(result.package.packQty)
+ newAdd.balance.packUnit = result.package.packUnit
+ newAdd.scaned = true;
+ detail.subList.push(newAdd)
+ } else {
+ if (itemDetail.scaned) {
+ itemDetail.handleQty = calc.add(itemDetail.handleQty, Number(result.label.qty));
+ // this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result
+ // .fromLocationCode + "】已经扫描")
+ }else{
+ itemDetail.scaned = true;
+ itemDetail.handleQty= Number(result.label.qty)
+ }
+ }
+ this.calcHandleQty();
+ }
+ } catch (e) {
+ this.showMessage(e.message)
}
- this.submitJob()
},
-
- checkCount(){
- let str=""
- let commitHint=""
- this.detailSource.subList.forEach(item => {
- if (this.jobContent.allowPartialComplete == "FALSE") {
- if (item.qty != item.handleQty) {
- str += `物料号【${item.itemCode}】实际提交数量【${item.handleQty}】与任务数量【${item.qty}】不一致\n`
- }
+ setData(result) {
+ try {
+ var packingNumber = result.balance.packingNumber;
+ var batch = result.balance.batch;
+ var qty = result.balance.qty;
+ var itemCode = result.balance.itemCode;
+ var locationCode = result.balance.locationCode;
+ var inventoryStatus = result.balance.inventoryStatus;
+ var detail = this.detailSource.find(r => r.itemCode == itemCode);
+
+ if (detail == undefined) {
+ this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
- //允许部分提交,提交的数量和任务数量不一致,提示
- if (item.qty != item.handleQty) {
- commitHint += `物料号【${item.itemCode}】实际提交数量【${item.handleQty}】与任务数量【${item.qty}】不一致,是否提交?\n`
+ var itemDetail = detail.subList.find(r => {
+ return r.packingNumber == packingNumber &&
+ r.batch == batch &&
+ r.fromLocationCode == result.fromLocationCode &&
+ r.isRecommend == false
+ })
+ if (itemDetail == undefined) {
+ var newAdd = {
+ itemCode: itemCode,
+ packingNumber: packingNumber,
+ batch: batch,
+ handleQty: detail.qty < Number(result.balance.qty) ? detail.qty : Number(result.balance.qty),
+ qty: detail.qty,
+ fromLocationCode: locationCode,
+ inventoryStatus: inventoryStatus,
+ toInventoryStatus: inventoryStatus,
+ balance: result.balance,
+ isRecommend: false,
+ isNewAdd: "newAdd"
+ }
+ newAdd.balance.balanceQty = Number(result.balance.qty);
+ newAdd.balance.packQty = Number(result.package.packQty)
+ newAdd.balance.packUnit = result.package.packUnit
+ newAdd.scaned = true;
+ detail.subList.push(newAdd)
+ this.calcHandleQty();
+ } else {
+ if (itemDetail.scaned) {
+ this.showErrorMessage("箱码【" + packingNumber + "】,批次【" + batch + "】库位【" + result
+ .fromLocationCode + "】已经扫描")
+ }
}
}
- })
- if(str){
- str = '不允许提交\n' + str
- this.showErrorMessage(str)
+ } catch (e) {
+ this.showMessage(e.message)
}
-
- if(commitHint){
- this.showQuestionMessage(commitHint,res=>{
- if(res){
- this.submitJob()
+ },
+ calcHandleQty() {
+ calcHandleNewQty(this.detailSource)
+ // this.continueScan()
+ this.$forceUpdate();
+ },
+ updateData() {
+ //删除新添加的
+ for (var i = 0; i < this.detailSource.length; i++) {
+ var item = this.detailSource[i]
+ for (var j = 0; j < item.subList.length; j++) {
+ var sub = item.subList[j]
+ if (!sub.isRecommend && !sub.scaned) {
+ item.subList.splice(j, 1)
}
- })
+ }
}
- if(str||commitHint){
- return false
- }else {
- return true
+ this.calcHandleQty();
+ },
+ submit(){
+ this.checkCount()
+ // uni.showLoading({
+ // title: "提交中....",
+ // mask: true
+ // });
+ // var params = this.setParams()
+ // console.log("提交参数", JSON.stringify(params));
+
+ // if (params.subList.length == 0) {
+ // uni.hideLoading()
+ // this.$refs.comMessage.showConfirmMessageModal('请扫描箱码')
+ // return
+ // }
+ },
+
+ checkCount(){
+ // 提交的数量和任务数量不一致提示
+ let str = ''
+ let num = 0
+ this.detailSource.forEach((item) => {
+ if (item.qty != item.handleQty) {
+ str += `物料号【${item.itemCode}】任务数量【${item.qty}】与实际提交数量【${item.handleQty}】不一致`
}
+ item.subList.forEach((cur,key)=>{
+ if(cur.isRecommend == false && cur.handleQty){
+ num++
+ }
+ })
+ })
+ if(!num){
+ this.$refs.comMessage.showConfirmMessageModal('请扫描箱码')
+ return
+ }
+ if (str) {
+ str = str + '\n是否提交?'
+ this.$refs.comMessage.showQuestionMessage1(str, 'red', res => {
+ if (res) {
+ this.submitJob()
+ }
+ });
+ } else {
+ this.submitJob()
+ }
},
@@ -366,8 +433,10 @@
mask: true
});
var itemCodes = []
- this.detailSource.subList.forEach(cur => {
- itemCodes.push(cur.itemCode)
+ this.detailSource.forEach(item => {
+ item.subList.forEach(cur => {
+ itemCodes.push(cur.itemCode)
+ })
})
//获取管理模式,封装参数
getManagementPrecisions(itemCodes, this.fromLocationCode, res => {
@@ -395,38 +464,35 @@
var subList = []
var createTime = getCurrDateTime();
var creator = this.$store.state.user.id
- this.detailSource.subList.forEach(r => {
- if (r.scaned) {
- let subItem = {
- ...r
+ this.detailSource.forEach(item => {
+ item.subList.forEach(detail => {
+ if (detail.scaned && !detail.isRecommend) {
+ detail.recordList = []
+ let record = {};
+ record.handleQty = detail.qty;
+ record.toContainerNumber = detail
+ .ContainerNumber;
+ record.inventoryStatus = detail
+ .inventoryStatus;
+ record.toLocationCode = item
+ .toLocationCode;
+ record.supplierCode =detail.supplierCode;
+ //使用在途库不改变管理模式
+ var info = getPackingNumberAndBatch(this.managementList, detail.itemCode,
+ record.packingNumber, detail.batch);
+ detail.toPackingNumber = info.packingNumber;
+ detail.packingNumber = info.packingNumber;
+ detail.fromPackingNumber = info.packingNumber;
+ record.toPackingNumber = info.packingNumber;
+ record.packingNumber = info.packingNumber;
+ record.fromPackingNumber = info.packingNumber;
+ record.fromBatch = detail.batch;
+ record.fromPackingNumber = detail.packingNumber
+ detail.recordList.push(record);
+ subList.push(deepCopyData(detail))
}
- subItem.recordList = []
- let record = {};
- record.handleQty = r.qty;
- record.toContainerNumber = r
- .ContainerNumber;
- record.inventoryStatus = r
- .inventoryStatus;
- record.toLocationCode = subItem
- .toLocationCode;
- record.supplierCode = r.supplierCode;
-
- //使用在途库不改变管理模式
- var info = getPackingNumberAndBatch(this.managementList, r.itemCode,
- record.packingNumber, r.batch);
- subItem.toPackingNumber = info.packingNumber;
- subItem.packingNumber = info.packingNumber;
- subItem.fromPackingNumber = info.packingNumber;
- record.toPackingNumber = info.packingNumber;
- record.packingNumber = info.packingNumber;
- record.fromPackingNumber = info.packingNumber;
- record.fromBatch = r.batch;
- record.fromPackingNumber = r.packingNumber
- subItem.recordList.push(record);
- subList.push(deepCopyData(subItem));
- }
+ })
})
-
this.jobContent.subList = subList
this.jobContent.createTime = createTime;
this.jobContent.creator = creator;
@@ -434,7 +500,27 @@
},
openScanDetailPopup() {
- this.$refs.comScanReturnPackBatch.openScanPopup(this.detailSource, this.jobContent);
+ let fromlocationCode = '';
+ let fromlocationList = [];
+ console.log(this.detailSource)
+ 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;
+ }
+ }
+ })
+ }
+ console.log(fromlocationCode, fromlocationList, this.jobContent)
+ this.$refs.scanPopup.openScanPopupForJob(fromlocationCode, fromlocationList, this.jobContent);
},
scanPopupGetFocus() {
diff --git a/src/pages/purchaseReturn/job/returnJob.vue b/src/pages/purchaseReturn/job/returnJob.vue
index 86572ea5..db559076 100644
--- a/src/pages/purchaseReturn/job/returnJob.vue
+++ b/src/pages/purchaseReturn/job/returnJob.vue
@@ -190,9 +190,8 @@
getManagementPrecisions([item.itemCode], item.fromLocationCode, ret => {
if (ret.success) {
this.managementList = ret.list;
- this.managementType = this.managementList.some(cur => cur.ManagementPrecision == 'BY_BATCH') ?
- 'BY_BATCH' : ''
- if (this.managementType == 'BY_BATCH') {
+ this.managementType = this.managementList&& this.managementList[0]&& this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : ''
+ if (this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY') {
uni.navigateTo({
url: './returnDetailBatch?id=' + item.masterId + '&status=' + item.status+'&title='+this.title
});
diff --git a/src/pages/unPlanned/job/issueJobDetail.vue b/src/pages/unPlanned/job/issueJobDetail.vue
index bba58a3a..cc885f8c 100644
--- a/src/pages/unPlanned/job/issueJobDetail.vue
+++ b/src/pages/unPlanned/job/issueJobDetail.vue
@@ -8,7 +8,8 @@
目的地
- {{jobContent.destination}}
+ {{jobContent.destination}}
@@ -18,8 +19,8 @@
-
+
@@ -27,8 +28,7 @@