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

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