InvManualOut.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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["OneInTimeBegin"] = OneInTimebegin;
  45. //queryJson["OneInTimeEnd"] = OneInTimeend;
  46. //queryJson["ProductTimeBegin"] = ProductTimebegin;
  47. //queryJson["ProductTimeEnd"] = ProductTimeend;
  48. queryJson["Grade"] = $("#Grade").val();
  49. queryJson["DoseNo"] = $("#DoseNo").val();
  50. queryJson["ContGrpType"] = $("#ContGrpType").lrselectGet();
  51. queryJson["InvStateCode"] = 3;
  52. queryJson["IsSurplus"] = $("#IsSurplus").lrselectGet();
  53. queryJson["IsRework"] = $("#IsRework").lrselectGet();
  54. queryJson["IsFast"] = $("#IsFast").lrselectGet();
  55. queryJson["IsFail"] = $("#IsFail").lrselectGet();
  56. queryJson["IsBack"] = $("#IsBack").lrselectGet();
  57. queryJson["ExecStateCode"] = $("#ExecStateCode").lrselectGet();
  58. page.search({ queryJson: JSON.stringify(queryJson) });
  59. }, 250);
  60. // 查询
  61. $('#btn_Search').on('click', function () {
  62. var keyword = $('#txt_Keyword').val();
  63. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), InvStateCode: 3 }) });
  64. });
  65. // 刷新
  66. $('#lr_refresh').on('click', function () {
  67. location.reload();
  68. });
  69. // 手动出库
  70. $('#lr_edit').on('click', function ()
  71. {
  72. selectRowsData = $('#gridtable').jfGridGet("rowdata");
  73. if (selectRowsData.length == 0) {
  74. learun.alert.error('未选择行!');
  75. return false;
  76. }
  77. learun.layerForm({
  78. id: 'form',
  79. title: '选择出库地址',
  80. url: top.$.rootUrl + '/CPManager/Inventorys/Form',
  81. width: 700,
  82. height: 300,
  83. callBack: function (id) {
  84. return top[id].acceptClick(refreshGirdData);
  85. }
  86. });
  87. });
  88. $('#lr_pass').on('click', function () {
  89. var postData = $('#gridtable').jfGridGet("rowdata");
  90. if (postData.length == 0) {
  91. learun.alert.error('未选择行!');
  92. return false;
  93. }
  94. learun.layerConfirm('是否确认放行该箱号!', function (res) {
  95. if (res) {
  96. learun.postForm(top.$.rootUrl + '/CPManager/Inventorys/UpdatePassStates', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
  97. refreshGirdData();
  98. });
  99. }
  100. });
  101. });
  102. $('#OneInTime').lrdatetime({
  103. dfdata: [
  104. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  105. { 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') } },
  106. { 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') } },
  107. { 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') } },
  108. ],
  109. // 月
  110. mShow: false,
  111. premShow: false,
  112. // 季度
  113. jShow: false,
  114. prejShow: false,
  115. // 年
  116. ysShow: false,
  117. yxShow: false,
  118. preyShow: false,
  119. yShow: false,
  120. // 默认
  121. dfvalue: 'all',
  122. selectfn: function (begin, end) {
  123. OneInTimebegin = begin;
  124. OneInTimeend = end;
  125. }
  126. });
  127. $('#ProductTime').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. ProductTimebegin = begin;
  149. ProductTimeend = end;
  150. }
  151. });
  152. $('#ContGrpType').lrselect({
  153. url: top.$.rootUrl + '/CPManager/Enums/GetContGrpTypeList',
  154. maxHeight: 180,
  155. allowSearch: false
  156. });
  157. $('#InvStateCode').lrselect({
  158. url: top.$.rootUrl + '/CPManager/Enums/GetInvStateList',
  159. maxHeight: 180,
  160. allowSearch: false
  161. });
  162. $('#ExecStateCode').lrselect({
  163. url: top.$.rootUrl + '/CPManager/Enums/InvLockStateList',
  164. maxHeight: 60,
  165. allowSearch: false
  166. });
  167. $('#IsSurplus').lrselect({
  168. url: top.$.rootUrl + '/CPManager/Enums/YesNoList',
  169. maxHeight: 60,
  170. allowSearch: false
  171. });
  172. $('#IsRework').lrselect({
  173. url: top.$.rootUrl + '/CPManager/Enums/YesNoList',
  174. maxHeight: 60,
  175. allowSearch: false
  176. });
  177. $('#IsFast').lrselect({
  178. url: top.$.rootUrl + '/CPManager/Enums/YesNoList',
  179. maxHeight: 60,
  180. allowSearch: false
  181. });
  182. $('#IsFail').lrselect({
  183. url: top.$.rootUrl + '/CPManager/Enums/YesNoList',
  184. maxHeight: 60,
  185. allowSearch: false
  186. });
  187. $('#IsBack').lrselect({
  188. url: top.$.rootUrl + '/CPManager/Enums/YesNoList',
  189. maxHeight: 60,
  190. allowSearch: false
  191. });
  192. },
  193. // 初始化列表
  194. initGird: function () {
  195. $('#gridtable').jfGrid({
  196. url: top.$.rootUrl + '/CPManager/Inventorys/GetPageList',
  197. headData: [
  198. { label: "容器条码", name: "ContGrpBarCode", width: 120, align: "left" },
  199. {
  200. label: "库存类型", name: "ContGrpTypeName", width: 60, align: "left", sortname: "ContGrpType"
  201. },
  202. //{ label: "材料号", name: "InvBarCode", width: 110, align: "left" },
  203. { label: "库存状态", name: "InvStateName", width: 80, align: "left", sortname: "InvStateCode" },
  204. { label: "巷道", name: "Tunnel", width: 50, align: "left" },
  205. { label: "货位号", name: "Code", width: 100, align: "left" },
  206. {
  207. label: "货位状态", name: "CellState", width: 80, align: "left"
  208. , formatter: function (cellvalue) {
  209. if (cellvalue == 0) {
  210. return '<span class=\"label label-success\" >启用</span>';
  211. } else {
  212. return '<span class=\"label label-default\" >禁用</span>';
  213. }
  214. }
  215. },
  216. { label: "箱号", name: "BoxBarCode", width: 120, align: "left" },
  217. { label: "SKU", name: "HWBarCode", width: 80, align: "left" },
  218. { label: "行", name: "PutRow", width:40, align: "left" },
  219. { label: "列", name: "PutCol", width: 40, align: "left" },
  220. { label: "层", name: "PutLayer", width:40, align: "left" },
  221. { label: "首次入库时间", name: "OneInTime", width: 130, align: "left" },
  222. { label: "生产时间", name: "ProductTime", width: 130, align: "left" },
  223. { label: "物料编码", name: "MatCode", width: 80, align: "left" },
  224. { label: "物料名称", name: "MatName", width: 80, align: "left" },
  225. { label: "预锁单号", name: "SalesDoc", width: 120, align: "left" },
  226. { label: "总重量", name: "TolWQty", width: 80, align: "left" },
  227. { label: "净重", name: "NetWQty", width: 80, align: "left" },
  228. { label: "皮重", name: "TareWQty", width: 80, align: "left" },
  229. { label: "长度", name: "LengthQty", width: 80, align: "left" },
  230. {
  231. label: "是否余料", name: "IsSurplus", width:70, align: "left"
  232. , formatter: function (cellvalue) {
  233. if (cellvalue == true) {
  234. return '<span class=\"label label-success\" >是</span>';
  235. } else {
  236. return '<span class=\"label label-default\" >否</span>';
  237. }
  238. }
  239. },
  240. {
  241. label: "是否退料", name: "IsBack", width: 70, align: "left"
  242. , formatter: function (cellvalue) {
  243. if (cellvalue == true) {
  244. return '<span class=\"label label-success\" >是</span>';
  245. } else {
  246. return '<span class=\"label label-default\" >否</span>';
  247. }
  248. }
  249. },
  250. {
  251. label: "是否锁定", name: "ExecStateCode", width: 80, align: "left"
  252. , formatter: function (cellvalue) {
  253. if (cellvalue == "InvState_Normal") {
  254. return '<span class=\"label label-default\" >否</span>';
  255. } else {
  256. return '<span class=\"label label-success\" >是</span>';
  257. }
  258. }
  259. },
  260. {
  261. label: "返工标记", name: "IsRework", width: 60, align: "left", formatter: function (cellvalue) {
  262. if (cellvalue == true) {
  263. return '<span class=\"label label-success\" >是</span>';
  264. } else {
  265. return '<span class=\"label label-default\" >否</span>';
  266. }
  267. }
  268. },
  269. {
  270. label: "快投标记", name: "IsFast", width: 60, align: "left", formatter: function (cellvalue) {
  271. if (cellvalue == true) {
  272. return '<span class=\"label label-success\" >是</span>';
  273. } else {
  274. return '<span class=\"label label-default\" >否</span>';
  275. }
  276. }
  277. },
  278. {
  279. label: "是否异常", name: "IsFail", width: 60, align: "left", formatter: function (cellvalue) {
  280. if (cellvalue == true) {
  281. return '<span class=\"label label-success\" >是</span>';
  282. } else {
  283. return '<span class=\"label label-default\" >否</span>';
  284. }
  285. }
  286. },
  287. { label: "异常原因", name: "FailReason", width: 80, align: "left" },
  288. { label: "等级", name: "Grade", width: 80, align: "left" },
  289. { label: "退料原因", name: "BackReason", width: 80, align: "left" },
  290. { label: "工序订单号", name: "ProcessDocsCode", width: 120, align: "left" },
  291. { label: "生产机台号", name: "ProductMachCode", width: 80, align: "left" },
  292. { label: "产线编号", name: "ProductLineNo", width: 80, align: "left" },
  293. { label: "入库单号", name: "InDocsNo", width: 120, align: "left" },
  294. { label: "入库单行号", name: "InDocsRowNo", width: 120, align: "left" },
  295. { label: "创建时间", name: "AddTime", width: 150, align: "left" },
  296. { label: "更新时间", name: "EditTime", width: 150, align: "left" },
  297. ],
  298. mainId: 'Id',
  299. isPage: true,
  300. reloadSelected: true,
  301. autowWidth: true,
  302. sidx: 'AddTime',
  303. sord: 'DESC',
  304. isMultiselect: true,
  305. });
  306. page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), InvStateCode: 3 }) });
  307. },
  308. search: function (param) {
  309. param = param || { queryJson: JSON.stringify({InvStateCode: 3 }) };
  310. $('#gridtable').jfGridSet('reload', param);
  311. }
  312. };
  313. refreshGirdData = function () {
  314. page.search();
  315. };
  316. page.init();
  317. }