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.

204 lines
7.7 KiB

3 weeks ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. @*<link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  6. <script src="~/Content/js/select2/select2.min.js"></script>*@
  7. <link href="~/Content/css/CommonReport/CommonReport.css" rel="stylesheet" />
  8. <script src="~/Content/js/CommonReport/CommonReport.js"></script>
  9. <link href="~/Content/css/bootstrap/bootstrap-select.css" rel="stylesheet" />
  10. <script src="~/Content/js/bootstrap/bootstrap-select.min.js"></script>
  11. <style>
  12. .form {
  13. margin: 25px 15px;
  14. }
  15. </style>
  16. <style>
  17. .td {
  18. padding: 0 5px 0 5px;
  19. }
  20. </style>
  21. <script>
  22. var WorkPoints = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  23. var User = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  24. var Times = new Date();
  25. var Time = formatDate("YYYY-mm-dd HH:MM:SS", Times);
  26. $(function () {
  27. $("#txtMUSER").val(User);
  28. $("#txtMTIME").val(Time);
  29. $("#txtMUSER").attr("disabled", "disabled");
  30. $("#txtMTIME").attr("disabled", "disabled");
  31. gridList();
  32. })
  33. function guid() {
  34. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  35. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  36. return v.toString(16);
  37. });
  38. }
  39. function formatDate(fomatType, date) {
  40. let ret;
  41. let valueDate = date;
  42. if (!date) valueDate = new Date()
  43. let opt = {
  44. "Y+": valueDate.getFullYear().toString(), // 年
  45. "m+": (valueDate.getMonth() + 1).toString(), // 月
  46. "d+": valueDate.getDate().toString(), // 日
  47. "H+": valueDate.getHours().toString(), // 时
  48. "M+": valueDate.getMinutes().toString(), // 分
  49. "S+": valueDate.getSeconds().toString() // 秒
  50. };
  51. for (let k in opt) {
  52. ret = new RegExp("(" + k + ")").exec(fomatType);
  53. if (ret) {
  54. fomatType = fomatType.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
  55. };
  56. };
  57. return fomatType;
  58. }
  59. function gridList() {
  60. debugger;
  61. document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> <div id="gridPager"></div>';//重置grid
  62. var $gridList = $("#gridList");
  63. var queryJson = {
  64. InvCode: $("#txt_InvCode").val(),
  65. InvName: $("#txt_InvName").val(),
  66. InvStd: $("#txt_InvStd").val(),
  67. }
  68. $gridList.dataGrid({
  69. url: "/PNWMS/Blitem/GetGridJsonInv" + "?" + Math.random(),
  70. postData: { queryJson: JSON.stringify(queryJson), WorkPoint: JSON.stringify(WorkPoints) },
  71. height: $(window).height() - 120,
  72. width: $(window).width() - 180,
  73. colModel: [
  74. { label: "主键", name: "ID", hidden: true, key: true },
  75. { label: '物料编码', name: 'InvCode', width: 150, align: 'left' },
  76. { label: '规格型号', name: 'InvStd', width: 200, align: 'left' },
  77. { label: '物料名称', name: 'InvName', width: 100, align: 'left' },
  78. //{ label: '可用数量', name: 'Quantity', width: 100, align: 'left' },
  79. ],
  80. sortname: 'InvCode,InvName',
  81. shrinkToFit: true,//宽度自适应
  82. pager: "#gridPager",
  83. //sortname: 'ID',
  84. viewrecords: true,
  85. multiselect: true,
  86. rowNum: 10000
  87. });
  88. $("#btn_search").click(function () {
  89. debugger;
  90. var queryJson = {
  91. InvCode: $("#txt_InvCode").val(),
  92. InvName: $("#txt_InvName").val(),
  93. InvStd: $("#txt_InvStd").val(),
  94. }
  95. $gridList.jqGrid('setGridParam', {
  96. postData: { queryJson: JSON.stringify(queryJson) },
  97. page: 1
  98. }).trigger('reloadGrid');
  99. });
  100. }
  101. //提交
  102. function submitForm() {
  103. debugger;
  104. var Details = [];
  105. var rows = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  106. if (rows.length < 1) {
  107. $.modalAlertNew("WMS00079");
  108. return;
  109. }
  110. for (var i = 0; i < rows.length; i++) {
  111. var obj = {
  112. SelectLevel: "",
  113. InvCode: $("#gridList").jqGrid('getRowData', rows[i]).InvCode,
  114. };
  115. Details.push(obj);
  116. }
  117. var Header = {
  118. User: User,
  119. MTIME: Time,
  120. WorkPoint: WorkPoints,
  121. Detail: Details,
  122. }
  123. var Parameter = [];
  124. Parameter.push(Header);
  125. $.submitForm({
  126. url: "/PNWMS/Blitem/AddICSCheck?" + Math.random(),
  127. param: { Parameter: JSON.stringify(Parameter) },
  128. success: function () {
  129. $.currentWindow().$("#gridList").trigger("reloadGrid");
  130. }
  131. })
  132. }
  133. function Close() {
  134. $.modalClose();
  135. }
  136. </script>
  137. <form id="form1">
  138. <div class="topPanel" style="height:50px">
  139. <div class="search">
  140. <table>
  141. <tr>
  142. <td style="text-align:right;padding: 0 5px 0 5px;">
  143. <label>维护人:</label>
  144. </td>
  145. <td>
  146. <div class="input-group">
  147. <input id="txtMUSER" type="text" class="form-control" placeholder="维护人" style="width: 100px;">
  148. </div>
  149. </td>
  150. <td style="text-align:right;padding: 0 5px 0 5px;">
  151. <label>维护日期:</label>
  152. </td>
  153. <td>
  154. <div class="input-group">
  155. <input id="txtMTIME" type="text" class="form-control" placeholder="维护日期" style="width: 100px;">
  156. </div>
  157. </td>
  158. <td style="text-align:right;padding: 0 5px 0 5px;">
  159. <label>物料编码:</label>
  160. </td>
  161. <td>
  162. <div class="input-group">
  163. <input id="txt_InvCode" type="text" class="form-control" placeholder="物料编码" style="width: 100px;">
  164. </div>
  165. </td>
  166. <td style="text-align:right;padding: 0 5px 0 5px;">
  167. <label>物料名称:</label>
  168. </td>
  169. <td>
  170. <div class="input-group">
  171. <input id="txt_InvName" type="text" class="form-control" placeholder="物料名称" style="width: 100px;">
  172. </div>
  173. </td>
  174. <td style="text-align:right;padding: 0 5px 0 5px;">
  175. <label>物料规格:</label>
  176. </td>
  177. <td>
  178. <div class="input-group">
  179. <input id="txt_InvStd" type="text" class="form-control" placeholder="物料规格" style="width: 100px;">
  180. </div>
  181. </td>
  182. <td>
  183. <span class="input-group-btn" style="padding-left:10px;">
  184. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  185. </span>
  186. </td>
  187. </tr>
  188. </table>
  189. </div>
  190. </div>
  191. <div class="gridPanel" id="gridPanel">
  192. <table id="gridList"></table>
  193. <div id="gridPager"></div>
  194. </div>
  195. </form>