Commit 2af4e414 by linjinhong

fix:修改问题

parent f6e45c94
...@@ -31,6 +31,9 @@ export const pathMap = { ...@@ -31,6 +31,9 @@ export const pathMap = {
//判断 status 操作单状态 //判断 status 操作单状态
scanProduce: { scanProduce: {
OP: "factory/podOrderOperation/scan-produce" OP: "factory/podOrderOperation/scan-produce"
},
checkInventory: {
OP: "factory/podOrderOperation/check-inventory"
} }
}; };
......
...@@ -631,5 +631,26 @@ export default { ...@@ -631,5 +631,26 @@ export default {
console.log("scanProduce", error); console.log("scanProduce", error);
res.json({ code: 500, msg: error }); res.json({ code: 500, msg: error });
} }
},
checkInventory: async (req, res) => {
env = getHostApi().apiApiHost;
const token = req.headers["jwt-token"];
const params = req.body;
let url = "factory/podOrderOperation/check-inventory";
console.log("checkInventory", `${env}/${url}`);
try {
let { data } = await axios.get(`${env}/${url}`, {
headers: { "jwt-token": token },
params: {
id: params.id,
status: params.status
}
});
res.send(data);
} catch (error) {
console.log("checkInventory", error);
res.json({ code: 500, msg: error });
}
} }
}; };
...@@ -65,5 +65,7 @@ autoRegisterRouter( ...@@ -65,5 +65,7 @@ autoRegisterRouter(
); );
//操作单状态 //操作单状态
autoRegisterRouter(router, "scanProduce", fn.scanProduce); autoRegisterRouter(router, "scanProduce", fn.scanProduce);
//检查库存
autoRegisterRouter(router, "checkInventory", fn.checkInventory);
export { router as default }; export { router as default };
...@@ -229,7 +229,7 @@ export default { ...@@ -229,7 +229,7 @@ export default {
break; break;
} }
}, },
async setData(data) { async setData(data, type) {
if (!data) return this.$message.warning("请扫描生产单号/操作单号"); if (!data) return this.$message.warning("请扫描生产单号/操作单号");
let params = { let params = {
id: data.id, id: data.id,
...@@ -256,11 +256,47 @@ export default { ...@@ -256,11 +256,47 @@ export default {
} }
console.log("本地数据removeFromOrderInfo:", getOrderInfoMap()); console.log("本地数据removeFromOrderInfo:", getOrderInfoMap());
//生产完成后在本地删除 //生产完成后在本地删除
if (
this.orderType == "OP" &&
(this.detail.status == "PENDING_PICK" ||
this.detail.status == "PENDING_REPLENISH")
) {
const { code, data } = await this.$api.post(
pathMap["scanProduce"][this.orderType],
params
);
if (code == 301) {
this.$confirm(
`<p>库存不足,无法进入生产!请联系仓库管理人员核对库存。</p>
<p>库存数量:${data.availableInventory || 0},生产中数量:${data.inventory ||
0},可调配库存:${data.inventory || 0}</p>`,
"提示",
{
confirmButtonText: "确定",
type: "error",
dangerouslyUseHTMLString: true,
// 🔥 关键:添加自定义类名
customClass: "custom-inventory-msgbox"
}
);
this.detail = "";
this.productionNo = "";
this.$refs.searchRef?.focus();
return;
}
} else {
await this.$api.post( await this.$api.post(
pathMap["completeDelivery"][this.orderType], pathMap["completeDelivery"][this.orderType],
params params
); );
}
this.$message.success("操作成功"); this.$message.success("操作成功");
} else {
if (type == "btn") {
const item = data.saveImgList?.find(el => !el.power);
this.$message.warning(`该订单${item.title}面未打印,无法生产完成`);
}
} }
}, },
async sureData() { async sureData() {
...@@ -272,7 +308,7 @@ export default { ...@@ -272,7 +308,7 @@ export default {
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(async () => { }).then(async () => {
await this.setData(this.detail); await this.setData(this.detail, "btn");
}); });
}, },
clearCache() { clearCache() {
...@@ -562,6 +598,8 @@ export default { ...@@ -562,6 +598,8 @@ export default {
} }
//如果该数据的图片第一次出现且素材图大于1张则把该数据储存到本地 //如果该数据的图片第一次出现且素材图大于1张则把该数据储存到本地
if (newImgList.length > 1 && !bool && this.desktopDevice == 3) { if (newImgList.length > 1 && !bool && this.desktopDevice == 3) {
console.log("addToOrderInfo", this.detail);
addToOrderInfo(this.detail); addToOrderInfo(this.detail);
console.log("本地数据addToOrderInfo", getOrderInfoMap()); console.log("本地数据addToOrderInfo", getOrderInfoMap());
} }
...@@ -689,31 +727,55 @@ export default { ...@@ -689,31 +727,55 @@ export default {
(this.detail.status == "PENDING_PICK" || (this.detail.status == "PENDING_PICK" ||
this.detail.status == "PENDING_REPLENISH") this.detail.status == "PENDING_REPLENISH")
) { ) {
const { data, code } = await this.$api.post( // const {
pathMap["scanProduce"][this.orderType], // data: checkInventoryData,
{ id: this.detail.id, status: this.detail.status } // code: checkInventoryCode
); // } = await this.$api.post(pathMap["checkInventory"][this.orderType], {
console.log("scanProduce---------", data); // id: this.detail.id,
// status: this.detail.status
if (code == 301) { // });
this.$confirm( // if (checkInventoryCode == 301) {
`<p>库存不足,无法进入生产!请联系仓库管理人员核对库存。</p> // this.$confirm(
<p>库存数量:${data.availableInventory || 0},生产中数量:${data.inventory || // `<p>库存不足,无法进入生产!请联系仓库管理人员核对库存。</p>
0},可调配库存:${data.inventory || 0}</p>`, // <p>库存数量:${checkInventoryData.availableInventory ||
"提示", // 0},生产中数量:${checkInventoryData.inventory ||
{ // 0},可调配库存:${checkInventoryData.inventory || 0}</p>`,
confirmButtonText: "确定", // "提示",
type: "error", // {
dangerouslyUseHTMLString: true, // confirmButtonText: "确定",
// 🔥 关键:添加自定义类名 // type: "error",
customClass: "custom-inventory-msgbox" // dangerouslyUseHTMLString: true,
} // customClass: "custom-inventory-msgbox"
); // }
this.detail = ""; // );
this.productionNo = ""; // this.detail = "";
this.$refs.searchRef?.focus(); // this.productionNo = "";
return; // this.$refs.searchRef?.focus();
} // return;
// }
// const { data, code } = await this.$api.post(
// pathMap["scanProduce"][this.orderType],
// { id: this.detail.id, status: this.detail.status }
// );
// if (code == 301) {
// this.$confirm(
// `<p>库存不足,无法进入生产!请联系仓库管理人员核对库存。</p>
// <p>库存数量:${data.availableInventory || 0},生产中数量:${data.inventory ||
// 0},可调配库存:${data.inventory || 0}</p>`,
// "提示",
// {
// confirmButtonText: "确定",
// type: "error",
// dangerouslyUseHTMLString: true,
// // 🔥 关键:添加自定义类名
// customClass: "custom-inventory-msgbox"
// }
// );
// this.detail = "";
// this.productionNo = "";
// this.$refs.searchRef?.focus();
// return;
// }
} }
let designImagesCanvasJsonList = this.detail.drParam; let designImagesCanvasJsonList = this.detail.drParam;
......
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