Index.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. var refreshGirdData;
  2. var OneInTimebegin = '';
  3. var OneInTimeend = '';
  4. var ProductTimebegin = '';
  5. var ProductTimeend = '';
  6. var logbegin = '';
  7. var logend = '';
  8. var bootstrap = function ($, learun) {
  9. var psuid = "";
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  18. // 调用后台查询
  19. // queryJson 查询条件
  20. var oneintime = $('#lr_search_date_OneInTime').html();
  21. if (oneintime == '') {
  22. OneInTimebegin = '';
  23. OneInTimeend = '';
  24. }
  25. var producttime = $('#lr_search_date_ProductTime').html();
  26. if (producttime == '') {
  27. ProductTimebegin = '';
  28. ProductTimeend = '';
  29. }
  30. console.log(queryJson);
  31. queryJson["MatCode"] = $("#MatCode").val();
  32. queryJson["MatName"] = $("#MatName").val();
  33. queryJson["BoxBarCode"] = $("#BoxBarCode").val();
  34. queryJson["InvBarCode"] = $("#InvBarCode").val();
  35. queryJson["PutRow"] = $("#PutRow").val();
  36. queryJson["PutCol"] = $("#PutCol").val();
  37. queryJson["PutLayer"] = $("#PutLayer").val();
  38. queryJson["OneInTimeBegin"] = $("#OneInTimebegin").val();
  39. queryJson["OneInTimeEnd"] = $("#OneInTimeend").val();
  40. queryJson["ProductTimeBegin"] = $("#ProductTimebegin").val();
  41. queryJson["ProductTimeEnd"] = $("#ProductTimeend").val();
  42. queryJson["Grade"] = $("#Grade").val();
  43. queryJson["DoseNo"] = $("#DoseNo").val();
  44. queryJson["ContGrpType"] = $("#ContGrpType").lrselectGet();
  45. queryJson["InvStateCode"] = $("#InvStateCode").lrselectGet();
  46. queryJson["IsSurplus"] = $("#IsSurplus").lrselectGet();
  47. queryJson["IsRework"] = $("#IsRework").lrselectGet();
  48. queryJson["IsFast"] = $("#IsFast").lrselectGet();
  49. queryJson["IsFail"] = $("#IsFail").lrselectGet();
  50. queryJson["IsBlack"] = $("#IsBlack").lrselectGet();
  51. queryJson["ExecStateCode"] = $("#ExecStateCode").lrselectGet();
  52. queryJson["WbGroupCode"] = $("#WbGroupCode").val();
  53. queryJson["SolderCount"] = $("#SolderCount").val();
  54. queryJson["HoldTime"] = $("#HoldTime").val();
  55. queryJson["IsControlpanel"] = $("#IsControlpanel").lrselectGet();
  56. queryJson["IsTorsChk"] = $("#IsTorsChk").lrselectGet();
  57. queryJson["IsCore"] = $("#IsCore").lrselectGet();
  58. queryJson["TorsChkQty"] = $("#TorsChkQty").lrselectGet();
  59. queryJson["Wind"] = $("#Wind").val();
  60. page.search({ queryJson: JSON.stringify(queryJson) });
  61. }, 250);
  62. // 查询
  63. $('#btn_Search').on('click', function () {
  64. var keyword = $('#txt_Keyword').val();
  65. page.search({ queryJson: JSON.stringify({ keyword: keyword }) });
  66. });
  67. // 刷新
  68. $('#lr_refresh').on('click', function () {
  69. location.reload();
  70. });
  71. //$('#lr_pass').on('click', function () {
  72. // var postData = $('#gridtable').jfGridGet("rowdata");
  73. // if (postData.length == 0) {
  74. // learun.alert.error('未选择行!');
  75. // return false;
  76. // }
  77. // learun.layerConfirm('是否确认放行该箱号!', function (res) {
  78. // if (res) {
  79. // learun.postForm(top.$.rootUrl + '/SXManager/BillInvflowHistory/UpdatePassStates', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  80. // refreshGirdData();
  81. // });
  82. // }
  83. // });
  84. //});
  85. // 导出数据
  86. $('#lr_exportnow').on('click', function () {
  87. var subsuid = "";
  88. if (psuid == "") {
  89. psuid = $('#gridtable').attr('id');
  90. }
  91. else if (psuid != "") {
  92. var t = $('#' + psuid).attr('id');
  93. if (t == undefined)
  94. psuid = $('#gridtable').attr('id');
  95. }
  96. var mainGridId = $('#gridtable').attr('id');
  97. learun.layerForm({
  98. id: "ExcelExportForm",
  99. title: '导出Excel数据',
  100. url: top.$.rootUrl + '/Utility/ExcelExportForm?mainGridId=' + mainGridId + '&gridId=' + psuid + '&filename=' + encodeURI(encodeURI("库存")),
  101. width: 500,
  102. height: 380,
  103. callBack: function (id) {
  104. return top[id].acceptClick();
  105. },
  106. btn: ['导出Excel', '关闭']
  107. });
  108. });
  109. ////导出全部数据
  110. //$('#lr_exportall').on('click', function () {
  111. // var query = $('#multiple_condition_query').lrGetFormData();
  112. // query["Btime"] = logbegin;
  113. // query["Etime"] = logend;
  114. // query["keyword"] = $('#txt_Keyword').val();
  115. // var queryJson = JSON.stringify(query);
  116. // if ($('#jfgrid_head_' + psuid).length == 0) {
  117. // learun.alert.warning('请任意展开一行子表');
  118. // return false;
  119. // }
  120. // learun.layerForm({
  121. // id: "ExcelExportColumn",
  122. // title: '导出Excel数据',
  123. // url: top.$.rootUrl + '/Utility/ExcelExportColumn?gridId=' + $('#gridtable').attr('id') + '&subgridId=' + psuid,
  124. // width: 600,
  125. // height: 480,
  126. // callBack: function (id) {
  127. // return top[id].acceptClick(function (data) {
  128. // learun.download({
  129. // method: "POST",
  130. // url: top.$.rootUrl + '/TaskManager/EquipmentTask_Dis/ExportExcel',
  131. // param: {
  132. // fileName: encodeURI("WCS历史任务"),
  133. // queryJson: queryJson,
  134. // exportField: JSON.stringify(data)
  135. // }
  136. // });
  137. // });
  138. // },
  139. // btn: ['导出Excel', '关闭']
  140. // });
  141. //});
  142. //导出
  143. $('#lr_exportall').on('click', function () {
  144. //var where = $("#queryWhere").val();
  145. var query = $('#multiple_condition_query').lrGetFormData();
  146. query["MatCode"] = $("#MatCode").val();
  147. query["MatName"] = $("#MatName").val();
  148. query["BoxBarCode"] = $("#BoxBarCode").val();
  149. query["InvBarCode"] = $("#InvBarCode").val();
  150. query["PutRow"] = $("#PutRow").val();
  151. query["PutCol"] = $("#PutCol").val();
  152. query["PutLayer"] = $("#PutLayer").val();
  153. query["OneInTimeBegin"] = $("#OneInTimebegin").val();
  154. query["OneInTimeEnd"] = $("#OneInTimeend").val();
  155. query["ProductTimeBegin"] = $("#ProductTimebegin").val();
  156. query["ProductTimeEnd"] = $("#ProductTimeend").val();
  157. query["Grade"] = $("#Grade").val();
  158. query["DoseNo"] = $("#DoseNo").val();
  159. query["ContGrpType"] = $("#ContGrpType").lrselectGet();
  160. query["InvStateCode"] = $("#InvStateCode").lrselectGet();
  161. query["IsSurplus"] = $("#IsSurplus").lrselectGet();
  162. query["IsRework"] = $("#IsRework").lrselectGet();
  163. query["IsFast"] = $("#IsFast").lrselectGet();
  164. query["IsFail"] = $("#IsFail").lrselectGet();
  165. query["IsBlack"] = $("#IsBlack").lrselectGet();
  166. query["ExecStateCode"] = $("#ExecStateCode").lrselectGet();
  167. query["WbGroupCode"] = $("#WbGroupCode").val();
  168. query["SolderCount"] = $("#SolderCount").val();
  169. query["HoldTime"] = $("#HoldTime").val();
  170. query["IsControlpanel"] = $("#IsControlpanel").lrselectGet();
  171. query["IsTorsChk"] = $("#IsTorsChk").lrselectGet();
  172. query["IsCore"] = $("#IsCore").lrselectGet();
  173. query["TorsChkQty"] = $("#TorsChkQty").lrselectGet();
  174. query["Wind"] = $("#Wind").val();
  175. query["keyword"] = $('#txt_Keyword').val();
  176. var queryJson = JSON.stringify(query);
  177. learun.layerForm({
  178. id: "ExcelExportForm",
  179. title: '导出Excel数据',
  180. // url: top.$.rootUrl + '/Utility/ExcelExportForm?mainGridId=' + mainGridId + '&gridId=' + psuid + '&filename=' + encodeURI(encodeURI("库存")),
  181. url: top.$.rootUrl + '/Utility/ExcelExportColumn?gridId=' + $('#gridtable').attr('id') + '&subgridId=',
  182. width: 500,
  183. height: 380,
  184. callBack: function (id) {
  185. return top[id].acceptClick(function (data) {
  186. learun.download({
  187. method: "POST",
  188. url: '/SXManager/BillInvflowHistory/ExportExcel',
  189. param: {
  190. fileName: "导出流水历史报表",
  191. queryJson: queryJson,
  192. exportField: JSON.stringify(data)
  193. }
  194. });
  195. });
  196. },
  197. btn: ['导出Excel', '关闭']
  198. });
  199. });
  200. $('#OneInTime').lrdatetime({
  201. dfdata: [
  202. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  203. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  204. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  205. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  206. ],
  207. // 月
  208. mShow: false,
  209. premShow: false,
  210. // 季度
  211. jShow: false,
  212. prejShow: false,
  213. // 年
  214. ysShow: false,
  215. yxShow: false,
  216. preyShow: false,
  217. yShow: false,
  218. // 默认
  219. dfvalue: 'all',
  220. selectfn: function (begin, end) {
  221. OneInTimebegin = begin;
  222. OneInTimeend = end;
  223. }
  224. });
  225. $('#ProductTime').lrdatetime({
  226. dfdata: [
  227. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  228. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  229. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  230. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  231. ],
  232. // 月
  233. mShow: false,
  234. premShow: false,
  235. // 季度
  236. jShow: false,
  237. prejShow: false,
  238. // 年
  239. ysShow: false,
  240. yxShow: false,
  241. preyShow: false,
  242. yShow: false,
  243. // 默认
  244. dfvalue: 'all',
  245. selectfn: function (begin, end) {
  246. ProductTimebegin = begin;
  247. ProductTimeend = end;
  248. }
  249. });
  250. $('#ContGrpType').lrselect({
  251. url: top.$.rootUrl + '/SXManager/Enums/GetContGrpTypeList',
  252. maxHeight: 180,
  253. allowSearch: false
  254. });
  255. $('#InvStateCode').lrselect({
  256. url: top.$.rootUrl + '/SXManager/Enums/GetInvStateList',
  257. maxHeight: 180,
  258. allowSearch: false
  259. });
  260. $('#ExecStateCode').lrselect({
  261. url: top.$.rootUrl + '/SXManager/Enums/InvLockStateList',
  262. maxHeight: 60,
  263. allowSearch: false
  264. });
  265. $('#IsSurplus').lrselect({
  266. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  267. maxHeight: 60,
  268. allowSearch: false
  269. });
  270. $('#IsRework').lrselect({
  271. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  272. maxHeight: 60,
  273. allowSearch: false
  274. });
  275. $('#IsFast').lrselect({
  276. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  277. maxHeight: 60,
  278. allowSearch: false
  279. });
  280. $('#IsFail').lrselect({
  281. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  282. maxHeight: 60,
  283. allowSearch: false
  284. });
  285. $('#IsBlack').lrselect({
  286. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  287. maxHeight: 60,
  288. allowSearch: false
  289. });
  290. $('#IsControlpanel').lrselect({
  291. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  292. maxHeight: 60,
  293. allowSearch: false
  294. });
  295. $('#IsTorsChk').lrselect({
  296. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  297. maxHeight: 60,
  298. allowSearch: false
  299. });
  300. $('#IsCore').lrselect({
  301. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  302. maxHeight: 60,
  303. allowSearch: false
  304. });
  305. $('#IsTimeOut').lrselect({
  306. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  307. maxHeight: 60,
  308. allowSearch: false
  309. });
  310. $('#TorsChkQty').lrselect({
  311. url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
  312. maxHeight: 60,
  313. allowSearch: false
  314. });
  315. },
  316. // 初始化列表
  317. initGird: function () {
  318. $('#gridtable').jfGrid({
  319. url: top.$.rootUrl + '/SXManager/BillInvflowHistory/GetPageList',
  320. headData: [
  321. { label: "容器条码", name: "ContGrpBarCode", width: 130, align: "left" },
  322. {
  323. label: "库存类型", name: "ContGrpTypeName", width: 60, align: "left", sortname: "ContGrpType"
  324. },
  325. { label: "材料号", name: "InvBarCode", width: 110, align: "left" },
  326. { label: "库存状态", name: "InvStateName", width: 80, align: "left", sortname: "InvStateCode" },
  327. //{ label: "巷道", name: "Tunnel", width: 50, align: "left" },
  328. //{ label: "货位号", name: "Code", width: 100, align: "left" },
  329. //{
  330. // label: "货位状态", name: "CellState", width: 80, align: "left"
  331. // , formatter: function (cellvalue) {
  332. // if (cellvalue == 0) {
  333. // return '<span class=\"label label-success\" >启用</span>';
  334. // } else {
  335. // return '<span class=\"label label-default\" >禁用</span>';
  336. // }
  337. // }
  338. //},
  339. { label: "箱号", name: "BoxBarCode", width: 120, align: "left" },
  340. { label: "SKU", name: "SkuCode", width: 80, align: "left" },
  341. { label: "机台组", name: "WbGroupCode", width: 80, align: "left" },
  342. { label: "工字轮类型", name: "HWTypeCode", width: 90, align: "left" },
  343. { label: "焊点数量", name: "SolderCount", width: 90, align: "left" },
  344. { label: "静止时长", name: "HoldTime", width: 90, align: "left" },
  345. {
  346. label: "是否控制盘", name: "IsControlpanel", width: 90, align: "left", formatter: function (cellvalue) {
  347. if (cellvalue == true) {
  348. return '<span class=\"label label-success\" >是</span>';
  349. } else {
  350. return '<span class=\"label label-default\" >否</span>';
  351. }
  352. }
  353. },
  354. {
  355. label: "是否需要扭转", name: "IsTorsChk", width: 90, align: "left", formatter: function (cellvalue) {
  356. if (cellvalue == true) {
  357. return '<span class=\"label label-success\" >是</span>';
  358. } else {
  359. return '<span class=\"label label-default\" >否</span>';
  360. }
  361. } },
  362. {
  363. label: "是否芯股", name: "IsCore", width: 90, align: "left", formatter: function (cellvalue) {
  364. if (cellvalue == true) {
  365. return '<span class=\"label label-success\" >是</span>';
  366. } else {
  367. return '<span class=\"label label-default\" >否</span>';
  368. }
  369. } },
  370. { label: "预锁单号", name: "SalesDoc", width: 120, align: "left" },
  371. { label: "行", name: "PutRow", width: 40, align: "left" },
  372. { label: "列", name: "PutCol", width: 40, align: "left" },
  373. { label: "层", name: "PutLayer", width: 40, align: "left" },
  374. { label: "首次入库时间", name: "OneInTime", width: 130, align: "left" },
  375. learun.jfFormatter.col_DateTime("生产时间", "ProductTime"),
  376. { label: "物料编码", name: "MatCode", width: 110, align: "left" },
  377. { label: "物料名称", name: "MatName", width: 80, align: "left" },
  378. { label: "总重量", name: "TolWQty", width: 80, align: "left" },
  379. { label: "净重", name: "NetWQty", width: 80, align: "left" },
  380. { label: "皮重", name: "TareWQty", width: 80, align: "left" },
  381. { label: "长度", name: "LengthQty", width: 80, align: "left" },
  382. {
  383. label: "是否余料", name: "IsSurplus", width: 80, align: "left"
  384. , formatter: function (cellvalue) {
  385. if (cellvalue == true) {
  386. return '<span class=\"label label-success\" >是</span>';
  387. } else {
  388. return '<span class=\"label label-default\" >否</span>';
  389. }
  390. }
  391. },
  392. {
  393. label: "是否黑盘", name: "IsBlack", width: 80, align: "left"
  394. , formatter: function (cellvalue) {
  395. if (cellvalue == true) {
  396. return '<span class=\"label label-success\" >是</span>';
  397. } else {
  398. return '<span class=\"label label-default\" >否</span>';
  399. }
  400. }
  401. },
  402. {
  403. label: "返工标记", name: "IsRework", width: 80, align: "left", formatter: function (cellvalue) {
  404. if (cellvalue == true) {
  405. return '<span class=\"label label-success\" >是</span>';
  406. } else {
  407. return '<span class=\"label label-default\" >否</span>';
  408. }
  409. }
  410. },
  411. {
  412. label: "快投标记", name: "IsFast", width: 80, align: "left", formatter: function (cellvalue) {
  413. if (cellvalue == true) {
  414. return '<span class=\"label label-success\" >是</span>';
  415. } else {
  416. return '<span class=\"label label-default\" >否</span>';
  417. }
  418. }
  419. },
  420. {
  421. label: "是否异常", name: "IsFail", width: 80, align: "left", formatter: function (cellvalue) {
  422. if (cellvalue == true) {
  423. return '<span class=\"label label-success\" >是</span>';
  424. } else {
  425. return '<span class=\"label label-default\" >否</span>';
  426. }
  427. }
  428. },
  429. {
  430. label: "是否锁定", name: "ExecStateCode", width: 80, align: "left"
  431. , formatter: function (cellvalue) {
  432. if (cellvalue == "InvState_Normal") {
  433. return '<span class=\"label label-default\" >否</span>';
  434. } else {
  435. return '<span class=\"label label-success\" >是</span>';
  436. }
  437. }
  438. },
  439. {
  440. label: "是否已扭转", name: "TorsChkQty", width: 80, align: "left"
  441. , formatter: function (cellvalue) {
  442. if (cellvalue == true) {
  443. return '<span class=\"label label-success\" >是</span>';
  444. } else {
  445. return '<span class=\"label label-default\" >否</span>';
  446. }
  447. }
  448. },
  449. { label: "预锁库存", name: "PreStock", width: 120, align: "left" },
  450. { label: "绕向", name: "Wind", width: 120, align: "left" },
  451. { label: "异常原因", name: "FailReason", width: 80, align: "left" },
  452. { label: "等级", name: "Grade", width: 80, align: "left" },
  453. { label: "退料原因", name: "BackReason", width: 80, align: "left" },
  454. { label: "工序订单号", name: "ProcessDocsCode", width: 120, align: "left" },
  455. { label: "生产机台号", name: "ProductMachCode", width: 80, align: "left" },
  456. { label: "产线编号", name: "ProductLineNo", width: 80, align: "left" },
  457. { label: "入库单号", name: "InDocsNo", width: 120, align: "left" },
  458. { label: "入库单行号", name: "InDocsRowNo", width: 120, align: "left" },
  459. { label: "扭转检测弓高", name: "TorsChkChord", width: 80, align: "left" },
  460. { label: "弓高是否合格", name: "TorsChkChordIsGood", width: 80, align: "left" },
  461. { label: "扭转检测平直度", name: "TorsChkFlatness", width: 80, align: "left" },
  462. { label: "平直度是否合格", name: "TorsChkFlatnessIsGood", width: 80, align: "left" },
  463. { label: "扭转机台工位", name: "TorsChkStation", width: 80, align: "left" },
  464. { label: "扭转值是否合格", name: "TorsChkValueIsGood", width: 80, align: "left" },
  465. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  466. { label: "更新时间", name: "EditTime", width: 130, align: "left" },
  467. ],
  468. mainId: 'Id',
  469. isPage: true,
  470. reloadSelected: true,
  471. autowWidth: true,
  472. sidx: 'AddTime',
  473. sord: 'DESC',
  474. });
  475. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  476. },
  477. search: function (param) {
  478. $('#gridtable').jfGridSet('reload', param);
  479. }
  480. };
  481. refreshGirdData = function () {
  482. $('#gridtable').jfGridSet('reload');
  483. };
  484. page.init();
  485. }