Index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. var refreshGirdData;
  2. var logbegin = '';
  3. var logend = '';
  4. var StartTimeBegin = '';
  5. var StartTimeend = '';
  6. var EndTimeBegin = '';
  7. var EndTimeend = '';
  8. var selectRowsData;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var psuid = "";
  12. var page = {
  13. init: function () {
  14. page.initGird();
  15. page.bind();
  16. page.search({ queryJson: JSON.stringify({ Finish: 0 }) });
  17. },
  18. bind: function () {
  19. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  20. // 调用后台查询
  21. // queryJson 查询条件
  22. var date = $('#lr_search_date_datesearch').html();
  23. if (date == '') {
  24. logbegin = '';
  25. logend = '';
  26. }
  27. var starttime = $('#lr_search_date_StartTime').html();
  28. if (starttime == '') {
  29. StartTimeBegin = '';
  30. StartTimeend = '';
  31. }
  32. var endtime = $('#lr_search_date_EndTime').html();
  33. if (endtime == '') {
  34. EndTimeBegin = '';
  35. EndTimeend = '';
  36. }
  37. //queryJson["AddTimeFrom"] = logbegin;
  38. //queryJson["AddTimeTo"] = logend;
  39. queryJson["WarehouseCode"] = $("#WarehouseCode").lrselectGet();
  40. queryJson["TaskId"] = $("#TaskId").val();
  41. queryJson["Code"] = $("#Code").val();
  42. queryJson["ProMaterCode"] = $("#ProMaterCode").val();
  43. queryJson["PalletizingStation"] = $("#PalletizingStation").val();
  44. queryJson["MatCodeList"] = $("#MatCodeList").val();
  45. queryJson["Finish"] = $("#Finish").lrselectGet();
  46. queryJson["PalleCode"] = $("#PalleCode").val();
  47. queryJson["AddTimeFrom"] = $("#AddTimeFrom").val();
  48. queryJson["AddTimeTo"] = $("#AddTimeTo").val();
  49. page.search({ queryJson: JSON.stringify(queryJson) });
  50. }, 250);
  51. // 查询
  52. $('#btn_Search').on('click', function () {
  53. var keyword = $('#txt_Keyword').val();
  54. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  55. });
  56. // 刷新
  57. $('#lr_refresh').on('click', function () {
  58. location.reload();
  59. });
  60. // 删除
  61. $('#lr_Finish').on('click', function () {
  62. selectRowsData = $('#gridtable').jfGridGet("rowdata");
  63. if (selectRowsData.length == 0) {
  64. learun.alert.error('未选择行!');
  65. return false;
  66. }
  67. learun.layerForm({
  68. id: 'form1',
  69. title: '修改是否结束',
  70. url: top.$.rootUrl + '/FJManager/WCSPalletizing/Form',
  71. width: 700,
  72. height: 300,
  73. callBack: function (id) {
  74. return top[id].acceptClick(refreshGirdData);
  75. }
  76. });
  77. });
  78. $('#lr_PalleCode').on('click', function () {
  79. selectRowsData = $('#gridtable').jfGridGet("rowdata");
  80. if (selectRowsData.length == 0) {
  81. learun.alert.error('未选择行!');
  82. return false;
  83. }
  84. learun.layerForm({
  85. id: 'form1',
  86. title: '修改托盘条码',
  87. url: top.$.rootUrl + '/FJManager/WCSPalletizing/PalleCodeForm',
  88. width: 700,
  89. height: 300,
  90. callBack: function (id) {
  91. return top[id].acceptClick(refreshGirdData);
  92. }
  93. });
  94. });
  95. $('#lr_PalletizingStation').on('click', function () {
  96. var postData = $('#gridtable').jfGridGet("rowdata");
  97. if (postData.length == 0) {
  98. learun.alert.error('未选择行!');
  99. return false;
  100. }
  101. learun.layerConfirm('是否确认重新分配码垛位!', function (res) {
  102. if (res) {
  103. learun.postForm(top.$.rootUrl + '/FJManager/WCSPalletizing/PalletizingStation', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  104. refreshGirdData();
  105. top.layer.close(top.layer.index);
  106. });
  107. }
  108. });
  109. });
  110. $('.datetime').each(function () {
  111. $(this).lrdatetime({
  112. dfdata: [
  113. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  114. { 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') } },
  115. { 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') } },
  116. { 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') } },
  117. ],
  118. // 月
  119. mShow: false,
  120. premShow: false,
  121. // 季度
  122. jShow: false,
  123. prejShow: false,
  124. // 年
  125. ysShow: false,
  126. yxShow: false,
  127. preyShow: false,
  128. yShow: false,
  129. // 默认
  130. dfvalue: 'all',
  131. selectfn: function (begin, end) {
  132. let id = $(this).attr('id');
  133. if (id == 'datesearch') {
  134. logbegin = begin;
  135. logend = end;
  136. }
  137. else if (id == 'StartTime') {
  138. StartTimeBegin = begin;
  139. StartTimeend = end;
  140. }
  141. else if (id == 'EndTime') {
  142. EndTimeBegin = begin;
  143. EndTimeend = end;
  144. }
  145. }
  146. });
  147. });
  148. $('#WarehouseCode').lrselect({
  149. url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetSelectWarehouseCodeNameList',
  150. maxHeight: 180,
  151. allowSearch: false
  152. });
  153. $('#Finish').lrselect({
  154. url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
  155. maxHeight: 60,
  156. allowSearch: false
  157. });
  158. },
  159. // 初始化列表
  160. initGird: function () {
  161. $('#gridtable').jfGrid({
  162. url: top.$.rootUrl + '/FJManager/WCSPalletizing/GetPageList',
  163. headData: [
  164. { label: 'Id', name: 'Id', width: 100, align: 'left' },
  165. { label: '任务Id', name: 'TaskId', width: 100, align: 'left' },
  166. { label: '托盘条码', name: 'PalleCode', width: 80, align: 'left' },
  167. { label: '垛型编码', name: 'Code', width: 110, align: 'left' },
  168. { label: '短垛型编码', name: 'ShortCode', width: 60, align: 'left' },
  169. { label: '帘线物料编码', name: 'ProMaterCode', width: 150, align: 'left' },
  170. { label: '码垛工位', name: 'PalletizingStation', width: 80, align: 'left' },
  171. { label: '产品总数', name: 'CountQty', width: 60, align: 'left' },
  172. { label: '托盘类型', name: 'TpTypeCode', width: 100, align: 'left' },
  173. { label: '层数', name: 'LayerCountQty', width: 60, align: 'left' },
  174. {
  175. label: '是否结束', name: 'Finish', width: 100, align: 'left', formatter: function (cellvalue) {
  176. if (cellvalue == true) {
  177. return '<span class=\"label label-success\" >是</span>';
  178. } else {
  179. return '<span class=\"label label-default\" >否</span>';
  180. }
  181. }
  182. },
  183. { label: '物料号', name: 'MatCodeList', width: 100, align: 'left' },
  184. { label: '仓库名称', name: 'WarehouseName', width: 100, align: 'left', sortname: 'WarehouseCode' },
  185. { label: '设备编号', name: 'DeviceCode', width: 100, align: 'left' },
  186. {
  187. label: '是否二次绑盘', name: 'isItHalf', width: 100, align: 'left', formatter: function (cellvalue) {
  188. if (cellvalue == true) {
  189. return '<span class=\"label label-success\" >是</span>';
  190. } else {
  191. return '<span class=\"label label-default\" >否</span>';
  192. }
  193. }
  194. },
  195. { label: '任务下一地址', name: 'TaskAddNext', width: 100, align: 'left' },
  196. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  197. { label: "更新时间", name: "EditTime", width: 130, align: "left" },
  198. ],
  199. mainId: 'Id',
  200. isMultiselect: true,
  201. isPage: true,
  202. reloadSelected: true,
  203. sidx: 'AddTime',
  204. sord: 'DESC',
  205. isSubGrid: true, // 是否有子表
  206. subGridExpanded: function (subid, rowdata) {
  207. psuid = subid;
  208. $('#' + subid).jfGrid({
  209. url: top.$.rootUrl + '/FJManager/WCSPalletizing/GetPalletizingItem',
  210. headData: [
  211. { label: '层号', name: 'LayerNo', width: 60, align: 'left' },
  212. {
  213. label: '层是否空置', name: 'IsEmpty', width: 100, align: 'left', formatter: function (cellvalue) {
  214. if (cellvalue == true) {
  215. return '<span class=\"label label-success\" >是</span>';
  216. } else {
  217. return '<span class=\"label label-default\" >否</span>';
  218. }
  219. }
  220. },
  221. { label: '行数', name: 'RowCountQty', width: 60, align: 'left' },
  222. { label: '物料号', name: 'MatCodeList', width: 150, align: 'left' },
  223. {
  224. label: '是否结束', name: 'Finish', width: 80, align: 'left', formatter: function (cellvalue) {
  225. if (cellvalue == true) {
  226. return '<span class=\"label label-success\" >是</span>';
  227. } else {
  228. return '<span class=\"label label-default\" >否</span>';
  229. }
  230. }
  231. },
  232. {
  233. label: '行是否空置', name: 'RowsIsEmpty', width: 100, align: 'left', formatter: function (cellvalue) {
  234. if (cellvalue == true) {
  235. return '<span class=\"label label-success\" >是</span>';
  236. } else {
  237. return '<span class=\"label label-default\" >否</span>';
  238. }
  239. } },
  240. { label: '数量上限', name: 'QtyMaxCount', width: 60, align: 'left' },
  241. { label: '行号', name: 'RowNo', width: 60, align: 'left' },
  242. { label: '是否混合料行', name: 'IsMixRow', width: 100, align: 'left' },
  243. { label: '缓存Id', name: 'CacheLineId', width: 100, align: 'left' },
  244. /* { label: '当前所有的物料号', name: 'MatCodeList', width: 100, align: 'left' },*/
  245. {
  246. label: '是否结束', name: 'RowsFinish', width: 100, align: 'left', formatter: function (cellvalue) {
  247. if (cellvalue == true) {
  248. return '<span class=\"label label-success\" >是</span>';
  249. } else {
  250. return '<span class=\"label label-default\" >否</span>';
  251. }
  252. }
  253. },
  254. { label: '取货线体号', name: 'LineCode', width: 100, align: 'left' },
  255. { label: '任务Id', name: 'TaskId', width: 100, align: 'left' },
  256. {
  257. label: '列是否空置', name: 'ColsIsEmpty', width: 100, align: 'left', formatter: function (cellvalue) {
  258. if (cellvalue == true) {
  259. return '<span class=\"label label-success\" >是</span>';
  260. } else {
  261. return '<span class=\"label label-default\" >否</span>';
  262. }
  263. }
  264. },
  265. { label: '坐标号', name: 'XYNo', width: 100, align: 'left' },
  266. { label: '所属设备号', name: 'DevCode', width: 100, align: 'left' },
  267. { label: '物料编码', name: 'MatCode', width: 100, align: 'left' },
  268. { label: '正反面', name: 'SideNum', width: 100, align: 'left' },
  269. { label: '工字轮类型', name: 'SpoolType', width: 100, align: 'left' },
  270. {
  271. label: '是否结束', name: 'ColsFinish', width: 100, align: 'left', formatter: function (cellvalue) {
  272. if (cellvalue == true) {
  273. return '<span class=\"label label-success\" >是</span>';
  274. } else {
  275. return '<span class=\"label label-default\" >否</span>';
  276. }
  277. }
  278. },
  279. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  280. { label: "更新时间", name: "EditTime", width: 130, align: "left" },
  281. ]
  282. });
  283. $('#' + subid).jfGridSet('reloadSon', { palletizingId: rowdata.Id });
  284. },
  285. });
  286. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  287. },
  288. search: function (param) {
  289. $('#gridtable').jfGridSet('reload', param);
  290. }
  291. };
  292. refreshGirdData = function () {
  293. $('#gridtable').jfGridSet('reload');
  294. };
  295. page.init();
  296. }