|
|
@ -53,7 +53,7 @@ |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
<script setup> |
|
|
|
import { |
|
|
|
issueRecordSubmit, |
|
|
|
getWorkShopLineStation, |
|
|
@ -99,514 +99,435 @@ |
|
|
|
import recordDetailCard from '@/mycomponents/record/recordDetailCard.vue' |
|
|
|
import balanceSelect from '@/mycomponents/balance/balanceSelect.vue' |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { |
|
|
|
winScanButton, |
|
|
|
winScanPack, |
|
|
|
requiredLocation, |
|
|
|
comBlankView, |
|
|
|
winScanLocation, |
|
|
|
winScanPackAndLocation, |
|
|
|
recordComDetailCard, |
|
|
|
recordDetailCard, |
|
|
|
balanceSelect |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
id: '', |
|
|
|
dataContent: {}, //内容 |
|
|
|
detailSource: [], //绑定在页面上的数据源 |
|
|
|
fromLocationInfo: {}, |
|
|
|
fromLocationCode: "", |
|
|
|
fromLocationAreaTypeList: [], |
|
|
|
toLocationAreaTypeList: [], |
|
|
|
inInventoryStatus: "", //目标入库库存状态 |
|
|
|
outInventoryStatus: "", //来源出库库存状态 |
|
|
|
businessType: {}, |
|
|
|
showToLoaction: true, |
|
|
|
recommendLocationList: [], //推荐库位列表 |
|
|
|
fromWarehouseCode: '', //来源仓库 |
|
|
|
businessTypeCode: "Issue", |
|
|
|
positionList: [], |
|
|
|
show: false, |
|
|
|
positionInfo: "请选择生产线", |
|
|
|
resultData: {} |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: option.title |
|
|
|
}) |
|
|
|
this.clearData(); |
|
|
|
getBusinessType(this.businessTypeCode, res => { |
|
|
|
if (res.success) { |
|
|
|
this.businessType = res.businessType; |
|
|
|
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList; |
|
|
|
this.toLocationAreaTypeList = res.toLocationAreaTypeList; |
|
|
|
this.showFromLocationPopup(); |
|
|
|
import {ref, onMounted} from 'vue'; |
|
|
|
import {onLoad, onNavigationBarButtonTap, onBackPress, onPullDownRefresh} from '@dcloudio/uni-app'; |
|
|
|
|
|
|
|
const id = ref(''); |
|
|
|
const dataContent = ref({}); |
|
|
|
const detailSource = ref([]); |
|
|
|
const fromLocationInfo = ref({}); |
|
|
|
const fromLocationCode = ref(""); |
|
|
|
const fromLocationAreaTypeList = ref([]); |
|
|
|
const toLocationAreaTypeList = ref([]); |
|
|
|
const inInventoryStatus = ref(""); // 目标入库库存状态 |
|
|
|
const outInventoryStatus = ref(""); // 来源出库库存状态 |
|
|
|
const businessType = ref({}); |
|
|
|
const showToLoaction = ref(true); |
|
|
|
const recommendLocationList = ref([]); // 推荐库位列表 |
|
|
|
const fromWarehouseCode = ref(''); // 来源仓库 |
|
|
|
const businessTypeCode = ref("Issue"); |
|
|
|
const positionList = ref([]); |
|
|
|
const show = ref(false); |
|
|
|
const positionInfo = ref("请选择生产线"); |
|
|
|
const resultData = ref({}); |
|
|
|
const workshopCode = ref(''); |
|
|
|
const productionLineCode = ref(''); |
|
|
|
const workStationCode = ref(''); |
|
|
|
const workShopName = ref(''); |
|
|
|
const productionLineName = ref(''); |
|
|
|
const workStationName = ref(''); |
|
|
|
const rawLocationCode = ref(''); |
|
|
|
const fgLocationCode = ref(''); |
|
|
|
const managementList = ref([]); |
|
|
|
const scanPopupRef = ref(null); |
|
|
|
const scanLocationCodeRef = ref(null); |
|
|
|
const comMessageRef = ref(null); |
|
|
|
|
|
|
|
const getBusinessType = (code, callback) => { |
|
|
|
// 获取业务类型的逻辑 |
|
|
|
uni.request({ |
|
|
|
url: `/api/businessType/${code}`, |
|
|
|
method: 'GET', |
|
|
|
success: (res) => { |
|
|
|
if (res.data.success) { |
|
|
|
businessType.value = res.data.businessType; |
|
|
|
fromLocationAreaTypeList.value = res.data.fromLocationAreaTypeList; |
|
|
|
toLocationAreaTypeList.value = res.data.toLocationAreaTypeList; |
|
|
|
showFromLocationPopup(); |
|
|
|
} else { |
|
|
|
this.showErrorMessage(res.message) |
|
|
|
showErrorMessage(res.data.message); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// if (this.positionList.length == 0) { |
|
|
|
getWorkShopLineStation().then(res => { |
|
|
|
if (res.data != null && res.data.length > 0) { |
|
|
|
this.positionList = res.data |
|
|
|
} else { |
|
|
|
this.showErrorMessage('未查找到位置信息'); |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
|
showErrorMessage(err.message); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
}).catch(error => { |
|
|
|
this.showErrorMessage(error); |
|
|
|
}) |
|
|
|
// } |
|
|
|
const showFromLocationPopup = () => { |
|
|
|
// 显示来源库位弹窗的逻辑 |
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
//返回首页 |
|
|
|
onNavigationBarButtonTap(e) { |
|
|
|
if (e.index === 0) { |
|
|
|
goHome(); |
|
|
|
const getWorkShopLineStation = () => { |
|
|
|
return uni.request({ |
|
|
|
url: '/api/workShopLineStation', |
|
|
|
method: 'GET' |
|
|
|
}).then((res) => { |
|
|
|
if (res.data.data && res.data.data.length > 0) { |
|
|
|
positionList.value = res.data.data; |
|
|
|
} else { |
|
|
|
showErrorMessage('未查找到位置信息'); |
|
|
|
} |
|
|
|
}, |
|
|
|
//拦截返回按钮事件 |
|
|
|
onBackPress(e) {}, |
|
|
|
|
|
|
|
onPullDownRefresh() {}, |
|
|
|
}).catch((error) => { |
|
|
|
showErrorMessage(error); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
mounted() {}, |
|
|
|
const showErrorMessage = (message) => { |
|
|
|
uni.showToast({ |
|
|
|
title: message, |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
methods: { |
|
|
|
getBalance(label, packageInfo, callback) { |
|
|
|
var filters = [] |
|
|
|
const getBalance = (label, packageInfo, callback) => { |
|
|
|
const filters = []; |
|
|
|
|
|
|
|
if (packageInfo.parentNumber) { |
|
|
|
var packingNumber = packageInfo.parentNumber + "," + label.packingNumber; |
|
|
|
const 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 != "") { |
|
|
|
if (fromInventoryStatus.value) { |
|
|
|
filters.push({ |
|
|
|
column: "inventoryStatus", |
|
|
|
action: "in", |
|
|
|
value: this.fromInventoryStatuses |
|
|
|
}) |
|
|
|
value: fromInventoryStatus.value |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
var params = { |
|
|
|
const params = { |
|
|
|
filters: filters, |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 100, |
|
|
|
} |
|
|
|
getBalanceByFilter(params).then(res => { |
|
|
|
callback(res.data) |
|
|
|
}).catch(err => { |
|
|
|
this.showErrorMessage(err.message); |
|
|
|
}) |
|
|
|
}; |
|
|
|
|
|
|
|
uni.request({ |
|
|
|
url: '/api/getBalanceByFilter', |
|
|
|
method: 'POST', |
|
|
|
data: params, |
|
|
|
success: (res) => { |
|
|
|
callback(res.data); |
|
|
|
}, |
|
|
|
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('未查找到该包装的库存信息,请重新扫描') |
|
|
|
fail: (err) => { |
|
|
|
showErrorMessage(err.message); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const getScanResult = (result) => { |
|
|
|
resultData.value = result; |
|
|
|
const packageInfo = result.package; |
|
|
|
getBalance(result.label, packageInfo, (balances) => { |
|
|
|
if (!packageInfo.parentNumber) { |
|
|
|
if (balances.list.length === 0) { |
|
|
|
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]; |
|
|
|
const newBalances = balances.list.filter(b => b.locationCode === fromLocationCode.value); |
|
|
|
if (newBalances.length === 0) { |
|
|
|
showErrorMessage('未查找到该包装的库存信息,请重新扫描'); |
|
|
|
} else if (newBalances.length === 1) { |
|
|
|
const balance = newBalances[0]; |
|
|
|
result.balance = balance; |
|
|
|
this.afterGetBalance(result); |
|
|
|
afterGetBalance(result); |
|
|
|
} else { |
|
|
|
this.showBalanceSelect(newBalances); |
|
|
|
showBalanceSelect(newBalances); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
//扫描的是小包装 |
|
|
|
if (balances.list.length == 0) { |
|
|
|
this.showErrorMessage('未查找到该包装的库存信息,请重新扫描') |
|
|
|
if (balances.list.length === 0) { |
|
|
|
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) { |
|
|
|
//外包装有库存,出库后剩余库存未转换为出库包装规格 |
|
|
|
|
|
|
|
const subPackitems = balances.list.filter(r => r.packingNumber === packageInfo.number); |
|
|
|
const subParentPackitems = balances.list.filter(r => r.packingNumber === packageInfo.parentNumber && r.locationCode === fromLocationCode.value); |
|
|
|
if (subPackitems.length === 0) { |
|
|
|
if (subParentPackitems.length > 0) { |
|
|
|
if (subParentPackitems.length == 1) { |
|
|
|
let balance = subParentPackitems[0]; |
|
|
|
if (subParentPackitems.length === 1) { |
|
|
|
const balance = subParentPackitems[0]; |
|
|
|
balance.qty = packageInfo.qty; |
|
|
|
result.balance = balance; |
|
|
|
this.afterGetBalance(result); |
|
|
|
afterGetBalance(result); |
|
|
|
} else { |
|
|
|
this.showBalanceSelect(subParentPackitems); |
|
|
|
showBalanceSelect(subParentPackitems); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
this.showErrorMessage('按外包装【' + packageInfo.parentNumber + '】和子包装【' + |
|
|
|
packageInfo.number + '】都未查找到库存余额') |
|
|
|
showErrorMessage(`按外包装[${packageInfo.parentNumber}]和子包装[${packageInfo.number}]都未查找到库存余额`); |
|
|
|
} |
|
|
|
} else { |
|
|
|
var locationCode = this.fromLocationCode |
|
|
|
if (balances.list == 1) { |
|
|
|
locationCode = balances.list[0].locationCode |
|
|
|
let locationCode = fromLocationCode.value; |
|
|
|
if (balances.list.length === 1) { |
|
|
|
locationCode = balances.list[0].locationCode; |
|
|
|
} else { |
|
|
|
var manyBlances = balances.list.filter(r => r.locationCode != this |
|
|
|
.fromLocationCode) |
|
|
|
const manyBlances = balances.list.filter(r => r.locationCode !== fromLocationCode.value); |
|
|
|
if (manyBlances.length > 0) { |
|
|
|
locationCode = manyBlances[0].locationCode; |
|
|
|
this.showErrorMessage('该包装【' + packageInfo.number + '】在库位【' + |
|
|
|
locationCode + |
|
|
|
'】已经有库存余额,请重新扫描') |
|
|
|
showErrorMessage(`该包装[${packageInfo.number}]在库位[${locationCode}]已经有库存余额,请重新扫描`); |
|
|
|
} else { |
|
|
|
this.afterGetBalance(result); |
|
|
|
afterGetBalance(result); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
showBalanceSelect(items) { |
|
|
|
this.$refs.balanceSelect.openPopup(items); |
|
|
|
}, |
|
|
|
const showBalanceSelect = (items) => { |
|
|
|
// 显示库存选择弹窗的逻辑 |
|
|
|
}; |
|
|
|
|
|
|
|
selectBalanceItem(balance) { |
|
|
|
this.resultData.balance = balance; |
|
|
|
this.afterGetBalance(this.resultData); |
|
|
|
}, |
|
|
|
const selectBalanceItem = (balance) => { |
|
|
|
resultData.value.balance = balance; |
|
|
|
afterGetBalance(resultData.value); |
|
|
|
}; |
|
|
|
|
|
|
|
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) { |
|
|
|
const afterGetBalance = (result) => { |
|
|
|
const balance = result.balance; |
|
|
|
const label = result.label; |
|
|
|
const pack = result.package; |
|
|
|
const packUnit = pack.packUnit; |
|
|
|
const packQty = pack.packQty; |
|
|
|
|
|
|
|
var itemp = createItemInfo(balance, pack); |
|
|
|
let newDetail = createDetailInfo(balance, pack); // |
|
|
|
let item = detailSource.value.find(res => res.itemCode === balance.itemCode); |
|
|
|
if (fromWarehouseCode.value === '') { |
|
|
|
fromWarehouseCode.value = balance.warehouseCode; |
|
|
|
} |
|
|
|
if (!item) { |
|
|
|
const itemp = createItemInfo(balance, pack); |
|
|
|
const newDetail = createDetailInfo(balance, pack); |
|
|
|
newDetail.parentNumber = pack.parentNumber; |
|
|
|
newDetail.packingNumber = pack.number |
|
|
|
newDetail.packingNumber = pack.number; |
|
|
|
newDetail.packUnit = packUnit; |
|
|
|
newDetail.packQty = packQty; |
|
|
|
itemp.subList.push(newDetail); |
|
|
|
this.detailSource.push(itemp) |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
|
|
|
|
detailSource.value.push(itemp); |
|
|
|
calcHandleQty(detailSource.value); |
|
|
|
} 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); |
|
|
|
let detail = item.subList.find(r => r.packingNumber === pack.number && r.batch === balance.batch && r.locationCode === balance.locationCode && r.inventoryStatus === balance.inventoryStatus); |
|
|
|
if (!detail) { |
|
|
|
const 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.packingNumber = pack.number; |
|
|
|
newDetail.packUnit = packUnit; |
|
|
|
newDetail.packQty = packQty; |
|
|
|
item.subList.push(newDetail); |
|
|
|
calcHandleQty(this.detailSource); |
|
|
|
calcHandleQty(detailSource.value); |
|
|
|
} else { |
|
|
|
if (detail.scaned == true) { |
|
|
|
this.showErrorMessage("箱码[" + balance.packingNumber + "批次[" + balance.batch + "]重复扫描") |
|
|
|
if (detail.scaned) { |
|
|
|
showErrorMessage(`箱码[${detail.packingNumber}]批次[${balance.batch}]重复扫描`); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
//获取推荐库位 |
|
|
|
getRecommendLocation(balance, pack, callback) { |
|
|
|
const getRecommendLocation = (balance, pack, callback) => { |
|
|
|
uni.showLoading({ |
|
|
|
title: '扫描中...', |
|
|
|
mask: true |
|
|
|
}) |
|
|
|
let recommend = this.recommendLocationList.find(r => r.itemCode == balance.itemCode); |
|
|
|
if (recommend == undefined) { |
|
|
|
let param = { |
|
|
|
}); |
|
|
|
const recommend = recommendLocationList.value.find(r => r.itemCode === balance.itemCode); |
|
|
|
if (!recommend) { |
|
|
|
const param = { |
|
|
|
itemCode: balance.itemCode, |
|
|
|
batch: balance.batch, |
|
|
|
inventoryStatus: balance.inventoryStatus, |
|
|
|
supplierCode: pack.supplierCode, |
|
|
|
businessCode: this.businessTypeCode |
|
|
|
businessCode: businessTypeCode.value |
|
|
|
}; |
|
|
|
console.log(JSON.stringify(param)) |
|
|
|
getPutawayRecommendLocation(param).then(res => { |
|
|
|
this.recommendLocationList.push({ |
|
|
|
console.log(JSON.stringify(param)); |
|
|
|
uni.request({ |
|
|
|
url: '/api/getPutawayRecommendLocation', |
|
|
|
method: 'POST', |
|
|
|
data: param, |
|
|
|
success: (res) => { |
|
|
|
recommendLocationList.value.push({ |
|
|
|
itemCode: balance.itemCode, |
|
|
|
locationCode: res.data.code |
|
|
|
}) |
|
|
|
}); |
|
|
|
callback(res.data); |
|
|
|
uni.hideLoading(); |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error); |
|
|
|
}, |
|
|
|
fail: (error) => { |
|
|
|
uni.hideLoading(); |
|
|
|
}) |
|
|
|
|
|
|
|
showErrorMessage(error); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
callback(recommend); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
|
this.$refs.comMessage.showErrorMessage(message, res => { |
|
|
|
if (res) {} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
calcTreeHandleQty() { |
|
|
|
for (let item of this.detailSource) { |
|
|
|
const calcHandleQty = (source) => { |
|
|
|
for (let item of source) { |
|
|
|
item.qty = 0; |
|
|
|
for (let detail of item.subList) { |
|
|
|
if (detail != undefined) { |
|
|
|
item.qty = calc.add(item.qty, detail.qty) |
|
|
|
if (detail) { |
|
|
|
item.qty = calc.add(item.qty, detail.qty); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.$forceUpdate(); |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
showSelect() { |
|
|
|
// if (this.editPosition) { |
|
|
|
this.show = true |
|
|
|
// } |
|
|
|
}, |
|
|
|
const showSelect = () => { |
|
|
|
show.value = true; |
|
|
|
}; |
|
|
|
onLoad((option) => { |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: option.title |
|
|
|
}); |
|
|
|
clearData(); |
|
|
|
getBusinessType(businessTypeCode.value, () => {}); |
|
|
|
getWorkShopLineStation(); |
|
|
|
}); |
|
|
|
|
|
|
|
confirmSelect(e) { |
|
|
|
this.positionInfo = e[0].label + "-" + e[1].label + "-" + e[2].label |
|
|
|
console.log("位置", this.positionInfo) |
|
|
|
this.workshopCode = e[0].value |
|
|
|
this.productionLineCode = e[1].value |
|
|
|
this.workStationCode = e[2].value |
|
|
|
this.workShopName = e[0].label |
|
|
|
this.productionLineName = e[1].label |
|
|
|
this.workStationName = e[2].label |
|
|
|
|
|
|
|
let shop = this.positionList.find(shop => shop.value == this.workshopCode); |
|
|
|
if (shop != undefined && shop.children != undefined) { |
|
|
|
let prodLine = shop.children.find(line => line.value == this.productionLineCode); |
|
|
|
if (prodLine != undefined && prodLine.children != undefined) { |
|
|
|
let station = prodLine.children.find(r => r.value == this.workStationCode); |
|
|
|
if (station.rawLocationCode == '' && station.rawLocationCode == null) { |
|
|
|
this.showErrorMessage(this.workStationName + "的原材料库位为空,请重新选择") |
|
|
|
onNavigationBarButtonTap((e) => { |
|
|
|
if (e.index === 0) { |
|
|
|
goHome(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
const confirmSelect = (e) => { |
|
|
|
positionInfo.value = e[0].label + '-' + e[1].label + '-' + e[2].label; |
|
|
|
console.log('位置', positionInfo.value); |
|
|
|
workshopCode.value = e[0].value; |
|
|
|
productionLineCode.value = e[1].value; |
|
|
|
workStationCode.value = e[2].value; |
|
|
|
workShopName.value = e[0].label; |
|
|
|
productionLineName.value = e[1].label; |
|
|
|
workStationName.value = e[2].label; |
|
|
|
|
|
|
|
let shop = positionList.value.find(shop => shop.value === workshopCode.value); |
|
|
|
if (shop && shop.children) { |
|
|
|
let prodLine = shop.children.find(line => line.value === productionLineCode.value); |
|
|
|
if (prodLine && prodLine.children) { |
|
|
|
let station = prodLine.children.find(r => r.value === workStationCode.value); |
|
|
|
if (station.rawLocationCode === '' || station.rawLocationCode === null) { |
|
|
|
showErrorMessage(workStationName.value + '的原材料库位为空,请重新选择'); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
this.rawLocationCode = station.rawLocationCode; |
|
|
|
this.fgLocationCode = station.fgLocationCode; |
|
|
|
rawLocationCode.value = station.rawLocationCode; |
|
|
|
fgLocationCode.value = station.fgLocationCode; |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.showErrorMessage("生产线-工位基础信息维护错误") |
|
|
|
showErrorMessage('生产线-工位基础信息维护错误'); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.showErrorMessage("车间-生产线基础信息维护错误") |
|
|
|
showErrorMessage('车间-生产线基础信息维护错误'); |
|
|
|
} |
|
|
|
|
|
|
|
//赋值到库位代码 |
|
|
|
let toLocationCode = '' |
|
|
|
this.positionList.forEach(item => { |
|
|
|
if (this.workshopCode == item.value) { // 车间 |
|
|
|
let toLocationCode = ''; |
|
|
|
positionList.value.forEach(item => { |
|
|
|
if (workshopCode.value === item.value) { // 车间 |
|
|
|
item.children.find(child => { |
|
|
|
if (this.productionLineCode == child.value) { |
|
|
|
toLocationCode = child.children.find(subChild => this.workStationCode == |
|
|
|
subChild.value).rawLocationCode; |
|
|
|
if (productionLineCode.value === child.value) { |
|
|
|
toLocationCode = child.children.find(subChild => workStationCode.value === subChild.value).rawLocationCode; |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
} |
|
|
|
}) |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
}); |
|
|
|
detailSource.value.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
detail.toLocationCode = toLocationCode |
|
|
|
detail.productionLineCode = this.productionLineCode |
|
|
|
detail.workStationCode = this.workStationCode |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
detail.toLocationCode = toLocationCode; |
|
|
|
detail.productionLineCode = productionLineCode.value; |
|
|
|
detail.workStationCode = workStationCode.value; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
removeItem(index, item) { |
|
|
|
this.detailSource.splice(index, 1) |
|
|
|
}, |
|
|
|
const removeItem = (index) => { |
|
|
|
detailSource.value.splice(index, 1); |
|
|
|
}; |
|
|
|
|
|
|
|
removePack() { |
|
|
|
for (var i = 0; i < this.detailSource.length; i++) { |
|
|
|
var item = this.detailSource[i]; |
|
|
|
if (item.subList.length == 0) { |
|
|
|
this.detailSource.splice(i, 1) |
|
|
|
const removePack = () => { |
|
|
|
for (let i = 0; i < detailSource.value.length; i++) { |
|
|
|
let item = detailSource.value[i]; |
|
|
|
if (item.subList.length === 0) { |
|
|
|
detailSource.value.splice(i, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
this.updateData(); |
|
|
|
}, |
|
|
|
updateData(); |
|
|
|
}; |
|
|
|
|
|
|
|
openScanPopup() { |
|
|
|
if (this.fromLocationCode == "") { |
|
|
|
this.showFromLocationPopup(); |
|
|
|
return |
|
|
|
const openScanPopup = () => { |
|
|
|
if (fromLocationCode.value === '') { |
|
|
|
showFromLocationPopup(); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.$refs.scanPopup.openScanPopupForType(this.fromLocationCode, this.businessType); |
|
|
|
}, |
|
|
|
|
|
|
|
showFromLocationPopup() { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.scanLocationCode.openScanPopup(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
scanPopupRef.value.openScanPopupForType(fromLocationCode.value, businessType.value); |
|
|
|
}; |
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
|
this.$refs.scanPopup.closeScanPopup(); |
|
|
|
const closeScanPopup = () => { |
|
|
|
if (scanPopupRef.value) { |
|
|
|
scanPopupRef.value.closeScanPopup(); |
|
|
|
} |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
scanPopupGetFocus() { |
|
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
|
this.$refs.scanPopup.getfocus(); |
|
|
|
const scanPopupGetFocus = () => { |
|
|
|
if (scanPopupRef.value) { |
|
|
|
scanPopupRef.value.getfocus(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// scanLocationCode(location, code) { |
|
|
|
// this.toLocationCode = code |
|
|
|
// this.toLocationCode = location; |
|
|
|
|
|
|
|
// }, |
|
|
|
}; |
|
|
|
|
|
|
|
commit() { |
|
|
|
const commit = () => { |
|
|
|
uni.showLoading({ |
|
|
|
title: "提交中....", |
|
|
|
title: '提交中....', |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
//记录有目标库位,需要查询管理模式 |
|
|
|
let precisionStrategyParams = getPrecisionStrategyParams(this.detailSource); |
|
|
|
//2:获取管理模式,封装参数 |
|
|
|
let precisionStrategyParams = getPrecisionStrategyParams(detailSource.value); |
|
|
|
getPrecisionStrategyList(precisionStrategyParams, res => { |
|
|
|
if (res.success) { |
|
|
|
this.managementList = res.list; |
|
|
|
var params = { |
|
|
|
...this.setRecordParams() |
|
|
|
} |
|
|
|
console.log("提交参数", JSON.stringify(params)); |
|
|
|
managementList.value = res.list; |
|
|
|
let params = setRecordParams(); |
|
|
|
console.log('提交参数', JSON.stringify(params)); |
|
|
|
|
|
|
|
issueRecordSubmit(params).then(res => { |
|
|
|
uni.hideLoading() |
|
|
|
uni.hideLoading(); |
|
|
|
if (res.data) { |
|
|
|
this.showCommitSuccessMessage("提交成功\n生成直接发料记录\n" + res.data) |
|
|
|
showCommitSuccessMessage(`提交成功\n生成直接发料记录\n${res.data}`); |
|
|
|
} else { |
|
|
|
this.showErrorMessage("提交失败[" + res.msg + "]") |
|
|
|
showErrorMessage(`提交失败[${res.msg}]`); |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
uni.hideLoading() |
|
|
|
this.showErrorMessage(error) |
|
|
|
}) |
|
|
|
uni.hideLoading(); |
|
|
|
showErrorMessage(error); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
uni.hideLoading(); |
|
|
|
this.showErrorMessage(res.message); |
|
|
|
showErrorMessage(res.message); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
setRecordParams() { |
|
|
|
var subList = [] |
|
|
|
var creator = this.$store.state.user.id |
|
|
|
this.detailSource.forEach(item => { |
|
|
|
const setRecordParams = () => { |
|
|
|
let subList = []; |
|
|
|
let creator = store.state.user.id; |
|
|
|
detailSource.value.forEach(item => { |
|
|
|
item.subList.forEach(detail => { |
|
|
|
if (detail.scaned) { |
|
|
|
var info = getPackingNumberAndBatchByList(this.managementList, detail.itemCode, |
|
|
|
detail.packingNumber, detail.toLocationCode, detail.batch); |
|
|
|
var submitItem = deepCopyData(detail) |
|
|
|
let info = getPackingNumberAndBatchByList(managementList.value, detail.itemCode, detail.packingNumber, detail.toLocationCode, detail.batch); |
|
|
|
let submitItem = deepCopyData(detail); |
|
|
|
submitItem.toPackingNumber = info.packingNumber; |
|
|
|
submitItem.toBatch = info.batch; |
|
|
|
submitItem.toContainerNumber = detail.containerNumber; |
|
|
@ -618,10 +539,8 @@ |
|
|
|
submitItem.fromLocationCode = detail.locationCode; |
|
|
|
submitItem.toLocationCode = detail.toLocationCode; |
|
|
|
|
|
|
|
// detail.toInventoryStatus = detail.inventoryStatus |
|
|
|
// detail.toLocationCode = detail.toLocationCode |
|
|
|
submitItem.qty = detail.handleQty; |
|
|
|
submitItem.package = ""; |
|
|
|
submitItem.package = ''; |
|
|
|
submitItem.recordList = [{ |
|
|
|
toInventoryStatus: detail.inventoryStatus, |
|
|
|
fromParentPackingNumber: detail.parentNumber, |
|
|
@ -636,84 +555,103 @@ |
|
|
|
toPackUnit: detail.packUnit, |
|
|
|
fromPackQty: detail.packQty, |
|
|
|
toPackQty: detail.packQty |
|
|
|
}] |
|
|
|
subList.push(submitItem) |
|
|
|
}]; |
|
|
|
subList.push(submitItem); |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (subList.length > 0) { |
|
|
|
this.dataContent.toWarehouseCode = subList[0].toWarehouseCode; |
|
|
|
dataContent.value.toWarehouseCode = subList[0].toWarehouseCode; |
|
|
|
} |
|
|
|
this.dataContent.subList = subList |
|
|
|
this.dataContent.creator = creator; |
|
|
|
this.dataContent.fromWarehouseCode = this.fromWarehouseCode; |
|
|
|
return this.dataContent; |
|
|
|
}, |
|
|
|
dataContent.value.subList = subList; |
|
|
|
dataContent.value.creator = creator; |
|
|
|
dataContent.value.fromWarehouseCode = fromWarehouseCode.value; |
|
|
|
return dataContent.value; |
|
|
|
}; |
|
|
|
|
|
|
|
showMessage(message) { |
|
|
|
this.$refs.comMessage.showMessage(message, res => { |
|
|
|
const showMessage = (message) => { |
|
|
|
comMessageRef.value.showMessage(message, res => { |
|
|
|
if (res) {} |
|
|
|
}); |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
showScanMessage(message) { |
|
|
|
this.$refs.comMessage.showScanMessage(message); |
|
|
|
}, |
|
|
|
const showScanMessage = (message) => { |
|
|
|
comMessageRef.value.showScanMessage(message); |
|
|
|
}; |
|
|
|
|
|
|
|
afterCloseMessage() { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
}, |
|
|
|
const afterCloseMessage = () => { |
|
|
|
scanPopupGetFocus(); |
|
|
|
}; |
|
|
|
|
|
|
|
closeScanMessage() { |
|
|
|
this.scanPopupGetFocus(); |
|
|
|
}, |
|
|
|
getLocation(location, code) { |
|
|
|
this.getFromLocationCode(location, code) |
|
|
|
}, |
|
|
|
getFromLocationCode(location, code) { |
|
|
|
this.fromLocationInfo = location; |
|
|
|
this.fromLocationCode = code; |
|
|
|
this.openScanPopup(); |
|
|
|
}, |
|
|
|
getToLocationCode(location, code) { |
|
|
|
if (this.fromLocationCode == code) { |
|
|
|
const closeScanMessage = () => { |
|
|
|
scanPopupGetFocus(); |
|
|
|
}; |
|
|
|
|
|
|
|
const getLocation = (location, code) => { |
|
|
|
getFromLocationCode(location, code); |
|
|
|
}; |
|
|
|
|
|
|
|
const getFromLocationCode = (location, code) => { |
|
|
|
fromLocationInfo.value = location; |
|
|
|
fromLocationCode.value = code; |
|
|
|
openScanPopup(); |
|
|
|
}; |
|
|
|
|
|
|
|
const getToLocationCode = (location, code) => { |
|
|
|
if (fromLocationCode.value === code) { |
|
|
|
uni.showToast({ |
|
|
|
title: "来源库位[" + this.fromLocationCode + "]不能与目标库位[" + code + "]一致", |
|
|
|
title: `来源库位[${fromLocationCode.value}]不能与目标库位[${code}]一致`, |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
return |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.toLocationCode = code; |
|
|
|
}, |
|
|
|
toLocationCode.value = code; |
|
|
|
}; |
|
|
|
|
|
|
|
showCommitSuccessMessage(hint) { |
|
|
|
this.$refs.comMessage.showSuccessMessage(hint, res => { |
|
|
|
this.clearData(); |
|
|
|
}) |
|
|
|
}, |
|
|
|
const showCommitSuccessMessage = (hint) => { |
|
|
|
comMessageRef.value.showSuccessMessage(hint, res => { |
|
|
|
clearData(); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
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) |
|
|
|
const updateData = () => { |
|
|
|
calcHandleQty(detailSource.value); |
|
|
|
for (let i = 0; i < detailSource.value.length; i++) { |
|
|
|
let item = detailSource.value[i]; |
|
|
|
if (item.qty === 0) { |
|
|
|
detailSource.value.splice(i, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
this.$forceUpdate(); |
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
const clearData = () => { |
|
|
|
fromLocationInfo.value = {}; |
|
|
|
fromLocationCode.value = ''; |
|
|
|
fromWarehouseCode.value = ''; |
|
|
|
toWarehouseCode.value = ''; |
|
|
|
detailSource.value = []; |
|
|
|
positionInfo.value = '请选择生产线'; |
|
|
|
}; |
|
|
|
|
|
|
|
clearData() { |
|
|
|
this.fromLocationInfo = {}; |
|
|
|
this.fromLocationCode = ''; |
|
|
|
this.fromWarehouseCode = ''; |
|
|
|
this.toWarehouseCode = ''; |
|
|
|
this.detailSource = []; |
|
|
|
this.positionInfo = "请选择生产线"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 生命周期钩子 |
|
|
|
onLoad((option) => { |
|
|
|
uni.setNavigationBarTitle({ |
|
|
|
title: option.title |
|
|
|
}); |
|
|
|
clearData(); |
|
|
|
getBusinessType(businessTypeCode.value, () => {}); |
|
|
|
getWorkShopLineStation(); |
|
|
|
}); |
|
|
|
|
|
|
|
onNavigationBarButtonTap((e) => { |
|
|
|
if (e.index === 0) { |
|
|
|
goHome(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|