InvManualOut.js 17 KB

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