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

259 lines
8.8 KiB

  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Index.cshtml";
  5. }
  6. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  7. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  8. <script src="~/Content/js/select2/select2.min.js"></script>
  9. <style>
  10. #Additem {
  11. margin-left: 45%;
  12. }
  13. #AddTemitem {
  14. margin-right: 45%;
  15. }
  16. </style>
  17. <script>
  18. var rfqcode = $.request("rfqcode");
  19. var ID = $.request("ID");
  20. var ApplyNegCode = $.request("ApplyNegCode");
  21. var WHCode = $.request("WHCode");
  22. $(function () {
  23. InitControl();
  24. var Muser = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  25. var now = new Date();
  26. var date = now.toLocaleDateString();
  27. $("#txtMUSER").val(Muser);
  28. $("#txtMTIME").val(date);
  29. $("#txtApplyNegCode").val(ApplyNegCode);
  30. $("#sel_WHCode").val([WHCode]).trigger("change");
  31. ClearTemp();
  32. reloadData();
  33. })
  34. function reloadData() {
  35. $("#gridList").dataGrid({
  36. url: "/WMS/MaterialsDeliveredRTM/GetICSMOApplyNegDetailTemp?ApplyNegCode=" + $("#txtApplyNegCode").val() + "&" + Math.random(),
  37. //postData: { rfqno: $("#RFQNO").val() },
  38. height: $(window).height() - 200,
  39. width: $(window).width(),
  40. cellEdit: true,
  41. colModel: [
  42. { label: '主键', name: 'ID', width: 150, align: 'left' ,hidden: true, key: true },
  43. { label: 'ID', name: 'ID', hidden: true },
  44. {
  45. label: '查看', width: 100, align: 'left',
  46. formatter: btnLook
  47. },
  48. { label: '退料子ID', name: 'TLZID', hidden: true },
  49. { label: '退料单号', name: 'ApplyNegCode', width: 150, align: 'left' },
  50. { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  51. { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  52. { label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  53. { label: '数量', name: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } },
  54. { label: '辅计量数量', name: 'Amount', width: 150, align: 'left' },
  55. { label: '单位', name: 'InvUnit', width: 100, align: 'left' },
  56. { label: '子件ID', name: 'ZJID', width: 100, align: 'left' },
  57. { label: '已发数量', name: 'IssueNegQuantity', width: 100, align: 'left' },
  58. { label: '自由项ID', name: 'ExtensionID', hidden: true },
  59. ],
  60. cellsubmit: "clientArray",
  61. width: "100%",
  62. autowidth: true,
  63. rownumbers: true,
  64. viewrecords: true,
  65. });
  66. }
  67. function btnLook(cellvalue, options, rowObject) {
  68. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "','" + rowObject.TLZID + "')\">查看</a>";
  69. }
  70. function UpLoadClick(ID,TLZID) {
  71. debugger;
  72. $.modalOpen({
  73. id: "selectDeatil",
  74. title: "查看修改物料",
  75. url: "/WMS/MaterialsDeliveredRTM/SeachPRInventory?TLZID=" + TLZID + "&Type=" + 1 + "&TLZID=" + TLZID + "&" + Math.random(),
  76. width: "1000px",
  77. height: "1000px",
  78. callBack: function (iframeId) {
  79. top.frames[iframeId].submitForm();
  80. top.frames[iframeId].Close();
  81. $("#gridList").jqGrid().setGridParam({ datatype: 'json' }, { postData: { rfqno: $("#RFQNO").val() } }).trigger('reloadGrid');
  82. }
  83. });
  84. }
  85. function guid() {
  86. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  87. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  88. return v.toString(16);
  89. });
  90. }
  91. //最后一行新增数据
  92. function AddRowToLast() {
  93. var obj = {
  94. ID: guid(),
  95. };
  96. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'last');
  97. $(".unwritten").hide();
  98. }
  99. function DeleteRowToLast() {
  100. debugger;
  101. var rowid = $("#gridList").jqGridRowValue().ID
  102. $("#gridList").delRowData(rowid);
  103. }
  104. function InitControl() {
  105. var $VenCode = $("#sel_WHCode");
  106. $VenCode.select2({
  107. allowClear: true,
  108. escapeMarkup: function (m) {
  109. return m;
  110. }
  111. });
  112. $.ajax({
  113. url: "/WMS/ProductionIssue/GetWHCode" + "?" + Math.random(),
  114. dataType: "json",
  115. async: false,
  116. success: function (data) {
  117. $.each(data, function (index, item) {
  118. $VenCode.append("<option value='" + item.WarehouseCode + "'>&nbsp;" + item.WarehouseName + "</option>");
  119. });
  120. }
  121. });
  122. }
  123. function ClearTemp() {
  124. $.ajax({
  125. url: "/WMS/MaterialsDeliveredRTM/ClearTemp?" + Math.random(),
  126. datatype: "json",
  127. async: false
  128. })
  129. }
  130. function submitForm() {
  131. var WHCode = $("#sel_WHCode").val();
  132. if (WHCode=="") {
  133. $.modalAlert("请选择仓库!");
  134. return;
  135. }
  136. debugger;
  137. var IDlist = "";
  138. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  139. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  140. var date = new Date();
  141. var Details = [];
  142. var obj_vendor = $("#gridList");
  143. var rowIds_vendor = obj_vendor.getDataIDs();
  144. var arrayData_vendor = new Array();
  145. if (rowIds_vendor.length > 0) {
  146. for (var i = 0; i < rowIds_vendor.length; i++) {
  147. var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
  148. if (vendorRowData.Quantity == '0' || vendorRowData.Quantity==0) {
  149. $.modalAlert("请输入数量!");
  150. return;
  151. }
  152. var obj = {
  153. Sequence: i + 1,
  154. DetailID:vendorRowData.TLZID,
  155. InvCode: vendorRowData.InvCode,
  156. Quantity: vendorRowData.Quantity,
  157. Amount: vendorRowData.Amount,
  158. SourceDetailID: vendorRowData.ZJID,
  159. ExtensionID: vendorRowData.ExtensionID,
  160. };
  161. Details.push(obj);
  162. }
  163. var ICSASNs = {
  164. ID:ID,
  165. WHCode: WHCode,
  166. User: RoleEnCode,
  167. MTIME: date,
  168. WorkPoint: WorkPoint,
  169. Type:'3',
  170. Detail: Details,
  171. }
  172. var ICSASN = [];
  173. ICSASN.push(ICSASNs);
  174. $.submitForm({
  175. url: "/WMS/MaterialsDeliveredRTM/UpdateICSMOApplyNeg?" + Math.random(),
  176. param: { ICSASN: JSON.stringify(ICSASN) },
  177. success: function () {
  178. $.currentWindow().$("#gridList").trigger("reloadGrid");
  179. }
  180. })
  181. }
  182. }
  183. </script>
  184. <form id="form1">
  185. <div class="topPanel" style="height:10px">
  186. <div class="btn-group">
  187. </div>
  188. </div>
  189. <div style="margin-right: 20px;">
  190. <table class="form">
  191. <thead>主表信息</thead>
  192. <tr>
  193. <th class="formTitle MOPick">退料单号:</th>
  194. <td class="formValue MOPick">
  195. <input type="text" id="txtApplyNegCode" class="form-control" />
  196. </td>
  197. <th class="formTitle">仓库编码:</th>
  198. <td class="formValue">
  199. <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width: 230px" placeholder="请选择供应商编码..."></select>
  200. <input type="hidden" id="hidetext" />
  201. </td>
  202. </tr>
  203. <tr>
  204. <th class="formTitle">维护人:</th>
  205. <td class="formValue">
  206. <input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
  207. </td>
  208. <th class="formTitle">维护时间:</th>
  209. <td class="formValue">
  210. <input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
  211. </td>
  212. </tr>
  213. </table>
  214. </div>
  215. <div class="gridPanel" style="margin-left:10px">
  216. <span><strong>子表信息</strong></span>
  217. <table id="gridList"></table>
  218. <div style="text-align:center">
  219. <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
  220. <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
  221. </div>
  222. </div>
  223. </form>