Index.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. var refreshGirdData;
  2. var logbegin = '';
  3. var logend = '';
  4. var StartTimeBegin = '';
  5. var StartTimeend = '';
  6. var EndTimeBegin = '';
  7. var EndTimeend = '';
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var psuid = "";
  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 date = $('#lr_search_date_datesearch').html();
  21. if (date == '') {
  22. logbegin = '';
  23. logend = '';
  24. }
  25. var starttime = $('#lr_search_date_StartTime').html();
  26. if (starttime == '') {
  27. StartTimeBegin = '';
  28. StartTimeend = '';
  29. }
  30. var endtime = $('#lr_search_date_EndTime').html();
  31. if (endtime == '') {
  32. EndTimeBegin = '';
  33. EndTimeend = '';
  34. }
  35. //queryJson["AddTimeFrom"] = logbegin;
  36. //queryJson["AddTimeTo"] = logend;
  37. queryJson["WarehouseCode"] = $("#WarehouseCode").lrselectGet();
  38. queryJson["LocationNo"] = $("#LocationNo").val();
  39. queryJson["TargetAddress"] = $("#TargetAddress").val();
  40. queryJson["MatCodeList"] = $("#MatCodeList").val();
  41. queryJson["TaskId"] = $("#TaskId").val();
  42. queryJson["Type"] = $("#Type").lrselectGet();
  43. queryJson["Put"] = $("#Put").lrselectGet();
  44. queryJson["InStock"] = $("#InStock").lrselectGet();
  45. queryJson["AddTimeFrom"] = $("#AddTimeFrom").val();
  46. queryJson["AddTimeTo"] = $("#AddTimeTo").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. $('#WarehouseCode').lrselect({
  97. url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetSelectWarehouseCodeNameList',
  98. maxHeight: 180,
  99. allowSearch: false
  100. });
  101. $('#Put').lrselect({
  102. url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
  103. maxHeight: 60,
  104. allowSearch: false
  105. });
  106. $('#InStock').lrselect({
  107. url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
  108. maxHeight: 60,
  109. allowSearch: false
  110. });
  111. $('#IsTruss').lrselect({
  112. url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
  113. maxHeight: 60,
  114. allowSearch: false
  115. });
  116. // 删除
  117. $('#lr_delete').on('click', function () {
  118. let postData = $('#gridtable').jfGridGet("rowdata");
  119. if (postData.length == 0) {
  120. learun.alert.error('未选择行!');
  121. return false;
  122. }
  123. learun.layerConfirm('是否确认删除该项!', function (res) {
  124. if (res) {
  125. learun.deleteForm(top.$.rootUrl + '/FJManager/WCSCacheline/Delete', {
  126. ids: JSON.stringify(postData.map((item) => item.Id))
  127. }, function () {
  128. refreshGirdData();
  129. });
  130. }
  131. });
  132. });
  133. // 超时
  134. $('#lr_overtime').on('click', function () {
  135. let postData = $('#gridtable').jfGridGet("rowdata");
  136. if (postData.length == 0) {
  137. learun.alert.error('未选择行!');
  138. return false;
  139. }
  140. learun.layerConfirm('是否确认执行超时操作!', function (res) {
  141. if (res) {
  142. learun.deleteForm(top.$.rootUrl + '/FJManager/WCSCacheline/UpdateOvertime', {
  143. ids: JSON.stringify(postData.map((item) => item.Id))
  144. }, function () {
  145. refreshGirdData();
  146. });
  147. }
  148. });
  149. });
  150. },
  151. // 初始化列表
  152. initGird: function () {
  153. $('#gridtable').jfGrid({
  154. url: top.$.rootUrl + '/FJManager/WCSCacheline/GetPageList',
  155. headData: [
  156. { label: "Id", name: "Id", width: 100, align: "left" },
  157. { label: '设备号', name: 'LocationNo', width: 100, align: 'left' },
  158. { label: '目标设备号', name: 'TargetAddress', width: 100, align: 'left' },
  159. { label: '行ID', name: 'PalletizingRowId', width: 100, align: 'left' },
  160. {
  161. label: '是否放行', name: 'Put', width: 80, align: 'left', formatter: function (cellvalue) {
  162. if (cellvalue == true) {
  163. return '<span class=\"label label-success\" >是</span>';
  164. } else {
  165. return '<span class=\"label label-default\" >否</span>';
  166. }
  167. }
  168. },
  169. { label: '有货数量', name: 'Quantity', width: 100, align: 'left' },
  170. { label: '物料编码组', name: 'MatCodeList', width: 160, align: 'left' },
  171. {
  172. label: '是否放满货物', name: 'InStock', width: 100, align: 'left', formatter: function (cellvalue) {
  173. if (cellvalue == true) {
  174. return '<span class=\"label label-success\" >是</span>';
  175. } else {
  176. return '<span class=\"label label-default\" >否</span>';
  177. }
  178. }
  179. },
  180. {
  181. label: '桁架是否开始取货', name: 'IsTruss', width: 130, align: 'left', formatter: function (cellvalue) {
  182. if (cellvalue == true) {
  183. return '<span class=\"label label-success\" >是</span>';
  184. } else {
  185. return '<span class=\"label label-default\" >否</span>';
  186. }
  187. }
  188. },
  189. { label: "仓库编码", name: "WarehouseCode", width: 110, align: "left" },
  190. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  191. { label: "更新时间", name: "EditTime", width: 130, align: "left" },
  192. ],
  193. mainId: 'Id',
  194. isMultiselect: true,
  195. isPage: true,
  196. reloadSelected: true,
  197. sidx: 'AddTime',
  198. sord: 'DESC',
  199. isSubGrid: true, // 是否有子表
  200. subGridExpanded: function (subid, rowdata) {
  201. psuid = subid;
  202. $('#' + subid).jfGrid({
  203. url: top.$.rootUrl + '/FJManager/WCSCacheline/GetCachelineItem',
  204. headData: [
  205. { label: '设备号', name: 'LocationNo', width: 100, align: 'left' },
  206. { label: '坐标号', name: 'XYNo', width: 100, align: 'left' },
  207. { label: '物料号', name: 'MatCode', width: 100, align: 'left' },
  208. { label: '任务号', name: 'TaskId', width: 100, align: 'left' },
  209. {
  210. label: '是否有货', name: 'InStock', width: 100, align: 'left', formatter: function (cellvalue) {
  211. if (cellvalue == true) {
  212. return '<span class=\"label label-success\" >是</span>';
  213. } else {
  214. return '<span class=\"label label-default\" >否</span>';
  215. }
  216. }
  217. },
  218. {
  219. label: '是否为空', name: 'IsEmpty', width: 100, align: 'left', formatter: function (cellvalue) {
  220. if (cellvalue == true) {
  221. return '<span class=\"label label-success\" >是</span>';
  222. } else {
  223. return '<span class=\"label label-default\" >否</span>';
  224. }
  225. }
  226. },
  227. { label: "创建时间", name: "AddTime", width: 130, align: "left" },
  228. { label: "更新时间", name: "EditTime", width: 130, align: "left" },
  229. ]
  230. });
  231. $('#' + subid).jfGridSet('reloadSon', { cachelineId: 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. }