Browse Source

修改直接发料和发料任务扫描小包装

hella_online_20240829
lijuncheng 5 months ago
parent
commit
190cb66f12
  1. 6
      src/mycomponents/scan/winComScanBalance.vue
  2. 194
      src/pages/issue/coms/comScanIssuePack.vue
  3. 2
      src/pages/issue/job/issueDetail.vue
  4. 219
      src/pages/issue/record/directIssue.vue

6
src/mycomponents/scan/winComScanBalance.vue

@ -71,7 +71,13 @@
balanceFromInventoryStatuses: { //fromInventoryStatuses balanceFromInventoryStatuses: { //fromInventoryStatuses
type: Boolean, type: Boolean,
default: true default: true
},
bussinessCode:{
type: String,
default: ''
} }
}, },
data() { data() {
return { return {

194
src/pages/issue/coms/comScanIssuePack.vue

@ -113,7 +113,8 @@
getDetailEditRemoveOption getDetailEditRemoveOption
} from '@/common/array.js'; } from '@/common/array.js';
import { import {
getWorkShopLineStation getWorkShopLineStation,
getBalanceByFilter
} from '@/api/request2.js'; } from '@/api/request2.js';
import { import {
@ -215,7 +216,7 @@ import { getDirectoryItemArray } from '../../../common/directory.js';
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.fromLocationList = that.getFromLocationList();
@ -251,6 +252,192 @@ import { getDirectoryItemArray } from '../../../common/directory.js';
} }
}, },
onScanResult(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
})
this.getBalance(result.label, packageInfo, balances => {
this.packageInfo =packageInfo;
//
let s = '';
if (!result.package.parentNumber) {
if (balances.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
let newBalances = balances.list.filter(b => b.locationCode == that
.fromLocationCode);
if (newBalances.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else if (newBalances.length == 1) {
let balance = newBalances[0];
this.afterGetBalance(result.label, balance, packageInfo);
} else {
this.showBalanceSelect(newBalances);
}
}
} else {
//
if (balances.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
//
let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo
.number)
//
let subParentPackitems = balances.list.filter(r => r.packingNumber ==
packageInfo
.parentNumber&&r.locationCode==this.fromLocationCode)
//
if (subPackitems.length == 0) {
//
if (subParentPackitems.length > 0) {
if(subParentPackitems.length==1){
let balance = subParentPackitems[0];
balance.qty=packageInfo.qty;
this.afterGetBalance(result.label, balance, packageInfo);
}else {
this.showBalanceSelect(subParentPackitems);
}
} else {
this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' +
packageInfo.number + '】都未查找到库存余额')
}
} else {
var locationCode = this.fromLocationCode
if(balances.list==1){
locationCode=balances.list[0].locationCode
}else {
var manyBlances = balances.list.filter(r=>r.locationCode!=this.fromLocationCode)
if(manyBlances.length>0){
locationCode = manyBlances[0].locationCode;
}
}
this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' +
locationCode +
'】已经有库存余额,请重新扫描')
}
// //
// if (subitems.length == 0 && subParentPackitems.length > 0) {
// this.afterGetBalance(result.label, null, packageInfo);
// } else if (subitems.length > 0 && subParentPackitems.length == 0) {
// //
// this.showErrorMessage('' + balances.list[0].locationCode +
// ',')
// } else {
// }
}
}
uni.hideLoading();
});
// getBalanceByManagementPrecision(result.label, that.fromLocationCode, that.fromInventoryStatuses,
// balanceRes => {
// if (balanceRes.success) {
// let s = '';
// if (balanceRes.data.list.length == 0) {
// this.afterGetBalance(result.label, null, packageInfo);
// } else if (balanceRes.data.list.length == 1) {
// let balance = balanceRes.data.list[0];
// this.afterGetBalance(result.label, balance, packageInfo);
// } else {
// this.showBalanceSelect(balanceRes.data.list);
// }
// } else {
// this.showErrorMessage(balanceRes.message.message);
// }
// uni.hideLoading();
// });
}
} catch (e) {
this.showErrorMessage(e.stack)
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) { onScan(result) {
if (this.toLocation && result.package.packUnit) { if (this.toLocation && result.package.packUnit) {
@ -267,7 +454,7 @@ import { getDirectoryItemArray } from '../../../common/directory.js';
} }
} }
}, },
onScanResult(result) { onScanResult1(result) {
try { try {
let that = this; let that = this;
if (that.fromLocationCode == '') { if (that.fromLocationCode == '') {
@ -432,6 +619,7 @@ import { getDirectoryItemArray } from '../../../common/directory.js';
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(balance.qty), qty: Number(balance.qty),
// qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty), // qty: Number(label.qty) > Number(balance.qty) ? Number(balance.qty) : Number(label.qty),

2
src/pages/issue/job/issueDetail.vue

@ -367,6 +367,8 @@
.packingNumber; .packingNumber;
record.toBatch = info.batch; record.toBatch = info.batch;
} }
record.fromParentPackingNumber = r
.parentPackingNumber;
subItem.recordList.push(record); subItem.recordList.push(record);
}) })
subList.push(deepCopyData(subItem)); subList.push(deepCopyData(subItem));

219
src/pages/issue/record/directIssue.vue

@ -16,8 +16,7 @@
<view class=""> <view class="">
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" <record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent"
:isShowFromLocation="false" @removeItem="removeItem(index,item)" :isShowFromLocation="false" @removeItem="removeItem(index,item)"
:isShowToLocation="false" :isShowToLocation="false" @updateData="updateData" @removePack="removePack">
@updateData="updateData" @removePack="removePack">
</record-com-detail-card> </record-com-detail-card>
</view> </view>
@ -44,11 +43,13 @@
</view> </view>
<win-scan-button @goScan='openScanPopup'></win-scan-button> <win-scan-button @goScan='openScanPopup'></win-scan-button>
</view> </view>
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'> <win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :allowModifyLocation='false'
:queryBalance="false">
</win-scan-pack-and-location> </win-scan-pack-and-location>
<comMessage ref="comMessage"></comMessage> <comMessage ref="comMessage"></comMessage>
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' <win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation'
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> :locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location>
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select>
</view> </view>
</template> </template>
@ -56,6 +57,7 @@
import { import {
issueRecordSubmit, issueRecordSubmit,
getWorkShopLineStation, getWorkShopLineStation,
getBalanceByFilter
} from '@/api/request2.js'; } from '@/api/request2.js';
import { import {
@ -95,6 +97,7 @@
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue"
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue'
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue'
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue'
export default { export default {
components: { components: {
@ -105,7 +108,8 @@
winScanLocation, winScanLocation,
winScanPackAndLocation, winScanPackAndLocation,
recordComDetailCard, recordComDetailCard,
recordDetailCard recordDetailCard,
balanceSelect
}, },
data() { data() {
return { return {
@ -125,7 +129,8 @@
businessTypeCode: "Issue", businessTypeCode: "Issue",
positionList: [], positionList: [],
show: false, show: false,
positionInfo: "请选择生产线" positionInfo: "请选择生产线",
resultData: {}
}; };
}, },
onLoad(option) { onLoad(option) {
@ -169,7 +174,191 @@
mounted() {}, mounted() {},
methods: { methods: {
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);
})
},
getScanResult(result) { getScanResult(result) {
this.resultData = result;
let packageInfo = result.package;
this.getBalance(result.label, packageInfo, balances => {
//
let s = '';
if (!result.package.parentNumber) {
if (balances.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
let newBalances = balances.list.filter(b => b.locationCode == this
.fromLocationCode);
if (newBalances.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else if (newBalances.length == 1) {
let balance = newBalances[0];
result.balance = balance;
this.afterGetBalance(result);
} else {
this.showBalanceSelect(newBalances);
}
}
} else {
//
if (balances.list.length == 0) {
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描')
} else {
//
let subPackitems = balances.list.filter(r => r.packingNumber == packageInfo
.number)
//
let subParentPackitems = balances.list.filter(r => r.packingNumber ==
packageInfo
.parentNumber && r.locationCode == this.fromLocationCode)
//
if (subPackitems.length == 0) {
//
if (subParentPackitems.length > 0) {
if (subParentPackitems.length == 1) {
let balance = subParentPackitems[0];
balance.qty = packageInfo.qty;
result.balance = balance;
this.afterGetBalance(result);
} else {
this.showBalanceSelect(subParentPackitems);
}
} else {
this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' +
packageInfo.number + '】都未查找到库存余额')
}
} else {
var locationCode = this.fromLocationCode
if (balances.list == 1) {
locationCode = balances.list[0].locationCode
} else {
var manyBlances = balances.list.filter(r => r.locationCode != this
.fromLocationCode)
if (manyBlances.length > 0) {
locationCode = manyBlances[0].locationCode;
}
}
this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' +
locationCode +
'】已经有库存余额,请重新扫描')
}
}
}
})
},
showBalanceSelect(items) {
this.$refs.balanceSelect.openPopup(items);
},
selectBalanceItem(balance) {
this.resultData.balance =balance;
this.afterGetBalance(this.resultData);
},
afterGetBalance(result){
let balance = result.balance;
let label = result.label;
let pack = result.package;
let packUnit = pack.packUnit;
let packQty =pack.packQty
var item = this.detailSource.find(res => {
if (res.itemCode == balance.itemCode) {
return res
}
})
if (this.fromWarehouseCode == '') {
this.fromWarehouseCode = balance.warehouseCode;
}
if (item == undefined) {
var itemp = createItemInfo(balance, pack);
let newDetail = createDetailInfo(balance, pack); //
newDetail.parentNumber =pack.parentNumber;
newDetail.packingNumber =pack.number
newDetail.packUnit =packUnit;
newDetail.packQty=packQty;
itemp.subList.push(newDetail);
this.detailSource.push(itemp)
calcHandleQty(this.detailSource);
} else {
var detail = item.subList.find(r => {
if (r.packingNumber == pack.number &&
r.batch == balance.batch &&
r.locationCode == balance.locationCode &&
r.inventoryStatus == balance.inventoryStatus) {
return r;
}
})
if (detail == undefined) {
let newDetail = createDetailInfo(balance, pack);
newDetail.parentNumber =pack.parentNumber;
newDetail.packingNumber =pack.number
newDetail.packUnit =packUnit;
newDetail.packQty=packQty;
item.subList.push(newDetail);
calcHandleQty(this.detailSource);
} else {
if (detail.scaned == true) {
this.showErrorMessage("箱码[" + detail.packingNumber + "]批次[" + balance.batch + "]已经在列表中")
}
}
}
},
getScanResult1(result) {
let balance = result.balance; let balance = result.balance;
let label = result.label; let label = result.label;
let pack = result.package; let pack = result.package;
@ -309,7 +498,8 @@
if (this.workshopCode == item.value) { // if (this.workshopCode == item.value) { //
item.children.find(child => { item.children.find(child => {
if (this.productionLineCode == child.value) { if (this.productionLineCode == child.value) {
toLocationCode = child.children.find(subChild=>this.workStationCode==subChild.value).rawLocationCode; toLocationCode = child.children.find(subChild => this.workStationCode ==
subChild.value).rawLocationCode;
} }
}) })
} }
@ -380,7 +570,9 @@
getPrecisionStrategyList(precisionStrategyParams, res => { getPrecisionStrategyList(precisionStrategyParams, res => {
if (res.success) { if (res.success) {
this.managementList = res.list; this.managementList = res.list;
var params = {...this.setRecordParams()} var params = {
...this.setRecordParams()
}
console.log("提交参数", JSON.stringify(params)); console.log("提交参数", JSON.stringify(params));
issueRecordSubmit(params).then(res => { issueRecordSubmit(params).then(res => {
@ -427,6 +619,7 @@
submitItem.package = ""; submitItem.package = "";
submitItem.recordList = [{ submitItem.recordList = [{
toInventoryStatus: detail.inventoryStatus, toInventoryStatus: detail.inventoryStatus,
fromParentPackingNumber: detail.parentNumber,
fromPackingNumber: info.packingNumber, fromPackingNumber: info.packingNumber,
fromBatch: info.batch, fromBatch: info.batch,
toPackingNumber: info.packingNumber, toPackingNumber: info.packingNumber,
@ -438,8 +631,7 @@
toPackUnit: detail.packUnit, toPackUnit: detail.packUnit,
fromPackQty: detail.packQty, fromPackQty: detail.packQty,
toPackQty: detail.packQty toPackQty: detail.packQty
} }]
]
subList.push(submitItem) subList.push(submitItem)
} }
}) })
@ -458,13 +650,6 @@
if (res) {} if (res) {}
}); });
}, },
showErrorMessage(message) {
this.$refs.comMessage.showErrorMessage(message, res => {
if (res) {
}
});
},
showScanMessage(message) { showScanMessage(message) {
this.$refs.comMessage.showScanMessage(message); this.$refs.comMessage.showScanMessage(message);
@ -520,7 +705,7 @@
this.fromWarehouseCode = ''; this.fromWarehouseCode = '';
this.toWarehouseCode = ''; this.toWarehouseCode = '';
this.detailSource = []; this.detailSource = [];
this.to this.positionInfo= "请选择生产线";
} }
} }
} }

Loading…
Cancel
Save