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.

1433 lines
61 KiB

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