Index.js 23 KB

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