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

335 lines
13 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 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 _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/ProductionIssue/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/ProductionIssue/SeachInventory?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. $("#gridList").jqGrid("delRowData", ID)
  143. var obj = top.frames[iframeId].submitForm();
  144. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'last');
  145. $(".unwritten").hide();
  146. top.frames[iframeId].Close();
  147. }
  148. });
  149. }
  150. function guid() {
  151. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  152. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  153. return v.toString(16);
  154. });
  155. }
  156. //最后一行新增数据
  157. function AddRowToLast() {
  158. var obj = {
  159. ID: guid(),
  160. };
  161. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'last');
  162. $(".unwritten").hide();
  163. }
  164. function DeleteRowToLast() {
  165. debugger;
  166. var rowid = $("#gridList").jqGridRowValue().ID
  167. $("#gridList").delRowData(rowid);
  168. }
  169. function InitControl() {
  170. var $VenCode = $("#sel_WHCode");
  171. $VenCode.select2({
  172. allowClear: true,
  173. escapeMarkup: function (m) {
  174. return m;
  175. }
  176. });
  177. $.ajax({
  178. url: "/WMS/ProductionIssue/GetWHCode" + "?" + Math.random(),
  179. dataType: "json",
  180. async: false,
  181. success: function (data) {
  182. $.each(data, function (index, item) {
  183. $VenCode.append("<option value='" + item.WarehouseCode + "'>&nbsp;" + item.WarehouseName + "</option>");
  184. });
  185. }
  186. });
  187. }
  188. function ClearTemp() {
  189. $.ajax({
  190. url: "/WMS/ProductionIssue/ClearTemp?" + Math.random(),
  191. datatype: "json",
  192. async: false
  193. })
  194. }
  195. function submitForm() {
  196. var WHCode = $("#sel_WHCode").val();
  197. if (WHCode == "") {
  198. $.modalAlertNew("WMS00041");
  199. return;
  200. }
  201. debugger;
  202. var IDlist = "";
  203. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  204. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  205. var myDate = new Date();
  206. var year = myDate.getFullYear(); //获取当前年
  207. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  208. var dates = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  209. var hours = myDate.getHours() + 1 < 10 ? "0" + myDate.getHours() : myDate.getHours(); //获取当前小时
  210. var minutes = myDate.getMinutes() + 1 < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes(); //获取当前分钟
  211. var seconds = myDate.getSeconds() + 1 < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds(); //获取当前秒
  212. var date = year + "-" + mon + "-" + dates + ' ' + hours + ':' + minutes + ':' + seconds;
  213. var Details = [];
  214. var obj_vendor = $("#gridList");
  215. var rowIds_vendor = obj_vendor.getDataIDs();
  216. var arrayData_vendor = new Array();
  217. if (rowIds_vendor.length > 0) {
  218. for (var i = 0; i < rowIds_vendor.length; i++) {
  219. var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
  220. if (vendorRowData.Quantity == '0' || vendorRowData.Quantity == 0) {
  221. $.modalAlertNew("WMS00089");
  222. return;
  223. }
  224. var obj = {
  225. Sequence: i + 1,
  226. DetailID:vendorRowData.TLZID,
  227. InvCode: vendorRowData.InvCode,
  228. Quantity: vendorRowData.Quantity,
  229. Amount: vendorRowData.Amount,
  230. SourceDetailID: vendorRowData.ZJID,
  231. ExtensionID: vendorRowData.ExtensionID,
  232. };
  233. Details.push(obj);
  234. }
  235. var ICSASNs = {
  236. ID:ID,
  237. WHCode: WHCode,
  238. User: RoleEnCode,
  239. MTIME: date,
  240. WorkPoint: WorkPoint,
  241. Type:'1',
  242. Detail: Details,
  243. }
  244. var ICSASN = [];
  245. ICSASN.push(ICSASNs);
  246. $.submitForm({
  247. url: "/WMS/ProductionIssue/UpdateICSMOApplyNeg?" + Math.random(),
  248. param: { ICSASN: JSON.stringify(ICSASN) },
  249. success: function () {
  250. $.currentWindow().$("#gridList").trigger("reloadGrid");
  251. }
  252. })
  253. }
  254. }
  255. </script>
  256. <form id="form1">
  257. <div class="topPanel" style="height:10px">
  258. <div class="btn-group">
  259. @*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a>
  260. <a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@
  261. </div>
  262. </div>
  263. <div style="margin-right: 20px;">
  264. <table class="form">
  265. <thead>主表信息</thead>
  266. <tr>
  267. <th class="formTitle MOPick">退料单号:</th>
  268. <td class="formValue MOPick">
  269. <input type="text" id="txtApplyNegCode" class="form-control" />
  270. </td>
  271. <th class="formTitle">仓库编码:</th>
  272. <td class="formValue">
  273. <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width: 230px" placeholder="请选择供应商编码..."></select>
  274. <input type="hidden" id="hidetext" />
  275. </td>
  276. </tr>
  277. <tr>
  278. <th class="formTitle">维护人:</th>
  279. <td class="formValue">
  280. <input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
  281. </td>
  282. <th class="formTitle">维护时间:</th>
  283. <td class="formValue">
  284. <input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
  285. </td>
  286. </tr>
  287. </table>
  288. </div>
  289. <div class="gridPanel" style="margin-left:10px">
  290. <span><strong>子表信息</strong></span>
  291. <table id="gridList"></table>
  292. <div style="text-align:center">
  293. <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
  294. <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
  295. </div>
  296. </div>
  297. </form>