DlgSelectRolAndCreditRecord.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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.Collections;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Infragistics.Win;
  13. using SaleBusiness = Core.StlMes.Client.Sale.BLL.SaleBusinessMgt;
  14. namespace Core.StlMes.Client.Sale.UI.Balance.DlgBox
  15. {
  16. public partial class DlgSelectRolAndCreditRecord : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase
  17. {
  18. private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo slmBalanceInfo
  19. = null;
  20. private CoreFS.CA06.OpeBase _ob = null;
  21. private DataSet dsSource = new DataSet();
  22. public DlgSelectRolAndCreditRecord(CoreFS.CA06.OpeBase ob)
  23. {
  24. _ob = ob;
  25. InitializeComponent();
  26. base.ob = ob;
  27. }
  28. private void DlgSelectRolAndCreditRecord_Load(object sender, EventArgs e)
  29. {
  30. this.Text = "选择退货记录";
  31. slmBalanceInfo = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo(_ob);
  32. dsSource = base.GetDataSetByColumnName(this.GetDataStruct(), null, null);
  33. SetDsCaption(ref dsSource);
  34. this.ultraGrid1.DataSource = dsSource;
  35. HiddenColumn();
  36. }
  37. private void HiddenColumn()
  38. {
  39. foreach (string s in new string[] { "ORD_PK", "ORD_LN_PK", "ORD_LN_DLY_PK" })
  40. {
  41. try
  42. {
  43. this.ultraGrid1.DisplayLayout.Bands[0].Columns[s].Hidden = true;
  44. }
  45. catch
  46. { }
  47. }
  48. }
  49. public override void Query()
  50. {
  51. if (this.textBox7.Text.Trim().Length == 0)
  52. {
  53. Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请输入完整提单号");
  54. return;
  55. }
  56. QueryDe(this.textBox7.Text.Trim());
  57. }
  58. private void QueryDe(string askPlanId)
  59. {
  60. string sql = GetSqlByAskPlanId(askPlanId);
  61. DataSet ds = base.ExecuteReader(sql);
  62. Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsSource, ds);
  63. base.SetGridStyle(ref this.ultraGrid1);
  64. }
  65. private void SetDsCaption(ref DataSet ds)
  66. {
  67. foreach (string[] s in GetColumnAndCaption())
  68. {
  69. try
  70. {
  71. ds.Tables[0].Columns[s[0]].Caption = s[1];
  72. }
  73. catch
  74. { }
  75. }
  76. }
  77. public void Update()
  78. {
  79. if (this.ultraGrid1.Rows.Count == 0)
  80. return;
  81. System.Collections.ArrayList list = new ArrayList();
  82. string askPlanid = "";
  83. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Rows)
  84. {
  85. askPlanid = ugr.Cells["BILL_NO"].Value.ToString();
  86. string ordpk = ugr.Cells["ORD_PK"].Value.ToString();
  87. string ORD_LN_PK = ugr.Cells["ORD_LN_PK"].Value.ToString();
  88. string ORD_LN_DLY_PK = ugr.Cells["ORD_LN_DLY_PK"].Value.ToString();
  89. string SEND_NUM = ugr.Cells["SEND_NUM"].Value.ToString();
  90. string ACT_WGT = ugr.Cells["ACT_WGT"].Value.ToString();
  91. string ACT_COUNT = ugr.Cells["ACT_COUNT"].Value.ToString();
  92. string JUDGE_STOVE_NO = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  93. string BATCH_NO = ugr.Cells["BATCH_NO"].Value.ToString();
  94. string BATCH_GROUD_NO = ugr.Cells["BATCH_GROUD_NO"].Value.ToString();
  95. string OUTSTOCK_SQE = ugr.Cells["OUTSTOCK_SQE"].Value.ToString();
  96. list.Add(new string[] {
  97. ordpk ,ORD_LN_PK,ORD_LN_DLY_PK,JUDGE_STOVE_NO,BATCH_NO,BATCH_GROUD_NO,
  98. OUTSTOCK_SQE,
  99. ACT_WGT,SEND_NUM
  100. });
  101. }
  102. string errMsg = "";
  103. slmBalanceInfo.AcceptRollBackAndCreaditRecord(list, askPlanid, out errMsg);
  104. if (errMsg.Length > 0)
  105. {
  106. Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(errMsg);
  107. }
  108. else
  109. {
  110. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  111. this.Close();
  112. }
  113. }
  114. private string[] GetDataStruct()
  115. {
  116. return new string[]
  117. {
  118. "OUTSTOCK_SQE",
  119. "ORDER_NO",
  120. "ORDER_SEQ",
  121. "JUDGE_STOVE_NO",
  122. "BATCH_NO",
  123. "BATCH_GROUD_NO",
  124. "ACT_WGT",
  125. "ACT_COUNT",
  126. "SEND_NUM",
  127. "ORD_PK",
  128. "ORD_LN_PK",
  129. "ORD_LN_DLY_PK",
  130. "BILL_NO"
  131. };
  132. }
  133. private List <string[]> GetColumnAndCaption()
  134. {
  135. List<string[]> list = new List<string[]>();
  136. list.Add(new string[] { "OUTSTOCK_SQE", "材料号" });
  137. list.Add(new string[] { "JUDGE_STOVE_NO", "炉号" });
  138. list.Add(new string[] { "BATCH_NO", "批号" });
  139. list.Add(new string[] { "BATCH_GROUD_NO", "组号" });
  140. list.Add(new string[] { "ACT_COUNT", "支数" });
  141. list.Add(new string[] { "ACT_WGT", "重量" });
  142. list.Add(new string[] { "SEND_NUM", "实发数" });
  143. list.Add(new string[] { "ORDER_NO", "合同号" });
  144. list.Add(new string[] { "ORDER_SEQ", "行号" });
  145. list.Add(new string[] { "BILL_NO", "提单号" });
  146. return list;
  147. }
  148. private string GetSqlByAskPlanId(string askPlanId)
  149. {
  150. string sql = @"select t.judge_stove_no,OUTSTOCK_SQE,
  151. t.batch_no,
  152. t.batch_groud_no,
  153. t.act_count,
  154. CASE
  155. WHEN T.PONDER_GROSS_WT > 0 THEN
  156. -ABS(T.PONDER_GROSS_WT)
  157. ELSE
  158. t.act_weight
  159. END ACT_WGT,
  160. t.ponder_gross_wt,
  161. t.send_num,
  162. t.order_no,
  163. t.order_seq,
  164. t.ord_pk,
  165. t.ord_ln_pk,
  166. t.ord_ln_dly_pk,M_BILL_NO BILL_NO
  167. from ydm_zc_outlist t
  168. where t.outstock_type_code = '800806'
  169. and t.validflag = '1'
  170. {0}
  171. and t.m_bill_no not like 'B%'
  172. AND NOT EXISTS (SELECT 1
  173. FROM SLM_BALANCEDETAIL_ALL A
  174. WHERE A.PRD_ID = T.OUTSTOCK_SQE)";
  175. string sqlCondition = string.Format(" and m_bill_no = '{0}' ", askPlanId);
  176. if (askPlanId.Length == 0)
  177. sqlCondition = " and rownum = 1 ";
  178. sql = string.Format(sql, sqlCondition);
  179. return sql;
  180. }
  181. public override void Affrim()
  182. {
  183. base.Affrim();
  184. }
  185. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  186. {
  187. if (e.Tool.Key == "Query")
  188. {
  189. this.Query();
  190. }
  191. if (e.Tool.Key == "Update")
  192. {
  193. this.Update();
  194. }
  195. if (e.Tool.Key == "Exit")
  196. {
  197. this.Close();
  198. }
  199. }
  200. }
  201. }