feat(wms): 在完成操作时传递新钢卷ID参数
修改completeAction接口以接收新钢卷ID参数,并在多个视图中调用时传递该参数
This commit is contained in:
@@ -122,10 +122,13 @@ export function startProcess(actionId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 完成操作
|
// 完成操作
|
||||||
export function completeAction(actionId) {
|
export function completeAction(actionId, newCoilIds) {
|
||||||
return request({
|
return request({
|
||||||
url: `/wms/coilPendingAction/complete/${actionId}`,
|
url: `/wms/coilPendingAction/complete/${actionId}`,
|
||||||
method: 'put'
|
method: 'put',
|
||||||
|
params: {
|
||||||
|
newCoilIds: newCoilIds
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -292,7 +292,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getMaterialCoil, mergeMaterialCoil } from '@/api/wms/coil';
|
import { getMaterialCoil, mergeMaterialCoil } from '@/api/wms/coil';
|
||||||
import { listPendingAction, completeAction, addPendingAction, getPendingAction } from '@/api/wms/pendingAction';
|
import { listPendingAction, getPendingAction } from '@/api/wms/pendingAction';
|
||||||
import CoilSelector from '@/components/CoilSelector';
|
import CoilSelector from '@/components/CoilSelector';
|
||||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||||
import RawMaterialSelector from "@/components/KLPService/RawMaterialSelect";
|
import RawMaterialSelector from "@/components/KLPService/RawMaterialSelect";
|
||||||
@@ -700,12 +700,6 @@ export default {
|
|||||||
|
|
||||||
// 保存合卷
|
// 保存合卷
|
||||||
async handleSave() {
|
async handleSave() {
|
||||||
// 验证源卷数量
|
|
||||||
// if (this.sourceCoils.length < 2) {
|
|
||||||
// this.$message.error('至少需要2个源卷才能合卷');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 验证源卷信息
|
// 验证源卷信息
|
||||||
for (let i = 0; i < this.sourceCoils.length; i++) {
|
for (let i = 0; i < this.sourceCoils.length; i++) {
|
||||||
const item = this.sourceCoils[i];
|
const item = this.sourceCoils[i];
|
||||||
@@ -758,7 +752,6 @@ export default {
|
|||||||
text: '正在合卷,请稍后...',
|
text: '正在合卷,请稍后...',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
// this.completeAllRelatedActions();
|
|
||||||
await mergeMaterialCoil(mergeData);
|
await mergeMaterialCoil(mergeData);
|
||||||
|
|
||||||
this.$message.success('合卷保存成功');
|
this.$message.success('合卷保存成功');
|
||||||
@@ -802,49 +795,6 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 完成所有相关的待操作记录
|
|
||||||
async completeAllRelatedActions() {
|
|
||||||
try {
|
|
||||||
// 收集所有待操作ID
|
|
||||||
const actionIds = [];
|
|
||||||
const ncs = [];
|
|
||||||
|
|
||||||
// 当前页面的actionId(从路由参数获取)
|
|
||||||
// if (this.actionId) {
|
|
||||||
// actionIds.push(this.actionId);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 从待合卷列表中选择的钢卷的actionId
|
|
||||||
this.sourceCoils.forEach(item => {
|
|
||||||
if (item.actionId) {
|
|
||||||
actionIds.push(item.actionId);
|
|
||||||
}
|
|
||||||
// 或许所有需要直接完成的
|
|
||||||
if (item.nc) {
|
|
||||||
ncs.push(item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 批量完成所有待操作
|
|
||||||
const promises1 = actionIds.map(id => completeAction(id));
|
|
||||||
const promises2 = ncs.map(item => {
|
|
||||||
addPendingAction({
|
|
||||||
actionType: this.actionTypeCode, // 合卷操作
|
|
||||||
actionStatus: '2', // 2表示已完成
|
|
||||||
coilId: item.coilId,
|
|
||||||
currentCoilNo: item.currentCoilNo || '',
|
|
||||||
priority: 0,
|
|
||||||
sourceType: 'manual',
|
|
||||||
completeTime: new Date()
|
|
||||||
})
|
|
||||||
});
|
|
||||||
await Promise.all(promises1.concat(promises2));
|
|
||||||
} catch (error) {
|
|
||||||
console.error('完成待操作失败:', error);
|
|
||||||
// 不影响主流程,只记录错误
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 取消操作
|
// 取消操作
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
console.log('取消合卷操作', this.$tab);
|
console.log('取消合卷操作', this.$tab);
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. 完成待办动作(根据业务逻辑调整)
|
// 2. 完成待办动作(根据业务逻辑调整)
|
||||||
const actionRes = await completeAction(this.actionId)
|
const actionRes = await completeAction(this.actionId, splitRes.data.childCoilIds.join(','))
|
||||||
if (actionRes.code !== 200) {
|
if (actionRes.code !== 200) {
|
||||||
this.$message.error('完成待办动作失败:' + actionRes.msg)
|
this.$message.error('完成待办动作失败:' + actionRes.msg)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ export default {
|
|||||||
|
|
||||||
// 如果是从待操作列表进来的,标记操作为完成
|
// 如果是从待操作列表进来的,标记操作为完成
|
||||||
if (this.actionId) {
|
if (this.actionId) {
|
||||||
await completeAction(this.actionId);
|
await completeAction(this.actionId, response.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 延迟返回,让用户看到成功提示
|
// 延迟返回,让用户看到成功提示
|
||||||
|
|||||||
@@ -324,11 +324,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getMaterialCoil, updateMaterialCoil, getMaterialCoilTrace, checkCoilNo } from '@/api/wms/coil';
|
import { getMaterialCoil, updateMaterialCoil, getMaterialCoilTrace } from '@/api/wms/coil';
|
||||||
import { completeAction, getPendingAction } from '@/api/wms/pendingAction';
|
import { completeAction, getPendingAction } from '@/api/wms/pendingAction';
|
||||||
import { listWarehouse } from '@/api/wms/warehouse';
|
import { listWarehouse } from '@/api/wms/warehouse';
|
||||||
import { listRawMaterialWithBom } from '@/api/wms/rawMaterial';
|
|
||||||
import { listProductWithBom } from '@/api/wms/product';
|
|
||||||
import { getAcidTypingPrefill } from '@/api/pocket/acidTyping';
|
import { getAcidTypingPrefill } from '@/api/pocket/acidTyping';
|
||||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||||
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
||||||
@@ -870,7 +868,6 @@ export default {
|
|||||||
enterCoilNo: this.currentInfo.enterCoilNo,
|
enterCoilNo: this.currentInfo.enterCoilNo,
|
||||||
supplierCoilNo: this.currentInfo.supplierCoilNo,
|
supplierCoilNo: this.currentInfo.supplierCoilNo,
|
||||||
abnormals: this.abnormals,
|
abnormals: this.abnormals,
|
||||||
// 注意:不要传newCoils,否则会走批量更新逻辑
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await updateMaterialCoil(updateData);
|
const response = await updateMaterialCoil(updateData);
|
||||||
@@ -880,7 +877,7 @@ export default {
|
|||||||
|
|
||||||
// 如果是从待操作列表进来的,标记操作为完成
|
// 如果是从待操作列表进来的,标记操作为完成
|
||||||
if (this.actionId) {
|
if (this.actionId) {
|
||||||
await completeAction(this.actionId);
|
await completeAction(this.actionId, response.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 延迟返回
|
// 延迟返回
|
||||||
|
|||||||
Reference in New Issue
Block a user