Commit 198d80d7 by linjinhong

Merge remote-tracking branch 'origin/GTX-3.0'

parents b2375b88 6d9f61b2
[{"head_setting":{"gridShow":1,"gridValue":0,"unit":"inch","language":"cn","autoPrint":false,"gridSpacing":1},"version":"1.0.16","print_setting":{"printer":"","xy":"","byInk":2,"byInkVolume":1,"byDoublePrint":3,"bEcoMode":false,"bMaterialBlack":false,"byHighlight":5,"printNum":1,"bFastMode":false,"bUniPrint":false,"bDivide":false,"bPause":false,"byMask":3,"bTransColor":false,"byChoke":2,"minWhiteInkType":0,"bySaturation":5,"byBrightness":5,"byContrast":5,"iCyanBalance":0,"iMagentaBalance":0,"iBlackBalance":0,"iYellowBalance":0,"byMinWhite":1,"bMultiple":false},"production_no":"GCPSC2507193437","print_time":"2025-07-19 15:12:08","position_unit":{"x":408.8,"rate":1.396341463414634,"sx":0,"zIndex":0,"sh":0,"sw":0,"sy":0,"y":458.6,"w":594.4,"h":826.7,"r":0},"position_after_px":{"x":"0.4","rate":1.0410958904109588,"sx":0,"zIndex":0,"sh":0,"sw":0,"sy":0,"y":"1.5","w":"26.4","h":"27.4","r":0},"position_before_px":{"url":"D:\\work\\electron-printer\\print\\Input\\fe1efecb-506e-4400-b264-c8e2d87adc5e.png","fileName":"fe1efecb-506e-4400-b264-c8e2d87adc5e.png","rate":1.0410958904109588,"w":795.3157894736843,"zIndex":0,"x":11.342105263157862,"y":46,"h":828,"r":0},"send_api_data":{"printer":"","xy":"","byInk":2,"byInkVolume":1,"byDoublePrint":3,"bEcoMode":false,"bMaterialBlack":false,"byHighlight":5,"printNum":1,"bFastMode":false,"bUniPrint":false,"bDivide":false,"bPause":false,"byMask":3,"bTransColor":false,"byChoke":2,"minWhiteInkType":0,"bySaturation":5,"byBrightness":5,"byContrast":5,"iCyanBalance":0,"iMagentaBalance":0,"iBlackBalance":0,"iYellowBalance":0,"byMinWhite":1,"bMultiple":false,"byPlatenSize":1,"cmd":"GTXproCMD.exe print -X \"Profile\\fe1efecb-506e-4400-b264-c8e2d87adc5e.xml\" -I \"Input\\fe1efecb-506e-4400-b264-c8e2d87adc5e.png\" -A \"Output\\fe1efecb-506e-4400-b264-c8e2d87adc5e.arxp\" -S 39374100 -L 00610233 -D 0 -W 1","fileName":"fe1efecb-506e-4400-b264-c8e2d87adc5e.png","print_cmd":"GTXproCMD.exe send -A \"Output\\fe1efecb-506e-4400-b264-c8e2d87adc5e.arxp\" -P \"Brother GTX pro FileOutput"}},{"head_setting":{"gridShow":1,"gridValue":0,"unit":"inch","language":"cn","autoPrint":false,"gridSpacing":1},"version":"1.0.16","print_setting":{"printer":"","xy":"","byInk":2,"byInkVolume":1,"byDoublePrint":3,"bEcoMode":false,"bMaterialBlack":false,"byHighlight":5,"printNum":1,"bFastMode":false,"bUniPrint":false,"bDivide":false,"bPause":false,"byMask":3,"bTransColor":false,"byChoke":2,"minWhiteInkType":0,"bySaturation":5,"byBrightness":5,"byContrast":5,"iCyanBalance":0,"iMagentaBalance":0,"iBlackBalance":0,"iYellowBalance":0,"byMinWhite":1,"bMultiple":false},"production_no":"GCPSC2507193437","print_time":"2025-07-19 15:12:00","position_unit":{"x":408.8,"rate":1.396341463414634,"sx":0,"zIndex":0,"sh":0,"sw":0,"sy":0,"y":458.6,"w":594.4,"h":826.7,"r":0},"position_after_px":{"x":"0.4","rate":1.0410958904109588,"sx":0,"zIndex":0,"sh":0,"sw":0,"sy":0,"y":"1.5","w":"26.4","h":"27.4","r":0},"position_before_px":{"url":"D:\\work\\electron-printer\\print\\Input\\fe1efecb-506e-4400-b264-c8e2d87adc5e.png","fileName":"fe1efecb-506e-4400-b264-c8e2d87adc5e.png","rate":1.0410958904109588,"w":795.3157894736843,"zIndex":0,"x":11.342105263157862,"y":46,"h":828,"r":0},"send_api_data":{"printer":"","xy":"","byInk":2,"byInkVolume":1,"byDoublePrint":3,"bEcoMode":false,"bMaterialBlack":false,"byHighlight":5,"printNum":1,"bFastMode":false,"bUniPrint":false,"bDivide":false,"bPause":false,"byMask":3,"bTransColor":false,"byChoke":2,"minWhiteInkType":0,"bySaturation":5,"byBrightness":5,"byContrast":5,"iCyanBalance":0,"iMagentaBalance":0,"iBlackBalance":0,"iYellowBalance":0,"byMinWhite":1,"bMultiple":false,"byPlatenSize":1,"cmd":"GTXproCMD.exe print -X \"Profile\\fe1efecb-506e-4400-b264-c8e2d87adc5e.xml\" -I \"Input\\fe1efecb-506e-4400-b264-c8e2d87adc5e.png\" -A \"Output\\fe1efecb-506e-4400-b264-c8e2d87adc5e.arxp\" -S 39374100 -L 00610233 -D 0 -W 1","fileName":"fe1efecb-506e-4400-b264-c8e2d87adc5e.png","print_cmd":"GTXproCMD.exe send -A \"Output\\fe1efecb-506e-4400-b264-c8e2d87adc5e.arxp\" -P \"导出为WPS PDF"}}]
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
[{"head_setting":{"gridShow":1,"gridValue":1,"unit":"inch","language":"cn","autoPrint":false,"gridSpacing":1},"version":"1.0.19","print_setting":{"printer":"","xy":"","byInk":2,"byInkVolume":1,"byDoublePrint":3,"bEcoMode":false,"bMaterialBlack":false,"byHighlight":5,"printNum":1,"bFastMode":false,"bUniPrint":false,"bDivide":false,"bPause":false,"byMask":3,"bTransColor":false,"byChoke":2,"minWhiteInkType":0,"bySaturation":5,"byBrightness":5,"byContrast":5,"iCyanBalance":0,"iMagentaBalance":0,"iBlackBalance":0,"iYellowBalance":0,"byMinWhite":1,"bMultiple":false},"production_no":"USPSC250621003","print_time":"2025-08-20 07:19:01","position_unit":{"x":408.8,"rate":1.396341463414634,"sx":0,"zIndex":0,"sh":0,"sw":0,"sy":0,"y":458.6,"w":594.4,"h":826.7,"r":0},"position_after_px":{"x":"0.0","rate":1.0676110753380554,"sx":0,"zIndex":0,"sh":0,"sw":0,"sy":0,"y":"1.5","w":"22.3","h":"26.4","r":0},"position_before_px":{"url":"D:\\work\\gtx-3.0\\print4.0\\Input\\7fd25868-79c5-478e-9c10-9becba9ef2dd.png","fileName":"7fd25868-79c5-478e-9c10-9becba9ef2dd.png","rate":1.0676110753380554,"w":674,"zIndex":0,"x":0,"y":44.19999999999999,"h":795.6,"r":0},"send_api_data":{"printer":"","xy":"","byInk":2,"byInkVolume":1,"byDoublePrint":3,"bEcoMode":false,"bMaterialBlack":false,"byHighlight":5,"printNum":1,"bFastMode":false,"bUniPrint":false,"bDivide":false,"bPause":false,"byMask":3,"bTransColor":false,"byChoke":2,"minWhiteInkType":0,"bySaturation":5,"byBrightness":5,"byContrast":5,"iCyanBalance":0,"iMagentaBalance":0,"iBlackBalance":0,"iYellowBalance":0,"byMinWhite":1,"bMultiple":false,"byPlatenSize":0,"cmd":"GTXproCMD.exe print -X \"Profile\\7fd25868-79c5-478e-9c10-9becba9ef2dd.xml\" -I \"Input\\7fd25868-79c5-478e-9c10-9becba9ef2dd.png\" -A \"Output\\7fd25868-79c5-478e-9c10-9becba9ef2dd.arxp\" -S 40534786 -L 00060272 -D 0 -W 1","fileName":"7fd25868-79c5-478e-9c10-9becba9ef2dd.png","print_cmd":"GTXproCMD.exe send -A \"Output\\7fd25868-79c5-478e-9c10-9becba9ef2dd.arxp\" -P \"Brother GTX pro FileOutput"}}]
\ No newline at end of file
......@@ -2,7 +2,7 @@
"name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant",
"description": "",
"version": "1.0.18",
"version": "1.0.20",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
......@@ -20,12 +20,13 @@
"@vue/composition-api": "^0.3.4",
"axios": "^0.19.2",
"bignumber.js": "^9.2.1",
"canvas": "^2.11.2",
"compressing": "^1.10.1",
"core-js": "^3.6.4",
"electron-builder": "^24.13.3",
"electron-icon-builder": "^2.0.1",
"electron-log": "^5.1.7",
"electron-store": "^4.0.0",
"electron-store": "^5.2.0",
"electron-updater": "^6.2.1",
"element-ui": "^2.13.0",
"express": "^4.17.1",
......@@ -39,6 +40,7 @@
"multiparty": "^4.2.3",
"nodemon": "^3.1.4",
"normalize.css": "^8.0.1",
"rebuild": "^0.1.2",
"sharp": "0.28.0",
"vue": "^2.6.11",
"vue-draggable-resizable": "^2.0.0",
......
GTXproCMD.exe print -X "Profile\CO12.xml" -I "Input\sample.png" -A "Output\pO12.arxp" -S 01000200 -L 02540254
echo %errorlevel%
\ No newline at end of file
GTXproCMD.exe print -X "Profile\CO12.xml" -I "Input\sample.png" -A "Output\pO12.arxp" -S 01000200 -L 02540254
echo %errorlevel%
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bMultiple>1</bMultiple>
<byResolution>1</byResolution>
<byInk>1</byInk>
<byInkVolume>1</byInkVolume>
<byDoublePrint>1</byDoublePrint>
<bySaturation>1</bySaturation>
<byBrightness>1</byBrightness>
<byContrast>1</byContrast>
<iCyanBalance>1</iCyanBalance>
<iMagentaBalance>1</iMagentaBalance>
<iYellowBalance>1</iYellowBalance>
<iBlackBalance>1</iBlackBalance>
<bUniPrint>1</bUniPrint>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<byHighlight>1</byHighlight>
<byMask>1</byMask>
<bDivide>1</bDivide>
<bTransColor>1</bTransColor>
<bySaturation>1</bySaturation>
<byBrightness>1</byBrightness>
<byContrast>1</byContrast>
<bUniPrint>1</bUniPrint>
<byResolution>1</byResolution>
<byInk>1</byInk>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>1</bEcoMode>
<byInk>1</byInk>
<bMaterialBlack>1</bMaterialBlack>
<bMultiple>1</bMultiple>
<byHighlight>1</byHighlight>
<byMask>1</byMask>
<bFastMode>1</bFastMode>
<bDivide>1</bDivide>
<bPause>1</bPause>
<bTransColor>1</bTransColor>
<byChoke>1</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>1</bySaturation>
<byBrightness>1</byBrightness>
<byContrast>1</byContrast>
<iCyanBalance>1</iCyanBalance>
<bUniPrint>1</bUniPrint>
<iMagentaBalance>1</iMagentaBalance>
<iYellowBalance>1</iYellowBalance>
<iBlackBalance>1</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<byResolution>1</byResolution>
<byInk>1</byInk>
<bMultiple>1</bMultiple>
<byInkVolume>1</byInkVolume>
<byDoublePrint>1</byDoublePrint>
<bySaturation>1</bySaturation>
<byBrightness>1</byBrightness>
<byContrast>1</byContrast>
<iBlackBalance>1</iBlackBalance>
<bUniPrint>1</bUniPrint>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<GTOPTION xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<szFileName />
<uiCopies>1</uiCopies>
<byPlatenSize>1</byPlatenSize>
<bEcoMode>false</bEcoMode>
<byInk>2</byInk>
<bMaterialBlack>false</bMaterialBlack>
<bMultiple>false</bMultiple>
<byHighlight>5</byHighlight>
<byMask>3</byMask>
<bFastMode>false</bFastMode>
<bDivide>false</bDivide>
<bPause>false</bPause>
<bTransColor>false</bTransColor>
<byChoke>2</byChoke>
<byMinWhite>1</byMinWhite>
<bySaturation>5</bySaturation>
<byBrightness>5</byBrightness>
<byContrast>5</byContrast>
<iCyanBalance>0</iCyanBalance>
<bUniPrint>false</bUniPrint>
<iMagentaBalance>0</iMagentaBalance>
<iYellowBalance>0</iYellowBalance>
<iBlackBalance>0</iBlackBalance>
<byResolution>1</byResolution>
</GTOPTION>
\ No newline at end of file
GTXproCMD.exe print -X "Profile\CO12.xml" -I "Input\sample.png" -A "Output\pO12.arxp" -S 01000200 -L 02540254
echo %errorlevel%
\ No newline at end of file
GTXproCMD.exe send -A "D:\sample\Output\pO12.arxp" -P "Brother GTX pro" -D 1
echo %errorlevel%
\ No newline at end of file
......@@ -7,6 +7,7 @@ import { autoUpdater } from "electron-updater";
import path from "path"; // 引入 path 模块
const { exec } = require("child_process");
const { setVersion } = require("@/server/utils/store");
Object.defineProperty(app, "isPackaged", {
get() {
......@@ -196,6 +197,11 @@ app.on("ready", async () => {
globalShortcut.register("CommandOrControl+R", () => {
return false;
});
ipcMain.on("update-version", (_, version) => {
console.log(72, version);
setVersion(version); // 保存到 electron-store
});
});
app.on("will-quit", () => {
......
......@@ -21,6 +21,15 @@ const { app } = require("electron");
let fileEnv, env, visionUrl;
axios.defaults.timeout = 12600000;
const multiparty = require("multiparty");
const { getVersion } = require("@/server/utils/store");
function getCurrentVersion() {
const version = getVersion();
console.log("version", version);
return version;
}
function readEnv() {
let exePath, configPath;
......@@ -52,7 +61,10 @@ export default {
responseType: "stream",
});
let fileName = uuid.v4() + ".png";
const filePath = path.join(process.cwd(), "./print/Input/" + fileName);
const filePath = path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + fileName
);
const writer = fs.createWriteStream(filePath);
response.data.pipe(writer);
......@@ -215,7 +227,7 @@ export default {
for (let k in q.imgList) {
const p = path.join(
process.cwd(),
"./print/Input/" + q.imgList[k].fileName
`./${getCurrentVersion()}/Input/` + q.imgList[k].fileName
);
zipStream.addEntry(p);
}
......@@ -254,7 +266,7 @@ export default {
},
uploadImage: async (req, res) => {
try {
const p = path.join(process.cwd(), "./print/Input/");
const p = path.join(process.cwd(), `./${getCurrentVersion()}/Input/`);
let fileName = uuid.v4() + ".png";
console.log(fileName);
......@@ -269,7 +281,10 @@ export default {
code: 200,
data: {
fileName,
url: path.join(process.cwd(), "./print/Input/" + fileName),
url: path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + fileName
),
},
});
}
......@@ -283,7 +298,7 @@ export default {
try {
const filePath = path.join(
process.cwd(),
`./print/Input/${req.body.fileName}`
`./${getCurrentVersion()}/Input/${req.body.fileName}`
);
console.log(filePath);
// 给客户端返回一个文件流 type类型
......@@ -318,7 +333,7 @@ export default {
toPrint: (req, res) => {
let body = req.body;
writeProfileXml(body); // 写入xml文件
// GTXproCMD.exe print -X "Profile\\CO12.xml" -I "Input\\sample.png" -A "Output\\pO12.arxp" -S 03000400 -L 02540254
// GTX6CMD.exe print -X "Profile\\CO12.xml" -I "Input\\sample.png" -A "Output\\pO12.arxp" -S 03000400 -L 02540254
console.log(249, body);
toSend(body)
......@@ -410,7 +425,7 @@ export default {
},
//删除图片
cleanDirectorySync: async (req, res) => {
let dirPath = path.join(process.cwd(), `./print/Input`);
let dirPath = path.join(process.cwd(), `./${getCurrentVersion()}/Input`);
if (!fs.existsSync(dirPath)) {
console.log(`目录不存在: ${dirPath}`);
res.json({ code: 500, msg: `目录不存在: ${dirPath}` });
......@@ -442,7 +457,7 @@ export default {
},
saveToPng: async (req, res) => {
try {
const p = path.join(process.cwd(), "./print/Input/");
const p = path.join(process.cwd(), `./${getCurrentVersion()}/Input/`);
const form = new multiparty.Form({ uploadDir: p });
form.parse(req, function(err, fields, files) {
console.log(367, fields, files, err);
......@@ -455,7 +470,10 @@ export default {
fs.renameSync(file.path, path.join(p, fileName));
list.push({
fileName,
url: path.join(process.cwd(), "./print/Input/" + fileName),
url: path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + fileName
),
});
});
res.json({
......
......@@ -6,6 +6,15 @@ var request = require("request");
var uuid = require("uuid");
const compressing = require("compressing");
const { getVersion } = require("@/server/utils/store");
function getCurrentVersion() {
const version = getVersion();
console.log("version", version);
return version;
}
function zip(from, to) {
return new Promise((resolve, reject) => {
let dirName = path.join(to, uuid.v4());
......@@ -49,7 +58,7 @@ export const downloadImage = (list) => {
return new Promise((resolve, reject) => {
try {
// console.log("Formatted Folder Name:", folderName); // 检查替换结果
let dirPath = path.join(process.cwd(), `./print/Input/`);
let dirPath = path.join(process.cwd(), `./${getCurrentVersion()}/Input/`);
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath);
......@@ -80,7 +89,10 @@ export const downloadImage = (list) => {
fileName = uuid.v4() + ".png";
type = 2;
}
let p = path.join(process.cwd(), "./print/Input/" + fileName);
let p = path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + fileName
);
let stream = fs.createWriteStream(p);
request(list[i].url)
.pipe(stream)
......@@ -141,7 +153,7 @@ export function downloadOtherImage(list) {
.split(".")[0];
let otherTypePath = path.join(
process.cwd(),
`./print/Input/${folderName}`
`./${getCurrentVersion()}/Input/${folderName}`
);
if (!fs.existsSync(otherTypePath)) {
fs.mkdirSync(otherTypePath);
......@@ -210,7 +222,10 @@ export function downloadOtherImage(list) {
// 传递素材给前端
export const sendImg = (filename = "sample.png") => {
let filePath = path.join(process.cwd(), "./print/Input/" + filename);
let filePath = path.join(
process.cwd(),
`./${getCurrentVersion()}/Input/` + filename
);
if (!fs.existsSync(filePath)) {
return false;
}
......@@ -220,18 +235,21 @@ export const sendImg = (filename = "sample.png") => {
};
export const toSend = (body) => {
console.log("999999999", path.join(process.cwd(), getCurrentVersion()));
return new Promise((resolve, reject) => {
exec(
body.cmd,
{ cwd: path.join(process.cwd(), "print"), shell: true },
(err, stdout, stderr) => {
{ cwd: path.join(process.cwd(), getCurrentVersion()), shell: true },
(err) => {
// console.log(stdout, 1);
// console.log(stderr, 2);
console.log("err", err);
if (!err) {
exec(
body.print_cmd,
{ cwd: path.join(process.cwd(), "print"), shell: true },
{ cwd: path.join(process.cwd(), getCurrentVersion()), shell: true },
(err2) => {
console.log(err2);
if (!err2) {
......@@ -240,7 +258,7 @@ export const toSend = (body) => {
fs.unlinkSync(
path.join(
process.cwd(),
"print/Profile/" +
`${getCurrentVersion()}/Profile/` +
body.fileName.replace(".png", "") +
".xml"
)
......@@ -248,7 +266,7 @@ export const toSend = (body) => {
fs.unlinkSync(
path.join(
process.cwd(),
"print/Output/" +
`${getCurrentVersion()}/Output/` +
body.fileName.replace(".png", "") +
".arxp"
)
......@@ -261,14 +279,14 @@ export const toSend = (body) => {
}
);
} else {
const errorCode = err.code || "UNKNOWN_ERROR";
const errorDetails = [
`生成命令失败: ${body.cmd}`,
`错误代码: ${errorCode}`,
`错误信息: ${err.message}`,
`标准错误输出: ${stderr}`,
].join("\n");
// const errorCode = err.code || "UNKNOWN_ERROR";
// const errorDetails = [
// `生成命令失败: ${body.cmd}`,
// `错误代码: ${errorCode}`,
// `错误信息: ${err.message}`,
// `标准错误输出: ${stderr}`,
// ].join("\n");
const errorDetails = "未匹配到对应版本的驱动,请检查驱动";
return reject(errorDetails);
}
}
......@@ -277,8 +295,13 @@ export const toSend = (body) => {
};
export const writeProfileXml = (b) => {
console.log(b);
try {
let p = path.join(process.cwd(), `./print/Profile/${b.byInk}.xml`);
let p = path.join(
process.cwd(),
`./${getCurrentVersion()}/Profile/${b.byInk}.xml`
);
let file = fs.readFileSync(p, { encoding: "utf8" });
file = file.replace(
/<uiCopies>(.*)<\/uiCopies>/i,
......@@ -376,11 +399,11 @@ export const writeProfileXml = (b) => {
fs.writeFileSync(
path.join(
process.cwd(),
`./print/Profile/${b.fileName.replace(".png", "")}.xml`
`./${getCurrentVersion()}/Profile/${b.fileName.replace(".png", "")}.xml`
),
file
);
} catch (err) {
console.log(err);
console.log(404, err);
}
};
const Store = require("electron-store");
const store = new Store();
module.exports = {
setVersion: (version) => {
store.set("desktoVersion", version);
console.log("store", store.get("desktoVersion"));
},
getVersion: () => store.get("desktoVersion") || "print",
};
......@@ -17,6 +17,7 @@ export default new Vuex.Store({
productDetail: {},
windowWH: { width: 0, height: 0 },
desktopDevice: 1, //1是兄弟,2是其他
desktoVersion: "print", //print2.0是2.0,print4.0是4.0
WHproportion: 1, //宽高比例
defaultProportion: 1,
isPreView: false,
......@@ -91,6 +92,9 @@ export default new Vuex.Store({
changeDesktopDevice(state, value) {
state.desktopDevice = value;
},
changeDesktoVersion(state, value) {
state.desktoVersion = value;
},
setProductDetail(state, value) {
state.productDetail = value;
},
......@@ -106,11 +110,25 @@ export default new Vuex.Store({
setGrid(state) {
// state.grid[0].h = h;
// state.grid[0].w = w;
console.log(state.WHproportion);
state.grid.forEach((el) => {
if (el.value == 0) {
el.h = 630 * (state.WHproportion - 0.3);
el.w = 480 * (state.WHproportion - 0.3);
console.log("16*21", state.WHproportion);
console.log("16*21..", state.defaultProportion);
let proportion = state.WHproportion;
if (state.defaultProportion == 1.5) {
proportion = 1.4;
} else if (state.defaultProportion == 1.7) {
proportion = 1.4;
}
el.h = 630 * proportion;
el.w = 480 * proportion;
} else if (el.value == 1) {
console.log("16*18", state.WHproportion);
console.log("16*18..", state.defaultProportion);
el.h = 540 * state.WHproportion;
el.w = 480 * state.WHproportion;
} else if (el.value == 2) {
......
<script>
import bus from "@/bus";
import PrintDialog from "./printDialog.vue";
// import PrintDialog from "./printDialog.vue";
import { ipcRenderer } from "electron";
// import { grid } from "../data";
import pkg from "../../../../package.json";
......@@ -12,9 +12,10 @@ import axios from "axios";
const uuid = require("uuid");
const fs = require("fs");
import { mapState } from "vuex";
const { getVersion } = require("@/server/utils/store");
export default {
components: { PrintDialog, UpdateDialog },
components: { UpdateDialog },
props: {
user: {
default: () => ({
......@@ -29,6 +30,7 @@ export default {
return {
checkList: [],
desktopDevice: 1,
desktoVersion: getVersion(),
checked: false,
isFirst: true,
cacheList: [
......@@ -101,6 +103,7 @@ export default {
});
},
created() {
localStorage.setItem("desktoVersion", "print");
if (this.$dataStore.get("setting")) {
this.setting = this.$dataStore.get("setting");
} else {
......@@ -413,6 +416,7 @@ export default {
console.error("清理目录时发生错误:", error.msg);
}
if (this.factoryType !== "US") {
if (this.factoryType !== "US") {
const regex = /^[A-Z]{4}_/; //是否以四个大写字母加下划线开头
if (regex.test(this.productionNo)) {
this.productionNo =
......@@ -524,11 +528,11 @@ export default {
if (i === 1) {
this.$store.commit("setWHproportion", this.defaultProportion - 0.3);
this.$store.commit("setGrid");
} else {
this.$store.commit("setWHproportion", this.defaultProportion);
this.$store.commit("setGrid");
}
this.$store.commit("setGrid");
this.selectGridIndex = i;
this.setting.gridValue = i;
......@@ -546,6 +550,12 @@ export default {
this.$store.commit("changeImgList", []);
console.log(347, store.state.desktopDevice);
},
changeDesktoVersionFn(value) {
console.log(553, value);
this.$store.commit("changeDesktoVersion", value);
ipcRenderer.send("update-version", value);
},
async cutImgFn(arr) {
if (!arr.length) return arr;
console.log(arr);
......@@ -677,6 +687,18 @@ export default {
<el-option label="其他" :value="2"></el-option>
</el-select>
</div>
<div class="selectInput">
<div>驱动版本:</div>
<el-select
v-model="desktoVersion"
@change="changeDesktoVersionFn"
placeholder="请选择版本"
>
<el-option label="2.0" value="print"></el-option>
<el-option label="4.0" value="print4.0"></el-option>
</el-select>
</div>
<el-dropdown trigger="click" @command="command" :hide-on-click="false">
<el-button style="height: 100%;margin-right: 0" size="small"
......@@ -700,6 +722,7 @@ export default {
:show-file-list="false"
multiple
:before-upload="uploadImage"
style="height: 100%;"
>
<el-button style="height: 100%;margin:0 8px" size="small">
<i class="el-icon-picture" style="font-size: 15px;"></i>
......@@ -1031,7 +1054,14 @@ export default {
::v-deep {
.el-select .el-input {
max-width: 150px;
max-width: 80px;
}
}
}
::v-deep {
.el-tooltip {
.el-upload--text {
height: 100%;
}
}
}
......
......@@ -249,7 +249,7 @@ export default {
});
},
moreImageCmd(arr) {
moreImageCmd() {
var canvas1 = document.createElement("canvas");
let _canvas = document.getElementsByClassName("sucaitu")[0]; //目标块
var bodyW = parseInt(window.getComputedStyle(_canvas).width);
......@@ -261,7 +261,7 @@ export default {
canvas1.style.background = "transparent";
document.documentElement.scrollTop = 0;
document.body.scrollTop = 0;
var context = canvas1.getContext("2d");
// var context = canvas1.getContext("2d");
// context.scale(2, 2);
let that = this;
html2canvas(_canvas, {
......@@ -423,6 +423,8 @@ export default {
};
await this.toWritePrintLog(data);
console.log("data", data);
let res = await this.$api.post("/toPrint", data);
this.$message.success(res.msg);
},
......
......@@ -50,6 +50,7 @@ export default {
this.$store.commit("setDefaultproportion", proportion);
this.$store.commit("setGrid");
});
if (!this.countryList.length) {
this.getAllCountryFn();
}
......@@ -67,6 +68,8 @@ export default {
w: this.grid[this.systemSetting.gridValue].w,
v: this.grid[this.systemSetting.gridValue].value,
h: this.grid[this.systemSetting.gridValue].h,
row: this.grid[this.systemSetting.gridValue].row,
col: this.grid[this.systemSetting.gridValue].col,
};
},
gridSpacing() {
......@@ -114,7 +117,7 @@ export default {
},
computedGridSize() {
const getter = this.systemSetting;
const num = getter.gridSpacing.slice(0, 2);
// const num = getter.gridSpacing.slice(0, 2);
return 10 + "px";
},
......@@ -141,6 +144,7 @@ export default {
"grid",
"windowWH",
"countryList",
"desktoVersion",
]),
},
data() {
......@@ -241,6 +245,16 @@ export default {
this.selectImgIndex = 0;
}
},
desktoVersion(newValue) {
if (newValue) {
this.imgList = [];
this.selectImgList = [];
this.selectIndex = -1;
this.selectImgIndex = 0;
this.detail = {};
}
},
productDetail(newValue) {
this.detail = { ...newValue };
if (typeof this.detail.imageAry == "string") {
......@@ -664,13 +678,17 @@ export default {
let data = await that.getImageSize(files[i].url);
rate = data.height / data.width;
console.log(679, rate);
if (rate > 1) {
height_px = bh * (9 / 10);
height_px = bh * (8 / 10);
// width_px = height_px / rate > bw ? bw : height_px / rate;
width_px = height_px / rate;
x = width_px / 2;
y = h;
} else {
width_px = bw * (2 / 3);
// height_px = width_px * rate > bh ? bh : width_px * rate;
height_px = width_px * rate;
x = w;
y = height_px / 2;
......@@ -705,7 +723,7 @@ export default {
addFile(file, callback) {
let that = this;
let bw = document.getElementById("line").clientWidth;
let bh = document.getElementById("line").clientHeight;
// let bh = document.getElementById("line").clientHeight;
that.$nextTick(() => {
that.getImageSize(file.url).then((data) => {
let w = document.getElementById("line").clientWidth / 2;
......@@ -1357,8 +1375,8 @@ export default {
<div
:class="{ 'no-border-grid': systemSetting.gridShow !== 1 }"
:style="{
width: 480 + 'px',
height: 540 + 'px',
width: gridWH.row * 30 + 'px',
height: gridWH.col * 30 + 'px',
}"
class="grid"
style="border-style:dashed"
......
......@@ -2,6 +2,7 @@
const { ipcRenderer } = require("electron");
import { mapState } from "vuex";
// 状态更新时发送
export default {
data() {
return {
......@@ -22,6 +23,7 @@ export default {
account: "",
password: "",
},
desktoVersion: "print",
};
},
computed: {
......
......@@ -104,6 +104,10 @@ module.exports = {
to: "../print",
},
{
from: "./print4.0/",
to: "../print4.0",
},
{
from: "./logs/",
to: "../logs",
},
......
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