frmOrderColligateInfomation.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  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 com.steering.pss.sale.order.model;
  11. using Core.Mes.Client.Comm.Tool;
  12. using Core.Mes.Client.Comm.Server;
  13. using System.Collections;
  14. using Infragistics.Win.UltraWinGrid;
  15. using Infragistics.Win.UltraWinEditors;
  16. using Core.StlMes.Client.SaleComm;
  17. namespace Core.StlMes.Client.SaleOrder.ReviewForm
  18. {
  19. public partial class frmOrderColligateInfomation : FrmBase
  20. {
  21. UltraComboEditor uceA = new UltraComboEditor();
  22. UltraComboEditor uceB = new UltraComboEditor();
  23. public frmOrderColligateInfomation()
  24. {
  25. InitializeComponent();
  26. this.IsLoadUserView = true;
  27. }
  28. /// <summary>
  29. /// 重写基类toolBar方法
  30. /// </summary>
  31. /// <param name="sender"></param>
  32. /// <param name="ToolbarKey"></param>
  33. public override void ToolBar_Click(object sender, string ToolbarKey)
  34. {
  35. switch (ToolbarKey)
  36. {
  37. case "Query":
  38. DoQuery();
  39. break;
  40. case "Print":
  41. DoLink();
  42. break;
  43. case "Refresh":
  44. DoRefresh();
  45. break;
  46. case "PrintOrder":
  47. PrintOrder();
  48. break;
  49. case "PrintOrderA4":
  50. PrintOrderA4();
  51. break;
  52. case "PrintBackA4":
  53. PrintBackA4();
  54. break;
  55. case "PrintOrderPreview":
  56. PrintOrderPreview();
  57. break;
  58. case "Close":
  59. this.Close();
  60. break;
  61. }
  62. }
  63. private void DoQuery()
  64. {
  65. DoQueryHead();
  66. }
  67. private void DoSave()
  68. {
  69. ultraGridOrderLine.UpdateData();
  70. UltraGridRow ugrHead = ultraGridOrderHead.ActiveRow;
  71. if (ugrHead == null)
  72. {
  73. MessageUtil.ShowWarning("请选择合同");
  74. return;
  75. }
  76. IQueryable<UltraGridRow> checkRows = ultraGridOrderLine.Rows.AsQueryable().Where(" CHC = 'True'");
  77. if (checkRows.Count() == 0)
  78. {
  79. MessageUtil.ShowWarning("请选择合同行");
  80. return;
  81. }
  82. ArrayList list = new ArrayList();
  83. String orderSeq = "";
  84. foreach (UltraGridRow ugr in checkRows)
  85. {
  86. PlnOrdCraftFileEntity fileEntity = new PlnOrdCraftFileEntity();
  87. fileEntity.CraftFileFlagCode = ugr.Cells["CraftFileFlagCode"].Value.ToString().Trim();
  88. fileEntity.CraftFileFlagNm = ugr.Cells["CraftFileFlagNm"].Value.ToString().Trim();
  89. fileEntity.CraftFileMan = ugr.Cells["CraftFileMan"].Value.ToString().Trim();
  90. fileEntity.CraftFileNo = ugr.Cells["CraftFileNo"].Value.ToString().Trim();
  91. fileEntity.CraftFilePath = ugr.Cells["CraftFilePath"].Value.ToString().Trim();
  92. fileEntity.CraftFileTypeCode = ugr.Cells["CraftFileTypeCode"].Value.ToString().Trim();
  93. fileEntity.CraftFileTypeNm = ugr.Cells["CraftFileTypeNm"].Value.ToString().Trim();
  94. fileEntity.OrderSeq = ugr.Cells["OrderSeq"].Value.ToString().Trim();
  95. fileEntity.OrdLnPk = ugr.Cells["OrdLnPk"].Value.ToString().Trim();
  96. fileEntity.OrdPk = ugr.Cells["OrdPk"].Value.ToString().Trim();
  97. fileEntity.OrderNo = ugrHead.Cells["OrderNo"].Value.ToString();
  98. fileEntity.CreateName = this.UserInfo.GetUserName();
  99. fileEntity.UpdateName = this.UserInfo.GetUserName();
  100. list.Add(fileEntity);
  101. orderSeq = fileEntity.OrderSeq.ToString();
  102. }
  103. if (MessageUtil.ShowYesNoAndQuestion("是否保存?") == DialogResult.No)
  104. {
  105. return;
  106. }
  107. CoreClientParam ccp = new CoreClientParam();
  108. ccp.ServerName = "com.steering.pss.sale.order.CoreOrderColligateInfomation";
  109. ccp.MethodName = "saveCraftFile";
  110. ccp.ServerParams = new object[] { list };
  111. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  112. if (ccp.ReturnCode != -1)
  113. {
  114. MessageUtil.ShowTips(ccp.ReturnInfo);
  115. DoQueryLine(ugrHead.Cells["OrdPk"].Value.ToString());
  116. foreach (UltraGridRow ugrline in ultraGridOrderLine.Rows)
  117. {
  118. if (ugrline.Cells["OrderSeq"].Text.Equals(orderSeq))
  119. {
  120. ugrline.Activate();
  121. }
  122. }
  123. }
  124. }
  125. private void DoRefresh()
  126. {
  127. if (ultraDateTimeEditorBegin.Value == null || ultraDateTimeEditorEnd.Value == null)
  128. {
  129. MessageUtil.ShowWarning("请选择正确的时间");
  130. return;
  131. }
  132. ultraComboEditorOrderNo.DataSource = null;
  133. String beginTime = ultraDateTimeEditorBegin.Value.ToString();
  134. String endTime = ultraDateTimeEditorEnd.Value.ToString();
  135. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreConReviewInfo.getOrdNoByTime", new Object[] { beginTime, endTime }, this.ob);
  136. ultraComboEditorOrderNo.DataSource = dt;
  137. }
  138. private void frmOrderInfomation_Load(object sender, EventArgs e)
  139. {
  140. EntityHelper.ShowGridCaption<SlmOrderHeadEntity>(ultraGridOrderHead.DisplayLayout.Bands[0]);
  141. EntityHelper.ShowGridCaption<SlmOrderLineNextEntity>(ultraGridOrderLine.DisplayLayout.Bands[0]);
  142. EntityHelper.ShowGridCaption<SlmOrderLineDeliveryEntity>(ultraGridOrderDeliry.DisplayLayout.Bands[0]);
  143. EntityHelper.ShowGridCaption<SlmOrderDeliveryTransitEntity>(ultraGridOrderTait.DisplayLayout.Bands[0]);
  144. EntityHelper.ShowGridCaption<SlmOrderPriceListEntity>(ultraGridOrderPrice.DisplayLayout.Bands[0]);
  145. InitDate();
  146. InitCombo();
  147. }
  148. /// <summary>
  149. /// 初始时间
  150. /// </summary>
  151. private void InitDate()
  152. {
  153. ultraCheckEditorOrderNo.Checked = true;
  154. ultraDateTimeEditorBegin.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-1);
  155. ultraDateTimeEditorEnd.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1).AddSeconds(-1);
  156. DoRefresh();
  157. }
  158. private void DoQueryHead()
  159. {
  160. ArrayList param = new ArrayList();
  161. if (ultraCheckEditorOrderNo.Checked)
  162. {
  163. param.Add(ultraComboEditorOrderNo.Text.Trim());
  164. }
  165. else
  166. {
  167. param.Add("");
  168. }
  169. if (ultraDateTimeEditorBegin.Value == null || ultraDateTimeEditorEnd.Value == null)
  170. {
  171. MessageUtil.ShowWarning("请选择正确的时间");
  172. return;
  173. }
  174. string timeBegin = "";
  175. string timeEnd = "";
  176. timeBegin = "1000-01-01 00:00:01";
  177. timeEnd = "9999-12-31 23:59:59";
  178. if (chkTime.Checked)
  179. {
  180. timeBegin = ultraDateTimeEditorBegin.DateTime.ToString("yyyy-MM-dd") + " 00:00:01";
  181. timeEnd = ultraDateTimeEditorEnd.DateTime.ToString("yyyy-MM-dd") + " 23:59:59";
  182. }
  183. param.Add(timeBegin);
  184. param.Add(timeEnd);
  185. int num = 0;
  186. if (radioBal.Checked)
  187. num = 0;
  188. if (radioAll.Checked)
  189. num = 1;
  190. List<SlmOrderHeadEntity> listSorce = EntityHelper.GetData<SlmOrderHeadEntity>(
  191. "com.steering.pss.sale.order.CoreOrderColligateInfomation.getOrderHeadInfo", new object[] { param, this.ValidDataPurviewIds, num }, this.ob);
  192. slmOrderHeadEntityBindingSource.DataSource = listSorce;
  193. }
  194. private void DoQueryLine(String ordPk)
  195. {
  196. List<SlmOrderLineNextEntity> listSorce = EntityHelper.GetData<SlmOrderLineNextEntity>(
  197. "com.steering.pss.sale.order.CoreOrderColligateInfomation.getOrderLineInfo", new object[] { ordPk }, this.ob);
  198. slmOrderLineNextEntityBindingSource.DataSource = listSorce;
  199. SetColumnReadOnly();
  200. if (listSorce.Count == 0)
  201. {
  202. DoQueryPrice("");
  203. DoQueryDelivry("");
  204. }
  205. }
  206. private void DoQueryPrice(String ordLnPk)
  207. {
  208. List<SlmOrderPriceListEntity> listSorce = EntityHelper.GetData<SlmOrderPriceListEntity>(
  209. "com.steering.pss.sale.order.CoreOrderColligateInfomation.getOrderPriceDetail", new object[] { ordLnPk }, this.ob);
  210. slmOrderPriceListEntityBindingSource.DataSource = listSorce;
  211. }
  212. private void ultraCheckEditorOrderNo_CheckedChanged(object sender, EventArgs e)
  213. {
  214. if (ultraCheckEditorOrderNo.Checked)
  215. {
  216. ultraComboEditorOrderNo.Enabled = true;
  217. }
  218. else
  219. {
  220. ultraComboEditorOrderNo.Enabled = false;
  221. }
  222. }
  223. private void ultraGridOrderHead_AfterRowActivate(object sender, EventArgs e)
  224. {
  225. UltraGridRow ugr = ultraGridOrderHead.ActiveRow;
  226. if (ugr == null)
  227. {
  228. return;
  229. }
  230. String priceNo = ugr.Cells["PriceNo"].Value.ToString().Trim();
  231. if (priceNo.Length > 0)
  232. {
  233. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.getOrderPriceInfo", new Object[] { priceNo }, this.ob);
  234. if (dt != null && dt.Rows.Count > 0)
  235. {
  236. ultraLabel1.Text = dt.Rows[0][0].ToString();
  237. }
  238. else
  239. {
  240. ultraLabel1.Text = "";
  241. }
  242. }
  243. else
  244. {
  245. ultraLabel1.Text = "";
  246. }
  247. String ordPk = ugr.Cells["OrdPk"].Value.ToString().Trim();
  248. DoQueryLine(ordPk);
  249. }
  250. private void ultraGridOrderLine_AfterRowActivate(object sender, EventArgs e)
  251. {
  252. ultraGridOrderLine.UpdateData();
  253. UltraGridRow ugr = ultraGridOrderLine.ActiveRow;
  254. if (ugr == null)
  255. {
  256. return;
  257. }
  258. String ordLnPk = ugr.Cells["OrdLnPk"].Value.ToString().Trim();
  259. DoQueryPrice(ordLnPk);
  260. DoQueryDelivry(ordLnPk);
  261. }
  262. private void DoQueryDelivry(String ordLnPk)
  263. {
  264. List<SlmOrderLineDeliveryEntity> listSorce = EntityHelper.GetData<SlmOrderLineDeliveryEntity>(
  265. "com.steering.pss.sale.order.CoreOrderInfomation.getOrderDelivyInfo", new object[] { ordLnPk }, this.ob);
  266. slmOrderLineDeliveryEntityBindingSource.DataSource = listSorce;
  267. if (listSorce.Count == 0)
  268. {
  269. DoQuerygTranSit("");
  270. }
  271. }
  272. private void DoQuerygTranSit(String ordLnDlyPk)
  273. {
  274. List<SlmOrderDeliveryTransitEntity> listSorce = EntityHelper.GetData<SlmOrderDeliveryTransitEntity>(
  275. "com.steering.pss.sale.order.CoreOrderInfomation.getOrderTranSit", new object[] { ordLnDlyPk }, this.ob);
  276. slmOrderDeliveryTransitEntityBindingSource.DataSource = listSorce;
  277. }
  278. private void ultraGridOrderDeliry_AfterRowActivate(object sender, EventArgs e)
  279. {
  280. UltraGridRow ugr = ultraGridOrderDeliry.ActiveRow;
  281. if (ugr == null)
  282. {
  283. return;
  284. }
  285. String ordLnDlyPk = ugr.Cells["OrdLnDlyPk"].Value.ToString().Trim();
  286. DoQuerygTranSit(ordLnDlyPk);
  287. }
  288. private void InitCombo()
  289. {
  290. this.Controls.Add(uceA);
  291. this.Controls.Add(uceB);
  292. uceA.Visible = false;
  293. uceB.Visible = false;
  294. DataTable dtA = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.getBaseInfo2002", new object[] { }, this.ob);
  295. DataTable dtB = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.getBaseInfo2003", new object[] { }, this.ob);
  296. uceA.DataSource = dtA;
  297. uceA.DisplayMember = "BASENAME";
  298. uceA.ValueMember = "BASECODE";
  299. uceB.DataSource = dtB;
  300. uceB.DisplayMember = "BASENAME";
  301. uceB.ValueMember = "BASECODE";
  302. ultraGridOrderLine.DisplayLayout.Bands[0].Columns["CraftFileTypeCode"].EditorComponent = uceA;
  303. ultraGridOrderLine.DisplayLayout.Bands[0].Columns["CraftFileTypeCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  304. ultraGridOrderLine.DisplayLayout.Bands[0].Columns["CraftFileFlagCode"].EditorComponent = uceB;
  305. ultraGridOrderLine.DisplayLayout.Bands[0].Columns["CraftFileFlagCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  306. ultraGridOrderLine.DisplayLayout.Bands[0].Columns["FilePath"].EditorComponent = askItemImg;
  307. }
  308. private void ultraGridOrderLine_CellChange(object sender, CellEventArgs e)
  309. {
  310. ultraGridOrderLine.UpdateData();
  311. if (ultraGridOrderLine.ActiveRow == null)
  312. {
  313. return;
  314. }
  315. if (e.Cell.Column.Key.Equals("CraftFileTypeCode"))
  316. {
  317. ultraGridOrderLine.ActiveRow.Cells["CraftFileTypeNm"].Value = e.Cell.Text;
  318. }
  319. if (e.Cell.Column.Key.Equals("CraftFileFlagCode"))
  320. {
  321. ultraGridOrderLine.ActiveRow.Cells["CraftFileFlagNm"].Value = e.Cell.Text;
  322. }
  323. if (e.Cell.Column.Key.Equals("CHC"))
  324. {
  325. if (Boolean.Parse(e.Cell.Value.ToString()))
  326. {
  327. e.Cell.Row.Cells["CraftFileTypeCode"].Activation = Activation.AllowEdit;
  328. e.Cell.Row.Cells["CraftFileFlagCode"].Activation = Activation.AllowEdit;
  329. e.Cell.Row.Cells["FilePath"].Activation = Activation.AllowEdit;
  330. e.Cell.Row.Cells["CraftFileMan"].Activation = Activation.AllowEdit;
  331. e.Cell.Row.Cells["CraftFileNo"].Activation = Activation.AllowEdit;
  332. }
  333. else
  334. {
  335. e.Cell.Row.Cells["CraftFileTypeCode"].Activation = Activation.ActivateOnly;
  336. e.Cell.Row.Cells["CraftFileFlagCode"].Activation = Activation.ActivateOnly;
  337. e.Cell.Row.Cells["FilePath"].Activation = Activation.ActivateOnly;
  338. e.Cell.Row.Cells["CraftFileMan"].Activation = Activation.ActivateOnly;
  339. e.Cell.Row.Cells["CraftFileNo"].Activation = Activation.ActivateOnly;
  340. }
  341. }
  342. }
  343. private void askItemImg_EditorButtonClick(object sender, EditorButtonEventArgs e)
  344. {
  345. UltraGridRow ugr = ultraGridOrderLine.ActiveRow;
  346. if (ugr == null)
  347. {
  348. return;
  349. }
  350. string ordLnPk = ugr.GetValue("OrdLnPk");
  351. string filePath = "saleOrder/ReviewForm/frmOrderColligateInfomation/" + ordLnPk;
  352. if (e.Button.Key.ToLower().Equals("select"))
  353. {
  354. dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
  355. down.ShowDialog();
  356. }
  357. if (e.Button.Key.ToLower().Equals("choice"))
  358. {
  359. bool isUpload = FlileUploadcomm.FlileUpload(filePath);
  360. if (isUpload)
  361. {
  362. dlgOrderAskDown down = new dlgOrderAskDown(this.ob, filePath);
  363. down.ShowDialog();
  364. }
  365. }
  366. ugr.Cells["CraftFilePath"].Value = filePath;
  367. }
  368. /// <summary>
  369. /// 设置列只可读
  370. /// </summary>
  371. /// <param name="ugr">UltraGrid</param>
  372. /// <param name="columns">列数组</param>
  373. private void SetColumnReadOnly()
  374. {
  375. for (int i = 0; i < ultraGridOrderLine.Rows.Count; i++)
  376. {
  377. UltraGridRow ugr = ultraGridOrderLine.Rows[i];
  378. for (int j = 0; j < ugr.Cells.Count; j++)
  379. {
  380. if (!ugr.Cells[j].Column.Key.Equals("CHC"))
  381. ugr.Cells[j].Activation = Activation.ActivateOnly;
  382. }
  383. if (ugr.Cells["CraftFilePath"].Value.ToString().Length > 0)
  384. {
  385. ugr.Cells["FilePath"].Value = "已上传";
  386. }
  387. }
  388. }
  389. private void ultraComboEditorOrderNo_KeyPress(object sender, KeyPressEventArgs e)
  390. {
  391. if (e.KeyChar == 13)
  392. {
  393. DoQuery();
  394. }
  395. }
  396. private void DoLink()
  397. {
  398. UltraGridRow ugr = ultraGridOrderHead.ActiveRow;
  399. if (ugr == null)
  400. {
  401. MessageUtil.ShowWarning("请选择合同行");
  402. return;
  403. }
  404. String orderNo = ugr.Cells["OrderNo"].Text.Trim();
  405. //调用系统默认的浏览器
  406. //System.Diagnostics.Process.Start("http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepInterTrade.cpt&__bypagesize__=false" + "&cmbOrder=" + strOrder);
  407. FrmOrderRepExcel fBug = new FrmOrderRepExcel(this.ob, "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepInterTrade.cpt&__bypagesize__=false" + "&cmbOrder=" + orderNo);
  408. fBug.AutoSize = true;
  409. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  410. fBug.WindowState = FormWindowState.Maximized;
  411. fBug.Show();
  412. }
  413. /// <summary>
  414. /// 正式合同打印
  415. /// </summary>
  416. private void PrintOrder()
  417. {
  418. UltraGridRow ugr = ultraGridOrderHead.ActiveRow;
  419. if (ugr == null)
  420. {
  421. MessageUtil.ShowWarning("请选择您要打印的合同!");
  422. return;
  423. }
  424. string ordPk = ugr.Cells["ORDPK"].Value.ToString();
  425. string printPrice = ugr.Cells["PRINTPRICE"].Value.ToString();
  426. //生效以后的状态的合同才能打印
  427. DataTable stsDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.queryOrderHeadStatus", new object[] { ordPk }, ob);
  428. if (stsDt == null && stsDt.Rows.Count == 0)
  429. {
  430. //价格评审通过或放行通过的合同才能打印
  431. MessageUtil.ShowWarning("价格评审通过或放行通过的合同才能打印!");
  432. return;
  433. }
  434. //if (printPrice.Trim() == "结算价")
  435. //{
  436. // DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.queryBlaPriceStatus", new object[] { ordPk }, ob);
  437. // if (dt != null && dt.Rows.Count > 0)
  438. // {
  439. // if (dt.Rows[0][0].ToString() != "0")
  440. // {
  441. // MessageUtil.ShowWarning("您选择合同的结算价尚未全部确认,不能打印!");
  442. // return;
  443. // }
  444. // }
  445. // else
  446. // {
  447. // return;
  448. // }
  449. //}
  450. string saleOrg = ugr.Cells["SaleOrg"].Value.ToString();
  451. string strurl = "";
  452. if (saleOrg == "100101")
  453. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepFormalContractPrint.cpt&op=view" + "&ORD_PK=" + ordPk;
  454. else if (saleOrg == "100103")
  455. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepFormalContractPrintGM.cpt&op=view" + "&ORD_PK=" + ordPk;
  456. if (strurl == "")
  457. {
  458. MessageUtil.ShowWarning("销售组织异常,无法打印!");
  459. return;
  460. }
  461. FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strurl);
  462. fBug.AutoSize = true;
  463. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  464. fBug.WindowState = FormWindowState.Maximized;
  465. fBug.Text = "合同打印";
  466. fBug.Show();
  467. //写入打印时间和打印次数(不管有没有打印 打印是否成功)
  468. ServerHelper.SetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.setPrintTimeAndCount", new object[] { ordPk }, this.ob);
  469. }
  470. /// <summary>
  471. /// 正式合同打印A4
  472. /// </summary>
  473. private void PrintOrderA4()
  474. {
  475. UltraGridRow ugr = ultraGridOrderHead.ActiveRow;
  476. if (ugr == null)
  477. {
  478. MessageUtil.ShowWarning("请选择您要打印的合同!");
  479. return;
  480. }
  481. string ordPk = ugr.Cells["ORDPK"].Value.ToString();
  482. string printPrice = ugr.Cells["PRINTPRICE"].Value.ToString();
  483. //生效以后的状态的合同才能打印
  484. DataTable stsDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.queryOrderHeadStatus", new object[] { ordPk }, ob);
  485. if (stsDt == null && stsDt.Rows.Count == 0)
  486. {
  487. //价格评审通过或放行通过的合同才能打印
  488. MessageUtil.ShowWarning("价格评审通过或放行通过的合同才能打印!");
  489. return;
  490. }
  491. string saleOrg = ugr.Cells["SaleOrg"].Value.ToString();
  492. string strurl = "";
  493. if (saleOrg == "100101")
  494. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepFormalContractPrintA4.cpt&op=view" + "&ORD_PK=" + ordPk;
  495. else if (saleOrg == "100103")
  496. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepFormalContractPrintGMA4.cpt&op=view" + "&ORD_PK=" + ordPk;
  497. if (strurl == "")
  498. {
  499. MessageUtil.ShowWarning("销售组织异常,无法打印!");
  500. return;
  501. }
  502. FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strurl);
  503. fBug.AutoSize = true;
  504. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  505. fBug.WindowState = FormWindowState.Maximized;
  506. fBug.Text = "合同打印";
  507. fBug.Show();
  508. //写入打印时间和打印次数(不管有没有打印 打印是否成功)
  509. ServerHelper.SetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.setPrintTimeAndCount", new object[] { ordPk }, this.ob);
  510. }
  511. /// <summary>
  512. /// 合同背面打印
  513. /// </summary>
  514. private void PrintBackA4()
  515. {
  516. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepFormalContractPrintBackA4.cpt&op=view";
  517. FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strurl);
  518. fBug.AutoSize = true;
  519. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  520. fBug.WindowState = FormWindowState.Maximized;
  521. fBug.Text = "合同背面打印";
  522. fBug.Show();
  523. }
  524. /// <summary>
  525. /// 正式合同打印预览
  526. /// </summary>
  527. private void PrintOrderPreview()
  528. {
  529. UltraGridRow ugr = ultraGridOrderHead.ActiveRow;
  530. if (ugr == null)
  531. {
  532. MessageUtil.ShowWarning("请选择您要打印的合同!");
  533. return;
  534. }
  535. string ordPk = ugr.Cells["ORDPK"].Value.ToString();
  536. string printPrice = ugr.Cells["PRINTPRICE"].Value.ToString();
  537. //打印预览 不需要条件限制
  538. //生效以后的状态的合同才能打印
  539. /*DataTable stsDt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.queryOrderHeadStatus", new object[] { ordPk }, ob);
  540. if (stsDt != null && stsDt.Rows.Count > 0)
  541. {
  542. //价格评审通过以后状态 允许打印
  543. }
  544. else
  545. {
  546. MessageUtil.ShowWarning("价格评审通过以后的合同才能打印!");
  547. return;
  548. }
  549. if (printPrice.Trim() == "结算价")
  550. {
  551. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderColligateInfomation.queryBlaPriceStatus", new object[] { ordPk }, ob);
  552. if (dt != null && dt.Rows.Count > 0)
  553. {
  554. if (dt.Rows[0][0].ToString() != "0")
  555. {
  556. MessageUtil.ShowWarning("您选择合同的结算价尚未全部确认,不能打印!");
  557. return;
  558. }
  559. }
  560. else
  561. {
  562. return;
  563. }
  564. }*/
  565. string saleOrg = ugr.Cells["SaleOrg"].Value.ToString();
  566. string strurl = "";
  567. if (saleOrg == "100101")
  568. {
  569. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepFormalContractPrintPreview.cpt&op=view" + "&ORD_PK=" + ordPk;
  570. // strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilMobileCard.cpt&op=view";
  571. }
  572. else if (saleOrg == "100103")
  573. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepFormalContractPrintPreviewGM.cpt&op=view" + "&ORD_PK=" + ordPk;
  574. if (strurl == "")
  575. {
  576. MessageUtil.ShowWarning("销售组织异常,无法打印!");
  577. return;
  578. }
  579. FrmOrderRepExcel fBug = new FrmOrderRepExcel(ob, strurl);
  580. fBug.AutoSize = true;
  581. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  582. fBug.WindowState = FormWindowState.Maximized;
  583. fBug.Text = "合同打印预览";
  584. fBug.Show();
  585. }
  586. private void radioBal_CheckedChanged(object sender, EventArgs e)
  587. {
  588. this.Cursor = Cursors.WaitCursor;
  589. DoQuery();
  590. this.Cursor = Cursors.Default;
  591. }
  592. private void radioAll_CheckedChanged(object sender, EventArgs e)
  593. {
  594. this.Cursor = Cursors.WaitCursor;
  595. DoQuery();
  596. this.Cursor = Cursors.Default;
  597. }
  598. }
  599. }