纽威
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.

191 lines
6.2 KiB

3 years ago
3 years ago
3 years ago
  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <script>
  7. $(function () {
  8. gridList();
  9. SireCodeBinding();
  10. LotNoBinding();
  11. });
  12. function gridList() {
  13. var $gridList = $("#gridList");
  14. $gridList.dataGrid({
  15. url: "/WMS/BasicSettings/GetSendContainerLot?" + Math.random(),
  16. height: $(window).height() -50,
  17. width: $(window).width() - 400,
  18. cellEdit: true,
  19. cellsubmit: "clientArray",
  20. colModel: [
  21. { label: "主键", name: "ID", hidden: true, key: true },
  22. {
  23. label: '删除', width: 100, align: 'left',
  24. formatter: btnLook
  25. },
  26. { label: '条码', name: 'LotNo', width: 120, align: 'left' },
  27. { label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
  28. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  29. { label: '规格型号', name: 'InvStd', width: 200, align: 'left' },
  30. { label: '单位', name: 'InvUnit', width: 200, align: 'left' },
  31. { label: '生产日期', name: 'ProductDate', width: 200, align: 'left' },
  32. { label: '数量', name: 'Quantity', width: 200, align: 'left' },
  33. ],
  34. afterSaveCell: function (rowid, cellname, value) {
  35. if (cellname === 'ProjectCN') {
  36. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  37. }
  38. },
  39. width: "100%",
  40. autowidth: true,
  41. rownumbers: true,
  42. viewrecords: true,
  43. });
  44. }
  45. function btnLook(cellvalue, options, rowObject) {
  46. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">删除</a>";
  47. }
  48. function UpLoadClick(ID) {
  49. $("#gridList").delRowData(ID);
  50. }
  51. function SireCodeBinding() {
  52. $("#SireCode").keydown(function (e) {
  53. var curKey = e.which;
  54. debugger;
  55. if (curKey == 13) {
  56. var SireCode = $("#SireCode").val();//需绑定容器
  57. $.ajax({
  58. url: "/WMS/BasicSettings/GetBindContainerID?SireCode=" + SireCode,
  59. dataType: "json",
  60. async: false,
  61. success: function (data) {
  62. debugger;
  63. if (data == "" || data == null) {
  64. $.modalAlertNew("WMS00022");
  65. return;
  66. }
  67. $("#SireID").val(data.rows[0].ID);
  68. $("#LotNo").focus();
  69. }
  70. });
  71. }
  72. });
  73. };
  74. function LotNoBinding() {
  75. $("#LotNo").keydown(function (e) {
  76. var curKey = e.which;
  77. debugger;
  78. if (curKey == 13) {
  79. var LotNo = $("#LotNo").val();//需绑定容器
  80. $.ajax({
  81. url: "/WMS/BasicSettings/GetContainerLotInfo?LotNo=" + LotNo,
  82. dataType: "json",
  83. async: false,
  84. success: function (data) {
  85. debugger;
  86. if (data == "" || data == null) {
  87. $.modalAlertNew("WMS00022");
  88. return;
  89. }
  90. //最后一行新增数据
  91. var obj = {
  92. ID: data.rows[0].ID,
  93. LotNo: data.rows[0].LotNo,
  94. InvCode: data.rows[0].InvCode,
  95. InvName: data.rows[0].InvName,
  96. InvStd: data.rows[0].InvStd,
  97. InvUnit: data.rows[0].InvUnit,
  98. ProductDate: data.rows[0].ProductDate,
  99. Quantity: data.rows[0].Quantity,
  100. };
  101. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'first');
  102. $(".unwritten").hide();
  103. }
  104. });
  105. }
  106. });
  107. };
  108. function submitForm() {
  109. debugger;
  110. var SireID = $("#SireID").val();
  111. var SireCode = $("#SireCode").val();
  112. var ICSMTDOC = [];
  113. var obj_Item1 = $("#gridList");
  114. var rowIds_Item1 = obj_Item1.getDataIDs();
  115. if (rowIds_Item1.length > 0) {
  116. for (var i = 0; i < rowIds_Item1.length; i++) {
  117. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
  118. var obj = {
  119. LotNo: RowData_Item1.LotNo,
  120. };
  121. ICSMTDOC.push(obj);
  122. }
  123. }
  124. debugger;
  125. $.modalConfirm("确定绑定吗?", function (r) {
  126. if (r) {
  127. $.submitForm({
  128. url: "/WMS/BasicSettings/BindingContainerLotID?SireID=" + SireID + "&SireCode=" + SireCode + "&" + Math.random(),
  129. param: { ICSMTDOC: JSON.stringify(ICSMTDOC) },
  130. success: function () {
  131. $.currentWindow().$("#gridList").trigger("reloadGrid");
  132. }
  133. })
  134. }
  135. });
  136. }
  137. </script>
  138. <form id="form1">
  139. <div style="padding-top: 20px; margin-right: 20px;">
  140. <table class="form">
  141. <tr>
  142. <th class="formTitle">容器:</th>
  143. <td class="formValue">
  144. <input id="SireCode" type="text" class="form-control" style="width: 300px;" οnkeydοwn="SireCodeBinding()" />
  145. <input id="SireID" type="text" class="form-control" />
  146. </td>
  147. <th class="formTitle">条码:</th>
  148. <td class="formValue">
  149. <input id="LotNo" type="text" class="form-control" style="width: 300px;" οnkeydοwn="LotNoBinding()" />
  150. </td>
  151. </tr>
  152. </table>
  153. </div>
  154. </form>
  155. <!--色牢度-->
  156. <div class="gridPanel" style="width: 100% ">
  157. <div class="ibox-title">
  158. 子表
  159. </div>
  160. <div class="gridPanel">
  161. <table id="gridList"></table>
  162. </div>
  163. </div>