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

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