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

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  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. //InitControl();
  22. //ClearTemp();
  23. if (ID=='') {
  24. $(".MOPick").css('display', 'none');
  25. }
  26. var Muser = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  27. var now = new Date();
  28. var date = now.toLocaleDateString();
  29. $("#txtMUSER").val(Muser);
  30. $("#txtMTIME").val(date);
  31. InitControl();
  32. ClearTemp();
  33. reloadData();
  34. })
  35. function reloadData() {
  36. $("#gridList").dataGrid({
  37. url: "/WMS/WeiWaiProductionIssue/GetICSReturnTemporary?rfqno=" + $("#txtApplyNegCode").val() + "&" + Math.random(),
  38. //postData: { rfqno: $("#RFQNO").val() },
  39. height: $(window).height() - 200,
  40. width: $(window).width(),
  41. cellEdit: true,
  42. colModel: [
  43. { label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true },
  44. { label: 'ID', name: 'ID', width: 150, align: 'left', hidden: true },
  45. {
  46. label: '查看', width: 100, align: 'left',
  47. formatter: btnLook
  48. },
  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: '已发数量', name: 'IssueNegQuantity', width: 150, align: 'left' },
  56. { label: '自由项ID', name: 'ExtensionID', hidden: true },
  57. { label: '单位', name: 'InvUnit', width: 100, align: 'left' },
  58. { label: '来源单据ID', name: 'ZJID', width: 100, align: 'left' },
  59. { label: '已退数量', name: 'tuinum', 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 + "')\">查看</a>";
  70. }
  71. function UpLoadClick(ID) {
  72. $.modalOpen({
  73. id: "selectDeatil",
  74. title: "查看修改物料",
  75. url: "/WMS/WeiWaiProductionIssue/SeachMaterial?ID=" + ID + "&" + 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/WeiWaiProductionIssue/ClearTemp?" + Math.random(),
  126. datatype: "json",
  127. async: false
  128. })
  129. }
  130. function submitForm() {
  131. debugger;
  132. var WHCode = $("#sel_WHCode").val();
  133. var IDlist = "";
  134. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  135. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  136. var date = new Date();
  137. var Details = [];
  138. var obj_vendor = $("#gridList");
  139. var rowIds_vendor = obj_vendor.getDataIDs();
  140. var arrayData_vendor = new Array();
  141. if (rowIds_vendor.length > 0) {
  142. for (var i = 0; i < rowIds_vendor.length; i++) {
  143. var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
  144. if (vendorRowData.Quantity=='') {
  145. $.modalAlert("请输入退货数量!");
  146. return;
  147. }
  148. var Code = vendorRowData.InvCode;
  149. var Quantity = Number(vendorRowData.Quantity);
  150. var IssueNegQuantity = Number(vendorRowData.IssueNegQuantity);
  151. var tuinum = Number(vendorRowData.tuinum);
  152. if (Quantity > IssueNegQuantity) {
  153. $.modalAlert("数量不能大于已发数量!");
  154. return;
  155. }
  156. if (IssueNegQuantity - tuinum <= 0) {
  157. $.modalAlert("料品:'" + Code + "'已发数:'" + IssueNegQuantity + "'已全部退货!");
  158. return;
  159. }
  160. var obj = {
  161. Sequence: i + 1,
  162. InvCode: vendorRowData.InvCode,
  163. Quantity: vendorRowData.Quantity,
  164. Amount: vendorRowData.Amount,
  165. SourceDetailID: vendorRowData.ZJID,
  166. ExtensionID: vendorRowData.ExtensionID,
  167. };
  168. Details.push(obj);
  169. }
  170. var ICSASNs = {
  171. WHCode: WHCode,
  172. User: RoleEnCode,
  173. MTIME: date,
  174. WorkPoint: WorkPoint,
  175. Type:'1',
  176. Detail: Details,
  177. }
  178. var ICSASN = [];
  179. ICSASN.push(ICSASNs);
  180. $.submitForm({
  181. url: "/WMS/WeiWaiProductionIssue/SaveICSMOApplyNeg?" + Math.random(),
  182. param: { ICSASN: JSON.stringify(ICSASN) },
  183. success: function () {
  184. $.currentWindow().$("#gridList").trigger("reloadGrid");
  185. }
  186. })
  187. }
  188. }
  189. </script>
  190. <form id="form1">
  191. <div class="topPanel" style="height:10px">
  192. <div class="btn-group">
  193. @*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a>
  194. <a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@
  195. </div>
  196. </div>
  197. <div style="margin-right: 20px;">
  198. <table class="form">
  199. <thead>主表信息</thead>
  200. <tr>
  201. <th class="formTitle MOPick">退料单号:</th>
  202. <td class="formValue MOPick">
  203. <input type="text" id="txtApplyNegCode" class="form-control" />
  204. </td>
  205. <th class="formTitle">仓库编码:</th>
  206. <td class="formValue">
  207. <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width: 230px" placeholder="请选择供应商编码..."></select>
  208. <input type="hidden" id="hidetext" />
  209. </td>
  210. </tr>
  211. <tr>
  212. <th class="formTitle">维护人:</th>
  213. <td class="formValue">
  214. <input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
  215. </td>
  216. <th class="formTitle">维护时间:</th>
  217. <td class="formValue">
  218. <input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
  219. </td>
  220. </tr>
  221. </table>
  222. </div>
  223. <div class="gridPanel" style="margin-left:10px">
  224. <span><strong>子表信息</strong></span>
  225. <table id="gridList"></table>
  226. <div style="text-align:center">
  227. <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
  228. <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
  229. </div>
  230. </div>
  231. </form>