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.

1317 lines
56 KiB

2 months ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
  6. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  7. <script src="~/Content/js/select2/select2.min.js"></script>
  8. <style>
  9. .ui-jqgrid .ui-jqgrid-btable tbody tr.jqgrow td {
  10. overflow: inherit;
  11. word-wrap: break-word;
  12. height: 34px;
  13. }
  14. .ui-jqgrid tr.jqgrow td {
  15. white-space: normal !important;
  16. /*height: auto;*/
  17. }
  18. </style>
  19. <script>
  20. var rfqcode = $.request("rfqcode");
  21. var status = $.request("status");
  22. var PURORG = decodeURI($.request("PURORG"));
  23. var PURTEAM = decodeURI($.request("PURTEAM"));
  24. $(function () {
  25. var UserName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName'
  26. var myDate = new Date();
  27. var year = myDate.getFullYear(); //获取当前年
  28. var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
  29. var date = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
  30. $("#RFQdate").val(year + "-" + mon + "-" + date);
  31. //getWorkPoint();
  32. InitControl();
  33. SelHASCOSTDETAILS();
  34. GetSORRVenDorFile();
  35. ClearTemp();
  36. reloadData();
  37. $.ajax({
  38. url: "/SRM/BicDoc_Publish/GetWorkPointByUser" + "?" + Math.random(),
  39. dataType: "json",
  40. async: false,
  41. success: function (data) {
  42. $("#Workpoint").val(data.rows[0].F_Location).trigger("change");
  43. }
  44. });
  45. $("#POorg option:contains('" + PURORG + "')").attr('selected', true).trigger("change");
  46. $("#PoOrgName option:contains('" + PURTEAM + "')").attr('selected', true).trigger("change");
  47. })
  48. function GetSORRVenDorFile() {
  49. var Fules = '';
  50. $.ajax({
  51. //url: "/SRM/BicDoc_Seller/GetICSBidDoc" + "?" + Math.random() + "&BidCode=" + BidCode + "&WorkPoint=" + WorkPoints,
  52. url: "/SRM/PriceInquiry/GetICSSORRFQRequestFromVenDorFile?rfqcode=" + rfqcode,
  53. dataType: "json",
  54. async: false,
  55. success: function (data) {
  56. if (data.rows.length > 0) {
  57. Fules = data.rows[0].Filename;
  58. }
  59. }
  60. });
  61. debugger
  62. var innerhtml = '';
  63. if (Fules != "" && Fules != null) {
  64. //Fules = Fules.substring(0, Fules.length - 1);
  65. var File = Fules.split(';');
  66. for (var i = 0; i < File.length; i++) {
  67. innerhtml += " <a href='../../../File/SORRFQFile/" + rfqcode + "/" + File[i] + "' download='" + File[i] + "' style='color:blue;'>" + File[i] + "</a>";
  68. }
  69. $("#hidbtn").html(innerhtml);
  70. $("#fileName").val(Fules);
  71. }
  72. }
  73. //function getWorkPoint() {
  74. // var $VenCode = $("#Workpoint");
  75. // $VenCode.select2({
  76. // allowClear: true,
  77. // escapeMarkup: function (m) {
  78. // return m;
  79. // }
  80. // });
  81. // $.ajax({
  82. // url: "/SRM/ASNAdd/GetVendors" + "?" + Math.random(),
  83. // dataType: "json",
  84. // async: false,
  85. // success: function (data) {
  86. // $.each(data, function (index, item) {
  87. // $VenCode.append("<option value='" + item.WorkPointCode + "'>&nbsp;" + item.WorkPointName + "</option>");
  88. // });
  89. // }
  90. // });
  91. //}
  92. function InitControl() {
  93. var OrgName = $("#PoOrgName");
  94. var Workpoint = $("#Workpoint");
  95. OrgName.select2({
  96. placeholder: "请选择",
  97. placeholderOption: "first",
  98. allowClear: true,
  99. escapeMarkup: function (m) {
  100. return m;
  101. }
  102. })
  103. Workpoint.select2({
  104. placeholder: "请选择",
  105. placeholderOption: "first",
  106. allowClear: true,
  107. escapeMarkup: function (m) {
  108. return m;
  109. }
  110. })
  111. OrgName.change(function () {
  112. $("#POorg").select2("val", "");
  113. $("#POorg").html("");
  114. var value = $("#PoOrgName option:selected").val()
  115. $.ajax({
  116. url: "/SRM/RFQAdd/GetPurTeam?code=" + value + "&" + Math.random,
  117. async: false,
  118. success: function (data) {
  119. var datas = JSON.parse(data);
  120. $("#POorg").append("<option value=''>&nbsp;请选择</option>")
  121. $.each(datas, function (index, item) {
  122. $("#POorg").append("<option value='" + item.purchugcode + "'>&nbsp;" + item.purchugname + "</option>")
  123. })
  124. }
  125. })
  126. })
  127. $("#INVType").select2({
  128. placeholder: "请选择",
  129. placeholderOption: "first",
  130. allowClear: true,
  131. escapeMarkup: function (m) {
  132. return m;
  133. }
  134. })
  135. $("#POorg").select2({
  136. placeholder: "请选择",
  137. placeholderOption: "first",
  138. allowClear: true,
  139. escapeMarkup: function (m) {
  140. return m;
  141. }
  142. })
  143. $.ajax({
  144. url: "/SRM/RFQAdd/GetInvType?" + Math.random,
  145. datatype: "json",
  146. async: false,
  147. success: function (data) {
  148. var datas = JSON.parse(data);
  149. $("#INVType").append("<option value=''>&nbsp;请选择</option>")
  150. $.each(datas, function (index, item) {
  151. $("#INVType").append("<option value='" + item.F_ItemName + "'>&nbsp;" + item.F_ItemName + "</option>")
  152. })
  153. }
  154. })
  155. $.ajax({
  156. url: "/SRM/ASNAdd/GetVendors" + "?" + Math.random(),
  157. dataType: "json",
  158. async: false,
  159. success: function (data) {
  160. $.each(data, function (index, item) {
  161. $("#Workpoint").append("<option value='" + item.WorkPointCode + "'>&nbsp;" + item.WorkPointName + "</option>");
  162. });
  163. }
  164. });
  165. $("#POorg").change(function () {
  166. if ($("#Workpoint").children('option:selected').val() == '') {
  167. $.modalAlert("请先选择站点!", "warning");
  168. return;
  169. }
  170. }
  171. )
  172. Workpoint.change(function () {
  173. debugger;
  174. OrgName.empty();
  175. var zd = Workpoint.find("option:selected").val();
  176. $.ajax({
  177. url: "/SRM/RFQAdd/GetPUROrganize?workpoint=" + zd + "&" + Math.random,
  178. datatype: "json",
  179. async: false,
  180. success: function (data) {
  181. var datas = JSON.parse(data)
  182. //OrgName.append("<option value=''>&nbsp;请选择</option>")
  183. if (status != "1") {
  184. $.each(datas, function (index, item) {
  185. OrgName.append("<option value='" + item.purchugcode + "'>&nbsp;" + item.purchugname + "</option>");
  186. $("#PoOrgName").val([item.purchugcode]).trigger("change");
  187. });
  188. } else {
  189. $.each(datas, function (index, item) {
  190. OrgName.append("<option value='" + item.purchugcode + "'>&nbsp;" + item.purchugname + "</option>");
  191. });
  192. }
  193. }
  194. })
  195. if (rfqcode == ""|| rfqcode == null || rfqcode == undefined) {
  196. $.ajax({
  197. url: "/SRM/RFQAdd/GetSercode?workpoint=" + zd + "&" + Math.random,
  198. datatype: "json",
  199. async: false,
  200. success: function (data) {
  201. $("#RFQNO").attr("value", data);
  202. $("#RFQName").attr("value", "询价单" + data);
  203. }
  204. })
  205. }
  206. })
  207. //$("#PoOrgName").change(function () {
  208. // var OrgNamess = OrgName.find("option:selected").val();
  209. // $.ajax({
  210. // url: "/SRM/RFQAdd/GetPurTeam?" + OrgNamess + "&" + Math.random,
  211. // datatype: "json",
  212. // async: false,
  213. // success: function (data) {
  214. // var datas = JSON.parse(data);
  215. // $("#POorg").append("<option value=''>&nbsp;请选择</option>")
  216. // $.each(datas, function (index, item) {
  217. // $("#POorg").append("<option value='" + item.purchugsoncode + "'>&nbsp;" + item.name + "</option>")
  218. // })
  219. // }
  220. // })
  221. //});
  222. if (rfqcode != "" && rfqcode != null && rfqcode != undefined) {
  223. $.ajax({
  224. url: "/SRM/PriceInquiry/GetICSSORRFQRequestFromrow?rfqcode=" + rfqcode + "&" + Math.random(),
  225. async: false,
  226. success: function (data) {
  227. var newdata = eval("(" + data + ")");
  228. var row1 = newdata.Table;
  229. $.each(row1, function (index, row) {
  230. if (row.rfqcode == rfqcode) {
  231. $("#Workpoint").val([row.workpoint]).trigger("change");
  232. //$("#Workpoint").trigger("change");
  233. //var PoOrgName = $("#PoOrgName").select2();
  234. //PoOrgName.val(row.purchugcode).trigger("change");
  235. $("#PoOrgName").val([row.purchugcode]).trigger("change");
  236. $("#POorg").val([row.purteam]).trigger("change");
  237. $("#Remarks").val(row.memo);
  238. $("#RFQNO").attr("value", rfqcode);
  239. $("#RFQName").attr("value", row.rfqname);
  240. $("#RFQdate").attr("value", row.createdate);
  241. $("#fileName").val(row.FileName);
  242. $("#Sel_HASCOSTDETAILS").val(row.HASCOSTDETAILS).trigger("change");//是否上传模板
  243. //var innerhtml = '';
  244. //if (row.FileName != "" && row.FileName != null) {
  245. //
  246. // var File = row.FileName.split(';');
  247. // for (var i = 0; i < File.length; i++) {
  248. // innerhtml += " <a href='../../../File/SORRFQFile/" + row.RFQCODE + "/" + File[i] + "' download='" + File[i] + "' style='color:blue;'>" + File[i] + "</a><br>";
  249. // }
  250. //}
  251. }
  252. })
  253. }
  254. })
  255. }
  256. }
  257. function SelHASCOSTDETAILS() {
  258. var $HASCOSTDETAILS = $("#Sel_HASCOSTDETAILS");
  259. $HASCOSTDETAILS.select2({
  260. allowClear: true,
  261. escapeMarkup: function (m) {
  262. return m;
  263. }
  264. });
  265. //$WhetheProdDevCapability.append("<option value=''>&nbsp;</option>");
  266. $HASCOSTDETAILS.append("<option value='0'>&nbsp;否</option>");
  267. $HASCOSTDETAILS.append("<option value='1'>&nbsp;是</option>");
  268. $("#Sel_HASCOSTDETAILS").val([1]).trigger("change");//是否上市公司
  269. }
  270. function ClearTemp() {
  271. $.ajax({
  272. url: "/SRM/InvAdd/ClearInvTemp?" + Math.random(),
  273. datatype: "json",
  274. async: false
  275. })
  276. }
  277. //加载jqGrid
  278. function reloadData() {
  279. document.getElementById("gridPanel").innerHTML = ' <table id="gridList"></table> ';//重置grid
  280. var SelectPerson = GetSelectBuiess();
  281. $("#gridList").dataGrid({
  282. url: "/SRM/PriceInquiry/GetInvTabICSSORRFQRequestFrom?" + Math.random(),
  283. postData: { rfqno: $("#RFQNO").val() },
  284. height: $(window).height() - 300,
  285. width: $(window).width(),
  286. cellEdit: true,
  287. colModel: [
  288. { label: '主键', name: 'ID', width: 150, align: 'left', hidden: true, key: true },
  289. { label: '物料代码', name: '物料代码', width: 180, align: 'left' },
  290. { label: '物料描述', name: '物料名称', width: 150, align: 'left' },
  291. { label: '物料规格', name: '物料规格', width: 150, align: 'lreft' },
  292. { label: '物料类型', name: '物料类型', width: 150, align: 'left', hidden: true },
  293. { label: '单位', name: '单位', width: 50, align: 'left' },
  294. { label: '询价备注', name: '备注', width: 100, align: 'left',editable: true,hidden:true },
  295. { label: '参考价格', name: '参考价格', width: 100, align: 'left', editable: true, edittype: 'text', editrules: { number: true },hidden:true },
  296. { label: '需求数量', name: '预计需求量', width: 60, align: 'left', edittype: 'text', editrules: { number: true } },
  297. {
  298. label: '是否需上传成本明细', name: '成本明细', width: 150, align: 'left', editable: true, edittype: 'select', editoptions: { value: GetItemCode(), },
  299. formatter: function (cellvalue) {
  300. if (cellvalue == "undefined" || cellvalue == "" || cellvalue == undefined) {
  301. return "";
  302. } else if (cellvalue == "1") {
  303. return "是";
  304. } else if (cellvalue == "0") {
  305. return "否";
  306. }
  307. },hidden:true
  308. },
  309. { label: '是否含税', name: '是否含税', width: 100, align: 'left', editable: true, edittype: 'select', editoptions: { value: GetItemCode(), },hidden:true },
  310. { label: '币种', name: '币种', width: 150, align: 'left', editable: true,hidden:true },
  311. { label: 'HiddenFile', name: 'HiddenFile', align: 'left', hidden: true },
  312. { label: '备注', name: '备注', width: 180, align: 'left' },
  313. {
  314. label: '技术要求文件', name: '文件路径', width: 200, align: 'left',
  315. formatter: function (cellvalue, options, rowObject) {
  316. var RFQNO = $("#RFQNO").val();
  317. var html = "";
  318. if (cellvalue != "" && cellvalue != null) {
  319. html = " <a href='../../../File/SORRFQFile/" + RFQNO + "/" + cellvalue + "' download='" + cellvalue + "' style='color:#1281C1;'>" + cellvalue + "</a>";
  320. //html = " <a href='../../../File/SORRFQFile/" + RFQNO + "/" + cellvalue + "' download='" + cellvalue + "' style='color:blue;'>" + cellvalue + "</a>";
  321. }
  322. return html;
  323. }
  324. },
  325. { label: '物料描述', name: '物料描述', width: 180, align: 'left', hidden: true },
  326. { label: '制造商', name: '制造商', width: 180, align: 'left', hidden: true },
  327. { label: '制造商编码', name: '制造商编码', width: 180, align: 'left', hidden: true },
  328. { label: '年用量', name: '年用量', width: 180, align: 'left', hidden: true },
  329. { label: '项目信息', name: '项目信息', width: 180, align: 'left', hidden: true },
  330. { label: '物料等级', name: '物料等级', width: 180, align: 'left', hidden: true },
  331. { label: '是否为客户指定', name: '是否为客户指定', width: 180, align: 'left', hidden: true },
  332. { label: 'Purchasing', name: 'Purchasing', width: 180, align: 'left', hidden: true },
  333. { label: '技术负责人', name: '技术负责人', width: 180, align: 'left', hidden: true },
  334. {
  335. label: '分配采购员', name: '分配采购员', width: 180, align: 'left',
  336. formatter: function (cellvalue, options, rowObject) {
  337. debugger;
  338. if (rowObject.ID != null) {
  339. var ID = str = rowObject.ID.replace(/[^\w\s]/gi, '');
  340. }
  341. var html = "";
  342. html += ' <select id="SelPersonSUM_' + ID + '" data-live-search ="true" Title=\"未选择\" class="selectpicker" data-width="150px">';
  343. html += SelectPerson;
  344. html += ' </select>';
  345. return cellvalue = html;
  346. }
  347. },
  348. { label: ' ', width: 80, align: 'center', formatter: btnModifys },
  349. ],
  350. cellsubmit: "clientArray",
  351. rowNum: 10000,
  352. gridComplete: function () {
  353. debugger;
  354. //设置select
  355. var RowDatas = $("#gridList").jqGrid('getDataIDs');
  356. //var ISTou = $("#gridList1").jqGrid("getCell", RowDatas[0], "IsTou");
  357. for (var j = 0; j < RowDatas.length; j++) {
  358. debugger;
  359. var ID = $("#gridList").jqGrid("getCell", RowDatas[j], "ID").replace(/[^\w\s]/gi, '');
  360. var Purchasing = $("#gridList").jqGrid("getCell", RowDatas[j], "Purchasing");
  361. var VenCode = $("#gridList").jqGrid("getCell", RowDatas[j], "物料代码");
  362. var colr = "SelPersonSUM_" + ID;
  363. // alert(ECNDocNO + "!" + Transfer + "!" + colr);
  364. if (Purchasing != "") {
  365. $("#" + colr).selectpicker('refresh');
  366. $("#" + colr).selectpicker('val', Purchasing);
  367. } else {
  368. $.ajax({
  369. url: "/SRM/PriceInquiry/GetPurchasing",
  370. dataType: "json",
  371. data: { VenCode: VenCode },
  372. async: false,
  373. success: function (data) {
  374. $("#" + colr).selectpicker('refresh');
  375. $("#" + colr).selectpicker('val', data.mass);
  376. }
  377. })
  378. }
  379. }
  380. },
  381. });
  382. }
  383. //下拉选项
  384. function GetItemCode() {
  385. var str = "0:否;1:是";
  386. /*debugger;*/
  387. return str;
  388. }
  389. //获取采购信息
  390. function GetSelectBuiess() {
  391. var html = '';
  392. var WorkPoint = $("#Workpoint").children('option:selected').val();
  393. //var BidCode = $("#txt_BidCode").val();
  394. $.ajax({
  395. url: "/SRM/PriceInquiry/GetSelectBuiess?" + Math.random() + "&WorkPoint=" + WorkPoint,
  396. dataType: "json",
  397. async: false,
  398. success: function (data) {
  399. debugger;
  400. //html = ' <option value="">未选择</option> ';
  401. if (data != false && data != null && data.length > 0) {
  402. for (var i = 0; i < data.length; i++) {
  403. html += ' <option value="' + data[i].F_Account + '">' + data[i].F_RealName + '</option> ';
  404. }
  405. }
  406. }
  407. });
  408. return html;
  409. }
  410. //操作按钮上传文件
  411. function btnModifys(cellvalue, options, rowObject) {
  412. return cellvalue = "<a class=\"btn btn-danger dropdown-text\" onclick=\"Back('" + rowObject.ID + "')\">退回</a>";
  413. }
  414. //上传触发控件
  415. function UpLoadFilestechnicalrequirement(ID, GGUID) {
  416. $("#gridList").find($("td[aria-describedby='gridList_rn']")).click();//提交取消编辑状态
  417. var rowData = $("#gridListVENDORCERTIFICATE").jqGrid('getRowData', ID);
  418. $("#FileUpBYRZinp").val(ID);
  419. //$("#FileUpBYRZEndDate").val(rowData.ENDDATE);
  420. //$("#FileUpBYRZEndCQ").val(rowData.ADDITION1);
  421. //$("#FileUpBYGGUID").val(GGUID);
  422. $("#FileUpBYRZ").click();
  423. }
  424. //上传文件方法
  425. function UpLoadFileBYRZ(fileinfo) {
  426. var ID = $("#FileUpBYRZinp").val();
  427. var RFQNO = $("#RFQNO").val();
  428. var files = fileinfo.files;
  429. var fileName = files[0].name;
  430. if (fileName != null && fileName != "") {
  431. var regex = /\s/;
  432. if (regex.test(fileName)) {
  433. $.modalAlert("文件名:<span style='color: red;'>" + fileName + "</span>,包含空格,上传失败,请修改后重新上传!", "warning");
  434. var file = document.getElementById('FileUpBYRZ');
  435. file.value = "";
  436. return false;
  437. }
  438. var data = new FormData();
  439. jQuery.each(jQuery('#FileUpBYRZ')[0].files, function (i, file) {
  440. data.append('file-' + i, file);
  441. });
  442. $.modalConfirm("确定上传文件吗?", function (r) {
  443. if (r) {
  444. $.ajax({
  445. url: "/SRM/RFQAdd/UpLoadFileImport" + "?" + Math.random() + "&ID=" + ID + "&RFQNO=" + RFQNO,
  446. type: "post",
  447. data: data,
  448. dataType: "json",
  449. contentType: false,
  450. processData: false,
  451. success: function (data) {
  452. if (data.state == 'error') {
  453. $.modalAlert("上传失败!");
  454. } else if (data.state == 'success') {
  455. //var FileName = data.FileName;
  456. //var PathName = data.PathName;
  457. //$("#AEquipment").text(FileName);
  458. //$('#AEquipment').attr('href', '../../File/VendorFile/' + RoleEnCode + '/' + FileName + '');
  459. $("#gridList").jqGrid('setCell', ID, "文件路径", fileName);
  460. $("#gridList").jqGrid('setCell', ID, "HiddenFile", fileName);
  461. $.modalMsg("上传成功", "success");
  462. }
  463. },
  464. error: function (aa) {
  465. //$.modalAlert("上传失败:" + aa);
  466. $.modalMsg("上传失败", "error");
  467. }
  468. });
  469. }
  470. });
  471. }
  472. var file = document.getElementById('FileUpBYRZ');
  473. file.value = "";
  474. }
  475. //查看
  476. function btnLook(cellvalue, options, rowObject) {
  477. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">查看</a>";
  478. }
  479. function btnLook1(cellvalue, options, rowObject) {
  480. return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick1('" + rowObject.ID + "')\">查看</a>";
  481. }
  482. function UpLoadClick(ID) {
  483. var sfqcode = $("#RFQNO").val();
  484. var zd = $("#Workpoint").children('option:selected').val();
  485. $.modalOpen2({
  486. id: "InvUpdate",
  487. title: "查看修改物料",
  488. url: "/SRM/InvAdd/Index" + "?type=''&SFQCODE=" + sfqcode + "" + "&workpoint=" + zd + "&id=" + ID + "&" + Math.random(),
  489. width: "95%",
  490. height: "95%",
  491. callBack: function (iframeId) {
  492. top.frames[iframeId].submitForm();
  493. top.frames[iframeId].Close();
  494. $("#gridList").jqGrid().setGridParam({ datatype: 'json' }, { postData: { rfqno: $("#RFQNO").val() } }).trigger('reloadGrid');
  495. }
  496. });
  497. }
  498. function UpLoadClick1(ID) {
  499. var sfqcode = $("#RFQNO").val();
  500. var zd = $("#Workpoint").children('option:selected').val();
  501. $.modalOpen2({
  502. id: "SupUpdate",
  503. title: "查看修改供应商",
  504. url: "/SRM/SupplierAdd/Index" + "?SFQCODE=" + sfqcode + "" + "&workpoint=" + zd + "&id=" + ID + "&" + Math.random(),
  505. width: "700px",
  506. height: "450px",
  507. callBack: function (iframeId) {
  508. top.frames[iframeId].submitForm();
  509. top.frames[iframeId].Close();
  510. $("#gridList2").jqGrid().setGridParam({ datatype: 'json' }, { postData: { rfqno: $("#RFQNO").val() } }).trigger('reloadGrid');
  511. }
  512. });
  513. }
  514. function AddInv(type) {
  515. if ($("#RFQNO").val() == "") {
  516. $.modalAlert("请先填写站点信息!", "warning")
  517. return;
  518. }
  519. if ($("#RFQdate").val() == "") {
  520. $.modalAlert("请先填写单据日期!", "warning")
  521. return;
  522. }
  523. if (status != "1") {
  524. if ($("#PoOrgName").children('option:selected').val() == "") {
  525. $.modalAlert("请先选择采购组织!", "warning")
  526. return;
  527. }
  528. }
  529. var sfqcode = $("#RFQNO").val();
  530. var WorkPoint = $("#Workpoint").children('option:selected').val();
  531. var index = layer.open({
  532. id: "Formitem",
  533. type: 2,
  534. shade: 0.3,
  535. title: "新增物料",
  536. fix: false,
  537. area: ["900px", "600px"],
  538. content: "/SRM/InvAdd/Invmes?" + Math.random() + "&workpoint=" + WorkPoint,
  539. btn: ['确定', '关闭'],
  540. btnclass: ['btn btn-primary', 'btn btn-danger'],
  541. maxmin: true,
  542. yes: function (index, layero) {
  543. var body = layer.getChildFrame('body', index);
  544. var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
  545. objArr = iframeWin.submitForm();//执行iframe页的方法:iframeWin.method();
  546. var arrayData = getJQAllData("#gridList");
  547. for (var j = 0; j < objArr.length; j++) {
  548. for (var i = 0; i < arrayData.length; i++) {
  549. if (objArr[j].物料代码 == arrayData[i].物料代码) {
  550. $.modalAlert("已添加物料!请勿重复添加!", "warning");
  551. return;
  552. }
  553. }
  554. $("#gridList").jqGrid('addRowData', objArr[j].ID, objArr[j], 'last');
  555. $(".unwritten").hide();
  556. }
  557. layer.close(index);
  558. }, cancel: function () {
  559. return true;
  560. }
  561. });
  562. }
  563. function getJQAllData(list) {
  564. //拿到grid对象
  565. var obj = $(list);
  566. //获取grid表中所有的rowid值
  567. var rowIds = obj.getDataIDs();
  568. //初始化一个数组arrayData容器,用来存放rowData
  569. var arrayData = new Array();
  570. if (rowIds.length > 0) {
  571. for (var i = 0; i < rowIds.length; i++) {
  572. //rowData=obj.getRowData(rowid);//这里rowid=rowIds[i];
  573. arrayData.push(obj.getRowData(rowIds[i]));
  574. }
  575. }
  576. return arrayData;
  577. }
  578. function AddSupplier(type) {
  579. if ($("#RFQNO").val() == "") {
  580. $.modalAlert("请先填写站点信息!", "warning")
  581. return;
  582. }
  583. if ($("#RFQdate").val() == "") {
  584. $.modalAlert("请先填写单据日期!", "warning")
  585. return;
  586. }
  587. if (status != "1") {
  588. if ($("#PoOrgName").children('option:selected').val() == "") {
  589. $.modalAlert("请先选择采购组织!", "warning")
  590. return;
  591. }
  592. }
  593. var sfqcode = $("#RFQNO").val();
  594. var zd = $("#Workpoint").children('option:selected').val();
  595. var index = layer.open({
  596. id: "Formitem",
  597. type: 2,
  598. shade: 0.3,
  599. title: "新增供应商",
  600. fix: false,
  601. area: ["900px", "600px"],
  602. content: "/SRM/SupplierAdd/CustomerMes" + "?SFQCODE=" + sfqcode + "" + "&workpoint=" + zd + "&" + Math.random(),
  603. btn: ['确定', '关闭'],
  604. btnclass: ['btn btn-primary', 'btn btn-danger'],
  605. maxmin: true,
  606. yes: function (index, layero) {
  607. var body = layer.getChildFrame('body', index);
  608. var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
  609. objArr = iframeWin.submitForm();//执行iframe页的方法:iframeWin.method();
  610. var arrayData = getJQAllData("#gridList2");
  611. for (var j = 0; j < objArr.length; j++) {
  612. for (var i = 0; i < arrayData.length; i++) {
  613. if (objArr[j].供应商代码 == arrayData[i].供应商代码) {
  614. $.modalAlert("已添供应商!请勿重复添加!", "warning");
  615. return;
  616. }
  617. }
  618. $("#gridList2").jqGrid('addRowData', objArr[j].ID, objArr[j], 'last');
  619. $(".unwritten").hide();
  620. }
  621. layer.close(index);
  622. }, cancel: function () {
  623. return true;
  624. }
  625. });
  626. }
  627. function Close() {
  628. ClearTemp();
  629. $.modalClose();
  630. }
  631. function deleteInv() {
  632. var ids = $('#gridList').jqGrid('getGridParam', 'selarrrow');
  633. if (ids.lenth <= 0) {
  634. $.modalAlert("请选择要删除的数据!", "warning");
  635. return;
  636. }
  637. var rowid = "";
  638. var WorkPoint = $("#sel_WorkPoint option:checked").val();
  639. var objArr = "";
  640. //var objList = $("#gridList1").jqGrid('getGridParam', 'selrow');
  641. //if (objList.length == 0) {
  642. // $.modalAlert("请选择要删除的标的数据!");
  643. // return;
  644. //}
  645. //for (var i = 0; i < objList.length; i++) {
  646. // var rowId = objList[i];
  647. // var rowData = $("#gridList1").jqGrid('getRowData', rowId);
  648. // objArr += "'" + rowData.ID + "',";
  649. // rowid += rowData.ID + ",";
  650. //}
  651. //rowid = rowid.trimEnd(',');
  652. //var rowid1 = rowid.split(',');
  653. $.deleteForm({
  654. url: "/SRM/InvAdd/DeleteInvRow" + "?" + Math.random(),
  655. param: { keyValue: $("#gridList").jqGridRowValue().ID },
  656. success: function () {
  657. $("#gridList").delRowData($("#gridList").jqGridRowValue().ID);
  658. //$.currentWindow().$("#gridList1").trigger("reloadGrid");
  659. //for (var i = 0; i < rowid1.length; i++) {
  660. // $("#gridList1").delRowData(rowid1[i]);
  661. //}
  662. var obj_item = $("#gridList");
  663. var rowIds_item = obj_item.getDataIDs();
  664. if (rowIds_item.length <= 0) {
  665. reloadData();
  666. }
  667. }
  668. })
  669. }
  670. function DeleteSup() {
  671. var ids = $('#gridList2').jqGrid('getGridParam', 'selarrrow');
  672. if (ids.lenth <= 0) {
  673. $.modalAlert("请选择要删除的数据!", "warning");
  674. return;
  675. }
  676. var rowid = "";
  677. var WorkPoint = $("#sel_WorkPoint option:checked").val();
  678. var objArr = "";
  679. $.deleteForm({
  680. url: "/SRM/SupplierAdd/Delete" + "?" + Math.random(),
  681. param: { keyValue: $("#gridList2").jqGridRowValue().ID },
  682. success: function () {
  683. $("#gridList2").delRowData($("#gridList2").jqGridRowValue().ID);
  684. //$.currentWindow().$("#gridList1").trigger("reloadGrid");
  685. //for (var i = 0; i < rowid1.length; i++) {
  686. // $("#gridList1").delRowData(rowid1[i]);
  687. //}
  688. var obj_item = $("#gridList2");
  689. var rowIds_item = obj_item.getDataIDs();
  690. if (rowIds_item.length <= 0) {
  691. reloadData();
  692. }
  693. }
  694. })
  695. }
  696. //保存 提交
  697. function submitForm() {
  698. $("#gridList2").find($("td[aria-describedby='gridList2_rn']")).click();
  699. $("#gridList").find($("td[aria-describedby='gridList_rn']")).click();
  700. var FKID = '';
  701. if ($("#RFQNO").val() == "") {
  702. $.modalAlert("请先选择站点!", "warning");
  703. return;
  704. }
  705. //if ($("#PoOrgName").text() == "") {
  706. // $.modalAlert("采购组织名称不能为空!", "warning");
  707. // return;
  708. //}
  709. if ($("#RFQdate").val() == "") {
  710. $.modalAlert("单据日期不能为空!", "warning");
  711. return;
  712. }
  713. var gridList = $("#gridList");
  714. var gridListrowIds = gridList.getDataIDs();
  715. if (gridListrowIds.length <= 0) {
  716. $.modalAlert("请选择物料再提交!", "warning");
  717. return;
  718. }
  719. var gridList2 = $("#gridList2");
  720. var gridList2rowIds = gridList2.getDataIDs();
  721. //if (gridList2rowIds.length <= 0) {
  722. // $.modalAlert("请选择供应商再提交!", "warning");
  723. // return;
  724. //}
  725. //if (gridList2rowIds.length > 0) {
  726. // for (var i = 0; i < gridList2rowIds.length; i++) {
  727. // var gridList2RowData = gridList2.getRowData(gridList2rowIds[i]);
  728. // FKID += "" + gridList2RowData.ID + ",";
  729. // if (gridList2RowData.供应商付款条件 == '') {
  730. // $.modalAlert("第" + (i + 1).toString() + "行,未输入付款条件!");
  731. // return false;
  732. // }
  733. // if (gridList2RowData.是否显示参考价 == '') {
  734. // $.modalAlert("第" + (i + 1).toString() + "行,未选择是否显示参考价!");
  735. // return false;
  736. // }
  737. // }
  738. //}
  739. var code = $("#RFQNO").val();
  740. var FileName = $("#fileName").val();
  741. debugger;
  742. var Orgcode = $("#PoOrgName").val();
  743. var Name = $("#RFQName").val();
  744. var now = new Date();
  745. //var CreateDate = now.getFullYear() + "-" + ((now.getMonth() + 1) < 10 ? "0" : "") + (now.getMonth() + 1) + "-" + (now.getDate() < 10 ? "0" : "") + now.getDate();
  746. //var CreateTime = (now.getHours() < 10 ? "0" : "") + now.getHours() + ":" + (now.getMinutes() < 10 ? "0" : "") + now.getMinutes() + ":" + (now.getSeconds() < 10 ? "0" : "") + now.getSeconds();
  747. var Workpoint = $("#Workpoint").val();
  748. var Purteam = $("#POorg").val();
  749. var begindate = $("#RFQdate").val();
  750. var COSTANALYSISTEMPLATE = "~/File/报价模板.xlsx";
  751. var COSTTYPE = "Common";
  752. var ISUNIFYANALYSISTEMPLATE = "1";
  753. var memo = $("#Remarks").val();
  754. var status = "0";
  755. var ID = FKID;
  756. var HASCOSTDETAILS = '';
  757. var HASCOSTDETAILS = $("#Sel_HASCOSTDETAILS").val();
  758. //if (HASCOSTDETAILS == "是") {
  759. // HASCOSTDETAILS = 1
  760. //} else {
  761. // HASCOSTDETAILS = 0
  762. //}
  763. //物料
  764. SelPerson = "#SelPersonSUM_"
  765. var obj_item = $("#gridList");
  766. var rowIds_item = obj_item.getDataIDs();
  767. var arrayData_item = new Array();
  768. if (rowIds_item.length > 0) {
  769. for (var i = 0; i < rowIds_item.length; i++) {
  770. var itemRowData = obj_item.getRowData(rowIds_item[i]);
  771. if (itemRowData.预计需求量 == '' || itemRowData.预计需求量 == null) {
  772. $.modalAlert("请维护物料" + itemRowData.物料代码 + "计划采购数量", "warning")
  773. return false;
  774. }
  775. if (itemRowData.是否显示参考价 == "是") {
  776. ISSHOWPRICE = 1
  777. } else {
  778. ISSHOWPRICE = 0
  779. }
  780. //if (itemRowData.DeliveryTime == '' || itemRowData.DeliveryTime == null) {
  781. // $.modalAlert("请维护物料" + itemRowData.INVCODE + "交期", "warning")
  782. // return false;
  783. //}
  784. var obj = {
  785. ID: itemRowData.ID,
  786. RFQCODE: code,
  787. ITEMCODE: itemRowData.物料代码,
  788. ITEMNAME: itemRowData.物料名称,
  789. InvStd: itemRowData.物料规格,
  790. ITEMTYPE: itemRowData.物料类型,
  791. UNIT: itemRowData.单位,
  792. MEMO: itemRowData.备注,
  793. Requirements: itemRowData.技术要求,
  794. REFERPRICE: itemRowData.参考价格,
  795. REQUESTQUANTITY: itemRowData.预计需求量,
  796. HASCOSTDETAILS: HASCOSTDETAILS,//是否需上传成本明细
  797. ISINCLUDETAX: itemRowData.是否含税,
  798. CURRENCY: itemRowData.币种,
  799. RFQITEMREFERCODE: itemRowData.HiddenFile,
  800. Workpoint: Workpoint,
  801. InvDesc: itemRowData.物料描述,
  802. ManuFacturer: itemRowData.制造商,
  803. ManuFacturerInvCode: itemRowData.制造商编码,
  804. YearQty: itemRowData.年用量,
  805. ProjectInfo: itemRowData.项目信息,
  806. MaterialGrade: itemRowData.物料等级,
  807. CustomerSpecified: itemRowData.是否为客户指定,
  808. TechnicalDirector: itemRowData.技术负责人,
  809. Purchasing: $("" + SelPerson + "" + itemRowData.ID.replace(/[^\w\s]/gi, '') + "").val()//采购员
  810. };
  811. arrayData_item.push(obj);
  812. }
  813. } else {
  814. $.modalAlert("请选择标的信息!", "warning")
  815. return false;
  816. }
  817. //供应商
  818. //标的
  819. //var obj_VenCode = $("#gridList2");
  820. //var rowIds_VenCode = obj_VenCode.getDataIDs();
  821. //var arrayData_VenCode = new Array();
  822. //if (rowIds_VenCode.length > 0) {
  823. // for (var i = 0; i < rowIds_VenCode.length; i++) {
  824. // var VenCodeRowData = obj_VenCode.getRowData(rowIds_VenCode[i]);
  825. // var obj = {
  826. // ID: VenCodeRowData.ID,
  827. // RFQCODE: code,
  828. // VENDORCODE: VenCodeRowData.供应商代码,
  829. // VENDORTYPE: VenCodeRowData.供应商类型,
  830. // TAXRATE: VenCodeRowData.供应商税率,
  831. // CURRENCY:VenCodeRowData.供应商币别,
  832. // PAYMENTCONDITION:VenCodeRowData.供应商付款条件,
  833. // ISSHOWPRICE: ISSHOWPRICE,
  834. // CauseOff: VenCodeRowData.关闭原因,
  835. // Workpoint: Workpoint
  836. // };
  837. // arrayData_VenCode.push(obj);
  838. // }
  839. //} else {
  840. // $.modalAlert("请选择应标供应商!", "warning")
  841. // return false;
  842. //}
  843. var arrayitem = JSON.stringify(arrayData_item);
  844. /* var arrayVenCode = JSON.stringify(arrayData_VenCode);*/
  845. $.ajax({
  846. url: "/SRM/PriceInquiry/AddRFQByPNPurchasing?" + Math.random(),
  847. data: {
  848. RFQCODE: code,
  849. PURCHUGCODE: Orgcode,
  850. RFQNAME: Name,
  851. //CreateDate1: CreateDate,
  852. //CreateTime1: CreateTime,
  853. HASCOSTDETAILS: HASCOSTDETAILS,//是否需上传成本明细
  854. FileName: FileName,
  855. RFQstatus:status,
  856. Workpoint: Workpoint,
  857. PURTeam: Purteam,
  858. BEGINDATE: begindate,
  859. //COSTANALYSISTEMPLATE1: COSTANALYSISTEMPLATE,
  860. COSTTYPE: COSTTYPE,
  861. ISUNIFYANALYSISTEMPLATE1: ISUNIFYANALYSISTEMPLATE,
  862. //COSTTYPE1: COSTTYPE,
  863. MEMO: memo,
  864. STATUS: status,
  865. ID: ID,
  866. arrayBidDocBD: arrayitem,
  867. /* arrayBidDocGYS: arrayVenCode,*/
  868. },
  869. type: "post",
  870. dataType: "json",
  871. success: function (data) {
  872. if (data.state == "success") {
  873. layer.msg(data.message);
  874. $.currentWindow().$("#gridList").trigger("reloadGrid");
  875. $.modalClose();
  876. return true;
  877. } else {
  878. layer.msg(data.message);
  879. }
  880. },
  881. error: function (XMLHttpRequest, textStatus, errorThrown) {
  882. layer.msg(errorThrown);
  883. },
  884. beforeSend: function () {
  885. },
  886. complete: function () {
  887. $.loading(false);
  888. }
  889. });
  890. }
  891. function UpdateTime() {
  892. if ($("#Workpoint").children('option:selected').val() == "") {
  893. $.modalAlert("请先选择站点!", "warning");
  894. return;
  895. }
  896. $("#gridList").find($("td[aria-describedby='gridList_rn']")).click();
  897. var obj_Item1 = $("#gridList");
  898. var rowIds_Item1 = obj_Item1.getDataIDs();
  899. if (rowIds_Item1.length > 0) {
  900. for (var i = 0; i < rowIds_Item1.length; i++) {
  901. var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
  902. var RowData_Item1Date = obj_Item1.getRowData(rowIds_Item1[0]);
  903. var Qty = RowData_Item1Date.预计需求量
  904. if (Qty == "") {
  905. $.modalAlert("请先填写第一个数量再同步");
  906. return;
  907. }
  908. //RowData_Item1.DeliveryTime = Datetime
  909. //$('#gridList1').jqGrid('setRowData', i, RowData_Item1);
  910. //给单元格赋值
  911. $("#gridList").jqGrid('setCell', rowIds_Item1[i], "预计需求量", Qty);
  912. }
  913. }
  914. }
  915. function AddPU() {
  916. if ($("#Workpoint").children('option:selected').val() == "") {
  917. $.modalAlert("请先选择站点!", "warning");
  918. return;
  919. }
  920. if ($("#PoOrgName").children('option:selected').val() == "") {
  921. $.modalAlert("请先选择采购组织!", "warning")
  922. return;
  923. }
  924. if ($("#POorg").children('option:selected').val() == "") {
  925. $.modalAlert("请先选择采购负责人!", "warning")
  926. return;
  927. }
  928. var WorkPoint = $("#Workpoint").children('option:selected').val();
  929. var index = layer.open({
  930. id: "ICSSORRFQByPU",
  931. type: 2,
  932. shade: 0.3,
  933. title: "请购单添加",
  934. fix: false,
  935. area: ["1000px", "600px"],
  936. content: "/SRM/RFQAdd/ICSSORRFQByPU?" + Math.random() + "&WorkPoint=" + WorkPoint,
  937. btn: ['确定', '关闭'],
  938. btnclass: ['btn btn-primary', 'btn btn-danger'],
  939. maxmin: true,
  940. yes: function (index, layero) {
  941. var body = layer.getChildFrame('body', index);
  942. var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
  943. objArr = iframeWin.submitForm();//执行iframe页的方法:iframeWin.method();
  944. var arrayData = getJQAllData("#gridList");
  945. for (var j = 0; j < objArr.length; j++) {
  946. for (var i = 0; i < arrayData.length; i++) {
  947. if (objArr[j].物料代码 == arrayData[i].物料代码) {
  948. $.modalAlert("已添加标的!请勿重复添加!");
  949. return;
  950. }
  951. }
  952. $("#gridList").jqGrid('addRowData', objArr[j].ID, objArr[j], 'last');
  953. $(".unwritten").hide();
  954. }
  955. layer.close(index);
  956. }, cancel: function () {
  957. return true;
  958. }
  959. });
  960. }
  961. function AddPoMain() {
  962. if ($("#Workpoint").children('option:selected').val() == "") {
  963. $.modalAlert("请先选择站点!", "warning");
  964. return;
  965. }
  966. if ($("#PoOrgName").children('option:selected').val() == "") {
  967. $.modalAlert("请先选择采购组织!", "warning")
  968. return;
  969. }
  970. if ($("#POorg").children('option:selected').val() == "") {
  971. $.modalAlert("请先选择采购负责人!", "warning")
  972. return;
  973. }
  974. var WorkPoint = $("#Workpoint").children('option:selected').val();
  975. var index = layer.open({
  976. id: "ICSSORRFQByPO",
  977. type: 2,
  978. shade: 0.3,
  979. title: "采购订单添加",
  980. fix: false,
  981. area: ["1200px", "600px"],
  982. content: "/SRM/RFQAdd/ICSSORRFQByPO?" + Math.random() + "&WorkPoint=" + WorkPoint,
  983. btn: ['确定', '关闭'],
  984. btnclass: ['btn btn-primary', 'btn btn-danger'],
  985. maxmin: true,
  986. yes: function (index, layero) {
  987. var body = layer.getChildFrame('body', index);
  988. var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
  989. objArr = iframeWin.submitForm();//执行iframe页的方法:iframeWin.method();
  990. var arrayData = getJQAllData("#gridList");
  991. for (var j = 0; j < objArr.length; j++) {
  992. for (var i = 0; i < arrayData.length; i++) {
  993. if (objArr[j].物料代码 == arrayData[i].物料代码) {
  994. $.modalAlert("已添加标的!请勿重复添加!");
  995. return;
  996. }
  997. }
  998. $("#gridList").jqGrid('addRowData', objArr[j].ID, objArr[j], 'last');
  999. $(".unwritten").hide();
  1000. }
  1001. layer.close(index);
  1002. }, cancel: function () {
  1003. return true;
  1004. }
  1005. });
  1006. }
  1007. function UpLoadFile(fileinfo) {
  1008. //$("#CurrentPoCode").val(poCode);
  1009. var files = fileinfo.files;
  1010. var RFQNO = $("#RFQNO").val();
  1011. var fileName = '';
  1012. var innerhtml = '';
  1013. for (var i = 0; i < files.length; i++) {
  1014. var regex = /\s/;
  1015. if (regex.test(files[i].name)) {
  1016. $.modalAlert("文件名:<span style='color: red;'>" + files[i].name + "</span>,包含空格,上传失败,请修改后重新上传!", "warning");
  1017. var file = document.getElementById('FileUp');
  1018. file.value = "";
  1019. return false;
  1020. }
  1021. fileName += "" + files[i].name + ";";
  1022. if (fileName != null && fileName != "") {
  1023. var data = new FormData();
  1024. jQuery.each(jQuery('#FileUp')[0].files, function (i, file) {
  1025. data.append('file-' + i, file);
  1026. });
  1027. //data.append("STNO", $("#CurrentSTNO").val());
  1028. //var info = document.getElementById("form1");
  1029. //var formData = new FormData(info);
  1030. $.modalConfirm("确定上传文件吗?", function (r) {
  1031. if (r) {
  1032. $.ajax({
  1033. url: "/SRM/RFQAdd/UpLoadFileImport" + "?" + Math.random() + "&RFQNO=" + RFQNO,
  1034. type: "post",
  1035. data: data,
  1036. dataType: "json",
  1037. contentType: false,
  1038. processData: false,
  1039. success: function (data) {
  1040. if (data.state == "success") {
  1041. $.modalMsg(data.message, data.state);
  1042. $("#fileName").val(fileName);
  1043. //$.currentWindow().$("#gridList").trigger("reloadGrid");
  1044. }
  1045. else {
  1046. $.modalAlert("异常:" + data.message, data.state);
  1047. }
  1048. }
  1049. });
  1050. }
  1051. });
  1052. }
  1053. }
  1054. fileName = fileName.substring(0, fileName.length - 1);
  1055. let arr1 = fileName.split(";");
  1056. for (var k = 0; k < arr1.length; k++) {
  1057. innerhtml += " <a href='../../../File/SORRFQFile/" + RFQNO + "/" + arr1[k] + "' download='" + arr1[k] + "' style='color:blue;'>" + arr1[k] + "</a>";
  1058. }
  1059. $("#hidbtn").html(innerhtml);
  1060. var file = document.getElementById('FileUp');
  1061. file.value = "";
  1062. }
  1063. //上传按钮触发事件
  1064. function UpLoadFiles(STNO) {
  1065. $("#FileUp").click();
  1066. }
  1067. function AdditemFSC() {
  1068. var WorkPoint = $("#Workpoint option:checked").val();
  1069. if (WorkPoint == "") {
  1070. $.modalAlert("请填写站点", "warning")
  1071. return false;
  1072. }
  1073. if ($("#ENDDATE").val() == "") {
  1074. $.modalAlert("请先填写截止日期!", "warning");
  1075. return;
  1076. }
  1077. var WorkPoint = $("#Workpoint option:checked").val();
  1078. var index = layer.open({
  1079. id: "AddFCS",
  1080. type: 2,
  1081. shade: 0.3,
  1082. title: "新增非生产标的",
  1083. fix: false,
  1084. area: ["600px", "650px"],
  1085. content: "/SRM/PriceInquiry/NoProductionMaterialAdd?" + Math.random() + "&WorkPoint=" + WorkPoint,
  1086. btn: ['确定', '关闭'],
  1087. btnclass: ['btn btn-primary', 'btn btn-danger'],
  1088. maxmin: true,
  1089. yes: function (index, layero) {
  1090. var body = layer.getChildFrame('body', index);
  1091. var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
  1092. objArr = iframeWin.submitForm();//执行iframe页的方法:iframeWin.method();
  1093. var arrayData = getJQAllData("#gridList");
  1094. for (var j = 0; j < objArr.length; j++) {
  1095. for (var i = 0; i < arrayData.length; i++) {
  1096. if (objArr[j].INVCODE == arrayData[i].INVCODE) {
  1097. $.modalAlert("已添加标的!请勿重复添加!");
  1098. return;
  1099. }
  1100. }
  1101. $("#gridList").jqGrid('addRowData', objArr[j].ID, objArr[j], 'last');
  1102. $(".unwritten").hide();
  1103. }
  1104. layer.close(index);
  1105. }, cancel: function () {
  1106. return true;
  1107. }
  1108. });
  1109. }
  1110. //退回
  1111. function Back(ID) {
  1112. if (ID=="") {
  1113. $.modalAlert("请选择要退回的数据!", "warning");
  1114. return;
  1115. }
  1116. var RFQNO = $("#RFQNO").val();
  1117. $.submitForm({
  1118. url: "/SRM/PriceInquiry/InvCodeBack" + "?" + Math.random(),
  1119. param: { keyValue: ID, RFQNO: RFQNO },
  1120. success: function () {
  1121. var obj_item = $("#gridList");
  1122. var rowIds_item = obj_item.getDataIDs();
  1123. if (rowIds_item.length <= 0) {
  1124. reloadData();
  1125. }
  1126. }
  1127. })
  1128. }
  1129. </script>
  1130. <form id="form1">
  1131. <input id="FileUpBYRZinp" hidden="hidden">
  1132. <input id='FileUpBYRZ' type='file' style="display: none" onchange="UpLoadFileBYRZ(this)" multiple="multiple" />
  1133. <div class="topPanel" style="height:10px">
  1134. <div class="btn-group">
  1135. @*<a id="AddItemLot" style="margin-left:3px;" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>添加明细</a>
  1136. <a id="refresh" class="btn btn-primary" style="margin-left:3px;" onclick="reloadData()"><span class="glyphicon glyphicon-refresh"></span></a>*@
  1137. </div>
  1138. </div>
  1139. <div style="margin-right: 20px;">
  1140. <table class="form">
  1141. <tr>
  1142. <th class="formTitle">
  1143. 站点:
  1144. </th>
  1145. <td class="formValue">
  1146. <select id="Workpoint" name="Workpoint" class="select2 form-control " placeholder="请选择站点.." style="width:32px" disabled></select>
  1147. </td>
  1148. @*<th class="formTitle">
  1149. 采购组织:
  1150. </th>
  1151. <td class="formValue">
  1152. <select id="PoOrgName" name="PoOrgName" class="select2 form-control " placeholder="请选择采购组织.."></select>
  1153. <input type="hidden" id="hidetext" />
  1154. </td>
  1155. <th class="formTitle">采购负责人:</th>
  1156. <td class="formValue">
  1157. <select id="POorg" name="POorg" class="select2 form-control " placeholder="请选择采购负责人.." style="width:32px"></select>
  1158. </td>*@
  1159. <th class="formTitle">询价单编号:</th>
  1160. <td class="formValue">
  1161. <input type="text" id="RFQNO" class="form-control" readonly="readonly" style="width: 98%" disabled/>
  1162. </td>
  1163. <th class="formTitle">询价单名称:</th>
  1164. <td class="formValue">
  1165. <input type="text" id="RFQName" class="form-control" style="width: 98%" disabled/>
  1166. </td>
  1167. </tr>
  1168. <tr>
  1169. <th class="formTitle">单据日期:</th>
  1170. <td class="formValue">
  1171. <input type="text" id="RFQdate" class="form-control" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" style="width: 98%" disabled/>
  1172. </td>
  1173. <th class="formTitle">
  1174. 是否需上传成本明细:
  1175. </th>
  1176. <td class="formValue">
  1177. <select id="Sel_HASCOSTDETAILS" name="Sel_HASCOSTDETAILS" class="select2 form-control " placeholder="是否需上传成本明细.." style="width:32px" disabled></select>
  1178. </td>
  1179. </tr>
  1180. <tr>
  1181. <th class="formTitle">备注:</th>
  1182. <td class="formValue" colspan="3">
  1183. <textarea id="Remarks" name="Remarks" cols="200" class="form-control" style="height:32px;line-height:32px" disabled></textarea>
  1184. </td>
  1185. </tr>
  1186. <tr>
  1187. <th class="formTitle">附件名称:</th>
  1188. <td class="formValue" colspan="3">
  1189. <input id="fileName" name="fileName" style="display:none">
  1190. <div id="hidbtn" style=" border: 1px #edeff3 solid"></div>
  1191. </td>
  1192. <td class="formValue">
  1193. <input id='FileUp' type='file' style="display: none" onchange="UpLoadFile(this)" multiple="multiple" />
  1194. @*<button id="btn_FileUp" class="btn btn-info" type="button" onclick="UpLoadFiles(this)">上传附件</button>*@
  1195. </td>
  1196. </tr>
  1197. </table>
  1198. </div>
  1199. <div class="gridPanel" style="margin-left:10px">
  1200. <span><strong>询价物料清单</strong></span>
  1201. <div id="gridPanel">
  1202. <table id="gridList"></table>
  1203. </div>
  1204. <div style="text-align:center">
  1205. <!--<button id="Additem" class="btn btn-info" type="button" onclick="AddInv('zs')">添加正式物料</button>
  1206. <button id="Additem" class="btn btn-info" type="button" onclick="AddPU()">请购添加标的</button>
  1207. <button id="Additem" class="btn btn-info" type="button" onclick="AddPoMain()">采购添加标的</button>
  1208. <button id="AdditemFSC_ID" class="btn btn-info" type="button" onclick="AdditemFSC()">添加非生产标的</button>-->
  1209. @*<button id="AddTemitem" class="btn btn-primary" type="button" onclick="AddInv('ls')">添加临时物料</button>*@
  1210. <!--<button id="deleteitem" class="btn btn-danger" type="button" onclick="deleteInv()">删除物料</button>
  1211. <button id="btn_UpdateTime" class="btn btn-info" type="button" onclick="UpdateTime()">一键同步</button>-->
  1212. @*<button id="btn_Back" class="btn btn-info" type="button" onclick="Back()">退回</button>*@
  1213. </div>
  1214. </div>
  1215. <div class="gridPane2" style="margin-left:10px;display:none">
  1216. <span style="display:block;margin-top:20px">
  1217. <strong>询价供应商清单</strong>
  1218. </span>
  1219. <table id="gridList2"></table>
  1220. <div style="text-align:center">
  1221. <button id="Addsupply" class="btn btn-info" type="button" onclick="AddSupplier()">添加供应商</button>
  1222. <button id="deletesupply" type="button" class="btn btn-danger" onclick="DeleteSup()">删除供应商</button>
  1223. </div>
  1224. </div>
  1225. </form>