BusCutplanHead.js
8.14 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
let action = null;
layui.config({
base: "/js/",
version: 1
}).use(['system'], function () {
var form = layui.form,
$ = layui.jquery,
element = layui.element,
table = layui.table,
system = layui.system,
sysU = new system.u(),
sendData = null,
areaName = "Material",
controllerName = "BusCutplanHead",
app = null;
action = {
queryOptions: function () {
var options = {
resetFrom: "form[lay-filter=listForm]",
fromId: "listForm",
urlExport: `/${areaName}/${controllerName}/Export`,
urlQuery: `/${areaName}/${controllerName}/Load`,
mainTable: app.data.tableIns
}
return options;
},
uploadOptions: function () {
var options = {
url: `/${areaName}/${tableName}/Import`
}
return options;
},
rowClickOptions: function () {
var options = {
isDefault: true,
targetTableId: app.data.tableElem,
tabfilter: "tableTabBody",
tabId: 2,
customFn: app.methods.initTableDesc
}
return options;
},
//手动完成切割方案
CompleteExecute: function (sysU, toolbarId, obj) {
var checkStatus = table.checkStatus(toolbarId);
if (checkStatus.data.length != 1) {
layer.alert(sysU.config.titleSelectOne, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleSelectOneRowData });
return;
}
layer.confirm('确定手动完成方案么?', { icon: 3, title: '提示' }, function (index) {
var ajaxConfig = {
data: { ID: checkStatus.data[0].id },
url: `/${areaName}/${controllerName}/CompleteExecute`,
success: function (result) {
if (sysU.successBefore(result)) return;
layer.msg(result.Message, { icon: sysU.config.iconoOk, shade: 0.4, time: 1000 });
action.actionSuccess(app.data.tableElem, app.data.tableIns.config.page.curr);
}
};
sysU.ajax(ajaxConfig);
});
},
//取消方案
CancelPlan: function (sysU, toolbarId, obj) {
var checkStatus = table.checkStatus(toolbarId);
if (checkStatus.data.length != 1) {
layer.alert(sysU.config.titleSelectOne, { icon: sysU.config.iconoError, shadeClose: true, title: sysU.config.titleSelectOneRowData });
return;
}
layer.confirm('确定取消方案么?', { icon: 3, title: '提示' }, function (index) {
var ajaxConfig = {
data: { ID: checkStatus.data[0].id },
url: `/${areaName}/${controllerName}/CancelPlan`,
success: function (result) {
if (sysU.successBefore(result)) return;
layer.msg(result.Message, { icon: sysU.config.iconoOk, shade: 0.4, time: 1000 });
action.actionSuccess(app.data.tableElem, app.data.tableIns.config.page.curr);
}
};
sysU.ajax(ajaxConfig);
});
},
//所有动作成功之后
actionSuccess: (falg) => {
app.methods.initTable();
}
}
app = {
data: {
cols: [[
{ checkbox: true, fixed: true },
{ field: "id", width: 80, hide: true, title: "Id" },
{ field: "keys", width: 80, hide: true, title: "Keys" },
{ field: "lotNo", width: 150, title: "管材SN" },
{ field: "materialCode", width: 150, title: "物料编码" },
{ field: "pipeLength", width: 150, title: "管材长度" },
{ field: "lossCount", width: 150, title: "总利用率", templet: function (obj) { return obj.lossCount > 0 ? (obj.lossCount * 100).toFixed(2) + "%" : "" } },
{ field: "oddmentsCode", width: 150, title: "余料编码" },
{ field: "oddmentsLength", width: 150, title: "余料长度" },
//{ field: "lineCode", width: 150, title: "线体" },
{ field: "planStartTime", width: 150, title: "计划生产日期" },
{ field: "level", width: 150, title: "生产优先级" },
{ field: "state", width: 150, title: "生产状态", templet: (d) => { return "".GetState(window.top.EnumCutPlanHeadStatus, d.state) } },
{ field: "actualStartTime", width: 150, title: "生产实际开始时间" },
{ field: "actualEndTime", width: 150, title: "生产实际完成时间" },
{ field: "dischargeStartTime", width: 150, title: "下料开始时间" },
{ field: "dischargeEndTime", width: 150, title: "下料完成时间" },
{ field: "cutStartTime", width: 150, title: "切割开始时间" },
{ field: "cutEndTime", width: 150, title: "切割完成时间" },
{ field: "createTime", width: 150, title: "套料时间" },
{ field: "createBy", width: 150, title: "套料人员" },
]],
colsDesc: [[
{ field: "id", width: 80, hide: true, title: "Id" },
{ field: "bodyKeys", width: 150, hide: true, title: "bodyKeys" },
{ field: "headKeys", width: 150, hide: true, title: "headkey" },
{ field: "iwpNo", width: 150, title: "工单号" },
{ field: "barCode", width: 150, title: "追踪码" },
{ field: "isendproduct", width: 150, title: "是否成品管", templet: function (obj) { return obj.isendproduct == 0 ? "否" : "是" } },
{ field: "cuttingLength", width: 150, title: "切割长度" },
//{ field: "cutFlanConfig", width: 150, title: "切割余量" },
{ field: "cutState", width: 150, title: "生产状态", templet: function (d) { return "".GetState(window.top.EnumCutPlanDetailStatus, d.cutState) } },
{ field: "cutStartTime", width: 150, title: "切割开始时间" },
{ field: "cutEndTime", width: 150, title: "切割完成时间" },
{ field: "cutLevel", width: 150, title: "切割优先级" }
]],
tableIns: null,
tableIns: null,
tableInsDesc: null,
tableElem: "mainList",
tableElemDesc: "mainListDesc",
},
methods: {
initTable: function (opt) {
var config = {};
if (opt != undefined) $.extend(config, opt);
let options = {
elem: "#" + app.data.tableElem,
url: `/${areaName}/${controllerName}/Load`,
cols: sysU.columnRecord(app.data.tableElem, app.data.cols),
toolbar: '#toolbarTable',
where: config,
doneExtend: function (res, obj) {
}
}
app.data.tableIns = sysU.initTable(options);
},
initTableDesc: function (obj) {
sendData = { keys: obj.data.keys }
let opt = {
cols: sysU.columnRecord(app.data.tableElemDesc, app.data.colsDesc),
elem: "#" + app.data.tableElemDesc,
url: `/${areaName}/${controllerName}/LoadDesc`,
height: 'full-55',
toolbar: '#toolbarTableDesc',
limit: 0,
page: false,
where: sendData
}
app.data.tableInsDesc = sysU.initTable(opt);
},
initFrom() {
}
},
registerEvent: function () {
},
init: function () {
app.methods.initTable();
app.methods.initFrom();
app.registerEvent();
}
};
app.init();
});