|
@ -39,7 +39,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script setup> |
|
|
import { goHome, showConfirmMsg, getCurrDateTime } from '@/common/basic.js' |
|
|
import { goHome, showConfirmMsg, getCurrDateTime } from '@/common/basic.js' |
|
|
|
|
|
|
|
|
import { splitPackageRecordSubmit } from '@/api/request2.js' |
|
|
import { splitPackageRecordSubmit } from '@/api/request2.js' |
|
@ -63,201 +63,179 @@ import winComScanBalance from '@/mycomponents/scan/winComScanBalance.vue' |
|
|
import uom from '@/mycomponents/qty/uom.vue' |
|
|
import uom from '@/mycomponents/qty/uom.vue' |
|
|
import numberBox from '@/mycomponents/qty/numberBox.vue' |
|
|
import numberBox from '@/mycomponents/qty/numberBox.vue' |
|
|
|
|
|
|
|
|
export default { |
|
|
import { ref, onMounted, nextTick } from 'vue'; |
|
|
components: { |
|
|
import { onLoad, onNavigationBarButtonTap, onBackPress, onPullDownRefresh } from '@dcloudio/uni-app'; |
|
|
winScanButton, |
|
|
|
|
|
winScanPack, |
|
|
const id = ref(''); |
|
|
requiredLocation, |
|
|
const detailSource = ref([]); // 绑定在页面上的数据源 |
|
|
comBlankView, |
|
|
const fromLocationCode = ref(''); |
|
|
winScanLocation, |
|
|
const toLocationCode = ref(''); |
|
|
winScanPackAndLocation, |
|
|
const fromLocationAreaTypeList = ref([]); |
|
|
recommendBalance, |
|
|
const inInventoryStatus = ref(''); // 目标入库库存状态 |
|
|
recordComDetailCard, |
|
|
const outInventoryStatus = ref(''); // 来源出库库存状态 |
|
|
comPackageRecord, |
|
|
const businessType = ref({}); |
|
|
winComScanBalance, |
|
|
const dataContent = ref({}); |
|
|
uom, |
|
|
const currentItemCode = ref(''); |
|
|
numberBox |
|
|
const toPackingNumber = ref(''); |
|
|
}, |
|
|
const itemCode = ref(''); |
|
|
data() { |
|
|
const splitCount = ref(1); |
|
|
return { |
|
|
const typeCode = ref('SplitPackage'); |
|
|
id: '', |
|
|
const fromInventoryStatuses = ref(null) |
|
|
detailSource: [], // 绑定在页面上的数据源 |
|
|
const scanPopupRef = ref(null); |
|
|
fromLocationCode: '', |
|
|
const comMessageRef = ref(null); |
|
|
toLocationCode: '', |
|
|
const fromPackUnit = ref(''); |
|
|
fromLocationAreaTypeList: [], |
|
|
const fromPack = ref({}) |
|
|
inInventoryStatus: '', // 目标入库库存状态 |
|
|
onLoad((option) => { |
|
|
outInventoryStatus: '', // 来源出库库存状态 |
|
|
|
|
|
businessType: {}, |
|
|
|
|
|
dataContent: {}, |
|
|
|
|
|
currentItemCode: '', |
|
|
|
|
|
toPackingNumber: '', |
|
|
|
|
|
itemCode: '', |
|
|
|
|
|
splitCount: 1, |
|
|
|
|
|
typeCode: 'SplitPackage' |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
onLoad(option) { |
|
|
|
|
|
uni.setNavigationBarTitle({ |
|
|
uni.setNavigationBarTitle({ |
|
|
title: option.title |
|
|
title: option.title |
|
|
}) |
|
|
}); |
|
|
this.getBusinessType() |
|
|
getBusinessType(); |
|
|
}, |
|
|
}); |
|
|
// 返回首页 |
|
|
|
|
|
onNavigationBarButtonTap(e) { |
|
|
onNavigationBarButtonTap((e) => { |
|
|
if (e.index === 0) { |
|
|
if (e.index === 0) { |
|
|
goHome() |
|
|
goHome(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}); |
|
|
// 拦截返回按钮事件 |
|
|
|
|
|
onBackPress(e) {}, |
|
|
|
|
|
|
|
|
|
|
|
onPullDownRefresh() {}, |
|
|
|
|
|
|
|
|
|
|
|
mounted() {}, |
|
|
const getBusinessType = () => { |
|
|
methods: { |
|
|
getBusinessTypeApi(typeCode.value, (res) => { |
|
|
getBusinessType() { |
|
|
|
|
|
getBusinessType(this.typeCode, (res) => { |
|
|
|
|
|
if (res.success) { |
|
|
if (res.success) { |
|
|
this.businessType = res.businessType |
|
|
businessType.value = res.businessType; |
|
|
this.fromInventoryStatuses = getDirectoryItemArray(res.fromInventoryStatuses) |
|
|
fromInventoryStatuses.value = getDirectoryItemArray(res.fromInventoryStatuses); |
|
|
this.fromLocationAreaTypeList = res.fromLocationAreaTypeList |
|
|
fromLocationAreaTypeList.value = res.fromLocationAreaTypeList; |
|
|
this.openScanPopup() |
|
|
openScanPopup(); |
|
|
} else { |
|
|
} else { |
|
|
this.showErrorMessage(res.message) |
|
|
showErrorMessage(res.message); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}; |
|
|
openScanPopup() { |
|
|
|
|
|
if (this.businessType) { |
|
|
const openScanPopup = () => { |
|
|
if (this.detailSource.length > 0) { |
|
|
if (businessType.value) { |
|
|
|
|
|
if (detailSource.value.length > 0) { |
|
|
showConfirmMsg('拆包信息还没提交,是否要重新扫描?', (res) => { |
|
|
showConfirmMsg('拆包信息还没提交,是否要重新扫描?', (res) => { |
|
|
if (res) { |
|
|
if (res) { |
|
|
this.clearData() |
|
|
clearData(); |
|
|
this.$refs.scanPopup.openScanPopup(this.businessType) |
|
|
scanPopupRef.value.openScanPopup(businessType.value); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
this.$refs.scanPopup.openScanPopup(this.businessType) |
|
|
scanPopupRef.value.openScanPopup(businessType.value); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
this.getBusinessType() |
|
|
getBusinessType(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
getScanResult(result) { |
|
|
const getScanResult = (result) => { |
|
|
this.setData(result) |
|
|
setData(result); |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
setData(result) { |
|
|
const setData = (result) => { |
|
|
const { balance } = result |
|
|
const { balance } = result; |
|
|
const { label } = result |
|
|
const { label } = result; |
|
|
const pack = result.package |
|
|
const pack = result.package; |
|
|
this.fromPackUnit = pack.packUnit |
|
|
fromPackUnit.value = pack.packUnit; |
|
|
this.fromPack = pack |
|
|
fromPack.value = pack; |
|
|
if (this.fromLocationCode && this.fromLocationCode != balance.locationCode) { |
|
|
|
|
|
this.showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]在库位[${this.fromLocationCode}]没有库存余额`) |
|
|
if (fromLocationCode.value && fromLocationCode.value !== balance.locationCode) { |
|
|
return |
|
|
showErrorMessage(`箱码[${balance.packingNumber}批次[${balance.batch}]在库位[${fromLocationCode.value}]没有库存余额`); |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const item = this.detailSource.find((res) => { |
|
|
const item = detailSource.value.find((res) => res.itemCode === balance.itemCode); |
|
|
if (res.itemCode == balance.itemCode) { |
|
|
if (!item) { |
|
|
return res |
|
|
if (itemCode.value !== '' && itemCode.value !== balance.itemCode) { |
|
|
} |
|
|
showErrorMessage(`请扫描物料为【${itemCode.value}】的箱码`); |
|
|
}) |
|
|
return; |
|
|
if (item == undefined) { |
|
|
|
|
|
if (this.itemCode != '' && this.itemCode != balance.itemCode) { |
|
|
|
|
|
this.showErrorMessage(`请扫描物料为【${this.itemCode}】的箱码`) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
} |
|
|
const itemp = createItemInfo(balance, pack) |
|
|
const itemp = createItemInfo(balance, pack); |
|
|
itemp.handleQty = 0 |
|
|
itemp.handleQty = 0; |
|
|
const newDetail = createDetailInfo(balance, pack) // |
|
|
const newDetail = createDetailInfo(balance, pack); |
|
|
newDetail.handleQty = 0 |
|
|
newDetail.handleQty = 0; |
|
|
newDetail.scaned = false |
|
|
newDetail.scaned = false; |
|
|
itemp.subList.push(newDetail) |
|
|
itemp.subList.push(newDetail); |
|
|
this.detailSource.push(itemp) |
|
|
detailSource.value.push(itemp); |
|
|
this.itemCode = balance.itemCode |
|
|
itemCode.value = balance.itemCode; |
|
|
this.fromLocationCode = balance.locationCode |
|
|
fromLocationCode.value = balance.locationCode; |
|
|
this.closeScanPopup() |
|
|
closeScanPopup(); |
|
|
} else { |
|
|
} else { |
|
|
const detail = item.subList.find((r) => { |
|
|
const detail = item.subList.find((r) => r.packingNumber === pack.packingNumber && r.batch === balance.batch && r.locationCode === balance.locationCode && r.inventoryStatus === balance.inventoryStatus); |
|
|
if (r.packingNumber == pack.packingNumber && r.batch == balance.batch && r.locationCode == balance.locationCode && r.inventoryStatus == balance.inventoryStatus) { |
|
|
if (!detail) { |
|
|
return r |
|
|
const newDetail = createDetailInfo(balance, pack); |
|
|
|
|
|
newDetail.handleQty = 0; |
|
|
|
|
|
item.subList.push(newDetail); |
|
|
|
|
|
closeScanPopup(); |
|
|
|
|
|
} else if (detail.scaned) { |
|
|
|
|
|
showErrorMessage(`箱码[${detail.packingNumber}批次[${balance.batch}]重复扫描`); |
|
|
} |
|
|
} |
|
|
}) |
|
|
|
|
|
if (detail == undefined) { |
|
|
|
|
|
const newDetail = createDetailInfo(balance, pack) |
|
|
|
|
|
newDetail.handleQty = 0 |
|
|
|
|
|
item.subList.push(newDetail) |
|
|
|
|
|
this.closeScanPopup() |
|
|
|
|
|
} else if (detail.scaned == true) { |
|
|
|
|
|
this.showErrorMessage(`箱码[${detail.packingNumber}批次[${balance.batch}]重复扫描`) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
calcHandleQtyFun(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const calcHandleQtyFun = () => { |
|
|
|
|
|
calcHandleQty(detailSource.value); |
|
|
|
|
|
nextTick(() => { |
|
|
|
|
|
// 强制更新视图 |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const showErrorMessage = (message) => { |
|
|
|
|
|
comMessageRef.value.showErrorMessage(message, (res) => { |
|
|
|
|
|
if (res) {} |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const updateData = () => { |
|
|
|
|
|
calcHandleQtyFun(); |
|
|
|
|
|
for (let i = 0; i < detailSource.value.length; i++) { |
|
|
|
|
|
const item = detailSource.value[i]; |
|
|
|
|
|
if (item.qty === 0) { |
|
|
|
|
|
detailSource.value.splice(i, 1); |
|
|
} |
|
|
} |
|
|
this.calcHandleQty() |
|
|
} |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
calcHandleQty() { |
|
|
const removeItem = (index) => { |
|
|
calcHandleQty(this.detailSource) |
|
|
detailSource.value.splice(index, 1); |
|
|
this.$forceUpdate() |
|
|
}; |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showErrorMessage(message) { |
|
|
const closeScanPopup = () => { |
|
|
this.$refs.comMessage.showErrorMessage(message, (res) => { |
|
|
if (scanPopupRef.value) { |
|
|
if (res) { |
|
|
scanPopupRef.value.closeScanPopup(); |
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
updateData() { |
|
|
|
|
|
this.calcHandleQty() |
|
|
|
|
|
for (let i = 0; i < this.detailSource.length; i++) { |
|
|
|
|
|
const item = this.detailSource[i] |
|
|
|
|
|
if (item.qty == 0) { |
|
|
|
|
|
this.detailSource.splice(i, 1) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}, |
|
|
|
|
|
removeItem(index, item) { |
|
|
|
|
|
this.detailSource.splice(index, 1) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
closeScanPopup() { |
|
|
|
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
|
|
|
this.$refs.scanPopup.closeScanPopup() |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
scanPopupGetFocus() { |
|
|
const scanPopupGetFocus = () => { |
|
|
if (this.$refs.scanPopup != undefined) { |
|
|
if (scanPopupRef.value) { |
|
|
this.$refs.scanPopup.getfocus() |
|
|
scanPopupRef.value.getfocus(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
commit() { |
|
|
const commit = () => { |
|
|
if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { |
|
|
if (detailSource.value.length > 0 && detailSource.value[0].subList.length > 0) { |
|
|
if (this.splitCount <= 0) { |
|
|
if (splitCount.value <= 0) { |
|
|
this.showErrorMessage('拆出数量必须大于0') |
|
|
showErrorMessage('拆出数量必须大于0'); |
|
|
return |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (this.splitCount >= this.detailSource[0].qty) { |
|
|
if (splitCount.value >= detailSource.value[0].qty) { |
|
|
this.showErrorMessage('拆出数量不能大于等于库存数量') |
|
|
showErrorMessage('拆出数量不能大于等于库存数量'); |
|
|
return |
|
|
return; |
|
|
} |
|
|
} |
|
|
uni.showLoading({ |
|
|
uni.showLoading({ |
|
|
title: '提交中....', |
|
|
title: '提交中....', |
|
|
mask: true |
|
|
mask: true |
|
|
}) |
|
|
}); |
|
|
|
|
|
|
|
|
const params = this.setParams() |
|
|
const params = setParams(); |
|
|
console.log(`提交${JSON.stringify(params)}`) |
|
|
console.log(`提交${JSON.stringify(params)}`); |
|
|
splitPackageRecordSubmit(params) |
|
|
splitPackageRecordSubmit(params) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading(); |
|
|
if (res.data) { |
|
|
if (res.data) { |
|
|
const list = [] |
|
|
const list = res.data.map((item) => ({ |
|
|
res.data.forEach((item) => { |
|
|
|
|
|
list.push({ |
|
|
|
|
|
itemCode: item.itemCode, // 物品代码 |
|
|
itemCode: item.itemCode, // 物品代码 |
|
|
itemName: item.itemName, // 物品名称 |
|
|
itemName: item.itemName, // 物品名称 |
|
|
packName: item.packName, // 包装名称 |
|
|
packName: item.packName, // 包装名称 |
|
@ -272,104 +250,99 @@ export default { |
|
|
productionLineCode: item.productionLineCode, // 生产线 |
|
|
productionLineCode: item.productionLineCode, // 生产线 |
|
|
barcodeString: item.barcodeString, // 标签信息 |
|
|
barcodeString: item.barcodeString, // 标签信息 |
|
|
barcodeBase64: '' |
|
|
barcodeBase64: '' |
|
|
}) |
|
|
})); |
|
|
}) |
|
|
showCommitSuccessMessage('提交成功\n生成拆包记录\n', list); |
|
|
this.showCommitSuccessMessage('提交成功\n生成拆包记录\n', list) |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.showErrorMessage(`提交失败[${res.msg}]`) |
|
|
showErrorMessage(`提交失败[${res.msg}]`); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch((error) => { |
|
|
.catch((error) => { |
|
|
uni.hideLoading() |
|
|
uni.hideLoading(); |
|
|
this.showErrorMessage(error) |
|
|
showErrorMessage(error); |
|
|
}) |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
this.showErrorMessage('没有要提交的数据') |
|
|
showErrorMessage('没有要提交的数据'); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
setParams() { |
|
|
const setParams = () => { |
|
|
const subList = [] |
|
|
const subList = []; |
|
|
const creator = this.$store.state.user.id |
|
|
const creator = store.state.user.id; |
|
|
this.detailSource.forEach((item) => { |
|
|
detailSource.value.forEach((item) => { |
|
|
item.subList.forEach((detail) => { |
|
|
item.subList.forEach((detail) => { |
|
|
const subItem = {} |
|
|
const subItem = { ...detail }; |
|
|
Object.assign(subItem, detail) |
|
|
subItem.itemCode = subItem.itemCode; |
|
|
subItem.itemCode = subItem.itemCode |
|
|
subItem.itemName = detail.package.itemName; |
|
|
subItem.itemName = detail.package.itemName |
|
|
subItem.itemDesc1 = detail.package.itemDesc1; |
|
|
subItem.itemDesc1 = detail.package.itemDesc1 |
|
|
subItem.itemDesc2 = detail.package.itemDesc2; |
|
|
subItem.itemDesc2 = detail.package.itemDesc2 |
|
|
|
|
|
|
|
|
subItem.fromInventoryStatus = subItem.inventoryStatus; |
|
|
subItem.fromInventoryStatus = subItem.inventoryStatus |
|
|
subItem.toInventoryStatus = subItem.inventoryStatus; |
|
|
subItem.toInventoryStatus = subItem.inventoryStatus |
|
|
|
|
|
|
|
|
subItem.fromQty = subItem.qty; |
|
|
subItem.fromQty = subItem.qty |
|
|
subItem.toQty = splitCount.value; |
|
|
subItem.toQty = this.splitCount |
|
|
|
|
|
|
|
|
subItem.fromPackingNumber = subItem.packingNumber; |
|
|
subItem.fromPackingNumber = subItem.packingNumber |
|
|
subItem.toPackingNumber = subItem.packingNumber; |
|
|
subItem.toPackingNumber = subItem.packingNumber |
|
|
|
|
|
|
|
|
subItem.fromBatch = subItem.batch; |
|
|
subItem.fromBatch = subItem.batch |
|
|
subItem.toBatch = subItem.batch; |
|
|
subItem.toBatch = subItem.batch |
|
|
subItem.locationCode = detail.locationCode; |
|
|
subItem.locationCode = detail.locationCode |
|
|
subItem.package = ''; |
|
|
subItem.package = '' |
|
|
subItem.Records = ''; |
|
|
subItem.Records = '' |
|
|
subList.push(subItem); |
|
|
subList.push(subItem) |
|
|
}); |
|
|
}) |
|
|
}); |
|
|
}) |
|
|
|
|
|
|
|
|
dataContent.value.subList = subList; |
|
|
this.dataContent.subList = subList |
|
|
dataContent.value.creator = creator; |
|
|
this.dataContent.creator = creator |
|
|
return dataContent.value; |
|
|
return this.dataContent |
|
|
}; |
|
|
}, |
|
|
|
|
|
|
|
|
const showMessage = (message) => { |
|
|
showMessage(message) { |
|
|
comMessageRef.value.showMessage(message, (res) => { |
|
|
this.$refs.comMessage.showMessage(message, (res) => { |
|
|
if (res) {} |
|
|
if (res) { |
|
|
}); |
|
|
} |
|
|
}; |
|
|
}) |
|
|
|
|
|
}, |
|
|
const showScanMessage = (message) => { |
|
|
|
|
|
comMessageRef.value.showScanMessage(message); |
|
|
showScanMessage(message) { |
|
|
}; |
|
|
this.$refs.comMessage.showScanMessage(message) |
|
|
|
|
|
}, |
|
|
const afterCloseMessage = () => { |
|
|
|
|
|
scanPopupGetFocus(); |
|
|
afterCloseMessage() { |
|
|
}; |
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
}, |
|
|
const closeScanMessage = () => { |
|
|
|
|
|
scanPopupGetFocus(); |
|
|
closeScanMessage() { |
|
|
}; |
|
|
this.scanPopupGetFocus() |
|
|
|
|
|
}, |
|
|
const showCommitSuccessMessage = (hint, pointData) => { |
|
|
|
|
|
comMessageRef.value.showSuccessMessage(hint, (res) => { |
|
|
showCommitSuccessMessage(hint, pointData) { |
|
|
clearData(); |
|
|
this.$refs.comMessage.showSuccessMessage(hint, (res) => { |
|
|
|
|
|
this.clearData() |
|
|
|
|
|
if (pointData.length > 0) { |
|
|
if (pointData.length > 0) { |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: `/pages/point/index?points=${JSON.stringify(pointData)}` |
|
|
url: `/pages/point/index?points=${JSON.stringify(pointData)}` |
|
|
}) |
|
|
}); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}); |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
clearData() { |
|
|
const clearData = () => { |
|
|
this.detailSource = [] |
|
|
detailSource.value = []; |
|
|
this.fromLocationCode = '' |
|
|
fromLocationCode.value = ''; |
|
|
this.currentItemCode = '' |
|
|
currentItemCode.value = ''; |
|
|
this.dataContent = {} |
|
|
dataContent.value = {}; |
|
|
this.itemCode = '' |
|
|
itemCode.value = ''; |
|
|
this.splitCount = 1 |
|
|
splitCount.value = 1; |
|
|
}, |
|
|
}; |
|
|
|
|
|
|
|
|
calcQty(val) { |
|
|
const calcQty = (val) => { |
|
|
this.splitCount = val |
|
|
splitCount.value = val; |
|
|
// if(val<=0){ |
|
|
// if (val <= 0) { |
|
|
// this.showErrorMessage("数量必须大于0") |
|
|
// showErrorMessage("数量必须大于0"); |
|
|
// } |
|
|
// } |
|
|
} |
|
|
}; |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style scoped lang="scss"></style> |
|
|
<style scoped lang="scss"></style> |
|
|