纽威
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
13 KiB

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