frmInsidePriceCarry.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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.StlMes.Client.SaleOrder;
  11. using System.Collections;
  12. using Core.Mes.Client.Comm.Control;
  13. using Core.StlMes.Client.SaleComm;
  14. using Infragistics.Win.UltraWinGrid;
  15. using Core.Mes.Client.Comm.Tool;
  16. using Core.Mes.Client.Comm.Server;
  17. using Core.StlMes.Client.SaleOrder.ReviewForm;
  18. using Core.StlMes.Client.SaleOrder.Dialog;
  19. using Core.Mes.Client.Comm;
  20. using Infragistics.Win;
  21. using System.Text.RegularExpressions;
  22. namespace Core.StlMes.Client.SaleOrder
  23. {
  24. public partial class frmInsidePriceCarry : FrmBase
  25. {
  26. public frmInsidePriceCarry()
  27. {
  28. InitializeComponent();
  29. this.IsLoadUserView = true;
  30. }
  31. private void frmInsidePriceCarry_Load(object sender, EventArgs e)
  32. {
  33. DateTime Today = DateTime.Now;
  34. this.date_starte.DateTime = Today.Date.AddMonths(-1);
  35. this.date_end.DateTime = DateTime.Today;
  36. GridHelper.SetColumnsActivateAndColor(efforder_seq.Rows.Band, "CARRY_USE");
  37. }
  38. public override void ToolBar_Click(object sender, string ToolbarKey)
  39. {
  40. switch (ToolbarKey)
  41. {
  42. case "doQuery":
  43. doQuery();
  44. break;
  45. case "doSaveCarry":
  46. doSaveCarry();
  47. break;
  48. case "doClose":
  49. this.Close();
  50. break;
  51. }
  52. }
  53. private void doSaveCarry()
  54. {
  55. if (gffect_oder.ActiveRow == null)
  56. return;
  57. try
  58. {
  59. efforder_seq.UpdateData();
  60. }
  61. catch { }
  62. string ordPk = gffect_oder.ActiveRow.Cells["ORD_PK"].Value.ToString();
  63. ArrayList parm = new ArrayList();
  64. foreach (UltraGridRow row in efforder_seq.Rows)
  65. {
  66. double wgt = 0;
  67. if (!double.TryParse(row.Cells["CARRY_USE"].Value.ToString(), out wgt))
  68. {
  69. MessageUtil.ShowTips("结转重量填写错误或未填写");
  70. return;
  71. }
  72. if (wgt == 0)
  73. {
  74. MessageUtil.ShowTips("结转重量不能为0");
  75. return;
  76. }
  77. ArrayList list = new ArrayList();
  78. list.Add(row.Cells["BALNCE_PRICE_ORG"].Value.ToString());
  79. list.Add(row.Cells["CARRY_USE"].Value.ToString());
  80. list.Add(row.Cells["CARRY_MONEY"].Value.ToString());
  81. list.Add(row.Cells["ORD_LN_PK"].Value.ToString());
  82. parm.Add(list);
  83. }
  84. CoreClientParam ccp = new CoreClientParam();
  85. ccp.ServerName = "com.steering.pss.sale.order.frmOrderEffect";
  86. ccp.MethodName = "saveCarryOrgInfo";
  87. ccp.ServerParams = new object[] { parm ,UserInfo.GetUserName()};
  88. ccp.IfShowErrMsg = false;
  89. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  90. if (ccp != null)
  91. {
  92. if (ccp.ReturnCode == -1)
  93. {
  94. MessageUtil.ShowWarning(ccp.ReturnInfo);
  95. return;
  96. }
  97. MessageUtil.ShowTips("结转成功!");
  98. doQuery();
  99. foreach (UltraGridRow row in gffect_oder.Rows)
  100. {
  101. if (ordPk.Equals(row.Cells["ORD_PK"].Value.ToString()))
  102. {
  103. row.Activate();
  104. break;
  105. }
  106. }
  107. }
  108. }
  109. public void doQuery()
  110. {
  111. //签约时间
  112. string date = "";
  113. String orderStart = "";
  114. String orderEnd = "";
  115. if (che_date.Checked)
  116. {
  117. orderStart = Convert.ToDateTime(date_starte.Value).ToString("yyyy-MM-dd") + " 00:00:01";
  118. orderEnd = Convert.ToDateTime(date_end.Value).ToString("yyyy-MM-dd") + " 23:59:59";
  119. }
  120. else
  121. {
  122. orderStart = "1000-01-01 00:00:01";
  123. orderEnd = "9999-12-31 23:59:59";
  124. }
  125. //合同号
  126. string order = "";
  127. if (ord_no.Checked)
  128. order = orde_cho.Text.Trim();
  129. DataTable dt = Globals.GetData("com.steering.pss.sale.order.frmOrderEffect.CoreOrderCarryPriceQuery", new Object[] { order, orderStart, orderEnd }, this.ob);
  130. gffect_oder.DataSource = dt;
  131. //列自适应
  132. GridHelper.RefreshAndAutoSizeExceptColumns(gffect_oder, new UltraGridColumn[] { });
  133. }
  134. private void che_date_CheckedChanged(object sender, EventArgs e)
  135. {
  136. date_starte.Enabled = che_date.Checked;
  137. date_end.Enabled = che_date.Checked;
  138. }
  139. private void ord_no_CheckedChanged(object sender, EventArgs e)
  140. {
  141. orde_cho.Enabled = ord_no.Checked;
  142. }
  143. private void gffect_oder_AfterRowActivate(object sender, EventArgs e)
  144. {
  145. UltraGridRow ugr = gffect_oder.ActiveRow;
  146. if (ugr == null)
  147. return;
  148. this.doQueryeffect(gffect_oder.ActiveRow.Cells["ORD_PK"].Text);
  149. this.doQueryeffect_mol(gffect_oder.ActiveRow.Cells["ORDER_MODEL_NO"].Value.ToString());
  150. this.queryPriceInfo(gffect_oder.ActiveRow.Cells["ORD_PK"].Text);
  151. }
  152. private void queryPriceInfo(string ordPk)
  153. {
  154. DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.frmOrderEffect.queryPriceInfo", new object[] { ordPk }, this.ob);
  155. if (dt != null && dt.Rows.Count > 0)
  156. {
  157. txtPrice.Text = dt.Rows[0][0].ToString();
  158. }
  159. }
  160. private void doQueryeffect_mol(string ordermodel)
  161. {
  162. DataTable dt = Globals.GetData("com.steering.pss.sale.order.frmOrderEffect.CoreOrderEffectinfo", new Object[] { ordermodel }, this.ob);
  163. efforder_mol.DataSource = dt;
  164. //列自适应
  165. GridHelper.RefreshAndAutoSizeExceptColumns(efforder_mol, new UltraGridColumn[] {
  166. });
  167. }
  168. private void doQueryeffect(string order)
  169. {
  170. DataTable dt = Globals.GetData("com.steering.pss.sale.order.frmOrderEffect.CoreOrderCarrySqeQuery", new Object[] { order }, this.ob);
  171. GridHelper.CopyDataToDatatable(ref dt, ref this.orderLineDt, true);
  172. foreach (DataRow dr in orderLineDt.Rows)
  173. {
  174. double actWt = 0;
  175. double carryWt = 0;
  176. if (!double.TryParse(dr["ACT_WT"].ToString(), out actWt))
  177. return;
  178. if (!double.TryParse(dr["CARRY_WT"].ToString(), out carryWt))
  179. return;
  180. dr["CARRY_USE"] = Math.Round(actWt - carryWt, 4);
  181. }
  182. //列自适应
  183. GridHelper.RefreshAndAutoSizeExceptColumns(efforder_seq, new UltraGridColumn[] { });
  184. }
  185. private void gffect_oder_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  186. {
  187. string acustom = gffect_oder.ActiveCell.Value.ToString();
  188. dlgBuyerInfo spt = new dlgBuyerInfo();
  189. spt.oPbd = this.ob;
  190. spt.customer = acustom;
  191. spt.FilePath = "checker";
  192. spt.ShowDialog();
  193. }
  194. private void efforder_seq_AfterRowActivate(object sender, EventArgs e)
  195. {
  196. if (efforder_seq.ActiveRow != null)
  197. {
  198. DataTable dt = Globals.GetData("com.steering.pss.sale.order.frmOrderEffect.CoreOrderCarryOrgInfo", new Object[] { efforder_seq.ActiveRow.Cells["ORD_LN_PK"].Value.ToString() }, this.ob);
  199. GridHelper.CopyDataToDatatable(ref dt, ref this.carryOrg, true);
  200. //列自适应
  201. GridHelper.RefreshAndAutoSizeExceptColumns(carry_price, new UltraGridColumn[] { });
  202. }
  203. }
  204. private void orde_cho_KeyPress(object sender, KeyPressEventArgs e)
  205. {
  206. if (e.KeyChar == 13)
  207. doQuery();
  208. }
  209. private void efforder_seq_CellDataError(object sender, CellDataErrorEventArgs e)
  210. {
  211. e.RaiseErrorEvent = false; // 阻止弹出错误提示窗口
  212. e.RestoreOriginalValue = true; // 恢复原始值
  213. e.StayInEditMode = true; // 继续保留在编辑模式
  214. }
  215. }
  216. }