InvManualOut.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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. "use strict";
  10. var page = {
  11. init: function () {
  12. page.initGird();
  13. page.bind();
  14. },
  15. bind: function () {
  16. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  17. // 调用后台查询
  18. // queryJson 查询条件
  19. var oneintime = $('#lr_search_date_OneInTime').html();
  20. if (oneintime == '') {
  21. OneInTimebegin = '';
  22. OneInTimeend = '';
  23. }
  24. var producttime = $('#lr_search_date_ProductTime').html();
  25. if (producttime == '') {
  26. ProductTimebegin = '';
  27. ProductTimeend = '';
  28. }
  29. console.log(queryJson);
  30. queryJson["MatCode"] = $("#MatCode").val();
  31. queryJson["MatName"] = $("#MatName").val();
  32. queryJson["RFIDBarCode"] = $("#RFIDBarCode").val();
  33. queryJson["InvBarCode"] = $("#InvBarCode").val();
  34. queryJson["Tunnel"] = $("#Tunnel").val();
  35. queryJson["Code"] = $("#Code").val();
  36. queryJson["PutRow"] = $("#PutRow").val();
  37. queryJson["PutCol"] = $("#PutCol").val();
  38. queryJson["PutLayer"] = $("#PutLayer").val();
  39. queryJson["OneInTimeBegin"] = $("#OneInTimeBegin").val();
  40. queryJson["OneInTimeEnd"] = $("#OneInTimeEnd").val();
  41. queryJson["ProductTimeBegin"] = $("#ProductTimeBegin").val();
  42. queryJson["ProductTimeEnd"] = $("#ProductTimeEnd").val();
  43. //queryJson["OneInTimeBegin"] = OneInTimebegin;
  44. //queryJson["OneInTimeEnd"] = OneInTimeend;
  45. //queryJson["ProductTimeBegin"] = ProductTimebegin;
  46. //queryJson["ProductTimeEnd"] = ProductTimeend;
  47. queryJson["Grade"] = $("#Grade").val();
  48. queryJson["ContGrpType"] = $("#ContGrpType").lrselectGet();
  49. queryJson["InvStateCode"] = 3;
  50. queryJson["IsSurplus"] = $("#IsSurplus").lrselectGet();
  51. queryJson["IsRework"] = $("#IsRework").lrselectGet();
  52. queryJson["IsFast"] = $("#IsFast").lrselectGet();
  53. queryJson["IsFail"] = $("#IsFail").lrselectGet();
  54. queryJson["IsBack"] = $("#IsBack").lrselectGet();
  55. queryJson["ExecStateCode"] = $("#ExecStateCode").lrselectGet();
  56. //if ($("#IsSurplus").is(":checked")) {
  57. // queryJson["IsSurplus"] = '1';
  58. //} else {
  59. // queryJson["IsSurplus"] = '0';
  60. //}
  61. //if ($("#IsRework").is(":checked")) {
  62. // queryJson["IsRework"] = '1';
  63. //} else {
  64. // queryJson["IsRework"] = '0';
  65. //}
  66. //if ($("#IsFast").is(":checked")) {
  67. // queryJson["IsFast"] = '1';
  68. //} else {
  69. // queryJson["IsFast"] = '0';
  70. //}
  71. //if ($("#IsFail").is(":checked")) {
  72. // queryJson["IsFail"] = '1';
  73. //} else {
  74. // queryJson["IsFail"] = '0';
  75. //}
  76. //if ($("#IsBack").is(":checked")) {
  77. // queryJson["IsBack"] = '1';
  78. //} else {
  79. // queryJson["IsBack"] = '0';
  80. //}
  81. //if ($("#ExecStateCode").is(":checked")) {
  82. // queryJson["ExecStateCode"] = 'InvState_Lock';
  83. //} else {
  84. // queryJson["ExecStateCode"] = 'InvState_Normal';
  85. //}
  86. page.search({ queryJson: JSON.stringify(queryJson) });
  87. }, 250);
  88. // 查询
  89. $('#btn_Search').on('click', function () {
  90. var keyword = $('#txt_Keyword').val();
  91. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), InvStateCode: 3 }) });
  92. });
  93. // 刷新
  94. $('#lr_refresh').on('click', function () {
  95. location.reload();
  96. });
  97. // 手动出库
  98. $('#lr_edit').on('click', function ()
  99. {
  100. var postData = $('#gridtable').jfGridGet("rowdata");
  101. if (postData.length == 0) {
  102. learun.alert.error('未选择行!');
  103. return false;
  104. }
  105. var url = weburl+"api/Hj/ManualTask";
  106. learun.layerConfirm('是否确认手动出库!', function (res) {
  107. if (res) {
  108. $.ajax({
  109. type: 'post',
  110. //data: { location: postData.map((item) => item.Id) },
  111. data: JSON.stringify({
  112. "location": postData.map((item) => item.Code)
  113. }),
  114. dataType: 'json',
  115. contentType: "application/json;charset=utf-8",
  116. url: url,
  117. success: function (response) {
  118. //resCode 200 resMsg "成功"
  119. refreshGirdData();
  120. top.layer.close(top.layer.index);
  121. learun.alert.info(response.resMsg);
  122. }
  123. });
  124. }
  125. });
  126. });
  127. $('#OneInTime').lrdatetime({
  128. dfdata: [
  129. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  130. { 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') } },
  131. { 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') } },
  132. { 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') } },
  133. ],
  134. // 月
  135. mShow: false,
  136. premShow: false,
  137. // 季度
  138. jShow: false,
  139. prejShow: false,
  140. // 年
  141. ysShow: false,
  142. yxShow: false,
  143. preyShow: false,
  144. yShow: false,
  145. // 默认
  146. dfvalue: 'all',
  147. selectfn: function (begin, end) {
  148. OneInTimebegin = begin;
  149. OneInTimeend = end;
  150. }
  151. });
  152. $('#ProductTime').lrdatetime({
  153. dfdata: [
  154. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  155. { 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') } },
  156. { 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') } },
  157. { 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') } },
  158. ],
  159. // 月
  160. mShow: false,
  161. premShow: false,
  162. // 季度
  163. jShow: false,
  164. prejShow: false,
  165. // 年
  166. ysShow: false,
  167. yxShow: false,
  168. preyShow: false,
  169. yShow: false,
  170. // 默认
  171. dfvalue: 'all',
  172. selectfn: function (begin, end) {
  173. ProductTimebegin = begin;
  174. ProductTimeend = end;
  175. }
  176. });
  177. $('#ContGrpType').lrselect({
  178. url: top.$.rootUrl + '/HJManager/Enums/GetContGrpTypeList',
  179. maxHeight: 180,
  180. allowSearch: false
  181. });
  182. $('#InvStateCode').lrselect({
  183. url: top.$.rootUrl + '/HJManager/Enums/GetInvStateList',
  184. maxHeight: 180,
  185. allowSearch: false
  186. });
  187. $('#ExecStateCode').lrselect({
  188. url: top.$.rootUrl + '/HJManager/Enums/InvLockStateList',
  189. maxHeight: 60,
  190. allowSearch: false
  191. });
  192. $('#IsSurplus').lrselect({
  193. url: top.$.rootUrl + '/HJManager/Enums/YesNoList',
  194. maxHeight: 60,
  195. allowSearch: false
  196. });
  197. $('#IsRework').lrselect({
  198. url: top.$.rootUrl + '/HJManager/Enums/YesNoList',
  199. maxHeight: 60,
  200. allowSearch: false
  201. });
  202. $('#IsFast').lrselect({
  203. url: top.$.rootUrl + '/HJManager/Enums/YesNoList',
  204. maxHeight: 60,
  205. allowSearch: false
  206. });
  207. $('#IsFail').lrselect({
  208. url: top.$.rootUrl + '/HJManager/Enums/YesNoList',
  209. maxHeight: 60,
  210. allowSearch: false
  211. });
  212. $('#IsBack').lrselect({
  213. url: top.$.rootUrl + '/HJManager/Enums/YesNoList',
  214. maxHeight: 60,
  215. allowSearch: false
  216. });
  217. },
  218. // 初始化列表
  219. initGird: function () {
  220. $('#gridtable').jfGrid({
  221. url: top.$.rootUrl + '/HJManager/Inventorys/GetPageList',
  222. headData: [
  223. { label: "容器条码", name: "ContGrpBarCode", width: 120, align: "left" },
  224. {
  225. label: "库存类型", name: "ContGrpType", width: 60, align: "left", formatter: function (cellvalue) {
  226. if (cellvalue == 1) {
  227. return '<span class=\"label label-success\" >物料盘</span>';
  228. } else if (cellvalue == 2) {
  229. return '<span class=\"label label-default\" >空盘</span>';
  230. } else {
  231. return '<span class=\"label label-default\" >未知</span>';
  232. }
  233. }
  234. },
  235. { label: "材料号", name: "InvBarCode", width: 110, align: "left" },
  236. { label: "库存状态", name: "InvStateName", width: 80, align: "left", sortname: "InvStateCode" },
  237. { label: "巷道", name: "Tunnel", width: 50, align: "left" },
  238. { label: "货位号", name: "Code", width: 100, align: "left" },
  239. {
  240. label: "货位状态", name: "CellState", width: 80, align: "left"
  241. , formatter: function (cellvalue) {
  242. if (cellvalue == 0) {
  243. return '<span class=\"label label-success\" >启用</span>';
  244. } else {
  245. return '<span class=\"label label-default\" >禁用</span>';
  246. }
  247. }
  248. },
  249. { label: "行", name: "PutRow", width:40, align: "left" },
  250. { label: "列", name: "PutCol", width: 40, align: "left" },
  251. { label: "层", name: "PutLayer", width:40, align: "left" },
  252. { label: "首次入库时间", name: "OneInTime", width: 130, align: "left" },
  253. { label: "生产时间", name: "ProductTime", width: 130, align: "left" },
  254. { label: "时效时长", name: "HoldDuration", width: 80, align: "left" },
  255. { label: "物料编码", name: "MatCode", width: 80, align: "left" },
  256. { label: "物料名称", name: "MatName", width: 80, align: "left" },
  257. { label: "总重量", name: "TolWQty", width: 80, align: "left" },
  258. { label: "净重", name: "NetWQty", width: 80, align: "left" },
  259. { label: "皮重", name: "TareWQty", width: 80, align: "left" },
  260. { label: "长度", name: "LengthQty", width: 80, align: "left" },
  261. { label: "RFID编号", name: "RFIDBarCode", width: 80, align: "left" },
  262. { label: "工字轮类型", name: "HWTypeCode", width: 80, align: "left" },
  263. {
  264. label: "是否余料", name: "IsSurplus", width:70, align: "left"
  265. , formatter: function (cellvalue) {
  266. if (cellvalue == true) {
  267. return '<span class=\"label label-success\" >是</span>';
  268. } else {
  269. return '<span class=\"label label-default\" >否</span>';
  270. }
  271. }
  272. },
  273. {
  274. label: "是否退料", name: "IsBack", width: 70, align: "left"
  275. , formatter: function (cellvalue) {
  276. if (cellvalue == true) {
  277. return '<span class=\"label label-success\" >是</span>';
  278. } else {
  279. return '<span class=\"label label-default\" >否</span>';
  280. }
  281. }
  282. },
  283. {
  284. label: "是否锁定", name: "ExecStateCode", width: 80, align: "left"
  285. , formatter: function (cellvalue) {
  286. if (cellvalue == "InvState_Normal") {
  287. return '<span class=\"label label-default\" >否</span>';
  288. } else {
  289. return '<span class=\"label label-success\" >是</span>';
  290. }
  291. }
  292. },
  293. {
  294. label: "返工标记", name: "IsRework", width: 60, align: "left", formatter: function (cellvalue) {
  295. if (cellvalue == true) {
  296. return '<span class=\"label label-success\" >是</span>';
  297. } else {
  298. return '<span class=\"label label-default\" >否</span>';
  299. }
  300. }
  301. },
  302. {
  303. label: "快投标记", name: "IsFast", width: 60, align: "left", formatter: function (cellvalue) {
  304. if (cellvalue == true) {
  305. return '<span class=\"label label-success\" >是</span>';
  306. } else {
  307. return '<span class=\"label label-default\" >否</span>';
  308. }
  309. }
  310. },
  311. {
  312. label: "是否异常", name: "IsFail", width: 60, align: "left", formatter: function (cellvalue) {
  313. if (cellvalue == true) {
  314. return '<span class=\"label label-success\" >是</span>';
  315. } else {
  316. return '<span class=\"label label-default\" >否</span>';
  317. }
  318. }
  319. },
  320. { label: "异常原因", name: "FailReason", width: 80, align: "left" },
  321. { label: "等级", name: "Grade", width: 80, align: "left" },
  322. { label: "退料原因", name: "BackReason", width: 80, align: "left" },
  323. { label: "工序订单号", name: "ProcessDocsCode", width: 120, align: "left" },
  324. { label: "生产机台号", name: "ProductMachCode", width: 80, align: "left" },
  325. { label: "产线编号", name: "ProductLineNo", width: 80, align: "left" },
  326. { label: "入库单号", name: "InDocsNo", width: 120, align: "left" },
  327. { label: "入库单行号", name: "InDocsRowNo", width: 120, align: "left" },
  328. { label: "创建时间", name: "AddTime", width: 150, align: "left" },
  329. { label: "更新时间", name: "EditTime", width: 150, align: "left" },
  330. ],
  331. mainId: 'Id',
  332. isPage: true,
  333. reloadSelected: true,
  334. autowWidth: true,
  335. sidx: 'AddTime',
  336. sord: 'DESC',
  337. isMultiselect: true,
  338. });
  339. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), InvStateCode: 3 }) });
  340. },
  341. search: function (param) {
  342. param = param || { queryJson: JSON.stringify({InvStateCode: 3 }) };
  343. $('#gridtable').jfGridSet('reload', param);
  344. }
  345. };
  346. refreshGirdData = function () {
  347. page.search();
  348. };
  349. page.init();
  350. }