| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Collections;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using Infragistics.Win;
- using SaleBusiness = Core.StlMes.Client.Sale.BLL.SaleBusinessMgt;
- namespace Core.StlMes.Client.Sale.UI.Balance.DlgBox
- {
- public partial class DlgSelectRolAndCreditRecord : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase
- {
- private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo slmBalanceInfo
- = null;
- private CoreFS.CA06.OpeBase _ob = null;
- private DataSet dsSource = new DataSet();
- public DlgSelectRolAndCreditRecord(CoreFS.CA06.OpeBase ob)
- {
- _ob = ob;
- InitializeComponent();
- base.ob = ob;
- }
- private void DlgSelectRolAndCreditRecord_Load(object sender, EventArgs e)
- {
- this.Text = "选择退货记录";
- slmBalanceInfo = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo(_ob);
- dsSource = base.GetDataSetByColumnName(this.GetDataStruct(), null, null);
- SetDsCaption(ref dsSource);
- this.ultraGrid1.DataSource = dsSource;
- HiddenColumn();
-
- }
- private void HiddenColumn()
- {
- foreach (string s in new string[] { "ORD_PK", "ORD_LN_PK", "ORD_LN_DLY_PK" })
- {
- try
- {
- this.ultraGrid1.DisplayLayout.Bands[0].Columns[s].Hidden = true;
- }
- catch
- { }
-
- }
- }
- public override void Query()
- {
- if (this.textBox7.Text.Trim().Length == 0)
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请输入完整提单号");
- return;
- }
- QueryDe(this.textBox7.Text.Trim());
-
- }
- private void QueryDe(string askPlanId)
- {
-
- string sql = GetSqlByAskPlanId(askPlanId);
- DataSet ds = base.ExecuteReader(sql);
- Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsSource, ds);
- base.SetGridStyle(ref this.ultraGrid1);
- }
- private void SetDsCaption(ref DataSet ds)
- {
- foreach (string[] s in GetColumnAndCaption())
- {
- try
- {
- ds.Tables[0].Columns[s[0]].Caption = s[1];
- }
- catch
- { }
-
- }
-
- }
- public void Update()
- {
- if (this.ultraGrid1.Rows.Count == 0)
- return;
- System.Collections.ArrayList list = new ArrayList();
- string askPlanid = "";
-
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- askPlanid = ugr.Cells["BILL_NO"].Value.ToString();
- string ordpk = ugr.Cells["ORD_PK"].Value.ToString();
- string ORD_LN_PK = ugr.Cells["ORD_LN_PK"].Value.ToString();
- string ORD_LN_DLY_PK = ugr.Cells["ORD_LN_DLY_PK"].Value.ToString();
- string SEND_NUM = ugr.Cells["SEND_NUM"].Value.ToString();
- string ACT_WGT = ugr.Cells["ACT_WGT"].Value.ToString();
- string ACT_COUNT = ugr.Cells["ACT_COUNT"].Value.ToString();
- string JUDGE_STOVE_NO = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string BATCH_NO = ugr.Cells["BATCH_NO"].Value.ToString();
- string BATCH_GROUD_NO = ugr.Cells["BATCH_GROUD_NO"].Value.ToString();
- string OUTSTOCK_SQE = ugr.Cells["OUTSTOCK_SQE"].Value.ToString();
- list.Add(new string[] {
- ordpk ,ORD_LN_PK,ORD_LN_DLY_PK,JUDGE_STOVE_NO,BATCH_NO,BATCH_GROUD_NO,
- OUTSTOCK_SQE,
- ACT_WGT,SEND_NUM
- });
- }
- string errMsg = "";
- slmBalanceInfo.AcceptRollBackAndCreaditRecord(list, askPlanid, out errMsg);
- if (errMsg.Length > 0)
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(errMsg);
- }
- else
- {
- Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
- this.Close();
-
- }
- }
- private string[] GetDataStruct()
- {
- return new string[]
- {
- "OUTSTOCK_SQE",
- "ORDER_NO",
- "ORDER_SEQ",
- "JUDGE_STOVE_NO",
- "BATCH_NO",
- "BATCH_GROUD_NO",
- "ACT_WGT",
- "ACT_COUNT",
- "SEND_NUM",
- "ORD_PK",
- "ORD_LN_PK",
- "ORD_LN_DLY_PK",
- "BILL_NO"
- };
- }
- private List <string[]> GetColumnAndCaption()
- {
- List<string[]> list = new List<string[]>();
- list.Add(new string[] { "OUTSTOCK_SQE", "材料号" });
- list.Add(new string[] { "JUDGE_STOVE_NO", "炉号" });
- list.Add(new string[] { "BATCH_NO", "批号" });
- list.Add(new string[] { "BATCH_GROUD_NO", "组号" });
- list.Add(new string[] { "ACT_COUNT", "支数" });
- list.Add(new string[] { "ACT_WGT", "重量" });
- list.Add(new string[] { "SEND_NUM", "实发数" });
- list.Add(new string[] { "ORDER_NO", "合同号" });
- list.Add(new string[] { "ORDER_SEQ", "行号" });
- list.Add(new string[] { "BILL_NO", "提单号" });
- return list;
- }
- private string GetSqlByAskPlanId(string askPlanId)
- {
- string sql = @"select t.judge_stove_no,OUTSTOCK_SQE,
- t.batch_no,
- t.batch_groud_no,
- t.act_count,
- CASE
- WHEN T.PONDER_GROSS_WT > 0 THEN
- -ABS(T.PONDER_GROSS_WT)
- ELSE
- t.act_weight
- END ACT_WGT,
- t.ponder_gross_wt,
- t.send_num,
- t.order_no,
- t.order_seq,
- t.ord_pk,
- t.ord_ln_pk,
- t.ord_ln_dly_pk,M_BILL_NO BILL_NO
- from ydm_zc_outlist t
- where t.outstock_type_code = '800806'
- and t.validflag = '1'
- {0}
- and t.m_bill_no not like 'B%'
- AND NOT EXISTS (SELECT 1
- FROM SLM_BALANCEDETAIL_ALL A
- WHERE A.PRD_ID = T.OUTSTOCK_SQE)";
- string sqlCondition = string.Format(" and m_bill_no = '{0}' ", askPlanId);
- if (askPlanId.Length == 0)
- sqlCondition = " and rownum = 1 ";
- sql = string.Format(sql, sqlCondition);
- return sql;
- }
- public override void Affrim()
- {
- base.Affrim();
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- if (e.Tool.Key == "Query")
- {
- this.Query();
- }
- if (e.Tool.Key == "Update")
- {
- this.Update();
- }
- if (e.Tool.Key == "Exit")
- {
- this.Close();
- }
- }
- }
- }
|