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

327 lines
12 KiB

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