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

321 lines
12 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 _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 date = new Date();
  201. var Details = [];
  202. var obj_vendor = $("#gridList");
  203. var rowIds_vendor = obj_vendor.getDataIDs();
  204. var arrayData_vendor = new Array();
  205. if (rowIds_vendor.length > 0) {
  206. for (var i = 0; i < rowIds_vendor.length; i++) {
  207. var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
  208. if (vendorRowData.Quantity == '0' || vendorRowData.Quantity == 0) {
  209. $.modalAlertNew("WMS00089");
  210. return;
  211. }
  212. var obj = {
  213. Sequence: i + 1,
  214. DetailID:vendorRowData.TLZID,
  215. InvCode: vendorRowData.InvCode,
  216. Quantity: vendorRowData.Quantity,
  217. Amount: vendorRowData.Amount,
  218. SourceDetailID: vendorRowData.ZJID,
  219. ExtensionID: vendorRowData.ExtensionID,
  220. };
  221. Details.push(obj);
  222. }
  223. var ICSASNs = {
  224. ID:ID,
  225. WHCode: WHCode,
  226. User: RoleEnCode,
  227. MTIME: date,
  228. WorkPoint: WorkPoint,
  229. Type:'3',
  230. Detail: Details,
  231. }
  232. var ICSASN = [];
  233. ICSASN.push(ICSASNs);
  234. $.submitForm({
  235. url: "/WMS/MaterialsDeliveredRTM/UpdateICSMOApplyNeg?" + Math.random(),
  236. param: { ICSASN: JSON.stringify(ICSASN) },
  237. success: function () {
  238. $.currentWindow().$("#gridList").trigger("reloadGrid");
  239. }
  240. })
  241. }
  242. }
  243. </script>
  244. <form id="form1">
  245. <div class="topPanel" style="height:10px">
  246. <div class="btn-group">
  247. </div>
  248. </div>
  249. <div style="margin-right: 20px;">
  250. <table class="form">
  251. <thead>主表信息</thead>
  252. <tr>
  253. <th class="formTitle MOPick">退料单号:</th>
  254. <td class="formValue MOPick">
  255. <input type="text" id="txtApplyNegCode" class="form-control" />
  256. </td>
  257. <th class="formTitle">仓库编码:</th>
  258. <td class="formValue">
  259. <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width: 230px" placeholder="请选择供应商编码..."></select>
  260. <input type="hidden" id="hidetext" />
  261. </td>
  262. </tr>
  263. <tr>
  264. <th class="formTitle">维护人:</th>
  265. <td class="formValue">
  266. <input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
  267. </td>
  268. <th class="formTitle">维护时间:</th>
  269. <td class="formValue">
  270. <input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
  271. </td>
  272. </tr>
  273. </table>
  274. </div>
  275. <div class="gridPanel" style="margin-left:10px">
  276. <span><strong>子表信息</strong></span>
  277. <table id="gridList"></table>
  278. <div style="text-align:center">
  279. <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
  280. <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
  281. </div>
  282. </div>
  283. </form>