using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Threading; using System.Collections; using System.Reflection; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; namespace Core.StlMes.Client.Sale.UI.Balance.BalanceAccount { public partial class FrmBalanceTicketMgt : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase { public FrmBalanceTicketMgt() { InitializeComponent(); } private String cusInfo = ""; private String suppunit = ""; private string _key = "2"; private void SetKey() { if (this.CustomInfo.Length > 0) { this._key = this.CustomInfo.Trim().Split('_')[0]; } } //待结算单据管理(结算价维护) 1 //待结算单据管理(结算编单) 2 private void HiddenToolbars() { try { foreach ( Infragistics.Win.UltraWinToolbars.ToolBase tb in toolMenu.Toolbars[0].Tools) { if (tb.Key == "QueryUnAcept" || tb.Key == "Accept" || tb.Key == "Exit" || tb.Key == "Export") { continue; } else tb.SharedProps.Visible = false; } } catch { } try { this.ultraExpandableGroupBox1.Visible = false; this.toolMenu.Toolbars[0].Tools["UpdatePrice"].SharedProps.Visible = false; this.toolMenu.Toolbars[0].Tools["RollBack"].SharedProps.Visible = false; this.toolMenu.Toolbars[0].Tools["SavePrice"].SharedProps.Visible = false; } catch { } if (this._key == "1") { try { this.label4.Visible = false; this.textBox2.Visible = false; this.ultraExpandableGroupBox2.Visible = false; this.toolMenu.Toolbars[0].Tools["UpdatePrice"].SharedProps.Visible = false; this.toolMenu.Toolbars[0].Tools["RollBack"].SharedProps.Visible = false; this.toolMenu.Toolbars[0].Tools["Invoice"].SharedProps.Visible = false; this.toolMenu.Toolbars[0].Tools["UnAffrim"].SharedProps.Visible = false; this.toolMenu.Toolbars[0].Tools["Affrim"].SharedProps.Visible = false; } catch { } } } private string LISTNUMBER = "LISTNUMBER"; private void AcceptTicket() { Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid5.Rows.Count == 0) return; ugr = this.ultraGrid5.ActiveRow; if (ugr == null) ugr = this.ultraGrid5.Rows[0]; ugr.Selected = true; ArrayList listask = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugs in this.ultraGrid5.Selected.Rows) { listask.Add(ugs.Cells[LISTNUMBER].Value.ToString()); } // string askPlanId = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID].Value.ToString(); if (Util.MessageUtil.ShowYesNoAndQuestion("是否接收选定行?") == DialogResult.No) return; string errMsg = ""; this.slmBalanceInfo.AffrimAcceptTicket(listask, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg); if (errMsg.Length == 0) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); this.QueryUnAcceptTicket(); } } private void UnAcceptTicket() { Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid1.Rows.Count == 0) return; ugr = this.ultraGrid1.ActiveRow; if (ugr == null) ugr = this.ultraGrid1.Rows[0]; if (ugr == null) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要取消的行"); return; } // string askPlanId = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID].Value.ToString(); if (Util.MessageUtil.ShowYesNoAndQuestion("是否取消接收选定行?") == DialogResult.No) return; string errMsg = ""; this.slmBalanceInfo.UnAffrimAcceptTicket(ugr.Cells[this.LISTNUMBER].Value.ToString(), CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg); if (errMsg.Length == 0) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); try { string listnum = ugr.Cells[this.LISTNUMBER].Value.ToString(); ArrayList list = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugs in this.ultraGrid1.Rows) { if (ugs.Cells[this.LISTNUMBER].Value.ToString() == listnum) { list.Add(ugs); } } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugg in list) { ugg.Delete(); } } catch { } } } private Infragistics.Win.ValueList GetAgenCyFlList() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("0", "否"); lit.ValueListItems.Add("1", "是"); return lit; } private Infragistics.Win.ValueList GetStatusList() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("0", "未确认"); lit.ValueListItems.Add("1", "确认"); lit.ValueListItems.Add("2", "编单"); return lit; } private Infragistics.Win.ValueList GetPriceStatusList() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("0", " 无效"); lit.ValueListItems.Add("1", " 有效"); return lit; } private Infragistics.Win.ValueList GetBalStatusList() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("0", "未确认"); // lit.ValueListItems.Add("1", "确认"); lit.ValueListItems.Add("2", "确认"); lit.ValueListItems.Add("3", "编单"); return lit; } private Infragistics.Win.ValueList GetFst_Drawee_unit() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("120601", "N/A"); lit.ValueListItems.Add("120602", "/"); lit.ValueListItems.Add("120603", "天津钢管集团股份有限公司"); lit.ValueListItems.Add("120604", "天津钢管钢铁贸易有限公司"); lit.ValueListItems.Add("120605", "天津钢管国际经济贸易有限公司"); lit.ValueListItems.Add("120606", "合同结算单位"); lit.ValueListItems.Add("120607", "江苏天淮钢管有限公司"); lit.ValueListItems.Add("120608", "天津钢管制造有限公司"); return lit; } private string[] GetGridFourDataStruct() { return new string[] { "ASKPLAN_ID", "TALLYSHEET_NO", "BATCH_NO", "QUANTITY", "ACT_WGT" , "OUTSTOCKMNY", "MONEY_TYPE", "AGENCY_FL", "DELVRY_ADDR", "RECEIV_ADDR" }; } protected override List GetNumberColumn() { return new List(new string[] { "SEND_NUM", "MONEY", "WEIGHT", "QUANTITY", "ACT_WGT", "OUTSTOCKMNY", "TRANSMNY", "PRICE", "PRICE_ORG", "MONEY_ORG", }); } private DataSet dsBalanceMain = new DataSet (); private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo slmBalanceInfo = null; DataSet dsGridThree = new DataSet(); DataSet dsGridFour = new DataSet(); DataSet dsGridUnAccept = new DataSet(); private void FrmBalanceTicketMgt_Load(object sender, EventArgs e) { this.ultraExpandableGroupBox1.Visible = false; this.ultraExpandableGroupBox2.Visible = true; this.dateTimePicker1.Value = System.DateTime.Now.AddMonths(-1); SetKey(); this.Init(); this.dsBalanceMain = base.GetDataSetByColumnName(this.GetGrid1DataStruct(), null, GetColumnAndCaption()); this.ultraGrid1.DataSource = dsBalanceMain; this.dsGridThree = base.GetDataSetByColumnName(this.GetGridThreeDataStruct(), StaticData.TbColumnAndCaption.GetDataSetColumnType(), StaticData.TbColumnAndCaption.GetColumnAndCaption()); this.ultraGrid3.DataSource = dsGridThree; dsGridFour = base.GetDataSetByColumnName(this.GetGridFourDataStruct(), StaticData.TbColumnAndCaption.GetDataSetColumnType(), StaticData.TbColumnAndCaption.GetColumnAndCaption()); // this.ultraGrid4.DataSource = dsGridFour; slmBalanceInfo = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo(this.ob); this.dsGridFine = base.GetDataSetByColumnName(this.GetGridFiveDataStruct(), StaticData.TbColumnAndCaption.GetDataSetColumnType(), StaticData.TbColumnAndCaption.GetColumnAndCaption()); // this.ultraGrid2.DataSource = dsGridFine; this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true; dsGridUnAccept = base.GetDataSetByColumnName(GetUnAcceptBalaceColumn(), null, GetColumnAndCaption()); this.ultraGrid5.DataSource = dsGridUnAccept; HiddenColumn(); InitGrid(); base.SetGridStyle(ref this.ultraGrid1, ref this.ultraGrid3,ref this.ultraGrid5); cusInfo = CustomInfo.Split('_')[0]; if (CustomInfo.Split('_').Length > 1) suppunit = CustomInfo.Split('_')[1]; SetGridShowLength(); if (this.cusInfo == "2") { this.ultraTabControl1.Tabs[0].Visible = true; } else { if (base.GetSaleOrgDesc() == "国贸公司" || suppunit == "120504") this.ultraTabControl1.Tabs[0].Visible = true; else { this.ultraTabControl1.Tabs[0].Visible = false; } } this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.ASKPLAN_ID].MergedCellStyle = Infragistics.Win.UltraWinGrid.MergedCellStyle.Always; this.ultraGrid1.DisplayLayout.Bands[0].Columns["LISTNUMBER"].MergedCellStyle = Infragistics.Win.UltraWinGrid.MergedCellStyle.Always; } private void InitGrid() { try { // this.ultraGrid4.DisplayLayout.Bands[0].Columns["AGENCY_FL"].ValueList = GetAgenCyFlList(); } catch { } try { this.ultraGrid1.DisplayLayout.Bands[0].Columns["CONTAIN_TAX"].ValueList = GetAgenCyFlList(); } catch { } try { this.ultraGrid1.DisplayLayout.Bands[0].Columns["TICKETSTATUS"].ValueList = GetAgenCyFlList(); } catch { } try { this.ultraGrid1.DisplayLayout.Bands[0].Columns["BALANCESTATUS_ORG"].ValueList = GetBalStatusList(); } catch { } try { // this.ultraGrid2.DisplayLayout.Bands[0].Columns["STATUS_CD"].ValueList = GetStatusList(); } catch { } try { this.ultraGrid1.DisplayLayout.Bands[0].Columns["FST_DRAWEE_UNIT"].ValueList = GetFst_Drawee_unit(); } catch { } try { this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_STS].ValueList = GetPriceStatusList(); } catch { } try { this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_ORG_STS].ValueList = GetPriceStatusList(); } catch { } } private void HiddenColumn() { try { this.ultraGrid1.DisplayLayout.Bands[0].Columns["BALANCESTATUS"].Hidden = true; // this.ultraGrid1.DisplayLayout.Bands[0].Columns["BALANCESTATUS_ORG"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.ADJUSTPRICEREASON].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ADJUSTPRICEREASON"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns[BUYERCODE].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ADJUSTPRICEPERSON"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_PK"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_LN_PK"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORD_LN_DLY_PK"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["CUSTOMER_NO"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["SALE_AREA_NO"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["STD_STYLE"].Hidden = true; } catch { } } private DataSet dsGridFine = new DataSet(); private Hashtable hstransFee = new Hashtable(); private void QueryGridFour() { this.dsGridFour.Clear(); Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid1.Rows.Count == 0) return; ugr = this.ultraGrid1.ActiveRow; if (ugr == null) ugr = this.ultraGrid1.Rows[0]; string orderno = ugr.Cells[StaticData.TbColumnAndCaption.ORD_NO].Value.ToString(); string orderseq = ugr.Cells[StaticData.TbColumnAndCaption.ORD_SEQ].Value.ToString(); string orderlineseq = ugr.Cells[StaticData.TbColumnAndCaption.ORD_LN_DLY].Value.ToString(); string askplanid = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID].Value.ToString(); string askplanidseq = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID_SEQ].Value.ToString(); string spetkey = ugr.Cells[StaticData.TbColumnAndCaption.SPETKEY].Value.ToString(); string steelkey = ugr.Cells[StaticData.TbColumnAndCaption.STEELCODEKEY].Value.ToString(); DataSet dsDetail = this.slmBalanceInfo.GetSlmBalanceDetailAllGroupByBatchNo( orderno, orderseq, orderlineseq, askplanid, askplanidseq, spetkey, steelkey); Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsGridFour, dsDetail); } private void QueryGridFive() { this.dsGridFine.Clear(); Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid1.Rows.Count == 0) return; ugr = this.ultraGrid1.ActiveRow; if (ugr == null) ugr = this.ultraGrid1.Rows[0]; string askPlanId = ugr.Cells[StaticData.TbColumnAndCaption.ASKPLAN_ID].Value.ToString(); DataSet ds = null; ds = this.slmBalanceInfo.GetSlmBalanceTransMoneyAskPlanid(askPlanId); ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "MONEY_TYPE", "运费"); Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsGridFine, ds); } private void Init() { try { this.radioButton1.Checked = true; } catch { } } private Hashtable GetHashTableByImpExcel() { Hashtable hs = new Hashtable(); string fileName = Util.UtilExcel.GetExcelFileName(); if (fileName.Length == 0) return hs; DataSet ds = Util.UtilExcel.ToDataSet(fileName); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) return hs; string key = ""; foreach (DataRow dr in ds.Tables[0].Rows) { key = dr[0].ToString() + dr[1].ToString() + dr[2].ToString(); if (!hs.ContainsKey(key)) { hs.Add(key,dr[3].ToString()); } } return hs; } private string GetSqlStr(string price,string person,string condition) { String sqlStr = @" update SLM_BALANCEINFO set PRICE_ORG = nvl({1},0), MONEY_ORG = round(nvl({1},0) * weight ,5), PRICE_INPUTPERSON_ORG = '{2}' ,PRICE_INPUTPEDATE_ORG = sysdate,PRICE_PRE_ORG = {1} where ORD_NO||ORD_SEQ||ORD_LN_DLY||ASKPLAN_ID||ASKPLAN_ID_SEQ||spetKey||steelCodeKey = '{0}' and forecorpcode = '国贸公司' and balancestatus_org = '0' "; sqlStr = string.Format(sqlStr, condition, price, person); return sqlStr; } private void BatchUPdateBalancePrice() { if (this.ultraGrid1.Selected.Rows.Count == 0) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要保存价格的行"); return; } if (this.radioButton2.Checked) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("只允许保存未接收数据价格"); return; } Hashtable hsOrderPrice = GetHashTableByImpExcel(); if (hsOrderPrice.Count == 0) return; ArrayList sqllist = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows) { string sql = ""; string key = ugr.Cells["CATEGORY"].Value.ToString().Trim() + ugr.Cells["STEELCODEKEY"].Value.ToString().Trim() + ugr.Cells["MODEL_DESC"].Value.ToString().Trim(); string orderno = ugr.Cells[this.ORD_NO].Value.ToString(); string ord_seq = ugr.Cells[this.ORD_SEQ].Value.ToString(); string ord_ln = ugr.Cells[this.ORD_LN_DLY].Value.ToString(); string askplanId = ugr.Cells[this.ASKPLAN_ID].Value.ToString(); string askPlanIdSeq = ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString(); string spetKey = ugr.Cells[this.SPETKEY].Value.ToString(); string steelcodekey = ugr.Cells[this.STEELCODEKEY].Value.ToString(); string person = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(); string price = "0"; if (hsOrderPrice.ContainsKey(key)) { price = hsOrderPrice[key].ToString(); if (Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(price) == 0) continue; } if (price == "0") continue; sql = GetSqlStr(price, person, orderno + ord_seq + ord_ln + askplanId + askPlanIdSeq + spetKey + steelcodekey); sqllist.Add(sql); } if (sqllist.Count > 0) { base.ExecuteNoReader(sqllist); this.QueryOrg(); } } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": { this.Query(); break; } case "QueryUnAcept": { this.QueryUnAcceptTicket(); break; } case "QueryOrg": { this.QueryOrg(); break; } case "Affrim": { this.Affrim(); break; } case "AffrimOrg": { this.AffrimOrg(); break; } case "UnAffrim": { this.UnAffrim(); break; } case "UnAffrimOrg": { this.UnAffrimOrg(); break; } case "Exit": { this.Close(); break; } case "Invoice": { InvoiceWithTranMny(); // this.Invoice(); break; } case "InvoiceOrg": { this.InvoiceOrg(); // this.Invoice(); break; } case "InvoiceGuoMao": { this.InvoiceGuom(); // this.Invoice(); break; } case "InvoiceWithTranMny": { InvoiceWithTranMny(); break; } case "UpdatePrice": { this.UpdatePrice(); break; } case "SavePrice": { this.InputPrice(); break; } case "RollBack": { this.RollBackAskPlanId(); break; } case "Export": { Util.UtilUltraGrid.ExportGridDataToExcel(this.Text, this.ultraGrid1); break; } case "SetPrice": { SetBalPrice(); break; } case "SetPriceOrg": { SetBalPriceOrg(); break; } case "ExportPrice": { BatchUPdateBalancePrice(); break; } case "Accept": { AcceptTicket(); break; } case "UnAccept": { UnAcceptTicket(); break; } case "AcpRllRecord": { AccetpRollCreditRecord(); break; } } } private void AccetpRollCreditRecord() { try { DlgBox.DlgCredit dlgCredit = new Core.StlMes.Client.Sale.UI.Balance.DlgBox.DlgCredit(this.ob); if (this.cusInfo == "3") dlgCredit.SetFlag("2"); dlgCredit.ShowDialog(); } catch { } } private void SetBalPriceOrg() { ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; //foreach (string[] s in listOrder) //{ // this.slmBalanceInfo.SetBalPriceOrg(new ArrayList() { s }, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); //} this.slmBalanceInfo.SetBalPriceOrg(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); this.QueryOrg(); } /// /// 重新获取结算明细价格,防止因维护不及时无法获取正确价格 /// private void SetBalPrice() { ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; //foreach (string[] s in listOrder) //{ // this.slmBalanceInfo.SetBalPrice(new ArrayList() { s}, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); //} this.slmBalanceInfo.SetBalPrice(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); this.Query(); } private void InvoiceWithTranMny() { if (!IsCanBeInvoiced()) return; ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定编制结算单?") == DialogResult.No) return; string errMsg = ""; this.slmBalanceInfo.InvoiceLightly(listOrder, "", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg); if (errMsg.Length > 0) { } else { removeUgr(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } // this.Query(); } private void InvoiceOrg() { if (!this.IsCanBeInvoicedOrg()) return; ArrayList listOrder = GetUpdateConditionSaleOrg(); if (listOrder.Count == 0) return; if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定编制结算单?") == DialogResult.No) return; string errMsg = ""; this.slmBalanceInfo.InvoiceLightlyOrg(listOrder, "", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg); // this.QueryOrg(); if (errMsg.Length > 0) { } else { removeUgr(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } } private void InvoiceGuom() { if (!this.IsCanBeInvoiced()) return; ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定编制结算单?") == DialogResult.No) return; string errMsg = ""; // this.slmBalanceInfo.Invoice(listOrder,"", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); this.slmBalanceInfo.InvoiceLightlyGuoM(listOrder, "", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(),out errMsg); // this.QueryOrg(); if (errMsg.Length > 0) { } else { removeUgr(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } } private DataSet GetSlmOrderLine(List odpkList) { DataSet ds = new DataSet(); if (odpkList.Count == 0) { return ds; } string sqlCondition = Core.StlMes.Client.Sale.Util.ConverObject .ConvertListStringValueToSqlCondition("ORD_PK", odpkList); string sql = @"select nvl(A.BALNCE_PRICE_STS, '0') BALNCE_PRICE_STS, nvl(A.BALNCE_PRICE_ORG_STS, '0') BALNCE_PRICE_ORG_STS, a.ord_pk, a.ord_ln_pk from slm_order_line a where 1=1 and validflag = '1' {0}"; sql = string.Format(sql,sqlCondition); ds = base.ExecuteReader(sql); return ds; } private Hashtable GetOrderBalSts(List odpkList) { Hashtable hs = new Hashtable(); DataSet ds = GetSlmOrderLine(odpkList); try { string ordandlinePk = ""; foreach (DataRow dr in ds.Tables[0].Rows) { ordandlinePk = dr["ORD_PK"].ToString() + dr["ORD_LN_PK"].ToString(); if (!hs.ContainsKey(ordandlinePk)) { hs.Add(ordandlinePk, new string[] { dr["BALNCE_PRICE_STS"].ToString(), dr["BALNCE_PRICE_ORG_STS"].ToString() }); } } } catch { } return hs; } private void QueryUnAcceptTicket() { DataSet ds = null; ds = this.slmBalanceInfo.GetUnAcceptTicketAndTransAndOutStockTicket(this.dateTimePicker1.Value, this.dateTimePicker2.Value,cusInfo, suppunit); if (this.textBox7.Text.Length > 0) { ds = Core.StlMes.Client.Sale.Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch (ds, ASKPLAN_ID, this.textBox7.Text.Trim()); } if (!this.UserInfo.GetUserName().Equals("admin")) ds = base.GetDataSetByFilterDeptId(ds); //if ("120504".Equals(suppunit)) // ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "supply_unit", suppunit); Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsGridUnAccept, ds); Core.StlMes.Client.Sale.Util.UtilDataSet.GetDsByDescOrderFromSourceDataSet(dsGridUnAccept, "LISTNUMBER"); } private void Query() { DataSet ds = null; DataSet dsTrans = null; // 只有编单界面才查 if (this.radioButton1.Checked) // 已编卡 { ds = this.slmBalanceInfo.GetUnAffrimSlmBalaneInfoByPlanBeginDateAndEndDate(this.dateTimePicker1.Value, this.dateTimePicker2.Value, suppunit); dsTrans = this.slmBalanceInfo.GetAcceptAndUnAffrimTransAndOutStockTicket(suppunit); } if (this.radioButton2.Checked)// 未编卡 { ds = this.slmBalanceInfo.GetAffrimSlmBalaneInfoByPlanBeginDateAndEndDate(this.dateTimePicker1.Value, this.dateTimePicker2.Value, suppunit); dsTrans = this.slmBalanceInfo.GetAcceptAndAffrimTransAndOutStockTicket(suppunit); } if (this.textBox7.Text.Trim().Length > 0) { ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this.ASKPLAN_ID, this.textBox7.Text.Trim()); dsTrans = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(dsTrans, this.ASKPLAN_ID, this.textBox7.Text.Trim()); } if (this.textBox1.Text.Trim().Length > 0) { ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this.ORD_NO, this.textBox1.Text.Trim()); } if (!this.UserInfo.GetUserName().Equals("admin")) ds = base.GetDataSetByFilterDeptId(ds); dsTrans = base.GetDataSetByFilterDeptId(dsTrans); //if ("120504".Equals(suppunit)) // ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "supply_unit", suppunit); //if ("120504".Equals(suppunit)) // dsTrans = Util.UtilDataSet.GetDataSetWithRowFilter(dsTrans, "supply_unit", suppunit); this.dsBalanceMain.Clear(); Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsBalanceMain,ds); SetTicketMoneyType(ref this.dsBalanceMain); SetOrd(); try { dsTrans.Tables[0].TableName = this.dsBalanceMain.Tables[0].TableName; this.dsBalanceMain.Merge(dsTrans, false, System.Data.MissingSchemaAction.Ignore); } catch { } Core.StlMes.Client.Sale.Util.UtilDataSet.GetDsByDescOrderFromSourceDataSet(this.dsBalanceMain, this.ASKPLAN_ID); this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_STS].CellActivation = Activation.ActivateOnly; this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_ORG_STS].CellActivation = Activation.ActivateOnly; CleanGrid(); // this.SetMoney(ref this.dsBalanceMain); } private void SetTicketMoneyType(ref DataSet ds) { try { foreach (DataRow dr in ds.Tables[0].Rows) { dr["MONEY_TYPE"] = "货款"; } } catch { } } private string ORD_PK = "ORD_PK"; private string ORD_LN_PK = "ORD_LN_PK"; private string BALNCE_PRICE_STS = "BALNCE_PRICE_STS"; private string BALNCE_PRICE_ORG_STS = "BALNCE_PRICE_ORG_STS"; private void SetOrd() { if (this.ultraGrid1.Rows.Count == 0) { return; } List list = new List(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Rows) { if (!list.Contains(ugr.Cells[this.ORD_PK].Value.ToString())) { list.Add(ugr.Cells[this.ORD_PK].Value.ToString()); } } Hashtable hs = GetOrderBalSts(list); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Rows) { if (hs.ContainsKey(ugr.Cells[this.ORD_PK].Value.ToString() + ugr.Cells[this.ORD_LN_PK].Value.ToString())) { string[] str = (string[]) hs[ugr.Cells[this.ORD_PK].Value.ToString() + ugr.Cells[this.ORD_LN_PK].Value.ToString()]; ugr.Cells[this.BALNCE_PRICE_STS].Value = str[0]; ugr.Cells[this.BALNCE_PRICE_ORG_STS].Value = str[1]; } // list.Add(ugr.Cells[this.ORD_PK].Value.ToString() + ugr.Cells[this.ORD_LN_PK].Value.ToString()); } } private void QueryOrg() { DataSet ds = null; DataSet dsTrans = null; // 只有编单界面才查 if (this.radioButton1.Checked) { ds = this.slmBalanceInfo.GetUnAffrimSlmBalaneInfoByPlanBeginDateAndEndDateOrg(this.dateTimePicker1.Value, this.dateTimePicker2.Value); dsTrans = this.slmBalanceInfo.GetAcceptAndUnAffrimTransAndOutStockTicketOrg(); } if (this.radioButton2.Checked) { ds = this.slmBalanceInfo.GetAffrimSlmBalaneInfoByPlanBeginDateAndEndDateOrg(this.dateTimePicker1.Value, this.dateTimePicker2.Value); dsTrans = this.slmBalanceInfo.GetAcceptAndAffrimTransAndOutStockTicketOrg(); } if (this.textBox7.Text.Trim().Length > 0) { ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this.ASKPLAN_ID, this.textBox7.Text.Trim()); dsTrans = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(dsTrans, this.ASKPLAN_ID, this.textBox7.Text.Trim()); } if (this.textBox1.Text.Trim().Length > 0) { ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this.ORD_NO, this.textBox1.Text.Trim()); } // 按部门过滤数据 // 按首次受票人过滤数据 ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "FST_DRAWEE_UNIT", GetFilterSaleOrg(suppunit)); //if ("120504".Equals(suppunit)) ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "supply_unit", suppunit); if (!this.UserInfo.GetUserName().Equals("admin")) ds = base.GetDataSetByFilterDeptId(ds); dsTrans = base.GetDataSetByFilterDeptId(dsTrans); //if ("120504".Equals(suppunit)) dsTrans = Util.UtilDataSet.GetDataSetWithRowFilter(dsTrans, "supply_unit", suppunit); this.dsBalanceMain.Clear(); Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsBalanceMain, ds); SetTicketMoneyType(ref this.dsBalanceMain); try { dsTrans.Tables[0].TableName = this.dsBalanceMain.Tables[0].TableName; this.dsBalanceMain.Merge(dsTrans, false, System.Data.MissingSchemaAction.Ignore); } catch { } SetOrd(); this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_STS].CellActivation = Activation.ActivateOnly; this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BALNCE_PRICE_ORG_STS].CellActivation = Activation.ActivateOnly; CleanGrid(); // this.SetMoney(ref this.dsBalanceMain); } private string[] GetFilterSaleOrg(String flag) { if (flag == "120504") return new string[] { "120603", "120604", "120605", "120608" }; else return new string[] { "120603", "120604", "120605" }; } private void CleanGrid() { this.dsGridThree.Clear(); this.dsGridFour.Clear(); } private void Affrim() { ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; string errMsg = ""; this.slmBalanceInfo.Affrim(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg); if (errMsg.Length > 0) { } else { removeUgr(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } } private void removeUgr() { try { System.Collections.Generic.List listugr = new List(); if(this.ultraGrid1.ActiveRow != null) this.ultraGrid1.ActiveRow.Selected = true; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows) { listugr.Add(ugr); } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in listugr) { ugr.Delete(); } this.ultraGrid1.UpdateData(); } catch { } } private void AffrimOrg() { ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; string errMsg = ""; this.slmBalanceInfo.AffrimOrg(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(),out errMsg); // this.QueryOrg(); if (errMsg.Length > 0) { } else { removeUgr(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } } private void UnAffrim() { ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; string errMsg = ""; if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定取消选定行?") == DialogResult.No) return; this.slmBalanceInfo.UnAffrim(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(),out errMsg); // this.Query(); if (errMsg.Length > 0) { } else { removeUgr(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } } private void UnAffrimOrg() { ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定取消选定行?") == DialogResult.No) return; string errMsg = ""; this.slmBalanceInfo.UnAffrimOrg(listOrder, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(),out errMsg); // this.QueryOrg(); if (errMsg.Length > 0) { } else { removeUgr(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } } private int saveDigit = 4; private void SetMoney(ref DataSet ds) { if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) return; foreach (DataRow dr in ds.Tables[0].Rows) { dr[this.MONEY] = Math.Round(Util.ConverObject.ConvertToDouble(dr[this.WEIGHT].ToString()) * Util.ConverObject.ConvertToDouble(dr[this.PRICE].ToString()), saveDigit); } } private Boolean IsCanBeUpdateWithDifferentPerson(string user) { if (user == CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()) { return true; } else { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("只允许操作本人数据"); return false; } } private void Invoice() { if (!IsCanBeInvoiced()) return; ArrayList listOrder = GetUpdateCondition(); if (listOrder.Count == 0) return; if (Util.MessageUtil.ShowYesNoAndQuestion("是否确定编制结算单?") == DialogResult.No) return; string errMsg = ""; // this.slmBalanceInfo.Invoice(listOrder,"", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); this.slmBalanceInfo.InvoiceLightly(listOrder, "", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg); if (errMsg.Length > 0) { } else { removeUgr(); Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } // this.Query(); } private void RollBackAskPlanId() { if (this.ultraGrid1.Rows.Count == 0) return; UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) return; this.slmBalanceInfo.RollBaskAskPlanId(ugr.Cells[this.ASKPLAN_ID].Value.ToString(), CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); } private Boolean IsCanBeInvoiced() { // 钢贸是否必须要在首次结算后再进行末次编单 Boolean isAllowInvoice = true; if (this.ultraGrid1.Rows.Count == 0) return false; if (this.ultraGrid1.Rows.Count == 1) this.ultraGrid1.Rows[0].Selected = true; this.ultraGrid1.ActiveRow.Selected = true; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows) { //if (Util.ConverObject.ConvertToDouble(ugr.Cells["PRICE"].Value.ToString()) == 0 // && ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款" // ) //{ // Util.MessageUtil.ShowError("记录中有单价为0记录,不允许编单"); // return false; //} string FST_DRAWEE_UNIT = ugr.Cells["FST_DRAWEE_UNIT"].Value.ToString(); // 钢贸的首次结算必须要等首次开票完成 if (( FST_DRAWEE_UNIT =="120604"|| FST_DRAWEE_UNIT =="120605") && isAllowInvoice && ugr.Cells["FORECORPCODE"].Value.ToString() == "钢贸公司" && ugr.Cells["BALANCESTATUS_ORG"].Value.ToString()+"" != "3") { if (ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款") { Util.MessageUtil.ShowError("记录中有未进行首次编单记录,不允许编单"); return false; } } if ( ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款" && !IsCanBeUpdateWithDifferentPerson(ugr.Cells["AFFRIMPERSON"].Value.ToString())) { return false; } } return true; } private Boolean IsCanBeInvoicedOrg() { if (this.ultraGrid1.Rows.Count == 0) return false; if (this.ultraGrid1.Rows.Count == 1) this.ultraGrid1.Rows[0].Selected = true; this.ultraGrid1.ActiveRow.Selected = true; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows) { if (Util.ConverObject.ConvertToDouble(ugr.Cells["PRICE_ORG"].Value.ToString()) == 0 && ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款") { Util.MessageUtil.ShowError("记录中有单价为0记录,不允许编单"); return false; } if (ugr.Cells["MONEY_TYPE"].Value.ToString() == "货款" && !IsCanBeUpdateWithDifferentPerson(ugr.Cells["AFFRIMPERSON_ORG"].Value.ToString())) { return false; } } return true; } private ArrayList GetUpdateCondition() { ArrayList list = new ArrayList(); if (this.ultraGrid1.Rows.Count == 0) return list; UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) return list; if (this.ultraGrid1.Selected.Rows.Count == 0) { CheckedIsGridGroupRow(ugr, ref list); } else { for (int i = 0; i < this.ultraGrid1.Selected.Rows.Count; i++) { CheckedIsGridGroupRow(this.ultraGrid1.Selected.Rows[i], ref list); } } return list; } private ArrayList GetUpdateConditionSaleOrg() { ArrayList list = new ArrayList(); if (this.ultraGrid1.Rows.Count == 0) return list; UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) return list; if (this.ultraGrid1.Selected.Rows.Count == 0) { CheckedIsGridGroupRowSaleOrg(ugr, ref list); } else { for (int i = 0; i < this.ultraGrid1.Selected.Rows.Count; i++) { CheckedIsGridGroupRowSaleOrg(this.ultraGrid1.Selected.Rows[i], ref list); } } return list; } private void CheckedIsGridGroupRow(UltraGridRow ugr, ref ArrayList ar1) { if (ugr is UltraGridGroupByRow) { for (int i = 0; i < ugr.ChildBands[0].Rows.Count; i++) { CheckedIsGridGroupRow(ugr.ChildBands[0].Rows[i], ref ar1); } } else { ar1.Add(new string[]{ ugr.Cells[this.ORD_NO].Value.ToString(), ugr.Cells[this.ORD_SEQ].Value.ToString(), ugr.Cells[this.ORD_LN_DLY].Value.ToString(), ugr.Cells[this.ASKPLAN_ID].Value.ToString(), ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString(), ugr.Cells[this.SPETKEY].Value.ToString(), ugr.Cells[this.STEELCODEKEY].Value.ToString(), ugr.Cells[this.BUYERCODE].Value.ToString(), ugr.Cells[this.PRICE].Value.ToString(), ugr.Cells[this.BALANCESTATUS].Value.ToString(), ugr.Cells["ORD_PK"].Value.ToString(), ugr.Cells["ORD_LN_PK"].Value.ToString(), ugr.Cells["ORD_LN_DLY_PK"].Value.ToString(), ugr.Cells["BALANCESTATUS_ORG"].Value.ToString(), ugr.Cells["CUSTOMER_NO"].Value.ToString(), ugr.Cells["SALE_AREA_NO"].Value.ToString(), ugr.Cells["FST_DRAWEE_UNIT"].Value.ToString(), ugr.Cells["FORECORPCODE"].Value.ToString(), ugr.Cells["LISTNUMBER"].Value.ToString(), ugr.Cells["MONEY_TYPE"].Value.ToString() }); } } private void CheckedIsGridGroupRowSaleOrg(UltraGridRow ugr, ref ArrayList ar1) { if (ugr is UltraGridGroupByRow) { for (int i = 0; i < ugr.ChildBands[0].Rows.Count; i++) { CheckedIsGridGroupRowSaleOrg(ugr.ChildBands[0].Rows[i], ref ar1); } } else { ar1.Add(new string[]{ ugr.Cells[this.ORD_NO].Value.ToString(), ugr.Cells[this.ORD_SEQ].Value.ToString(), ugr.Cells[this.ORD_LN_DLY].Value.ToString(), ugr.Cells[this.ASKPLAN_ID].Value.ToString(), ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString(), ugr.Cells[this.SPETKEY].Value.ToString(), ugr.Cells[this.STEELCODEKEY].Value.ToString(), ugr.Cells[this.BUYERCODE].Value.ToString(), ugr.Cells["PRICE_ORG"].Value.ToString(), ugr.Cells[this.BALANCESTATUS].Value.ToString(), ugr.Cells["ORD_PK"].Value.ToString(), ugr.Cells["ORD_LN_PK"].Value.ToString(), ugr.Cells["ORD_LN_DLY_PK"].Value.ToString(), ugr.Cells["BALANCESTATUS_ORG"].Value.ToString(), ugr.Cells["CUSTOMER_NO"].Value.ToString(), ugr.Cells["SALE_AREA_NO"].Value.ToString(), ugr.Cells["FST_DRAWEE_UNIT"].Value.ToString(), ugr.Cells["FORECORPCODE"].Value.ToString(), ugr.Cells["LISTNUMBER"].Value.ToString(), ugr.Cells["MONEY_TYPE"].Value.ToString() }); } } private void UpdatePrice() { if (this.ultraGrid1.Rows.Count == 0) return; Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; double price = Convert.ToDouble(this.ultraNumericEditor1.Value); string reason = this.textBox2.Text.Trim(); if (reason.Length == 0) { MessageBox.Show("请输入调整原因"); return; } if (price == 0) return; string errMsg = ""; string orderno = ugr.Cells[this.ORD_NO].Value.ToString(); string ord_seq = ugr.Cells[this.ORD_SEQ].Value.ToString(); string ord_ln = ugr.Cells[this.ORD_LN_DLY].Value.ToString(); string askplanId = ugr.Cells[this.ASKPLAN_ID].Value.ToString(); string askPlanIdSeq = ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString(); string spetKey = ugr.Cells[this.SPETKEY].Value.ToString(); string steelcodekey = ugr.Cells[this.STEELCODEKEY].Value.ToString(); string person = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(); this.slmBalanceInfo.UpdatePrice(orderno, ord_seq, ord_ln, askplanId, askPlanIdSeq, spetKey, steelcodekey, price, reason, person, out errMsg); if (errMsg.Length == 0) { MessageBox.Show("修改成功"); ugr.Cells[this.PRICE].Value = Math.Round(price,this.saveDigit); ugr.Cells[this.MONEY].Value = Math.Round(Convert.ToDouble(ugr.Cells[this.WEIGHT].Value) * price, this.saveDigit); ugr.Cells[this.ADJUSTPRICEREASON].Value = reason; } } private string[] GetGridThreeDataStruct() { return new string[] { "ASKPLAN_ID", "TALLYSHEET_NO", // "ORD_LN_DLY", "BATCH_NO", "QUANTITY", "ACT_WGT" }; } /// /// 价格由专门的人员维护,结算人员只需要进行编单 /// 但是也提供价格调整功能,只是调整原因必须输入,见UpdatePrice /// private void InputPrice() { if (this.ultraGrid1.Rows.Count == 0) return; Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; double price = Convert.ToDouble(this.ultraNumericEditor1.Value); string reason = this.textBox2.Text.Trim(); if (price == 0) return; string errMsg = ""; string orderno = ugr.Cells[this.ORD_NO].Value.ToString(); string ord_seq = ugr.Cells[this.ORD_SEQ].Value.ToString(); string ord_ln = ugr.Cells[this.ORD_LN_DLY].Value.ToString(); string askplanId = ugr.Cells[this.ASKPLAN_ID].Value.ToString(); string askPlanIdSeq = ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString(); string spetKey = ugr.Cells[this.SPETKEY].Value.ToString(); string steelcodekey = ugr.Cells[this.STEELCODEKEY].Value.ToString(); string person = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(); this.slmBalanceInfo.inputPrice(orderno, ord_seq, ord_ln, askplanId, askPlanIdSeq, spetKey, steelcodekey, price, person, out errMsg); if (errMsg.Length == 0) { MessageBox.Show("修改成功"); ugr.Cells[this.PRICE].Value = Math.Round(price, this.saveDigit); ugr.Cells[this.MONEY].Value = Math.Round(Convert.ToDouble(ugr.Cells[this.WEIGHT].Value) * price, this.saveDigit); ugr.Cells[this.ADJUSTPRICEREASON].Value = reason; } } private string[] GetGrid1DataStruct() { return GetBalanceMainColumn(); } private string[] GetUnAcceptBalaceColumn() { return new string[] { "LISTNUMBER", "ASKPLAN_ID", "SEND_NUM", // "ORDER_UNIT", "QUANTITY", "WEIGHT", "MONEY", "OUTWEIGHT", "OUTSTOCKMNY", "TRANSMONEY", "TRANS_TYPE_NAME", "SALE_AREA_DESC", "BUYERNAME", "INCEPTCORPCODE", "SUPPLY_UNIT_DESC" }; } private string[] GetBalanceMainColumn() { return new string[] { "ASKPLAN_ID", LISTNUMBER, "MONEY_TYPE", "SALE_AREA_DESC", "FORECORPCODE", "BUYERCODE", "BUYERNAME", "SUPPLY_UNIT_DESC", "FST_DRAWEE_UNIT", "ORD_NO", "ORD_SEQ", "ORD_LN_DLY", "ASKPLAN_ID_SEQ", "STEELCODEKEY", "PACTINDEX", "SPETKEY", "SEND_NUM", "ORDER_UNIT", "QUANTITY", "WEIGHT", "BALNCE_PRICE_STS", "BALNCE_PRICE_ORG_STS", "PRICE", "MONEY", "PRICE_ORG", "MONEY_ORG", "CONTAIN_TAX", "CATEGORY", "SPEC_ABBSYMNAME", "STD_STYLE_DESC", "MODEL_DESC", "TRANS_TYPE_NAME", "ADJUSTPRICEPERSON", "ADJUSTPRICEREASON", "BASEPRICE", "INCEPTCORPCODE", // "STATIONCODE", "BALANCESTATUS_ORG", "AFFRIMPERSON_ORG", "AFFIRMTIME_ORG", "BALANCESTATUS", "AFFRIMPERSON", "AFFIRMTIME", // "AREACODE", // "DOCKCODE", // "SHIPNO", // "FIXSIZE", "INVOICENO_ORG", "REALINVOICENO_ORG", "ORD_PK", "ORD_LN_PK", "ORD_LN_DLY_PK", "CUSTOMER_NO", "CUSTOMER_NM", "SALE_AREA_NO" }; } private string BUYERCODE = "BUYERCODE"; private string ORD_NO = "ORD_NO"; private string ORD_SEQ = "ORD_SEQ"; private string ORD_LN_DLY = "ORD_LN_DLY"; private string ASKPLAN_ID = "ASKPLAN_ID"; private string ASKPLAN_ID_SEQ = "ASKPLAN_ID_SEQ"; private string SPETKEY = "SPETKEY"; private string STEELCODEKEY = "STEELCODEKEY"; private string MONEY = "MONEY"; private string WEIGHT = "WEIGHT"; private string PRICE = "PRICE"; private string BALANCESTATUS = "BALANCESTATUS"; private string ADJUSTPRICEREASON = "ADJUSTPRICEREASON"; private string BALANCESTATUS_INIT = "0"; private string BALANCESTATUS_AFFRIM = "2"; private string BALANCESTATUS_INVOINCE = "3"; private string[] GetGrid2DataStruct() { return new string[] { "ORDERNO", "PLY", "WIDTH", "LENGTH", "STEELCODE", "WEIGHT", "QUANTITY", "BASEPRICE", "PRICE", "MONEY", "HOISTINGFEE", "CARFMONEY", "SHIPPRICE", "TRANSMONEYQC", "TRANSMONEYSY1", "TRANSMONETRAIN" } ; } private Hashtable GetColumnAndCaption() { Hashtable hs = new Hashtable(); hs.Add("SHIPNO", "船号"); hs.Add("WEIGHT", "重量"); hs.Add("DOCKCODE", "港口"); hs.Add("TRANSMONEYSY1", "船运费"); hs.Add("SHIPPRICE", "船运价"); hs.Add("PLY", "厚/直径/壁厚"); hs.Add("WIDTH", "宽/外径"); hs.Add("HOISTINGFEE", "吊装费"); hs.Add("TRANSMONETRAIN", "火运费"); hs.Add("ORD_NO", "合同号"); hs.Add("ORD_SEQ", "合同行"); hs.Add("ORD_LN_DLY", "交货行"); hs.Add("ASKPLAN_ID", "提单号"); hs.Add("ASKPLAN_ID_SEQ", "提单序号"); hs.Add("SPETKEY", "规格"); hs.Add("STEELCODEKEY", " 钢级(牌号)"); hs.Add("ADJUSTPRICEPERSON", "调价人"); hs.Add("ADJUSTPRICEREASON", "调价原因"); hs.Add("AFFRIMPERSON", "末次确认人"); hs.Add("AFFIRMTIME", "末次确认时间"); hs.Add("AFFRIMPERSON_ORG", "首次确认人"); hs.Add("AFFIRMTIME_ORG", "首次确认时间"); hs.Add("BASEPRICE", "订单价"); hs.Add("FORECORPCODE", "子公司"); hs.Add("STATIONCODE", "到站"); hs.Add("BUYERNAME", "结算单位名称"); hs.Add("BUYERCODE", "客户编码"); hs.Add("CUSTOMER_NM", "订货单位"); hs.Add("TRANS_TYPE_NAME", "运输方式"); hs.Add("MONEY_ORG", "首次结算金额"); hs.Add("PRICE_ORG", "首次结算价"); hs.Add("CATEGORY", "品名"); hs.Add("SPEC_ABBSYMNAME", "标准"); hs.Add("STD_STYLE_DESC", "标准类别"); hs.Add("MODEL_DESC", "扣型"); hs.Add("ORDER_UNIT", "计量单位"); hs.Add("SALE_AREA_DESC", "销售区域"); hs.Add("SEND_NUM", "实发量"); hs.Add("CONTAIN_TAX", "是否含税"); hs.Add("BALANCESTATUS_ORG", "首次结算状态"); hs.Add("FST_DRAWEE_UNIT", "首次受票人"); hs.Add("INVOICENO_ORG", "首次结算单号"); hs.Add("REALINVOICENO_ORG", "首次真实单号"); hs.Add("BALNCE_PRICE_STS", "末次价格有效性"); hs.Add("BALNCE_PRICE_ORG_STS", "首次价格有效性"); hs.Add("PACTINDEX", "钢种"); hs.Add("OUTWEIGHT", "出库费(重量)"); hs.Add("OUTSTOCKMNY", "出库费(金额)"); hs.Add("MONEY_TYPE", "类型"); hs.Add("SUPPLY_UNIT_DESC", "制造商"); return hs; } protected override List GetGridColumnListHidden() { List list = new List(); list.Add(this.ASKPLAN_ID_SEQ); list.Add(this.BALANCESTATUS); return list; } private void SetGridShowLength() { Hashtable hs = StaticData.TbColumnAndCaption.GetDataSetColumnLength(); try { foreach (string s in hs.Keys) { try { this.ultraGrid1.DisplayLayout.Bands[0].Columns[s].Width = (int) Util.ConverObject.ConvertToDouble(hs[s]); } catch { } try { // this.ultraGrid2.DisplayLayout.Bands[0].Columns[s].Width = (int)Util.ConverObject.ConvertToDouble(hs[s]); } catch { } try { this.ultraGrid3.DisplayLayout.Bands[0].Columns[s].Width = (int)Util.ConverObject.ConvertToDouble(hs[s]); } catch { } } } catch { } } private string[] GetGridFiveDataStruct() { return new string[] { "TICKETTYPE", "MONEY", // "TICKETNUM", "MONEY_TYPE", "TRANS_TYPE", // "MOTORMANNAME", "REG_ID", "REG_DTIME", "AFFRIM_ID", "AFFRIM_TIME", "STATUS_CD" }; } protected override Hashtable GetGridColumnLength() { return StaticData.TbColumnAndCaption.GetDataSetColumnLength(); } private void QueryGridThree() { this.dsGridThree.Clear(); if (this.ultraGrid1.Rows.Count == 0) return; Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) ugr = this.ultraGrid1.Rows[0]; string orderno = ugr.Cells[this.ORD_NO].Value.ToString(); string orderseq = ugr.Cells[this.ORD_SEQ].Value.ToString(); string orderlineseq = ugr.Cells[this.ORD_LN_DLY].Value.ToString(); string askplanid = ugr.Cells[this.ASKPLAN_ID].Value.ToString(); string askplanidseq = ugr.Cells[this.ASKPLAN_ID_SEQ].Value.ToString(); string spetkey = ugr.Cells[this.SPETKEY].Value.ToString(); string steelkey = ugr.Cells[this.STEELCODEKEY].Value.ToString(); DataSet dsDetail = this.slmBalanceInfo.GetSlmBalanceDetailAllGroupByBatchNo( orderno, orderseq, orderlineseq, askplanid, askplanidseq, spetkey, steelkey); Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsGridThree, dsDetail); } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { QueryGridThree(); QueryGridFive(); QueryGridFour(); Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) ugr = this.ultraGrid1.Rows[0]; else ugr = this.ultraGrid1.ActiveRow; double price = Util.ConverObject.ConvertToDouble(ugr.Cells[this.PRICE].Value); string adjustReason = ugr.Cells[this.ADJUSTPRICEREASON].Value.ToString(); this.ultraNumericEditor1.Value = price; this.textBox2.Text = adjustReason; } private void FrmBalanceTicketMgt_Shown(object sender, EventArgs e) { HiddenToolbars(); if (!(base.GetSaleOrgDesc() == "国贸公司")) { string[] keys = new string[] { "QueryOrg", "AffrimOrg", "UnAffrimOrg", "InvoiceOrg","SetPriceOrg","ExportPrice","Export","AcpRllRecord"}; try { foreach (string s in keys) { toolMenu.Toolbars[0].Tools[s].SharedProps.Visible = true; } } catch { } try { if (cusInfo == "2") { toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = true; toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = true; // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = true; } else { toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = false; // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = false; } } catch { } } } private void ultraGrid1_AfterRowActivate_1(object sender, EventArgs e) { QueryGridThree(); QueryGridFive(); QueryGridFour(); Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) ugr = this.ultraGrid1.Rows[0]; else ugr = this.ultraGrid1.ActiveRow; double price = Util.ConverObject.ConvertToDouble(ugr.Cells[this.PRICE].Value); string adjustReason = ugr.Cells[this.ADJUSTPRICEREASON].Value.ToString(); this.ultraNumericEditor1.Value = price; this.textBox2.Text = adjustReason; } private void groupBox1_Enter(object sender, EventArgs e) { } private void textBox7_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { if (cusInfo == "2") this.Query(); else this.QueryOrg(); } } private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { if (cusInfo == "2") this.Query(); else this.QueryOrg(); } } private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (cusInfo == "2") this.Query(); else this.QueryOrg(); } private void radioButton2_CheckedChanged(object sender, EventArgs e) { if (cusInfo == "2") this.Query(); else this.QueryOrg(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { } private void SetToolBars() { string[] keys = new string[] { "QueryOrg", "AffrimOrg", "UnAffrimOrg", "InvoiceOrg","SetPriceOrg","ExportPrice","Export"}; if (ultraTabControl1.SelectedTab.Index == 0) { this.textBox1.ReadOnly = true; this.radioButton1.Visible = false; this.radioButton2.Visible = false; try { toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = true; toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = true; // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = false; } catch { } foreach (string s in keys) { try { toolMenu.Toolbars[0].Tools[s].SharedProps.Visible = false; } catch { } } } if (ultraTabControl1.SelectedTab.Index == 1) { this.textBox1.ReadOnly = false; this.radioButton1.Visible = true; this.radioButton2.Visible = true; try { toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = false; // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = true; } catch { } foreach (string s in keys) { try { toolMenu.Toolbars[0].Tools[s].SharedProps.Visible = true; } catch { } } } } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (cusInfo == "2") { if (ultraTabControl1.SelectedTab.Index == 0) { this.textBox1.ReadOnly = true; this.radioButton1.Visible = false; this.radioButton2.Visible = false; try { toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = true; toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = true; // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["Affrim"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["UnAffrim"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["Invoice"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["SetPrice"].SharedProps.Visible = false; // toolMenu.Toolbars[0].Tools["Export"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["Query"].SharedProps.Visible = false; } catch { } } else { try { this.textBox1.ReadOnly = false; this.radioButton1.Visible = true; this.radioButton2.Visible = true; toolMenu.Toolbars[0].Tools["Accept"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["QueryUnAcept"].SharedProps.Visible = false; toolMenu.Toolbars[0].Tools["Affrim"].SharedProps.Visible = true; toolMenu.Toolbars[0].Tools["UnAffrim"].SharedProps.Visible = true; toolMenu.Toolbars[0].Tools["Invoice"].SharedProps.Visible = true; toolMenu.Toolbars[0].Tools["SetPrice"].SharedProps.Visible = true; toolMenu.Toolbars[0].Tools["Export"].SharedProps.Visible = true; // toolMenu.Toolbars[0].Tools["UnAccept"].SharedProps.Visible = true; try { toolMenu.Toolbars[0].Tools["Query"].SharedProps.Visible = true; } catch { } try { toolMenu.Toolbars[0].Tools["AcpRllRecord"].SharedProps.Visible = true; } catch { } } catch { } } } else if (cusInfo == "3") SetToolBars(); } private void ultraGrid1_AfterRowActivate_2(object sender, EventArgs e) { QueryGridThree(); // QueryGridFive(); // QueryGridFour(); Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) ugr = this.ultraGrid1.Rows[0]; else ugr = this.ultraGrid1.ActiveRow; double price = Util.ConverObject.ConvertToDouble(ugr.Cells[this.PRICE].Value); string adjustReason = ugr.Cells[this.ADJUSTPRICEREASON].Value.ToString(); this.ultraNumericEditor1.Value = price; this.textBox2.Text = adjustReason; } } }