Commit f6e45c94 by linjinhong

fix:添加库存提示

parent 8163590c
......@@ -11,7 +11,7 @@ function startLoading() {
lock: true,
text: "拼命加载中...",
spinner: "el-icon-loading",
background: "rgba(0,0,0,.7)",
background: "rgba(0,0,0,.7)"
});
}
......@@ -25,16 +25,16 @@ axios.defaults.timeout = 12600000;
const QUERY_ORDER_API_MAP = {
CN: {
path: "factory/podJomallOrderProductCn/getProductCnByFactorySubOrderNumber",
paramKey: "factorySubOrderNumber", // 参数名:工厂子订单号
paramKey: "factorySubOrderNumber" // 参数名:工厂子订单号
},
US: {
path: "factory/podJomallOrderProductUs/getProductUsByFactorySubOrderNumber",
paramKey: "factorySubOrderNumber", // 参数名:工厂子订单号
paramKey: "factorySubOrderNumber" // 参数名:工厂子订单号
},
GC: {
path: "factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber",
paramKey: "thirdSubOrderNumber", // 参数名:第三方子订单号(老pod)
},
paramKey: "thirdSubOrderNumber" // 参数名:第三方子订单号(老pod)
}
};
/**
* 通用查询订单接口
......@@ -53,21 +53,21 @@ export function findByPodProductionNoApi(orderNumber) {
const apiConfig = QUERY_ORDER_API_MAP[orderNumber.orderType];
if (!apiConfig) {
throw new Error(
`查询订单失败:不支持的订单类型${orderNumber.orderType},仅支持CN/US/GC`,
`查询订单失败:不支持的订单类型${orderNumber.orderType},仅支持CN/US/GC`
);
}
// 3. 构造请求参数(根据类型自动匹配参数名)
const requestParams = {
[apiConfig.paramKey]: orderNumber.thirdSubOrderNumber,
resizable: orderNumber.resizable,
resizable: orderNumber.resizable
};
// 4. 获取基地址并发送GET请求
const env = getHostApi().apiApiHost;
return axios.get(apiConfig.path, {
baseURL: env,
params: requestParams,
params: requestParams
});
}
// ===================== 素材下载相关 =====================
......@@ -97,7 +97,7 @@ export async function downloadBySubOrderNumberApi(params) {
// 4. 发送请求获取下载链接
const { data, message } = await downloadDesignImagesBaseApi(
pathMap["downloadBySubOrderNumber"][targetType],
params,
params
);
// 建议明确获取响应data(根据实际axios响应结构调整)
......@@ -113,7 +113,7 @@ export async function downloadBySubOrderNumberApi(params) {
// 6. 构建下载文件列表
const fileEnv = getHostApi().fileApiUrl;
files = files.map((el) => ({ url: `${fileEnv}${el}` }));
files = files.map(el => ({ url: `${fileEnv}${el}` }));
console.log(106, files);
const downloadFunc =
params.device === 2 ? downloadOtherImage : downloadImage;
......@@ -122,7 +122,7 @@ export async function downloadBySubOrderNumberApi(params) {
return {
code: 200,
message: "下载成功",
data: downloadResult,
data: downloadResult
};
} catch (error) {
// 统一错误处理:便于调试和用户提示
......@@ -147,21 +147,21 @@ export function completeDeliveryApi(params) {
CN: {
data: {
id: params.id,
podJomallOrderCnId: params.podJomallOrderCnId || "",
podJomallOrderCnId: params.podJomallOrderCnId || ""
},
url: "factory/podJomallOrderProductCn/completeDelivery",
url: "factory/podJomallOrderProductCn/completeDelivery"
},
US: {
data: {
id: params.id,
podJomallOrderUsId: params.podJomallOrderUsId || "",
podJomallOrderUsId: params.podJomallOrderUsId || ""
},
url: "factory/podJomallOrderProductUs/completeDelivery",
url: "factory/podJomallOrderProductUs/completeDelivery"
},
GC: {
data: { id: params.id },
url: "factory/podJomallOrderProduct/completeDelivery",
},
url: "factory/podJomallOrderProduct/completeDelivery"
}
};
// 2. 校验订单类型是否支持
......@@ -178,16 +178,16 @@ export function checkUpdate(version) {
{
params: {
businessType: "production_assistant",
version,
},
},
version
}
}
);
}
export function getAllCountryApi(thirdSubOrderNumber) {
return axios.get(`logisticsAddress/getAllCountry`, {
params: {
thirdSubOrderNumber,
},
thirdSubOrderNumber
}
});
}
......@@ -4,7 +4,7 @@ export const pathMap = {
CN: "factory/podJomallOrderProductCn/getProductCnByFactorySubOrderNumber",
US: "factory/podJomallOrderProductUs/getProductUsByFactorySubOrderNumber",
GC: "factory/podJomallOrderProduct/getSubOrderByThirdSubOrderNumber",
OP: "factory/podOrderOperation/getByOperationNo",
OP: "factory/podOrderOperation/getByOperationNo"
},
//下载素材接口
downloadBySubOrderNumber: {
......@@ -14,26 +14,30 @@ export const pathMap = {
OP: "factory/podOrderOperation/downloadDesignImages",
USHLC: "factory/podJomallOrderProductUs/downloadCompatibleDesignImages",
CNHLC: "factory/podJomallOrderProductCn/downloadCompatibleDesignImages",
OPHLC: "factory/podOrderOperation/downloadCompatibleDesignImages",
OPHLC: "factory/podOrderOperation/downloadCompatibleDesignImages"
},
//生产完成接口
completeDelivery: {
CN: "factory/podJomallOrderProductCn/completeDelivery",
US: "factory/podJomallOrderProductUs/completeDelivery",
GC: "factory/podJomallOrderProduct/completeDelivery",
OP: "factory/podOrderOperation/printerCompleteDelivery",
OP: "factory/podOrderOperation/printerCompleteDelivery"
},
//惠立彩素材下载接口
processTransparentBackground: {
CN: "factory/podJomallOrderProductCn/processTransparentBackground",
US: "factory/podJomallOrderProductUs/processTransparentBackground",
US: "factory/podJomallOrderProductUs/processTransparentBackground"
},
//判断 status 操作单状态
scanProduce: {
OP: "factory/podOrderOperation/scan-produce"
}
};
export function autoRegisterRouter(router, funcKey, handler) {
const configGroup = pathMap[funcKey];
// 遍历配置自动注册路由
Object.values(configGroup).forEach((el) => {
Object.values(configGroup).forEach(el => {
router.post(`/${el}`, (req, res) => {
handler(req, res);
});
......
......@@ -3,12 +3,12 @@ import {
downloadOtherImage,
toSend,
writeProfileXml,
copySingleImage,
copySingleImage
} from "@/server/utils";
const {
cropImageTransparentEdges,
cropTransparentEdges,
processImages,
processImages
} = require("../utils/setImage");
import axios from "axios";
import { returnLogFilePath } from "../utils/log";
......@@ -26,7 +26,7 @@ const {
getVersion,
setApi,
getHostApi,
getDesktopDevice,
getDesktopDevice
} = require("@/server/utils/store");
const { pathMap } = require("@/config/index.js");
......@@ -95,12 +95,12 @@ export default {
const response = await axios({
url: req.body.url,
method: "GET",
responseType: "stream",
responseType: "stream"
});
let fileName = uuid.v4() + ".png";
const filePath = path.join(
process.cwd(),
`./${version}/Input/` + fileName,
`./${version}/Input/` + fileName
);
const writer = fs.createWriteStream(filePath);
......@@ -109,21 +109,21 @@ export default {
writer.on("finish", () => {
res.json({
code: 200,
data: filePath,
data: filePath
});
});
writer.on("error", (err) => {
writer.on("error", err => {
res.json({
code: 500,
data: err.message,
data: err.message
});
});
} catch (error) {
console.error("Error downloading image:", error);
res.json({
code: 500,
data: error.message,
data: error.message
});
}
},
......@@ -170,7 +170,7 @@ export default {
}
const { data } = await axios.post(postUrl, [...params.ids], {
headers: { "jwt-token": token },
headers: { "jwt-token": token }
});
if (data.code !== 200) {
......@@ -193,13 +193,13 @@ export default {
let files = [path];
files = files.map((el) => ({ url: `${fileEnv}${el}` }));
files = files.map(el => ({ url: `${fileEnv}${el}` }));
const downloadFunc =
params.device === 2 ? downloadOtherImage : downloadImage;
const result = await downloadFunc(files, {
processDesignA,
processDesignB,
processDesignB
});
console.log("result200", result);
......@@ -220,7 +220,7 @@ export default {
CN: "factorySubOrderNumber",
US: "factorySubOrderNumber",
GC: "thirdSubOrderNumber",
OP: "operationNo",
OP: "operationNo"
};
let url = pathMap["findByPodProductionNo"][params.orderType];
let paramsField = fieldMap[params.orderType];
......@@ -228,9 +228,9 @@ export default {
let { data } = await axios.get(`${env}/${url}`, {
params: {
[paramsField]: params.thirdSubOrderNumber,
resizable: params.resizable,
resizable: params.resizable
},
headers: { "jwt-token": token },
headers: { "jwt-token": token }
});
res.setHeader("Act-Request-URL", `${env}/${url}`);
res.json(data);
......@@ -241,7 +241,7 @@ export default {
getCompanyList: async (req, res) => {
try {
let { data } = await axios.get(
"https://platform.jomalls.com/api/tools/getCompanyList",
"https://platform.jomalls.com/api/tools/getCompanyList"
);
res.setHeader("X-Backend-Request-URL", "api/tools/getCompanyList");
res.send(data);
......@@ -258,21 +258,21 @@ export default {
const fieldMap = {
CN: {
id: params.id,
podJomallOrderCnId: params.podJomallOrderCnId || "",
podJomallOrderCnId: params.podJomallOrderCnId || ""
},
US: {
id: params.id,
podJomallOrderUsId: params.podJomallOrderUsId || "",
podJomallOrderUsId: params.podJomallOrderUsId || ""
},
GC: { id: params.id },
OP: { ...params.data },
OP: { ...params.data }
};
let url = pathMap["completeDelivery"][params.orderType];
let postData = fieldMap[params.orderType];
try {
let { data } = await axios.post(`${env}/${url}`, postData, {
headers: { "jwt-token": token },
headers: { "jwt-token": token }
});
res.setHeader("X-Backend-Request-URL", url);
......@@ -295,7 +295,7 @@ export default {
for (let k in q.imgList) {
const p = path.join(
process.cwd(),
`./${version}/Input/` + q.imgList[k].fileName,
`./${version}/Input/` + q.imgList[k].fileName
);
zipStream.addEntry(p);
}
......@@ -307,7 +307,7 @@ export default {
// console.log("success");
res.json({
code: 200,
msg: q.productionNo + ".zip" + "已下载到桌面",
msg: q.productionNo + ".zip" + "已下载到桌面"
});
})
.on("error", () => {
......@@ -339,8 +339,8 @@ export default {
code: 200,
data: {
fileName,
url: path.join(process.cwd(), `./${version}/Input/` + fileName),
},
url: path.join(process.cwd(), `./${version}/Input/` + fileName)
}
});
}
});
......@@ -357,7 +357,7 @@ export default {
const filePath = path.join(
process.cwd(),
`./${version}/Input/${req.body.fileName}`,
`./${version}/Input/${req.body.fileName}`
);
console.log(filePath);
// 给客户端返回一个文件流 type类型
......@@ -401,7 +401,7 @@ export default {
.then(() => {
res.send({ code: 200, msg: "操作成功" });
})
.catch((err) => {
.catch(err => {
res.send({ code: 500, msg: err });
});
},
......@@ -443,7 +443,7 @@ export default {
fs.unlinkSync(from);
res.json({ code: 200, msg: "更新成功" });
})
.catch((err) => {
.catch(err => {
res.json({ code: 500, msg: err.message });
});
});
......@@ -535,17 +535,17 @@ export default {
res.send({ code: 500, err });
} else {
let list = [];
files.files.forEach((file) => {
files.files.forEach(file => {
let fileName = uuid.v4() + ".png";
fs.renameSync(file.path, path.join(p, fileName));
list.push({
fileName,
url: path.join(process.cwd(), `./${version}/Input/` + fileName),
url: path.join(process.cwd(), `./${version}/Input/` + fileName)
});
});
res.json({
code: 200,
data: list,
data: list
});
}
});
......@@ -591,7 +591,7 @@ export default {
try {
let { data } = await axios.get(`${env}/${url}`, {
params: postData,
headers: { "jwt-token": token },
headers: { "jwt-token": token }
});
console.log("processTransparentBackground", data);
if (data.message) {
......@@ -600,7 +600,7 @@ export default {
let files = data.data || [data.message];
files = files.map((el) => ({ url: `${fileEnv}${el}` }));
files = files.map(el => ({ url: `${fileEnv}${el}` }));
console.log("processTransparentBackground,files", files);
const result = await downloadImage(files);
......@@ -611,4 +611,25 @@ export default {
res.json({ code: 500, msg: err });
}
},
scanProduce: async (req, res) => {
env = getHostApi().apiApiHost;
const token = req.headers["jwt-token"];
const params = req.body;
let url = "factory/podOrderOperation/scan-produce";
console.log("scanProduce", `${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("scanProduce", error);
res.json({ code: 500, msg: error });
}
}
};
......@@ -25,7 +25,7 @@ router.post("/downloadByDesignId", fn.downloadByDesignId);
autoRegisterRouter(
router,
"downloadBySubOrderNumber",
fn.downloadBySubOrderNumber,
fn.downloadBySubOrderNumber
);
// 提交生产完成
autoRegisterRouter(router, "completeDelivery", fn.completeDelivery);
......@@ -61,6 +61,9 @@ autoRegisterRouter(router, "findByPodProductionNo", fn.findByPodProductionNo);
autoRegisterRouter(
router,
"processTransparentBackground",
fn.processTransparentBackground,
fn.processTransparentBackground
);
//操作单状态
autoRegisterRouter(router, "scanProduce", fn.scanProduce);
export { router as default };
......@@ -5,7 +5,7 @@ import { Loading } from "element-ui";
// create an axios instance
const service = axios.create({
baseURL: "http://localhost:3000", // url = base url + request url
timeout: 12600000, // request timeout
timeout: 12600000 // request timeout
});
let loading;
......@@ -14,7 +14,7 @@ function startLoading() {
lock: true,
text: "拼命加载中...",
spinner: "el-icon-loading",
background: "rgba(0,0,0,.7)",
background: "rgba(0,0,0,.7)"
});
}
......@@ -24,7 +24,7 @@ function endLoading() {
// Add a request interceptor
service.interceptors.request.use(
(config) => {
config => {
const user = Vue.prototype.$dataStore.get("user");
if (user) {
config.headers["jwt-token"] = user.token;
......@@ -32,32 +32,30 @@ service.interceptors.request.use(
startLoading();
return config;
},
(error) => {
error => {
endLoading();
// do something with request error
return Promise.reject(error);
},
}
);
// Add a response interceptor
service.interceptors.response.use(
async (response) => {
async response => {
// do something with response data
const res = response.data;
endLoading();
if (res.code) {
if (res.code !== 200) {
if (res.code === 411) {
return Promise.resolve(res);
}
if (res.code === 205) {
if (res.code === 411 || res.code === 205 || res.code === 301) {
return Promise.resolve(res);
}
if (res.code === 403) {
Vue.prototype.$dataStore.delete("user");
Vue.prototype.$message.error({
showClose: true,
message: res.msg || res.message || "Error",
message: res.msg || res.message || "Error"
});
setTimeout(() => {
location.reload();
......@@ -72,7 +70,7 @@ service.interceptors.response.use(
}
Vue.prototype.$message.error({
showClose: true,
message: res.msg || res.message || "Error",
message: res.msg || res.message || "Error"
});
// reject
return Promise.reject(new Error(res.msg || res.message || "Error"));
......@@ -82,11 +80,11 @@ service.interceptors.response.use(
}
return Promise.resolve(res);
},
(error) => {
error => {
endLoading();
// do something with response error
return Promise.reject(error);
},
}
);
export default service;
......
......@@ -26,7 +26,7 @@ const {
setOrderInfo,
getLocation,
setNowDate,
getNowDate,
getNowDate
} = require("@/server/utils/store");
export default {
......@@ -35,11 +35,11 @@ export default {
user: {
default: () => ({
avatar: "",
factory: {},
factory: {}
}),
type: Object,
type: Object
},
factoryType: { type: String, default: "CN" },
factoryType: { type: String, default: "CN" }
},
data() {
return {
......@@ -51,20 +51,20 @@ export default {
cacheList: [
{
label: "清除当前登录信息",
value: "token",
value: "token"
},
{
label: "登录记录",
value: "userList",
value: "userList"
},
{
label: "打印预设",
value: "print-setting",
value: "print-setting"
},
{
label: "系统设置",
value: "setting",
},
value: "setting"
}
],
selectGridIndex: 0,
pkg,
......@@ -81,7 +81,7 @@ export default {
unit: "inch",
language: "cn",
autoPrint: false,
gridSpacing: 1,
gridSpacing: 1
},
detail: null,
config: getHostApi(),
......@@ -102,11 +102,11 @@ export default {
"hsva(120, 40, 94, 0.5)",
"hsl(181, 100%, 37%)",
"hsla(209, 100%, 56%, 0.73)",
"#c7158577",
"#c7158577"
],
faceType: "A",
dialogVisible: false,
showforcedProduc: false,
showforcedProduc: false
};
},
computed: {
......@@ -119,8 +119,8 @@ export default {
"countryList",
"orderType",
"grid",
"imgList",
]),
"imgList"
])
},
mounted() {
// console.log(pkg, "pkg");
......@@ -151,14 +151,14 @@ export default {
bus.$emit("busEmit", { type: "updateSystemSetting" });
},
deep: true,
deep: true
},
config: {
handler(val) {
this.newApiApiHost = this.getDomainFromUrl(val.apiApiHost);
},
immediate: true,
deep: true,
deep: true
},
desktopDevice() {
this.checked = false;
......@@ -168,7 +168,7 @@ export default {
handler(value) {
if (this.detail && value?.length && this.desktopDevice === 3) {
const item = this.detail?.saveImgList?.find(
(el) => el.fileName == value[0].fileName,
el => el.fileName == value[0].fileName
);
if (item) {
item.power = true;
......@@ -176,11 +176,11 @@ export default {
//复制图片到当前文件夹下
copySingleImage(
item.productionFile,
getLocation("downloadLocation1"),
getLocation("downloadLocation1")
);
copySingleImage(
item.productionFile,
getLocation("downloadLocation2"),
getLocation("downloadLocation2")
);
} catch (error) {
this.$message.error("发送失败");
......@@ -193,13 +193,13 @@ export default {
console.log("updateOrderInfoItemitem", item);
console.log("本地数据updateOrderInfoItem:", getOrderInfoMap());
}
},
}
// deep: true,
},
}
},
methods: {
checkUpdate() {
this.$refs.updateDialog.checkUpdate().then((data) => {
this.$refs.updateDialog.checkUpdate().then(data => {
if (data) {
// 有新版本更新
this.$refs.updateDialog.open(data, 2);
......@@ -214,7 +214,7 @@ export default {
this.$confirm("是否退出登录?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
})
.then(() => {
this.$dataStore.delete("user");
......@@ -233,7 +233,7 @@ export default {
if (!data) return this.$message.warning("请扫描生产单号/操作单号");
let params = {
id: data.id,
orderType: this.orderType,
orderType: this.orderType
};
if (this.orderType === "CN") {
params.podJomallOrderCnId = data.podJomallOrderCnId;
......@@ -245,7 +245,7 @@ export default {
//如果为惠立彩则判断当前saveImgList字段中的power是否全是true 是则生产完成
const canCallApi =
this.desktopDevice != 3 ||
(data.saveImgList?.every((el) => el.power) ?? false);
(data.saveImgList?.every(el => el.power) ?? false);
if (canCallApi) {
console.log("生产完成");
......@@ -258,7 +258,7 @@ export default {
//生产完成后在本地删除
await this.$api.post(
pathMap["completeDelivery"][this.orderType],
params,
params
);
this.$message.success("操作成功");
}
......@@ -270,7 +270,7 @@ export default {
this.$confirm(`确定生产完成?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
}).then(async () => {
await this.setData(this.detail);
});
......@@ -282,15 +282,15 @@ export default {
this.$confirm("是否确定清除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
type: "warning"
})
.then(() => {
for (let k of this.checkList) {
if (k === "print-setting" || k === "deviceId") {
let list = Object.keys(this.$dataStore.store).filter((el) =>
el.includes(k),
let list = Object.keys(this.$dataStore.store).filter(el =>
el.includes(k)
);
list.forEach((el) => {
list.forEach(el => {
this.$dataStore.delete(el);
});
} else if (k === "token") {
......@@ -311,9 +311,9 @@ export default {
try {
axios
.get(item?.src, {
responseType: "blob",
responseType: "blob"
})
.then((res) => {
.then(res => {
var url = URL.createObjectURL(res.data);
let img = new Image();
img.crossorigin = "";
......@@ -334,7 +334,7 @@ export default {
resolve();
};
})
.catch((e) => {
.catch(e => {
console.log(e);
reject(e);
});
......@@ -362,7 +362,7 @@ export default {
const { canvasWidth, canvasHeight, list: drawItems } = canvasConfig;
if (!canvasWidth || !canvasHeight || !Array.isArray(drawItems)) {
throw new Error(
"canvas配置项必须包含canvasWidth/canvasHeight/list(数组)属性",
"canvas配置项必须包含canvasWidth/canvasHeight/list(数组)属性"
);
}
......@@ -373,8 +373,8 @@ export default {
canvas.height = canvasHeight;
// 批量执行绘制方法,收集异步绘制Promise(语义化变量名,替代原模糊的list)
const drawPromises = drawItems.map((drawItem) =>
this.drawImage(canvas, drawItem),
const drawPromises = drawItems.map(drawItem =>
this.drawImage(canvas, drawItem)
);
// 等待当前canvas的所有绘制操作完成
await Promise.all(drawPromises);
......@@ -415,7 +415,7 @@ export default {
async hasDesignImagesCanvasJsonList(
designImagesCanvasJsonList,
bool,
isForcedProduction,
isForcedProduction
) {
let imageResList = [];
......@@ -498,13 +498,13 @@ export default {
device: this.desktopDevice,
orderType: this.orderType,
forceProduction:
this.isForcedProduction || isForcedProduction || false,
},
this.isForcedProduction || isForcedProduction || false
}
);
console.log("downloadBySubOrderNumber", res);
if (!res.data.length) return this.$message.warning("未找到素材图!");
res.data.forEach((el) => {
res.data.forEach(el => {
imageResList = imageResList.concat(el.list || []);
});
} catch (error) {
......@@ -517,7 +517,7 @@ export default {
if (this.checked) {
imageResList = await this.cutImgFn(imageResList);
imageResList.forEach((el) => {
imageResList.forEach(el => {
el.isCut = true;
});
}
......@@ -540,7 +540,7 @@ export default {
let obj = {
type: "sendFile",
value: [...newImgList],
productMark: this.detail.productMark,
productMark: this.detail.productMark
};
if (
......@@ -550,12 +550,12 @@ export default {
) {
obj.size = {
width: this.detail.mssWidth,
height: this.detail.mssHeight,
height: this.detail.mssHeight
};
}
//设置储存图片的字段,并添加power标识
if (!this.detail["saveImgList"]?.length) {
this.detail["saveImgList"] = [...newImgList].map((el) => {
this.detail["saveImgList"] = [...newImgList].map(el => {
el.power = false;
return { ...el };
});
......@@ -591,11 +591,11 @@ export default {
if (this.detail && !this.isAutoFinish && this.desktopDevice == 3) {
//惠立彩判断是否全部图片都已经打印完成
const canCallApi =
this.detail.saveImgList?.every((el) => el.power) ?? false;
this.detail.saveImgList?.every(el => el.power) ?? false;
if (canCallApi) {
bus.$emit("busEmit", {
value: this.detail.newId,
type: "completeFail",
type: "completeFail"
});
}
}
......@@ -610,8 +610,8 @@ export default {
if (!this.isAutoFinish && today != getNowDate()) {
this.$confirm("请注意自动完成上一单未勾选", "提示", {
confirmButtonText: "跳过提示",
type: "warning",
}).then((res) => {
type: "warning"
}).then(res => {
if (res == "confirm") {
setNowDate(today);
}
......@@ -622,7 +622,7 @@ export default {
if (this.productionNo.includes("_")) {
this.$store.commit(
"setOrderType",
this.classifyField(this.productionNo),
this.classifyField(this.productionNo)
);
} else {
let str;
......@@ -645,7 +645,7 @@ export default {
const apiRequestParams = {
thirdSubOrderNumber: this.productionNo,
orderType: this.orderType,
resizable: this.desktopDevice == 3 ? true : false,
resizable: this.desktopDevice == 3 ? true : false
};
//判断是否为惠立彩
......@@ -658,12 +658,12 @@ export default {
localItem ||
(await this.$api.post(
pathMap["findByPodProductionNo"][this.orderType],
apiRequestParams,
apiRequestParams
));
} else {
findByPodProductionNo = await this.$api.post(
pathMap["findByPodProductionNo"][this.orderType],
apiRequestParams,
apiRequestParams
);
}
......@@ -673,12 +673,55 @@ export default {
this.detail["newId"] = this.productionNo;
}
if (
this.orderType == "OP" &&
(this.detail.productMark == "custom_normal" ||
this.detail.productMark == "normal")
) {
this.detail = "";
const err = new Error();
err.data = "GCB类的操作单无效操作!!!";
throw err;
}
if (
this.orderType == "OP" &&
(this.detail.status == "PENDING_PICK" ||
this.detail.status == "PENDING_REPLENISH")
) {
const { data, code } = await this.$api.post(
pathMap["scanProduce"][this.orderType],
{ id: this.detail.id, status: this.detail.status }
);
console.log("scanProduce---------", data);
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;
//获取下载素材
await this.hasDesignImagesCanvasJsonList(
designImagesCanvasJsonList,
this.desktopDevice === 3 ? (localItem ? true : false) : false,
isForcedProduction,
isForcedProduction
);
this.$store.commit("setProductDetail", this.detail);
ipcRenderer.send("win-subScreen", findByPodProductionNo.data);
......@@ -686,11 +729,13 @@ export default {
this.productionNo = "";
this.$refs.searchRef?.focus();
} catch (err) {
console.log(err);
console.log(723, err);
if (!err.data) {
this.$message.error(
"未使用英文输入法输入/扫码,或该生产单号未拣胚或已完成",
"未使用英文输入法输入/扫码,或该生产单号未拣胚或已完成"
);
} else {
this.$message.error(err.data);
}
this.productionNo = "";
this.$refs.searchRef?.focus();
......@@ -726,7 +771,7 @@ export default {
unit: "mm",
language: "cn",
autoPrint: false,
gridSpacing: 10,
gridSpacing: 10
};
this.$message.success("重置应用程序设置成功");
},
......@@ -747,8 +792,8 @@ export default {
formData.append("file", f);
let { data } = await this.$api.post("/uploadImage", formData, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
"Content-Type": "application/x-www-form-urlencoded"
}
});
bus.$emit("busEmit", { type: "uploadImage", value: data });
return false;
......@@ -768,7 +813,7 @@ export default {
this.$store.commit("updateSystemSetting", {
field: "gridValue",
value: this.grid[i],
value: this.grid[i]
});
bus.$emit("busEmit", { type: "grid", value: this.grid[i] });
},
......@@ -810,7 +855,7 @@ export default {
const outputPath = path.join(outputDir, outputFileName);
const params = {
inputPath: el.productionFile,
outputPath: outputPath,
outputPath: outputPath
};
let res;
res = await this.$api.post("/processImage", params);
......@@ -818,18 +863,18 @@ export default {
return {
fileName: outputFileName,
productionFile: res.msg[0]?.outputPath,
designId: el.designId || index,
designId: el.designId || index
};
} catch (error) {
console.error(`处理失败: ${el.productionFile}`, error);
}
}),
})
);
// 等待所有异步操作完成
await new Promise((resolve) => setTimeout(resolve, 100));
const newMap = new Map(processQueue.map((el) => [el.designId, el]));
processQueue.forEach((el) => {
await new Promise(resolve => setTimeout(resolve, 100));
const newMap = new Map(processQueue.map(el => [el.designId, el]));
processQueue.forEach(el => {
if (newMap.has(el.designId)) {
el.fileName = newMap.get(el.designId).fileName;
el.productionFile = newMap.get(el.designId).productionFile;
......@@ -844,7 +889,7 @@ export default {
},
getCountryName(code) {
if (code) {
const item = this.countryList?.find((el) => el.countryCode == code);
const item = this.countryList?.find(el => el.countryCode == code);
if (item) {
return `(${item.nameCn})`;
}
......@@ -877,8 +922,8 @@ export default {
this.detail = null;
this.$store.commit("setProductDetail", {});
this.dialogVisible = false;
},
},
}
}
};
</script>
<style scoped>
......@@ -990,7 +1035,7 @@ export default {
<el-form-item prop="setting" label="网格显示">
<el-select
style="width:100%"
@change="(e) => settingChange('gridShow', e)"
@change="e => settingChange('gridShow', e)"
clearable
v-model="setting.gridShow"
>
......@@ -1001,7 +1046,7 @@ export default {
<el-form-item prop="gridSpacing" label="单位">
<el-select
style="width:100%"
@change="(e) => settingChange('unit', e)"
@change="e => settingChange('unit', e)"
clearable
v-model="setting.unit"
>
......@@ -1012,7 +1057,7 @@ export default {
<el-form-item prop="gridSpacing" label="网格间隔">
<el-select
style="width:100%"
@change="(e) => settingChange('gridSpacing', e)"
@change="e => settingChange('gridSpacing', e)"
clearable
v-model="setting.gridSpacing"
>
......@@ -1041,7 +1086,7 @@ export default {
<el-form-item prop="language" label="语言设置">
<el-select
style="width:100%"
@change="(e) => settingChange('language', e)"
@change="e => settingChange('language', e)"
clearable
v-model="setting.language"
>
......@@ -1133,7 +1178,7 @@ export default {
{{
user.factory.countryCode
? `${user.factory.countryCode}${getCountryName(
user.factory.countryCode,
user.factory.countryCode
)}`
: "CN(中国)"
}}
......@@ -1211,7 +1256,7 @@ export default {
>
<el-button
v-if="!showforcedProduc"
@click="(e) => forcedProductionFN(e, true)"
@click="e => forcedProductionFN(e, true)"
style="color: red;"
>自动强制生产</el-button
>
......@@ -1348,3 +1393,10 @@ export default {
}
}
</style>
<style>
.custom-inventory-msgbox {
width: 500px !important; /* 必须加 !important 覆盖默认样式 */
min-width: 500px !important; /* 防止被最小宽度限制 */
}
</style>
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