Commit 5466219d by linjinhong

fix:修改生产完成逻辑

parent bc514608
......@@ -135,7 +135,6 @@ export default {
}
});
this.$store.commit("changeDesktopDevice", getDesktopDevice());
this.isAutoFinish = false;
},
created() {
localStorage.setItem("desktoVersion", "print");
......@@ -270,39 +269,35 @@ export default {
} else if (this.orderType === "OP") {
params.data = { ...data };
}
//如果为惠立彩则判断当前saveImgList字段中的power是否全是true 是则生产完成
// const canCallApi =
// this.desktopDevice != 3 ||
// (data.saveImgList?.every(el => el.power) ?? false);
try {
console.log("生产完成");
// if (this.orderType !== "OP" && type == "btn") {
// await this.$api.post(
// pathMap["completeDelivery"][this.orderType],
// params
// );
// await removeFromOrderInfo(data.newId);
// bus.$emit("busEmit", {
// value: data.newId,
// type: "completeMessage"
// });
// this.$message.success("操作成功");
// } else
if (this.orderType == "OP") {
const isOP = this.orderType === "OP";
const newId = data.newId;
console.log("生产完成------", this.orderType, type);
// 统一走完成交付的场景:非OP / OP且type=btn
if (!isOP || type === "btn") {
await this.$api.post(
pathMap.completeDelivery[this.orderType],
params
);
if (this.desktopDevice === 3) {
await removeFromOrderInfo(newId);
bus.$emit("busEmit", { value: newId, type: "completeMessage" });
}
} else {
// OP 非btn:扫码入库校验库存
const { code, data: resData } = await this.$api.post(
pathMap["scanProduce"][this.orderType],
pathMap.scanProduce[this.orderType],
{ id: params.id, status: params.data.status }
);
if (code == 301) {
if (code === 301) {
this.$confirm(
`${
resData.thirdSkuCode
}库存不足,无法进入生产!请联系仓库管理人员核对库存。</br>
库存数量:${resData.availableInventory || 0}
生产中数量:${resData.inventory || 0}
<span style="color: red;">可调配库存:
${resData.inventory || 0}</span>`,
库存数量:${resData.availableInventory || 0}
生产中数量:${resData.inventory || 0}
<span style="color: red;">可调配库存:${resData.inventory || 0}</span>`,
"提示",
{
confirmButtonText: "确定",
......@@ -316,27 +311,13 @@ export default {
this.$refs.searchRef?.focus();
return;
}
if (this.desktopDevice == 3) {
bus.$emit("busEmit", {
value: data.newId,
type: "productingMessage"
});
}
} else {
await this.$api.post(
pathMap["completeDelivery"][this.orderType],
params
);
if (this.desktopDevice == 3) {
await removeFromOrderInfo(data.newId);
bus.$emit("busEmit", {
value: data.newId,
type: "completeMessage"
});
}
this.desktopDevice === 3 &&
bus.$emit("busEmit", { value: newId, type: "productingMessage" });
}
this.$message.success("操作成功");
} catch (error) {
this.$message.error(error);
console.error("setData 执行失败", error);
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment