feat(钢卷管理): 添加长度字段支持及相关功能
refactor(订单管理): 重构订单状态显示及操作记录功能 fix(权限控制): 移除导出订单明细的权限校验 perf(钢卷操作): 使用策略模式重构钢卷操作逻辑
This commit is contained in:
@@ -110,6 +110,11 @@
|
||||
<el-input v-model="form.netWeight" placeholder="请输入净重" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="长度" prop="length">
|
||||
<el-input v-model="form.length" placeholder="请输入长度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
|
||||
@@ -229,6 +229,7 @@ import ProductSelect from "@/components/KLPService/ProductSelect";
|
||||
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
||||
import { Pagination } from 'element-ui';
|
||||
import { listDeliveryPlan } from '@/api/wms/deliveryPlan'
|
||||
import handleCoil, { COIL_ACTIONS } from '../js/coilActions'
|
||||
|
||||
// 键值为[400, 500), 不包含在字典中,但后续可以加入的特殊操作,这类操作录入后会立刻完成,例如入库(401)和发货(402)
|
||||
|
||||
@@ -354,26 +355,16 @@ export default {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
addMaterialCoil(this.form).then(response => {
|
||||
addPendingAction({
|
||||
// 计划ID 对应 warehouseId, warehouseId字段并不是仓库ID,而是一个根据操作类型自适应的查询字段
|
||||
warehouseId: this.form.planId,
|
||||
actionType: 401,
|
||||
currentCoilNo: this.form.currentCoilNo,
|
||||
sourceType: 'manual',
|
||||
coilId: response.data.coilId,
|
||||
priority: 0,
|
||||
remark: this.form.remark,
|
||||
actionStatus: 0,
|
||||
}).then(res => {
|
||||
handleCoil(COIL_ACTIONS.RECEIVE, this.form, this.form.planId)
|
||||
.then(res => {
|
||||
this.$modal.msgSuccess("入库成功");
|
||||
this.$refs.form.resetFields();
|
||||
this.getList()
|
||||
})
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
// 打开收货弹窗
|
||||
@@ -394,20 +385,13 @@ export default {
|
||||
this.$modal.confirm("收货后刚钢卷会进入库存并占用所选的实际库区,是否继续?").then(() => {
|
||||
this.buttonLoading = true;
|
||||
// 更新操作记录状态 actionStatus: 2
|
||||
updatePendingAction({
|
||||
...this.receiptForm,
|
||||
actionStatus: 2,
|
||||
}).then(_ => {
|
||||
this.$message.success("确认收货成功");
|
||||
this.getList()
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
// 更新钢卷状态为当前钢卷; dataType: 1
|
||||
updateMaterialCoilSimple({
|
||||
...this.coilInfo,
|
||||
dataType: 1,
|
||||
})
|
||||
handleCoil(COIL_ACTIONS.STORE, this.coilInfo, this.receiptForm)
|
||||
.then(_ => {
|
||||
this.$message.success("确认收货成功");
|
||||
this.getList()
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
})
|
||||
},
|
||||
// 取消操作
|
||||
|
||||
79
klp-ui/src/views/wms/coil/js/coilActions.js
Normal file
79
klp-ui/src/views/wms/coil/js/coilActions.js
Normal file
@@ -0,0 +1,79 @@
|
||||
import { addMaterialCoil, updateMaterialCoil, updateMaterialCoilSimple } from "@/api/wms/coil"
|
||||
import { addPendingAction, updatePendingAction } from '@/api/wms/pendingAction';
|
||||
|
||||
export const COIL_ACTIONS = {
|
||||
RECEIVE: 'RECEIVE', // 收货与入库的区别在于,收货相当于计划入库,不管是否已到货都执行这个操作,计划收货也是收获
|
||||
STORE: 'STORE', // 入库相当于实际收货与入库
|
||||
CORRECTION: 'CORRECTION',
|
||||
PROCESSING: 'PROCESSING',
|
||||
MERGE: 'MERGE',
|
||||
SPLIT: 'SPLIT',
|
||||
PACK: 'PACK',
|
||||
DELIVER: 'DELIVER',
|
||||
MOVE: 'MOVE',
|
||||
EDIT: 'EDIT', // 对应“根据库位码编辑钢卷信息”
|
||||
ALLOCATE: 'ALLOCATE'
|
||||
}
|
||||
|
||||
export const actions = Object.values(COIL_ACTIONS)
|
||||
|
||||
export const actionStrategies = {
|
||||
RECEIVE: {
|
||||
type: COIL_ACTIONS.RECEIVE,
|
||||
name: '计划钢卷收货',
|
||||
description: '计划钢卷收货,不管是否已到货都执行这个操作,计划收货也是收货',
|
||||
handler: async (coil, planId) => {
|
||||
// 收货逻辑,创建一个dataType为10的钢卷,和一个待操作记录
|
||||
const response = await addMaterialCoil({
|
||||
...coil,
|
||||
dataType: 10,
|
||||
})
|
||||
await addPendingAction({
|
||||
// 计划ID 对应 warehouseId, warehouseId字段并不是仓库ID,而是一个根据操作类型自适应的查询字段
|
||||
warehouseId: planId,
|
||||
actionType: 401,
|
||||
currentCoilNo: coil.currentCoilNo,
|
||||
sourceType: 'manual',
|
||||
coilId: response.data.coilId,
|
||||
priority: 0,
|
||||
remark: coil.remark,
|
||||
actionStatus: 0,
|
||||
})
|
||||
return response.data.coilId
|
||||
}
|
||||
},
|
||||
STORE: {
|
||||
type: COIL_ACTIONS.STORE,
|
||||
name: '实际钢卷入库',
|
||||
description: '实际钢卷入库,只有在已到货的情况下才执行这个操作',
|
||||
handler: async (coil, action) => {
|
||||
// 更新操作记录状态 actionStatus: 2
|
||||
// 并行执行更新操作记录和更新钢卷状态
|
||||
await Promise.all([
|
||||
updatePendingAction({
|
||||
...action,
|
||||
actionStatus: 2,
|
||||
}),
|
||||
updateMaterialCoilSimple({
|
||||
...coil,
|
||||
dataType: 1,
|
||||
})
|
||||
])
|
||||
return true
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
const handleCoil = (action, ...args) => {
|
||||
const strategy = actionStrategies[action]
|
||||
if (strategy && strategy.handler) {
|
||||
return strategy.handler(...args)
|
||||
} else {
|
||||
console.error(`No strategy found for action: ${action}`)
|
||||
}
|
||||
}
|
||||
|
||||
export default handleCoil
|
||||
|
||||
|
||||
@@ -182,6 +182,12 @@
|
||||
<template slot="append">吨</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="长度(m)">
|
||||
<el-input v-model.number="targetCoil.length" placeholder="请输入长度" type="number" step="0.01"
|
||||
:disabled="readonly">
|
||||
<template slot="append">米</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑库区">
|
||||
<WarehouseSelect
|
||||
v-model="targetCoil.warehouseId"
|
||||
@@ -257,7 +263,8 @@ export default {
|
||||
qualityStatus: '',
|
||||
packagingRequirement: '',
|
||||
packingStatus: '',
|
||||
trimmingRequirement: ''
|
||||
trimmingRequirement: '',
|
||||
length: null,
|
||||
},
|
||||
buttonLoading: false,
|
||||
loading: false,
|
||||
@@ -359,6 +366,9 @@ export default {
|
||||
materialName: '',
|
||||
productName: '',
|
||||
specification: '',
|
||||
grossWeight: null,
|
||||
netWeight: null,
|
||||
length: null,
|
||||
bomItems: []
|
||||
},
|
||||
{
|
||||
@@ -372,6 +382,9 @@ export default {
|
||||
materialName: '',
|
||||
productName: '',
|
||||
specification: '',
|
||||
grossWeight: null,
|
||||
netWeight: null,
|
||||
length: null,
|
||||
bomItems: []
|
||||
}
|
||||
];
|
||||
@@ -400,6 +413,9 @@ export default {
|
||||
productName: data.productName || (data.product ? data.product.productName : ''),
|
||||
specification: data.rawMaterial?.specification || data.product?.specification || '',
|
||||
bomItems: data.bomItemList || [],
|
||||
grossWeight: data.grossWeight || null,
|
||||
netWeight: data.netWeight || null,
|
||||
length: data.length || null,
|
||||
},
|
||||
{
|
||||
coilId: null,
|
||||
@@ -412,7 +428,10 @@ export default {
|
||||
materialName: '',
|
||||
productName: '',
|
||||
specification: '',
|
||||
bomItems: []
|
||||
bomItems: [],
|
||||
grossWeight: null,
|
||||
netWeight: null,
|
||||
length: null,
|
||||
}
|
||||
];
|
||||
|
||||
@@ -488,6 +507,9 @@ export default {
|
||||
materialName: data.materialName || (data.rawMaterial ? data.rawMaterial.rawMaterialName : ''),
|
||||
productName: data.productName || (data.product ? data.product.productName : ''),
|
||||
specification: data.rawMaterial?.specification || data.product?.specification || '',
|
||||
grossWeight: data.grossWeight || null,
|
||||
netWeight: data.netWeight || null,
|
||||
length: data.length || null,
|
||||
bomItems: data.bomItemList || [],
|
||||
actionId: pending.actionId // 保存待操作ID,用于后续完成操作
|
||||
});
|
||||
@@ -662,6 +684,9 @@ export default {
|
||||
materialName: coil.materialName || '',
|
||||
productName: coil.productName || '',
|
||||
specification: coil.rawMaterial?.specification || coil.product?.specification || '',
|
||||
grossWeight: coil.grossWeight || null,
|
||||
netWeight: coil.netWeight || null,
|
||||
length: coil.length || null,
|
||||
bomItems: coil.bomItemList || []
|
||||
});
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
</div>
|
||||
<div class="info-grid-item label-cell">参考长度</div>
|
||||
<div class="info-grid-item value-cell">
|
||||
<input type="text" class="nob" :value="content.referenceLength || ''" />
|
||||
<input type="text" class="nob" :value="content.length || ''" />
|
||||
</div>
|
||||
|
||||
<!-- 第八行:生产日期(跨3列) -->
|
||||
@@ -137,6 +137,7 @@ export default {
|
||||
grossWeight: '',
|
||||
netWeight: '7080',
|
||||
referenceLength: '320',
|
||||
length: '320',
|
||||
productionDate: '2025-03-19',
|
||||
// 底部信息字段
|
||||
address: '唐山市滦州市茨榆坨工业区',
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="showAbnormal" label="异常数量" align="center" prop="abnormalCount"></el-table-column>
|
||||
<el-table-column label="长度 (米)" align="center" prop="length" v-if="showLength" />
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" />
|
||||
<el-table-column label="发货时间" align="center" v-if="showExportTime" prop="exportTime" />
|
||||
<el-table-column label="更新人" align="center" prop="updateByName" />
|
||||
@@ -206,6 +207,9 @@
|
||||
<el-form-item label="净重" prop="netWeight">
|
||||
<el-input v-model="form.netWeight" placeholder="请输入净重" />
|
||||
</el-form-item>
|
||||
<el-form-item label="长度" prop="length" v-if="showLength">
|
||||
<el-input v-model="form.length" placeholder="请输入长度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
@@ -311,6 +315,10 @@ export default {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showLength: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<BasePage :qrcode="qrcode" :querys="querys" :labelType="labelType" :showStatus="showStatus" :hideType="hideType" />
|
||||
<BasePage :qrcode="qrcode"
|
||||
:querys="querys"
|
||||
:labelType="labelType"
|
||||
:showStatus="showStatus"
|
||||
:hideType="hideType"
|
||||
:showLength="showLength" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -21,6 +26,7 @@ export default {
|
||||
labelType: '3',
|
||||
showStatus: true,
|
||||
hideType: true,
|
||||
showLength: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,12 @@
|
||||
<template slot="append">吨</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="长度(m)" required>
|
||||
<el-input v-model.number="item.length" placeholder="请输入长度" type="number" step="0.01"
|
||||
:disabled="readonly">
|
||||
<template slot="append">米</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑库区" required>
|
||||
<WarehouseSelect
|
||||
v-model="item.warehouseId"
|
||||
@@ -248,7 +254,8 @@ export default {
|
||||
grossWeight: null,
|
||||
netWeight: null,
|
||||
warehouseId: null,
|
||||
actualWarehouseId: null
|
||||
actualWarehouseId: null,
|
||||
length: null,
|
||||
}
|
||||
],
|
||||
loading: false,
|
||||
@@ -467,6 +474,7 @@ export default {
|
||||
productName: coil.productName || '',
|
||||
grossWeight: coil.grossWeight,
|
||||
netWeight: coil.netWeight,
|
||||
length: coil.length,
|
||||
bomItems: coil.bomItemList || coil.bomItems || []
|
||||
};
|
||||
this.$message.success('母卷选择成功');
|
||||
@@ -492,6 +500,7 @@ export default {
|
||||
productName: data.productName || (data.product ? data.product.productName : ''),
|
||||
grossWeight: data.grossWeight,
|
||||
netWeight: data.netWeight,
|
||||
length: data.length,
|
||||
bomItems: data.bomItemList || data.bomItems || []
|
||||
};
|
||||
}
|
||||
@@ -525,6 +534,7 @@ export default {
|
||||
itemId: null,
|
||||
grossWeight: null,
|
||||
netWeight: null,
|
||||
length: null,
|
||||
warehouseId: null,
|
||||
actualWarehouseId: null,
|
||||
qualityStatus: '',
|
||||
|
||||
@@ -158,6 +158,13 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="长度(m)" prop="length">
|
||||
<el-input v-model.number="updateForm.length" placeholder="请输入长度" type="number" step="0.01"
|
||||
:disabled="readonly">
|
||||
<template slot="append">米</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="逻辑库区" prop="warehouseId">
|
||||
<WarehouseSelect
|
||||
v-model="updateForm.warehouseId"
|
||||
@@ -264,7 +271,8 @@ export default {
|
||||
warehouseId: null,
|
||||
nextWarehouseName: '',
|
||||
status: 0,
|
||||
remark: ''
|
||||
remark: '',
|
||||
length: null,
|
||||
},
|
||||
// 更新表单
|
||||
updateForm: {
|
||||
@@ -281,7 +289,8 @@ export default {
|
||||
qualityStatus: '',
|
||||
packagingRequirement: '',
|
||||
packingStatus: '',
|
||||
trimmingRequirement: ''
|
||||
trimmingRequirement: '',
|
||||
length: null,
|
||||
},
|
||||
rules: {
|
||||
currentCoilNo: [
|
||||
@@ -597,6 +606,7 @@ export default {
|
||||
grossWeight: parseFloat(this.currentInfo.grossWeight) || null,
|
||||
netWeight: parseFloat(this.currentInfo.netWeight) || null,
|
||||
warehouseId: this.currentInfo.warehouseId,
|
||||
length: parseFloat(this.currentInfo.length) || null,
|
||||
remark: this.currentInfo.remark
|
||||
};
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect
|
||||
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
|
||||
import Printer from "../components/Printer.vue";
|
||||
import { getConfigKey } from '@/api/system/config'
|
||||
import handleCoil, { COIL_ACTIONS } from "@/views/wms/coil/js/coilActions.js";
|
||||
|
||||
export default {
|
||||
name: "DeliveryWaybill",
|
||||
@@ -440,22 +441,14 @@ export default {
|
||||
// 二次确认
|
||||
this.$modal.confirm("收货后刚钢卷会进入库存并占用所选的实际库区,是否继续?").then(() => {
|
||||
this.buttonLoading = true;
|
||||
// 更新操作记录状态 actionStatus: 2
|
||||
updatePendingAction({
|
||||
...this.receiptForm,
|
||||
actionStatus: 2,
|
||||
}).then(_ => {
|
||||
this.$message.success("确认收货成功");
|
||||
this.getList()
|
||||
this.receiptModalVisible = false;
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
// 更新钢卷状态为当前钢卷; dataType: 1
|
||||
updateMaterialCoilSimple({
|
||||
...this.coilInfo,
|
||||
dataType: 1,
|
||||
})
|
||||
handleCoil(COIL_ACTIONS.STORE, this.coilInfo, this.receiptForm)
|
||||
.then(_ => {
|
||||
this.$message.success("确认收货成功");
|
||||
this.getList()
|
||||
this.receiptModalVisible = false;
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
})
|
||||
},
|
||||
// 取消操作
|
||||
|
||||
Reference in New Issue
Block a user