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

340 lines
13 KiB

3 years ago
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
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. $(function () {
  22. SetCols();
  23. //InitControl();
  24. //ClearTemp();
  25. if (ID=='') {
  26. $(".MOPick").css('display', 'none');
  27. }
  28. var Muser = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  29. var now = new Date();
  30. var date = now.toLocaleDateString();
  31. $("#txtMUSER").val(Muser);
  32. $("#txtMTIME").val(date);
  33. InitControl();
  34. ClearTemp();
  35. reloadData();
  36. })
  37. function SetCols() {
  38. $.ajax({
  39. url: "/Print/SelectColumnName?" + Math.random(),
  40. dataType: "json",
  41. async: false,
  42. success: function (data) {
  43. var cols = new Array();
  44. var collast = { label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true };
  45. cols.push(collast);
  46. var collast = { label: 'ID', name: 'ID', width: 150, align: 'left', hidden: true };
  47. cols.push(collast);
  48. var collast = {
  49. label: '查看', width: 100, align: 'left',
  50. formatter: btnLook
  51. };
  52. cols.push(collast);
  53. var collast = { label: '委外退料单号', name: 'OApplyNegCode', width: 150, align: 'left' };
  54. cols.push(collast);
  55. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  56. cols.push(collast);
  57. var collast = { label: '料品名称', name: 'InvName', width: 100, align: 'left' };
  58. cols.push(collast);
  59. var collast = { label: '规格型号', name: 'InvStd', width: 100, align: 'left' };
  60. cols.push(collast);
  61. var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } };
  62. cols.push(collast);
  63. var collast = { label: '辅计量数量', name: 'Amount', width: 150, align: 'left' };
  64. cols.push(collast);
  65. var collast = { label: '已发数量', name: 'IssueNegQuantity', width: 150, align: 'left' };
  66. cols.push(collast);
  67. var collast = { label: '自由项ID', name: 'ExtensionID', hidden: true };
  68. cols.push(collast);
  69. var collast = { label: '单位', name: 'InvUnit', width: 100, align: 'left' };
  70. cols.push(collast);
  71. var collast = { label: '来源单据ID', name: 'ZJID', width: 100, align: 'left' };
  72. cols.push(collast);
  73. var collast = { label: '已退数量', name: 'tuinum', width: 100, align: 'left' };
  74. cols.push(collast);
  75. if (data != null && data.length > 0) {
  76. DateList = data;
  77. for (var i = 0; i < data.length; i++) {
  78. var ColName = data[i].ColName;
  79. var ColCode = data[i].ColCode;
  80. var obj = new Array();
  81. obj = {
  82. label: ColName,
  83. name: ColCode,
  84. width: 80,
  85. align: "left"
  86. }
  87. cols.push(obj);
  88. }
  89. }
  90. _Clos = cols;
  91. }
  92. });
  93. }
  94. function reloadData() {
  95. $("#gridList").dataGrid({
  96. url: "/WMS/WeiWaiProductionIssue/GetICSReturnTemporary?rfqno=" + $("#txtApplyNegCode").val() + "&" + Math.random(),
  97. //postData: { rfqno: $("#RFQNO").val() },
  98. height: $(window).height() - 200,
  99. width: $(window).width(),
  100. cellEdit: true,
  101. // colModel: [
  102. //{ label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true },
  103. // { label: 'ID', name: 'ID', width: 150, align: 'left', hidden: true },
  104. // {
  105. // label: '查看', width: 100, align: 'left',
  106. // formatter: btnLook
  107. // },
  108. //{ label: '委外退料单号', name: 'OApplyNegCode', width: 150, align: 'left' },
  109. //{ label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
  110. //{ label: '料品名称', name: 'InvName', width: 100, align: 'left' },
  111. //{ label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
  112. //{ label: '数量', name: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } },
  113. //{ label: '辅计量数量', name: 'Amount', width: 150, align: 'left' },
  114. //{ label: '已发数量', name: 'IssueNegQuantity', width: 150, align: 'left' },
  115. //{ label: '自由项ID', name: 'ExtensionID', hidden: true },
  116. //{ label: '单位', name: 'InvUnit', width: 100, align: 'left' },
  117. //{ label: '来源单据ID', name: 'ZJID', width: 100, align: 'left' },
  118. // { label: '已退数量', name: 'tuinum', width: 100, align: 'left' },
  119. // ],
  120. colModel: _Clos,
  121. cellsubmit: "clientArray",
  122. width: "100%",
  123. autowidth: true,
  124. rownumbers: true,
  125. viewrecords: true,
  126. });
  127. }
  128. function btnLook(cellvalue, options, rowObject) {
  129. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">查看</a>";
  130. }
  131. function UpLoadClick(ID) {
  132. $.modalOpen({
  133. id: "selectDeatil",
  134. title: "查看修改物料",
  135. url: "/WMS/WeiWaiProductionIssue/SeachMaterial?ID=" + ID + "&" + 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/WeiWaiProductionIssue/ClearTemp?" + Math.random(),
  186. datatype: "json",
  187. async: false
  188. })
  189. }
  190. function submitForm() {
  191. debugger;
  192. var WHCode = $("#sel_WHCode").val();
  193. var IDlist = "";
  194. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  195. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  196. var myDate = new Date();
  197. var year = myDate.getFullYear(); //获取当前年
  198. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  199. var dates = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  200. var hours = myDate.getHours() + 1 < 10 ? "0" + myDate.getHours() : myDate.getHours(); //获取当前小时
  201. var minutes = myDate.getMinutes() + 1 < 10 ? "0" + myDate.getMinutes() : myDate.getMinutes(); //获取当前分钟
  202. var seconds = myDate.getSeconds() + 1 < 10 ? "0" + myDate.getSeconds() : myDate.getSeconds(); //获取当前秒
  203. var date = year + "-" + mon + "-" + dates + ' ' + hours + ':' + minutes + ':' + seconds;
  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 == '') {
  212. $.modalAlertNew("WMS00097");
  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 (Quantity > IssueNegQuantity) {
  220. $.modalAlertNew("WMS00090");
  221. return;
  222. }
  223. if (IssueNegQuantity - tuinum <= 0) {
  224. $.modalAlertNew("WMS00098", Code, IssueNegQuantity);
  225. //$.modalAlert("料品:'" + Code + "'已发数:'" + IssueNegQuantity + "'已全部退货!");
  226. return;
  227. }
  228. var obj = {
  229. Sequence: i + 1,
  230. InvCode: vendorRowData.InvCode,
  231. Quantity: vendorRowData.Quantity,
  232. Amount: vendorRowData.Amount,
  233. SourceDetailID: vendorRowData.ZJID,
  234. ExtensionID: vendorRowData.ExtensionID,
  235. };
  236. Details.push(obj);
  237. }
  238. var ICSASNs = {
  239. WHCode: WHCode,
  240. User: RoleEnCode,
  241. MTIME: date,
  242. WorkPoint: WorkPoint,
  243. Type:'1',
  244. Detail: Details,
  245. }
  246. var ICSASN = [];
  247. ICSASN.push(ICSASNs);
  248. $.submitForm({
  249. url: "/WMS/WeiWaiProductionIssue/SaveICSMOApplyNeg?" + Math.random(),
  250. param: { ICSASN: JSON.stringify(ICSASN) },
  251. success: function () {
  252. $.currentWindow().$("#gridList").trigger("reloadGrid");
  253. }
  254. })
  255. }
  256. }
  257. </script>
  258. <form id="form1">
  259. <div class="topPanel" style="height:10px">
  260. <div class="btn-group">
  261. @*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a>
  262. <a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@
  263. </div>
  264. </div>
  265. <div style="margin-right: 20px;">
  266. <table class="form">
  267. <thead>主表信息</thead>
  268. <tr>
  269. <th class="formTitle MOPick">退料单号:</th>
  270. <td class="formValue MOPick">
  271. <input type="text" id="txtApplyNegCode" class="form-control" />
  272. </td>
  273. <th class="formTitle">仓库编码:</th>
  274. <td class="formValue">
  275. <select id="sel_WHCode" name="sel_WHCode" class="form-control select2" style="width: 230px" placeholder="请选择供应商编码..."></select>
  276. <input type="hidden" id="hidetext" />
  277. </td>
  278. </tr>
  279. <tr>
  280. <th class="formTitle">维护人:</th>
  281. <td class="formValue">
  282. <input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
  283. </td>
  284. <th class="formTitle">维护时间:</th>
  285. <td class="formValue">
  286. <input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
  287. </td>
  288. </tr>
  289. </table>
  290. </div>
  291. <div class="gridPanel" style="margin-left:10px">
  292. <span><strong>子表信息</strong></span>
  293. <table id="gridList"></table>
  294. <div style="text-align:center">
  295. <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
  296. <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
  297. </div>
  298. </div>
  299. </form>