Index.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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 selectedRow;
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var psuid = "";
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. page.search({ queryJson: JSON.stringify({Out:0}) });
  18. },
  19. bind: function () {
  20. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  21. // 调用后台查询
  22. // queryJson 查询条件
  23. var date = $('#lr_search_date_datesearch').html();
  24. if (date == '') {
  25. logbegin = '';
  26. logend = '';
  27. }
  28. var starttime = $('#lr_search_date_StartTime').html();
  29. if (starttime == '') {
  30. StartTimeBegin = '';
  31. StartTimeend = '';
  32. }
  33. var endtime = $('#lr_search_date_EndTime').html();
  34. if (endtime == '') {
  35. EndTimeBegin = '';
  36. EndTimeend = '';
  37. }
  38. //queryJson["AddTimeFrom"] = logbegin;
  39. //queryJson["AddTimeTo"] = logend;
  40. queryJson["WareHouseId"] = $("#WareHouseId").lrselectGet();
  41. queryJson["BomCode"] = $("#BomCode").val();
  42. queryJson["BomSetGrpName"] = $("#BomSetGrpName").val();
  43. queryJson["Out"] = $("#Out").lrselectGet();
  44. queryJson["AddTimeFrom"] = $("#AddTimeFrom").val();
  45. queryJson["AddTimeTo"] = $("#AddTimeTo").val();
  46. queryJson["Id"] = $("#Id").val();
  47. page.search({ queryJson: JSON.stringify(queryJson) });
  48. }, 250);
  49. // 查询
  50. $('#btn_Search').on('click', function () {
  51. var keyword = $('#txt_Keyword').val();
  52. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  53. });
  54. // 刷新
  55. $('#lr_refresh').on('click', function () {
  56. location.reload();
  57. });
  58. $('.datetime').each(function () {
  59. $(this).lrdatetime({
  60. dfdata: [
  61. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  62. { 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') } },
  63. { 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') } },
  64. { 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') } },
  65. ],
  66. // 月
  67. mShow: false,
  68. premShow: false,
  69. // 季度
  70. jShow: false,
  71. prejShow: false,
  72. // 年
  73. ysShow: false,
  74. yxShow: false,
  75. preyShow: false,
  76. yShow: false,
  77. // 默认
  78. dfvalue: 'all',
  79. selectfn: function (begin, end) {
  80. let id = $(this).attr('id');
  81. if (id == 'datesearch') {
  82. logbegin = begin;
  83. logend = end;
  84. }
  85. else if (id == 'StartTime') {
  86. StartTimeBegin = begin;
  87. StartTimeend = end;
  88. }
  89. else if (id == 'EndTime') {
  90. EndTimeBegin = begin;
  91. EndTimeend = end;
  92. }
  93. }
  94. });
  95. });
  96. $('#WareHouseId').lrselect({
  97. url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetSelectWarehouseNameList',
  98. maxHeight: 180,
  99. allowSearch: false
  100. });
  101. $('#Out').lrselect({
  102. url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
  103. maxHeight: 60,
  104. allowSearch: false
  105. });
  106. $('#lr_Out').on('click', function () {
  107. selectRowsData = $('#gridtable').jfGridGet("rowdata");
  108. if (selectRowsData.length == 0) {
  109. learun.alert.error('未选择行!');
  110. return false;
  111. }
  112. learun.layerForm({
  113. id: 'form',
  114. title: '是否已出库',
  115. url: top.$.rootUrl + '/FJManager/BillRingpalletizing/Form',
  116. width: 450,
  117. height: 300,
  118. callBack: function (id) {
  119. return top[id].acceptClick(refreshGirdData);
  120. }
  121. });
  122. });
  123. $('#lr_HaveQty').on('click', function () {
  124. selectRowsData = $('#gridtable').jfGridGet("rowdata");
  125. var keyValue = $('#gridtable').jfGridValue('Id');
  126. if (selectRowsData.length == 0) {
  127. learun.alert.error('未选择行!');
  128. return false;
  129. }
  130. if (selectRowsData.length >1) {
  131. learun.alert.error('不能多选,请选择一条数据!');
  132. return false;
  133. }
  134. selectedRow = selectRowsData[0];
  135. if (learun.checkrow(keyValue)) {
  136. learun.layerForm({
  137. id: 'form',
  138. title: '修改已有个数',
  139. url: top.$.rootUrl + '/FJManager/BillRingpalletizing/Form2?keyValue=' + keyValue,
  140. width: 450,
  141. height: 300,
  142. callBack: function (id) {
  143. return top[id].acceptClick(refreshGirdData);
  144. }
  145. });
  146. }
  147. });
  148. $('#lr_OvertimeOut').on('click', function () {
  149. var postData = $('#gridtable').jfGridGet("rowdata");
  150. if (postData.length == 0) {
  151. learun.alert.error('未选择行!');
  152. return false;
  153. }
  154. learun.layerConfirm('是否确认超时出库!', function (res) {
  155. if (res) {
  156. learun.postForm(top.$.rootUrl + '/FJManager/BillRingpalletizing/UpdateOvertimeOut', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  157. refreshGirdData();
  158. });
  159. }
  160. });
  161. });
  162. },
  163. // 初始化列表
  164. initGird: function () {
  165. $('#gridtable').jfGrid({
  166. url: top.$.rootUrl + '/FJManager/BillRingpalletizing/GetPageList',
  167. headData: [
  168. { label: 'ID编号', name: 'Id', width: 160 },
  169. { label: '仓库', name: 'WarehouseName', width: 120, align: 'left', sortname:'WareHouseId' },
  170. { label: '垛形编号', name: 'BomSetGrpCode', width: 100, align: 'left' },
  171. { label: '垛形名', name: 'BomSetGrpName', width: 100, align: 'left' },
  172. { label: '工字轮个数', name: 'HWCountQty', width: 100, align: 'left' },
  173. { label: '投料信息', name: 'BomCode', width: 100, align: 'left' },
  174. { label: '已有工字轮个数', name: 'HaveQty', width: 100, align: 'left' },
  175. { label: '上一次放置位', name: 'LastXYNO', width: 100, align: 'left' },
  176. {
  177. label: '是否出库', name: 'Out', width: 100, align: 'left', formatter: function (cellvalue) {
  178. if (cellvalue == true) {
  179. return '<span class=\"label label-success\" >是</span>';
  180. } else {
  181. return '<span class=\"label label-default\" >否</span>';
  182. }
  183. }
  184. },
  185. { label: '备注', name: 'Memo', width: 100, align: 'left' },
  186. { label: '创建用户', name: 'AddWho', width: 100, align: 'left' },
  187. { label: '更新用户', name: 'EditWho', width: 100, align: 'left' },
  188. { label: '创建时间', name: 'AddTime', width: 130, align: 'left' },
  189. { label: '更新时间', name: 'EditTime', width: 130, align: 'left' },
  190. ],
  191. mainId: 'Id',
  192. isPage: true,
  193. reloadSelected: true,
  194. autowWidth: true,
  195. sidx: 'AddTime',
  196. sord: 'DESC',
  197. isMultiselect: true,
  198. isSubGrid: true, // 是否有子表
  199. subGridExpanded: function (subid, rowdata) {
  200. psuid = subid;
  201. $('#' + subid).jfGrid({
  202. url: top.$.rootUrl + '/FJManager/BaseWareCell/GetListsByGroupID',
  203. headData: [
  204. { label: "仓库", name: "WarehouseName", width: 120, align: "left" },
  205. { label: "货位号", name: "Code", width: 100, align: "left" },
  206. { label: "货位名称", name: "Name", width: 120, align: "left" },
  207. { label: "货位状态", name: "StatusName", width: 90, align: "left", sortname: "StateNum" },
  208. { label: "货位类型", name: "TypeName", width: 70, align: "left", sortname: "TypeNum" },
  209. {
  210. label: "是否停用", name: "IsStop", width: 70, align: "left", formatter: function (cellvalue) {
  211. if (cellvalue == 0) {
  212. return '<span class=\"label label-success\" >正常</span>';
  213. } else if (cellvalue == 1) {
  214. return '<span class=\"label label-default\" >停用</span>';
  215. } else {
  216. return '<span class=\"label label-default\" >未知</span>';
  217. }
  218. }
  219. },
  220. { label: "组ID", name: "GroupID", width: 160, align: "left" },
  221. { label: "货位值", name: "Size", width: 50, align: "left" },
  222. { label: "RFID条码", name: "ContGrpBarCode", width: 130, align: "left" },
  223. { label: "行", name: "Row", width: 50, align: "left" },
  224. { label: "列", name: "Col", width: 50, align: "left" },
  225. { label: "层", name: "Layer", width: 50, align: "left" },
  226. { label: "深度", name: "Depth", width: 50, align: "left" },
  227. { label: "设备", name: "SCRel", width: 60, align: "left" },
  228. { label: '出库跺型', name: 'XYNO', width: 100, align: 'left' },
  229. ]
  230. });
  231. $('#' + subid).jfGridSet('reloadSon', { groupId: rowdata.Id});
  232. },
  233. });
  234. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
  235. },
  236. search: function (param) {
  237. $('#gridtable').jfGridSet('reload', param);
  238. }
  239. };
  240. refreshGirdData = function () {
  241. $('#gridtable').jfGridSet('reload');
  242. };
  243. page.init();
  244. }