You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

896 lines
40 KiB

3 weeks ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <script>
  7. debugger;
  8. var _Clos = new Array();
  9. var Type = $.request("Type");
  10. var mold = $.request("mold");
  11. var Name = "单据号";
  12. var ColModelMain = [];
  13. var ColModelSub = [];
  14. $(function () {
  15. SetCols();
  16. if (Type == '5') {
  17. gridList5();
  18. }
  19. })
  20. function SetCols() {
  21. $.ajax({
  22. url: "/Print/SelectColumnName?" + Math.random(),
  23. dataType: "json",
  24. async: false,
  25. success: function (data) {
  26. var cols = new Array();
  27. var cols1 = new Array();
  28. if (Type == '5') {
  29. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  30. cols.push(collast);
  31. var collast = { label: '单据号', name: 'InCode', width: 120, align: 'left' };
  32. cols.push(collast);
  33. var collast = { label: '行号', name: 'Sequence', width: 50, align: 'left' };
  34. cols.push(collast);
  35. var collast = { label: '仓库编码', name: 'WHCode', width: 120, align: 'left' };
  36. cols.push(collast);
  37. var collast = { label: '料品编码', name: 'InvCode', width: 50, align: 'left' };
  38. cols.push(collast);
  39. var collast = { label: '料品名称', name: 'InvName', width: 120, align: 'left' };
  40. cols.push(collast);
  41. var collast = { label: '料品描述', name: 'InvDesc', width: 50, align: 'left' };
  42. cols.push(collast);
  43. var collast = { label: '料品型号', name: 'InvStd', width: 150, align: 'left' };
  44. cols.push(collast);
  45. var collast = { label: '料品单位', name: 'InvStd', width: 50, align: 'left' };
  46. cols.push(collast);
  47. var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left' };
  48. cols.push(collast);
  49. var collast = { label: '已生成数量', name: 'LOTQTY', width: 100, align: 'left' };
  50. cols.push(collast);
  51. var collast = { label: '辅计量数量', name: 'Amount', width: 150, align: 'left' };
  52. cols.push(collast);
  53. var collast = { label: '已入数量', name: 'InQuantity', width: 60, align: 'left', };
  54. cols.push(collast);
  55. var collast = { label: '创建人', name: 'CreatePerson', width: 60, align: 'left', };
  56. cols.push(collast);
  57. var collast = { label: '创建时间', name: 'CreateDateTime', width: 100, align: 'left' };
  58. cols.push(collast);
  59. //var collast = { label: '批次', name: 'BatchCode', width: 100, align: 'left' };
  60. //cols.push(collast);
  61. $.ajax({
  62. url: "/Print/SelectTableColumnName?" + Math.random(),
  63. dataType: "json",
  64. async: false,
  65. success: function (data) {
  66. if (data != null && data.length > 0) {
  67. DateList = data;
  68. for (var i = 0; i < data.length; i++) {
  69. var TableCode = data[i].TableCode;
  70. if (TableCode == "ICSOtherIn") {
  71. var Code = data[i].Code;
  72. var Name = data[i].Name;
  73. var obj = new Array();
  74. obj = {
  75. label: Name,
  76. name: Code,
  77. width: 80,
  78. align: "left"
  79. }
  80. cols.push(obj);
  81. }
  82. if (TableCode == "ICSInventory") {
  83. var Code = data[i].Code;
  84. var Name = data[i].Name;
  85. var obj = new Array();
  86. obj = {
  87. label: Name,
  88. name: Code,
  89. width: 80,
  90. align: "left"
  91. }
  92. cols.push(obj);
  93. //cols1.push(obj);
  94. }
  95. }
  96. }
  97. _Clos = cols;
  98. //_Clos1 = cols1;
  99. }
  100. });
  101. }
  102. var cols1 = new Array();
  103. var collast1 = { label: "主键", name: "ID", hidden: true, key: true };
  104. cols1.push(collast1);
  105. var collast1 = { label: "来源单据号", name: "TransCode", width: 150, align: 'left' };
  106. cols1.push(collast1);
  107. var collast1 = { label: '来源单据行', name: 'TransSequence', width: 80, align: 'left' };
  108. cols1.push(collast1);
  109. var collast1 = { label: '条码', name: 'LotNo', width: 200, align: 'left' };
  110. cols1.push(collast1);
  111. var collast1 = { label: '条码数量', name: 'Quantity', width: 80, align: 'left' };
  112. cols1.push(collast1);
  113. var collast1 = { label: '辅计量数量', name: 'Amount', width: 80, align: 'left' };
  114. cols1.push(collast1);
  115. var collast1 = { label: '生产日期', name: 'ProductDate', width: 80, align: 'left' };
  116. cols1.push(collast1);
  117. var collast1 = { label: '失效日期', name: 'ExpirationDate', width: 80, align: 'left' };
  118. cols1.push(collast1);
  119. var collast1 = { label: '有效期天数', name: 'EffectiveDays', width: 80, align: 'left' };
  120. cols1.push(collast1);
  121. var collast1 = { label: '备注', name: 'EATTRIBUTE5', width: 100, align: 'left' };
  122. cols1.push(collast1);
  123. var collast1 = { label: '是否入库', name: 'isStorage', width: 100, align: 'left' };
  124. cols1.push(collast1);
  125. var collast1 = { label: '是否检验', name: 'isInspection', width: 100, align: 'left' };
  126. cols1.push(collast1);
  127. var collast1 = { label: '免检', name: 'isExemption', width: 100, align: 'left' };
  128. cols1.push(collast1);
  129. var collast1 = { label: '操作人', name: 'MUSERName', width: 100, align: 'left' };
  130. cols1.push(collast1);
  131. var collast1 = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
  132. cols1.push(collast1);
  133. var collast1 = { label: '是否打印', name: 'isPrint', width: 150, align: 'left' };
  134. cols1.push(collast1);
  135. if (data != null && data.length > 0) {
  136. DateList = data;
  137. for (var i = 0; i < data.length; i++) {
  138. var ColName = data[i].ColName;
  139. var ColCode = data[i].ColCode;
  140. var obj = new Array();
  141. obj = {
  142. label: ColName,
  143. name: ColCode,
  144. width: 80,
  145. align: "left"
  146. }
  147. cols.push(obj);
  148. cols1.push(obj);
  149. }
  150. }
  151. _Clos = cols;
  152. _Clos1 = cols1;
  153. }
  154. });
  155. }
  156. //其它入库生成条码
  157. function gridList5() {
  158. var $gridList = $("#gridList");
  159. var queryJson = {
  160. POCode: $("#txt_POCode").val(),
  161. InvCode: $("#txt_InvCode").val(),
  162. InvName: $("#txt_InvName").val(),
  163. BatchCode: $("#txt_BatchCode").val(),
  164. POStatus: $("#selShow").val(),
  165. InvStd: $("#txt_InvStd").val(),
  166. }
  167. $gridList.dataGrid({
  168. url: "/MFWMS/ScrapDocumentDealWith/GetGridJsonQiTa" + "?" + Math.random(),
  169. postData: { queryJson: JSON.stringify(queryJson) },
  170. height: $(window).height() - 200,
  171. width: $(window).width() - 300,
  172. colModel: _Clos,
  173. //colModel: [
  174. // { label: "主键", name: "ID", hidden: true, key: true },
  175. // { label: '单据号', name: 'InCode', width: 120, align: 'left' },
  176. // { label: '行号', name: 'Sequence', width: 50, align: 'left' },
  177. // { label: '仓库编码', name: 'WHCode', width: 120, align: 'left' },
  178. // { label: '料品编码', name: 'InvCode', width: 50, align: 'left' },
  179. // { label: '料品名称', name: 'InvName', width: 120, align: 'left' },
  180. // { label: '料品描述', name: 'InvDesc', width: 50, align: 'left' },
  181. // { label: '料品型号', name: 'InvStd', width: 150, align: 'left' },
  182. // { label: '料品单位', name: 'InvStd', width: 50, align: 'left' },
  183. // { label: '数量', name: 'Quantity', width: 100, align: 'left' },
  184. // { label: '已生成数量', name: 'LOTQTY', width: 100, align: 'left' },
  185. // { label: '辅计量数量', name: 'Amount', width: 150, align: 'left' },
  186. // { label: '已入数量', name: 'InQuantity', width: 60, align: 'left', },
  187. // { label: '创建人', name: 'CreatePerson', width: 60, align: 'left', },
  188. // { label: '创建时间', name: 'CreateDateTime', width: 100, align: 'left' },
  189. // { label: '批次', name: 'BatchCode', width: 100, align: 'left' },
  190. //],
  191. //colModel: ColModelMain,
  192. width: "100%",
  193. autowidth: true,
  194. //shrinkToFit: true,
  195. gridComplete: function () {
  196. },
  197. pager: "#gridPager",
  198. sortname: 'InCode',
  199. sortorder: "asc",
  200. viewrecords: true,
  201. multiselect: true,
  202. //beforeSelectRow: function (rowid, e) {
  203. // $("#gridList").jqGrid('resetSelection');
  204. // return (true);
  205. //},
  206. subGrid: true, // (1)开启子表格支持
  207. subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  208. $("#gridList").jqGrid("setSelection", rowid, false);
  209. bindSubGrid5(subgrid_id, rowid)
  210. }
  211. });
  212. $("#warehouse a.btn-default").click(function () {
  213. $("#warehouse a.btn-default").removeClass("active");
  214. $(this).addClass("active");
  215. $('#btn_search').trigger("click");
  216. });
  217. $("#btn_search").click(function () {
  218. var warehouse = $("#warehouse a.active").attr('data-value');
  219. var queryJson = {
  220. POCode: $("#txt_POCode").val(),
  221. InvCode: $("#txt_InvCode").val(),
  222. InvName: $("#txt_InvName").val(),
  223. BatchCode: $("#txt_BatchCode").val(),
  224. POStatus: $("#selShow").val(),
  225. InvStd: $("#txt_InvStd").val(),
  226. }
  227. $gridList.jqGrid('setGridParam', {
  228. postData: { queryJson: JSON.stringify(queryJson) },
  229. }).trigger('reloadGrid');
  230. });
  231. }
  232. function bindSubGrid5(subgrid_id, rowid) {
  233. $("#gridList").jqGrid("setSelection", rowid, false);
  234. var subgrid_table_id;
  235. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  236. var subgrid_pager_id;
  237. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  238. // (5)动态添加子报表的table和pager
  239. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  240. var InCode = $("#gridList").jqGrid('getRowData', rowid).InCode;
  241. var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
  242. var isPrint = $("#selPrint").val();
  243. // (6)创建jqGrid对象
  244. $("#" + subgrid_table_id).dataGrid({
  245. cellEdit: true,
  246. url: "/WMS/WMSCreateItemLot/GetSubGridJson/GetSubGridJson?ApplyNegCode=" + InCode + "&Sequence=" + Sequence + "&Type=" + Type + "&isPrint=" + isPrint + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  247. //colModel: [
  248. // { label: "主键", name: "ID", hidden: true, key: true },
  249. // { label: "来源单据号", name: "TransCode", width: 200, align: 'left' },
  250. // { label: '来源单据行', name: 'TransSequence', width: 200, align: 'left' },
  251. // { label: '条码', name: 'LotNo', width: 200, align: 'left' },
  252. // { label: '条码数量', name: 'Quantity', width: 200, align: 'left' },
  253. // { label: '操作人', name: 'MUSERName', width: 200, align: 'left' },
  254. // { label: '操作时间', name: 'MTIME', width: 200, align: 'left' },
  255. //],
  256. colModel: _Clos1,
  257. //colModel: ColModelSub,
  258. shrinkToFit: true,//宽度自适应
  259. multiselect: true,
  260. prmNames: { search: "search" },
  261. viewrecords: true,
  262. height: "100%",
  263. rowNum: 20,
  264. pager: subgrid_pager_id,
  265. });
  266. }
  267. function btnDelete() {
  268. var objArr = '';
  269. var obj = $("#gridList").jqGrid("getRowData");
  270. for (var i = 0; i < obj.length; i++) {
  271. var $SubGird = $("#gridList_" + obj[i].ID + "_t");
  272. var rowData = $SubGird.jqGrid('getGridParam', 'selarrrow');
  273. if (rowData != "undefined" && rowData != null) {
  274. for (var j = 0; j < rowData.length; j++) {
  275. objArr += "'" + rowData[j] + "',";
  276. }
  277. }
  278. }
  279. if (objArr == "") {
  280. $.modalAlertNew("WMS00099");
  281. return;
  282. }
  283. $.deleteForm({
  284. url: "/WMS/WMSCreateItemLot/DeleteItemLot",
  285. param: { keyValue: JSON.stringify(objArr) },
  286. success: function () {
  287. $.currentWindow().$("#gridList").trigger("reloadGrid");
  288. }
  289. })
  290. }
  291. function btnAudit() {
  292. debugger;
  293. var PoStatus;
  294. var jsonData = '';
  295. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  296. //if (ids.length != 1) {
  297. // $.modalAlertNew("WMS00100");
  298. // return;
  299. //}
  300. var POCode = "";
  301. var PORow = "";
  302. var VenCode = "";
  303. var WorkPoint = "";
  304. var VendorLot = "";
  305. //普通到货单
  306. if (Type == '5') {
  307. debugger;
  308. LocationCode = $("#txt_LocationCode").val();
  309. if (LocationCode == '' || LocationCode==undefined) {
  310. $.modalAlert("请先输入入库库位!");
  311. return;
  312. }
  313. var ARR = [];
  314. for (var i in ids) {
  315. WHCode = $("#gridList").jqGrid('getRowData', ids[i]).WHCode;
  316. ID = $("#gridList").jqGrid('getRowData', ids[i]).ID;
  317. InCode = $("#gridList").jqGrid('getRowData', ids[i]).InCode;
  318. Sequence = $("#gridList").jqGrid('getRowData', ids[i]).Sequence;
  319. EffectiveEnable = $("#gridList").jqGrid('getRowData', ids[i]).EffectiveEnable;
  320. EffectiveDays = $("#gridList").jqGrid('getRowData', ids[i]).EffectiveDays;
  321. var WorkPoints = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  322. var WarehouseCode = "";
  323. $.ajax({
  324. url: "/MFWMS/ScrapDocumentDealWith/GetWHCodeByLocation?LocationCode=" + LocationCode + "&" + Math.random(),
  325. dataType: "json",
  326. async: false,
  327. success: function (data) {
  328. if (data != null && data.length > 0) {
  329. WarehouseCode = data[0].WarehouseCode;
  330. }
  331. }
  332. });
  333. if (WarehouseCode != WHCode) {
  334. $.modalAlert("所输入库位号与单据:" + InCode + "行号:" + Sequence + "对应仓库不符,请填写对应仓库下的库位号!");
  335. return;
  336. }
  337. //console.log("单号:" + DNCode + ",行号:" + Sequence + ",站位:" + WorkPoints);
  338. var thisCreateQty = $("#gridList").jqGrid('getRowData', ids[i]).Quantity * 1 - $("#gridList").jqGrid('getRowData', ids[i]).LOTQTY * 1;//本次生成数量
  339. if (thisCreateQty == 0) {
  340. $.modalAlert("该单据条码已全部生成完毕!");
  341. return;
  342. }
  343. thisCreateQty = thisCreateQty.toFixed(6);
  344. var minPackQty = thisCreateQty;//最小包装量
  345. //minPackQty = minPackQty.toFixed(4);
  346. var createPageCount = 1;//本次生成张数
  347. createPageCount = createPageCount.toFixed(0);
  348. console.log("thisCreateQty:" + thisCreateQty + ",minPackQty:" + minPackQty);
  349. var Quantity = $("#gridList").jqGrid('getRowData', ids[i]).Quantity * 1;//采购订单总数
  350. Quantity = Quantity.toFixed(6);
  351. var CreatedQty = $("#gridList").jqGrid('getRowData', ids[i]).LOTQTY * 1;//已生成数量
  352. CreatedQty = CreatedQty.toFixed(6);
  353. console.log("Quantity:" + Quantity + ",CreatedQty:" + CreatedQty);
  354. if (Quantity == CreatedQty) {
  355. return false;
  356. }
  357. if (EffectiveEnable == 'true') {
  358. var ExpirationDate = dateChange(EffectiveDays, PRODUCTDATE);
  359. } else {
  360. var ExpirationDate = '2999-12-31 00:00:00.000';//条码失效日期
  361. }
  362. var PRODUCTDATE = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate();//条码生产日期
  363. // console.log("ExpirationDate:" + ExpirationDate + ",PRODUCTDATE:" + PRODUCTDATE);
  364. var obj = {
  365. ID: ID,
  366. Code: InCode,
  367. Sequence: Sequence,
  368. thisCreateQty: thisCreateQty,
  369. minPackQty: minPackQty,
  370. createPageCount: createPageCount,
  371. //VendorLot: VendorLot,
  372. PRODUCTDATE: PRODUCTDATE,
  373. ExpirationDate: ExpirationDate,
  374. Amount: $("#gridList").jqGrid('getRowData', ids[i]).Amount * 1,
  375. //自由项
  376. ProjectCode: $("#gridList").jqGrid('getRowData', ids[i]).ProjectCode !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).ProjectCode : '',
  377. BatchCode: $("#gridList").jqGrid('getRowData', ids[i]).BatchCode !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).BatchCode : '',
  378. Version: $("#gridList").jqGrid('getRowData', ids[i]).Version !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).Version : '',
  379. Brand: $("#gridList").jqGrid('getRowData', ids[i]).Brand !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).Brand : '',
  380. cFree1: $("#gridList").jqGrid('getRowData', ids[i]).cFree1 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree1 : '',
  381. cFree2: $("#gridList").jqGrid('getRowData', ids[i]).cFree2 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree2 : '',
  382. cFree3: $("#gridList").jqGrid('getRowData', ids[i]).cFree3 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree3 : '',
  383. cFree4: $("#gridList").jqGrid('getRowData', ids[i]).cFree4 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree4 : '',
  384. cFree5: $("#gridList").jqGrid('getRowData', ids[i]).cFree5 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree5 : '',
  385. cFree6: $("#gridList").jqGrid('getRowData', ids[i]).cFree6 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree6 : '',
  386. cFree7: $("#gridList").jqGrid('getRowData', ids[i]).cFree7 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree7 : '',
  387. cFree8: $("#gridList").jqGrid('getRowData', ids[i]).cFree8 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree8 : '',
  388. cFree9: $("#gridList").jqGrid('getRowData', ids[i]).cFree9 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree9 : '',
  389. cFree10: $("#gridList").jqGrid('getRowData', ids[i]).cFree10 !== undefined ? $("#gridList").jqGrid('getRowData', ids[i]).cFree10 : '',
  390. }
  391. ARR.push(obj);
  392. }
  393. $.submitForm({
  394. url: "/MFWMS/ScrapDocumentDealWith/SubmitFormQTALL?"+ Math.random(),
  395. param: {
  396. keyValue: JSON.stringify(ARR),
  397. Location: LocationCode
  398. },
  399. success: function () {
  400. $.currentWindow().$("#gridList").trigger("reloadGrid");
  401. }
  402. })
  403. }
  404. }
  405. function dateChange(num, date) {
  406. if (!date) {
  407. date = new Date();//没有传入值时,默认是当前日期
  408. date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
  409. }
  410. date += " 00:00:00";//设置为当天凌晨12点
  411. date = Date.parse(new Date(date)) / 1000;//转换为时间戳
  412. date += (86400) * num;//修改后的时间戳
  413. var newDate = new Date(parseInt(date) * 1000);//转换为时间
  414. return newDate.getFullYear() + '-' + (newDate.getMonth() + 1) + '-' + newDate.getDate();
  415. }
  416. function btnCreate() {
  417. debugger;
  418. var PoStatus;
  419. var jsonData = '';
  420. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  421. if (ids.length != 1) {
  422. $.modalAlertNew("WMS00100");
  423. return;
  424. }
  425. var POCode = "";
  426. var PORow = "";
  427. if (Type == '5') {
  428. for (var i in ids) {
  429. InCode = $("#gridList").jqGrid('getRowData', ids[i]).InCode;
  430. Sequence = $("#gridList").jqGrid('getRowData', ids[i]).Sequence;
  431. InvCode = $("#gridList").jqGrid('getRowData', ids[i]).InvCode;
  432. ID = $("#gridList").jqGrid('getRowData', ids[i]).ID;
  433. Quantity = $("#gridList").jqGrid('getRowData', ids[i]).Quantity;
  434. }
  435. $.modalOpen({
  436. id: "FormAddItemLot",
  437. title: "其他入库条码产生",
  438. url: "/WMS/WMSCreateItemLot/From?InCode=" + InCode + "&Sequence=" + Sequence + "&InvCode=" + InvCode + "&Type=" + 5 + "&ID=" + ID + "&Quantity=" + Quantity + "&" + Math.random(),
  439. width: "550px",
  440. height: "1000px",
  441. callBack: function (iframeId) {
  442. top.frames[iframeId].submitForm();
  443. }
  444. });
  445. }
  446. }
  447. function fullscreen() {
  448. var docElm = document.documentElement;
  449. if (docElm.requestFullscreen) {
  450. docElm.requestFullscreen();
  451. } else if (docElm.mozRequestFullScreen) {
  452. docElm.mozRequestFullScreen();
  453. } else if (docElm.webkitRequestFullScreen) {
  454. docElm.webkitRequestFullScreen();
  455. } else if (docElm.msRequestFullscreen) {
  456. docElm.msRequestFullscreen();
  457. }
  458. $(window).bind('resize', function () {
  459. $("#gridList").setGridWidth($(window).width());
  460. }).trigger('resize');
  461. $(window).bind('resize', function () {
  462. $("#gridList").setGridHeight($(window).height());
  463. }).trigger('resize');
  464. }
  465. function btnPrint() {
  466. debugger;
  467. if (mold == '')
  468. {
  469. if (Type == '5') { mold = '00005'; }//其他入库生成条码
  470. }
  471. var objArr = '';
  472. var arr = [];
  473. var obj = $("#gridList").jqGrid("getRowData");
  474. for (var i = 0; i < obj.length; i++) {
  475. var $SubGird = $("#gridList_" + obj[i].ID + "_t");
  476. var rowData = $SubGird.jqGrid('getGridParam', 'selarrrow');
  477. if (rowData != "undefined" && rowData != null && rowData.length != 0) {
  478. for (var j = 0; j < rowData.length; j++) {
  479. objArr += "'" + rowData[j] + "',";
  480. }
  481. objArr = objArr.slice(0, objArr.length - 1);
  482. objArr = "" + objArr + "|";
  483. arr.push(objArr);
  484. }
  485. }
  486. if (objArr == "") {
  487. $.modalAlertNew("WMS00101");
  488. return;
  489. }
  490. $.modalOpen({
  491. id: "PrintLot",
  492. title: "打印",
  493. url: "/WMS/Print/PrintViewByLot?Arguments=" + encodeURI(encodeURI(arr)) + "&mold=" + mold + "&" + Math.random(),
  494. width: "550px",
  495. height: "1000px",
  496. callBack: function (iframeId) {
  497. top.frames[iframeId].submitForm();
  498. }
  499. });
  500. }
  501. function btnBatchPrint() {
  502. debugger;
  503. if (mold == '')
  504. {
  505. if (Type == '7') { mold = '00056'; }//普通到货单生成条码
  506. if (Type == '8') { mold = '00057'; }//委外到货单生成条码
  507. }
  508. var objArr = '';
  509. var arr = [];
  510. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  511. if (ids.length == 0) {
  512. $.modalAlertNew("WMS00100");
  513. return;
  514. }
  515. var ID = '';
  516. for (var i in ids) {
  517. ID = $("#gridList").jqGrid('getRowData', ids[i]).ID;
  518. objArr += "'" + ID + "',";
  519. }
  520. objArr = objArr.slice(0, objArr.length - 1);
  521. objArr = "" + objArr + "|";
  522. arr.push(objArr);
  523. var xxx = "";
  524. $.modalOpen({
  525. id: "PrintLot",
  526. title: "打印",
  527. url: "/WMS/Print/PrintView?Arguments=" + encodeURI(encodeURI(arr)) + "&mold=" + mold + "&" + Math.random(),
  528. width: "550px",
  529. height: "1000px",
  530. callBack: function (iframeId) {
  531. top.frames[iframeId].submitForm();
  532. }
  533. });
  534. }
  535. function btn_ExportAll() {
  536. debugger;
  537. var objArr = '';
  538. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  539. for (var i in ids) {
  540. objArr += "'" + $("#gridList").jqGrid('getRowData', ids[i]).ID + "',";
  541. }
  542. if (objArr=="") {
  543. $.modalAlert("请选择单据后导出!");
  544. return;
  545. }
  546. var postData = "&Type=" + Type + "";
  547. //postData += "&ID=" + ID
  548. postData += "&ID=" + objArr;
  549. $.download("/WMS/WMSCreateItemLot/StatementExportAll" + "?" + Math.random(), postData, 'post');
  550. }
  551. function Select_SelGDLX() {
  552. $("#SelGDLX").find("option").remove();
  553. var DeptName = $("#SelGDLX option:checked").text();
  554. $("#SelGDLX").append("<option value=''>--请选择--</option>");
  555. $.ajax({
  556. url: "/WMS/WMSCreateItemLot/SelGDLX" + "?" + Math.random(),
  557. dataType: "json",
  558. async: false,
  559. success: function (data) {
  560. if (data != null && data.length > 0) {
  561. for (var i = 0; i < data.length; i++) {
  562. $("#SelGDLX").append("<option value='" + data[i].Code + "'>" + data[i].Name + "</option>");
  563. }
  564. }
  565. }
  566. });
  567. $("#SelGDLX option:checked").val('');
  568. }
  569. function btnCreateLook() {
  570. var MODetailID = '';
  571. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  572. for (var i = 0; i < objList.length; i++) {
  573. var rowId = objList[i];
  574. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  575. MODetailID = rowData.MODetailID;
  576. }
  577. $.modalOpenClean({
  578. id: "FormMoPick",
  579. title: "工单子件信息",
  580. url: "/WMS/WMSCreateItemLot/FormMoPick" + "?" + Math.random() + "&MODetailID=" + MODetailID,
  581. width: "90%",
  582. height: "90%",
  583. callBack: function (iframeId) {
  584. top.frames[iframeId].submitForm();
  585. }
  586. });
  587. }
  588. function btn_Import() {
  589. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  590. if (objList.length != 1) {
  591. $.modalAlertNew("WMS00100");
  592. return;
  593. }
  594. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  595. for (var i = 0; i < objList.length; i++) {
  596. var rowId = objList[i];
  597. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  598. var Code = rowData.MOCode;
  599. var Sequence = rowData.Sequence;
  600. $.modalOpen({
  601. id: "Upload",
  602. title: "导入",
  603. url: "/WMS/WMSCreateItemLot/ImportLot?Code=" + Code + "&Sequence=" + Sequence + "&" + Math.random(),
  604. width: "400px",
  605. height: "200px",
  606. btn: null,
  607. });
  608. }
  609. }
  610. function btnPrints() {
  611. debugger;
  612. var mold = '';
  613. if (Type == '5') { mold = '00005'; }//其他入库生成条码
  614. var objArr = '';
  615. var arr = [];
  616. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  617. for (var i = 0; i < objList.length; i++) {
  618. var rowId = objList[i];
  619. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  620. objArr += "'" + rowData.ID + "',";
  621. }
  622. objArr = objArr.slice(0, objArr.length - 1);
  623. if (objArr == "") {
  624. $.modalAlertNew("WMS00110");
  625. return;
  626. }
  627. objArr = "" + objArr + "|";
  628. arr.push(objArr);
  629. $.modalOpen({
  630. id: "PrintLot",
  631. title: "打印",
  632. url: "/WMS/Print/PrintViewByLot?Arguments=" + encodeURI(encodeURI(arr)) + "&mold=" + mold + "&" + Math.random(),
  633. width: "550px",
  634. height: "1000px",
  635. callBack: function (iframeId) {
  636. top.frames[iframeId].submitForm();
  637. }
  638. });
  639. }
  640. function btnInWareHouse() {
  641. debugger;
  642. var objArr = '';
  643. var arr = [];
  644. var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  645. for (var i = 0; i < objList.length; i++) {
  646. var rowId = objList[i];
  647. var rowData = $("#gridList").jqGrid('getRowData', rowId);
  648. objArr += "'" + rowData.ID + "',";
  649. }
  650. objArr = objArr.slice(0, objArr.length - 1);
  651. if (objArr == "") {
  652. $.modalAlertNew("WMS00110");
  653. return;
  654. }
  655. arr.push(objArr);
  656. $.submitForm({
  657. url: "/WMS/WMSCreateItemLot/PostInWareHouse" ,
  658. param: {
  659. IDs: JSON.stringify(objArr)
  660. },
  661. success: function () {
  662. $.currentWindow().$("#gridList").trigger("reloadGrid");
  663. }
  664. })
  665. }
  666. function btn_Rebind() {
  667. var objArr = '';
  668. var obj = $("#gridList").jqGrid("getRowData");
  669. for (var i = 0; i < obj.length; i++) {
  670. var $SubGird = $("#gridList_" + obj[i].ID + "_t");
  671. var rowData = $SubGird.jqGrid('getGridParam', 'selarrrow');
  672. if (rowData != "undefined" && rowData != null && rowData.length != 0) {
  673. for (var j = 0; j < rowData.length; j++) {
  674. var rowDataZ = $SubGird.jqGrid('getRowData', rowData[j]);
  675. objArr += "'" + rowDataZ.LotNo + "',";
  676. }
  677. objArr = objArr.slice(0, objArr.length - 1);
  678. }
  679. }
  680. if (objArr == "") {
  681. $.modalAlert("请选择条码信息后,进行重新绑定!");
  682. return;
  683. }
  684. $.modalOpen({
  685. id: "ICSLotRebind",
  686. title: "条码重新绑定",
  687. url: "/WMS/WMSCreateItemLot/ICSLotRebind?LotNo=" + encodeURI(encodeURI(objArr)) + "&" + Math.random(),
  688. width: "500px",
  689. height: "350px",
  690. callBack: function (iframeId) {
  691. top.frames[iframeId].submitForm();
  692. }
  693. });
  694. }
  695. </script>
  696. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  697. <script>
  698. </script>
  699. <div class="topPanel" style="height:145px;">
  700. <div class="toolbar">
  701. <div class="btn-group">
  702. @*<a id="NF-ALLCreate" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnAllCreate()"><i class="fa fa-pencil-square-o"></i>一键生成</a>*@
  703. <a id="NF-Audit" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnAudit()"><i class="fa fa-pencil-square-o"></i>批审</a>
  704. @*<a id="NF-Create" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>生成条码</a>
  705. <a id="NF-Delete" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnDelete()"><i class="fa fa-pencil-square-o"></i>删除条码</a>
  706. <a id="NF-Print" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnPrint()"><i class="fa fa-pencil-square-o"></i>打印</a>
  707. <a id="NF-BatchPrint" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnBatchPrint()"><i class="fa fa-pencil-square-o"></i>批量打印</a>*@
  708. @*<a id="NF-btnInWareHouse" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnInWareHouse()"><i class="fa fa-pencil-square-o"></i>一键退库</a>*@
  709. @*<a id="NF-Prints" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnPrints()"><i class="fa fa-pencil-square-o"></i>单据批量打印</a>*@
  710. @*<a id="NF-ExportAll" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_ExportAll()"><i class="fa fa-pencil-square-o"></i>导出</a>*@
  711. @*<a id="NF-ExportAll" authorize="yes" class="btn btn-default" onclick="btn_ExportAll()"><i class="fa fa-download"></i>导出</a>*@
  712. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  713. </div>
  714. @*<div class="btn-group" style="display:block;padding-left:2px;">*@
  715. @*<a class="btn btn-primary" id="downPrintControl" href="~/PrintActivex.exe" style="display:none">点击下载打印组件</a>
  716. <a id="NF-Import" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_Import()"><i class="fa fa-pencil-square-o"></i>导入</a>*@
  717. @*<a id="NF-Rebind" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_Rebind()"><i class="fa fa-pencil-square-o"></i>重新绑定</a>*@
  718. @*<a id="NF-Looks" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreateLook()"><i class="fa fa-pencil-square-o"></i>查看子件信息</a>*@
  719. @*</div>*@
  720. <script>$('.toolbar').authorizeButton()</script>
  721. </div>
  722. <div class="search">
  723. <table>
  724. <tr>
  725. <td class="POCodeShow" style="text-align:right;"><label class="lglabel " id="POCodeShowLable" for="txt_POCode">&nbsp;&nbsp;&nbsp;&nbsp;</label>单据号:</td>
  726. <td class="POCodeShow">
  727. <div class="input-group">
  728. <input id="txt_POCode" type="text" class="form-control" style="width: 130px;">
  729. </div>
  730. </td>
  731. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
  732. <td>
  733. <div class="input-group">
  734. <input id="txt_InvCode" type="text" class="form-control" style="width: 130px;">
  735. </div>
  736. </td>
  737. <td style="text-align:right;"><label class="lglabel" for="txt_InvName">&nbsp;&nbsp;&nbsp;&nbsp;料品名称</label>:</td>
  738. <td>
  739. <div class="input-group">
  740. <input id="txt_InvName" type="text" class="form-control" style="width: 130px;">
  741. </div>
  742. </td>
  743. </tr>
  744. <tr>
  745. <td class="HideItems3" style="text-align:right;"><label class="lglabel HideItems3" for="txt_InvStd">&nbsp;&nbsp;&nbsp;&nbsp;规格型号</label>:</td>
  746. <td class="HideItems3">
  747. <div class="input-group HideItems3">
  748. <input id="txt_InvStd" type="text" class="form-control" style="width: 130px;">
  749. </div>
  750. </td>
  751. <td style="text-align:right;"><label class="lglabel" for="txt_BatchCode">&nbsp;&nbsp;&nbsp;&nbsp;批次号</label>:</td>
  752. <td>
  753. <div class="input-group">
  754. <input id="txt_BatchCode" type="text" class="form-control" style="width: 130px;">
  755. </div>
  756. </td>
  757. </tr>
  758. <tr>
  759. <td>
  760. <label>&nbsp;&nbsp;&nbsp;是否全部生成:&nbsp;&nbsp;&nbsp;&nbsp;</label>
  761. </td>
  762. <td>
  763. <div class="input-group">
  764. <select id="selShow" name="F_Target" class="form-control" style="width: 130px;">
  765. <option value="0">显示全部</option>
  766. <option value="1">已全部生成</option>
  767. <option value="2" selected="selected">未全部生成</option>
  768. </select>
  769. </div>
  770. </td>
  771. <td class="HideItems3">
  772. <label>&nbsp;&nbsp;&nbsp;条码是否打印:&nbsp;&nbsp;&nbsp;&nbsp;</label>
  773. </td>
  774. <td class="HideItems3">
  775. <div class="input-group HideItems3">
  776. <select id="selPrint" name="selPrint" class="form-control HideItems3" style="width: 130px;">
  777. <option value="0">显示全部</option>
  778. <option value="1">已打印</option>
  779. <option value="2" selected="selected">未打印</option>
  780. </select>
  781. </div>
  782. </td>
  783. <td>
  784. <span class="input-group-btn">
  785. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  786. </span>
  787. </td>
  788. <td class="LocationCode" style="text-align:right;"><label class="lglabel " id="LocationCodeLable" style="margin-left:700px" for="txt_LocationCode">&nbsp;&nbsp;&nbsp;&nbsp;</label>入库库位:</td>
  789. <td class="LocationCode">
  790. <div class="input-group">
  791. <input id="txt_LocationCode" type="text" class="form-control" style="width: 130px">
  792. </div>
  793. </td>
  794. </tr>
  795. </table>
  796. </div>
  797. </div>
  798. <div class="gridPanel">
  799. <table id="gridList"></table>
  800. <div id="gridPager"></div>
  801. </div>