Browse Source

修改成品发货任务扫描

hella_online_20240927
lijuncheng 2 months ago
parent
commit
8d57ee4312
  1. 709
      src/pages/deliver/coms/comScanDeliverPack.vue
  2. 582
      src/pages/deliver/coms/comScanDeliverPackss.vue
  3. 5
      src/pages/deliver/job/deliverDetail.vue

709
src/pages/deliver/coms/comScanDeliverPack.vue

@ -3,18 +3,19 @@
<uni-popup ref="popup" :maskClick='false'> <uni-popup ref="popup" :maskClick='false'>
<view class=""> <view class="">
<view class="popup_box"> <view class="popup_box">
<view class="pop_title uni-flex space-between"> <view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;"> <view class="" style="font-size: 35rpx;">
扫描箱码 扫描箱码
</view> </view>
<view class=""> <view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg" <image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg"
@click="closeScanPopup()"></image> @click="closeScanPopup()"></image>
</view> </view>
</view> </view>
<!-- <view class="uni-flex uni-row" style="align-items: center;
<!-- <view class="uni-flex uni-row" style="align-items: center;
background-color: #fff; background-color: #fff;
margin-left: 20rpx; margin-left: 20rpx;
margin-right: 20rpx; margin-right: 20rpx;
@ -32,28 +33,29 @@
@confirm="confirmSelect"></u-select> @confirm="confirmSelect"></u-select>
</view> </view>
</view> </view>
</view> </view> -->
<u-line class='line_color'></u-line> --> <!-- <u-line class='line_color'></u-line> -->
<view class="uni-flex uni-row" style="align-items: center; <!-- <view class="uni-flex uni-row" style="align-items: center;
background-color: #fff; background-color: #fff;
margin-left: 20rpx; margin-left: 20rpx;
margin-right: 20rpx; margin-right: 20rpx;
margin-top: 8rpx; margin-top: 8rpx;
border-radius: 8rpx;"> border-radius: 8rpx;">
<view class="uni-center" style="width: 25%; "> <view class="uni-center" style="width: 25%; font-size: 35rpx; ">
来源库位 来源库位
</view> </view>
<view class="" style="width: 75%; padding: 8rpx;"> <view class="" style="width: 75%; padding: 8rpx;">
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位" <uni-combox class="my-combox" :candidates="fromLocationList" v-model="fromLocationCode"
@confirm="fromLocationUpdate"></uni-combox> placeholder="请选择库位" @confirm="fromLocationUpdate"
:inputStyle="inputStyleObject"></uni-combox>
</view> </view>
</view> </view> -->
<view class=""> <view class="">
<view class=""> <view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true" <win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true"
:headerType="headerType" :isShowHistory="false"> headerType="HPQ,HMQ" :isShowHistory="false">
</win-com-scan> </win-com-scan>
<view style="width: 100%;"> <view style="width: 100%;">
@ -76,7 +78,7 @@
<uni-swipe-action-item @click="swipeClick($event,record,index)" <uni-swipe-action-item @click="swipeClick($event,record,index)"
:right-options="scanOptions"> :right-options="scanOptions">
<view style="padding: 0px 10px"> <view style="padding: 0px 10px">
<balance :dataContent="record" :isShowLocation="false" <balance :dataContent="record" :isShowFromLocation="false"
:isShowStdPack="false"></balance> :isShowStdPack="false"></balance>
</view> </view>
</uni-swipe-action-item> </uni-swipe-action-item>
@ -95,6 +97,10 @@
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> <balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit> <balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
<!-- 模拟扫描功能 -->
<!-- <win-com-scan v-show="false" ref="comscansimulate" placeholder="箱标签" @getResult="onScan" :clearResult="true"
headerType="HPQ,HMQ" :isShowHistory="false">
</win-com-scan> -->
</view> </view>
</template> </template>
@ -108,24 +114,33 @@
getDetailOption, getDetailOption,
getDetailEditRemoveOption getDetailEditRemoveOption
} from '@/common/array.js'; } from '@/common/array.js';
import {
getWorkShopLineStation,
getBalanceByFilter,
getBalanceByParams,
} from '@/api/request2.js';
import {
uniqueArray
} from '@/common/basic.js';
import { import {
getDirectoryItemArray, getLabelInfo
} from '@/common/directory.js'; } from '@/common/label.js';
import { import {
calc calc
} from '@/common/calc.js'; } from '@/common/calc.js';
import {
getWorkShopLineStation
} from '@/api/request2.js';
import { import {
getBalanceByManagementPrecision getBalanceByManagementPrecision
} from '@/common/balance.js'; } from '@/common/balance.js';
import {
getDirectoryItemArray
} from '../../../common/directory.js';
export default { export default {
name: 'winScanPack', name: 'winScanPack',
emits: ["afterScan", "closeScan"],
components: { components: {
winComScan, winComScan,
balance, balance,
@ -137,12 +152,6 @@
type: String, type: String,
default: '' default: ''
}, },
headerType: {
type: String,
default: "HPQ,HMQ"
},
}, },
data() { data() {
return { return {
@ -156,16 +165,21 @@
fromLocationList: [], fromLocationList: [],
fromLocationCode: '', fromLocationCode: '',
fromLocation: null, fromLocation: null,
issueRecord: [], // issueRecord: [], //
expand: true, expand: true,
scanOptions: {}, scanOptions: {},
editItem: {}, editItem: {},
positionInfo: "请选择位置", positionInfo: "请选择位置",
positionList: [], positionList: [],
defaultValueList: [], defaultValueList: [],
fromInventoryStatuses: "",
packageInfo: {},
label: {}, label: {},
fromInventoryStatuses: [], inputStyleObject: {
packageInfo: {} fontSize: "100rpx"
},
bussinessCode: 'Issue',
toLocationAreaTypeList: []
} }
}, },
created() { created() {
@ -177,13 +191,29 @@
this.scanOptions = getDetailEditRemoveOption(); this.scanOptions = getDetailEditRemoveOption();
}, },
methods: { methods: {
openScanPopupForJobSimulate(content, jobcontent, scanMessage) {
this.issueRecord = [];
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
getLabelInfo(scanMessage, "HPQ,HMQ", callback => {
if (callback.success) {
this.onScan(callback);
} else {
this.showErrorMessage(callback.message, res => {})
}
})
},
openScanPopup(content, jobcontent) { openScanPopup(content, jobcontent) {
this.issueRecord = []; this.issueRecord = [];
this.dataContent = content; this.dataContent = content;
this.jobContent = jobcontent; this.jobContent = jobcontent;
this.initData(); this.initData();
this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode + // this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode +
"-" + this.jobContent.subList[0].workStationCode // "-" + this.jobContent.subList[0].workStationCode
this.$refs.popup.open('bottom') this.$refs.popup.open('bottom')
setTimeout(res => { setTimeout(res => {
this.getfocus(); this.getfocus();
@ -202,104 +232,257 @@
let that = this; let that = this;
that.fromLocationList = []; that.fromLocationList = [];
if (that.dataContent != null) { if (that.dataContent != null) {
that.fromInventoryStatuses = getDirectoryItemArray(this.jobContent.outInventoryStatuses) that.fromInventoryStatuses = this.jobContent.outInventoryStatuses
that.toLocation = that.dataContent[0]; that.toLocation = that.dataContent[0];
that.toLocationCode = that.dataContent[0].toLocationCode; that.toLocationCode = that.dataContent[0].toLocationCode;
that.fromLocationList = that.getFromLocationList(); that.toLocationAreaTypeList = getDirectoryItemArray(this.jobContent.toAreaTypes)
// that.fromLocationList = that.getFromLocationList();
} }
}, },
showBalanceSelect(items, packageInfo) { showBalanceSelect(items) {
this.packageInfo = packageInfo;
this.$refs.balanceSelect.openPopup(items); this.$refs.balanceSelect.openPopup(items);
}, },
getFromLocationList() { // getFromLocationList() {
let list = []; // let list = [];
let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode); // this.dataContent.forEach(location => {
if (location != undefined) { // location.Items.forEach(item => {
location.Items.forEach(item => { // item.Locations.forEach(f => {
item.Locations.forEach(f => { // let item = list.find(l => l == f.fromLocationCode);
list.push(f.fromLocationCode) // if (item == undefined) {
}) // list.push(f.fromLocationCode)
}) // }
this.fromLocationCode = list[0]; // })
return list; // })
} else { // });
this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => { // //
this.toLocationCode = ''; // list = uniqueArray(list);
}); // this.fromLocationCode = list[0];
} // return list;
}, // },
fromLocationUpdate(fromlocation) { fromLocationUpdate(fromlocation) {
let location = this.fromLocationList.find(r => r == fromlocation) let location = this.fromLocationList.find(r => r == fromlocation)
// -- if (location == undefined) {
// if (location == undefined) { this.fromLocationCode = ''
this.fromLocationCode = fromlocation this.showErrorMessage('发料库位【' + fromlocation + '】不存在')
// this.showErrorMessage('' + fromlocation + '') }
// }
}, },
onScan(result) {
queryBalance(result) {
try { try {
let that = this; let that = this;
// if (that.fromLocationCode == '') {
if (that.fromLocationCode == '') { // that.showErrorMessage('', res => {
that.showErrorMessage('请选择来源库位', res => { // that.$refs.toLocationCombox.onFocus();
that.$refs.toLocationCombox.onFocus(); // });
}); // return;
return; // }
}
let packageInfo = result.package; let packageInfo = result.package;
let itemCode = result.label.itemCode; let itemCode = result.label.itemCode;
let packingCode = result.label.packingNumber; let packingCode = result.label.packingNumber;
let lot = result.label.batch; let lot = result.label.batch;
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); let item = that.toLocation.Items.find(r => r.itemCode == itemCode);
if (item == undefined) { if (item == undefined) {
that.showErrorMessage('未查找到物料【' + itemCode + '】的发明细', that.showErrorMessage('未查找到物料【' + itemCode + '】的发明细',
res => { res => {
that.getfocus(); that.getfocus();
} }
) )
return; return;
} else { } else {
//
var params = {
itemCode: result.package.itemCode,
batch: result.label.batch,
packingNumber: result.label.packingNumber,
parentPackingNumber: result.package.parentNumber,
inventoryStatus: this.jobContent.outInventoryStatuses.split(','),
areaType: this.jobContent.fromAreaTypes.split(','),
bussinessCode: this.jobContent.businessType
}
uni.showLoading({ uni.showLoading({
title: '加载中', title: '查询中',
mask: true mask: true
}) })
getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses, getBalanceByParams(params).then(res => {
balanceRes => { if (res.data.length == 0) {
if (balanceRes.success) { var status = getInventoryStatusDesc(params.inventoryStatus)
if (balanceRes.data.list.length == 0) { var areaType = getListLocationAreaTypeDesc(params.areaType)
this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],未查找到该包装的库存记录', var hint =
res => { "按物料号 [" + params.itemCode + "] \n" +
this.packGetFocus(); "包装号 [" + params.packingNumber + "] \n" +
}) "批次 [" + params.batch + "] \n" +
} else if (balanceRes.data.list.length == 1) { "状态 [" + status + "] \n" +
let balance = balanceRes.data.list[0]; "库区 [" + areaType + "] \n" +
this.afterGetBalance(result.label, balance, packageInfo); "未查找到库存余额"
} else { this.showErrorMessage(hint,
this.label = result.label; res => {
this.showBalanceSelect(balanceRes.data.list, packageInfo); that.getfocus();
} })
} else if (res.data.length == 1) {
result.balance = res.data[0]
if (result.label.packingNumber != result.balance.packingNumber) {
result.balance.qty = Number(result.label.qty)
} else { } else {
this.showErrorMessage(balanceRes.message.message); result.balance.qty = Number(result.balance.qty)
} }
uni.hideLoading(); this.afterGetBalance(result.label, result.balance, result.package);
}); } else {
//
this.$refs.balanceSelect.openPopup(res.data);
}
uni.hideLoading()
}).catch(error => {
uni.hideLoading()
this.showErrorMessage(error,
res => {
that.getfocus();
})
})
} }
} catch (e) { } catch (e) {
this.showErrorMessage(e.stack) this.showErrorMessage(e.stack, res => {
that.getfocus();
})
uni.hideLoading(); uni.hideLoading();
} }
}, },
getBalance(label, packageInfo, callback) {
var filters = []
if (packageInfo.parentNumber) {
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: label.packingNumber
})
}
filters.push({
column: "itemCode",
action: "==",
value: label.itemCode
})
filters.push({
column: "batch",
action: "==",
value: label.batch
})
if (this.fromInventoryStatuses != null && this.fromInventoryStatuses != "") {
filters.push({
column: "inventoryStatus",
action: "in",
value: this.fromInventoryStatuses
})
}
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
callback(res.data)
}).catch(err => {
this.showErrorMessage(err.message);
})
},
onScan(result) {
if (!result.package) {
this.showErrorMessage('扫描数据错误[' + result.label.code + "]",
res => {
this.getfocus();
}
)
return;
}
if (this.toLocation && result.package.packUnit) {
let item = this.toLocation.Items.find(r => r.itemCode == result.package.itemCode);
if (!item) {
this.showErrorMessage('扫描物料代码不属于该任务');
return
}
this.getToLocationBalance(result)
}
},
//
getToLocationBalance(result) {
uni.showLoading({
title: '查询中',
mask: true
})
var filters = []
if (result.package.parentNumber) {
var packingNumber = result.package.parentNumber + "," + result.package.number;
filters.push({
column: "packingNumber",
action: "in",
value: packingNumber
})
} else {
filters.push({
column: "packingNumber",
action: "==",
value: result.package.number
})
}
filters.push({
column: "itemCode",
action: "==",
value: result.package.itemCode
})
filters.push({
column: "batch",
action: "==",
value: result.package.batch
})
filters.push({
column: "areaType",
action: "in",
value: this.toLocationAreaTypeList.join(',')
})
var params = {
filters: filters,
pageNo: 1,
pageSize: 100,
}
getBalanceByFilter(params).then(res => {
uni.hideLoading()
if (res.data.list.length > 0) {
this.showErrorMessage("包装在库位【" + res.data.list[0].locationCode + "】已有库存余额");
} else {
this.queryBalance(result);
}
// callback(res.data)
}).catch(err => {
uni.hideLoading()
this.showErrorMessage(err.message);
})
},
selectBalanceItem(balance) { selectBalanceItem(balance) {
this.afterGetBalance(balance, balance, this.packageInfo); this.afterGetBalance(balance, balance, this.packageInfo);
}, },
afterGetBalance(label, balance, packageInfo) { afterGetBalance(label, balance, packageInfo) {
let that = this; let that = this;
try { try {
@ -307,34 +490,18 @@
let packingCode = label.packingNumber; let packingCode = label.packingNumber;
let lot = label.batch; let lot = label.batch;
let item = that.toLocation.Items.find(r => r.itemCode == itemCode); let item = that.toLocation.Items.find(r => r.itemCode == itemCode);
that.fromLocationCode = balance.locationCode;
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode); let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode);
// -- //
if(!fromLocation){ if (fromLocation){
fromLocation = { //
Batchs:[{ // if(fromLocation.isNewAdd){
Recommends:[],
Records: [], // }else {
batch: label.batch, // //
detail:{
...packageInfo, // }
fromLocationCode: balance.locationCode,
toLocationCode:this.toLocationCode
},
handleQty: 0,
packingNumber: null,
// packingNumber: label.packingNumber,
qty: label.qty,
uom: label.uom
}],
toLocationCode:this.toLocationCode,
fromLocationCode: balance.locationCode,
handleQty: 0,
qty: label.qty,
uom: label.uom
}
item.Locations.push(fromLocation)
}
if (fromLocation != undefined) {
let batch = fromLocation.Batchs.find(r => r.batch == lot); let batch = fromLocation.Batchs.find(r => r.batch == lot);
if (batch != undefined) { if (batch != undefined) {
if (batch.Records == undefined) { if (batch.Records == undefined) {
@ -344,7 +511,7 @@
let record = batch.Records.find(r => r.packingNumber == packingCode); let record = batch.Records.find(r => r.packingNumber == packingCode);
if (record == undefined) { if (record == undefined) {
// //
if (batch.Recommends&&batch.Recommends.length > 0) { if (batch.Recommends != undefined && batch.Recommends.length > 0) {
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode); let recommend = batch.Recommends.find(r => r.packingNumber == packingCode);
if (recommend != undefined) { if (recommend != undefined) {
that.addRecord(batch, label, balance, packageInfo) that.addRecord(batch, label, balance, packageInfo)
@ -356,6 +523,7 @@
that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细', that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细',
res => { res => {
that.getfocus(); that.getfocus();
return;
} }
) )
} }
@ -363,6 +531,7 @@
} else { } else {
that.addRecord(batch, label, balance, packageInfo) that.addRecord(batch, label, balance, packageInfo)
} }
} else { } else {
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱', that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱',
res => { res => {
@ -370,29 +539,191 @@
} }
) )
} }
} else { } else {
if (this.jobContent.allowModifyBatch == "TRUE") { if (this.jobContent.allowModifyBatch == "TRUE") {
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot + this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot +
'】的发货明细,是否要继续发货?', res => { '】的发料明细,是否要继续发料?', res => {
if (res) { if (res) {
let batch = that.createBatchInfo(label, balance,packageInfo); let batch = that.createBatchInfo(label, balance, packageInfo);
//details
if (fromLocation.Batchs.length > 0) {
batch.detail = fromLocation.Batchs[0].detail;
}
fromLocation.Batchs.unshift(batch); fromLocation.Batchs.unshift(batch);
this.getfocus();
that.$emit("afterScan");
} }
}) })
} else { } else {
that.showErrorMessage('未查找到批次【' + lot + '】的发明细', that.showErrorMessage('未查找到批次【' + lot + '】的发明细',
res => { res => {
that.getfocus(); that.getfocus();
}); });
} }
} }
} else {
that.showErrorMessage('未查找到推荐库位【' + that.fromLocationCode + '】的发货明细', }else {
res => { //
that.getfocus(); if (this.jobContent.allowModifyLocation == "TRUE") {
} this.showQuestionMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode +
) "】与推荐的库位不一致,是否要继续发料?", res => {
if (res) {
let locaion = that.createLocationInfo(label, balance, packageInfo);
item.Locations.push(locaion);
this.getfocus();
that.$emit("afterScan");
}
})
} else {
this.showErrorMessage("扫描物料[" + itemCode + "]的库位【" + that.fromLocationCode +
"】与推荐的库位不一致,不允许继续发料?")
}
} }
// if (fromLocation && !fromLocation.isNewAdd) {
// let batch = fromLocation.Batchs.find(r => r.batch == lot);
// if (batch != undefined) {
// if (batch.Records == undefined) {
// batch.Records = [];
// }
// let record = batch.Records.find(r => r.packingNumber == packingCode);
// if (record == undefined) {
// //
// if (batch.Recommends != undefined && batch.Recommends.length > 0) {
// let recommend = batch.Recommends.find(r => r.packingNumber == packingCode);
// if (recommend != undefined) {
// that.addRecord(batch, label, balance, packageInfo)
// } else {
// //
// if (this.jobContent.allowModifyPackingNumber == 'TRUE') {
// that.addRecord(batch, label, balance, packageInfo);
// } else {
// that.showErrorMessage('' + packingCode + '',
// res => {
// that.getfocus();
// return;
// }
// )
// }
// }
// } else {
// that.addRecord(batch, label, balance, packageInfo)
// }
// } else {
// that.showErrorMessage('' + packingCode + ',',
// res => {
// that.getfocus();
// }
// )
// }
// } else {
// if (this.jobContent.allowModifyBatch == "TRUE") {
// this.showQuestionMessage('' + that.fromLocationCode + ',' + lot +
// ',?', res => {
// if (res) {
// let batch = that.createBatchInfo(label, balance, packageInfo);
// //details
// if (fromLocation.Batchs.length > 0) {
// batch.detail = fromLocation.Batchs[0].detail;
// }
// fromLocation.Batchs.unshift(batch);
// this.getfocus();
// that.$emit("afterScan");
// }
// })
// } else {
// that.showErrorMessage('' + lot + '',
// res => {
// that.getfocus();
// });
// }
// }
// } else {
// if (fromLocation&&fromLocation.isNewAdd) {
// let batch = fromLocation.Batchs.find(r => r.batch == lot);
// if (batch != undefined) {
// if (batch.Records == undefined) {
// batch.Records = [];
// }
// let record = batch.Records.find(r => r.packingNumber == packingCode);
// if (record == undefined) {
// //
// if (batch.Recommends != undefined && batch.Recommends.length > 0) {
// let recommend = batch.Recommends.find(r => r.packingNumber == packingCode);
// if (recommend != undefined) {
// that.addRecord(batch, label, balance, packageInfo)
// } else {
// //
// if (this.jobContent.allowModifyPackingNumber == 'TRUE') {
// that.addRecord(batch, label, balance, packageInfo);
// } else {
// that.showErrorMessage('' + packingCode + '',
// res => {
// that.getfocus();
// return;
// }
// )
// }
// }
// } else {
// that.addRecord(batch, label, balance, packageInfo)
// }
// } else {
// that.showErrorMessage('' + packingCode + ',',
// res => {
// that.getfocus();
// }
// )
// }
// } else {
// if (this.jobContent.allowModifyBatch == "TRUE") {
// this.showQuestionMessage('' + that.fromLocationCode + ',' + lot +
// ',?', res => {
// if (res) {
// let batch = that.createBatchInfo(label, balance, packageInfo);
// //details
// if (fromLocation.Batchs.length > 0) {
// batch.detail = fromLocation.Batchs[0].detail;
// }
// fromLocation.Batchs.unshift(batch);
// this.getfocus();
// that.$emit("afterScan");
// }
// })
// } else {
// that.showErrorMessage('' + lot + '',
// res => {
// that.getfocus();
// });
// }
// }
// } else {
// if (this.jobContent.allowModifyLocation == "TRUE") {
// this.showQuestionMessage("[" + itemCode + "]" + that.fromLocationCode +
// ",?", res => {
// if (res) {
// let locaion = that.createLocationInfo(label, balance, packageInfo);
// item.Locations.push(locaion);
// this.getfocus();
// that.$emit("afterScan");
// }
// })
// } else {
// this.showErrorMessage("[" + itemCode + "]" + that.fromLocationCode +
// ",?")
// }
// }
// }
} catch (e) { } catch (e) {
that.showErrorMessage(e.stack, that.showErrorMessage(e.stack,
res => { res => {
@ -402,27 +733,32 @@
} }
}, },
//
createLocationInfo(label, balance, packageInfo) {
let location = {
fromLocationCode: balance.locationCode,
qty: balance.qty,
uom: balance.uom,
handleQty: 0,
isNewAdd: true,
Batchs: []
}
let batch = this.createBatchInfo(label, balance, packageInfo);
batch.detail = balance;
batch.detail.fromLocationCode = balance.locationCode;
location.Batchs.push(batch);
return location;
},
createBatchInfo(data, balance, packageInfo) { createBatchInfo(data, balance, packageInfo) {
let batch = { let batch = {
batch: data.lot||data.batch, isNewAdd: true,
batch: data.batch,
qty: 0, qty: 0,
uom: data.uom, uom: data.uom,
handleQty: Number(data.qty), handleQty: Number(balance.qty),
Records: [], Records: []
detail:{
fromLocationCode:this.fromLocationCode, //balance.locationCode
toLocationCode:this.toLocationCode,
itemCode:data.itemCode,
handleQty: Number(data.qty),
packingNumber:data.packingNumber,
qty: 0,
uom:data.uom,
itemName:packageInfo.itemName,
itemDesc1:packageInfo.itemDesc1,
itemDesc2:packageInfo.itemDesc2,
singlePrice:balance.singlePrice,
amount:balance.amount
}
} }
let record = this.creatRecord(data, balance, packageInfo); let record = this.creatRecord(data, balance, packageInfo);
batch.Records.push(record); batch.Records.push(record);
@ -437,18 +773,21 @@
scaned: true, scaned: true,
itemCode: label.itemCode, itemCode: label.itemCode,
packingNumber: label.packingNumber, packingNumber: label.packingNumber,
parentPackingNumber: packageInfo.parentNumber,
batch: label.batch, batch: label.batch,
qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), // qty: Number(balance.qty),
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),
qty: Number(balance.qty),
handleQty: Number(balance.qty),
uom: balance.uom, uom: balance.uom,
inventoryStatus: balance.inventoryStatus, inventoryStatus: balance.inventoryStatus,
balance: balance, balance: balance,
toLocationCode: this.toLocationCode, toLocationCode: this.toLocationCode,
supplierCode: label.supplierCode, supplierCode: label.supplierCode,
packUnit: packageInfo.packUnit, packUnit: packageInfo.packUnit,
packQty: packageInfo.packQty, packQty: packageInfo.packQty
singlePrice:balance.singlePrice,
amount:balance.amount
} }
return record; return record;
}, },
@ -458,14 +797,64 @@
handleQty = calc.add(handleQty, res.qty) handleQty = calc.add(handleQty, res.qty)
}) })
batch.handleQty = handleQty; batch.handleQty = handleQty;
}, },
addRecord(batch, label, balance, packageInfo) { addRecord(batch, label, balance, packageInfo) {
let record = this.creatRecord(label, balance, packageInfo); if (packageInfo.parentNumber) {
batch.Records.push(record); var checkData = batch.Records.find(r => {
this.issueRecord.unshift(record) if (r.packingNumber == packageInfo.parentNumber &&
this.calcBatchHandleQty(batch); r.batch == balance.batch) {
this.getfocus(); return r;
}
})
if (checkData) {
//
this.showErrorMessage("箱码[" + packageInfo.number + "]批次[" + balance.batch +
"]的父包装已经扫描")
} else {
let record = this.creatRecord(label, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
this.calcBatchHandleQty(batch);
this.getfocus();
this.$emit("afterScan");
}
} else {
//
var checkData = batch.Records.find(r => {
if (r.parentPackingNumber == packageInfo.number &&
r.batch == balance.batch) {
return r;
}
})
if (checkData) {
//
this.$refs.comMessage.showQuestionMessage("扫描箱码[" + checkData.parentPackingNumber + "]" + "批次[" +
balance
.batch + "]是父包装,是否移除子包装", res => {
if (res) {
batch.Records = [];
let record = this.creatRecord(label, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
this.calcBatchHandleQty(batch);
this.getfocus();
this.$emit("afterScan");
}
})
console.log("扫描的是父包装,是否移除子包装")
} else {
let record = this.creatRecord(label, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
this.calcBatchHandleQty(batch);
this.getfocus();
this.$emit("afterScan");
}
}
}, },
getfocus() { getfocus() {
@ -514,13 +903,17 @@
let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode); let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode);
if (item != undefined) { if (item != undefined) {
item.Locations.forEach(l => { item.Locations.forEach(l => {
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b
.batch == record.batch); .batch == record.batch);
let rIndex = batch.Records.findIndex(r => r.packingNumber == record
.packingNumber && r if (batch && batch.Records && batch.Records.length > 0) {
.batch == record.batch); let rIndex = batch.Records.findIndex(r => r.packingNumber == record
batch.Records.splice(rIndex, 1); .packingNumber && r.batch == record.batch);
batch.Records.splice(rIndex, 1);
}
}) })
} }
this.$emit('updateData', item); this.$emit('updateData', item);
@ -529,10 +922,16 @@
}, },
packGetFocus() { packGetFocus() {
this.$refs.comscan.getfocus(); if (this.$refs.comscan) {
this.$refs.comscan.getfocus();
}
}, },
packLoseFocus() { packLoseFocus() {
this.$refs.comscan.losefocus(); if (this.$refs.comscan) {
this.$refs.comscan.losefocus();
}
}, },
showMessage(message, callback) { showMessage(message, callback) {
setTimeout(r => { setTimeout(r => {
@ -579,4 +978,8 @@
max-height: 300rpx; max-height: 300rpx;
padding: 10rpx; padding: 10rpx;
} }
.my-combox {
font-size: 50px;
}
</style> </style>

582
src/pages/deliver/coms/comScanDeliverPackss.vue

@ -0,0 +1,582 @@
<template>
<view>
<uni-popup ref="popup" :maskClick='false'>
<view class="">
<view class="popup_box">
<view class="pop_title uni-flex space-between">
<view class="" style="font-size: 35rpx;">
扫描箱码
</view>
<view class="">
<image class="fr icons_scan_close" src="/static/icons/icons_scan_close.svg"
@click="closeScanPopup()"></image>
</view>
</view>
<!-- <view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
padding:20rpx;
border-radius: 8rpx;">
<view class="uni-center">
位置 :
</view>
<view class="" style="width: 75%;padding: 0rpx">
<view class="uni-flex u-col-center uni-row" @click="showSelect">
<view class="" style="margin-left: 15rpx;font-size: 30rpx;">
{{positionInfo}}
</view>
<u-select v-model="show" mode="mutil-column-auto" :list="positionList" :defaultValue="defaultValueList"
@confirm="confirmSelect"></u-select>
</view>
</view>
</view>
<u-line class='line_color'></u-line> -->
<view class="uni-flex uni-row" style="align-items: center;
background-color: #fff;
margin-left: 20rpx;
margin-right: 20rpx;
margin-top: 8rpx;
border-radius: 8rpx;">
<view class="uni-center" style="width: 25%; ">
来源库位
</view>
<view class="" style="width: 75%; padding: 8rpx;">
<uni-combox :candidates="fromLocationList" v-model="fromLocationCode" placeholder="请选择库位"
@confirm="fromLocationUpdate"></uni-combox>
</view>
</view>
<view class="">
<view class="">
<win-com-scan ref="comscan" placeholder="箱标签" @getResult="onScan" :clearResult="true"
:headerType="headerType" :isShowHistory="false">
</win-com-scan>
<view style="width: 100%;">
<view style="width: 100%;" v-if="issueRecord.length>0">
<view class="uni-flex uni-row space-between u-col-center">
<view class="" style="padding: 10rpx;">
历史记录
</view>
<view class="" style="padding-right: 10rpx;">
<u-icon :name="expendIcon" size="35rpx" @click="expands()"></u-icon>
</view>
</view>
<u-line class='line_color' style='padding-top: 10rpx;padding-bottom: 20rpx;'>
</u-line>
<scroll-view scroll-y="true" class="scroll-view"
v-if="expand&&issueRecord.length>0">
<view class="uni-flex u-col" v-for="(record,index) in issueRecord">
<view style="width: 100%;">
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item @click="swipeClick($event,record,index)"
:right-options="scanOptions">
<view style="padding: 0px 10px">
<balance :dataContent="record" :isShowLocation="false"
:isShowStdPack="false"></balance>
</view>
</uni-swipe-action-item>
</uni-swipe-action>
<u-line class='line_color'></u-line>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
</view>
</view>
</uni-popup>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
<comMessage ref="comMessage"></comMessage>
<balance-qty-edit ref="balanceQtyEdit" @confirm="confirm" :isShowStatus="true"></balance-qty-edit>
</view>
</template>
<script>
import winComScan from '@/mycomponents/scan/winComScan.vue'
import balance from '@/mycomponents/balance/balance.vue'
import balanceQtyEdit from '@/mycomponents/qty/balanceQtyEdit.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
import {
getDetailOption,
getDetailEditRemoveOption
} from '@/common/array.js';
import {
getDirectoryItemArray,
} from '@/common/directory.js';
import {
calc
} from '@/common/calc.js';
import {
getWorkShopLineStation
} from '@/api/request2.js';
import {
getBalanceByManagementPrecision
} from '@/common/balance.js';
export default {
name: 'winScanPack',
components: {
winComScan,
balance,
balanceQtyEdit,
balanceSelect
},
props: {
title: {
type: String,
default: ''
},
headerType: {
type: String,
default: "HPQ,HMQ"
},
},
data() {
return {
dataContent: {},
jobContent: {},
expendIcon: 'arrow-down',
show: false,
scanList: [],
toLocation: null,
toLocationCode: '',
fromLocationList: [],
fromLocationCode: '',
fromLocation: null,
issueRecord: [], //
expand: true,
scanOptions: {},
editItem: {},
positionInfo: "请选择位置",
positionList: [],
defaultValueList: [],
label: {},
fromInventoryStatuses: [],
packageInfo: {}
}
},
created() {
},
watch: {},
mounted() {
this.detailOptions = getDetailOption();
this.scanOptions = getDetailEditRemoveOption();
},
methods: {
openScanPopup(content, jobcontent) {
this.issueRecord = [];
this.dataContent = content;
this.jobContent = jobcontent;
this.initData();
this.positionInfo = this.jobContent.workShopCode + "-" + this.jobContent.subList[0].productionLineCode +
"-" + this.jobContent.subList[0].workStationCode
this.$refs.popup.open('bottom')
setTimeout(res => {
this.getfocus();
}, 500)
},
closeScanPopup() {
this.losefocus()
this.$refs.popup.close();
this.$emit("closeScan")
//
// Object.assign(this.$data, this.$options.data());
},
initData() {
let that = this;
that.fromLocationList = [];
if (that.dataContent != null) {
that.fromInventoryStatuses = getDirectoryItemArray(this.jobContent.outInventoryStatuses)
that.toLocation = that.dataContent[0];
that.toLocationCode = that.dataContent[0].toLocationCode;
that.fromLocationList = that.getFromLocationList();
}
},
showBalanceSelect(items, packageInfo) {
this.packageInfo = packageInfo;
this.$refs.balanceSelect.openPopup(items);
},
getFromLocationList() {
let list = [];
let location = this.dataContent.find(r => r.toLocationCode == this.toLocationCode);
if (location != undefined) {
location.Items.forEach(item => {
item.Locations.forEach(f => {
list.push(f.fromLocationCode)
})
})
this.fromLocationCode = list[0];
return list;
} else {
this.$refs.comMessage.showErrorMessages('需求库位【' + this.toLocationCode + '】不存在', res => {
this.toLocationCode = '';
});
}
},
fromLocationUpdate(fromlocation) {
let location = this.fromLocationList.find(r => r == fromlocation)
// --
// if (location == undefined) {
this.fromLocationCode = fromlocation
// this.showErrorMessage('' + fromlocation + '')
// }
},
onScan(result) {
try {
let that = this;
if (that.fromLocationCode == '') {
that.showErrorMessage('请选择来源库位', res => {
that.$refs.toLocationCombox.onFocus();
});
return;
}
let packageInfo = result.package;
let itemCode = result.label.itemCode;
let packingCode = result.label.packingNumber;
let lot = result.label.batch;
let item = that.toLocation.Items.find(r => r.itemCode == itemCode);
if (item == undefined) {
that.showErrorMessage('未查找到物料【' + itemCode + '】的发货明细',
res => {
that.getfocus();
}
)
return;
} else {
//
uni.showLoading({
title: '加载中',
mask: true
})
getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses,
balanceRes => {
if (balanceRes.success) {
if (balanceRes.data.list.length == 0) {
this.showErrorMessage('在来源库位[' + this.fromLocationCode + '],未查找到该包装的库存记录',
res => {
this.packGetFocus();
})
} else if (balanceRes.data.list.length == 1) {
let balance = balanceRes.data.list[0];
this.afterGetBalance(result.label, balance, packageInfo);
} else {
this.label = result.label;
this.showBalanceSelect(balanceRes.data.list, packageInfo);
}
} else {
this.showErrorMessage(balanceRes.message.message);
}
uni.hideLoading();
});
}
} catch (e) {
this.showErrorMessage(e.stack)
uni.hideLoading();
}
},
selectBalanceItem(balance) {
this.afterGetBalance(balance, balance, this.packageInfo);
},
afterGetBalance(label, balance, packageInfo) {
let that = this;
try {
let itemCode = label.itemCode;
let packingCode = label.packingNumber;
let lot = label.batch;
let item = that.toLocation.Items.find(r => r.itemCode == itemCode);
let fromLocation = item.Locations.find(l => l.fromLocationCode == that.fromLocationCode);
// --
if(!fromLocation){
fromLocation = {
Batchs:[{
Recommends:[],
Records: [],
batch: label.batch,
detail:{
...packageInfo,
fromLocationCode: balance.locationCode,
toLocationCode:this.toLocationCode
},
handleQty: 0,
packingNumber: null,
// packingNumber: label.packingNumber,
qty: label.qty,
uom: label.uom
}],
toLocationCode:this.toLocationCode,
fromLocationCode: balance.locationCode,
handleQty: 0,
qty: label.qty,
uom: label.uom
}
item.Locations.push(fromLocation)
}
if (fromLocation != undefined) {
let batch = fromLocation.Batchs.find(r => r.batch == lot);
if (batch != undefined) {
if (batch.Records == undefined) {
batch.Records = [];
}
let record = batch.Records.find(r => r.packingNumber == packingCode);
if (record == undefined) {
//
if (batch.Recommends&&batch.Recommends.length > 0) {
let recommend = batch.Recommends.find(r => r.packingNumber == packingCode);
if (recommend != undefined) {
that.addRecord(batch, label, balance, packageInfo)
} else {
//
if (this.jobContent.allowModifyPackingNumber == 'TRUE') {
that.addRecord(batch, label, balance, packageInfo);
} else {
that.showErrorMessage('未查找到该箱码【' + packingCode + '】的明细',
res => {
that.getfocus();
}
)
}
}
} else {
that.addRecord(batch, label, balance, packageInfo)
}
} else {
that.showErrorMessage('箱码【' + packingCode + '】已经扫描,请继续扫描下一箱',
res => {
that.getfocus();
}
)
}
} else {
if (this.jobContent.allowModifyBatch == "TRUE") {
this.showQuestionMessage('在【' + that.fromLocationCode + '】库位下,未查找到批次【' + lot +
'】的发货明细,是否要继续发货?', res => {
if (res) {
let batch = that.createBatchInfo(label, balance,packageInfo);
fromLocation.Batchs.unshift(batch);
}
})
} else {
that.showErrorMessage('未查找到批次【' + lot + '】的发货明细',
res => {
that.getfocus();
});
}
}
} else {
that.showErrorMessage('未查找到推荐库位【' + that.fromLocationCode + '】的发货明细',
res => {
that.getfocus();
}
)
}
} catch (e) {
that.showErrorMessage(e.stack,
res => {
that.getfocus();
}
)
}
},
createBatchInfo(data, balance, packageInfo) {
let batch = {
batch: data.lot||data.batch,
qty: 0,
uom: data.uom,
handleQty: Number(data.qty),
Records: [],
detail:{
fromLocationCode:this.fromLocationCode, //balance.locationCode
toLocationCode:this.toLocationCode,
itemCode:data.itemCode,
handleQty: Number(data.qty),
packingNumber:data.packingNumber,
qty: 0,
uom:data.uom,
itemName:packageInfo.itemName,
itemDesc1:packageInfo.itemDesc1,
itemDesc2:packageInfo.itemDesc2,
singlePrice:balance.singlePrice,
amount:balance.amount
}
}
let record = this.creatRecord(data, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
return batch;
},
creatRecord(label, balance, packageInfo) {
balance.packQty = packageInfo.packQty
balance.packUnit = packageInfo.packUnit
let record = {
scaned: true,
itemCode: label.itemCode,
packingNumber: label.packingNumber,
batch: label.batch,
qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),
uom: balance.uom,
inventoryStatus: balance.inventoryStatus,
balance: balance,
toLocationCode: this.toLocationCode,
supplierCode: label.supplierCode,
packUnit: packageInfo.packUnit,
packQty: packageInfo.packQty,
singlePrice:balance.singlePrice,
amount:balance.amount
}
return record;
},
calcBatchHandleQty(batch) {
let handleQty = 0;
batch.Records.forEach(res => {
handleQty = calc.add(handleQty, res.qty)
})
batch.handleQty = handleQty;
},
addRecord(batch, label, balance, packageInfo) {
let record = this.creatRecord(label, balance, packageInfo);
batch.Records.push(record);
this.issueRecord.unshift(record)
this.calcBatchHandleQty(batch);
this.getfocus();
},
getfocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.getfocus();
}
},
losefocus() {
if (this.$refs.comscan != undefined) {
this.$refs.comscan.losefocus();
}
},
expands() {
this.expand = !this.expand;
this.expendIcon = this.expand == true ? "arrow-down" : "arrow-up"
},
swipeClick(e, item, index) {
if (e.content.text == "详情") {
this.detail(item)
} else if (e.content.text == "编辑") {
this.edit(item)
} else if (e.content.text == "移除") {
this.remove(item, index)
}
},
edit(item) {
this.editItem = item;
// item.balance.balanceQty = item.balance.qty;
item.balance.balanceQty = item.balance.qty;
this.$refs.balanceQtyEdit.openEditPopup(item.balance, item.qty);
},
detail(item) {
this.showItem = item;
this.$refs.receiptHint.openScanPopup()
},
remove(record, index) {
this.showQuestionMessage("确定移除扫描信息?",
res => {
if (res) {
record.qty = 0;
this.issueRecord.splice(index, 1)
let item = this.toLocation.Items.find(r => r.itemCode == record.itemCode);
if (item != undefined) {
item.Locations.forEach(l => {
let batch = l.Batchs.find(b => b.packingNumber == record.packingNumber && b
.batch == record.batch);
let rIndex = batch.Records.findIndex(r => r.packingNumber == record
.packingNumber && r
.batch == record.batch);
batch.Records.splice(rIndex, 1);
})
}
this.$emit('updateData', item);
}
});
},
packGetFocus() {
this.$refs.comscan.getfocus();
},
packLoseFocus() {
this.$refs.comscan.losefocus();
},
showMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showMessage(message, callback);
})
},
showErrorMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showErrorMessage(message, callback);
})
},
showQuestionMessage(message, callback) {
setTimeout(r => {
this.packLoseFocus();
this.$refs.comMessage.showQuestionMessage(message, callback);
})
},
confirm(val) {
this.editItem.qty = Number(val);
this.$emit('updateData', this.editItem)
},
cancle() {
this.closeScanPopup()
}
}
}
</script>
<style lang="scss">
button {
border: none;
}
button::after {
border: none
}
.scroll-view {
overflow-y: scroll;
height: auto;
max-height: 300rpx;
padding: 10rpx;
}
</style>

5
src/pages/deliver/job/deliverDetail.vue

@ -341,6 +341,8 @@
batch.Records.forEach(r => { batch.Records.forEach(r => {
let record = {}; let record = {};
record.handleQty = r.qty; record.handleQty = r.qty;
record.fromPackingNumber = r
.packingNumber;
record.toContainerNumber = r record.toContainerNumber = r
.ContainerNumber; .ContainerNumber;
record.toInventoryStatus = r record.toInventoryStatus = r
@ -365,7 +367,8 @@
.packingNumber; .packingNumber;
record.toBatch = info.batch; record.toBatch = info.batch;
} }
record.fromPackingNumber = r.packingNumber record.fromParentPackingNumber = r
.parentPackingNumber;
subItem.recordList.push(record); subItem.recordList.push(record);
}) })
subList.push(subItem); subList.push(subItem);

Loading…
Cancel
Save