|
|
@@ -40,7 +40,7 @@
|
|
|
left-icon=""
|
|
|
placeholder="请扫描容器号"
|
|
|
autocomplete="off"
|
|
|
- @search="onConfirm"
|
|
|
+ @search="isCheck()"
|
|
|
@focus="scanType=5"
|
|
|
@blur="scanType=2"
|
|
|
></van-search>
|
|
|
@@ -78,7 +78,7 @@
|
|
|
show-action
|
|
|
:min="1"
|
|
|
:max="asnInfo.asnNo?asnInfo.expectedQuantity-asnInfo.receivedQuantity:10000"
|
|
|
- @search="onConfirm"
|
|
|
+ @search="isCheck()"
|
|
|
:class="[scanType===4?'search-input-barcode':'','van-hairline--bottom']"
|
|
|
@focus="scanType=4"
|
|
|
>
|
|
|
@@ -574,13 +574,12 @@ const _getCommodityRule = (item) => {
|
|
|
*/
|
|
|
const containerNoRef = ref(null)
|
|
|
const numberRef = ref(null)
|
|
|
-// 完成收货
|
|
|
-const onConfirm = () => {
|
|
|
-
|
|
|
+// 完成收货校验
|
|
|
+const isCheck = () => {
|
|
|
if (!asnInfo.value.asnNo) {
|
|
|
scanError()
|
|
|
showToast({ duration: 3000, message: '请先查询商品收货信息' })
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
//商品物理属性判断
|
|
|
if (!attributeTrueFalseBy.value) {
|
|
|
@@ -589,14 +588,14 @@ const onConfirm = () => {
|
|
|
attributeTrueFalseBy.value = false
|
|
|
attributeRef.value?.show(isAttributeInfo, attributeMap.value)
|
|
|
}
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
// //商品批次属性判断
|
|
|
const incompleteLot = lotData.value.find(lot => lot.require && !lot.mapping)
|
|
|
if (incompleteLot) {
|
|
|
scanError()
|
|
|
showToast({ duration: 3000, message: `请先补充${incompleteLot.label}` })
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
const lotMap = toMap(lotData.value, 'field', 'mapping')
|
|
|
const productionDate = lotMap['lotAtt01'] ? new Date(lotMap['lotAtt01']) : null
|
|
|
@@ -608,13 +607,13 @@ const onConfirm = () => {
|
|
|
if (productionDate && expirationDate <= productionDate) {
|
|
|
scanError()
|
|
|
showToast({ duration: 3000, message: `失效日期不能小于等于生产日期` })
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
// 检查失效日期是否小于当前日期
|
|
|
if (expirationDate <= currentDate) {
|
|
|
scanError()
|
|
|
showToast({ duration: 3000, message: `失效日期不能小于等于当前日期` })
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
}
|
|
|
if(productionDate){
|
|
|
@@ -622,63 +621,65 @@ const onConfirm = () => {
|
|
|
if (expirationDate && productionDate >= expirationDate) {
|
|
|
scanError()
|
|
|
showToast({ duration: 3000, message: `生产日期不能大于失效日期` })
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
// 检查生产日期是否小于当前日期
|
|
|
if (productionDate >= currentDate) {
|
|
|
scanError()
|
|
|
showToast({ duration: 3000, message: `生产日期不能大于等于当前日期` })
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
}
|
|
|
if (searchCount.value == '') {
|
|
|
numberRef.value?.focus()
|
|
|
scanError()
|
|
|
showToast({ duration: 3000, message: '请先输入收货数量' })
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
if (containerNo.value == '') {
|
|
|
scanError()
|
|
|
containerNoRef.value?.focus()
|
|
|
showToast({ duration: 3000, message: '请先输入容器号' })
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
// 唯一码收集
|
|
|
if (uniqueRuleList.value.length > 0 && uniqueCodeList.value.length != searchCount.value) {
|
|
|
scanType.value = 3
|
|
|
uniqueCodeRef.value?.show('', '请扫描唯一码', `收货数量:${searchCount.value}`, uniqueRuleMap.value)
|
|
|
- return
|
|
|
+ return false
|
|
|
}
|
|
|
- receiving()
|
|
|
+ return true
|
|
|
}
|
|
|
// 收货
|
|
|
-const receiving = () => {
|
|
|
- const lotMap = toMap(lotData.value, 'field', 'mapping')
|
|
|
- const { asnLineNo, asnNo, warehouse } = asnInfo.value
|
|
|
- const data = {
|
|
|
- asnLineNo,
|
|
|
- asnNo,
|
|
|
- containerId: containerNo.value,
|
|
|
- quantity: searchCount.value,
|
|
|
- warehouse,
|
|
|
- serialNos: uniqueCodeList.value.length > 0 ? uniqueCodeList.value : undefined,
|
|
|
- ...lotMap,
|
|
|
- }
|
|
|
- showLoading()
|
|
|
- inputBarcodeType.value='task'
|
|
|
- setReceiving(data).then(res => {
|
|
|
- scanSuccess()
|
|
|
- showNotify({ type: 'success', duration: 3000, message: `${searchBarcode.value}收货完成,请继续收货!`})
|
|
|
- setBarcode(taskNo.value, '2')
|
|
|
- closeLoading()
|
|
|
- }).catch(err => {
|
|
|
- if(err.message.includes('序列号已存在')){
|
|
|
- scanType.value = 3
|
|
|
- uniqueCodeRef.value?.show('', '请扫描唯一码', `收货数量:${searchCount.value},${err.message}`, uniqueRuleMap.value)
|
|
|
+const onConfirm = () => {
|
|
|
+ if(isCheck()){
|
|
|
+ const lotMap = toMap(lotData.value, 'field', 'mapping')
|
|
|
+ const { asnLineNo, asnNo, warehouse } = asnInfo.value
|
|
|
+ const data = {
|
|
|
+ asnLineNo,
|
|
|
+ asnNo,
|
|
|
+ containerId: containerNo.value,
|
|
|
+ quantity: searchCount.value,
|
|
|
+ warehouse,
|
|
|
+ serialNos: uniqueCodeList.value.length > 0 ? uniqueCodeList.value : undefined,
|
|
|
+ ...lotMap,
|
|
|
+ }
|
|
|
+ showLoading()
|
|
|
+ inputBarcodeType.value='task'
|
|
|
+ setReceiving(data).then(res => {
|
|
|
+ scanSuccess()
|
|
|
+ showNotify({ type: 'success', duration: 3000, message: `${searchBarcode.value}收货完成,请继续收货!`})
|
|
|
+ setBarcode(taskNo.value, '2')
|
|
|
+ closeLoading()
|
|
|
+ }).catch(err => {
|
|
|
+ if(err.message.includes('序列号已存在')){
|
|
|
+ scanType.value = 3
|
|
|
+ uniqueCodeRef.value?.show('', '请扫描唯一码', `收货数量:${searchCount.value},${err.message}`, uniqueRuleMap.value)
|
|
|
+ }
|
|
|
+ scanError()
|
|
|
+ closeLoading()
|
|
|
+ })
|
|
|
}
|
|
|
- scanError()
|
|
|
- closeLoading()
|
|
|
- })
|
|
|
}
|
|
|
|
|
|
// 数据刷新
|