Index.js 26 KB

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