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