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

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