ForceOutPalletIndex.js 18 KB

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