Browse Source

修改发料添加供应商代码

intex
lijuncheng 5 days ago
parent
commit
e0668bc2f0
  1. 635
      src/pages/issue/job/issueDetailBatch.vue
  2. 6
      src/pages/issue/record/directIssueByBatch.vue

635
src/pages/issue/job/issueDetailBatch.vue

@ -8,17 +8,16 @@
<work-station :workshopCode="jobContent.workShopCode" <work-station :workshopCode="jobContent.workShopCode"
:productionLineCode="jobContent.detailProductionLineCode" :productionLineCode="jobContent.detailProductionLineCode"
:workStationCode="jobContent.detailWorkStationCode" :workStationCode="jobContent.detailWorkStationCode"
:rawLocationCode="jobContent.detailToLocationCode" :rawLocationCode="jobContent.detailToLocationCode" :itemGroup="jobContent.itemGroup"
:itemGroup="jobContent.itemGroup" :isShowItemGroup='true'> :isShowItemGroup='true'>
</work-station> </work-station>
</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 v-for="(toLocation, index) in detailSource"> <view v-for="(toLocation, index) in detailSource">
<comIssueDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation" :settingParam="jobContent" <comIssueDetailCardBatch ref='comIssueDetailCardBatch' :dataContent="toLocation"
@updateData='updateData' :settingParam="jobContent" @updateData='updateData'>
>
</comIssueDetailCardBatch> </comIssueDetailCardBatch>
<view class="split_line"></view> <view class="split_line"></view>
</view> </view>
@ -40,11 +39,11 @@
<!-- <com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData' <!-- <com-scan-issue-pack ref="comScanIssuePack" @closeScan='closeScan' @updateData='updateData'
@afterScan='afterScan' :locationCode='fromLocationCode'> @afterScan='afterScan' :locationCode='fromLocationCode'>
</com-scan-issue-pack> --> </com-scan-issue-pack> -->
<winScanPackAndLocation :balanceFromInventoryStatuses="true" ref="scanPopup" <winScanPackAndLocation :balanceFromInventoryStatuses="true" ref="scanPopup" @getResult='getScanResult'
@getResult='getScanResult' :noShowBalanceMessage="false" @confirm='confirmFromLocation'> :noShowBalanceMessage="false" @confirm='confirmFromLocation'>
</winScanPackAndLocation> </winScanPackAndLocation>
<balance-select ref="balanceSelect" ></balance-select> <balance-select ref="balanceSelect"></balance-select>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
</view> </view>
</template> </template>
@ -75,8 +74,8 @@
import { import {
calc calc
} from '@/common/calc.js'; } from '@/common/calc.js';
import { import {
getDataSourceBatch, getDataSourceBatch,
getTreeDataSource, getTreeDataSource,
@ -84,7 +83,7 @@
getScanCount, getScanCount,
getThreeDataSource getThreeDataSource
} from '@/common/detail.js'; } from '@/common/detail.js';
import { import {
calcHandleQtyAdd calcHandleQtyAdd
} from '@/common/record.js'; } from '@/common/record.js';
@ -124,7 +123,7 @@
scanMessage: '', scanMessage: '',
managementList: [], managementList: [],
managementType: "", managementType: "",
fromLocationCode:'' fromLocationCode: ''
}; };
}, },
@ -223,12 +222,12 @@
that.subList = res.data.subList; that.subList = res.data.subList;
that.detailSource = getDataSourceBatch(that.subList) that.detailSource = getDataSourceBatch(that.subList)
that.jobContent.detailToLocationCode = res.data.subList[0].toLocationCode that.jobContent.detailToLocationCode = res.data.subList[0].toLocationCode
that.toLocationCode= res.data.subList[0].toLocationCode that.toLocationCode = res.data.subList[0].toLocationCode
that.fromLocationCode = that.subList[0].fromLocationCode that.fromLocationCode = that.subList[0].fromLocationCode
that.detailSource.forEach(r => { that.detailSource.forEach(r => {
r.subList.forEach(s => { r.subList.forEach(s => {
s.isRecommTaskItem = true// s.isRecommTaskItem = true //
}) })
}) })
// //
@ -266,213 +265,213 @@
this.resizeCollapse(); this.resizeCollapse();
}, },
getScanResult(result, managementTypeParams) { getScanResult(result, managementTypeParams) {
if(!result.package.number){ if (!result.package.number) {
this.showErrorMessage("包装号不能为空") this.showErrorMessage("包装号不能为空")
return; return;
} }
this.managementType = managementTypeParams this.managementType = managementTypeParams
let array1 = []// let array1 = [] //
let array2 = []// let array2 = [] //
this.detailSource.forEach(item=>{ this.detailSource.forEach(item => {
item.subList.forEach(cur=>{ item.subList.forEach(cur => {
array1.push(cur.fromLocationCode) array1.push(cur.fromLocationCode)
array2.push(cur.batch) array2.push(cur.batch)
}) })
}) })
// //
const obj1 = array1.find(item=>item == result.fromLocationCode) const obj1 = array1.find(item => item == result.fromLocationCode)
const obj2 = array2.find(item=>item == result.label.batch) const obj2 = array2.find(item => item == result.label.batch)
if(this.jobContent.allowModifyLocation == 'FALSE'){ if (this.jobContent.allowModifyLocation == 'FALSE') {
if(!obj1){ if (!obj1) {
this.showErrorMessage(`不可以扫描推荐库位【${array1.join(',')}】以外的库位`) this.showErrorMessage(`不可以扫描推荐库位【${array1.join(',')}】以外的库位`)
return return
} }
} }
if(this.jobContent.allowModifyBatch == 'FALSE'){ if (this.jobContent.allowModifyBatch == 'FALSE') {
if(!obj2){ if (!obj2) {
this.showErrorMessage(`不可以扫描推荐批次【${array2.join(',')}】以外的批次`) this.showErrorMessage(`不可以扫描推荐批次【${array2.join(',')}】以外的批次`)
return return
} }
} }
if(!obj1){ if (!obj1) {
this.recommendQty = 0 this.recommendQty = 0
}else{ } else {
this.recommendQty = result.balance.qty this.recommendQty = result.balance.qty
} }
// this.managementType = managementTypeParams // this.managementType = managementTypeParams
if(managementTypeParams == "BY_BATCH" ||managementTypeParams == "BY_QUANTITY" ){ if (managementTypeParams == "BY_BATCH" || managementTypeParams == "BY_QUANTITY") {
this.setDataBatch(result) this.setDataBatch(result)
} }
}, },
setDataBatch11(result) { setDataBatch11(result) {
console.log(result) console.log(result)
try { try {
let that = this let that = this
this.balanceinfo = result.balance this.balanceinfo = result.balance
var packingNumber = result.label.packingNumber; var packingNumber = result.label.packingNumber;
var batch = result.label.batch; var batch = result.label.batch;
var qty = result.label.qty; var qty = result.label.qty;
var itemCode = result.label.itemCode; var itemCode = result.label.itemCode;
var locationCode = result.fromLocationCode; var locationCode = result.fromLocationCode;
if (!result.balance) { if (!result.balance) {
this.showMessage("没有库存余额") this.showMessage("没有库存余额")
return; return;
} }
// var inventoryStatus = "OK"; // var inventoryStatus = "OK";
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 {
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.packingNumber==packingNumber r.packingNumber == packingNumber
}) })
if (itemDetail == undefined) { if (itemDetail == undefined) {
var isExit; var isExit;
for (let subItem of detail.subList) { for (let subItem of detail.subList) {
var item; var item;
// for (let pack of subItem.packList) { // for (let pack of subItem.packList) {
// if (pack.batch == batch) { // if (pack.batch == batch) {
// item = pack; // item = pack;
// isExit = pack; // isExit = pack;
// break; // break;
// } // }
// } // }
// if (item != undefined) { // if (item != undefined) {
// subItem.scaned = true // subItem.scaned = true
// subItem.handleQty = 0; // subItem.handleQty = 0;
// item = undefined // item = undefined
// } // }
} }
if (isExit == undefined) { if (isExit == undefined) {
// this.showErrorMessage("" + batch + "" + result // this.showErrorMessage("" + batch + "" + result
// .fromLocationCode + "") // .fromLocationCode + "")
detail.subList.push({ detail.subList.push({
scaned:true, scaned: true,
packingNumber:packingNumber, packingNumber: packingNumber,
fromLocationCode:this.fromLocationCode, fromLocationCode: this.fromLocationCode,
toLocationCode:this.toLocationCode, toLocationCode: this.toLocationCode,
batch:result.label.batch, batch: result.label.batch,
handleQty:result.label.qty, handleQty: result.label.qty,
qty:0, qty: 0,
inventoryStatus:result.balance.inventoryStatus, inventoryStatus: result.balance.inventoryStatus,
toLocation:result.balance.toLocation, toLocation: result.balance.toLocation,
balance:result.balance, balance: result.balance,
balanceQty:result.balance.qty, balanceQty: result.balance.qty,
packQty:result.package.packQty, packQty: result.package.packQty,
packUnit:result.package.packUnit, packUnit: result.package.packUnit,
uom:result.balance.uom, uom: result.balance.uom,
isRecommTaskItem:false,// isRecommTaskItem: false, //
// packList:[{ // packList:[{
// scaned : true, // scaned : true,
// handleQty : Number(result.label.qty), // handleQty : Number(result.label.qty),
// toLocationCode : result.balance.toLocationCode, // toLocationCode : result.balance.toLocationCode,
// }] // }]
}) })
detail.handleQty = 0 detail.handleQty = 0
detail.qty = 0 detail.qty = 0
detail.subList.forEach(item=>{ detail.subList.forEach(item => {
item.handleQty =item.handleQty || 0 item.handleQty = item.handleQty || 0
detail.handleQty = calc.add(detail.handleQty,item.handleQty) detail.handleQty = calc.add(detail.handleQty, item.handleQty)
detail.qty = calc.add(detail.qty,item.qty) detail.qty = calc.add(detail.qty, item.qty)
// item.packList.forEach(cur=>{ // item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty) // cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// }) // })
}) })
setTimeout(r => { setTimeout(r => {
that.resizeCollapse(); that.resizeCollapse();
that.$forceUpdate() that.$forceUpdate()
}, 100) }, 100)
} else {
if (!isExit.cancleScanedHiht && isExit.scaned) {
// this.showMessage("" + batch + "")
} else { } else {
if (!isExit.cancleScanedHiht && isExit.scaned) { isExit.scaned = true
// this.showMessage("" + batch + "") let qty = 0;
if (result.balance != null) {
qty = Number(result.balance.qty);
} else { } else {
isExit.scaned = true qty = Number(result.label.qty);
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); isExit.handleQty = Number(result.label.qty);
detail.handleQty = 0 isExit.toLocationCode = this.toLocationCode;
detail.balance = result.balance, }
detail.subList.forEach(item=>{ itemDetail.handleQty = calc.add(itemDetail.handleQty, result.label.qty);
item.handleQty =item.handleQty || 0 detail.handleQty = 0
detail.handleQty = calc.add(detail.handleQty,item.handleQty) 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=>{ // item.packList.forEach(cur=>{
// cur.handleQty = calc.add(detail.handleQty,item.handleQty) // cur.handleQty = calc.add(detail.handleQty,item.handleQty)
// }) // })
}) })
// calcHandleQtyAdd(this.detailSource, result.label); // calcHandleQtyAdd(this.detailSource, result.label);
} }
this.continueScan() this.continueScan()
this.$forceUpdate() 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 => {
detail.handleQty = calc.add(detail.handleQty, item.handleQty)
})
} else { } else {
var scanedLength = 0; itemDetail.scaned = true;
// itemDetail.packList.forEach(res => { this.detailSource[0].subList.sort(compareAsc('scaned')); //
// if (res.scaned) { itemDetail.handleQty = result.label.qty;
// scanedLength++; 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.isRecommTaskItem = true //
// itemDetail.toInventoryStatus = "OK"
// itemDetail.packList.forEach(pac => {
// pac.scaned = true
// pac.handleQty = Number(result.label.qty);
// pac.toLocationCode = result.balance.toLocationCode;
// }) // })
// detail.handleQty = 0
itemDetail.fromInventoryStatus = result.balance.inventoryStatus; detail.subList.forEach(item => {
console.log(item.handleQty)
if (itemDetail.scaned ) { item.handleQty = item.handleQty || 0
// this.showMessage("" + packingNumber + "") detail.handleQty = calc.add(detail.handleQty, item.handleQty)
// calcHandleQtyAdd(this.detailSource, result.label); // item.packList.forEach(cur=>{
itemDetail.balance=result.balance // cur.handleQty = calc.add(detail.handleQty,item.handleQty)
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=>{
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.isRecommTaskItem = true//
// 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=>{ // calcTreeHandleQty(this.detailSource);
console.log(item.handleQty) this.continueScan()
item.handleQty =item.handleQty || 0 this.$forceUpdate()
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 => { // this.detailSource.forEach(item => {
// item.subList.forEach(detail => { // item.subList.forEach(detail => {
@ -483,70 +482,71 @@
this.showMessage(e.message) this.showMessage(e.message)
} }
}, },
setDataBatch(result) { setDataBatch(result) {
try { try {
let that = this let that = this
this.balanceinfo = result.balance this.balanceinfo = result.balance
var packingNumber = result.label.packingNumber; var packingNumber = result.label.packingNumber;
var batch = result.label.batch; var batch = result.label.batch;
var qty = result.label.qty; var qty = result.label.qty;
var itemCode = result.label.itemCode; var itemCode = result.label.itemCode;
var locationCode = result.fromLocationCode; var locationCode = result.fromLocationCode;
if (!result.balance) { if (!result.balance) {
this.showMessage("没有库存余额") this.showMessage("没有库存余额")
return; return;
} }
// var inventoryStatus = "OK"; // var inventoryStatus = "OK";
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 {
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.packingNumber==packingNumber r.packingNumber == packingNumber
}) })
// //
if (itemDetail == undefined) { if (itemDetail == undefined) {
var item ={ var item = {
scaned:true, scaned: true,
packingNumber:packingNumber, packingNumber: packingNumber,
fromLocationCode:this.fromLocationCode, fromLocationCode: this.fromLocationCode,
toLocationCode:this.toLocationCode, toLocationCode: this.toLocationCode,
batch:result.label.batch, batch: result.label.batch,
handleQty:result.label.qty, handleQty: result.label.qty,
qty:0, qty: 0,
inventoryStatus:result.balance.inventoryStatus, inventoryStatus: result.balance.inventoryStatus,
toLocation:result.balance.toLocation, toLocation: result.balance.toLocation,
balance:result.balance, balance: result.balance,
balanceQty:result.balance.qty, balanceQty: result.balance.qty,
packQty:result.package.packQty, packQty: result.package.packQty,
packUnit:result.package.packUnit, packUnit: result.package.packUnit,
uom:result.balance.uom, uom: result.balance.uom,
isRecommTaskItem:false,// isRecommTaskItem: false, //
} supplierCode: result.label.supplierCode
detail.subList.push(item)
//
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)
})
setTimeout(r => {
that.resizeCollapse();
that.$forceUpdate()
}, 100)
}else {
itemDetail.handleQty=calc.add(itemDetail.handleQty,result.label.qty)
} }
detail.subList.push(item)
//
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)
})
setTimeout(r => {
that.resizeCollapse();
that.$forceUpdate()
}, 100)
} else {
itemDetail.handleQty = calc.add(itemDetail.handleQty, result.label.qty)
}
} }
} catch (e) { } catch (e) {
this.showMessage(e.message) this.showMessage(e.message)
@ -561,7 +561,7 @@
this.scanPopupGetFocus(); this.scanPopupGetFocus();
} }
}, },
submit() { submit() {
uni.showLoading({ uni.showLoading({
title: "提交中....", title: "提交中....",
@ -589,23 +589,22 @@
submitJob() { submitJob() {
var params = this.setParams() var params = this.setParams()
// if (!params.subList || params.subList.length == 0) { // if (!params.subList || params.subList.length == 0) {
// uni.hideLoading() // uni.hideLoading()
// this.showErrorMessage("") // this.showErrorMessage("")
// return // return
// } // }
const isTrue = params.subList.some(item=>{ const isTrue = params.subList.some(item => {
return item.recordList.some(cur=>cur.scaned) == true return item.recordList.some(cur => cur.scaned) == true
}) })
if(!isTrue){ if (!isTrue) {
uni.hideLoading() uni.hideLoading()
this.showErrorMessage("请扫描您需要提交的发料任务") this.showErrorMessage("请扫描您需要提交的发料任务")
return return
} }
console.log("提交参数", params);
issueJobSubmit(params).then(res => { issueJobSubmit(params).then(res => {
uni.hideLoading() uni.hideLoading()
if (res.data) { if (res.data) {
@ -624,43 +623,47 @@
var creator = this.$store.state.user.id var creator = this.$store.state.user.id
this.detailSource.forEach(toLocationCode => { this.detailSource.forEach(toLocationCode => {
let arr = [] let arr = []
toLocationCode.subList.forEach(record=>{ toLocationCode.subList.forEach(record => {
if(record.scaned){ if (record.scaned) {
let obj = {...toLocationCode,...record} let obj = {
obj.recordList = [] ...toLocationCode,
delete obj.balance ...record
delete obj.subList }
let obj1 ={} obj.recordList = []
obj1.supplierCode = record.supplierCode; delete obj.balance
obj1.batch = record.batch; delete obj.subList
obj1.copyContent =record.copyContent; let obj1 = {}
obj1.fromInventoryStatus =record.fromInventoryStatus; obj1.supplierCode = record.supplierCode;
obj1.fromLocationCode =record.fromLocationCode; obj1.batch = record.batch;
obj1.handleQty =record.handleQty; obj1.copyContent = record.copyContent;
obj1.inventoryStatus =record.fromInventoryStatus; obj1.fromInventoryStatus = record.fromInventoryStatus;
obj1.packQty =record.packQty; obj1.fromLocationCode = record.fromLocationCode;
obj1.packUnit =record.packUnit; obj1.handleQty = record.handleQty;
obj1.packingNumber =record.packingNumber; obj1.inventoryStatus = record.fromInventoryStatus;
obj1.qty =record.qty; obj1.packQty = record.packQty;
obj1.scaned =record.scaned; obj1.packUnit = record.packUnit;
obj1.toLocationCode =record.toLocationCode; obj1.packingNumber = record.packingNumber;
obj1.fromPackingNumber =record.packingNumber; obj1.qty = record.qty;
obj1.fromBatch = record.batch; obj1.scaned = record.scaned;
obj1.toBatch = record.batch; obj1.toLocationCode = record.toLocationCode;
obj1.toInventoryStatus = record.inventoryStatus; obj1.fromPackingNumber = record.packingNumber;
obj1.toPackingNumber =""; obj1.fromBatch = record.batch;
obj1.packingNumber = ""; obj1.toBatch = record.batch;
obj1.toInventoryStatus = record.inventoryStatus;
let single_price = record.balance.singlePrice == null ? 0 : record.balance.singlePrice; obj1.toPackingNumber = "";
obj1.packingNumber = "";
obj1.singlePrice = single_price;
obj1.amount = single_price *record.qty; let single_price = record.balance.singlePrice == null ? 0 : record.balance
obj.recordList.push(obj1) .singlePrice;
subList.push(obj)
obj1.singlePrice = single_price;
obj1.amount = single_price * record.qty;
obj.recordList.push(obj1)
subList.push(obj)
} }
}) })
}) })
this.jobContent.subList = subList this.jobContent.subList = subList
this.jobContent.creator = creator; this.jobContent.creator = creator;
return this.jobContent; return this.jobContent;
@ -697,10 +700,10 @@
}, },
updateData(record) { updateData(record) {
this.detailSource.forEach(item=>{ this.detailSource.forEach(item => {
item.handleQty = 0 item.handleQty = 0
item.subList.forEach(cur=>{ item.subList.forEach(cur => {
item.handleQty = calc.add(cur.handleQty,item.handleQty) item.handleQty = calc.add(cur.handleQty, item.handleQty)
}) })
}) })
}, },
@ -709,33 +712,33 @@
this.resizeCollapse(); this.resizeCollapse();
// this.autoCommit() // this.autoCommit()
}, },
autoCommit(){ autoCommit() {
let str="" let str = ""
let str1="" let str1 = ""
let str2="" let str2 = ""
let str3="" let str3 = ""
let isTrue = true let isTrue = true
this.detailSource.forEach(detail=>{ this.detailSource.forEach(detail => {
var itemHandleQty=0 var itemHandleQty = 0
detail.subList.forEach(item=>{ detail.subList.forEach(item => {
// //
if(item.scaned){ if (item.scaned) {
itemHandleQty=calc.add(itemHandleQty,item.handleQty) itemHandleQty = calc.add(itemHandleQty, item.handleQty)
} }
}) })
if(itemHandleQty<detail.qty){ if (itemHandleQty < detail.qty) {
str += `物料号【${detail.itemCode}】提交数量【${detail.handleQty}】不允许小于任务数量【${detail.qty}\n` str += `物料号【${detail.itemCode}】提交数量【${detail.handleQty}】不允许小于任务数量【${detail.qty}\n`
} }
if(itemHandleQty>detail.qty){ if (itemHandleQty > detail.qty) {
str1 += `物料号【${detail.itemCode}】提交数量【${detail.handleQty}】不允许大于任务数量【${detail.qty}\n】` str1 += `物料号【${detail.itemCode}】提交数量【${detail.handleQty}】不允许大于任务数量【${detail.qty}\n】`
} }
}) })
if (this.jobContent.allowSmallerQty == "FALSE") { if (this.jobContent.allowSmallerQty == "FALSE") {
if (str) { if (str) {
str = '不允许提交\n' + str str = '不允许提交\n' + str
@ -750,15 +753,15 @@
return return
} }
} }
if (str2) { if (str2) {
str2 = '不允许提交\n' + str2 str2 = '不允许提交\n' + str2
this.showErrorMessage(str2) this.showErrorMessage(str2)
return return
} }
console.log(str3) console.log(str3)
if(str3){ if (str3) {
str3 = str3+"是否提交" str3 = str3 + "是否提交"
this.$refs.comMessage.showQuestionMessage1(str3, 'red', res => { this.$refs.comMessage.showQuestionMessage1(str3, 'red', res => {
if (res) { if (res) {
// //
@ -767,48 +770,50 @@
this.scanPopupGetFocus() this.scanPopupGetFocus()
} }
}); });
}else { } else {
// //
this.$throttle(this.submit, 2000, this)() this.$throttle(this.submit, 2000, this)()
} }
}, },
autoCommit11(){ autoCommit11() {
// this.$throttle(this.submit, 2000, this)() // this.$throttle(this.submit, 2000, this)()
// this.jobContent.allowSmallerQty = 'FALSE' // this.jobContent.allowSmallerQty = 'FALSE'
// this.jobContent.allowBiggerQty = 'FALSE' // this.jobContent.allowBiggerQty = 'FALSE'
let str="" let str = ""
let str1="" let str1 = ""
let str2="" let str2 = ""
let str3="" let str3 = ""
let isTrue = true let isTrue = true
this.detailSource.forEach(detail => { this.detailSource.forEach(detail => {
const isScaned = detail.subList.some(cur=>cur.scaned) const isScaned = detail.subList.some(cur => cur.scaned)
if(isScaned){ if (isScaned) {
if(parseFloat(detail.handleQty)<parseFloat(detail.qty)){ if (parseFloat(detail.handleQty) < parseFloat(detail.qty)) {
str += `物料号【${detail.itemCode}】提交数量【${detail.handleQty}】不允许小于任务数量【${detail.qty}\n` str += `物料号【${detail.itemCode}】提交数量【${detail.handleQty}】不允许小于任务数量【${detail.qty}\n`
} }
if(parseFloat(detail.handleQty)>parseFloat(detail.qty)){ if (parseFloat(detail.handleQty) > parseFloat(detail.qty)) {
str1 += `物料号【${detail.itemCode}】提交数量【${detail.handleQty}】不允许大于任务数量【${detail.qty}\n】` str1 += `物料号【${detail.itemCode}】提交数量【${detail.handleQty}】不允许大于任务数量【${detail.qty}\n】`
} }
} }
detail.subList.forEach(item => { detail.subList.forEach(item => {
if(item.scaned){ if (item.scaned) {
if(parseFloat(item.handleQty)>parseFloat(item.balance.qty)){ if (parseFloat(item.handleQty) > parseFloat(item.balance.qty)) {
str2 += `物料号【${detail.itemCode}】批次【${item.batch}】提交数量【${parseFloat(item.handleQty)}】不可以大于库存数量【${item.balance.qty}\n` str2 +=
`物料号【${detail.itemCode}】批次【${item.batch}】提交数量【${parseFloat(item.handleQty)}】不可以大于库存数量【${item.balance.qty}\n`
} }
} }
if(item.isRecommTaskItem){// if (item.isRecommTaskItem) { //
item.handleQty = item.handleQty || 0 item.handleQty = item.handleQty || 0
if(item.handleQty == 0 && isTrue){ if (item.handleQty == 0 && isTrue) {
isTrue = false isTrue = false
str3 = '推荐的箱码没扫,' str3 = '推荐的箱码没扫,'
} }
if(parseFloat(item.handleQty)!=parseFloat(item.qty)){ if (parseFloat(item.handleQty) != parseFloat(item.qty)) {
str3 += `物料号【${detail.itemCode}】批次【${item.batch}】扫描数量【${parseFloat(item.handleQty)}】和任务数量【${item.qty}】不一致\n` str3 +=
`物料号【${detail.itemCode}】批次【${item.batch}】扫描数量【${parseFloat(item.handleQty)}】和任务数量【${item.qty}】不一致\n`
} }
} }
}) })
}) })
@ -826,15 +831,15 @@
return return
} }
} }
if (str2) { if (str2) {
str2 = '不允许提交\n' + str2 str2 = '不允许提交\n' + str2
this.showErrorMessage(str2) this.showErrorMessage(str2)
return return
} }
console.log(str3) console.log(str3)
if(str3){ if (str3) {
str3 = str3+"是否提交" str3 = str3 + "是否提交"
this.$refs.comMessage.showQuestionMessage1(str3, 'red', res => { this.$refs.comMessage.showQuestionMessage1(str3, 'red', res => {
if (res) { if (res) {
// //
@ -843,7 +848,7 @@
this.scanPopupGetFocus() this.scanPopupGetFocus()
} }
}); });
}else { } else {
// //
this.$throttle(this.submit, 2000, this)() this.$throttle(this.submit, 2000, this)()
} }
@ -932,7 +937,7 @@
closeScanPopup() { closeScanPopup() {
// this.updateCommitBtn(); // this.updateCommitBtn();
}, },
confirmFromLocation(fromLocationCodeParams){ confirmFromLocation(fromLocationCodeParams) {
this.fromLocationCode = fromLocationCodeParams this.fromLocationCode = fromLocationCodeParams
} }
} }

6
src/pages/issue/record/directIssueByBatch.vue

@ -245,6 +245,7 @@
let newDetail = createDetailInfo(balance, pack); // let newDetail = createDetailInfo(balance, pack); //
newDetail.packingNumber = pack.number newDetail.packingNumber = pack.number
newDetail.handleQty =label.qty newDetail.handleQty =label.qty
newDetail.supplierCode =label.supplierCode
itemp.subList.push(newDetail); itemp.subList.push(newDetail);
this.detailSource.push(itemp) this.detailSource.push(itemp)
} else { } else {
@ -260,6 +261,7 @@
let newDetail = createDetailInfo(balance, pack); let newDetail = createDetailInfo(balance, pack);
newDetail.packingNumber = pack.number newDetail.packingNumber = pack.number
newDetail.handleQty =label.qty newDetail.handleQty =label.qty
newDetail.supplierCode =label.supplierCode
item.subList.push(newDetail); item.subList.push(newDetail);
} else { } else {
detail.handleQty=calc.add(detail.handleQty,result.label.qty) detail.handleQty=calc.add(detail.handleQty,result.label.qty)
@ -455,7 +457,6 @@
var params = { var params = {
...this.setRecordParams() ...this.setRecordParams()
} }
console.log("提交参数", JSON.stringify(params));
const isHaveItem = params.subList.find(item => item.handleQty > item.balanceQty) const isHaveItem = params.subList.find(item => item.handleQty > item.balanceQty)
if (isHaveItem) { if (isHaveItem) {
this.showErrorMessage(`物料号${isHaveItem.itemCode}`) this.showErrorMessage(`物料号${isHaveItem.itemCode}`)
@ -520,7 +521,8 @@
fromPackUnit: detail.packUnit, fromPackUnit: detail.packUnit,
toPackUnit: detail.packUnit, toPackUnit: detail.packUnit,
fromPackQty: detail.packQty, fromPackQty: detail.packQty,
toPackQty: detail.packQty toPackQty: detail.packQty,
supplierCode:detail.supplierCode
}] }]
subList.push(submitItem) subList.push(submitItem)
} }

Loading…
Cancel
Save