Commit 433632d1 by linjinhong

fix:修改惠立彩图片处理逻辑

parent 6c8146f3
{"apiApiHost":"https://11factory.jomalls.com/api","fileApiUrl":"https://11factory.jomalls.com/upload/factory","visionUrl":"https://console.jomalls.com","configPath":"D:\\work\\electron-printer\\config\\env.json"} {
\ No newline at end of file "apiApiHost": "https://factory.jomalls.com/api",
"fileApiUrl": "https://factory.jomalls.com/upload/factory",
"visionUrl": "https://console.jomalls.com",
"configPath": "D:\\work\\electron-printer\\config\\env.json"
}
...@@ -140,13 +140,14 @@ export default { ...@@ -140,13 +140,14 @@ export default {
CN: "factory/podJomallOrderProductCn/downloadDesignImages", CN: "factory/podJomallOrderProductCn/downloadDesignImages",
US: "factory/podJomallOrderProductUs/downloadDesignImages", US: "factory/podJomallOrderProductUs/downloadDesignImages",
GC: "factory/podJomallOrder/downloadByProduction", GC: "factory/podJomallOrder/downloadByProduction",
HLC: "factory/podJomallOrderProductUs/downloadCompatibleDesignImages", USHLC: "factory/podJomallOrderProductUs/downloadCompatibleDesignImages",
CNHLC: "factory/podJomallOrderProductCn/downloadCompatibleDesignImages",
}; };
try { try {
let url = urlMap[params.orderType]; let url = urlMap[params.orderType];
if (params.device == 3) { if (params.device == 3) {
url = urlMap["HLC"]; url = params.orderType == "CN" ? urlMap["CNHLC"] : urlMap["USHLC"];
} }
const { data } = await axios.post(`${env}/${url}`, [...params.ids], { const { data } = await axios.post(`${env}/${url}`, [...params.ids], {
headers: { "jwt-token": token }, headers: { "jwt-token": token },
......
...@@ -20,7 +20,7 @@ const { ...@@ -20,7 +20,7 @@ const {
setApi, setApi,
setDesktopDevice, setDesktopDevice,
getDesktopDevice, getDesktopDevice,
getOrderInfo, getOrderInfoMap,
getOrderInfoItem, getOrderInfoItem,
addToOrderInfo, addToOrderInfo,
updateOrderInfoItem, updateOrderInfoItem,
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
"hsla(209, 100%, 56%, 0.73)", "hsla(209, 100%, 56%, 0.73)",
"#c7158577", "#c7158577",
], ],
faceType: "1", faceType: "A",
}; };
}, },
computed: { computed: {
...@@ -179,25 +179,16 @@ export default { ...@@ -179,25 +179,16 @@ export default {
item.productionFile, item.productionFile,
getLocation("downloadLocation2"), getLocation("downloadLocation2"),
); );
// this.$api.post("/copySingleImageFn", {
// imgPath: item.productionFile,
// targetPath: getLocation("downloadLocation1"),
// });
// this.$api.post("/copySingleImageFn", {
// imgPath: item.productionFile,
// targetPath: getLocation("downloadLocation2"),
// });
// this.$message.success("图片已发送目标文件夹下");
} catch (error) { } catch (error) {
this.$message.error("发送失败"); this.$message.error("发送失败");
console.log(error); console.log(error);
} }
//更新数据到本地数据 //更新数据到本地数据
updateOrderInfoItem(this.detail.newId, this.detail); updateOrderInfoItem(this.detail.newId, this.detail, this.faceType);
} }
console.log("updateOrderInfoItemitem", item); console.log("updateOrderInfoItemitem", item);
console.log("本地数据updateOrderInfoItem:", getOrderInfo()); console.log("本地数据updateOrderInfoItem:", getOrderInfoMap());
} }
}, },
// deep: true, // deep: true,
...@@ -259,9 +250,9 @@ export default { ...@@ -259,9 +250,9 @@ export default {
if (canCallApi) { if (canCallApi) {
console.log("生产完成"); console.log("生产完成");
removeFromOrderInfo(data.newId); await removeFromOrderInfo(data.newId);
bus.$emit("busEmit", { value: data.newId, type: "completeMessage" }); bus.$emit("busEmit", { value: data.newId, type: "completeMessage" });
console.log("本地数据removeFromOrderInfo:", getOrderInfo()); console.log("本地数据removeFromOrderInfo:", getOrderInfoMap());
//生产完成后在本地删除 //生产完成后在本地删除
return; return;
await this.$api.post("/completeDelivery", params); await this.$api.post("/completeDelivery", params);
...@@ -387,17 +378,7 @@ export default { ...@@ -387,17 +378,7 @@ export default {
} }
return new File([u8arr], fileName, { type: "image/png" }); return new File([u8arr], fileName, { type: "image/png" });
}, },
// async downloadImage() {
// if (!this.detail || Object.keys(this.detail).length === 0)
// return this.$message.warning("请扫描生产单号");
// let params = {
// productionNo: this.detail.factorySubOrderNumber,
// imgList: this.imgList,
// };
// let res = await this.$api.post("/downloadByDesignId", params);
// this.$message.success(res.msg);
// },
async saveImgByUrl(url) { async saveImgByUrl(url) {
try { try {
let res = await this.$api.post("/saveImgByUrl", { url }); let res = await this.$api.post("/saveImgByUrl", { url });
...@@ -406,8 +387,10 @@ export default { ...@@ -406,8 +387,10 @@ export default {
throw new Error(e.message); // 或者直接 throw e; throw new Error(e.message); // 或者直接 throw e;
} }
}, },
async hasDesignImagesCanvasJsonList(designImagesCanvasJsonList, bool) { async hasDesignImagesCanvasJsonList(designImagesCanvasJsonList, bool) {
let imageResList = []; let imageResList = [];
//当adjustable有值时 直接赋值宽高
if ( if (
!this.checked && !this.checked &&
this.detail.diyId && this.detail.diyId &&
...@@ -443,23 +426,20 @@ export default { ...@@ -443,23 +426,20 @@ export default {
// } // }
} }
} }
if (!imageResList.length && !bool) {
// console.log(347, this.orderType);
// 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示 // 根据生产单号查找 素材图片 下载到本地 然后返回本地地址去显示
if (!imageResList.length && !bool) {
let res = await this.$api.post("/downloadBySubOrderNumber", { let res = await this.$api.post("/downloadBySubOrderNumber", {
ids: [this.detail.id], ids: [this.detail.id],
device: this.$store.state.desktopDevice, device: this.$store.state.desktopDevice,
orderType: this.orderType, orderType: this.orderType,
}); });
// console.log("downloadBySubOrderNumber", res);
if (!res.data.length) return this.$message.warning("未找到素材图!"); if (!res.data.length) return this.$message.warning("未找到素材图!");
res.data.forEach((el) => { res.data.forEach((el) => {
imageResList = imageResList.concat(el.list || []); imageResList = imageResList.concat(el.list || []);
}); });
} else if (bool) { } else if (bool) {
//如果有本地数据 则直接获取本地数据同图片
imageResList = this.detail?.saveImgList || []; imageResList = this.detail?.saveImgList || [];
console.log("imageResList", imageResList); console.log("imageResList", imageResList);
} }
...@@ -476,7 +456,6 @@ export default { ...@@ -476,7 +456,6 @@ export default {
if (imageResList.length) { if (imageResList.length) {
let pathUrl = imageResList[0].productionFile; let pathUrl = imageResList[0].productionFile;
setTimeout(async () => { setTimeout(async () => {
// await this.focusExplorerWindow(pathUrl);
const pathParts = pathUrl.split("\\"); const pathParts = pathUrl.split("\\");
pathParts.pop(); pathParts.pop();
// 使用 join() 将剩余部分重新拼接成路径 // 使用 join() 将剩余部分重新拼接成路径
...@@ -522,7 +501,6 @@ export default { ...@@ -522,7 +501,6 @@ export default {
type: "sendFile", type: "sendFile",
value: [...newImgList], value: [...newImgList],
}; };
// console.log(387, obj);
if ( if (
this.detail.mssWidth && this.detail.mssWidth &&
...@@ -544,13 +522,16 @@ export default { ...@@ -544,13 +522,16 @@ export default {
//如果该数据的图片第一次出现且素材图大于1张则把该数据储存到本地 //如果该数据的图片第一次出现且素材图大于1张则把该数据储存到本地
if (newImgList.length > 1 && !bool) { if (newImgList.length > 1 && !bool) {
addToOrderInfo(this.detail); addToOrderInfo(this.detail);
console.log("本地数据addToOrderInfo", getOrderInfo()); console.log("本地数据addToOrderInfo", getOrderInfoMap());
} }
if (this.desktopDevice == 3) obj.faceType = this.faceType;
bus.$emit("busEmit", obj); bus.$emit("busEmit", obj);
} }
}, },
async getDataInfo() { async getDataInfo() {
//查询后先检查当前是否有数据,有则先走生产完成
if ( if (
this.detail && this.detail &&
Object.keys(this.detail).length > 0 && Object.keys(this.detail).length > 0 &&
...@@ -558,13 +539,13 @@ export default { ...@@ -558,13 +539,13 @@ export default {
) { ) {
await this.setData(this.detail); await this.setData(this.detail);
} }
//判断生产单号是否为空
if (this.productionNo === "") if (this.productionNo === "")
return this.$message.warning("请录入生产单号"); return this.$message.warning("请录入生产单号");
const today = moment(new Date()).format("YYYY-MM-DD"); const today = moment(new Date()).format("YYYY-MM-DD");
console.log("today", today);
//判断上一单未勾选是否跳过
if (!this.isAutoFinish && today != getNowDate()) { if (!this.isAutoFinish && today != getNowDate()) {
this.$confirm("请注意自动完成上一单未勾选", "提示", { this.$confirm("请注意自动完成上一单未勾选", "提示", {
confirmButtonText: "跳过提示", confirmButtonText: "跳过提示",
...@@ -576,11 +557,10 @@ export default { ...@@ -576,11 +557,10 @@ export default {
}); });
} }
//判断生产单号是US CN GC(老pod),并设置 setOrderType
if (this.productionNo.includes("_")) { if (this.productionNo.includes("_")) {
const parts = this.productionNo.split("_"); const parts = this.productionNo.split("_");
// 查找第一个包含"PSC"的片段
const pscPart = parts.find((part) => part.includes("PSC")); const pscPart = parts.find((part) => part.includes("PSC"));
if (pscPart) { if (pscPart) {
this.$store.commit( this.$store.commit(
"setOrderType", "setOrderType",
...@@ -604,13 +584,11 @@ export default { ...@@ -604,13 +584,11 @@ export default {
} }
try { try {
//获取本地数组
const arr = await getOrderInfo();
//查询当前生产单号是否在本地数据 //查询当前生产单号是否在本地数据
const localItem = getOrderInfoItem(this.productionNo) const localItem = getOrderInfoItem(this.productionNo, this.faceType)
? { data: getOrderInfoItem(this.productionNo) } ? { data: getOrderInfoItem(this.productionNo, this.faceType) }
: null; : null;
console.log("本地数据getOrderInfoItem", getOrderInfo()); console.log("本地数据getOrderInfoItem", getOrderInfoMap());
let findByPodProductionNo; let findByPodProductionNo;
const apiRequestParams = { const apiRequestParams = {
thirdSubOrderNumber: this.productionNo, thirdSubOrderNumber: this.productionNo,
...@@ -620,20 +598,9 @@ export default { ...@@ -620,20 +598,9 @@ export default {
//判断是否为惠立彩 //判断是否为惠立彩
if (this.desktopDevice === 3) { if (this.desktopDevice === 3) {
if (arr.length > 0) {
//如果查询到生产单号 直接复制否则调用接口获取详情
findByPodProductionNo = findByPodProductionNo =
localItem || localItem ||
(await this.$api.post( (await this.$api.post("/findByPodProductionNo", apiRequestParams));
"/findByPodProductionNo",
apiRequestParams,
));
} else {
findByPodProductionNo = await this.$api.post(
"/findByPodProductionNo",
apiRequestParams,
);
}
} else { } else {
findByPodProductionNo = await this.$api.post( findByPodProductionNo = await this.$api.post(
"/findByPodProductionNo", "/findByPodProductionNo",
...@@ -643,9 +610,12 @@ export default { ...@@ -643,9 +610,12 @@ export default {
this.detail = findByPodProductionNo.data; this.detail = findByPodProductionNo.data;
//赋值当前扫码为生产单号的标识 //赋值当前扫码为生产单号的标识
if (!this.detail["newId"]) {
this.detail["newId"] = this.productionNo; this.detail["newId"] = this.productionNo;
}
let designImagesCanvasJsonList = this.detail.drParam; let designImagesCanvasJsonList = this.detail.drParam;
//获取下载素材
await this.hasDesignImagesCanvasJsonList( await this.hasDesignImagesCanvasJsonList(
designImagesCanvasJsonList, designImagesCanvasJsonList,
this.desktopDevice === 3 ? (localItem ? true : false) : false, this.desktopDevice === 3 ? (localItem ? true : false) : false,
...@@ -1076,8 +1046,8 @@ export default { ...@@ -1076,8 +1046,8 @@ export default {
<div>当前打印:</div> <div>当前打印:</div>
<el-select v-model="faceType" placeholder="请选择" class="FaceType"> <el-select v-model="faceType" placeholder="请选择" class="FaceType">
<el-option label="A面 / 正面" value="1"></el-option> <el-option label="A面 / 正面" value="A"></el-option>
<el-option label="B面 / 反面" value="2"></el-option> <el-option label="B面 / 反面" value="B"></el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
......
...@@ -77,7 +77,13 @@ export default { ...@@ -77,7 +77,13 @@ export default {
unitToPx, unitToPx,
getCurrentItem(item) { getCurrentItem(item) {
// let setting = this.$dataStore.get("setting"); // let setting = this.$dataStore.get("setting");
if (item.y != 0) {
this.item.y = item.y - item.h / 2; this.item.y = item.y - item.h / 2;
console.log(93, item);
} else {
item.y == 0;
}
this.item.x = item.x - item.w / 2; this.item.x = item.x - item.w / 2;
this.$dataStore.set( this.$dataStore.set(
"position_before_px", "position_before_px",
......
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