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.

271 lines
11 KiB

  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. { label: '项目号', name: 'ProjectCode', width: 200, align: 'left',hidden:true },
  34. { label: '批次', name: 'BatchCode', width: 200, align: 'left', hidden: true },
  35. { label: '版本', name: 'Version', width: 200, align: 'left', hidden: true },
  36. { label: '厂牌', name: 'Brand', width: 200, align: 'left', hidden: true },
  37. { label: '自由项1', name: 'cFree1', width: 200, align: 'left', hidden: true },
  38. { label: '自由项2', name: 'cFree2', width: 200, align: 'left', hidden: true },
  39. { label: '自由项3', name: 'cFree3', width: 200, align: 'left', hidden: true },
  40. { label: '自由项4', name: 'cFree4', width: 200, align: 'left', hidden: true },
  41. { label: '自由项5', name: 'cFree5', width: 200, align: 'left', hidden: true },
  42. { label: '自由项6', name: 'cFree6', width: 200, align: 'left', hidden: true },
  43. { label: '自由项7', name: 'cFree7', width: 200, align: 'left', hidden: true },
  44. { label: '自由项8', name: 'cFree8', width: 200, align: 'left', hidden: true },
  45. { label: '自由项9', name: 'cFree9', width: 200, align: 'left', hidden: true },
  46. { label: '自由项10', name: 'cFree10', width: 200, align: 'left', hidden: true },
  47. ],
  48. afterSaveCell: function (rowid, cellname, value) {
  49. if (cellname === 'ProjectCN') {
  50. $gridList.jqGrid("setCell", rowid, 'ProjectID', value);
  51. }
  52. },
  53. width: "100%",
  54. autowidth: true,
  55. rownumbers: true,
  56. viewrecords: true,
  57. });
  58. }
  59. function btnLook(cellvalue, options, rowObject) {
  60. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">删除</a>";
  61. }
  62. function UpLoadClick(ID) {
  63. $("#gridList").delRowData(ID);
  64. }
  65. function SireCodeBinding() {
  66. $("#SireCode").keydown(function (e) {
  67. var curKey = e.which;
  68. debugger;
  69. if (curKey == 13) {
  70. var SireCode = $("#SireCode").val();//需绑定容器
  71. $.ajax({
  72. url: "/WMS/BasicSettings/GetBindContainerID?SireCode=" + SireCode,
  73. dataType: "json",
  74. async: false,
  75. success: function (data) {
  76. debugger;
  77. if (data == "" || data == null) {
  78. $.modalAlertNew("WMS00022");
  79. return;
  80. }
  81. $("#SireID").val(data.rows[0].ID);
  82. $("#LotNo").focus();
  83. }
  84. });
  85. $("#SireCode").attr("disabled", "disabled");
  86. }
  87. });
  88. };
  89. function LotNoBinding() {
  90. $("#LotNo").keydown(function (e) {
  91. var curKey = e.which;
  92. debugger;
  93. if (curKey == 13) {
  94. var LotNo = $("#LotNo").val();//需绑定容器
  95. $.ajax({
  96. url: "/WMS/BasicSettings/GetContainerLotInfo?LotNo=" + LotNo,
  97. dataType: "json",
  98. async: false,
  99. success: function (data) {
  100. debugger;
  101. if (data == "" || data == null) {
  102. $.modalAlertNew("WMS00022");
  103. return;
  104. }
  105. //最后一行新增数据
  106. var obj = {
  107. ID: data.rows[0].ID,
  108. LotNo: data.rows[0].LotNo,
  109. InvCode: data.rows[0].InvCode,
  110. InvName: data.rows[0].InvName,
  111. InvStd: data.rows[0].InvStd,
  112. InvUnit: data.rows[0].InvUnit,
  113. ProductDate: data.rows[0].ProductDate,
  114. Quantity: data.rows[0].Quantity,
  115. ProjectCode: data.rows[0].ProjectCode,
  116. BatchCode: data.rows[0].BatchCode,
  117. Version: data.rows[0].Version,
  118. Brand: data.rows[0].Brand,
  119. cFree1: data.rows[0].cFree1,
  120. cFree2: data.rows[0].cFree2,
  121. cFree3: data.rows[0].cFree3,
  122. cFree4: data.rows[0].cFree4,
  123. cFree5: data.rows[0].cFree5,
  124. cFree6: data.rows[0].cFree6,
  125. cFree7: data.rows[0].cFree7,
  126. cFree8: data.rows[0].cFree8,
  127. cFree9: data.rows[0].cFree9,
  128. cFree10: data.rows[0].cFree10
  129. };
  130. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'first');
  131. $(".unwritten").hide();
  132. }
  133. });
  134. }
  135. });
  136. };
  137. //function submitForm() {
  138. // debugger;
  139. // var SireID = $("#SireID").val();
  140. // var SireCode = $("#SireCode").val();
  141. // var ICSMTDOC = [];
  142. // var obj_Item1 = $("#gridList");
  143. // var rowIds_Item1 = obj_Item1.getDataIDs();
  144. // if (rowIds_Item1.length > 0) {
  145. // for (var i = 0; i < rowIds_Item1.length; i++) {
  146. // var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
  147. // var obj = {
  148. // LotNo: RowData_Item1.LotNo,
  149. // };
  150. // ICSMTDOC.push(obj);
  151. // }
  152. // }
  153. // debugger;
  154. // $.modalConfirm("确定绑定吗?", function (r) {
  155. // if (r) {
  156. // $.submitForm({
  157. // url: "/WMS/BasicSettings/BindingContainerLotID?SireID=" + SireID + "&SireCode=" + SireCode + "&" + Math.random(),
  158. // param: { ICSMTDOC: JSON.stringify(ICSMTDOC) },
  159. // success: function () {
  160. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  161. // }
  162. // })
  163. // }
  164. // });
  165. //}
  166. function submitForm() {
  167. debugger;
  168. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  169. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  170. var SireCode = $("#SireCode").val();//需绑定容器
  171. var date = new Date();
  172. var Details = [];
  173. var obj_Item1 = $("#gridList");
  174. var rowIds_Item1 = obj_Item1.getDataIDs();
  175. if (rowIds_Item1.length > 0) {
  176. for (var i = 0; i < rowIds_Item1.length; i++) {
  177. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
  178. var obj = {
  179. LotNo: RowData_Item1.LotNo,
  180. ContainerCode: SireCode,
  181. ProjectCode: RowData_Item1.ProjectCode,
  182. BatchCode: RowData_Item1.BatchCode,
  183. Version: RowData_Item1.Version,
  184. Brand: RowData_Item1.Brand,
  185. cFree1: RowData_Item1.cFree1,
  186. cFree2: RowData_Item1.cFree2,
  187. cFree3: RowData_Item1.cFree3,
  188. cFree4: RowData_Item1.cFree4,
  189. cFree5: RowData_Item1.cFree5,
  190. cFree6: RowData_Item1.cFree6,
  191. cFree7: RowData_Item1.cFree7,
  192. cFree8: RowData_Item1.cFree8,
  193. cFree9: RowData_Item1.cFree9,
  194. cFree10: RowData_Item1.cFree10,
  195. };
  196. Details.push(obj);
  197. }
  198. }
  199. var Header = {
  200. WorkPoint: WorkPoint,
  201. User: RoleEnCode,
  202. detail:Details
  203. }
  204. var Parameter = [];
  205. Parameter.push(Header);
  206. $.modalConfirm("确定绑定吗?", function (r) {
  207. $.submitForm({
  208. url: "/WMS/BasicSettings/BindingContainerLotID?SireID="+ "?" + Math.random(),
  209. param: { keyValue: JSON.stringify(Parameter) },
  210. success: function () {
  211. $.currentWindow().$("#gridList").trigger("reloadGrid");
  212. }
  213. })
  214. })
  215. }
  216. </script>
  217. <form id="form1">
  218. <div style="padding-top: 20px; margin-right: 20px;">
  219. <table class="form">
  220. <tr>
  221. <th class="formTitle">容器:</th>
  222. <td class="formValue">
  223. <input id="SireCode" type="text" class="form-control" style="width: 300px;" οnkeydοwn="SireCodeBinding()" />
  224. <input id="SireID" type="text" class="form-control" style="display:none" />
  225. </td>
  226. <th class="formTitle">条码:</th>
  227. <td class="formValue">
  228. <input id="LotNo" type="text" class="form-control" style="width: 300px;" οnkeydοwn="LotNoBinding()" />
  229. </td>
  230. </tr>
  231. </table>
  232. </div>
  233. </form>
  234. <!--色牢度-->
  235. <div class="gridPanel" style="width: 100% ">
  236. <div class="ibox-title">
  237. 子表
  238. </div>
  239. <div class="gridPanel">
  240. <table id="gridList"></table>
  241. </div>
  242. </div>