FrmPriceConfirm.cs 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Core.Mes.Client.Comm.Tool;
  10. using CoreFS.CA06;
  11. using com.steering.pss.sale.orderchange.entity;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Control;
  14. using Infragistics.Win.UltraWinGrid;
  15. using System.Collections;
  16. using Core.Mes.Client.Comm.Format;
  17. using Core.StlMes.Client.SaleOrder.Dialog;
  18. namespace Core.StlMes.Client.SaleOrder.ReviewForm
  19. {
  20. public partial class FrmPriceConfirm : FrmBase
  21. {
  22. /// <summary>
  23. /// 关闭窗体引起主窗体刷新数据
  24. /// </summary>
  25. public delegate void FrmClosedRefresh(string ordPk);
  26. public event FrmClosedRefresh FrmClosedRefreshHandle;
  27. public FrmPriceConfirm()
  28. {
  29. InitializeComponent();
  30. this.IsLoadUserView = true;
  31. }
  32. private string ordPk;
  33. private string saleOrg;
  34. public string SaleOrg
  35. {
  36. get { return saleOrg; }
  37. set { saleOrg = value; }
  38. }
  39. /// <summary>
  40. /// 窗体的用途 等于0时 表示价格评审的弹窗(只查出销售、钢贸的数据) 等于1时 表示后续价格修改国贸 的数据 等于2时 表示第一次业务员录入价格 等于3时 业务员第二次N次维护价格
  41. /// </summary>
  42. private string formUse = "0";
  43. /// <summary>
  44. /// 窗体的用途
  45. /// 等于0时 表示价格评审的弹窗(只查出销售、钢贸的数据)-----弃用大部分功能---保留评审通过、评审不通过功能--第一次评审 涉及到合同状态
  46. /// 等于1时 表示后续价格修改(变更) 销售钢贸 国贸 的数据 ------后改为只针对国贸数据维护
  47. /// 等于2时 表示第一次业务员录入价格
  48. /// 等于3时 表示第二次N次业务员录入价格
  49. /// 等于4时 针对国贸数据确认 或者价格变更的确认(不涉及到合同的状态)
  50. /// </summary>
  51. public string FormUse
  52. {
  53. get { return formUse; }
  54. set { formUse = value; }
  55. }
  56. public FrmPriceConfirm(OpeBase _ob, string ordPk)
  57. {
  58. InitializeComponent();
  59. this.ob = _ob;
  60. this.ordPk = ordPk;
  61. }
  62. private void FrmPriceConfirm_Load(object sender, EventArgs e)
  63. {
  64. /* foreach (UltraGridColumn ugc in gdPrice.DisplayLayout.Bands[0].Columns)
  65. {
  66. ugc.SortIndicator = SortIndicator.Disabled;
  67. }*/
  68. QueryOrder();
  69. if (FormUse == "1" && SaleOrg == "100102")
  70. {
  71. gdPrice.DisplayLayout.Bands[0].Columns["OUT_PRICE"].Hidden = true;
  72. }
  73. if (FormUse == "2" || FormUse == "3" || FormUse == "1")
  74. {
  75. this.ultraToolbarsManager1.Toolbars[0].Tools["Pass"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  76. this.ultraToolbarsManager1.Toolbars[0].Tools["Back"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  77. }
  78. else if (FormUse == "0" || FormUse == "4")
  79. {
  80. this.ultraToolbarsManager1.Toolbars[0].Tools["Save"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  81. this.ultraToolbarsManager1.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  82. this.ultraToolbarsManager1.Toolbars[0].Tools["Print"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  83. this.ultraToolbarsManager1.Toolbars[0].Tools["PrintFJ"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  84. this.ultraToolbarsManager1.Toolbars[0].Tools["PrintC"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  85. this.ultraToolbarsManager1.Toolbars[0].Tools["Delete"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  86. gdPrice.DisplayLayout.Bands[0].Columns["TRANS_PRICE"].CellAppearance.BackColor = Color.White;
  87. gdPrice.DisplayLayout.Bands[0].Columns["PAK_PRICE"].CellAppearance.BackColor = Color.White;
  88. gdPrice.DisplayLayout.Bands[0].Columns["BALNCE_PRICE_ORG"].CellAppearance.BackColor = Color.White;
  89. }
  90. if (saleOrg != "100102")
  91. {
  92. this.ultraToolbarsManager1.Toolbars[0].Tools["Print"].InstanceProps.Visible = Infragistics.Win.DefaultableBoolean.False;
  93. this.ultraToolbarsManager1.Toolbars[0].Tools["PrintC"].SharedPropsInternal.Caption = "打印审批单";
  94. }
  95. }
  96. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  97. {
  98. switch (e.Tool.Key)
  99. {
  100. case "Query":
  101. QueryOrder();
  102. break;
  103. case "Save": //保存价格
  104. SaveData();
  105. break;
  106. case "Confirm": //确认价格
  107. DoConfirm();
  108. break;
  109. case "Print": //打印短流程
  110. Print();
  111. break;
  112. case "PrintFJ": //打印附件
  113. PrintFJ();
  114. break;
  115. case "PrintC": //打印长流程
  116. PrintC();
  117. break;
  118. case "Export":
  119. GridHelper.ulGridToExcel(gdPrice, "价格确认");
  120. break;
  121. case "Pass": //评审通过
  122. DoPassPrice();
  123. break;
  124. case "Back": //评审不通过
  125. DoBackPrice();
  126. break;
  127. case "Delete": //作废
  128. DoDelete();
  129. break;
  130. case "Close":
  131. this.Close();
  132. break;
  133. }
  134. }
  135. /// <summary>
  136. /// 打印审批单短流程
  137. /// </summary>
  138. private void Print()
  139. {
  140. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePriceConfirm.getOrderPriceNo", new object[] { ordPk }, ob);
  141. string priceNo = "";
  142. if (dt != null && dt.Rows.Count > 0)
  143. {
  144. priceNo = dt.Rows[0][0].ToString();
  145. }
  146. string strUrl = "";
  147. if (saleOrg == "100101")
  148. {
  149. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalShort.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
  150. }
  151. else if (saleOrg == "100105")
  152. {
  153. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalShort.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
  154. }
  155. else if (saleOrg == "100103")
  156. {
  157. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalGMShort.cpt" + "&PRICE_NO=" + priceNo;
  158. }
  159. if (strUrl == "")
  160. {
  161. MessageUtil.ShowWarning("合同销售组织异常,无法打印!");
  162. return;
  163. }
  164. FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strUrl);
  165. fBug.Text = "打印价格审批单(短流程)";
  166. fBug.AutoSize = true;
  167. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  168. fBug.WindowState = FormWindowState.Maximized;
  169. fBug.Show();
  170. }
  171. /// <summary>
  172. /// 打印附件
  173. /// </summary>
  174. private void PrintFJ()
  175. {
  176. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePriceConfirm.getOrderPriceNo", new object[] { ordPk }, ob);
  177. string priceNo = "";
  178. if (dt != null && dt.Rows.Count > 0)
  179. {
  180. priceNo = dt.Rows[0][0].ToString();
  181. }
  182. string strUrl = "";
  183. if (saleOrg == "100101")
  184. {
  185. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalAtta.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
  186. }
  187. else if (saleOrg == "100103")
  188. {
  189. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalAttaGM.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
  190. }
  191. if (gdPrice.ActiveRow.Cells["SUPPLY_UNIT"].Value.ToString() == "120504")
  192. {
  193. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalAttaTH.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
  194. }
  195. if (strUrl == "")
  196. {
  197. MessageUtil.ShowWarning("合同销售组织异常,无法打印!");
  198. return;
  199. }
  200. FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strUrl);
  201. fBug.Text = "打印价格审批单附件";
  202. fBug.AutoSize = true;
  203. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  204. fBug.WindowState = FormWindowState.Maximized;
  205. fBug.Show();
  206. }
  207. /// <summary>
  208. /// 打印审批单长流程
  209. /// </summary>
  210. private void PrintC()
  211. {
  212. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePriceConfirm.getOrderPriceNo", new object[] { ordPk }, ob);
  213. string priceNo = "";
  214. if (dt != null && dt.Rows.Count > 0)
  215. {
  216. priceNo = dt.Rows[0][0].ToString();
  217. }
  218. string strUrl = "";
  219. if (saleOrg != "100102")
  220. {
  221. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalLong.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
  222. }
  223. else if (saleOrg == "100105")
  224. {
  225. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalLong.cpt&__bypagesize__=false" + "&PRICE_NO=" + priceNo;
  226. }
  227. if (saleOrg == "100103")
  228. {
  229. strUrl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepPriceApprovalGMLong.cpt" + "&PRICE_NO=" + priceNo;
  230. }
  231. if (strUrl == "")
  232. {
  233. MessageUtil.ShowWarning("合同销售组织异常,无法打印!");
  234. return;
  235. }
  236. FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strUrl);
  237. fBug.Text = "打印价格审批单(长流程)";
  238. fBug.AutoSize = true;
  239. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  240. fBug.WindowState = FormWindowState.Maximized;
  241. fBug.Show();
  242. }
  243. /// <summary>
  244. /// 查询合同信息
  245. /// </summary>
  246. private void QueryOrder()
  247. {
  248. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CorePriceConfirm.getOrderInfo", new object[] { this.ordPk }, this.ob);
  249. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  250. UltraGridColumn[] col = new UltraGridColumn[] { gdPrice.DisplayLayout.Bands[0].Columns["PRICE_BASE"] };
  251. GridHelper.RefreshAndAutoSizeExceptColumns(gdPrice, col);
  252. }
  253. /// <summary>
  254. /// 修改价格保存
  255. /// </summary>
  256. private void SaveData()
  257. {
  258. //对于0 2 3 时 修改价格都差不多 等于2 加入了合同状态 2和3 去掉了评审功能 都用了0的保存方法。
  259. gdPrice.UpdateData();
  260. UltraGridRow ugr = gdPrice.ActiveRow;
  261. if (ugr == null)
  262. {
  263. MessageUtil.ShowWarning("请选择需要修改的记录!");
  264. return;
  265. }
  266. string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
  267. //这里需要判断 priceNo的状态
  268. ArrayList parm = new ArrayList();
  269. foreach (UltraGridRow row in gdPrice.Rows)
  270. {
  271. string containTax = row.Cells["CONTAIN_TAX"].Value.ToString();
  272. string balPrice = row.Cells["BALNCE_PRICE"].Value.ToString();
  273. string balorgPrice = row.Cells["BALNCE_PRICE_ORG"].Value.ToString();
  274. string outPrice = row.Cells["OUT_PRICE"].Value.ToString();
  275. string traPrice = row.Cells["TRANS_PRICE"].Value.ToString();
  276. string pakPrice = row.Cells["PAK_PRICE"].Value.ToString();
  277. string tonPrice = row.Cells["TON_PRICE"].Value.ToString();
  278. string keepType = row.Cells["KEEP_TYPE"].Value.ToString();
  279. string ddzy = row.Cells["DDZY"].Value.ToString();
  280. if (!String.IsNullOrEmpty(balPrice))
  281. {
  282. if (!StringUtil.Is_Below_zero(balPrice))
  283. {
  284. MessageUtil.ShowWarning("结算价请输入大于0的数字!");
  285. row.Activate();
  286. return;
  287. }
  288. }
  289. else
  290. {
  291. MessageUtil.ShowWarning("请输入结算价!");
  292. row.Activate();
  293. return;
  294. }
  295. //内部结算价不强制输入
  296. if (!String.IsNullOrEmpty(balorgPrice))
  297. {
  298. if (!StringUtil.Is_Below_zero(balorgPrice))
  299. {
  300. MessageUtil.ShowWarning("内部结算价请输入大于0的数字!");
  301. row.Activate();
  302. return;
  303. }
  304. }
  305. if (FormUse != "1" || SaleOrg != "100102") //价格后续N次修改变更 国贸不管出厂价
  306. {
  307. if (!String.IsNullOrEmpty(outPrice))
  308. {
  309. if (!StringUtil.Is_Below_zero(outPrice))
  310. {
  311. MessageUtil.ShowWarning("出厂价请输入大于0的数字!");
  312. row.Activate();
  313. return;
  314. }
  315. }
  316. else
  317. {
  318. MessageUtil.ShowWarning("请输入出厂!");
  319. row.Activate();
  320. return;
  321. }
  322. }
  323. //运费不强制输入
  324. if (!String.IsNullOrEmpty(traPrice))
  325. {
  326. if (!StringUtil.IsNumber(traPrice))
  327. {
  328. MessageUtil.ShowWarning("运费请输入数字!");
  329. row.Activate();
  330. return;
  331. }
  332. }
  333. //吊装费不强制输入
  334. if (!String.IsNullOrEmpty(pakPrice))
  335. {
  336. if (!StringUtil.IsNumber(pakPrice))
  337. {
  338. MessageUtil.ShowWarning("吊装费请输入大于0的数字!");
  339. row.Activate();
  340. return;
  341. }
  342. }
  343. //吨价不强制输入
  344. if (!String.IsNullOrEmpty(tonPrice))
  345. {
  346. if (!StringUtil.IsNumber(pakPrice))
  347. {
  348. MessageUtil.ShowWarning("吨价请输入大于0的数字!");
  349. row.Activate();
  350. return;
  351. }
  352. }
  353. //保价类型不能为空
  354. if (String.IsNullOrEmpty(keepType))
  355. {
  356. MessageUtil.ShowWarning("请选择保价类型!");
  357. row.Activate();
  358. return;
  359. }
  360. if (containTax.Equals("含税") && keepType.Equals("0"))
  361. {
  362. MessageUtil.ShowWarning("合同行含税,请选择保价类型为保总价!");
  363. row.Activate();
  364. return;
  365. }
  366. ArrayList list = new ArrayList();
  367. list.Add(balPrice);
  368. list.Add(outPrice);
  369. list.Add(traPrice);
  370. list.Add(pakPrice);
  371. list.Add(row.Cells["ORD_LN_PK"].Value.ToString());
  372. list.Add(balorgPrice);
  373. list.Add(tonPrice);
  374. list.Add(keepType);
  375. list.Add(ddzy);
  376. parm.Add(list);
  377. }
  378. if (txtPriceInfo.Text.Trim() == "")
  379. {
  380. MessageUtil.ShowWarning("请输入定价说明!");
  381. return;
  382. }
  383. if (MessageUtil.ShowYesNoAndQuestion("是否保存价格?") == DialogResult.No) return;
  384. SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
  385. sop.PriceBase = txtPriceInfo.Text.Trim();
  386. sop.CreateName = UserInfo.GetUserName();
  387. CoreClientParam ccp = new CoreClientParam();
  388. ccp.IfShowErrMsg = false;
  389. ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
  390. ccp.MethodName = "savePrice";
  391. ccp.ServerParams = new object[] { ordPk, parm, JSONFormat.Format(sop), saleOrg, FormUse, UserInfo.GetUserName() };
  392. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  393. if (ccp == null)
  394. {
  395. return;
  396. }
  397. else
  398. {
  399. if (ccp.ReturnCode == -1)
  400. {
  401. MessageUtil.ShowWarning(ccp.ReturnInfo);
  402. return;
  403. }
  404. MessageUtil.ShowWarning("修改成功!");
  405. QueryOrder();
  406. }
  407. }
  408. private void gdPrice_AfterRowActivate(object sender, EventArgs e)
  409. {
  410. UltraGridRow ugr = gdPrice.ActiveRow;
  411. if (ugr == null)
  412. return;
  413. txtPriceInfo.Text = ugr.Cells["PRICE_BASE"].Value.ToString();
  414. if (ugr.Cells["PRICE_STATUS_CODE"].Value.ToString() == "W" && this.FormUse != "0" && FormUse != "1")
  415. {
  416. ugr.Activation = Activation.ActivateOnly;
  417. return;
  418. }
  419. else
  420. {
  421. ugr.Activation = Activation.AllowEdit;
  422. }
  423. if (FormUse == "0" || FormUse == "4")
  424. {
  425. ugr.Cells["TRANS_PRICE"].Activation = Activation.ActivateOnly;
  426. ugr.Cells["PAK_PRICE"].Activation = Activation.ActivateOnly;
  427. ugr.Cells["BALNCE_PRICE_ORG"].Activation = Activation.ActivateOnly;
  428. }
  429. }
  430. /// <summary>
  431. /// 价格确认
  432. /// </summary>
  433. private void DoConfirm()
  434. {
  435. //先判断是否有价格评审单号,再判断价格评审单号的状态
  436. UltraGridRow ugr = gdPrice.ActiveRow;
  437. if (ugr == null)
  438. {
  439. MessageUtil.ShowWarning("不存在需要确认的合同行!");
  440. return;
  441. }
  442. string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
  443. if (priceNo == "")
  444. {
  445. MessageUtil.ShowWarning("该合同尚未启动价格评审,不能确认!");
  446. return;
  447. }
  448. string priceStatus = ugr.Cells["PRICE_STATUS_CODE"].Value.ToString();
  449. if (priceStatus != "" && priceStatus != "L")
  450. {
  451. if (priceStatus == "W")
  452. {
  453. MessageUtil.ShowWarning("该合同价格正在评审中,不必重复确认!");
  454. return;
  455. }
  456. else if (priceStatus == "S")
  457. {
  458. MessageUtil.ShowWarning("该合同价格评审已通过,不必重复确认!");
  459. return;
  460. }
  461. else if (priceStatus == "F")
  462. {
  463. MessageUtil.ShowWarning("该合同价格评审不通过,请先修改价格,再确认价格!");
  464. return;
  465. }
  466. else if (priceStatus == "D")
  467. {
  468. MessageUtil.ShowWarning("该合同价格评审单无效,请先修改价格,再确认价格!");
  469. return;
  470. }
  471. }
  472. if (MessageUtil.ShowYesNoAndQuestion("是否确认价格?") == DialogResult.No) return;
  473. SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
  474. sop.ReportName = UserInfo.GetUserName();
  475. sop.ReportUnitcode = UserInfo.GetDeptid();
  476. sop.ReportUnitdesc = UserInfo.GetDepartment();
  477. sop.ReportDeptcode = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
  478. sop.ReportDeptdesc = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  479. CoreClientParam ccp = new CoreClientParam();
  480. ccp.IfShowErrMsg = false;
  481. ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
  482. ccp.MethodName = "confirmPrice";
  483. ccp.ServerParams = new object[] { ordPk, JSONFormat.Format(sop) };
  484. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  485. if (ccp != null)
  486. {
  487. if (ccp.ReturnCode == -1)
  488. {
  489. MessageUtil.ShowWarning(ccp.ReturnInfo);
  490. return;
  491. }
  492. MessageUtil.ShowTips("确认成功,请打印价格审批单进行线外流程!");
  493. QueryOrder();
  494. }
  495. }
  496. /// <summary>
  497. /// 作废变更单,以便重新启动价格评审
  498. /// </summary>
  499. public void DoDelete()
  500. {
  501. //先判断是否有价格评审单号,再判断价格评审单号的状态
  502. UltraGridRow ugr = gdPrice.ActiveRow;
  503. if (ugr == null)
  504. {
  505. MessageUtil.ShowWarning("不存在需要删除价格评审的合同行!");
  506. return;
  507. }
  508. string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
  509. if (priceNo == "")
  510. {
  511. MessageUtil.ShowWarning("该合同尚未启动价格评审,不能作废评审单!");
  512. return;
  513. }
  514. string priceStatus = ugr.Cells["PRICE_STATUS_CODE"].Value.ToString();
  515. if (priceStatus != "" && priceStatus != "L")
  516. {
  517. if (priceStatus == "S")
  518. {
  519. MessageUtil.ShowWarning("该合同价格评审已通过,不能作废!");
  520. return;
  521. }
  522. else if (priceStatus == "F")
  523. {
  524. MessageUtil.ShowWarning("该合同价格评审已不通过,不能作废!");
  525. return;
  526. }
  527. else if (priceStatus == "D")
  528. {
  529. MessageUtil.ShowWarning("该合同价格评审已经无效,不能作废!");
  530. return;
  531. }
  532. }
  533. if (MessageUtil.ShowYesNoAndQuestion("是否确认作废价格评审单?") == DialogResult.No) return;
  534. CoreClientParam ccp = new CoreClientParam();
  535. ccp.IfShowErrMsg = false;
  536. ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
  537. ccp.MethodName = "deletePrice";
  538. ccp.ServerParams = new object[] { ordPk, UserInfo.GetUserName() };
  539. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  540. if (ccp != null)
  541. {
  542. if (ccp.ReturnCode == -1)
  543. {
  544. MessageUtil.ShowWarning(ccp.ReturnInfo);
  545. return;
  546. }
  547. MessageUtil.ShowTips("作废成功!");
  548. QueryOrder();
  549. }
  550. }
  551. /// <summary>
  552. /// 价格评审通过
  553. /// </summary>
  554. public void DoPassPrice()
  555. {
  556. //先判断是否有价格评审单号,再判断价格评审单号的状态
  557. UltraGridRow ugr = gdPrice.ActiveRow;
  558. if (ugr == null)
  559. {
  560. MessageUtil.ShowWarning("不存在需要价格评审通过的合同行!");
  561. return;
  562. }
  563. gdPrice.UpdateData();
  564. string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
  565. if (priceNo == "")
  566. {
  567. MessageUtil.ShowWarning("该合同尚未启动价格评审,不能评审通过!");
  568. return;
  569. }
  570. string priceStatus = ugr.Cells["PRICE_STATUS_CODE"].Value.ToString();
  571. if (priceStatus != "")
  572. {
  573. if (priceStatus == "L")
  574. {
  575. MessageUtil.ShowWarning("该合同价格尚未确认,不能评审通过!");
  576. return;
  577. }
  578. else if (priceStatus == "S")
  579. {
  580. MessageUtil.ShowWarning("该合同价格评审已通过,不能重复评审!");
  581. return;
  582. }
  583. else if (priceStatus == "F")
  584. {
  585. MessageUtil.ShowWarning("该合同价格评审不通过,请再次启动价格评审!");
  586. return;
  587. }
  588. else if (priceStatus == "D")
  589. {
  590. MessageUtil.ShowWarning("该合同价格评审无效,请再次启动价格评审!");
  591. return;
  592. }
  593. }
  594. else
  595. {
  596. MessageUtil.ShowWarning("价格评审状态异常!");
  597. return;
  598. }
  599. //暂时放个口子 评审人员可以修改价格
  600. ArrayList price = new ArrayList();
  601. foreach (UltraGridRow row in gdPrice.Rows)
  602. {
  603. string balPrice = row.Cells["BALNCE_PRICE"].Value.ToString();
  604. string balPriceorg = row.Cells["BALNCE_PRICE_ORG"].Value.ToString();
  605. string outPrice = row.Cells["OUT_PRICE"].Value.ToString();
  606. string traPrice = row.Cells["TRANS_PRICE"].Value.ToString();
  607. string pakPrice = row.Cells["PAK_PRICE"].Value.ToString();
  608. string tonPrice = row.Cells["TON_PRICE"].Value.ToString();
  609. string keepType = row.Cells["KEEP_TYPE"].Value.ToString();
  610. string ddzy = row.Cells["DDZY"].Value.ToString();
  611. if (!String.IsNullOrEmpty(balPrice))
  612. {
  613. if (!StringUtil.Is_Below_zero(balPrice))
  614. {
  615. MessageUtil.ShowWarning("结算价请输入大于0的数字!");
  616. row.Activate();
  617. return;
  618. }
  619. }
  620. else
  621. {
  622. MessageUtil.ShowWarning("请输入结算价!");
  623. row.Activate();
  624. return;
  625. }
  626. if ((FormUse != "1" && FormUse != "4") || SaleOrg != "100102") //价格后续N次修改变更 国贸不管出厂价
  627. {
  628. if (!String.IsNullOrEmpty(outPrice))
  629. {
  630. if (!StringUtil.Is_Below_zero(outPrice))
  631. {
  632. MessageUtil.ShowWarning("出厂价请输入大于0的数字!");
  633. row.Activate();
  634. return;
  635. }
  636. }
  637. else
  638. {
  639. MessageUtil.ShowWarning("请输入出厂价!");
  640. row.Activate();
  641. return;
  642. }
  643. }
  644. ArrayList list = new ArrayList();
  645. list.Add(balPrice);
  646. list.Add(outPrice);
  647. list.Add(traPrice);
  648. list.Add(pakPrice);
  649. list.Add(row.Cells["ORD_LN_PK"].Value.ToString());
  650. list.Add(balPriceorg);
  651. list.Add(tonPrice);
  652. list.Add(keepType);
  653. list.Add(keepType);
  654. list.Add(ddzy);
  655. price.Add(list);
  656. }
  657. if (MessageUtil.ShowYesNoAndQuestion("是否确认价格评审通过?") == DialogResult.No) return;
  658. SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
  659. sop.DealName = UserInfo.GetUserName();
  660. sop.DealUnitcode = UserInfo.GetDeptid();
  661. sop.DealUnitdesc = UserInfo.GetDepartment();
  662. sop.DealDeptcode = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
  663. sop.DealDeptdesc = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  664. string name = UserInfo.GetUserName();
  665. string dept = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  666. dept = dept + "-" + UserInfo.GetDepartment();
  667. CoreClientParam ccp = new CoreClientParam();
  668. ccp.IfShowErrMsg = false;
  669. ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
  670. ccp.MethodName = "passPrice";
  671. ccp.ServerParams = new object[] { ordPk, name, dept, JSONFormat.Format(sop), FormUse, price };
  672. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  673. if (ccp != null)
  674. {
  675. if (ccp.ReturnCode == -1)
  676. {
  677. MessageUtil.ShowWarning(ccp.ReturnInfo);
  678. return;
  679. }
  680. MessageUtil.ShowTips("价格评审通过!");
  681. DialogResult = DialogResult.OK;
  682. this.Close();
  683. }
  684. }
  685. /// <summary>
  686. /// 价格评审不通过(不再调用原来的价格评审的‘评审不通过‘,合同状态将继续卡在这里 而不是退回给业务员了。
  687. /// </summary>
  688. public void DoBackPrice()
  689. {
  690. //先判断是否有价格评审单号,再判断价格评审单号的状态
  691. UltraGridRow ugr = gdPrice.ActiveRow;
  692. if (ugr == null)
  693. {
  694. MessageUtil.ShowWarning("不存在需要价格评审不通过的合同行!");
  695. return;
  696. }
  697. string priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
  698. if (priceNo == "")
  699. {
  700. MessageUtil.ShowWarning("该合同尚未启动价格评审,不能评审不通过!");
  701. return;
  702. }
  703. string priceStatus = ugr.Cells["PRICE_STATUS_CODE"].Value.ToString();
  704. if (priceStatus != "")
  705. {
  706. if (priceStatus == "L")
  707. {
  708. MessageUtil.ShowWarning("该合同价格尚未确认,不能评审不通过!");
  709. return;
  710. }
  711. else if (priceStatus == "S")
  712. {
  713. MessageUtil.ShowWarning("该合同价格评审已通过,不能重复评审!");
  714. return;
  715. }
  716. else if (priceStatus == "F")
  717. {
  718. MessageUtil.ShowWarning("该合同价格评审已不通过,请再次启动价格评审!");
  719. return;
  720. }
  721. else if (priceStatus == "D")
  722. {
  723. MessageUtil.ShowWarning("该合同价格评审已经无效,请再次启动价格评审!");
  724. return;
  725. }
  726. }
  727. else
  728. {
  729. MessageUtil.ShowWarning("价格评审状态异常!");
  730. return;
  731. }
  732. if (MessageUtil.ShowYesNoAndQuestion("是否确认价格评审不通过?") == DialogResult.No) return;
  733. SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
  734. sop.DealName = UserInfo.GetUserName();
  735. sop.DealUnitcode = UserInfo.GetDeptid();
  736. sop.DealUnitdesc = UserInfo.GetDepartment();
  737. sop.DealDeptcode = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
  738. sop.DealDeptdesc = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  739. string name = UserInfo.GetUserName();
  740. string dept = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  741. dept = dept + "-" + UserInfo.GetDepartment();
  742. dlgReviewMemo dlg = new dlgReviewMemo();
  743. dlg.ReviewFlag = 0;
  744. dlg.ReviewSatus = "评审不通过";
  745. dlg.ShowDialog();
  746. string reviewMemo = dlg.ReviewMemo;
  747. if (dlg.DialogResult != DialogResult.OK)
  748. return;
  749. CoreClientParam ccp = new CoreClientParam();
  750. ccp.IfShowErrMsg = false;
  751. ccp.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
  752. ccp.MethodName = "backPrice";
  753. ccp.ServerParams = new object[] { ordPk, JSONFormat.Format(sop), FormUse, name, dept, reviewMemo };
  754. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  755. if (ccp != null)
  756. {
  757. if (ccp.ReturnCode == -1)
  758. {
  759. MessageUtil.ShowWarning(ccp.ReturnInfo);
  760. return;
  761. }
  762. MessageUtil.ShowTips("价格评审不通过完成!");
  763. DialogResult = DialogResult.OK;
  764. this.Close();
  765. }
  766. }
  767. private void gdPrice_InitializeRow(object sender, InitializeRowEventArgs e)
  768. {
  769. if (e.Row.Cells["PRICE_STATUS_CODE"].Value.ToString().Trim() == "D")
  770. {
  771. e.Row.Cells["PRICE_STATUS"].Appearance.BackColor = Color.Red;
  772. }
  773. }
  774. private void FrmPriceConfirm_FormClosing(object sender, FormClosingEventArgs e)
  775. {
  776. if (FormUse == "2")
  777. {
  778. UltraGridRow ugr = gdPrice.ActiveRow;
  779. if (ugr != null)
  780. {
  781. if (ugr.Cells["PRICE_STATUS_CODE"].Value.ToString().Equals("L"))
  782. {
  783. if (MessageUtil.ShowYesNoAndQuestion("价格评审单尚未确认,合同无法提报审批,是否退出?") == DialogResult.No)
  784. e.Cancel = true;
  785. }
  786. }
  787. }
  788. else if (FormUse == "3")
  789. {
  790. UltraGridRow ugr = gdPrice.ActiveRow;
  791. if (ugr != null)
  792. {
  793. if (ugr.Cells["PRICE_STATUS_CODE"].Value.ToString().Equals("L"))
  794. {
  795. if (MessageUtil.ShowYesNoAndQuestion("价格评审单尚未确认,无法启动价格评审,是否退出?") == DialogResult.No)
  796. e.Cancel = true;
  797. }
  798. }
  799. }
  800. if (FrmClosedRefreshHandle != null)
  801. FrmClosedRefreshHandle(this.ordPk);
  802. }
  803. /// <summary>
  804. /// 维护一行价格 之后的行的价格一样 当时勾选的行不受影响也不影响其他行
  805. /// </summary>
  806. /// <param name="sender"></param>
  807. /// <param name="e"></param>
  808. private void gdPrice_CellChange(object sender, CellEventArgs e)
  809. {
  810. try
  811. {
  812. gdPrice.UpdateData();
  813. }
  814. catch { }
  815. if (e.Cell.Column.Key.Equals("BALNCE_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
  816. {
  817. if (e.Cell.Value.ToString() == "")
  818. return;
  819. int rCount = e.Cell.Row.Index;
  820. for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
  821. {
  822. UltraGridRow row = gdPrice.Rows[i];
  823. if (!Convert.ToBoolean(row.Cells["CHK"].Value))
  824. row.Cells["BALNCE_PRICE"].Value = e.Cell.Value;
  825. }
  826. }
  827. else if (e.Cell.Column.Key.Equals("OUT_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
  828. {
  829. if (e.Cell.Value.ToString() == "")
  830. return;
  831. int rCount = e.Cell.Row.Index;
  832. for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
  833. {
  834. UltraGridRow row = gdPrice.Rows[i];
  835. if (!Convert.ToBoolean(row.Cells["CHK"].Value))
  836. row.Cells["OUT_PRICE"].Value = e.Cell.Value;
  837. }
  838. }
  839. else if (e.Cell.Column.Key.Equals("TRANS_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
  840. {
  841. if (e.Cell.Value.ToString() == "")
  842. return;
  843. int rCount = e.Cell.Row.Index;
  844. for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
  845. {
  846. UltraGridRow row = gdPrice.Rows[i];
  847. if (!Convert.ToBoolean(row.Cells["CHK"].Value))
  848. row.Cells["TRANS_PRICE"].Value = e.Cell.Value;
  849. }
  850. }
  851. else if (e.Cell.Column.Key.Equals("PAK_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
  852. {
  853. if (e.Cell.Value.ToString() == "")
  854. return;
  855. int rCount = e.Cell.Row.Index;
  856. for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
  857. {
  858. UltraGridRow row = gdPrice.Rows[i];
  859. if (!Convert.ToBoolean(row.Cells["CHK"].Value))
  860. row.Cells["PAK_PRICE"].Value = e.Cell.Value;
  861. }
  862. }
  863. else if (e.Cell.Column.Key.Equals("BALNCE_PRICE_ORG") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
  864. {
  865. if (e.Cell.Value.ToString() == "")
  866. return;
  867. int rCount = e.Cell.Row.Index;
  868. for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
  869. {
  870. UltraGridRow row = gdPrice.Rows[i];
  871. if (!Convert.ToBoolean(row.Cells["CHK"].Value))
  872. row.Cells["BALNCE_PRICE_ORG"].Value = e.Cell.Value;
  873. }
  874. }
  875. else if (e.Cell.Column.Key.Equals("TON_PRICE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
  876. {
  877. if (e.Cell.Value.ToString() == "")
  878. return;
  879. int rCount = e.Cell.Row.Index;
  880. for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
  881. {
  882. UltraGridRow row = gdPrice.Rows[i];
  883. if (!Convert.ToBoolean(row.Cells["CHK"].Value))
  884. row.Cells["TON_PRICE"].Value = e.Cell.Value;
  885. }
  886. }
  887. else if (e.Cell.Column.Key.Equals("KEEP_TYPE") && !Convert.ToBoolean(e.Cell.Row.Cells["CHK"].Value))
  888. {
  889. if (e.Cell.Value.ToString() == "")
  890. return;
  891. int rCount = e.Cell.Row.Index;
  892. for (int i = rCount + 1; i < gdPrice.Rows.Count; i++)
  893. {
  894. UltraGridRow row = gdPrice.Rows[i];
  895. if (!Convert.ToBoolean(row.Cells["CHK"].Value))
  896. row.Cells["KEEP_TYPE"].Value = e.Cell.Value;
  897. }
  898. }
  899. else if (e.Cell.Column.Key.Equals("CHK"))
  900. {
  901. this.toolTips.ShowAlways = true;
  902. this.toolTips.SetToolTip(gdPrice, "勾选的行维护数据时不更新其他行也不被其他行的数据所更新");
  903. this.toolTips.ToolTipTitle = "提示";
  904. }
  905. }
  906. private void gdPrice_CellDataError(object sender, CellDataErrorEventArgs e)
  907. {
  908. e.RaiseErrorEvent = false; // 阻止弹出错误提示窗口
  909. e.RestoreOriginalValue = true; // 恢复原始值
  910. e.StayInEditMode = true; // 继续保留在编辑模式
  911. }
  912. }
  913. }