|
@ -10,7 +10,8 @@ |
|
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|
|
<view class="detail-list" v-for="(item, index) in detailSource" :key="item.id"> |
|
|
<view class=""> |
|
|
<view class=""> |
|
|
<com-move-record :dataContent="item" :index="index" @removeData="removeData" |
|
|
<com-move-record :dataContent="item" :index="index" @removeData="removeData" |
|
|
:isShowStatus="isShowStatus" @updateData="updateData" @removePack='removePack'> |
|
|
:isShowStatus="isShowStatus" @updateData="updateData" @removePack='removePack' |
|
|
|
|
|
:allowEditStatus ="allowEditStatus"> |
|
|
</com-move-record> |
|
|
</com-move-record> |
|
|
</view> |
|
|
</view> |
|
|
<u-line /> |
|
|
<u-line /> |
|
@ -34,7 +35,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'"></win-scan-pack-and-location> |
|
|
<win-scan-pack-and-location ref="scanPopup" @getResult='getScanResult' :title="'箱码'"></win-scan-pack-and-location> |
|
|
<win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getLocation' |
|
|
<win-scan-location ref="scanFromLocationCode" title="来源库位" @getLocation='getLocation' |
|
|
:locationTypeList="fromLocationTypeArray"></win-scan-location> |
|
|
:locationTypeList="fromlocationTypeList"></win-scan-location> |
|
|
<com-message ref="comMessage"></com-message> |
|
|
<com-message ref="comMessage"></com-message> |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
@ -49,13 +50,21 @@ |
|
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
|
|
import winScanPackAndLocation from "@/mycomponents/scan/winScanPackAndLocation.vue" |
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
import { |
|
|
import { |
|
|
getBalanceByUniquecode, |
|
|
inventoryMoveRecordSubmit, |
|
|
} from '@/api/request.js'; |
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
getDirectoryItemArray |
|
|
getDirectoryItemArray |
|
|
} from '@/common/directory.js'; |
|
|
} from '@/common/directory.js'; |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
getPrecisionStrategyList |
|
|
|
|
|
} from '@/common/balance.js'; |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
|
getPackingNumberAndBatchByList |
|
|
|
|
|
} from '@/common/basic.js'; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
getBusinessType, |
|
|
getBusinessType, |
|
|
createItemInfo, |
|
|
createItemInfo, |
|
@ -84,9 +93,14 @@ |
|
|
// default: "" |
|
|
// default: "" |
|
|
// }, |
|
|
// }, |
|
|
isShowStatus: { |
|
|
isShowStatus: { |
|
|
|
|
|
type: Boolean, |
|
|
|
|
|
default: true |
|
|
|
|
|
}, |
|
|
|
|
|
allowEditStatus: { |
|
|
type: Boolean, |
|
|
type: Boolean, |
|
|
default: false |
|
|
default: false |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
businessTypeCode: { |
|
|
businessTypeCode: { |
|
|
type: String, |
|
|
type: String, |
|
|
default: "Move" |
|
|
default: "Move" |
|
@ -95,14 +109,17 @@ |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
fromLocationCode: "", |
|
|
fromLocationCode: "", |
|
|
fromLocationInfo: {}, |
|
|
|
|
|
fromLocationTypeArray: [], |
|
|
|
|
|
toLocationCode: "", |
|
|
toLocationCode: "", |
|
|
toLocationInfo: {}, |
|
|
toLocationInfo: {}, |
|
|
toLocationTypeArray: [], |
|
|
toLocationTypeArray: [], |
|
|
toInventoryStatus: "", |
|
|
toInventoryStatus: "", |
|
|
businessType: {}, //业务类型 |
|
|
businessType: {}, //业务类型 |
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
|
|
title:"", |
|
|
|
|
|
dataContent:{}, |
|
|
|
|
|
toWarehouseCode:"", |
|
|
|
|
|
fromlocationTypeList: [], |
|
|
|
|
|
tolocationTypeList: [], |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -114,7 +131,7 @@ |
|
|
this.tolocationTypeList = res.tolocationTypeList; |
|
|
this.tolocationTypeList = res.tolocationTypeList; |
|
|
this.showFromLocationPopup(); |
|
|
this.showFromLocationPopup(); |
|
|
} else { |
|
|
} else { |
|
|
this.$refs.comMessage.showBreakMessage(res.message ); |
|
|
this.showErrorMessage(res.message) |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
this.updateTitle(); |
|
|
this.updateTitle(); |
|
@ -126,27 +143,27 @@ |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
updateTitle() { |
|
|
updateTitle() { |
|
|
var name ="" |
|
|
if(this.businessTypeCode=="InventoryMoveRecord"){ |
|
|
if(this.businessTypeCode=="Move"){ |
|
|
this.title = "库存转移记录"; |
|
|
name = "库存转移记录"; |
|
|
this.toInventoryStatus = "OK" |
|
|
}else if(this.businessTypeCode=="HoldToOkRecord"){ |
|
|
}else if(this.businessTypeCode=="HoldToOkRecord"){ |
|
|
name = "隔离转合格记录"; |
|
|
this.title = "隔离转合格记录"; |
|
|
this.toInventoryStatus = "OK" |
|
|
this.toInventoryStatus = "OK" |
|
|
}else if(this.businessTypeCode=="HoldToScrapRecord"){ |
|
|
}else if(this.businessTypeCode=="HoldToScrapRecord"){ |
|
|
name = "隔离转报废记录"; |
|
|
this.title = "隔离转报废记录"; |
|
|
this.toInventoryStatus = "SCRAP" |
|
|
this.toInventoryStatus = "SCRAP" |
|
|
}else if(this.businessTypeCode=="OkToHoldRecord"){ |
|
|
}else if(this.businessTypeCode=="OkToHoldRecord"){ |
|
|
name = "合格转隔离记录"; |
|
|
this.title = "合格转隔离记录"; |
|
|
this.toInventoryStatus ="HOLD" |
|
|
this.toInventoryStatus ="HOLD" |
|
|
}else if(this.businessTypeCode=="OktoScrapRecord"){ |
|
|
}else if(this.businessTypeCode=="OktoScrapRecord"){ |
|
|
name = "合格转报废记录"; |
|
|
this.title = "合格转报废记录"; |
|
|
this.toInventoryStatus ="SCRAP" |
|
|
this.toInventoryStatus ="SCRAP" |
|
|
}else if(this.businessTypeCode=="ScrapToHoldRecord"){ |
|
|
}else if(this.businessTypeCode=="ScrapToHoldRecord"){ |
|
|
name = "报废转隔离记录"; |
|
|
this.title = "报废转隔离记录"; |
|
|
this.toInventoryStatus ="HOLD" |
|
|
this.toInventoryStatus ="HOLD" |
|
|
} |
|
|
} |
|
|
uni.setNavigationBarTitle({ |
|
|
uni.setNavigationBarTitle({ |
|
|
title: name |
|
|
title: this.title |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
openScanPopup() { |
|
|
openScanPopup() { |
|
@ -166,11 +183,11 @@ |
|
|
this.getfromLocationCode(location) |
|
|
this.getfromLocationCode(location) |
|
|
}, |
|
|
}, |
|
|
getfromLocationCode(location) { |
|
|
getfromLocationCode(location) { |
|
|
this.fromLocationInfo = location; |
|
|
|
|
|
this.fromLocationCode = location.code; |
|
|
this.fromLocationCode = location.code; |
|
|
this.openScanPopup(); |
|
|
this.openScanPopup(); |
|
|
}, |
|
|
}, |
|
|
getToLocationCode(location, code) { |
|
|
getToLocationCode(location, code) { |
|
|
|
|
|
this.toWarehouseCode = location.warehouseCode |
|
|
this.toLocationCode = code; |
|
|
this.toLocationCode = code; |
|
|
}, |
|
|
}, |
|
|
getScanResult(result) { |
|
|
getScanResult(result) { |
|
@ -188,6 +205,8 @@ |
|
|
if (item == undefined) { |
|
|
if (item == undefined) { |
|
|
var itemp = createItemInfo(balance,pack); |
|
|
var itemp = createItemInfo(balance,pack); |
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
|
|
newDetail.inventoryStatus =balance.inventoryStatus; |
|
|
|
|
|
newDetail.toInventoryStatus =this.toInventoryStatus |
|
|
itemp.subList.push(newDetail); |
|
|
itemp.subList.push(newDetail); |
|
|
this.detailSource.push(itemp) |
|
|
this.detailSource.push(itemp) |
|
|
} else { |
|
|
} else { |
|
@ -203,6 +222,8 @@ |
|
|
|
|
|
|
|
|
if (detail == undefined) { |
|
|
if (detail == undefined) { |
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
let newDetail = createDetailInfo(balance, pack); |
|
|
|
|
|
newDetail.inventoryStatus = balance.inventoryStatus; |
|
|
|
|
|
newDetail.toInventoryStatus =this.toInventoryStatus |
|
|
item.subList.push(newDetail); |
|
|
item.subList.push(newDetail); |
|
|
} else { |
|
|
} else { |
|
|
this.showErrorMessage(balance.packingNumber + "已经在列表中") |
|
|
this.showErrorMessage(balance.packingNumber + "已经在列表中") |
|
@ -212,41 +233,6 @@ |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
createItemInfo(balance, pack) { |
|
|
|
|
|
let item = { |
|
|
|
|
|
itemCode: pack.itemCode, |
|
|
|
|
|
itemName: pack.itemName, |
|
|
|
|
|
stdPackQty: pack.stdPackQty, |
|
|
|
|
|
stdPackUnit: pack.stdPackUnit, |
|
|
|
|
|
qty: balance.qty, |
|
|
|
|
|
handleQty: 0, |
|
|
|
|
|
uom: pack.uom, |
|
|
|
|
|
subList: [] |
|
|
|
|
|
} |
|
|
|
|
|
return item; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
createDetailInfo(data, pack) { |
|
|
|
|
|
data.scaned = true; |
|
|
|
|
|
data.toInventoryStatus = this.toInventoryStatus == "" ? data.inventoryStatus : this.toInventoryStatus; |
|
|
|
|
|
let detail = {}; |
|
|
|
|
|
Object.assign(detail, data) |
|
|
|
|
|
detail.balanceQty = detail.qty |
|
|
|
|
|
detail.package = pack |
|
|
|
|
|
return detail; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
calcHandleQty() { |
|
|
|
|
|
for (let item of this.detailSource) { |
|
|
|
|
|
item.qty = 0; |
|
|
|
|
|
for (let detail of item.subList) { |
|
|
|
|
|
if (detail != undefined) { |
|
|
|
|
|
item.qty += detail.qty |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
this.$forceUpdate(); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
showErrorMessage(message) { |
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
@ -283,35 +269,133 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
|
|
this.fromLocationCode = ''; |
|
|
|
|
|
this.subList = []; |
|
|
|
|
|
this.detailSource = []; |
|
|
|
|
|
this.toLocationCode = ''; |
|
|
|
|
|
this.dataContent = {} |
|
|
|
|
|
this.toWarehouseCode = "" |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
commit() { |
|
|
commit() { |
|
|
|
|
|
|
|
|
|
|
|
if (this.toLocationCode == "") { |
|
|
|
|
|
this.showMessage("请先选择目标库位") |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|
|
|
|
|
//查询管理模式 |
|
|
uni.showLoading({ |
|
|
uni.showLoading({ |
|
|
title: "提交中....", |
|
|
title: "提交中....", |
|
|
mask: true |
|
|
mask: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
this.managementList = []; |
|
|
|
|
|
var precisionStrategParams = this.setPrecisionStrategParams() |
|
|
|
|
|
|
|
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|
|
getPrecisionStrategyList(precisionStrategParams, res => { |
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
if (res.success) { |
|
|
|
|
|
this.managementList = res.list; |
|
|
//直接创建记录 |
|
|
var params = this.setParams() |
|
|
//采购退货直接出库,不用查询管理模式 |
|
|
console.log("提交" + JSON.stringify(params)) |
|
|
var params = this.setRecordParams(true) |
|
|
inventoryMoveRecordSubmit(params).then(res => { |
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
|
|
|
|
|
|
|
|
purchaseReturnRecordSubmit(params).then(res => { |
|
|
|
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
if (res.data) { |
|
|
if (res.data) { |
|
|
this.showCommitSuccessMessage("提交成功<br>生成采购退货记录" + res.data) |
|
|
this.showCommitSuccessMessage("提交成功<br>生成"+this.title+"记录<br>" + res.data) |
|
|
} else { |
|
|
} else { |
|
|
this.showErrorMessage("提交失败" + res.msg) |
|
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
|
|
} |
|
|
} |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
this.showErrorMessage(error) |
|
|
this.showErrorMessage(error) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.showErrorMessage("没有要提交的数据") |
|
|
uni.hideLoading(); |
|
|
|
|
|
this.showErrorMessage(res.message); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
this.showErrorMessage("没有要提交的数据,请先扫描") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setPrecisionStrategParams() { |
|
|
|
|
|
var itemList = [] |
|
|
|
|
|
this.detailSource.forEach(item => { |
|
|
|
|
|
item.subList.forEach(detail => { |
|
|
|
|
|
if (detail.scaned) { |
|
|
|
|
|
detail.toLocationCode = this.toLocationCode; |
|
|
|
|
|
var filterResult = itemList.filter(res => { |
|
|
|
|
|
if (res.itemCode == item.itemCode && |
|
|
|
|
|
detail.toLocationCode == res.locationCode) { |
|
|
|
|
|
return res |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
//去掉重复元素 |
|
|
|
|
|
if (filterResult.length == 0) { |
|
|
|
|
|
var result = { |
|
|
|
|
|
itemCode: item.itemCode, |
|
|
|
|
|
locationCode: detail.toLocationCode |
|
|
|
|
|
} |
|
|
|
|
|
itemList.push(result) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
return itemList; |
|
|
|
|
|
}, |
|
|
|
|
|
setParams() { |
|
|
|
|
|
|
|
|
|
|
|
var subList = [] |
|
|
|
|
|
var creator = this.$store.state.user.id |
|
|
|
|
|
this.detailSource.forEach(item => { |
|
|
|
|
|
item.subList.forEach(detail => { |
|
|
|
|
|
if (detail.scaned) { |
|
|
|
|
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
|
|
|
|
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
|
|
|
|
|
detail.itemCode = detail.itemCode; |
|
|
|
|
|
detail.itemName = detail.package.itemName; |
|
|
|
|
|
detail.itemDesc1 = detail.package.itemDesc1; |
|
|
|
|
|
detail.itemDesc2 = detail.package.itemDesc2; |
|
|
|
|
|
|
|
|
|
|
|
detail.fromInventoryStatus = detail.inventoryStatus; |
|
|
|
|
|
// detail.toInventoryStatus = this.toInventoryStatus; |
|
|
|
|
|
|
|
|
|
|
|
detail.fromPackingNumber = info.packingNumber; |
|
|
|
|
|
detail.toPackingNumber = info.packingNumber; |
|
|
|
|
|
|
|
|
|
|
|
detail.fromContainerNumber = detail.containerNumber; |
|
|
|
|
|
detail.toContainerNumber = detail.containerNumber |
|
|
|
|
|
|
|
|
|
|
|
detail.fromBatch = info.batch; |
|
|
|
|
|
detail.toBatch = info.batch; |
|
|
|
|
|
|
|
|
|
|
|
detail.fromLocationCode = detail.locationCode; |
|
|
|
|
|
detail.toLocationCode = detail.toLocationCode; |
|
|
|
|
|
|
|
|
|
|
|
subList.push(detail) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
this.dataContent.subList = subList; |
|
|
|
|
|
this.dataContent.creator = creator; |
|
|
|
|
|
this.dataContent.fromWarehouseCode = this.detailSource[0].subList[0].warehouseCode; |
|
|
|
|
|
this.dataContent.toWarehouseCode = this.toWarehouseCode; |
|
|
|
|
|
this.dataContent.businessType = this.businessTypeCode; |
|
|
|
|
|
return this.dataContent; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|