Browse Source

YT-2441修改支持数量

intex
李俊城 6 days ago
parent
commit
e1ddbc7bd3
  1. 239
      src/pages/deliver/job/deliverDetailBatch.vue
  2. 2
      src/pages/deliver/job/deliverJob.vue
  3. 168
      src/pages/productReceipt/coms/comProductDetailCardQty.vue
  4. 165
      src/pages/productReceipt/job/productReceiptDetail.vue

239
src/pages/deliver/job/deliverDetailBatch.vue

@ -30,9 +30,8 @@
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view v-for="(toLocation, index) in detailSource"> <view v-for="(toLocation, index) in detailSource">
<comDeliverDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent" <comDeliverDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent"
@updateData='updateData' :allowBiggerQty='allowBiggerQty'> @updateData='updateData' >
</comDeliverDetailCardBatch> </comDeliverDetailCardBatch>
<view class="split_line"></view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@ -129,6 +128,7 @@
toLocationCode: "", toLocationCode: "",
jobStatus: "", jobStatus: "",
allowBiggerQty:"TRUE",// allowBiggerQty:"TRUE",//
jobToLocationCode:""
}; };
}, },
@ -206,11 +206,38 @@
that.jobContent = res.data; that.jobContent = res.data;
that.jobStatus = res.data.status; that.jobStatus = res.data.status;
that.subList = res.data.subList; that.subList = res.data.subList;
that.subList.forEach(item=>{
item.recommend=true
})
// that.detailSource = res.data; // that.detailSource = res.data;
that.detailSource = getDataSourceBatch(that.subList) that.detailSource = getDataSourceBatch(that.subList)
that.toLocationCode = that.subList[0].toLocationCode that.toLocationCode = that.subList[0].toLocationCode
that.allowBiggerQty = res.data.allowBiggerQty; that.allowBiggerQty = res.data.allowBiggerQty;
that.resizeCollapse(); that.resizeCollapse();
var itemCodes = []
this.detailSource.forEach(item => {
itemCodes.push(item.itemCode)
item.scaned = false
})
this.jobToLocationCode=this.detailSource[0].subList[0].toLocationCode
getManagementPrecisions(itemCodes, this.jobToLocationCode, res => {
if (res.success) {
this.managementList = res.list;
//
this.detailSource.forEach(item => {
var manageInfo = this.managementList.find(r =>
r.itemCode == item.itemCode)
if (manageInfo) {
item.manageType = manageInfo
.ManagementPrecision
} else {
item.manageType = "BY_BATCH"
}
})
}
})
} else { } else {
that.showMessage('未获取到详情'); that.showMessage('未获取到详情');
} }
@ -232,9 +259,13 @@
}); });
}, },
getScanResult(result) {
var detail =this.detailSource.find(r => r.itemCode == result.label.itemCode);
if (detail == undefined) {
this.showErrorMessage("物料号【" + result.label.itemCode + "】不在列表中")
return;
}
getScanResult(result, managementTypeParams) {
this.managementType = managementTypeParams
let array1 = []// let array1 = []//
let array2 = []// let array2 = []//
this.detailSource.forEach(item=>{ this.detailSource.forEach(item=>{
@ -263,9 +294,13 @@
}else{ }else{
this.recommendQty = result.balance.qty this.recommendQty = result.balance.qty
} }
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){
if(detail.manageType == "BY_BATCH" ){
this.setDataBatch(result) this.setDataBatch(result)
}else{ }else if(detail.manageType == "BY_QUANTITY" ){
this.setDataQty(result)
}
else{
this.setData(result) this.setData(result)
} }
}, },
@ -293,6 +328,7 @@
var itemDetail = detail.subList.find(r => { var itemDetail = detail.subList.find(r => {
return r.batch == batch && return r.batch == batch &&
r.fromLocationCode == result.fromLocationCode r.fromLocationCode == result.fromLocationCode
&&!r.recommend
}) })
if (itemDetail == undefined) { if (itemDetail == undefined) {
var isExit; var isExit;
@ -439,6 +475,176 @@
this.showMessage(e.message) this.showMessage(e.message)
} }
}, },
setDataQty(result) {
try {
let that = this
this.balanceinfo = result.balance
var packingNumber = result.label.packingNumber;
var batch = result.label.batch;
var qty = result.label.qty;
var itemCode = result.label.itemCode;
var locationCode = result.fromLocationCode;
if (!result.balance) {
this.showMessage("没有库存余额")
return;
}
// var inventoryStatus = "OK";
var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else {
var itemDetail = detail.subList.find(r =>
r.fromLocationCode == result.fromLocationCode&&!r.recommend)
if (itemDetail == undefined) {
var isExit;
for (let subItem of detail.subList) {
var item;
// for (let pack of subItem.packList) {
// if (pack.batch == batch) {
// item = pack;
// isExit = pack;
// break;
// }
// }
// if (item != undefined) {
// subItem.scaned = true
// subItem.handleQty = 0;
// item = undefined
// }
}
if (isExit == undefined) {
// this.showErrorMessage("" + batch + "" + result
// .fromLocationCode + "")
detail.subList.push({
scaned:true,
fromLocationCode:this.fromLocationCode,
toLocationCode:this.toLocationCode,
batch:"",
handleQty:result.label.qty,
qty:0,
inventoryStatus:result.balance.inventoryStatus,
toLocation:result.balance.toLocation,
balance:result.balance,
balanceQty:result.balance.qty,
packQty:result.package.packQty,
packUnit:result.package.packUnit,
uom:result.balance.uom,
// packList:[{
// scaned : true,
// handleQty : Number(result.label.qty),
// toLocationCode : result.balance.toLocationCode,
// }]
})
detail.handleQty = 0
detail.qty = 0
detail.subList.forEach(item=>{
item.handleQty = item.handleQty || 0
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
detail.qty = calc.add(detail.qty,item.qty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
setTimeout(r => {
that.resizeCollapse();
that.$forceUpdate()
}, 100)
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
// this.showMessage("" + batch + "")
} else {
isExit.scaned = true
let qty = 0;
if (result.balance != null) {
qty = Number(result.balance.qty);
} else {
qty = Number(result.label.qty);
}
isExit.handleQty = Number(result.label.qty);
isExit.toLocationCode = this.toLocationCode;
}
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.balance = result.balance,
detail.subList.forEach(item=>{
item.handleQty = item.handleQty || 0
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
// calcHandleQtyAdd(this.detailSource, result.label);
}
this.continueScan()
this.$forceUpdate()
} else {
var scanedLength = 0;
// itemDetail.packList.forEach(res => {
// if (res.scaned) {
// scanedLength++;
// }
// })
//
itemDetail.fromInventoryStatus = result.balance.inventoryStatus;
if (itemDetail.scaned ) {
// this.showMessage("" + packingNumber + "")
// calcHandleQtyAdd(this.detailSource, result.label);
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom,
itemDetail.handleQty = calc.add(itemDetail.handleQty,result.label.qty);
detail.handleQty = 0
detail.subList.forEach(item=>{
item.handleQty = item.handleQty || 0
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
})
} else {
itemDetail.scaned = true;
this.detailSource[0].subList.sort(compareAsc('scaned')); //
itemDetail.handleQty = result.label.qty;
itemDetail.scaned = true
itemDetail.balance=result.balance
itemDetail.balanceQty=result.balance.qty
itemDetail.uom=result.balance.uom
itemDetail.packQty=result.package.packQty
itemDetail.packUnit=result.package.packUnit
itemDetail.fromlocationCode=this.fromLocationCode
itemDetail.toLocationCode=this.toLocationCode
// itemDetail.toInventoryStatus = "OK"
// itemDetail.packList.forEach(pac => {
// pac.scaned = true
// pac.handleQty = Number(result.label.qty);
// pac.toLocationCode = result.balance.toLocationCode;
// })
detail.handleQty = 0
detail.subList.forEach(item=>{
item.handleQty = item.handleQty || 0
detail.handleQty = calc.add(detail.handleQty,item.handleQty)
// item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// })
})
// calcTreeHandleQty(this.detailSource);
this.continueScan()
this.$forceUpdate()
}
}
}
this.detailSource.forEach(item => {
item.subList.forEach(detail => {
detail.packingNumber = ''
})
})
} catch (e) {
this.showMessage(e.message)
}
},
// //
continueScan() { continueScan() {
this.scanCount = getScanCount(this.subList); this.scanCount = getScanCount(this.subList);
@ -547,7 +753,12 @@
detail.totalQty =calc.add(detail.totalQty,item.handleQty) detail.totalQty =calc.add(detail.totalQty,item.handleQty)
if(item.scaned){ if(item.scaned){
if(item.handleQty>item.balance.qty){ if(item.handleQty>item.balance.qty){
if(item.batch){
str2 += `物料号【${detail.itemCode}】批次【${item.batch}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}` str2 += `物料号【${detail.itemCode}】批次【${item.batch}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}`
}else {
str2 += `物料号【${detail.itemCode}】提交数量【${item.handleQty}】不可以大于库存数量【${item.balance.qty}`
}
} }
} }
}) })
@ -609,8 +820,6 @@
} }
var params = this.setParams() var params = this.setParams()
console.log("提交参数", params);
console.log("提交参数", params.subList);
// const isTrue = params.subList.some(item=>{ // const isTrue = params.subList.some(item=>{
// console.log(item.recordList.some(cur=>cur.scaned)) // console.log(item.recordList.some(cur=>cur.scaned))
// return item.recordList.some(cur=>cur.scaned) == true // return item.recordList.some(cur=>cur.scaned) == true
@ -662,13 +871,13 @@
obj1.toLocationCode = record.toLocationCode; obj1.toLocationCode = record.toLocationCode;
obj1.supplierCode = record.supplierCode; obj1.supplierCode = record.supplierCode;
obj1.uom = record.uom; obj1.uom = record.uom;
obj1.toPackingNumber =''; var info = getPackingNumberAndBatch(this.managementList, toLocationCode.itemCode,
obj1.packingNumber = '' record.packingNumber, record.batch);
obj1.fromPackingNumber = '';
obj1.toBatch = record.batch; obj1.toPackingNumber =info.packingNumber;
obj1.toPackingNumber = ''; obj1.packingNumber = info.packingNumber;
obj1.packingNumber = ''; obj1.fromPackingNumber = info.packingNumber;
obj1.fromPackingNumber =''; obj1.toBatch = info.batch;
obj = {...obj1} obj = {...obj1}
recordList.push(obj1) recordList.push(obj1)
}) })

2
src/pages/deliver/job/deliverJob.vue

@ -196,7 +196,7 @@
}, },
openJobDetail(item) { openJobDetail(item) {
getManagementPrecisions([item.itemCode], item.fromLocationCode, ret => { getManagementPrecisions([item.itemCode], item.toLocationCode, ret => {
if (ret.success) { if (ret.success) {
this.managementList = ret.list; this.managementList = ret.list;
this.managementType = this.managementList&&this.managementList[0]&&this.managementList[0].ManagementPrecision this.managementType = this.managementList&&this.managementList[0]&&this.managementList[0].ManagementPrecision

168
src/pages/productReceipt/coms/comProductDetailCardQty.vue

@ -0,0 +1,168 @@
<template>
<view class="" style="background-color: #fff;">
<uni-collapse ref="collapse1" @change="">
<uni-collapse-item :open="true">
<template v-slot:title>
<itemCompareQty :dataContent="dataContent" :handleQty="dataContent.handleQty"></itemCompareQty>
</template>
<view class="" v-for="(item,index) in dataContent.subList" :key="index">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,item)"
:right-options="item.scaned?scanOptions:detailOptions">
<recommend :detail="item" :isShowFromLocation="false"
:isShowToLocation="settingParam.allowModifyLocation=='TRUE'"></recommend>
</uni-swipe-action-item>
</uni-swipe-action>
<view v-if="item.fgList!=undefined && item.fgList.length>0" class="card_view "
style="margin-left: 20px;" v-for="(fg, index) in item.fgList" :key="index">
<com-fg-card :detail='fg' class="scan_view"></com-fg-card>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
<recommend-qty-edit ref="receiptEdit" :dataContent="editItem" :settingParam="settingParam" @confirm="confirm" :isNumTips='isNumTips'>
</recommend-qty-edit>
<win-scan-location ref="scanLocationCode" title="目标库位" @getLocation='getLocation'
:locationAreaTypeList="locationAreaTypeList"></win-scan-location>
<productDetailInfoPopup ref="jobDetailPopup" :dataContent="showItem"></productDetailInfoPopup>
<comMessage ref="message"></comMessage>
</view>
</template>
<script>
import itemCompareQty from '@/mycomponents/item/itemCompareQty.vue'
import recommend from '@/mycomponents/recommend/recommend.vue'
import recommendQtyEdit from '@/mycomponents/qty/recommendQtyEdit.vue'
import jobDetailPopup from '@/mycomponents/detail/jobDetailPopup.vue'
import productDetailInfoPopup from '@/pages/productReceipt/coms/productDetailInfoPopup.vue'
import winScanLocation from "@/mycomponents/scan/winScanLocation.vue"
import comFgCard from "@/pages/productReceipt/coms/comFgCard.vue"
import {
getDetailOption,
getPurchaseReceiptOption
} from '@/common/array.js';
export default {
components: {
itemCompareQty,
recommend,
recommendQtyEdit,
jobDetailPopup,
productDetailInfoPopup,
winScanLocation,
comFgCard
},
props: {
dataContent: {
type: Object,
default: null
},
settingParam: {
type: Object,
default: null
},
locationAreaTypeList: {
type: Array,
default: null
},
isNumTips: {
type: Boolean,
default: true
},
},
watch: {
dataContent: {
handler(newName, oldName) {
if (this.dataContent.subList.length > 0) {
if (this.$refs.collapse1 != undefined && this.$refs.collapse1 != null) {
this.$nextTick(res => {
this.$refs.collapse1.resize()
})
}
}
},
immediate: true,
deep: true
}
},
data() {
return {
showItem: {},
editItem: {
record: {
}
},
locatonItem: {},
detailOptions: [],
scanOptions: []
}
},
mounted() {
if (this.detailOptions.length == 0) {
this.detailOptions = getDetailOption();
}
if (this.scanOptions.length == 0) {
this.scanOptions = getPurchaseReceiptOption(this.settingParam.allowModifyQty, this.settingParam
.allowModifyLocation)
}
},
methods: {
swipeClick(e, item) {
if (e.content.text == "详情") {
this.detail(item)
} else if (e.content.text == "编辑") {
this.edit(item)
} else if (e.content.text == "库位") {
this.showLocation(item)
} else if (e.content.text == "移除") {
this.remove(item)
}
},
edit(item) {
this.editItem = item;
this.$refs.receiptEdit.openTaskEditPopup(item.qty, item.handleQty, item.labelQty);
},
showLocation(item) {
this.locatonItem = item;
this.$refs.scanLocationCode.openScanPopup();
},
//
getLocation(location, code) {
this.locatonItem.toLocationCode = code;
this.$emit('updateData')
},
detail(item) {
this.showItem = item;
this.$refs.jobDetailPopup.openPopup(item)
},
remove(item) {
this.$refs.message.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
item.scaned = false
item.handleQty = null
item.fgList=[]
this.$forceUpdate()
this.$emit('remove', item)
}
});
},
confirm(qty) {
this.editItem.handleQty = qty;
this.$emit('updateData')
}
}
}
</script>
<style>
</style>

165
src/pages/productReceipt/job/productReceiptDetail.vue

@ -28,7 +28,7 @@
</view> </view>
<view class="cell_info"> <view class="cell_info">
<view class="text_lightblue">班次</view> <view class="text_lightblue">班次</view>
<view style="line-height: 32rpx;" > <view style="line-height: 32rpx;">
{{jobContent.shiftName}} {{jobContent.shiftName}}
</view> </view>
</view> </view>
@ -36,19 +36,23 @@
</view> </view>
</view> </view>
</view> </view>
<view class="page-main"> <view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll"> <scroll-view scroll-y="true" class="page-main-scroll">
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> <view class="detail-list" v-for="(item, index) in detailSource" :key="item.id">
<view class=""> <view class="">
<comProductDetailCardBatch :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData" :isNumTips='false'
:locationAreaTypeList='toLocationAreaTypeList' v-if="managementType=='BY_BATCH'">
</comProductDetailCardBatch>
<comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false" <comProductDetailCard :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData" @remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList'
:locationAreaTypeList='toLocationAreaTypeList' v-else> v-if="item.manageType=='BY_PACKAGING'">
</comProductDetailCard> </comProductDetailCard>
<comProductDetailCardBatch :dataContent="item" :settingParam="jobContent"
:isShowLocation="false" @remove="updateData" @updateData="updateData" :isNumTips='false'
:locationAreaTypeList='toLocationAreaTypeList' v-if="item.manageType=='BY_BATCH'">
</comProductDetailCardBatch>
<comProductDetailCardQty :dataContent="item" :settingParam="jobContent" :isShowLocation="false"
@remove="updateData" @updateData="updateData" :locationAreaTypeList='toLocationAreaTypeList'
v-if="item.manageType=='BY_QUANTITY'">
</comProductDetailCardQty>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@ -70,7 +74,8 @@
</view> </view>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
<win-scan-pack ref="scanPopup" @getResult='getScanResult' :title="'制品标签'" headerType="HMQ" :isNoSearchPackage='isNoSearchPackage'></win-scan-pack> <win-scan-pack ref="scanPopup" @getResult='getScanResult' :title="'制品标签'" headerType="HMQ"
:isNoSearchPackage='isNoSearchPackage'></win-scan-pack>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
@ -117,6 +122,7 @@
import jobTop from '@/mycomponents/job/jobTop.vue' import jobTop from '@/mycomponents/job/jobTop.vue'
import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue" import comProductDetailCard from "@/pages/productReceipt/coms/comProductDetailCard.vue"
import comProductDetailCardBatch from "@/pages/productReceipt/coms/comProductDetailCardBatch.vue" import comProductDetailCardBatch from "@/pages/productReceipt/coms/comProductDetailCardBatch.vue"
import comProductDetailCardQty from "@/pages/productReceipt/coms/comProductDetailCardQty.vue"
export default { export default {
@ -128,7 +134,8 @@
winScanPack, winScanPack,
jobTop, jobTop,
comProductDetailCard, comProductDetailCard,
comProductDetailCardBatch comProductDetailCardBatch,
comProductDetailCardQty
}, },
data() { data() {
return { return {
@ -142,13 +149,13 @@
detailSource: [], // detailSource: [], //
toLocationAreaTypeList: [], toLocationAreaTypeList: [],
managementList: [], managementList: [],
managementType:'', managementType: '',
jobStatus: "", jobStatus: "",
jobToLocationCode: "", jobToLocationCode: "",
status: '', status: '',
scanMessage: "", scanMessage: "",
productionLineCode: "", productionLineCode: "",
isNoSearchPackage:false isNoSearchPackage: false
}; };
}, },
onLoad(option) { onLoad(option) {
@ -159,7 +166,7 @@
this.id = option.id; this.id = option.id;
this.scanMessage = option.scanMessage; this.scanMessage = option.scanMessage;
this.status = option.status || '' this.status = option.status || ''
this.isNoSearchPackage=option.isNoSearchPackage this.isNoSearchPackage = option.isNoSearchPackage
}, },
onShow() { onShow() {
@ -233,15 +240,15 @@
} else { } else {
if (res.data.subList.length > 0) { if (res.data.subList.length > 0) {
that.jobContent = res.data; that.jobContent = res.data;
console.log(344,that.jobContent.allowModifyLocation) console.log(344, that.jobContent.allowModifyLocation)
that.subList = res.data.subList; that.subList = res.data.subList;
that.jobStatus = res.data.status; that.jobStatus = res.data.status;
that.jobToLocationCode = that.subList[0].toLocationCode; that.jobToLocationCode = that.subList[0].toLocationCode;
that.productionLineCode = that.jobContent.subList[0].productionLineCode; that.productionLineCode = that.jobContent.subList[0].productionLineCode;
var valiDate = getSwitchInfoByCode("semiProductReceipCommitValidate") var valiDate = getSwitchInfoByCode("semiProductReceipCommitValidate")
if(valiDate){ if (valiDate) {
that.jobContent.allowModifyLocation = 'TRUE' that.jobContent.allowModifyLocation = 'TRUE'
}else{ } else {
that.jobContent.allowModifyLocation = 'FALSE' that.jobContent.allowModifyLocation = 'FALSE'
} }
that.toLocationCode = that.subList[0].toLocationCode that.toLocationCode = that.subList[0].toLocationCode
@ -259,8 +266,18 @@
getManagementPrecisions(itemCodes, that.jobToLocationCode, res => { getManagementPrecisions(itemCodes, that.jobToLocationCode, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
this.managementType = this.managementList.some(item => item.ManagementPrecision == //
'BY_BATCH') ? 'BY_BATCH' : '' this.detailSource.forEach(item => {
var manageInfo = this.managementList.find(r =>
r.itemCode == item.itemCode)
if (manageInfo) {
item.manageType = manageInfo
.ManagementPrecision
} else {
item.manageType = "BY_BATCH"
}
})
} }
}) })
} else { } else {
@ -279,11 +296,11 @@
mask: true mask: true
}); });
const res1 = await getNumberForStatus(result.label.requestNumber) const res1 = await getNumberForStatus(result.label.requestNumber)
if(res1.data == 5){ if (res1.data == 5) {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage(`该品番对应的申请【${result.label.requestNumber}】已关闭`) this.showErrorMessage(`该品番对应的申请【${result.label.requestNumber}】已关闭`)
return return
}else if(res1.data == 8){ } else if (res1.data == 8) {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage(`该品番对应的生产任务【${result.label.requestNumber}】已经完成`) this.showErrorMessage(`该品番对应的生产任务【${result.label.requestNumber}】已经完成`)
return return
@ -295,19 +312,23 @@
var qty = label.qty; var qty = label.qty;
var itemCode = label.itemCode; var itemCode = label.itemCode;
var detail = this.detailSource.find(r => r.itemCode == itemCode); var detail = this.detailSource.find(r => r.itemCode == itemCode);
if (detail == undefined) { if (detail == undefined) {
this.showErrorMessage("物料号【" + itemCode + "】不在列表中") this.showErrorMessage("物料号【" + itemCode + "】不在列表中")
} else { } else {
//
detail.scaned = true detail.scaned = true
var itemDetail = detail.subList.find(r => var itemDetail;
r.batch == batch); //
if (itemDetail == undefined) { if (detail.manageType == "BY_PACKAGING") {
this.showErrorMessage("批次[" + batch + "]不在任务列表中") itemDetail = detail.subList.find(r =>
} else { r.itemCode == itemCode &&
r.batch == batch &&
r.packingNumber == packingNumber);
if (itemDetail) {
if (itemDetail.scaned) { if (itemDetail.scaned) {
// this.showErrorMessage("[" + batch + "]") this.showErrorMessage("包装[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中")
itemDetail.handleQty = calc.add(Number(result.label.qty),itemDetail.handleQty);
} else { } else {
itemDetail.scaned = true; itemDetail.scaned = true;
itemDetail.handleQty = Number(result.label.qty); itemDetail.handleQty = Number(result.label.qty);
@ -316,20 +337,61 @@
this.continueScan() this.continueScan()
this.$forceUpdate() this.$forceUpdate()
} }
calcHandleQty(this.detailSource);
} else {
this.showErrorMessage("包装[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中")
}
} else if (detail.manageType == "BY_BATCH") {
itemDetail = detail.subList.find(r =>
r.itemCode == itemCode &&
r.batch == batch);
if (itemDetail) {
if (itemDetail.scaned) {
itemDetail.handleQty = calc.add(Number(result.label.qty), itemDetail.handleQty);
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.label.qty);
itemDetail.labelQty = Number(result.label.qty);
this.continueScan()
this.$forceUpdate()
}
calcHandleQty(this.detailSource); calcHandleQty(this.detailSource);
} else {
this.showErrorMessage("批次[" + batch + "]不在任务列表中")
} }
} else if (detail.manageType == "BY_QUANTITY") {
itemDetail = detail.subList.find(r =>
r.itemCode == itemCode);
if (itemDetail) {
if (itemDetail.scaned) {
itemDetail.handleQty = calc.add(Number(result.label.qty), itemDetail.handleQty);
} else {
itemDetail.scaned = true;
itemDetail.handleQty = Number(result.label.qty);
itemDetail.labelQty = Number(result.label.qty);
this.continueScan()
this.$forceUpdate()
}
calcHandleQty(this.detailSource);
} else {
this.showErrorMessage("包装[" + packingNumber + "]" + "批次[" + batch + "]不在任务列表中")
}
}
} }
}, },
// //
continueScan() { continueScan() {
this.scanCount = getScanCount(this.subList);
if (this.scanCount == this.subList.length) {
this.closeScanPopup();
} else {
this.scanPopupGetFocus(); this.scanPopupGetFocus();
} // this.scanCount = getScanCount(this.subList);
// if (this.scanCount == this.subList.length) {
// this.closeScanPopup();
// } else {
// this.scanPopupGetFocus();
// }
}, },
@ -384,11 +446,11 @@
} }
var valiDate = getSwitchInfoByCode("semiProductReceipCommitValidate") var valiDate = getSwitchInfoByCode("semiProductReceipCommitValidate")
// //
if(valiDate){ if (valiDate) {
if (!this.checkLocation()) { if (!this.checkLocation()) {
return return
} }
}else{ } else {
this.toLocationCode = this.jobToLocationCode this.toLocationCode = this.jobToLocationCode
} }
// //
@ -399,16 +461,17 @@
await getManagementPrecisions(itemCodes, this.toLocationCode, res => { await getManagementPrecisions(itemCodes, this.toLocationCode, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
this.managementType = this.managementList&& this.managementList[0]&& this.managementList[0].ManagementPrecision ? this.managementList[0].ManagementPrecision : 'BY_PACKAGING' this.managementType = this.managementList && this.managementList[0] && this
.managementList[0].ManagementPrecision;
} }
}) })
// //
if (this.scanCount == this.subList.length) { if (this.scanCount == this.subList.length) {
if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){ if (this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY') {
if (this.checkCountBatch()) { if (this.checkCountBatch()) {
this.submitJob(); this.submitJob();
} }
}else{ } else {
if (this.checkCount()) { if (this.checkCount()) {
this.submitJob(); this.submitJob();
} }
@ -417,11 +480,11 @@
// //
if (this.jobContent.allowPartialComplete == "TRUE") { if (this.jobContent.allowPartialComplete == "TRUE") {
// //
if(this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY'){ if (this.managementType == 'BY_BATCH' || this.managementType == 'BY_QUANTITY') {
if (this.checkCountBatch()) { if (this.checkCountBatch()) {
this.submitJob(); this.submitJob();
} }
}else{ } else {
if (this.checkCount()) { if (this.checkCount()) {
this.submitJob(); this.submitJob();
} }
@ -445,7 +508,8 @@
var subItem = item.subList[i] var subItem = item.subList[i]
if (calc.sub(subItem.handleQty, subItem.qty) < 0) { if (calc.sub(subItem.handleQty, subItem.qty) < 0) {
isCheck = false; isCheck = false;
hint = "包装【" + subItem.packingNumber + "】实际收货数量:[" + subItem.handleQty + "]与包装数量[" + subItem.qty + hint = "包装【" + subItem.packingNumber + "】实际收货数量:[" + subItem.handleQty + "]与包装数量[" + subItem
.qty +
"]不相等,是否继续收货?" "]不相等,是否继续收货?"
break break
} }
@ -462,7 +526,7 @@
return isCheck; return isCheck;
}, },
checkCountBatch(){ checkCountBatch() {
var isCheck = true; var isCheck = true;
var hint = "" var hint = ""
for (var i = 0; i < this.detailSource.length; i++) { for (var i = 0; i < this.detailSource.length; i++) {
@ -470,9 +534,9 @@
let handleQty = 0 let handleQty = 0
for (var j = 0; j < item.subList.length; j++) { for (var j = 0; j < item.subList.length; j++) {
var subItem = item.subList[j] var subItem = item.subList[j]
handleQty = calc.add(handleQty,subItem.handleQty) handleQty = calc.add(handleQty, subItem.handleQty)
} }
if(parseFloat(handleQty)<parseFloat(item.qty)){ if (parseFloat(handleQty) < parseFloat(item.qty)) {
hint = "物料号【" + item.itemCode + "】实际收货数量【" + handleQty + "】小于任务的收货数量【" + item.qty + "】,\n" hint = "物料号【" + item.itemCode + "】实际收货数量【" + handleQty + "】小于任务的收货数量【" + item.qty + "】,\n"
isCheck = false; isCheck = false;
} }
@ -490,7 +554,7 @@
} }
console.log(isCheck) console.log(isCheck)
if (!isCheck) { if (!isCheck) {
this.showQuestMessage(hint+'对于未收货部分将创建一个新的收货任务?', res => { this.showQuestMessage(hint + '对于未收货部分将创建一个新的收货任务?', res => {
if (res) { if (res) {
this.submitJob(); this.submitJob();
} }
@ -512,17 +576,16 @@
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
let params = this.setParams(); let params = this.setParams();
console.log("提交参数", JSON.stringify(params));
productReceiptJobsubmit(params).then(res => { productReceiptJobsubmit(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {
var hint = "" var hint = ""
if(params.type=='predict'){ if (params.type == 'predict') {
hint="提交成功\n生成补给品收货记录\n" +res.data hint = "提交成功\n生成补给品收货记录\n" + res.data
}else if(params.type=='assemble'){ } else if (params.type == 'assemble') {
hint="提交成功\n生成号口品收货记录\n" +res.data hint = "提交成功\n生成号口品收货记录\n" + res.data
}else { } else {
hint="提交成功\n生成收货记录\n" hint = "提交成功\n生成收货记录\n"
} }
this.showCommitSuccessMessage(hint) this.showCommitSuccessMessage(hint)
} else { } else {

Loading…
Cancel
Save