1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
NAME:
DESCRIPTION: ;
PARAMETER:
[
{
name : 'path',
title : '资料路径',
type : 'LineEdit',
property : {tool_tip : '资料路径,必填'},
},
{
name : 'db',
title : '料号db',
type : 'LineEdit',
property : {tool_tip : '料号db,默认是genesis'},
},
{
name : 'config_path',
title : '配置地址',
type : 'LineEdit',
property : {tool_tip : '配置的路径'},
}
]
VERSION_HISTORY:
V1.00 2020-04-20 Scott Sun
1.新版本
HELP:
<html><body bgcolor="#DDECFE">
<font size="3" color="#003DB2"><p>功能简介</p></font>
<p> 客户数据导入 </p>
<br>
<font size="3" color="#003DB2"><p>参数配置</p></font>
<p> 料号 和 客户配置 </p>
<br>
<font size="3" color="#003DB2"><p>注意事项</p></font>
<p> 无 </p>
<br>
</body></html>
*/
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// 引入模块 包
console.log("=============================================>input_start");
console.log("=============================================>input_start");
console.log("=============================================>input_start");
console.log("=============================================>input_start");
var $ = require('topcam.scriptfunc').argv();
var fs = require('fs');
var _ = require('lodash');
var zip = require('topsin.zip');
var mode = $.ikm ? "topcam" : "aimdfm";
var IKM = $.ikm;
if (IKM==undefined ) { IKM = require('topcam.ikm6')($) }
var GEN = $.gen;
var GUI = $.gui || {};
var Job = $.job || $.job_name;
var JobId = $.job_id;
var db = $.db || IKM.db
var PAR = {}
if ($.par) {
PAR = $.par
} else if ($.hasOwnProperty('script_parameter')){
PAR = JSON.parse($.script_parameter);
}
if (mode === "aimdfm") {
var database = require("topsin.database");
database.addConnection($.conf.database_conf, "DFM");
var QDfm = database.query("DFM");
$.QDfm = QDfm;
if ($.conf.product_type == "aimdfm") {
QDfm.updateRow({
table: "pdm_aimdfm_task",
data: {
current_process_title: $.process_title,
progress: 0
},
where: { id: $.task_id }
});
}
}
var Status = 'ok';
var resultData = [];
try {
GEN.COM("open_job,job="+job+",open_win=no,disk_map=,job_map=")
GEN.AUX("set_group,group=99")
GEN.COM("close_job,job="+job+"")
GEN.COM("disp_on")
GEN.COM("origin_on")
GEN.COM("disp_on")
GEN.COM("origin_on")
GEN.COM("checkin_closed_job,job="+job)
if (mode === "aimdfm") {
$.QDfm.updateRow({
table: "pdm_aimdfm_task",
data: {
progress: 30
},
where: { id: $.task_id }
});
if (GEN.hasError()) {
Status = 'error';
resultData.push({ type: "error", title: "GEN错误!", detail: [{ desc: _.join(GEN.STATUS, "\n") }] });
return {
status: Status,
result_data: resultData
};
} else {
resultData.push({ type: "info", title: "操作完成, 请注意检查!" });
return {
status: Status,
result_data: resultData
};
}
}else {
return "Done"
}
}
catch (e) {
IKM.msg(_.join(GEN.STATUS, "\n"))
IKM.msg(e)
Status = 'error';
resultData.push({type: "error", title: "脚本执行出错!", detail: [{desc: _.toString(e)}]});
return (mode === "aimdfm") ? {status: Status, result_data: resultData} : "Error";
}