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.

592 lines
24 KiB

  1. 
  2. @{
  3. ViewBag.Title = "Index";
  4. Layout = "~/Views/Shared/_Form.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. InitContro2();
  33. InitContro3();
  34. ClearTemp();
  35. reloadData();
  36. $("#sel_CodeType").change(function () {
  37. $.ajax({
  38. url: "/DHAY/ICSCustomerSuppliedIn/GetBidCode" + "?" + Math.random(),
  39. dataType: "json",
  40. async: false,
  41. success: function (data) {
  42. if (data.Code != '') {
  43. $("#Code").val(data.Code);
  44. $("#Code").attr("disabled", "disabled");
  45. }
  46. }
  47. });
  48. });
  49. })
  50. function SetCols() {
  51. $.ajax({
  52. url: "/Print/SelectColumnName?" + Math.random(),
  53. dataType: "json",
  54. async: false,
  55. success: function (data) {
  56. var cols = new Array();
  57. var collast = { label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true };
  58. cols.push(collast);
  59. var collast = { label: 'ID', name: 'ID', width: 150, align: 'left', hidden: true };
  60. cols.push(collast);
  61. //var collast = {
  62. // label: '查看', width: 100, align: 'left',
  63. // formatter: btnLook
  64. //};
  65. // cols.push(collast);
  66. var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
  67. cols.push(collast);
  68. var collast = { label: '料品名称', name: 'INVNAME', width: 100, align: 'left' };
  69. cols.push(collast);
  70. var collast = { label: '规格型号', name: 'InvStd', width: 100, align: 'left' };
  71. cols.push(collast);
  72. var collast = { label: '仓库编码', name: 'WHCode', width: 100, align: 'left', hidden: true };
  73. cols.push(collast);
  74. var collast = { label: '仓库名称', name: 'WHCodeName', width: 100, align: 'left', editable: true };
  75. cols.push(collast);
  76. var collast = { label: '批号', name: 'Batch', width: 100, align: 'left', editable: true };
  77. cols.push(collast);
  78. var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left', editable: true, editrules: { number: true } };
  79. cols.push(collast);
  80. var collast = { label: '备注', name: 'DetailReamrk', width: 150, align: 'left', editable: true };
  81. cols.push(collast);
  82. if (data != null && data.length > 0) {
  83. DateList = data;
  84. for (var i = 0; i < data.length; i++) {
  85. var ColName = data[i].ColName;
  86. var ColCode = data[i].ColCode;
  87. var obj = new Array();
  88. obj = {
  89. label: ColName,
  90. name: ColCode,
  91. width: 80,
  92. align: "left"
  93. }
  94. cols.push(obj);
  95. }
  96. }
  97. _Clos = cols;
  98. }
  99. });
  100. }
  101. function reloadData() {
  102. $("#gridList").dataGrid({
  103. url: "/WMS/ProductionIssue/GetICSReturnTemporary?rfqno=" + $("#txtApplyNegCode").val() + "&" + Math.random(),
  104. //postData: { rfqno: $("#RFQNO").val() },
  105. height: $(window).height() - 300,
  106. width: $(window).width(),
  107. cellEdit: true,
  108. colModel: _Clos,
  109. cellsubmit: "clientArray",
  110. width: "100%",
  111. //autowidth: true,
  112. rownumbers: true,
  113. viewrecords: true,
  114. ondblClickRow: function (rowid, cellname, value) {
  115. var colModel = $("#gridList").jqGrid("getGridParam", "colModel");
  116. var cellIndex = $("#gridList").jqGrid("getGridParam", "iCol");
  117. var cellname = colModel[cellIndex].name;
  118. if (cellname == "InvCode") {
  119. $.modalOpen({
  120. id: "InvCodeSelect",
  121. title: "选择物料信息",
  122. url: "/DHAY/ICSCustomerSuppliedReturn/GetInvCode",
  123. width: "50%",
  124. height: "50%",
  125. callBack: function (iframeId) {
  126. debugger;
  127. var obj = top.frames[iframeId].submitForm();
  128. $("#gridList").jqGrid('setCell', rowid, 'InvCode', obj.INVCODE, 'review-' + rowid);
  129. $("#gridList").jqGrid('setCell', rowid, 'INVNAME', obj.INVNAME, 'review-' + rowid);
  130. $("#gridList").jqGrid('setCell', rowid, 'InvStd', obj.InvStd, 'review-' + rowid);
  131. $("#gridList").jqGrid("saveCell", rowid, 1);
  132. $("#gridList").jqGrid("saveCell", rowid, 2);
  133. $("#gridList").jqGrid("saveCell", rowid, 3);
  134. $("#gridList").jqGrid("saveCell", rowid, 4);
  135. $("#gridList").jqGrid("saveCell", rowid, 5);
  136. $("#gridList").jqGrid("saveCell", rowid, 6);
  137. $("#gridList").jqGrid("saveCell", rowid, 7);
  138. $("#gridList").jqGrid("saveCell", rowid, 8);
  139. $("#gridList").jqGrid("saveCell", rowid, 9);
  140. top.frames[iframeId].Close();
  141. }
  142. });
  143. } else if (cellname == "WHCodeName") {
  144. $.modalOpen({
  145. id: "GetWHCode",
  146. title: "选择仓库",
  147. url: "/DHAY/ICSCustomerSuppliedReturn/GetWHCode",
  148. width: "50%",
  149. height: "50%",
  150. callBack: function (iframeId) {
  151. debugger;
  152. var obj = top.frames[iframeId].submitForm();
  153. $("#gridList").jqGrid('setCell', rowid, 'WHCode', obj.WarehouseCode, 'review-' + rowid);
  154. $("#gridList").jqGrid('setCell', rowid, 'WHCodeName', obj.WarehouseName, 'review-' + rowid);
  155. $("#gridList").jqGrid("saveCell", rowid, 1);
  156. $("#gridList").jqGrid("saveCell", rowid, 2);
  157. $("#gridList").jqGrid("saveCell", rowid, 3);
  158. $("#gridList").jqGrid("saveCell", rowid, 4);
  159. $("#gridList").jqGrid("saveCell", rowid, 5);
  160. $("#gridList").jqGrid("saveCell", rowid, 6);
  161. $("#gridList").jqGrid("saveCell", rowid, 7);
  162. $("#gridList").jqGrid("saveCell", rowid, 8);
  163. $("#gridList").jqGrid("saveCell", rowid, 9);
  164. top.frames[iframeId].Close();
  165. }
  166. });
  167. } else if (cellname == "Batch") {
  168. $.modalOpen({
  169. id: "InvCodeSelect",
  170. title: "选择批次信息",
  171. url: "/DHAY/ICSCustomerSuppliedReturn/GetBatch",
  172. width: "50%",
  173. height: "50%",
  174. callBack: function (iframeId) {
  175. debugger;
  176. var obj = top.frames[iframeId].submitForm();
  177. $("#gridList").jqGrid('setCell', rowid, 'Batch', obj.BatchCode, 'review-' + rowid);
  178. $("#gridList").jqGrid("saveCell", rowid, 1);
  179. $("#gridList").jqGrid("saveCell", rowid, 2);
  180. $("#gridList").jqGrid("saveCell", rowid, 3);
  181. $("#gridList").jqGrid("saveCell", rowid, 4);
  182. $("#gridList").jqGrid("saveCell", rowid, 5);
  183. $("#gridList").jqGrid("saveCell", rowid, 6);
  184. $("#gridList").jqGrid("saveCell", rowid, 7);
  185. $("#gridList").jqGrid("saveCell", rowid, 8);
  186. $("#gridList").jqGrid("saveCell", rowid, 9);
  187. top.frames[iframeId].Close();
  188. }
  189. });
  190. }
  191. },
  192. });
  193. }
  194. function btnLook(cellvalue, options, rowObject) {
  195. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">查看</a>";
  196. }
  197. function UpLoadClick(ID) {
  198. $.modalOpen({
  199. id: "selectDeatil",
  200. title: "查看修改物料",
  201. url: "/WMS/ProductionIssue/SeachInventory?ID=" + ID + "&" + Math.random(),
  202. width: "1000px",
  203. height: "1000px",
  204. callBack: function (iframeId) {
  205. var obj = top.frames[iframeId].submitForm();
  206. var rowData = $("#gridList").jqGrid('getRowData', ID);
  207. rowData.TLZID = obj.TLZID,
  208. rowData.ZJID = obj.ZJID,
  209. rowData.InvCode = obj.InvCode,
  210. rowData.InvName = obj.InvName,
  211. rowData.InvStd = obj.InvStd,
  212. rowData.InvUnit = obj.InvUnit,
  213. rowData.Quantity = obj.Quantity,
  214. rowData.IssueNegQuantity = obj.IssueQuantity,
  215. rowData.Amount = obj.Amount,
  216. rowData.ExtensionID = obj.ExtensionID,
  217. rowData.ProjectCode = obj.ProjectCode,
  218. rowData.BatchCode = obj.BatchCode,
  219. rowData.Version = obj.Version,
  220. rowData.Brand = obj.Brand,
  221. rowData.cFree1 = obj.cFree1,
  222. rowData.cFree2 = obj.cFree2,
  223. rowData.cFree3 = obj.cFree3,
  224. rowData.cFree4 = obj.cFree4,
  225. rowData.cFree5 = obj.cFree5,
  226. rowData.cFree6 = obj.cFree6,
  227. rowData.cFree7 = obj.cFree7,
  228. rowData.cFree8 = obj.cFree8,
  229. rowData.cFree9 = obj.cFree9,
  230. rowData.cFree10 = obj.cFree10
  231. $("#gridList").jqGrid('setRowData', ID, rowData);
  232. $(".unwritten").hide();
  233. top.frames[iframeId].Close();
  234. }
  235. });
  236. }
  237. function guid() {
  238. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  239. var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
  240. return v.toString(16);
  241. });
  242. }
  243. //最后一行新增数据
  244. function AddRowToLast() {
  245. var obj = {
  246. ID: guid(),
  247. WHCode: ""
  248. };
  249. $("#gridList").jqGrid('addRowData', obj.ID, obj, 'last');
  250. $(".unwritten").hide();
  251. }
  252. function DeleteRowToLast() {
  253. debugger;
  254. var rowid = $("#gridList").jqGridRowValue().ID
  255. $("#gridList").delRowData(rowid);
  256. }
  257. //获取U9单据类型
  258. function InitControl() {
  259. var $CodeType = $("#sel_CodeType");
  260. $CodeType.select2({
  261. allowClear: true,
  262. escapeMarkup: function (m) {
  263. return m;
  264. }
  265. });
  266. $.ajax({
  267. url: "/DHAY/ICSCustomerSuppliedReturn/GetU9CodeType" + "?" + Math.random(),
  268. dataType: "json",
  269. async: false,
  270. success: function (data) {
  271. $.each(data, function (index, item) {
  272. $CodeType.append("<option value='" + item.Code + "'>&nbsp;" + item.Name + "</option>");
  273. });
  274. }
  275. });
  276. }
  277. //获取U9部门
  278. function InitContro2() {
  279. var $Dept = $("#sel_Dept");
  280. $Dept.select2({
  281. allowClear: true,
  282. escapeMarkup: function (m) {
  283. return m;
  284. }
  285. });
  286. $.ajax({
  287. url: "/DHAY/ICSCustomerSuppliedReturn/GetU9Department" + "?" + Math.random(),
  288. dataType: "json",
  289. async: false,
  290. success: function (data) {
  291. $.each(data, function (index, item) {
  292. $Dept.append("<option value='" + item.Code + "'>&nbsp;" + item.Name + "</option>");
  293. });
  294. }
  295. });
  296. }
  297. //获取U9客户
  298. function InitContro3() {
  299. var $Custmer = $("#sel_Custmer");
  300. $Custmer.select2({
  301. allowClear: true,
  302. escapeMarkup: function (m) {
  303. return m;
  304. }
  305. });
  306. $.ajax({
  307. url: "/DHAY/ICSCustomerSuppliedReturn/GetU9Customer" + "?" + Math.random(),
  308. dataType: "json",
  309. async: false,
  310. success: function (data) {
  311. $.each(data, function (index, item) {
  312. $Custmer.append("<option value='" + item.Code + "'>&nbsp;" + item.Name + "</option>");
  313. });
  314. }
  315. });
  316. }
  317. function ClearTemp() {
  318. $.ajax({
  319. url: "/WMS/ProductionIssue/ClearTemp?" + Math.random(),
  320. datatype: "json",
  321. async: false
  322. })
  323. }
  324. @*function submitForm() {
  325. debugger;
  326. if (!$('#form1').formValid()) {
  327. return false;
  328. }
  329. var CodeType = $("#sel_CodeType").val();//单据类型
  330. var Dept = $("#sel_Dept").val();//部门
  331. var ApplyNegCode = $("#txtApplyNegCode").val();//在建项目
  332. var Custmer = $("#sel_Custmer").val();//客户
  333. var Remarks = $("#Remarks").val();//备注
  334. var Code = $("#Code").val();//单据号
  335. var MTIME = $("#txtMTIME").val();//单据号
  336. var SYproject = $("#txtSYproject").val();//受益项目
  337. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  338. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  339. var IDlist = "";
  340. var Details = [];
  341. SelPerson = "#SelBR_"
  342. var obj_vendor = $("#gridList");
  343. var rowIds_vendor = obj_vendor.getDataIDs();
  344. var arrayData_vendor = new Array();
  345. if (rowIds_vendor.length > 0) {
  346. for (var i = 0; i < rowIds_vendor.length; i++) {
  347. var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
  348. if (vendorRowData.Quantity == "" || vendorRowData.Quantity == 'undefined') {
  349. $.modalAlertNew("WMS00089");
  350. return;
  351. }
  352. var WHCode = $("" + SelPerson + "" + vendorRowData.ID + "").val();
  353. var obj = {
  354. ID: vendorRowData.ID,
  355. Sequence: i + 1,
  356. InvCode: vendorRowData.InvCode,
  357. Quantity: vendorRowData.Quantity,
  358. WHCode: WHCode,
  359. DetailReamrk: vendorRowData.DetailReamrk,
  360. Batch: vendorRowData.Batch
  361. };
  362. Details.push(obj);
  363. }
  364. var ICSASNs = {
  365. Dept: Dept,
  366. CodeType: CodeType,
  367. ApplyNegCode: ApplyNegCode,
  368. Custmer: Custmer,
  369. Remarks: Remarks,
  370. Code: Code,
  371. MTIME: MTIME,
  372. User: RoleEnCode,
  373. SYproject: SYproject,
  374. Detail: Details,
  375. }
  376. var ICSASN = [];
  377. ICSASN.push(ICSASNs);
  378. if (SaveICSOtherIn == [])
  379. {
  380. $.modalAlert("请添加物料信息!");
  381. return;
  382. }
  383. $.submitForm({
  384. url: "/DHAY/ICSCustomerSuppliedIn/SaveICSOtherIn?" + Math.random(),
  385. param: { ICSASN: JSON.stringify(ICSASN) },
  386. success: function () {
  387. $.currentWindow().$("#gridList").trigger("reloadGrid");
  388. }
  389. })
  390. }
  391. }*@
  392. function submitForm() {
  393. $("#gridList").find($("td[aria-describedby='gridList_rn']")).click();
  394. debugger;
  395. if (!$('#form1').formValid()) {
  396. return false;
  397. }
  398. var CodeType = $("#sel_CodeType").val();//单据类型
  399. var Dept = $("#sel_Dept").val();//部门
  400. var ApplyNegCode = $("#txtApplyNegCode").val();//在建项目
  401. var Custmer = $("#sel_Custmer").val();//客户
  402. var Remarks = $("#Remarks").val();//备注
  403. var Code = $("#Code").val();//单据号
  404. var MTIME = $("#txtMTIME").val();//单据号
  405. var SYproject = $("#txtSYproject").val();//受益项目
  406. var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
  407. var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
  408. var IDlist = "";
  409. var Details = [];
  410. SelPerson = "#SelBR_"
  411. var obj_vendor = $("#gridList");
  412. var rowIds_vendor = obj_vendor.getDataIDs();
  413. var arrayData_vendor = new Array();
  414. if (rowIds_vendor.length > 0) {
  415. for (var i = 0; i < rowIds_vendor.length; i++) {
  416. var vendorRowData = obj_vendor.getRowData(rowIds_vendor[i]);
  417. if (vendorRowData.Quantity == "" || vendorRowData.Quantity == 'undefined') {
  418. $.modalAlertNew("WMS00089");
  419. return;
  420. }
  421. /* var WHCode = $("" + SelPerson + "" + vendorRowData.ID + "").val();*/
  422. var obj = {
  423. ID: vendorRowData.ID,
  424. Sequence: i + 1,
  425. InvCode: vendorRowData.InvCode,
  426. Quantity: vendorRowData.Quantity,
  427. WHCode: vendorRowData.WHCode,
  428. DetailReamrk: vendorRowData.DetailReamrk,
  429. Batch: vendorRowData.Batch
  430. };
  431. Details.push(obj);
  432. }
  433. var ICSASNs = {
  434. Dept: Dept,
  435. CodeType: CodeType,
  436. ApplyNegCode: ApplyNegCode,
  437. Custmer: Custmer,
  438. Remarks: Remarks,
  439. Code: Code,
  440. MTIME: MTIME,
  441. User: RoleEnCode,
  442. SYproject: SYproject,
  443. Detail: Details,
  444. }
  445. var ICSASN = [];
  446. ICSASN.push(ICSASNs);
  447. $.submitForm({
  448. url: "/DHAY/ICSCustomerSuppliedIn/SaveICSOtherIn?" + Math.random(),
  449. param: { ICSASN: JSON.stringify(ICSASN) },
  450. success: function () {
  451. $.currentWindow().$("#gridList").trigger("reloadGrid");
  452. }
  453. })
  454. }
  455. }
  456. function GetSelectPerson(ID, WHCode) {
  457. debugger;
  458. var str = "";
  459. $.ajax({
  460. url: "/DHAY/ICSCustomerSuppliedReturn/Select_ICSWHCode",
  461. dataType: "json",
  462. async: false,
  463. async: false,
  464. success: function (data) {
  465. if (data != null && data.length > 0) {
  466. $("#SelBR_" + ID + "").find("option").remove();
  467. for (var i = 0; i < data.length; i++) {
  468. $("#SelBR_" + ID + "").append("<option value='" + data[i].WarehouseCode + "'>" + data[i].WarehouseName + "</option>");
  469. }
  470. }
  471. }
  472. });
  473. /* $("#SelBR_" + ID + "").selectpicker('refresh');*/
  474. /*$("#SelBR_" + ID + "").selectpicker('val', WHCode);*/
  475. }
  476. </script>
  477. <form id="form1">
  478. <div class="topPanel" style="height:10px">
  479. <div class="btn-group">
  480. @*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a>
  481. <a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@
  482. </div>
  483. </div>
  484. <div style="margin-right: 20px;">
  485. <table class="form">
  486. <thead>主表信息</thead>
  487. <tr>
  488. <th class="formTitle">单据类型:</th>
  489. <td class="formValue">
  490. <select id="sel_CodeType" name="sel_CodeType" class="form-control select2 required" style="width: 230px" placeholder="请选择单据类型..."></select>
  491. <input type="hidden" id="hidetext" />
  492. </td>
  493. <th class="formTitle">单号:</th>
  494. <td class="formValue">
  495. <input id="Code" type="text" readonly="readonly" class="form-control required" />
  496. </td>
  497. </tr>
  498. <tr>
  499. <th class="formTitle">受益部门:</th>
  500. <td class="formValue">
  501. <select id="sel_Dept" name="sel_Dept" class="form-control select2 required" style="width: 230px" placeholder="请选择受益部门..."></select>
  502. <input type="hidden" id="hidetext" />
  503. </td>
  504. <th class="formTitle">受益项目:</th>
  505. <td class="formValue">
  506. <input type="text" id="txtSYproject" class="form-control" />
  507. </td>
  508. </tr>
  509. <tr>
  510. <th class="formTitle">在建工程项目:</th>
  511. <td class="formValue">
  512. <input type="text" id="txtApplyNegCode" class="form-control" />
  513. </td>
  514. <th class="formTitle">客户:</th>
  515. <td class="formValue">
  516. <select id="sel_Custmer" name="sel_Custmer" class="form-control select2" style="width: 230px" placeholder="请选择客户..."></select>
  517. <input type="hidden" id="hidetext" />
  518. </td>
  519. </tr>
  520. <tr>
  521. <th class="formTitle">备注:</th>
  522. <td class="formValue">
  523. <input type="text" id="Remarks" class="form-control" />
  524. </td>
  525. </tr>
  526. <tr>
  527. <th class="formTitle">维护人:</th>
  528. <td class="formValue">
  529. <input id="txtMUSER" type="text" readonly="readonly" class="form-control" />
  530. </td>
  531. <th class="formTitle">维护时间:</th>
  532. <td class="formValue">
  533. <input id="txtMTIME" type="text" readonly="readonly" class="form-control" />
  534. </td>
  535. </tr>
  536. </table>
  537. </div>
  538. <div class="gridPanel" style="margin-left:10px">
  539. <span><strong>子表信息</strong></span>
  540. <table id="gridList"></table>
  541. <div style="text-align:center">
  542. <button id="AddRow" class="btn btn-primary" type="button" onclick="AddRowToLast()">添加</button>
  543. <button id="DeleteRow" type="button" class="btn btn-primary" onclick="DeleteRowToLast()">删除</button>
  544. </div>
  545. </div>
  546. </form>