+
@@ -160,15 +144,17 @@
-
+
-
+
-
+
@@ -190,45 +176,33 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -301,7 +275,7 @@ import {
scanMaterialLabel,
productionReturnConfirm,
printLabelCommon,
- getMaterialLabelByIssueDetail
+ getMaterialLabelByIssueDetail,
} from '@/api/production/production-return'
import moment from 'moment'
@@ -483,12 +457,8 @@ export default {
} catch (error) {
console.warn('恢复生产退料手动页面状态失败', error)
} finally {
- sessionStorage.removeItem(
- 'productionReturnPickingDetail_shouldRestore'
- )
- sessionStorage.removeItem(
- 'productionReturnPickingDetail_state_manual'
- )
+ sessionStorage.removeItem('productionReturnPickingDetail_shouldRestore')
+ sessionStorage.removeItem('productionReturnPickingDetail_state_manual')
}
},
@@ -502,7 +472,7 @@ export default {
batchNo: this.batchNo,
componentPartNo: this.componentPartNo,
}
- scanMaterialLabel(params)
+ scanMaterialLabel(params)
.then(({ data }) => {
if (data.code === 0 && data) {
// 检查是否已经扫描过
@@ -583,7 +553,7 @@ export default {
this.newLabelForm = {
partNo: this.componentPartNo,
partDesc: this.componentPartDesc,
- wdrNo: this.wdrNo|| '*',
+ wdrNo: this.wdrNo || '*',
locationId: '',
height: 0,
quantity: 0,
@@ -611,7 +581,10 @@ export default {
this.$message.warning('请输入物料wdr')
return
}
- if (!this.newLabelForm.locationId || !this.newLabelForm.locationId.trim()) {
+ if (
+ !this.newLabelForm.locationId ||
+ !this.newLabelForm.locationId.trim()
+ ) {
this.$message.warning('请输入库位')
return
}
@@ -681,21 +654,36 @@ export default {
this.$message.warning('扫描数量不能大于总领料数量和已退数量的差!')
return
}
- const hasNewPrint = this.labelList.some(item => {
- return typeof item !== null && item.newPrint === 'NEW';
- });
- if(hasNewPrint && !this.enablePrint){
+ const hasNewPrint = this.labelList.some((item) => {
+ return typeof item !== null && item.newPrint === 'NEW'
+ })
+ if (hasNewPrint && !this.enablePrint) {
this.$message.warning('存在新标签,需勾选打印标签选项!')
return
}
- // 从 labelList 中移除 isInWh 为 'Y' 且 quantity 为 0 的标签
- this.labelList = this.labelList.filter((label) => {
- return !(label.isInWh === 'Y' && (Number(label.quantity) === 0 || !label.quantity));
- });
+ const hasInvalidLabel = this.labelList.some((label) => {
+ const isInWh = label.isInWh
+ const quantity = Number(label.quantity)
+ return isInWh === 'Y' && !isNaN(quantity) && quantity === 0
+ })
+
+ if (hasInvalidLabel) {
+ this.$message.warning('立库已有标签不能有数量')
+
+ return
+ }
+ // 从 labelList 中移除 isInWh 为 'Y' 或 quantity 为 0 的标签
+ let labelLists = this.labelList.filter((label) => {
+ return !(
+ label.isInWh === 'Y' ||
+ (Number(label.quantity) === 0 || !label.quantity)
+ )
+ })
+
// 如果过滤后没有标签了,提示用户
- if (this.labelList.length === 0) {
+ if (labelLists.length === 0) {
this.$message.warning('没有可退料的标签')
return
}
@@ -711,13 +699,13 @@ export default {
itemNo: this.itemNo,
ifsReversedQty: this.qtyReversed,
issueQty: this.quantity,
- notifyNo:this.notifyNo,
- lineItemNo:this.lineItemNo,
+ notifyNo: this.notifyNo,
+ lineItemNo: this.lineItemNo,
releaseNo: this.releaseNo,
sequenceNo: this.sequenceNo,
umId: this.umId,
// 退料标签列表
- selectedMaterials: this.labelList.map((label) => ({
+ selectedMaterials: labelLists.map((label) => ({
labelCode: label.labelCode,
issueQty: label.quantity,
batchNo: label.batchNo,
@@ -730,18 +718,18 @@ export default {
newPrint: label.newPrint || 'OLD',
})),
}
- console.log(returnParams);
-
+ console.log(returnParams)
+
this.loading = true
productionReturnConfirm(returnParams)
.then(({ data }) => {
if (data.code === 0 && data) {
this.$message.success('生产退料成功')
- const unitIds = data.unitIds || [];
+ const unitIds = data.unitIds || []
// 根据勾选框决定是否打印
if (this.enablePrint && unitIds.length > 0) {
- this.printViaServer(unitIds);
+ this.printViaServer(unitIds)
}
this.$router.back()
this.loading = false
@@ -750,7 +738,7 @@ export default {
}
})
.catch(() => {
- this.$message.error(data.msg ||'操作失败')
+ this.$message.error(data.msg || '操作失败')
})
.finally(() => {
this.loading = false
@@ -759,8 +747,8 @@ export default {
async printViaServer(unitIds) {
if (!unitIds || unitIds.length === 0) {
- console.warn('没有可打印的标签');
- return;
+ console.warn('没有可打印的标签')
+ return
}
this.$emit('print-start')
@@ -770,9 +758,9 @@ export default {
username: localStorage.getItem('userName'),
site: localStorage.getItem('site'),
unitIds: unitIds,
- labelType: "BIL标签"
+ labelType: 'BIL标签',
}
- console.log('打印请求:', printRequest);
+ console.log('打印请求:', printRequest)
const { data } = await printLabelCommon(printRequest)
if (data.code === 200 || data.code === 0) {
@@ -786,7 +774,6 @@ export default {
}
},
-
// 关闭打印弹框
closePrintDialog() {
this.showPrintDialog = false
@@ -860,10 +847,10 @@ export default {
batchNo: this.batchNo,
site: localStorage.getItem('site'),
partNo: this.componentPartNo,
- quantity:this.quantity
+ quantity: this.quantity,
}
- getMaterialLabelByIssueDetail(paramdetail).then(({data}) =>{
- if(data.code == 0){
+ getMaterialLabelByIssueDetail(paramdetail).then(({ data }) => {
+ if (data.code == 0) {
this.labelList = data.labelInfo
}
})
@@ -921,7 +908,7 @@ export default {
'物料编码:',
this.partNo,
'关联单号:',
- this.engChgLevel,
+ this.engChgLevel
)
if (!this.orderNo) {
@@ -1029,12 +1016,11 @@ export default {
}
.manual-btn {
-
border: 1px solid #1abc4a;
background: #1abc4a;
color: white;
border-radius: 6px;
- width:60px;
+ width: 60px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;