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.

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