freightManage.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.Mes.Client.Comm.Tool;
  13. using CoreFS.CA06;
  14. namespace Core.StlMes.Client.GlBusiness
  15. {
  16. public partial class freightManage : FrmBase
  17. {
  18. public freightManage()
  19. {
  20. InitializeComponent();
  21. }
  22. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  23. {
  24. switch (e.Tool.Key)
  25. {
  26. case "Query":
  27. doQuery();
  28. break;
  29. case "doConfirm":
  30. doConfirm();
  31. break;
  32. case "Close":
  33. this.Close();
  34. break;
  35. }
  36. }
  37. private string setCreateTimeStart(Object value)
  38. {
  39. DateTime time = Convert.ToDateTime(value);
  40. DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 0, 0, 0);
  41. endtime.ToLongTimeString();
  42. return endtime.ToString();
  43. }
  44. private string setCreateTimeEnd(Object value)
  45. {
  46. DateTime time = Convert.ToDateTime(value);
  47. DateTime endtime = new DateTime(time.Year, time.Month, time.Day, 23, 59, 59);
  48. return endtime.ToString();
  49. }
  50. /// <summary>
  51. /// 查询
  52. /// </summary>
  53. public void doQuery()
  54. {
  55. this.dataTable1.Clear();
  56. ArrayList parm = new ArrayList();
  57. parm.Add(txt_orderNo.Text.Trim());
  58. if (QcreateTime_Begin.Value != null)//创建开始时间
  59. {
  60. parm.Add(setCreateTimeStart(QcreateTime_Begin.Value));
  61. }
  62. if (QcreateTime_End.Value != null)//创建结束时间
  63. {
  64. parm.Add(setCreateTimeEnd(QcreateTime_End.Value));
  65. }
  66. DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.SlmGlAccrued.doQueryFreight", new Object[] { parm }, this.ob);
  67. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  68. }
  69. /// <summary>
  70. /// 增加运费
  71. /// </summary>
  72. public void doConfirm()
  73. {
  74. try
  75. {
  76. this.ultraGrid1.UpdateData();
  77. if (ultraGrid1.ActiveRow == null)
  78. {
  79. MessageUtil.ShowTips("请选择需要增加的数据!");
  80. return;
  81. }
  82. if (ultraGrid1.ActiveRow.Cells["COST_TPYE_DESC"].Value.ToString() == "运费")
  83. {
  84. MessageUtil.ShowTips("请选择货款数据新增运费!");
  85. return;
  86. }
  87. if (ultraGrid1.ActiveRow.Cells["BALNCE_TOL_PRICE"].Text == "")
  88. {
  89. MessageUtil.ShowTips("新增数据运费不能为空!");
  90. return;
  91. }
  92. if (MessageUtil.ShowYesNoAndQuestion("是否确定添加?") == DialogResult.No)
  93. {
  94. return;
  95. }
  96. ArrayList all = new ArrayList();
  97. all.Add("BLyyyyMMdd00001");//结算单号
  98. all.Add(ultraGrid1.ActiveRow.Cells["ORDER_NO"].Value.ToString());//客户合同号
  99. if (ultraGrid1.ActiveRow.Cells["TRADE_TYPE"].Value.ToString().Equals("122301"))
  100. {
  101. all.Add("123401");//结算类型编码
  102. all.Add("应收");//结算类型
  103. }
  104. else if (ultraGrid1.ActiveRow.Cells["TRADE_TYPE"].Value.ToString().Equals("122302"))
  105. {
  106. all.Add("123402");//结算类型编码
  107. all.Add("应付");//结算类型
  108. }
  109. all.Add("123302");//费用类型编码
  110. all.Add("运费");//费用类型
  111. all.Add(ultraGrid1.ActiveRow.Cells["CUSTOMER_NO"].Value.ToString());
  112. all.Add(ultraGrid1.ActiveRow.Cells["CUSTOMER_NM"].Value.ToString());
  113. all.Add(ultraGrid1.ActiveRow.Cells["SUPPLY_UNIT"].Value.ToString());
  114. all.Add(ultraGrid1.ActiveRow.Cells["STLMT_UNIT_NO"].Value.ToString());
  115. all.Add(ultraGrid1.ActiveRow.Cells["STLMT_UNIT_NM"].Value.ToString());
  116. all.Add("0");//支付状态
  117. all.Add("1");//数据状态
  118. all.Add(UserInfo.GetUserName());
  119. all.Add(UserInfo.GetDepartment());
  120. all.Add(ultraGrid1.ActiveRow.Cells["BALNCE_TOL_PRICE"].Value.ToString());
  121. all.Add(ultraGrid1.ActiveRow.Cells["CG_ORDER_NO"].Value.ToString());
  122. CoreClientParam ccp = new CoreClientParam();
  123. ccp.ServerName = "com.steering.pss.glbusiness.SlmGlAccrued";
  124. ccp.MethodName = "doAddFreight";
  125. ccp.ServerParams = new object[] { all };
  126. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  127. if (ccp.ReturnCode == -1) return;
  128. MessageBox.Show("增加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  129. this.Close();
  130. }
  131. catch (System.Exception ex)
  132. {
  133. MessageUtil.ShowTips("操作失败:" + ex.Message);
  134. }
  135. }
  136. private void FrmSlmGlPay_Load(object sender, EventArgs e)
  137. {
  138. QcreateTime_Begin.Value = DateTime.Now.AddMonths(-1);
  139. QcreateTime_End.Value = DateTime.Now;
  140. GridHelper.SetColumnsActivateAndColor(ultraGrid1.Rows.Band, "BALNCE_TOL_PRICE");
  141. }
  142. }
  143. }