frmOrderApproval.cs 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534
  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 CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using Infragistics.Win.UltraWinGrid;
  13. using System.Collections;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Core.StlMes.Client.SaleOrder.Dialog;
  16. using Infragistics.Win;
  17. using Core.StlMes.Client.SaleOrder.ReviewForm;
  18. using Core.Mes.Client.Comm.Format;
  19. namespace Core.StlMes.Client.SaleOrder.OrderForm
  20. {
  21. /// <summary>
  22. /// 合同审批提报
  23. /// </summary>
  24. public partial class frmOrderApproval : FrmBase
  25. {
  26. public frmOrderApproval()
  27. {
  28. InitializeComponent();
  29. }
  30. bool queryAll = false; //所有生效
  31. bool queryPass = false; //价格放行通过的合同
  32. string saleOrg = "";
  33. /// <summary>
  34. /// 价格评审窗体是否打开 (原来模态形式,现在用非模态形式打开)
  35. /// </summary>
  36. private bool isOpened = false;
  37. /// <summary>
  38. /// 重写基类方法
  39. /// </summary>
  40. /// <param name="sender"></param>
  41. /// <param name="ToolbarKey"></param>
  42. public override void ToolBar_Click(object sender, string ToolbarKey)
  43. {
  44. switch (ToolbarKey)
  45. {
  46. case "doQuery":
  47. doQuery();
  48. break;
  49. case "doPrice":
  50. doPriceN();
  51. break;
  52. case "ChgePrice":
  53. ChgePrice();
  54. break;
  55. case "doReport":
  56. DoReport();
  57. break;
  58. case "doCancel":
  59. DoCancel();
  60. break;
  61. case "BackDelivery":
  62. if (saleOrg != "100102")
  63. BackToDelivery();
  64. else
  65. {
  66. BackToDeliveryIE();
  67. }
  68. break;
  69. case "BackEdit":
  70. BackEdit(); //现货合同退回
  71. break;
  72. //case "BackDeliveryIE":
  73. // BackToDeliveryIE();
  74. // break;
  75. //分界面按钮
  76. case "doThrough":
  77. DoOrderPass();
  78. break;
  79. case "doRollback":
  80. DoOrderRollBack();
  81. break;
  82. case "Export":
  83. GridHelper.ulGridToExcel(ultraGridHead, "合同审批提报");
  84. break;
  85. case "doClose":
  86. this.Close();
  87. break;
  88. }
  89. }
  90. /// <summary>
  91. /// 审批退回
  92. /// </summary>
  93. private void DoOrderRollBack()
  94. {
  95. ultraGridHead.UpdateData();
  96. ArrayList parm = new ArrayList();
  97. int count = 0;
  98. foreach (UltraGridRow row in ultraGridHead.Rows)
  99. {
  100. if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
  101. {
  102. string ordPk = row.Cells["ORD_PK"].Value.ToString();
  103. count += 1;
  104. parm.Add(ordPk);
  105. }
  106. }
  107. if (count == 0)
  108. {
  109. MessageBox.Show("请选择需要审批退回的数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  110. return;
  111. }
  112. if (MessageUtil.ShowQuestion("确认审批退回?").ToString().ToLower().Equals("yes"))
  113. {
  114. string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
  115. string name = UserInfo.GetUserName(); //操作人
  116. dept = dept + "-" + UserInfo.GetDepartment(); //部门-科室
  117. //主管审批退回:12020222
  118. if (this.CustomInfo.Contains("director"))
  119. {
  120. dlgReviewMemo dlg = new dlgReviewMemo();
  121. dlg.ReviewFlag = 0;
  122. dlg.ReviewSatus = "审批退回";
  123. dlg.ShowDialog();
  124. string reviewMemo = dlg.ReviewMemo;
  125. if (dlg.DialogResult != DialogResult.OK)
  126. return;
  127. CoreClientParam ccp = new CoreClientParam();
  128. ccp.IfShowErrMsg = false;
  129. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  130. ccp.MethodName = "reviewBack";
  131. ccp.ServerParams = new object[] { parm, name, dept, reviewMemo, saleOrg };
  132. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  133. if (ccp == null)
  134. return;
  135. else
  136. {
  137. if (ccp.ReturnCode == -1)
  138. {
  139. MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
  140. return;
  141. }
  142. }
  143. doQuery();
  144. }
  145. else if (this.CustomInfo.Contains("manager"))
  146. {
  147. dlgReviewMemo dlg = new dlgReviewMemo();
  148. dlg.ReviewFlag = 0;
  149. dlg.ReviewSatus = "审批退回";
  150. dlg.ShowDialog();
  151. string reviewMemo = dlg.ReviewMemo;
  152. if (dlg.DialogResult != DialogResult.OK)
  153. return;
  154. CoreClientParam ccp = new CoreClientParam();
  155. ccp.IfShowErrMsg = false;
  156. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  157. ccp.MethodName = "reviewBackManager";
  158. ccp.ServerParams = new object[] { parm, name, dept, reviewMemo };
  159. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  160. if (ccp == null)
  161. return;
  162. else
  163. {
  164. if (ccp.ReturnCode == -1)
  165. {
  166. MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
  167. return;
  168. }
  169. }
  170. doQuery();
  171. }
  172. }
  173. }
  174. /// <summary>
  175. /// 审批通过
  176. /// </summary>
  177. private void DoOrderPass()
  178. {
  179. ultraGridHead.UpdateData();
  180. ArrayList parm = new ArrayList();
  181. int count = 0;
  182. foreach (UltraGridRow row in ultraGridHead.Rows)
  183. {
  184. if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
  185. {
  186. if (row.Cells["ORDER_STS"].Value.ToString() == "12020251")
  187. {
  188. MessageUtil.ShowWarning("合同已经评审通过!");
  189. return;
  190. }
  191. count += 1;
  192. string ordPk = row.Cells["ORD_PK"].Value.ToString();
  193. parm.Add(ordPk);
  194. }
  195. }
  196. if (count == 0)
  197. {
  198. MessageBox.Show("请选择需要操作的数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  199. return;
  200. }
  201. string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
  202. string name = UserInfo.GetUserName(); //操作人
  203. dept = dept + "-" + UserInfo.GetDepartment(); //部门-科室
  204. if (MessageUtil.ShowQuestion("确认审批通过?").ToString().ToLower().Equals("yes"))
  205. {
  206. //主管审批通过:12020222
  207. if (this.CustomInfo.Contains("director"))
  208. {
  209. dlgReviewMemo dlg = new dlgReviewMemo();
  210. dlg.ReviewFlag = 1;
  211. dlg.ReviewSatus = "审批通过";
  212. dlg.ShowDialog();
  213. string reviewMemo = dlg.ReviewMemo;
  214. if (dlg.DialogResult != DialogResult.OK)
  215. return;
  216. CoreClientParam ccp = new CoreClientParam();
  217. ccp.IfShowErrMsg = false;
  218. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  219. ccp.MethodName = "reviewPass";
  220. ccp.ServerParams = new object[] { parm, name, dept, reviewMemo, saleOrg };
  221. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  222. if (ccp == null)
  223. return;
  224. else
  225. {
  226. if (ccp.ReturnCode == -1)
  227. {
  228. MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
  229. return;
  230. }
  231. //if ("100101".Equals(saleOrg))
  232. if (this.CustomInfo.Equals("director-120504"))// 天淮系统审批价格法务
  233. {
  234. automaticExamine(parm, "SYSTEM", dept, reviewMemo);
  235. }
  236. }
  237. doQuery();
  238. }
  239. else if (this.CustomInfo.Contains("manager"))
  240. {
  241. //评审说明
  242. dlgReviewMemo dlg = new dlgReviewMemo();
  243. dlg.ReviewFlag = 1;
  244. dlg.ReviewSatus = "审批通过";
  245. dlg.ShowDialog();
  246. string reviewMemo = dlg.ReviewMemo;
  247. if (dlg.DialogResult != DialogResult.OK)
  248. return;
  249. CoreClientParam ccp = new CoreClientParam();
  250. ccp.IfShowErrMsg = false;
  251. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  252. ccp.MethodName = "reviewPassManager";
  253. ccp.ServerParams = new object[] { parm, name, dept, reviewMemo };
  254. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  255. if (ccp == null)
  256. return;
  257. else
  258. {
  259. if (ccp.ReturnCode == -1)
  260. {
  261. MessageUtil.ShowWarning(ccp.ReturnObject.ToString());
  262. return;
  263. }
  264. }
  265. doQuery();
  266. }
  267. }
  268. }
  269. private void automaticExamine(ArrayList parm, string name, string dept, string reviewMemo)
  270. {
  271. // 主管经理审批
  272. CoreClientParam ccp = new CoreClientParam();
  273. ccp.IfShowErrMsg = false;
  274. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  275. ccp.MethodName = "reviewPassManager";
  276. ccp.ServerParams = new object[] { parm, name, dept, reviewMemo };
  277. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  278. if (ccp.ReturnCode == -1)
  279. {
  280. MessageUtil.ShowWarning("主管经理审批自动审批失败!");
  281. return;
  282. }
  283. // 价格审批
  284. foreach (var ordPk in parm)
  285. {
  286. SlmOrderPriceEntity sop = new SlmOrderPriceEntity();
  287. sop.DealName = name;
  288. sop.DealUnitcode = UserInfo.GetDeptid();
  289. sop.DealUnitdesc = UserInfo.GetDepartment();
  290. sop.DealDeptcode = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob);
  291. sop.DealDeptdesc = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob);
  292. CoreClientParam ccp1 = new CoreClientParam();
  293. ccp1.IfShowErrMsg = false;
  294. ccp1.ServerName = "com.steering.pss.sale.order.CorePriceConfirm";
  295. ccp1.MethodName = "passPrice";
  296. ccp1.ServerParams = new object[] { ordPk, name, "营销管理部-价格管理科", JSONFormat.Format(sop), "", new ArrayList() };
  297. ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  298. if (ccp1.ReturnCode == -1)
  299. {
  300. MessageUtil.ShowWarning("价格审批自动审批失败!");
  301. return;
  302. }
  303. }
  304. // 法务审批
  305. CoreClientParam ccp2 = new CoreClientParam();
  306. ccp2.IfShowErrMsg = false;
  307. ccp2.ServerName = "com.steering.pss.sale.order.CoreOrderReviewLaw";
  308. ccp2.MethodName = "lawReviewPass";
  309. ccp2.ServerParams = new object[] { parm, name, "销售总公司-合同管理科", reviewMemo };
  310. ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  311. if (ccp2.ReturnCode == -1)
  312. {
  313. MessageUtil.ShowWarning("法务审批自动审批失败!");
  314. return;
  315. }
  316. }
  317. /// <summary>
  318. /// 定价内容
  319. /// </summary>
  320. private void doPrice()
  321. {
  322. UltraGridRow ugr = ultraGridHead.ActiveRow;
  323. if (ugr == null)
  324. {
  325. }
  326. if (ultraGridHead.ActiveRow == null)
  327. {
  328. MessageBox.Show("请选择合同头数据。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  329. return;
  330. }
  331. frmOrderPriceDetails opDetails = new frmOrderPriceDetails();
  332. opDetails.ob = this.ob;
  333. // opDetails.OrdPk = ultraGridHead.ActiveRow.Cells["ORD_PK"].Value.ToString();
  334. ArrayList parms = new ArrayList();
  335. ArrayList priceNoParms = new ArrayList();
  336. foreach (UltraGridRow row in ultraGridHead.Rows)
  337. {
  338. if (row.Selected || row.Activated)
  339. {
  340. parms.Add(row.Cells["ORD_PK"].Value.ToString());
  341. priceNoParms.Add(row.Cells["PRICE_NO"].Value.ToString());
  342. }
  343. }
  344. //string[] strs = priceNoParms.Cast<string>().Distinct().ToArray();
  345. int selectedCount = ultraGridHead.Rows.AsQueryable().Where(a => a.Selected == true).Count();
  346. int count = ultraGridHead.Rows.AsQueryable().Where(a => a.Selected == true
  347. && ultraGridHead.ActiveRow.Cells["PRICE_NO"].Value.ToString() == a.Cells["PRICE_NO"].Value.ToString()).Count();
  348. if (selectedCount == count)
  349. {
  350. opDetails.ShowDialog();
  351. }
  352. else
  353. {
  354. MessageBox.Show("选中合同头定价编号不一致,无法进行定价维护。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  355. return;
  356. }
  357. }
  358. /// <summary>
  359. /// 修正合同头状态
  360. /// </summary>
  361. /// <param name="ordPk"></param>
  362. private void UpdateHeadStatus(string ordPk, string hStatus, string hStatusDesc)
  363. {
  364. //获取当前选中合同头主键,修正当前合同头主键下面全部合同行,全部交货行状态为交货期评审通过。
  365. //执行数据库相关操作
  366. CoreClientParam ccp = new CoreClientParam();
  367. //服务端的包名+类名
  368. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  369. //类里的方法名
  370. ccp.MethodName = "UpdateHeadStatus";
  371. //带一个审批人和时间。
  372. ccp.ServerParams = new object[] { ordPk, hStatus, hStatusDesc, UserInfo.GetUserName() };
  373. try
  374. {
  375. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  376. }
  377. catch (Exception ex)
  378. {
  379. MessageBox.Show("错误提示:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  380. return;
  381. }
  382. if (ccp.ReturnCode == -1)
  383. {
  384. return;
  385. }
  386. else
  387. {
  388. //MessageBox.Show("提报成功。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  389. doQuery();
  390. foreach (UltraGridRow row in ultraGridHead.Rows)
  391. {
  392. if (ordPk.Equals(row.Cells["ORD_PK"].Value.ToString()))
  393. {
  394. row.Activate();
  395. break;
  396. }
  397. }
  398. }
  399. }
  400. /// <summary>
  401. /// 查询功能
  402. /// </summary>
  403. private void doQuery()
  404. {
  405. string orderNo = ultraTextOrder.Text.Trim();
  406. string orderStart = "";
  407. string orderEnd = "";
  408. if (uchkDate.Checked)
  409. {
  410. orderStart = ultraDateTimeSta.DateTime.ToString("yyyy-MM-dd") + " 00:00:01";
  411. orderEnd = ultraDateTimeEnd.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  412. }
  413. else
  414. {
  415. orderStart = "1000-01-01 00-00-01";
  416. orderEnd = "9999-01-01 23-59-59";
  417. }
  418. if (!ultraCheckOrder.Checked)
  419. {
  420. orderNo = "";
  421. }
  422. DataTable dt = new DataTable();
  423. //合同头状态为“交货期评审通过/审批退回(业务主管或主管经理)/价格评审失败/法务评审失败/待提报审批/待审批”的合同
  424. List<String> list = null;
  425. if (this.CustomInfo.Contains("approval"))
  426. {
  427. if (queryAll == false && queryPass == false)
  428. {
  429. list = new List<string>() { "12020212", "12020221", "12020223", "12020231", "12020241", "12020213", "12020220", orderNo, saleOrg, orderStart, orderEnd };
  430. }
  431. else if (queryAll == true)
  432. {
  433. list = new List<string>() { orderNo, saleOrg, orderStart, orderEnd };
  434. }
  435. else if (queryPass == true)
  436. {
  437. list = new List<string>() { orderNo, saleOrg, orderStart, orderEnd };
  438. }
  439. }
  440. //主管
  441. else if (this.CustomInfo.Contains("director")) //queryAll在此处无效 只为跟服务端统一
  442. {
  443. list = new List<string>() { "12020220", "12020220", "12020220", "12020220", "12020220", "12020220", "12020220", orderNo, saleOrg, orderStart, orderEnd };
  444. //展示内容:待审批12020220
  445. }
  446. //经理
  447. else if (this.CustomInfo.Contains("manager")) //queryAll在此处无效 只为跟服务端统一
  448. {
  449. list = new List<string>() { "12020222", "12020222", "12020222", "12020222", "12020222", "12020222", "12020220", orderNo, saleOrg, orderStart, orderEnd };
  450. }
  451. else
  452. {
  453. return;
  454. }
  455. string[] arr = this.ValidDataPurviewIds;
  456. string supp = this.CustomInfo.Contains("120504") ? "120504" : "";
  457. dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetQuery", new Object[] { list, this.CustomInfo, arr, saleOrg, queryAll, queryPass, supp }, this.ob);
  458. if (dt.Rows.Count <= 0)
  459. {
  460. this.orderLine.Rows.Clear();
  461. this.slmOrderModelItem.Rows.Clear();
  462. this.slmOrderPrice.Rows.Clear();
  463. }
  464. GridHelper.CopyDataToDatatable(ref dt, ref this.orderHead, true);
  465. //列自适应
  466. //GridHelper.RefreshAndAutoSizeExceptColumns(ultraGridHead, new UltraGridColumn[] { });
  467. }
  468. /// <summary>
  469. /// 查询定位功能
  470. /// </summary>
  471. private void doQuery(string ord_pk)
  472. {
  473. dataSetOrder.Clear();
  474. string orderNo = ultraTextOrder.Text.Trim();
  475. //string orderSts = "'120210','120211','120212','120213'";
  476. string orderStart = ultraDateTimeSta.DateTime.ToShortDateString();
  477. string orderEnd = ultraDateTimeEnd.DateTime.ToShortDateString();
  478. if (!uchkDate.Checked)
  479. {
  480. orderStart = ultraDateTimeSta.MinDate.ToShortDateString();
  481. orderEnd = ultraDateTimeSta.MaxDate.ToShortDateString();
  482. }
  483. if (!ultraCheckOrder.Checked)
  484. {
  485. orderNo = "";
  486. }
  487. DataTable dt = new DataTable();
  488. if (this.CustomInfo.Contains("doQueryReport"))
  489. {
  490. dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetQuery", new Object[] { orderNo, orderStart, orderEnd, "12020204", "12020205", "", "" }, this.ob);
  491. }
  492. if (this.CustomInfo.Contains("doQueryReports"))
  493. {
  494. dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetQuery", new Object[] { orderNo, orderStart, orderEnd, "12020205", "12020206", "12020207", "" }, this.ob);
  495. }
  496. GridHelper.CopyDataToDatatable(ref dt, ref this.orderHead, true);
  497. foreach (UltraGridRow row in ultraGridHead.Rows)
  498. {
  499. if ("1".Equals(row.Cells["CUSTOMER_MODEL_FL"].Value))
  500. {
  501. row.Cells["CUSTOMER_MODEL_FL"].Value = true;
  502. }
  503. else
  504. {
  505. row.Cells["CUSTOMER_MODEL_FL"].Value = false;
  506. }
  507. if ("1".Equals(row.Cells["VALIDFLAG"].Value))
  508. {
  509. row.Cells["VALIDFLAG"].Value = true;
  510. row.Appearance.ForeColor = Color.Black;
  511. }
  512. else
  513. {
  514. row.Cells["VALIDFLAG"].Value = false;
  515. row.Appearance.ForeColor = Color.Red;
  516. }
  517. if (ord_pk.Equals(row.Cells["ORD_PK"].Value.ToString()))
  518. {
  519. row.Activate();
  520. }
  521. }
  522. if (dt.Rows.Count <= 0)
  523. {
  524. this.orderHead.Rows.Clear();
  525. }
  526. //列自适应
  527. GridHelper.RefreshAndAutoSizeExceptRows(ultraGridHead, new UltraGridColumn[] {
  528. });
  529. }
  530. private void ultraCheckOrder_CheckedChanged(object sender, EventArgs e)
  531. {
  532. if (ultraCheckOrder.Checked)
  533. {
  534. this.ultraTextOrder.ReadOnly = false;
  535. }
  536. else
  537. {
  538. this.ultraTextOrder.ReadOnly = true;
  539. }
  540. }
  541. private void uchkDate_CheckedChanged(object sender, EventArgs e)
  542. {
  543. if (uchkDate.Checked)
  544. {
  545. ultraDateTimeSta.ReadOnly = false;
  546. ultraDateTimeEnd.ReadOnly = false;
  547. }
  548. else
  549. {
  550. ultraDateTimeSta.ReadOnly = true;
  551. ultraDateTimeEnd.ReadOnly = true;
  552. }
  553. }
  554. protected override void OnLoad(EventArgs e)
  555. {
  556. base.OnLoad(e);
  557. }
  558. private void ultraGridLine_AfterRowActivate(object sender, EventArgs e)
  559. {
  560. }
  561. /// <summary>
  562. /// 单纯审批提报
  563. /// </summary>
  564. /// <param name="ord_pk"></param>
  565. /// <param name="orderstsType"></param>
  566. /// <param name="orderstsDesc"></param>
  567. /// <param name="name"></param>
  568. /// <param name="time"></param>
  569. /// <param name="oldOrdersts"></param>
  570. /// <returns></returns>
  571. private bool orderstsUpdate(string ord_pk, string orderstsType, string orderstsDesc, string oldOrdersts)
  572. {
  573. ArrayList parms = new ArrayList();
  574. parms.Add(orderstsType);
  575. parms.Add(orderstsDesc);
  576. //加入审批人和审批时间
  577. parms.Add(UserInfo.GetUserName());
  578. parms.Add(ord_pk);
  579. CoreClientParam ccp = new CoreClientParam();
  580. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  581. ccp.MethodName = "doUpdateHeadOrder";
  582. ccp.ServerParams = new object[] { parms };
  583. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  584. if (ccp.ReturnCode == -1)
  585. {
  586. return false;
  587. }
  588. else
  589. {
  590. ArrayList parmsHead = new ArrayList();
  591. parmsHead.Add(orderstsType);
  592. parmsHead.Add(orderstsDesc);
  593. parmsHead.Add(oldOrdersts);
  594. parmsHead.Add("合同审批管理(frmOrderApproval.cs)");
  595. parmsHead.Add(ord_pk);
  596. parms = new ArrayList();
  597. parms.Add(orderstsType);
  598. parms.Add(oldOrdersts);
  599. parms.Add("合同审批管理(frmOrderApproval.cs)");
  600. parms.Add(ord_pk);
  601. ccp = new CoreClientParam();
  602. ccp.ServerName = "com.steering.pss.sale.order.CoreOrderManager";
  603. ccp.MethodName = "upOrderHeadLineDelivery";
  604. ccp.ServerParams = new object[] { parms, parmsHead };
  605. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  606. if (ccp.ReturnCode == -1)
  607. {
  608. return false;
  609. }
  610. return true;
  611. }
  612. }
  613. private bool orderstsUpdateMeMo(string ord_pk, string orderstsType, string orderstsDesc, string MeMo, string oldOrdersts)
  614. {
  615. ArrayList parms = new ArrayList();
  616. parms.Add(orderstsType);
  617. parms.Add(orderstsDesc);
  618. parms.Add(MeMo);
  619. parms.Add(ord_pk);
  620. CoreClientParam ccp = new CoreClientParam();
  621. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  622. ccp.MethodName = "doUpdateHeadOrderMeMo";
  623. ccp.ServerParams = new object[] { parms };
  624. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  625. if (ccp.ReturnCode == -1)
  626. {
  627. return false;
  628. }
  629. else
  630. {
  631. ArrayList parmsHead = new ArrayList();
  632. parmsHead.Add(orderstsType);
  633. parmsHead.Add(orderstsDesc);
  634. parmsHead.Add(oldOrdersts);
  635. parmsHead.Add("合同评审管理(frmOrderApproval.cs),评审回退");
  636. parmsHead.Add(ord_pk);
  637. parms = new ArrayList();
  638. parms.Add(orderstsType);
  639. parms.Add(oldOrdersts);
  640. parms.Add("合同评审管理(frmOrderApproval.cs),评审回退");
  641. parms.Add(ord_pk);
  642. ccp = new CoreClientParam();
  643. ccp.ServerName = "com.steering.pss.sale.order.CoreOrderManager";
  644. ccp.MethodName = "upOrderHeadLineDelivery";
  645. ccp.ServerParams = new object[] { parms, parmsHead };
  646. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  647. if (ccp.ReturnCode == -1)
  648. {
  649. return false;
  650. }
  651. return true;
  652. }
  653. }
  654. private void frmOrderApproval_Load(object sender, EventArgs e)
  655. {
  656. InitTime();
  657. if (this.CustomInfo != "approval" && this.CustomInfo != "approval-120504")
  658. {
  659. chkQueryAll.Visible = false;
  660. chkPass.Visible = false;
  661. }
  662. utSaleorg.ValueList = ClsBaseInfo.GetSaleOrgByValid(this.ValidDataPurviewIds);
  663. saleOrg = ClsBaseInfo.GetSaleOrg(UserInfo.GetDeptid());
  664. utSaleorg.Value=saleOrg;
  665. if (saleOrg == "100102")
  666. {
  667. chkPass.Visible = false;
  668. ultraGridHead.DisplayLayout.Bands[0].Groups[0].Hidden = true;
  669. }
  670. if (utSaleorg.ValueList.ValueListItems.Count > 1)
  671. {
  672. ultraLabel30.Visible = true;
  673. utSaleorg.Visible = true;
  674. }
  675. }
  676. private void ultraGridHead_AfterRowActivate(object sender, EventArgs e)
  677. {
  678. ultraGridHead.UpdateData();
  679. UltraGridRow ugr = ultraGridHead.ActiveRow;
  680. if (ugr != null)
  681. {
  682. String ordPk = ugr.Cells["ORD_PK"].Value.ToString();
  683. String orderModelNo = ugr.Cells["ORDER_MODEL_NO"].Value.ToString();
  684. String priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
  685. if (ultraTabControl1.SelectedTab.Key.Equals("1"))
  686. {
  687. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetLineOrder", new Object[] { ordPk }, this.ob);
  688. GridHelper.CopyDataToDatatable(ref dt, ref this.orderLine, true);
  689. }
  690. else if (ultraTabControl1.SelectedTab.Key.Equals("2"))
  691. {
  692. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetModelItem", new Object[] { orderModelNo }, this.ob);
  693. GridHelper.CopyDataToDatatable(ref dt, ref this.slmOrderModelItem, true);
  694. }
  695. else if (ultraTabControl1.SelectedTab.Key.Equals("3"))
  696. {
  697. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.GetOrderPriceList", new Object[] { priceNo, ordPk }, this.ob);
  698. GridHelper.CopyDataToDatatable(ref dt, ref this.slmOrderPrice, true);
  699. }
  700. else if (ultraTabControl1.SelectedTab.Key.Equals("4"))
  701. {
  702. textBox1.Text = getPriceBase(ordPk);
  703. }
  704. else
  705. {
  706. designStatus1.DoQuery(ultraGridHead.ActiveRow.Cells["ORDER_NO"].Value.ToString(), this.ob);
  707. }
  708. foreach (UltraGridCell cell in ugr.Cells)
  709. {
  710. if (!cell.Column.Key.Equals("CHK"))
  711. cell.Activation = Activation.ActivateOnly;
  712. }
  713. }
  714. //列自适应
  715. GridHelper.RefreshAndAutoSizeExceptRows(ultraGridLine, new UltraGridColumn[] {
  716. });
  717. }
  718. private void ultraDateTimeSta_ValueChanged(object sender, EventArgs e)
  719. {
  720. ultraDateTimeSta.FormatString = "yyyy-MM-dd";
  721. }
  722. /// <summary>
  723. /// 初始时间控件 2015/06/18
  724. /// </summary>
  725. private void InitTime()
  726. {
  727. ultraDateTimeSta.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1);
  728. ultraDateTimeEnd.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddHours(24).AddSeconds(-1);
  729. }
  730. /// <summary>
  731. /// 查询合同头状态/定价编号 2015/06/18
  732. /// </summary>
  733. /// <param name="ordPk">合同头号</param>
  734. /// <returns></returns>
  735. private String[] getOrderHeadStatus(String ordPk)
  736. {
  737. String[] status = null;
  738. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.getOrdPkStatus", new Object[] { ordPk }, this.ob);
  739. if (dt != null && dt.Rows.Count > 0)
  740. {
  741. status = new String[2];
  742. status[0] = dt.Rows[0][0].ToString();
  743. status[1] = dt.Rows[0][1].ToString();
  744. }
  745. return status;
  746. }
  747. /// <summary>
  748. /// 获取价格评审单的状态
  749. /// </summary>
  750. /// <param name="priceNo"></param>
  751. /// <returns></returns>
  752. private String getOrderPriceStatus(String priceNo)
  753. {
  754. String status = "";
  755. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.getOrderPriceStatus", new Object[] { priceNo }, this.ob);
  756. if (dt != null && dt.Rows.Count > 0)
  757. {
  758. status = dt.Rows[0][0].ToString();
  759. }
  760. return status;
  761. }
  762. /// <summary>
  763. /// 提报审批
  764. /// </summary>
  765. private void DoReport()
  766. {
  767. ultraGridHead.UpdateData();
  768. ArrayList parm = new ArrayList();
  769. int count = 0;
  770. string pk = "";
  771. foreach (UltraGridRow ugr in ultraGridHead.Rows)
  772. {
  773. if (ugr.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
  774. {
  775. count += 1;
  776. ArrayList list = new ArrayList();
  777. string ordPk = ugr.Cells["ORD_PK"].Value.ToString().Trim();
  778. string orderNo = ugr.Cells["ORDER_NO"].Value.ToString().Trim();
  779. string orderType = ugr.Cells["ORDER_TYP"].Value.ToString().Trim();
  780. //合同头状态
  781. String[] statuses = getOrderHeadStatus(ordPk);
  782. if (statuses == null)
  783. {
  784. MessageUtil.ShowWarning("合同" + orderNo + "状态异常,不能提报审批");
  785. return;
  786. }
  787. string status = statuses[0];
  788. string priceNo = statuses[1];
  789. int flag = 0; //是否需要进行价格维护
  790. if (orderType == "120104")
  791. {
  792. flag = 1; //预排合同不需要定价
  793. }
  794. else
  795. {
  796. if (orderNo.StartsWith("TH"))
  797. {
  798. flag = 1; // 天淮成品合同不需要定价,取天管合同价格,维护内部价格
  799. } else if (saleOrg.Equals("100102"))
  800. {
  801. flag = 1; //国贸公司跳过价格维护
  802. }
  803. else
  804. {
  805. if (priceNo.Length > 0)
  806. {
  807. string sts = getOrderPriceStatus(priceNo);
  808. if (sts != "W")
  809. {
  810. MessageUtil.ShowWarning("价格评审不是待审状态,无法提报!");
  811. return;
  812. }
  813. flag = 1;
  814. }
  815. else
  816. {
  817. flag = 0;
  818. }
  819. }
  820. }
  821. DataTable dt1 = ServerHelper.GetData("com.steering.pss.glbusiness.FrmTHOrderManage.getThBcOrder", new object[] { orderNo }, this.ob);
  822. if (dt1 != null && dt1.Rows.Count > 0 && ("002001042001012".Equals(UserInfo.GetDeptid()) || UserInfo.GetUserName() == "admin"))
  823. {
  824. flag = 1;
  825. }
  826. if ("天津钢管制造有限公司".Equals(ugr.Cells["CUSTOMER_NM"].Value.ToString().Trim()) && "江苏天淮钢管有限公司".Equals(ugr.Cells["SUPPLY_UNIT_NM"].Value.ToString().Trim()))
  827. {
  828. flag = 1;
  829. }
  830. //合同头状态为“交货期评审通过/待提报审批”的合同;而且必须有定价内容
  831. if ((status.Equals("12020212") || status.Equals("12020213")) && flag > 0)
  832. {
  833. list.Add(ordPk);
  834. list.Add(orderType);
  835. pk = ordPk;
  836. parm.Add(list);
  837. }
  838. else
  839. {
  840. if (!status.Equals("12020212") && !status.Equals("12020213"))
  841. {
  842. if (saleOrg == "100102")
  843. {
  844. MessageUtil.ShowWarning("合同" + orderNo + "处于待审批或者已审批通过,不必重复提报审批");
  845. return;
  846. }
  847. else
  848. {
  849. MessageUtil.ShowWarning("合同" + orderNo + "需要重新维护定价或者已处于待审批,不能提报审批");
  850. return;
  851. }
  852. }
  853. if (flag == 0)
  854. {
  855. MessageUtil.ShowWarning("合同" + orderNo + "没有定价内容,不能提报审批");
  856. return;
  857. }
  858. }
  859. }
  860. }
  861. if (count == 0)
  862. {
  863. MessageUtil.ShowWarning("请选择需要提报审批的数据");
  864. return;
  865. }
  866. if (MessageUtil.ShowYesNoAndQuestion("确认提报审批") == DialogResult.Yes)
  867. {
  868. CoreClientParam ccp = new CoreClientParam();
  869. dlgReviewMemo dlg = new dlgReviewMemo();
  870. dlg.ReviewFlag = 1;
  871. dlg.ReviewSatus = "提报审批";
  872. dlg.ShowDialog();
  873. string reviewMemo = dlg.ReviewMemo;
  874. if (dlg.DialogResult != DialogResult.OK)
  875. return;
  876. string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
  877. dept = dept + "-" + UserInfo.GetDepartment();
  878. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  879. ccp.MethodName = "doExport";
  880. ccp.ServerParams = new object[] { parm, reviewMemo, UserInfo.GetUserName(), dept, saleOrg };
  881. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  882. if (ccp.ReturnCode == -1)
  883. {
  884. return;
  885. }
  886. MessageUtil.ShowTips("提报审批成功!");
  887. doQuery();
  888. activeRow(ultraGridHead, pk);
  889. }
  890. }
  891. private void activeRow(UltraGrid ug, String value)
  892. {
  893. foreach (UltraGridRow ugr in ug.Rows)
  894. {
  895. if (ugr.Cells["ORD_PK"].Value.ToString().Equals(value))
  896. {
  897. ugr.Activate();
  898. }
  899. }
  900. }
  901. /// <summary>
  902. /// 撤销提报
  903. /// </summary>
  904. private void DoCancel()
  905. {
  906. if (saleOrg == "100102")
  907. {
  908. MessageUtil.ShowWarning("此功能对国贸合同没有操作权限!");
  909. return;
  910. }
  911. ultraGridHead.UpdateData();
  912. ArrayList parm = new ArrayList();
  913. int count = 0;
  914. string pk = "";
  915. foreach (UltraGridRow ugr in ultraGridHead.Rows)
  916. {
  917. if (ugr.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
  918. {
  919. ArrayList list = new ArrayList();
  920. count += 1;
  921. String ordPk = ugr.Cells["ORD_PK"].Value.ToString().Trim();
  922. String orderNo = ugr.Cells["ORDER_NO"].Value.ToString().Trim();
  923. String orderType = ugr.Cells["ORDER_TYP"].Value.ToString().Trim();
  924. //合同头状态
  925. String[] statuses = getOrderHeadStatus(ordPk);
  926. if (statuses == null)
  927. {
  928. MessageUtil.ShowWarning("合同" + orderNo + "状态异常,不能审批");
  929. return;
  930. }
  931. String status = statuses[0];
  932. if (status.Equals("12020220"))
  933. {
  934. list.Add(ordPk);
  935. list.Add(orderType);
  936. pk = ordPk;
  937. parm.Add(list);
  938. }
  939. else
  940. {
  941. MessageUtil.ShowWarning("合同" + orderNo + "状态不是待审批状态,不能撤销提报");
  942. return;
  943. }
  944. }
  945. }
  946. if (count == 0)
  947. {
  948. MessageUtil.ShowWarning("请选择需要撤销审批的数据");
  949. return;
  950. }
  951. if (MessageUtil.ShowYesNoAndQuestion("确认撤销提报") == DialogResult.Yes)
  952. {
  953. CoreClientParam ccp = new CoreClientParam();
  954. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  955. ccp.MethodName = "doCancel";
  956. ccp.ServerParams = new object[] { parm, saleOrg };
  957. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  958. if (ccp.ReturnCode == -1)
  959. {
  960. return;
  961. }
  962. MessageUtil.ShowTips("撤销提报成功!");
  963. doQuery();
  964. activeRow(ultraGridHead, pk);
  965. }
  966. }
  967. /// <summary>
  968. /// 定价内容
  969. /// </summary>
  970. private void doPriceN()
  971. {
  972. if (saleOrg == "100102")
  973. {
  974. MessageUtil.ShowWarning("此功能国贸合同没有操作权限!");
  975. return;
  976. }
  977. UltraGridRow ugr = ultraGridHead.ActiveRow;
  978. if (ugr == null)
  979. {
  980. MessageUtil.ShowWarning("请选择需要定价的合同");
  981. return;
  982. }
  983. string ordPk = ugr.Cells["ORD_PK"].Value.ToString().Trim();
  984. string[] statuses = getOrderHeadStatus(ordPk);
  985. string orderType = ugr.Cells["ORDER_TYP"].Value.ToString().Trim();
  986. if (orderType.Equals("120104"))
  987. {
  988. MessageUtil.ShowWarning("预排合同不需要维护价格!");
  989. return;
  990. }
  991. if (statuses == null)
  992. {
  993. MessageUtil.ShowWarning("合同状态异常,不能维护定价");
  994. return;
  995. }
  996. string status = statuses[0];
  997. ArrayList list = new ArrayList() { "12020212", "12020213", "12020221", "12020223", "12020231", "12020241" };
  998. if (list.Contains(status))
  999. {
  1000. //frmOrderPriceDetails opDetails = new frmOrderPriceDetails();
  1001. //opDetails.OrdPk = ordPk;
  1002. //opDetails.Ob = this.ob;
  1003. //opDetails.ShowDialog();
  1004. if (isOpened == true)
  1005. {
  1006. return;
  1007. }
  1008. FrmPriceConfirm fpc = new FrmPriceConfirm(this.ob, ordPk);
  1009. fpc.FormUse = "2";
  1010. fpc.Size = new Size(1000, 680);
  1011. fpc.SaleOrg = ugr.Cells["SALE_ORG"].Value.ToString();
  1012. fpc.Text = "价格维护";
  1013. isOpened = true;
  1014. fpc.FrmClosedRefreshHandle += fpc_FrmClosedRefreshHandle;
  1015. fpc.Show();
  1016. }
  1017. else
  1018. {
  1019. MessageUtil.ShowWarning("合同已审批,不能定价维护");
  1020. return;
  1021. }
  1022. }
  1023. void fpc_FrmClosedRefreshHandle(string ordPk)
  1024. {
  1025. isOpened = false;
  1026. doQuery();
  1027. foreach (UltraGridRow ugrn in ultraGridHead.Rows)
  1028. {
  1029. if (ugrn.Cells["ORD_PK"].Value.ToString().Equals(ordPk))
  1030. {
  1031. ugrn.Activate();
  1032. }
  1033. }
  1034. }
  1035. /// <summary>
  1036. /// 查询定价内容
  1037. /// </summary>
  1038. /// <param name="priceNo"></param>
  1039. /// <returns></returns>
  1040. private String getPriceBase(String ordPk)
  1041. {
  1042. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderReviewLaw.queryPriceInfo", new Object[] { ordPk }, ob);
  1043. if (dt != null && dt.Rows.Count > 0)
  1044. {
  1045. return dt.Rows[0][0].ToString();
  1046. }
  1047. else
  1048. {
  1049. return "";
  1050. }
  1051. }
  1052. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  1053. {
  1054. ultraGridHead.UpdateData();
  1055. UltraGridRow ugr = ultraGridHead.ActiveRow;
  1056. if (ugr != null)
  1057. {
  1058. String ordPk = ugr.Cells["ORD_PK"].Value.ToString();
  1059. String orderModelNo = ugr.Cells["ORDER_MODEL_NO"].Value.ToString();
  1060. String priceNo = ugr.Cells["PRICE_NO"].Value.ToString();
  1061. if (e.Tab.Key.Equals("1"))
  1062. {
  1063. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetLineOrder", new Object[] { ordPk }, this.ob);
  1064. GridHelper.CopyDataToDatatable(ref dt, ref this.orderLine, true);
  1065. }
  1066. else if (e.Tab.Key.Equals("2"))
  1067. {
  1068. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.doGetModelItem", new Object[] { orderModelNo }, this.ob);
  1069. GridHelper.CopyDataToDatatable(ref dt, ref this.slmOrderModelItem, true);
  1070. }
  1071. else if (e.Tab.Key.Equals("3"))
  1072. {
  1073. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CopyOrderApproval.GetOrderPriceList", new Object[] { priceNo, ordPk }, this.ob);
  1074. GridHelper.CopyDataToDatatable(ref dt, ref this.slmOrderPrice, true);
  1075. }
  1076. else if (e.Tab.Key.Equals("4"))
  1077. {
  1078. textBox1.Text = getPriceBase(ordPk);
  1079. }
  1080. else
  1081. {
  1082. designStatus1.DoQuery(ultraGridHead.ActiveRow.Cells["ORDER_NO"].Value.ToString(), this.ob);
  1083. }
  1084. }
  1085. }
  1086. /// <summary>
  1087. /// 会退到交货期评审通过
  1088. /// </summary>
  1089. private void BackToDelivery()
  1090. {
  1091. if (saleOrg == "100102")
  1092. {
  1093. MessageUtil.ShowWarning("此功能只针对于国内贸易部!");
  1094. return;
  1095. }
  1096. //主管 ,经理 价格 法务 评审失败的状态 可以直接会退到交货期评审通过
  1097. UltraGridRow ugr = ultraGridHead.ActiveRow;
  1098. if (ugr == null)
  1099. {
  1100. MessageUtil.ShowWarning("请选择需要退回交货期的合同!");
  1101. return;
  1102. }
  1103. string ordPk = ugr.Cells["ORD_PK"].Value.ToString();
  1104. string sts = "";
  1105. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.getOrderHeadStatus", new object[] { ordPk }, this.ob);
  1106. if (dt != null && dt.Rows.Count > 0)
  1107. {
  1108. sts = dt.Rows[0][0].ToString();
  1109. }
  1110. if (ugr.Cells["SUPPLY_UNIT_NM"].Text.Equals("江苏天淮钢管有限公司") && !ugr.Cells["FST_DRAWEE_UNIT_NM"].Text.Equals("江苏天淮钢管有限公司"))
  1111. {
  1112. MessageUtil.ShowWarning("天淮成品合同无法退回交货期!");
  1113. return;
  1114. }
  1115. if (sts != "12020301" && Convert.ToInt32(sts) < 12020301 && Convert.ToInt32(sts) >= 12020212)
  1116. {
  1117. if (MessageUtil.ShowYesNoAndQuestion("是否退回到交货期状态?") == DialogResult.No) return;
  1118. string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
  1119. dept = dept + "-" + UserInfo.GetDepartment();
  1120. string name = UserInfo.GetUserName();
  1121. dlgReviewMemo dlg = new dlgReviewMemo();
  1122. dlg.ReviewFlag = 0;
  1123. dlg.ReviewSatus = "退回交货期状态";
  1124. dlg.ShowDialog();
  1125. string reviewMemo = dlg.ReviewMemo;
  1126. if (dlg.DialogResult != DialogResult.OK)
  1127. return;
  1128. CoreClientParam ccp = new CoreClientParam();
  1129. ccp.IfShowErrMsg = false;
  1130. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  1131. ccp.MethodName = "backToDelivery";
  1132. ccp.ServerParams = new object[] { ordPk, dept, name, reviewMemo };
  1133. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1134. if (ccp != null)
  1135. {
  1136. if (ccp.ReturnCode == -1)
  1137. {
  1138. MessageUtil.ShowWarning(ccp.ReturnInfo);
  1139. return;
  1140. }
  1141. MessageUtil.ShowTips("回退成功!");
  1142. doQuery();
  1143. }
  1144. }
  1145. else
  1146. {
  1147. MessageUtil.ShowWarning("合同已生效或者处于交货期通过之前的状态,不能直接退回交货期");
  1148. return;
  1149. }
  1150. }
  1151. //回退交货期 国贸
  1152. private void BackToDeliveryIE()
  1153. {
  1154. if (saleOrg != "100102")
  1155. {
  1156. MessageUtil.ShowWarning("此功能只针对于国际贸易部!");
  1157. return;
  1158. }
  1159. //国贸 待审批 审批通过的状态 可以直接会退到交货期评审通过
  1160. UltraGridRow ugr = ultraGridHead.ActiveRow;
  1161. if (ugr == null)
  1162. {
  1163. MessageUtil.ShowWarning("请选择需要退回交货期的合同!");
  1164. return;
  1165. }
  1166. string ordPk = ugr.Cells["ORD_PK"].Value.ToString();
  1167. string sts = "";
  1168. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.getOrderHeadStatus", new object[] { ordPk }, this.ob);
  1169. if (dt != null && dt.Rows.Count > 0)
  1170. {
  1171. sts = dt.Rows[0][0].ToString();
  1172. }
  1173. if (sts != "12020301" && Convert.ToInt32(sts) < 12020301 && Convert.ToInt32(sts) >= 12020212)
  1174. {
  1175. if (MessageUtil.ShowYesNoAndQuestion("是否退回到交货期状态?") == DialogResult.No) return;
  1176. string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
  1177. dept = dept + "-" + UserInfo.GetDepartment();
  1178. string name = UserInfo.GetUserName();
  1179. dlgReviewMemo dlg = new dlgReviewMemo();
  1180. dlg.ReviewFlag = 0;
  1181. dlg.ReviewSatus = "退回交货期状态";
  1182. dlg.ShowDialog();
  1183. string reviewMemo = dlg.ReviewMemo;
  1184. if (dlg.DialogResult != DialogResult.OK)
  1185. return;
  1186. CoreClientParam ccp = new CoreClientParam();
  1187. ccp.IfShowErrMsg = false;
  1188. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  1189. ccp.MethodName = "backToDeliveryIE";
  1190. ccp.ServerParams = new object[] { ordPk, dept, name, reviewMemo };
  1191. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1192. if (ccp != null)
  1193. {
  1194. if (ccp.ReturnCode == -1)
  1195. {
  1196. MessageUtil.ShowWarning(ccp.ReturnInfo);
  1197. return;
  1198. }
  1199. MessageUtil.ShowTips("回退成功!");
  1200. doQuery();
  1201. }
  1202. }
  1203. else
  1204. {
  1205. MessageUtil.ShowWarning("合同已生效或者处于交货期通过之前的状态,不能直接退回交货期!");
  1206. return;
  1207. }
  1208. }
  1209. private void ultraTextOrder_KeyPress(object sender, KeyPressEventArgs e)
  1210. {
  1211. if (e.KeyChar == 13)
  1212. doQuery();
  1213. }
  1214. private void frmOrderApproval_Shown(object sender, EventArgs e)
  1215. {
  1216. if (saleOrg == "100102") //国贸
  1217. {
  1218. if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
  1219. toolMenu.Toolbars[0].Tools["doPrice"].InstanceProps.Visible = DefaultableBoolean.False;
  1220. if (toolMenu.Toolbars[0].Tools.Exists("doCancel"))
  1221. toolMenu.Toolbars[0].Tools["doCancel"].InstanceProps.Visible = DefaultableBoolean.False;
  1222. if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
  1223. toolMenu.Toolbars[0].Tools["ChgePrice"].InstanceProps.Visible = DefaultableBoolean.False;
  1224. }
  1225. if (this.CustomInfo.Contains("approval")) //用于审批提报界面
  1226. {
  1227. if (queryPass != true)
  1228. {
  1229. if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
  1230. this.ToolBarItemEnable(this, "ChgePrice", false);
  1231. if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
  1232. this.ToolBarItemEnable(this, "doPrice", true);
  1233. }
  1234. else
  1235. {
  1236. if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
  1237. this.ToolBarItemEnable(this, "ChgePrice", true);
  1238. if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
  1239. this.ToolBarItemEnable(this, "doPrice", false);
  1240. }
  1241. }
  1242. }
  1243. private void chkQueryAll_CheckedChanged(object sender, EventArgs e)
  1244. {
  1245. if (chkQueryAll.Checked)
  1246. {
  1247. chkPass.Checked = false;
  1248. queryAll = true;
  1249. doQuery();
  1250. }
  1251. else
  1252. {
  1253. queryAll = false;
  1254. doQuery();
  1255. }
  1256. }
  1257. private void chkPass_CheckedChanged(object sender, EventArgs e)
  1258. {
  1259. if (chkPass.Checked)
  1260. {
  1261. chkQueryAll.Checked = false;
  1262. queryPass = true;
  1263. doQuery();
  1264. if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
  1265. this.ToolBarItemEnable(this, "ChgePrice", true);
  1266. if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
  1267. this.ToolBarItemEnable(this, "doPrice", false);
  1268. }
  1269. else
  1270. {
  1271. queryPass = false;
  1272. doQuery();
  1273. if (toolMenu.Toolbars[0].Tools.Exists("ChgePrice"))
  1274. this.ToolBarItemEnable(this, "ChgePrice", false);
  1275. if (toolMenu.Toolbars[0].Tools.Exists("doPrice"))
  1276. this.ToolBarItemEnable(this, "doPrice", true);
  1277. }
  1278. }
  1279. private void ChgePrice()
  1280. {
  1281. if (saleOrg == "100102")
  1282. {
  1283. MessageUtil.ShowWarning("此功能国贸合同没有操作权限!");
  1284. return;
  1285. }
  1286. UltraGridRow ugr = ultraGridHead.ActiveRow;
  1287. if (ugr == null)
  1288. {
  1289. MessageUtil.ShowWarning("请选择需要定价的合同");
  1290. return;
  1291. }
  1292. String ordPk = ugr.Cells["ORD_PK"].Value.ToString().Trim();
  1293. String[] statuses = getOrderHeadStatus(ordPk);
  1294. if (statuses == null)
  1295. {
  1296. MessageUtil.ShowWarning("合同状态异常,不能价格维护");
  1297. return;
  1298. }
  1299. String status = statuses[0];
  1300. if (Convert.ToInt32(status == "" ? "0" : status) >= 12020232)
  1301. {
  1302. if (isOpened)
  1303. {
  1304. return;
  1305. }
  1306. FrmPriceConfirm fpc = new FrmPriceConfirm(this.ob, ordPk);
  1307. fpc.FormUse = "3";
  1308. fpc.Size = new Size(1000, 680);
  1309. fpc.SaleOrg = ugr.Cells["SALE_ORG"].Value.ToString();
  1310. fpc.Text = "价格维护";
  1311. fpc.FrmClosedRefreshHandle += fpc_FrmClosedRefreshHandle;
  1312. isOpened = true;
  1313. fpc.Show();
  1314. }
  1315. else
  1316. {
  1317. MessageUtil.ShowWarning("不是价格放行的合同,不能价格维护!\n若要维护价格,请点击定价维护!");
  1318. return;
  1319. }
  1320. }
  1321. /// <summary>
  1322. /// 现货退回
  1323. /// </summary>
  1324. private void BackEdit()
  1325. {
  1326. UltraGridRow ugr = ultraGridHead.ActiveRow;
  1327. if (ugr == null)
  1328. {
  1329. MessageUtil.ShowWarning("请选择需要退回的现货合同!");
  1330. return;
  1331. }
  1332. string ordPk = ugr.Cells["ORD_PK"].Value.ToString();
  1333. string ordType = "";
  1334. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.getOrderType", new object[] { ordPk }, this.ob);
  1335. if (dt != null && dt.Rows.Count > 0)
  1336. {
  1337. ordType = dt.Rows[0][0].ToString();
  1338. }
  1339. if (ordType == "120102" || ordType == "120105")
  1340. {
  1341. //2015-10-30 修改了现货合同的逻辑 不存在现货合同的退回情况 现货合同的基本信息不存在修改情况 因为是根据选择的炉号生成的现货合同
  1342. //MessageUtil.ShowWarning("现货合同不允许退回!");
  1343. //return;
  1344. if (MessageUtil.ShowYesNoAndQuestion("是否将现货合同退回到录入状态?") == DialogResult.No) return;
  1345. string dept = ClsBaseInfo.GetDepartBySectionIdChangeSale(UserInfo.GetDeptid(), this.ob);
  1346. dept = dept + "-" + UserInfo.GetDepartment();
  1347. string name = UserInfo.GetUserName();
  1348. dlgReviewMemo dlg = new dlgReviewMemo();
  1349. dlg.ReviewFlag = 0;
  1350. dlg.ReviewSatus = "退回录入状态";
  1351. dlg.ShowDialog();
  1352. string reviewMemo = dlg.ReviewMemo;
  1353. if (dlg.DialogResult != DialogResult.OK)
  1354. return;
  1355. CoreClientParam ccp = new CoreClientParam();
  1356. ccp.IfShowErrMsg = false;
  1357. ccp.ServerName = "com.steering.pss.sale.order.CopyOrderApproval";
  1358. ccp.MethodName = "backEdit";
  1359. ccp.ServerParams = new object[] { ordPk, dept, name, reviewMemo, saleOrg };
  1360. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1361. if (ccp != null)
  1362. {
  1363. if (ccp.ReturnCode == -1)
  1364. {
  1365. MessageUtil.ShowWarning(ccp.ReturnInfo);
  1366. return;
  1367. }
  1368. MessageUtil.ShowTips("回退成功!");
  1369. doQuery();
  1370. }
  1371. }
  1372. else
  1373. {
  1374. MessageUtil.ShowWarning("您选择的合同不是现货合同或者贸易合同,无法退回!");
  1375. return;
  1376. }
  1377. }
  1378. private void utSaleorg_ValueChanged(object sender, EventArgs e)
  1379. {
  1380. if (utSaleorg.SelectedIndex == -1)
  1381. utSaleorg.SelectedIndex = 0;
  1382. saleOrg = utSaleorg.Value.ToString();
  1383. doQuery();
  1384. }
  1385. }
  1386. }