|
|
@ -16,8 +16,7 @@ |
|
|
|
<view class=""> |
|
|
|
<record-com-detail-card :dataContent="item" :index="index" :settingParam="dataContent" |
|
|
|
:isShowFromLocation="false" @removeItem="removeItem(index,item)" |
|
|
|
:isShowToLocation="false" |
|
|
|
@updateData="updateData" @removePack="removePack"> |
|
|
|
:isShowToLocation="false" @updateData="updateData" @removePack="removePack"> |
|
|
|
</record-com-detail-card> |
|
|
|
|
|
|
|
</view> |
|
|
@ -44,11 +43,13 @@ |
|
|
|
</view> |
|
|
|
<win-scan-button @goScan='openScanPopup'></win-scan-button> |
|
|
|
</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> |
|
|
|
<comMessage ref="comMessage"></comMessage> |
|
|
|
<win-scan-location ref="scanLocationCode" title="来源库位" @getLocation='getLocation' |
|
|
|
:locationAreaTypeList="fromLocationAreaTypeList"></win-scan-location> |
|
|
|
<balance-select ref="balanceSelect" @onSelectItem='selectBalanceItem'></balance-select> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@ -56,6 +57,7 @@ |
|
|
|
import { |
|
|
|
issueRecordSubmit, |
|
|
|
getWorkShopLineStation, |
|
|
|
getBalanceByFilter |
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
import { |
|
|
@ -95,6 +97,7 @@ |
|
|
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
|
|
|
import recordComDetailCard from '@/mycomponents/record/recordComDetailCard.vue' |
|
|
|
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' |
|
|
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
@ -105,7 +108,8 @@ |
|
|
|
winScanLocation, |
|
|
|
winScanPackAndLocation, |
|
|
|
recordComDetailCard, |
|
|
|
recordDetailCard |
|
|
|
recordDetailCard, |
|
|
|
balanceSelect |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -125,7 +129,8 @@ |
|
|
|
businessTypeCode: "Issue", |
|
|
|
positionList: [], |
|
|
|
show: false, |
|
|
|
positionInfo: "请选择生产线" |
|
|
|
positionInfo: "请选择生产线", |
|
|
|
resultData: {} |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
@ -169,7 +174,139 @@ |
|
|
|
mounted() {}, |
|
|
|
|
|
|
|
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) { |
|
|
|
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; |
|
|
@ -187,6 +324,8 @@ |
|
|
|
|
|
|
|
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); |
|
|
@ -195,7 +334,7 @@ |
|
|
|
|
|
|
|
} else { |
|
|
|
var detail = item.subList.find(r => { |
|
|
|
if (r.packingNumber == balance.packingNumber && |
|
|
|
if (r.packingNumber == pack.number && |
|
|
|
r.batch == balance.batch && |
|
|
|
r.locationCode == balance.locationCode && |
|
|
|
r.inventoryStatus == balance.inventoryStatus) { |
|
|
@ -204,10 +343,60 @@ |
|
|
|
}) |
|
|
|
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 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.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 == balance.packingNumber && |
|
|
|
r.batch == balance.batch && |
|
|
|
r.locationCode == balance.locationCode && |
|
|
|
r.inventoryStatus == balance.inventoryStatus) { |
|
|
|
return r; |
|
|
|
} |
|
|
|
}) |
|
|
|
if (detail == undefined) { |
|
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
newDetail.packUnit = packUnit; |
|
|
|
newDetail.packQty = packQty; |
|
|
|
item.subList.push(newDetail); |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
} else { |
|
|
|
if (detail.scaned == true) { |
|
|
|
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]已经在列表中") |
|
|
@ -305,16 +494,17 @@ |
|
|
|
|
|
|
|
//赋值到库位代码 |
|
|
|
let toLocationCode = '' |
|
|
|
this.positionList.forEach(item=>{ |
|
|
|
if(this.workshopCode == item.value){ // 车间 |
|
|
|
item.children.find(child=>{ |
|
|
|
if(this.productionLineCode==child.value){ |
|
|
|
toLocationCode = child.children.find(subChild=>this.workStationCode==subChild.value).rawLocationCode; |
|
|
|
this.positionList.forEach(item => { |
|
|
|
if (this.workshopCode == item.value) { // 车间 |
|
|
|
item.children.find(child => { |
|
|
|
if (this.productionLineCode == child.value) { |
|
|
|
toLocationCode = child.children.find(subChild => this.workStationCode == |
|
|
|
subChild.value).rawLocationCode; |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.detailSource.forEach(item=>{ |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
detail.toLocationCode = toLocationCode |
|
|
|
}) |
|
|
@ -380,7 +570,9 @@ |
|
|
|
getPrecisionStrategyList(precisionStrategyParams, res => { |
|
|
|
if (res.success) { |
|
|
|
this.managementList = res.list; |
|
|
|
var params = {...this.setRecordParams()} |
|
|
|
var params = { |
|
|
|
...this.setRecordParams() |
|
|
|
} |
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
|
|
|
|
issueRecordSubmit(params).then(res => { |
|
|
@ -426,20 +618,20 @@ |
|
|
|
submitItem.qty = detail.handleQty; |
|
|
|
submitItem.package = ""; |
|
|
|
submitItem.recordList = [{ |
|
|
|
toInventoryStatus:detail.inventoryStatus, |
|
|
|
fromPackingNumber:info.packingNumber, |
|
|
|
fromBatch:info.batch, |
|
|
|
toPackingNumber:info.packingNumber, |
|
|
|
toBatch:info.batch, |
|
|
|
fromLocationCode:detail.locationCode, |
|
|
|
toLocationCode:detail.toLocationCode, |
|
|
|
handleQty:detail.handleQty, |
|
|
|
fromPackUnit:detail.packUnit, |
|
|
|
toPackUnit:detail.packUnit, |
|
|
|
fromPackQty:detail.packQty, |
|
|
|
toPackQty:detail.packQty |
|
|
|
} |
|
|
|
] |
|
|
|
toInventoryStatus: detail.inventoryStatus, |
|
|
|
fromParentPackingNumber: detail.parentNumber, |
|
|
|
fromPackingNumber: info.packingNumber, |
|
|
|
fromBatch: info.batch, |
|
|
|
toPackingNumber: info.packingNumber, |
|
|
|
toBatch: info.batch, |
|
|
|
fromLocationCode: detail.locationCode, |
|
|
|
toLocationCode: detail.toLocationCode, |
|
|
|
handleQty: detail.handleQty, |
|
|
|
fromPackUnit: detail.packUnit, |
|
|
|
toPackUnit: detail.packUnit, |
|
|
|
fromPackQty: detail.packQty, |
|
|
|
toPackQty: detail.packQty |
|
|
|
}] |
|
|
|
subList.push(submitItem) |
|
|
|
} |
|
|
|
}) |
|
|
@ -458,13 +650,6 @@ |
|
|
|
if (res) {} |
|
|
|
}); |
|
|
|
}, |
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) { |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
showScanMessage(message) { |
|
|
|
this.$refs.comMessage.showScanMessage(message); |
|
|
@ -502,17 +687,17 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
updateData() { |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
for (var i = 0; i < this.detailSource.length; i++) { |
|
|
|
let item = this.detailSource[i]; |
|
|
|
if (item.qty == 0) { |
|
|
|
this.detailSource.splice(i, 1) |
|
|
|
updateData() { |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
for (var i = 0; i < this.detailSource.length; i++) { |
|
|
|
let item = this.detailSource[i]; |
|
|
|
if (item.qty == 0) { |
|
|
|
this.detailSource.splice(i, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.$forceUpdate(); |
|
|
|
this.$forceUpdate(); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
clearData() { |
|
|
|
this.fromLocationInfo = {}; |
|
|
@ -520,7 +705,7 @@ |
|
|
|
this.fromWarehouseCode = ''; |
|
|
|
this.toWarehouseCode = ''; |
|
|
|
this.detailSource = []; |
|
|
|
this.to |
|
|
|
this.positionInfo= "请选择生产线"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|