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.

512 lines
21 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 Name = "单据号";
  10. var ColModelMain = [];
  11. var ColModelSub = [];
  12. $(function () {
  13. SetCols();
  14. $(".GDLX").css('display', 'block');
  15. gridList();
  16. })
  17. function SetCols() {
  18. $.ajax({
  19. url: "/Print/SelectColumnName?" + Math.random(),
  20. dataType: "json",
  21. async: false,
  22. success: function (data) {
  23. var cols = new Array();
  24. var cols1 = new Array();
  25. var collast = { label: "主键", name: "ID", hidden: true, key: true };
  26. cols.push(collast);
  27. var collast = { label: '入库单号', name: 'RCVCode', width: 120, align: 'left' };
  28. cols.push(collast);
  29. var collast = { label: '入库单行号', name: 'Sequence', width: 50, align: 'left' };
  30. cols.push(collast);
  31. var collast = { label: '工单号', name: 'ProductionCode', width: 120, align: 'left' };
  32. cols.push(collast);
  33. var collast = { label: '料品代码', name: 'InvCode', width: 120, align: 'left' };
  34. cols.push(collast);
  35. var collast = { label: '料品名称', name: 'InvName', width: 150, align: 'left', };
  36. cols.push(collast);
  37. var collast = { label: '规格型号', name: 'InvStd', width: 120, align: 'left', };
  38. cols.push(collast);
  39. var collast = { label: '入库数量', name: 'Quantity', width: 60, align: 'left' };
  40. cols.push(collast);
  41. var collast = { label: '已绑定数量', name: 'BoundQuantity', width: 150, align: 'left' };
  42. cols.push(collast);
  43. var collast = { label: '入库仓库', name: 'WHCode', width: 150, align: 'left' };
  44. cols.push(collast);
  45. var collast = { label: '创建人', name: 'CreatePerson', width: 150, align: 'left', };
  46. cols.push(collast);
  47. var collast = { label: '创建时间', name: 'CreateDateTime', width: 150, align: 'left', };
  48. cols.push(collast);
  49. var collast = { label: '是否入库', name: 'IsWH', width: 100, align: 'left' };
  50. cols.push(collast);
  51. $.ajax({
  52. url: "/Print/SelectTableColumnName?" + Math.random(),
  53. dataType: "json",
  54. async: false,
  55. success: function (data) {
  56. if (data != null && data.length > 0) {
  57. DateList = data;
  58. for (var i = 0; i < data.length; i++) {
  59. var TableCode = data[i].TableCode;
  60. if (TableCode == "ICSManufactureReceive") {
  61. var Code = data[i].Code;
  62. var Name = data[i].Name;
  63. var obj = new Array();
  64. obj = {
  65. label: Name,
  66. name: Code,
  67. width: 80,
  68. align: "left"
  69. }
  70. cols.push(obj);
  71. }
  72. }
  73. }
  74. _Clos = cols;
  75. //_Clos1 = cols1;
  76. }
  77. });
  78. var collast1 = { label: "主键", name: "ID", hidden: true, key: true };
  79. cols1.push(collast1);
  80. var collast1 = { label: '条码', name: 'LotNo', width: 200, align: 'left' };
  81. cols1.push(collast1);
  82. var collast1 = { label: '条码数量', name: 'Quantity', width: 80, align: 'left' };
  83. cols1.push(collast1);
  84. var collast1 = { label: '辅计量数量', name: 'Amount', width: 80, align: 'left' };
  85. cols1.push(collast1);
  86. //var collast1 = { label: '炉批号', name: 'EATTRIBUTE4', width: 100, align: 'left' };
  87. //cols1.push(collast1);
  88. var collast1 = { label: '备注', name: 'EATTRIBUTE5', width: 100, align: 'left' };
  89. cols1.push(collast1);
  90. var collast1 = { label: '操作人', name: 'MUSERName', width: 100, align: 'left' };
  91. cols1.push(collast1);
  92. var collast1 = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
  93. cols1.push(collast1);
  94. var collast1 = { label: '是否打印', name: 'isPrint', width: 150, align: 'left' };
  95. cols1.push(collast1);
  96. _Clos = cols;
  97. _Clos1 = cols1;
  98. }
  99. });
  100. }
  101. //产成品入库单
  102. function gridList() {
  103. var $gridList = $("#gridList");
  104. var queryJson = {
  105. POCode: $("#txt_POCode").val(),
  106. InvCode: $("#txt_InvCode").val(),
  107. InvName: $("#txt_InvName").val(),
  108. BatchCode: $("#txt_BatchCode").val(),
  109. POStatus: $("#selShow").val(),
  110. WHStatus: $("#selStatus").val(),
  111. InvStd: $("#txt_InvStd").val(),
  112. }
  113. $gridList.dataGrid({
  114. url: "/KBSWMS/ICSManufactureReceive/GetManufactureReceive" + "?" + Math.random(),
  115. postData: { queryJson: JSON.stringify(queryJson) },
  116. height: $(window).height() - 200,
  117. width: $(window).width() - 300,
  118. colModel: _Clos,
  119. width: "100%",
  120. autowidth: true,
  121. //shrinkToFit: true,
  122. gridComplete: function () {
  123. },
  124. pager: "#gridPager",
  125. //sortname: 'MOCode,cast(Sequence as int)',
  126. sortname: "RCVCode,Sequence ",
  127. sortorder: "asc",
  128. viewrecords: true,
  129. multiselect: true,
  130. //beforeSelectRow: function (rowid, e) {
  131. // $("#gridList").jqGrid('resetSelection');
  132. // return (true);
  133. //},
  134. //subGrid: true, // (1)开启子表格支持
  135. //subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
  136. // $("#gridList").jqGrid("setSelection", rowid, false);
  137. // bindSubGrid3(subgrid_id, rowid)
  138. //}
  139. });
  140. $("#warehouse a.btn-default").click(function () {
  141. $("#warehouse a.btn-default").removeClass("active");
  142. $(this).addClass("active");
  143. $('#btn_search').trigger("click");
  144. });
  145. $("#btn_search").click(function () {
  146. var warehouse = $("#warehouse a.active").attr('data-value');
  147. var queryJson = {
  148. POCode: $("#txt_POCode").val(),
  149. InvCode: $("#txt_InvCode").val(),
  150. InvName: $("#txt_InvName").val(),
  151. BatchCode: $("#txt_BatchCode").val(),
  152. POStatus: $("#selShow").val(),
  153. WHStatus: $("#selStatus").val(),
  154. InvStd: $("#txt_InvStd").val(),
  155. }
  156. $gridList.jqGrid('setGridParam', {
  157. postData: { queryJson: JSON.stringify(queryJson) },
  158. }).trigger('reloadGrid');
  159. });
  160. }
  161. function bindSubGrid3(subgrid_id, rowid) {
  162. $("#gridList").jqGrid("setSelection", rowid, false);
  163. var subgrid_table_id;
  164. subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
  165. var subgrid_pager_id;
  166. subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
  167. // (5)动态添加子报表的table和pager
  168. $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
  169. var MOCode = $("#gridList").jqGrid('getRowData', rowid).MOCode;
  170. var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
  171. var isPrint = $("#selPrint").val();
  172. // (6)创建jqGrid对象
  173. $("#" + subgrid_table_id).dataGrid({
  174. cellEdit: true,
  175. url: "/KBSWMS/WMSCreateItemLot/GetSubGridJson?ApplyNegCode=" + MOCode + "&Sequence=" + Sequence + "&isPrint=" + isPrint + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
  176. colModel: _Clos1,
  177. shrinkToFit: true,//宽度自适应
  178. multiselect: false,
  179. prmNames: { search: "search" },
  180. viewrecords: true,
  181. height: "100%",
  182. rowNum: 20,
  183. pager: subgrid_pager_id,
  184. });
  185. }
  186. function btnDelete() {
  187. debugger;
  188. var MOCodes='';
  189. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  190. if (ids.length < 1) {
  191. $.modalAlertNew("WMS00100");
  192. return;
  193. }
  194. for (var i in ids) {
  195. var MOCode = $("#gridList").jqGrid('getRowData', ids[i]).MOCode;
  196. MOCodes += "'" + MOCode + "',";
  197. }
  198. MOCodes = MOCodes.slice(0, MOCodes.length - 1);
  199. $.deleteForm({
  200. url: "/KBSWMS/WMSCreateItemLot/DeleteItemLot",
  201. param: { MOCodes: JSON.stringify(MOCodes) },
  202. success: function (data) {
  203. if (data.state == "success") {
  204. $.currentWindow().$("#gridList").trigger("reloadGrid");
  205. }
  206. else {
  207. alert(data.messages);
  208. }
  209. }
  210. })
  211. }
  212. function dateChange(num, date) {
  213. if (!date) {
  214. date = new Date();//没有传入值时,默认是当前日期
  215. date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
  216. }
  217. date += " 00:00:00";//设置为当天凌晨12点
  218. date = Date.parse(new Date(date)) / 1000;//转换为时间戳
  219. date += (86400) * num;//修改后的时间戳
  220. var newDate = new Date(parseInt(date) * 1000);//转换为时间
  221. return newDate.getFullYear() + '-' + (newDate.getMonth() + 1) + '-' + newDate.getDate();
  222. }
  223. function btnBind() {
  224. debugger;
  225. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  226. var objects = [];
  227. if (ids.length != 1) {
  228. $.modalAlertNew("WMS00079");
  229. return;
  230. }
  231. var RCVCode = $("#gridList").jqGrid('getRowData', ids[0]).RCVCode;
  232. var Sequence = $("#gridList").jqGrid('getRowData', ids[0]).Sequence;
  233. var ProductionCode = $("#gridList").jqGrid('getRowData', ids[0]).ProductionCode;
  234. var Quantity = $("#gridList").jqGrid('getRowData', ids[0]).Quantity;
  235. var InvCode = $("#gridList").jqGrid('getRowData', ids[0]).InvCode;
  236. var InvName = $("#gridList").jqGrid('getRowData', ids[0]).InvName;
  237. var WHCode = $("#gridList").jqGrid('getRowData', ids[0]).WHCode;
  238. var BoundQuantity = $("#gridList").jqGrid('getRowData', ids[0]).BoundQuantity;
  239. $.modalOpen({
  240. id: "BindAdd",
  241. title: "绑定条码",
  242. url: "/KBSWMS/ICSManufactureReceive/BindAdd" + "?" + Math.random() + "&RCVCode=" + RCVCode + "&Sequence=" + Sequence + "&ProductionCode=" + ProductionCode + "&Quantity=" + Quantity + "&InvCode=" + InvCode + "&InvName=" + encodeURI(encodeURI(InvName)) + "&WHCode=" + WHCode + "&BoundQuantity=" + BoundQuantity,
  243. width: "70%",
  244. height: "70%",
  245. callBack: function (iframeId) {
  246. top.frames[iframeId].submitForm();
  247. }
  248. });
  249. }
  250. function btn_UnBind() {
  251. debugger;
  252. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  253. var objects = [];
  254. if (ids.length != 1) {
  255. $.modalAlertNew("WMS00079");
  256. return;
  257. }
  258. for (var i = 0; i < ids.length; i++){
  259. objects.push(ids[i]);
  260. }
  261. $.submitForm({
  262. url: "/KBSWMS/ICSManufactureReceive/PostUnBind",
  263. param: { ids: JSON.stringify(objects) },
  264. success: function (data) {
  265. if (data.state == "success") {
  266. $.currentWindow().$("#gridList").trigger("reloadGrid");
  267. }
  268. else {
  269. alert(data.messages);
  270. }
  271. }
  272. })
  273. }
  274. function btn_Examine() {
  275. debugger;
  276. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  277. var objects = [];
  278. if (ids.length < 1) {
  279. $.modalAlertNew("WMS00077");
  280. return;
  281. }
  282. for (var i = 0; i < ids.length; i++) {
  283. var RCVCode = $("#gridList").jqGrid('getRowData', ids[0]).RCVCode;
  284. objects.push(RCVCode);
  285. }
  286. $.submitForm({
  287. url: "/KBSWMS/ICSManufactureReceive/PostExamine",
  288. param: { RCVCodes: JSON.stringify(objects) },
  289. success: function (data) {
  290. if (data.state == "success") {
  291. $.currentWindow().$("#gridList").trigger("reloadGrid");
  292. }
  293. else {
  294. alert(data.messages);
  295. }
  296. }
  297. })
  298. }
  299. function fullscreen() {
  300. var docElm = document.documentElement;
  301. if (docElm.requestFullscreen) {
  302. docElm.requestFullscreen();
  303. } else if (docElm.mozRequestFullScreen) {
  304. docElm.mozRequestFullScreen();
  305. } else if (docElm.webkitRequestFullScreen) {
  306. docElm.webkitRequestFullScreen();
  307. } else if (docElm.msRequestFullscreen) {
  308. docElm.msRequestFullscreen();
  309. }
  310. $(window).bind('resize', function () {
  311. $("#gridList").setGridWidth($(window).width());
  312. }).trigger('resize');
  313. $(window).bind('resize', function () {
  314. $("#gridList").setGridHeight($(window).height());
  315. }).trigger('resize');
  316. }
  317. function btnPrint() {
  318. debugger;
  319. var MOCodes = [];
  320. var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  321. if (ids.length < 1) {
  322. $.modalAlertNew("WMS00100");
  323. return;
  324. }
  325. for (var i in ids) {
  326. var MOCode = $("#gridList").jqGrid('getRowData', ids[i]).MOCode;
  327. MOCodes.push(MOCode);
  328. }
  329. $.submitForm({
  330. url: "/KBSWMS/CreateItemLot/PrintViewByLot",
  331. param: { MOCodes: JSON.stringify(MOCodes) },
  332. success: function (data) {
  333. if (data.state == "success") {
  334. $.currentWindow().$("#gridList").trigger("reloadGrid");
  335. }
  336. else {
  337. alert(data.messages);
  338. }
  339. }
  340. })
  341. }
  342. function btn_ImPort() {
  343. $("#FileUp").click();
  344. }
  345. function btnInvBadGroup(up) {
  346. debugger;
  347. var form = new FormData(document.getElementById("form1"));
  348. $.ajax({
  349. url: "/KBSWMS/ICSManufactureReceive/UploadFileBinding?" + Math.random(),
  350. type: "post",
  351. data: form,
  352. contentType: false,
  353. processData: false,
  354. success: function (data) {
  355. if (data == "导入成功") {
  356. debugger;
  357. $.modalMsg('导入成功', "success");
  358. $.currentWindow().$("#gridList").trigger("reloadGrid");
  359. //alert("导入成功");
  360. }
  361. else {
  362. $.modalMsg(data, "warning");
  363. }
  364. },
  365. error: function (aa) {
  366. $.modalMsg(aa, "error");
  367. // alert("导入失败:" + aa);
  368. }
  369. });
  370. document.getElementById("FileUp").value = "";
  371. }
  372. </script>
  373. <iframe id="ifrm" src="" width="0" height="0"></iframe>
  374. <form id="form1">
  375. <div class="topPanel" style="height:120px;">
  376. <div class="toolbar">
  377. <div class="btn-group">
  378. <input id="FileUp" name="FileUp" type="file" style="display:none;" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" onchange="btnInvBadGroup(this)" />
  379. <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>
  380. <a href="~/File/Stack/生产入库单绑定条码模板.xlsx" id="NF-IntroductionMould" style="margin-left:3px;" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_IntroductionMould()"><i class="fa fa-file-excel-o"></i>导入模板下载</a>
  381. </div>
  382. <div class="btn-group" style="display:block;padding-left:2px;">
  383. <a id="NF-Bind" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnBind()"><i class="fa fa-pencil-square-o"></i>绑定条码</a>
  384. <a id="NF-UnBind" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_UnBind()"><i class="fa fa-pencil-square-o"></i>解绑条码</a>
  385. <a id="NF-Examine" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btn_Examine()"><i class="fa fa-pencil-square-o"></i>提交过帐</a>
  386. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  387. </div>
  388. <script>$('.toolbar').authorizeButton()</script>
  389. </div>
  390. <div class="search">
  391. <table>
  392. <tr>
  393. <td class="POCodeShow" style="text-align:right;"><label class="lglabel " id="POCodeShowLable" for="txt_POCode">&nbsp;&nbsp;&nbsp;&nbsp;单据号</label>:</td>
  394. <td class="POCodeShow">
  395. <div class="input-group">
  396. <input id="txt_POCode" type="text" class="form-control" style="width: 130px;">
  397. </div>
  398. </td>
  399. <td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
  400. <td>
  401. <div class="input-group">
  402. <input id="txt_InvCode" type="text" class="form-control" style="width: 130px;">
  403. </div>
  404. </td>
  405. <td style="text-align:right;"><label class="lglabel" for="txt_InvName">&nbsp;&nbsp;&nbsp;&nbsp;料品名称</label>:</td>
  406. <td>
  407. <div class="input-group">
  408. <input id="txt_InvName" type="text" class="form-control" style="width: 130px;">
  409. </div>
  410. </td>
  411. </tr>
  412. <tr>
  413. <td class="HideItems3" style="text-align:right;"><label class="lglabel HideItems3" for="txt_InvStd">&nbsp;&nbsp;&nbsp;&nbsp;规格型号</label>:</td>
  414. <td class="HideItems3">
  415. <div class="input-group HideItems3">
  416. <input id="txt_InvStd" type="text" class="form-control" style="width: 130px;">
  417. </div>
  418. </td>
  419. <td style="text-align:right;"><label class="lglabel" for="txt_BatchCode">&nbsp;&nbsp;&nbsp;&nbsp;批次号</label>:</td>
  420. <td>
  421. <div class="input-group">
  422. <input id="txt_BatchCode" type="text" class="form-control" style="width: 130px;">
  423. </div>
  424. </td>
  425. <td clsaa="Status">
  426. <label>&nbsp;&nbsp;&nbsp;是否入库:&nbsp;&nbsp;&nbsp;&nbsp;</label>
  427. </td>
  428. <td clsaa="Status">
  429. <div class="input-group">
  430. <select id="selStatus" name="F_Target" class="form-control" style="width: 130px;">
  431. <option value="1">是</option>
  432. <option value="0" selected="selected">否</option>
  433. </select>
  434. </div>
  435. </td>
  436. <td>
  437. <span class="input-group-btn">
  438. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  439. </span>
  440. </td>
  441. </tr>
  442. </table>
  443. </div>
  444. </div>
  445. <div class="gridPanel">
  446. <table id="gridList"></table>
  447. <div id="gridPager"></div>
  448. </div>
  449. </form>