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

333 lines
12 KiB

2 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 _Clos = new Array();
  19. var rfqcode = $.request("rfqcode");
  20. var ID = $.request("ID");
  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/ProductionRAFMR/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/ProductionRAFMR/SeachPRInventory?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/ProductionRAFMR/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 myDate = new Date();
  192. var year = myDate.getFullYear(); //获取当前年
  193. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  194. var dates = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  195. var hours = myDate.getHours() + 1 < 10 ? "0" + myDate.getHours() : myDate.getHours(); //获取当前小时
  196. var minutes = myDate.getMinutes() + 1 < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes(); //获取当前分钟
  197. var seconds = myDate.getSeconds() + 1 < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds(); //获取当前秒
  198. var date = year + "-" + mon + "-" + dates + ' ' + hours + ':' + minutes + ':' + seconds;
  199. var Details = [];
  200. var obj_vendor = $("#gridList");
  201. var rowIds_vendor = obj_vendor.getDataIDs();
  202. var arrayData_vendor = new Array();
  203. if (rowIds_vendor.length > 0) {
  204. for (var i = 0; i < rowIds_vendor.length; i++) {
  205. var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
  206. if (vendorRowData.Quantity == "" || vendorRowData.Quantity == 'undefined') {
  207. $.modalAlertNew("WMS00089");
  208. return;
  209. }
  210. var Quantity = Number(vendorRowData.Quantity);
  211. var IssueQuantity =Number(vendorRowData.IssueQuantity);
  212. if (Quantity > IssueQuantity) {
  213. $.modalAlertNew("WMS00090");
  214. return;
  215. }
  216. var obj = {
  217. Sequence: i + 1,
  218. InvCode: vendorRowData.InvCode,
  219. Quantity: vendorRowData.Quantity,
  220. Amount: vendorRowData.Amount,
  221. SourceDetailID: vendorRowData.ZJID,
  222. ExtensionID: vendorRowData.ExtensionID,
  223. };
  224. Details.push(obj);
  225. }
  226. var ICSASNs = {
  227. WHCode: WHCode,
  228. User: RoleEnCode,
  229. MTIME: date,
  230. WorkPoint: WorkPoint,
  231. Type:'2',
  232. Detail: Details,
  233. }
  234. var ICSASN = [];
  235. ICSASN.push(ICSASNs);
  236. $.submitForm({
  237. url: "/WMS/ProductionRAFMR/SaveICSMOApplyNeg?" + Math.random(),
  238. param: { ICSASN: JSON.stringify(ICSASN) },
  239. success: function () {
  240. $.currentWindow().$("#gridList").trigger("reloadGrid");
  241. }
  242. })
  243. }
  244. }
  245. </script>
  246. <form id="form1">
  247. <div class="topPanel" style="height:10px">
  248. <div class="btn-group">
  249. @*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a>
  250. <a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@
  251. </div>
  252. </div>
  253. <div style="margin-right: 20px;">
  254. <table class="form">
  255. <thead>主表信息</thead>
  256. <tr>
  257. <th class="formTitle MOPick">退料单号:</th>
  258. <td class="formValue MOPick">
  259. <input type="text" id="txtApplyNegCode" class="form-control" />
  260. </td>
  261. <th class="formTitle">仓库编码:</th>
  262. <td class="formValue">
  263. <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width: 230px" placeholder="请选择供应商编码..."></select>
  264. <input type="hidden" id="hidetext" />
  265. </td>
  266. </tr>
  267. <tr>
  268. <th class="formTitle">维护人:</th>
  269. <td class="formValue">
  270. <input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
  271. </td>
  272. <th class="formTitle">维护时间:</th>
  273. <td class="formValue">
  274. <input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
  275. </td>
  276. </tr>
  277. </table>
  278. </div>
  279. <div class="gridPanel" style="margin-left:10px">
  280. <span><strong>子表信息</strong></span>
  281. <table id="gridList"></table>
  282. <div style="text-align:center">
  283. <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
  284. <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
  285. </div>
  286. </div>
  287. </form>