using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Core.StlMes.Client.Sale.UI.Balance.BalanceAccount { public partial class FrmBalanceTicketsAline : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase { public FrmBalanceTicketsAline() { InitializeComponent(); } DataSet dsMain = new DataSet(); DataSet dsGrid2 = new DataSet(); DataSet dsGrid3 = new DataSet(); private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo slmBalanceInfo = null; private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.StaticData.PublicStaticVariable publicStaticVariable = null; private Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Trans.YdmZcLoadVehicleMatMgt ydmZcLoadVehicleMatMgt = null; private void InitOb() { ydmZcLoadVehicleMatMgt = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Trans.YdmZcLoadVehicleMatMgt(this.ob); slmBalanceInfo = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Balance.SlmBalanceInfo(this.ob); } private void InitDataSource() { dsMain = base.GetDataSetByColumnName(GetDataStructMain(), GetTbColumnNameAndDataType(), base.ConvertListStringArrayToHashTable(GetDataStructCaption())); this.ultraGrid1.DataSource = dsMain; dsGrid2 = base.GetDataSetByColumnName(this.GetGrid2DataStruct(), null, base.ConvertListStringArrayToHashTable(GetDataStructCaption())); this.ultraGrid2.DataSource = dsGrid2; dsGrid3 = base.GetDataSetByColumnName(this.GetGrid3DataStruct(), GetTbColumnNameAndDataType(), base.ConvertListStringArrayToHashTable(GetDataStructCaption())); this.ultraGrid3.DataSource = dsGrid3; } private void HiddenColumn() { try { this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.CUSTOMER_NO].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.CARRY_COMPANY_CODE].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.RECEIV_NO].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["SUPPLY_UNIT"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.BILL_STATUS].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.CARRY_COMPANY_NAME].Hidden = true; // this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.LOADVEHICLE_TYPE].Hidden = true; // this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.TRANSMNY_TICKET_STATUS].Hidden = true; this.ultraGrid2.DisplayLayout.Bands[0].Columns[this.ORD_PK].Hidden = true; this.ultraGrid2.DisplayLayout.Bands[0].Columns[this.ORD_LN_PK].Hidden = true; this.ultraGrid2.DisplayLayout.Bands[0].Columns[this.ORD_LN_DLY_PK].Hidden = true; this.ultraGrid3.DisplayLayout.Bands[0].Columns[this.ORD_PK].Hidden = true; this.ultraGrid3.DisplayLayout.Bands[0].Columns[this.ORD_LN_PK].Hidden = true; this.ultraGrid3.DisplayLayout.Bands[0].Columns[this.ORD_LN_DLY_PK].Hidden = true; } catch { } } private void InitGridValeList() { try { this.ultraGrid1.DisplayLayout.Bands[0].Columns[this.LOADVEHICLE_TYPE] .ValueList = GetLoadTypeStatusList(); } catch { } try { this.ultraGrid2.DisplayLayout.Bands[0].Columns["AGENCY_FL"] .ValueList = GetAgnflStatusList(); } catch { } try { this.ultraGrid2.DisplayLayout.Bands[0].Columns["TRANS_TPE"] .ValueList = GetTransTpe(); } catch { } try { this.ultraGrid3.DisplayLayout.Bands[0].Columns["TRANSIT_TYP"] .ValueList = GetTransTpe(); } catch { } try { this.ultraGrid3.DisplayLayout.Bands[0].Columns["AGENCY_FL"] .ValueList = GetTransStatusList(); } catch { } } protected override System.Collections.Hashtable GetTbColumnNameAndDataType() { System.Collections.Hashtable hs = new System.Collections.Hashtable(); hs.Add( "BILL_CK","System.Boolean"); hs.Add( "OUTSTOCK_CK","System.Boolean"); hs.Add( "TRANSMNY_CK","System.Boolean"); hs.Add(this.SELECT, "System.Boolean"); return hs; } private Infragistics.Win.ValueList GetLoadTypeStatusList() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("1", "实单"); lit.ValueListItems.Add("2", "虚单"); return lit; } private Infragistics.Win.ValueList GetAgnflStatusList() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("0", "不代办"); lit.ValueListItems.Add("1", "代办"); return lit; } private Infragistics.Win.ValueList GetTransStatusList() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("0", "无客户代办"); lit.ValueListItems.Add("1", "TPCO代办"); lit.ValueListItems.Add("2", "客户代办"); return lit; } private Infragistics.Win.ValueList GetTransTpe() { Infragistics.Win.ValueList lit = new Infragistics.Win.ValueList(); lit.ValueListItems.Add("110501", "汽运"); lit.ValueListItems.Add("110502", "铁运"); lit.ValueListItems.Add("110503", "船运"); return lit; } private void InitCellAllowEdit() { foreach (string s in new string[] { this.BILL_CK,this.OUTSTOCK_CK,this.TRANSMNY_CK}) { this.ultraGrid1.DisplayLayout.Bands[0].Columns[s].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; this.ultraGrid1.DisplayLayout.Bands[0].Columns[s].CellAppearance.BackColor = base.GetEditColor(); } foreach (string s in new string[] { this.SELECT, this.TRANSMNY, "STAMP_DUTY_MONEY", "DISBURASES_BILL", "TRANS_NO" }) { this.ultraGrid3.DisplayLayout.Bands[0].Columns[s].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; this.ultraGrid3.DisplayLayout.Bands[0].Columns[s].CellAppearance.BackColor = base.GetEditColor(); } } private void FrmBalanceTicketsAline_Load(object sender, EventArgs e) { this.dateTimePicker1.Value = System.DateTime.Now.AddMonths(-1); this.dateTimePicker3.Value = System.DateTime.Now.AddMonths(-1); dateTimePicker3.Enabled = false; dateTimePicker4.Enabled = false; this.radioButton1.Checked = true; InitOb(); InitDataSource(); HiddenColumn(); InitGridValeList(); base.SetGridStyle(ref this.ultraGrid1,ref this.ultraGrid2,ref this.ultraGrid3); InitCellAllowEdit(); this.ultraGrid2.DisplayLayout.Bands[0].Columns["OUTSTOCKMNY"].MaskInput = "-nn,nnn,nnn.nnnnn"; } protected override System.Collections.Hashtable GetGridColumnLength() { System.Collections.Hashtable hs = new System.Collections.Hashtable(); hs.Add(this.LOADVEHICLE_TYPE, 60); hs.Add(this.BILL_TICKET_STATUS, 60); hs.Add(this.OUTSTOCK_TICKET_STATUS, 60); hs.Add(this.TRANSMNY_TICKET_STATUS, 60); hs.Add(this.ACT_COUNT, 60); hs.Add(this.ACT_WEIGHT, 60); hs.Add(SEND_NUM, 60); hs.Add(this.BILL_CK, 40); hs.Add(this.OUTSTOCK_CK, 60); hs.Add(this.TRANSMNY_CK, 40); hs.Add(this.CREATE_TIME, 100); hs.Add("ORDERNO", 110); hs.Add("JUDGE_STOVE_NO", 60); hs.Add("BATCH_NO", 50); hs.Add("QUANTITY", 50); hs.Add("WEIGHT", 90); hs.Add(this.SELECT, 50); hs.Add(this.TRANSMNY, 70); return hs; } private string _activeBillNo = ""; public override void Query() { this._activeBillNo = ""; Query01(); } public void Query01() { DataSet ds = null; DateTime date3 = new DateTime(); DateTime date4 = new DateTime(); if (uchkDate.Checked) { date3=dateTimePicker3.Value; date4=dateTimePicker4.Value; } if (this.textBox7.Text.Trim().Length > 0) { if (this.radioButton1.Checked) // 未对齐 ds = ydmZcLoadVehicleMatMgt.GetBillNoAfterCloseByBillno(this.textBox7.Text.Trim()); else if (this.radioButton2.Checked) // 已对齐 ds = ydmZcLoadVehicleMatMgt.GetAlineBillNoAfterCloseByBillno(this.textBox7.Text.Trim()); else if (this.radioButton3.Checked) // 已发送 ds = ydmZcLoadVehicleMatMgt.GetSendSuccessBillNoAfterCloseByBillno(this.textBox7.Text.Trim()); } else { if (this.radioButton1.Checked) // 未对齐 ds = ydmZcLoadVehicleMatMgt.GetBillNoAfterCloseByBillCreateTime(this.dateTimePicker1.Value, this.dateTimePicker2.Value,date3,date4); else if (this.radioButton2.Checked) // 已对齐 ds = ydmZcLoadVehicleMatMgt.GetAlineBillNoAfterCloseByBillCreateTime(this.dateTimePicker1.Value, this.dateTimePicker2.Value,date3,date4); else if (this.radioButton3.Checked) // 已发送 ds = ydmZcLoadVehicleMatMgt.GetSendSuccessBillNoAfterCloseByBillCreateTime(this.dateTimePicker1.Value, this.dateTimePicker2.Value,date3,date4); } if (!this.UserInfo.GetUserName().Equals("admin")) ds = base.GetDataSetByFilterDeptId(ds); ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "SUPPLY_UNIT", this.CustomInfo); Core.StlMes.Client.Sale.Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref this.dsMain, ds); try { if (this.radioButton1.Checked) { foreach (DataRow dr in dsMain.Tables[0].Rows) { dr[this.BILL_CK] = (dr[this.BILL_TICKET_STATUS].ToString() == "N") ? true : false; dr[this.OUTSTOCK_CK] = (dr[this.OUTSTOCK_TICKET_STATUS].ToString() == "N" || dr[this.OUTSTOCK_TICKET_STATUS].ToString() == "OK" ) ? true : false; dr[this.TRANSMNY_CK] = (dr[this.TRANSMNY_TICKET_STATUS].ToString() == "N" || dr[this.TRANSMNY_TICKET_STATUS].ToString() == "OK" ) ? true : false; } } if (this.radioButton2.Checked || this.radioButton3.Checked) { foreach (DataRow dr in dsMain.Tables[0].Rows) { dr[this.BILL_CK] = true; dr[this.OUTSTOCK_CK] = true; dr[this.TRANSMNY_CK] = true; } } } catch { } if (_activeBillNo.Length == 0) return; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugrs in this.ultraGrid1.Rows) { if (_activeBillNo == ugrs.Cells[this.BILL_NO].Value.ToString()) { ugrs.Activated = true; break; } } } private void QueryGrid2() { dsGrid2.Clear(); try { 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; if (ugr == null) return; string loadvtype = ugr.Cells[this.LOADVEHICLE_TYPE].Value.ToString(); string bill_sts = ugr.Cells[this.BILL_STATUS].Value.ToString(); DataSet ds = null; if (loadvtype == "1" || bill_sts == "4" || bill_sts == "5" || bill_sts == "6") { ds = this.ydmZcLoadVehicleMatMgt.GetAlineBillMateByBillNo(ugr.Cells[this.BILL_NO].Value.ToString()); } else { ds = this.ydmZcLoadVehicleMatMgt.GetAlineVirtualBillMateByBillNo(ugr.Cells[this.BILL_NO].Value.ToString()); } Core.StlMes.Client.Sale.Util.UtilDataSet .SetDataSetByMergeSameColumnName(ref this.dsGrid2, ds); } catch { } } private void QueryGrid3() { this.dsGrid3.Clear(); try { 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; if (ugr == null) return; DataSet ds = this.ydmZcLoadVehicleMatMgt.GetAlineTransDeliveryByBillNo(ugr.Cells[this.BILL_NO].Value.ToString()); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) return; DataRow[] dr0 = ds.Tables[0].Select(" AGENCY_FL = '0' "); DataRow[] dr1 = ds.Tables[0].Select(" AGENCY_FL = '1' "); DataRow[] dr2 = ds.Tables[0].Select(" AGENCY_FL = '2' "); DataSet dsClone = ds.Clone(); if (dr0 != null && dr0.Length > 0) { dsClone.Tables[0].Rows.Add(dr0[0].ItemArray); } if (dr1 != null && dr1.Length > 0) { dsClone.Tables[0].Rows.Add(dr1[0].ItemArray); } if (dr2 != null && dr2.Length > 0) { dsClone.Tables[0].Rows.Add(dr2[0].ItemArray); } Core.StlMes.Client.Sale.Util.UtilDataSet .SetDataSetByMergeSameColumnName(ref this.dsGrid3, dsClone); SetDataSetGrid3(); SetGrid3TicketNumAndMoney(ugr.Cells[this.BILL_NO].Value.ToString()); } catch { } } private void SetGrid3TicketNumAndMoney(string billno) { if (this.dsGrid3 == null || this.dsGrid3.Tables.Count == 0 || this.dsGrid3.Tables[0].Rows.Count == 0) return; DataSet ds = this.slmBalanceInfo.GetSlmBalanceTransMoneyAskPlanid(billno); ds = Util.UtilDataSet.GetDataSetWithRowFilter(ds, "MONEY_TYPE", "运费"); if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) return; double ticketnum = 0; double money = 0; double stampDutyMoney = 0; string _disburasesbill = ""; string _no = ""; foreach (DataRow dr in this.dsGrid3.Tables[0].Rows) { ticketnum = 0; money = 0; stampDutyMoney = 0; string rowfilter = string.Format(@" ASKPLAN_ID = '{0}' and AGENCY_FL = '{1}' ", billno , dr["AGENCY_FL"].ToString()); DataRow[] drs = ds.Tables[0].Select(rowfilter); if (drs == null || drs.Length == 0) continue; foreach (DataRow drm in drs) { money = money + Util.ConverObject.ConvertToDouble(drm["MONEY"]); stampDutyMoney = stampDutyMoney + Util.ConverObject.ConvertToDouble(drm["STAMP_DUTY_MONEY"]); if (_disburasesbill.Equals("")) _disburasesbill = drm["DISBURASES_BILL"].ToString(); else _disburasesbill = _disburasesbill + ";" + drm["DISBURASES_BILL"].ToString(); if (_no.Equals("")) _no = drm["TRANS_NO"].ToString(); else _no = _no + ";" + drm["TRANS_NO"].ToString(); } dr["TRANSMNY"] = money; dr["STAMP_DUTY_MONEY"] = stampDutyMoney; dr["DISBURASES_BILL"] = _disburasesbill; dr["TRANS_NO"] = _no; } } //SELECT, // TRANSMNY, // "TICKETTYPE", private void SetDataSetGrid3() { try { foreach (DataRow dr in dsGrid3.Tables[0].Rows) { dr["TICKETTYPE"] = GetTicketType(dr["AGENCY_FL"].ToString(), "", "" ); dr[this.SELECT] = false; } } catch { } } private string GetTicketType(string agfl,string indexno,string recdliv) { return (agfl == "0") ? "报销" : (agfl == "1") ? "应收" : "冲减应收"; if (recdliv == "TPCO库房" && agfl == "1") return "应收"; if (recdliv == "TPCO库房" && agfl == "0") return "无"; if (recdliv == "TPCO库房车板" && agfl == "1") return "报销"; if (recdliv == "指定地点" && agfl == "1" && indexno == "1") return "报销"; if (recdliv == "指定地点" && agfl == "0" && indexno == "1") return "冲减应收"; if (recdliv == "指定地点" && agfl == "1" && indexno != "1") return "应收"; if (recdliv == "指定地点" && agfl == "0" && indexno != "1") return "无"; return "无"; } // 确认对齐 public override void Affrim() { if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) this.ultraGrid1.Rows[0].Activated = true; Infragistics.Win.UltraWinGrid.UltraGridRow ugre = null; ugre = this.ultraGrid1.ActiveRow; if (ugre == null) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要确认的行"); return; } ugre.Selected = true; this.ultraGrid1.UpdateData(); this.ultraGrid3.UpdateData(); System.Collections.ArrayList list = new System.Collections.ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows) { string[] temp = null; string billck = "0"; string outck = "0"; string transck = "0"; string billno = ugr.Cells[this.BILL_NO].Value.ToString(); billck = (ugr.Cells[this.BILL_CK].Value.ToString().ToUpper() == "TRUE") ? "1" : "0"; outck = (ugr.Cells[this.OUTSTOCK_CK].Value.ToString().ToUpper() == "TRUE") ? "1" : "0"; transck = (ugr.Cells[this.TRANSMNY_CK].Value.ToString().ToUpper() == "TRUE") ? "1" : "0"; if (outck == "1") { if (ugr.Cells[this.LOADVEHICLE_TYPE].Value.ToString() == "2" && (ugr.Cells[this.BILL_STATUS].Value.ToString() == "0" || ugr.Cells[this.BILL_STATUS].Value.ToString() == "1" || ugr.Cells[this.BILL_STATUS].Value.ToString() == "2" || ugr.Cells[this.BILL_STATUS].Value.ToString() == "3")) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("虚单且未进行二次关闭,不允许确认出库费"); return; } } if (transck == "1" && ugr.Cells[this.TRANSMNY_TICKET_STATUS].Value.ToString() == "N") { int index = 0; // 先检查有没有输入运费 if (this.ultraGrid3.Rows.Count > 0) { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugrs in this.ultraGrid3.Rows) { if (ugrs.Cells["TICKETTYPE"].Value.ToString() == "无") continue; string transmoney = ugrs.Cells[TRANSMNY].Value.ToString(); if (transmoney.Length == 0) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("无运费维护,不能确认运费"); return; } //if (Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble(transmoney) == 0) //{ // Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("无运费维护,不能确认运费"); // return; //} index++; } // 防止界面输入数值,但是没有保存,从后台查询数据校验 DataSet dstransmny = this.slmBalanceInfo.GetSlmBalanceTransMoneyAskPlanid(billno); dstransmny = Util.UtilDataSet.GetDataSetWithRowFilter(dstransmny, "MONEY_TYPE", "运费"); try { if (index > dstransmny.Tables[0].Rows.Count) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("无运费维护,不能确认运费"); return; } } catch { } } } temp = new string[] { ugr.Cells[this.BILL_NO].Value.ToString(), billck,outck,transck }; list.Add(temp); } if (list.Count == 0) return; string errMsg = ""; this.ydmZcLoadVehicleMatMgt.AffrimAline(list, CoreFS.SA06.CoreUserInfo.UserInfo .GetUserName(), out errMsg); if (errMsg.Length > 0) { } else { Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } this.Query01(); } // 取消对齐 public override void UnAffrim() { if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) this.ultraGrid1.Rows[0].Activated = true; Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; ugr = this.ultraGrid1.ActiveRow; if (ugr == null) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要取消确认的行"); return; } this.ultraGrid1.UpdateData(); System.Collections.ArrayList list = new System.Collections.ArrayList(); string[] temp = null; string billck = "0"; string outck = "0"; string transck = "0"; billck = (ugr.Cells[this.BILL_CK].Value.ToString().ToUpper() == "TRUE") ? "1" : "0"; outck = (ugr.Cells[this.OUTSTOCK_CK].Value.ToString().ToUpper() == "TRUE") ? "1" : "0"; transck = (ugr.Cells[this.TRANSMNY_CK].Value.ToString().ToUpper() == "TRUE") ? "1" : "0"; temp = new string[] { ugr.Cells[this.BILL_NO].Value.ToString(), billck,outck,transck }; list.Add(temp); if (list.Count == 0) return; string errMsg = ""; this.ydmZcLoadVehicleMatMgt.UnAffrimAline(list, CoreFS.SA06.CoreUserInfo.UserInfo .GetUserName(), out errMsg); if (errMsg.Length > 0) { } else { Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); } this.Query01(); } public override void Export() { Core.StlMes.Client.Sale.Util.UtilUltraGrid.ExportGridDataToExcel(this.Text, this.ultraGrid1); } // 保存运费 public override void Add() { if (this.ultraGrid3.Rows.Count == 0) return; Infragistics.Win.UltraWinGrid.UltraGridRow ugs = this.ultraGrid1.ActiveRow; if(ugs == null ) return; if(ugs.Cells["TRANSMNY_TICKET_STATUS"].Value.ToString() == "已对齐" || ugs.Cells["TRANSMNY_TICKET_STATUS"].Value.ToString() == "发送结算") { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("运费已经确认或结算接收,不允许保存"); return; } this.ultraGrid3.UpdateData(); string errMsg = ""; string err = ""; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid3.Rows) { if (ugr.Cells[this.SELECT].Value.ToString().ToUpper() == "TRUE") { if (ugr.Cells["TICKETTYPE"].Value.ToString() == "无") continue; string billno = this.ultraGrid1.ActiveRow.Cells[this.BILL_NO].Value.ToString(); string transmoney = ugr.Cells[TRANSMNY].Value.ToString(); string stampDutyMoney = ugr.Cells["STAMP_DUTY_MONEY"].Value.ToString(); string tickettype = ugr.Cells["TICKETTYPE"].Value.ToString(); string agencyfl = ugr.Cells["AGENCY_FL"].Value.ToString(); string disburasesbill = ugr.Cells["DISBURASES_BILL"].Value.ToString(); string transNo = ugr.Cells["TRANS_NO"].Value.ToString(); string delvaddr = ""; // string delvaddr = ugr.Cells["DELVRY_ADDR"].Value.ToString(); //string ordpk = ugr.Cells["ORD_PK"].Value.ToString(); //string ordLnPk = ugr.Cells["ORD_LN_PK"].Value.ToString(); //string ordLndPk = ugr.Cells["ORD_LN_DLY_PK"].Value.ToString(); //string indexNo = ugr.Cells["INDEX_SEQ"].Value.ToString(); string ordpk = ""; string ordLnPk = ""; string ordLndPk = ""; string indexNo = ""; this.slmBalanceInfo.SaveTransMoneyWithAlineTicket(billno, transmoney,tickettype,agencyfl,delvaddr,ordpk,ordLnPk,ordLndPk,indexNo, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), "0", disburasesbill, transNo, stampDutyMoney, out errMsg); if (errMsg.Length > 0) { return; } } } Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功"); QueryGrid3(); } // 发送结算 public override void Send1() { if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) this.ultraGrid1.Rows[0].Activated = true; Infragistics.Win.UltraWinGrid.UltraGridRow ugr1 = null; ugr1 = this.ultraGrid1.ActiveRow; if (ugr1 == null) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要发送的行"); return; } string errMsg = ""; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows) { string billck = (ugr.Cells[this.BILL_TICKET_STATUS].Value.ToString() == "已对齐") ? "1" : "0"; string outck = (ugr.Cells[this.OUTSTOCK_TICKET_STATUS].Value.ToString() == "已对齐" || ugr.Cells[this.OUTSTOCK_TICKET_STATUS].Value.ToString() == "OK" ) ? "1" : "0"; string transck = (ugr.Cells[this.TRANSMNY_TICKET_STATUS].Value.ToString() == "已对齐" || ugr.Cells[this.TRANSMNY_TICKET_STATUS].Value.ToString() == "OK" ) ? "1" : "0"; this.ydmZcLoadVehicleMatMgt.AcceptTicketBySendTicketToInvoice(ugr.Cells[this.BILL_NO].Value.ToString(), GetoutStockMny(ugr.Cells[this.BILL_NO].Value.ToString()), ugr.Cells[this.LOADVEHICLE_TYPE].Value.ToString(), billck, outck, transck, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg ); if (errMsg.Length > 0) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError(ugr.Cells[this.BILL_NO].Value.ToString() + "发送失败!" + errMsg); return; } } if (errMsg.Length == 0) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("发送成功"); } this.Query01(); } public override void Send() { if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) this.ultraGrid1.Rows[0].Activated = true; Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; ugr = this.ultraGrid1.ActiveRow; if (ugr == null) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要发送的行"); return; } string errMsg = ""; string billck = (ugr.Cells[this.BILL_TICKET_STATUS].Value.ToString() == "已对齐") ? "1" : "0"; string outck = (ugr.Cells[this.OUTSTOCK_TICKET_STATUS].Value.ToString() == "已对齐" || ugr.Cells[this.OUTSTOCK_TICKET_STATUS].Value.ToString() == "OK" ) ? "1" : "0"; string transck = (ugr.Cells[this.TRANSMNY_TICKET_STATUS].Value.ToString() == "已对齐" || ugr.Cells[this.TRANSMNY_TICKET_STATUS].Value.ToString() == "OK" ) ? "1" : "0"; this.ydmZcLoadVehicleMatMgt.AcceptTicketBySendTicketToInvoice(ugr.Cells[this.BILL_NO].Value.ToString(), GetoutStockMny(ugr.Cells[this.BILL_NO].Value.ToString()), ugr.Cells[this.LOADVEHICLE_TYPE].Value.ToString(), billck, outck, transck, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg ); if (errMsg.Length == 0) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("发送成功"); } this.Query01(); } public override void UnSend() { if (this.ultraGrid1.Rows.Count == 0) return; if (this.ultraGrid1.Rows.Count == 1) this.ultraGrid1.Rows[0].Activated = true; Infragistics.Win.UltraWinGrid.UltraGridRow ugr = null; ugr = this.ultraGrid1.ActiveRow; if (ugr == null) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要发送的行"); return; } this.ultraGrid1.UpdateData(); string errMsg = ""; string billck = "0"; string outck = "0"; string transck = "0"; if (ugr.Cells[this.BILL_CK].Value.ToString().ToUpper() == "TRUE" && ugr.Cells[this.BILL_TICKET_STATUS].Value.ToString() == "发送结算") { billck = "1"; } if (ugr.Cells[this.OUTSTOCK_CK].Value.ToString().ToUpper() == "TRUE" && ( ugr.Cells[this.OUTSTOCK_TICKET_STATUS].Value.ToString() == "发送结算" || ugr.Cells[this.OUTSTOCK_TICKET_STATUS].Value.ToString() == "OK") ) { outck = "1"; } if (ugr.Cells[this.TRANSMNY_CK].Value.ToString().ToUpper() == "TRUE" && (ugr.Cells[this.TRANSMNY_TICKET_STATUS].Value.ToString() == "发送结算" || ugr.Cells[this.TRANSMNY_TICKET_STATUS].Value.ToString() == "OK") ) { transck = "1"; } this.ydmZcLoadVehicleMatMgt.RollBackTicketBySendTicketToInvoice(ugr.Cells[this.BILL_NO].Value.ToString(), ugr.Cells[this.LOADVEHICLE_TYPE].Value.ToString(), billck, outck, transck, CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(), out errMsg ); if (errMsg.Length == 0) { Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("取消发送成功"); } this.Query01(); } private System.Collections.ArrayList GetoutStockMny(string billno) { System.Collections.ArrayList list = new System.Collections.ArrayList(); if (this.ultraGrid2.Rows.Count == 0) return list; string[] temp = null; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid2.Rows) { if (ugr.Cells["TICKETYPE"].Value.ToString() == "无" || Core.StlMes.Client.Sale.Util.ConverObject.ConvertToDouble (ugr.Cells["OUTSTOCKMNY"].Value) == 0) continue; string billNo = billno; string ORD_PK = 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 AGENCY_FL = ugr.Cells["AGENCY_FL"].Value.ToString(); string ORDER_NO = ugr.Cells["ORDERNO"].Value.ToString().Split('/')[0]; string ORDER_SEQ = ugr.Cells["ORDERNO"].Value.ToString().Split('/')[1]; string DELVRY_ADDR = ugr.Cells["DELVRY_ADDR"].Value.ToString(); string TRANS_TYPE = ugr.Cells["TRANS_TPE"].Text; string MOTORMANNAME = this.ultraGrid1.ActiveRow.Cells["CARRY_COMPANY_NAME"].Value.ToString(); string money = ugr.Cells["OUTSTOCKMNY"].Value.ToString(); string moneytype = ugr.Cells["TICKETYPE"].Value.ToString(); string weight = ugr.Cells["WEIGHT"].Value.ToString(); // temp = new string[] { billNo, ORD_PK, ORD_LN_PK, ORD_LN_DLY_PK, AGENCY_FL, ORDER_NO, ORDER_SEQ ,DELVRY_ADDR,TRANS_TYPE,MOTORMANNAME,money,moneytype,weight }; list.Add(temp); } return list; } private System.Collections.Generic.List< string[]> GetDataStructCaption() { List list = new List(); list.Add(new string[] { CREATE_TIME ,"创建时间"}); list.Add(new string[] { BILL_TICKET_STATUS, "货款状态" }); list.Add(new string[] { OUTSTOCK_TICKET_STATUS, "出库费状态" }); list.Add(new string[] { TRANSMNY_TICKET_STATUS, "运费状态" }); list.Add(new string[] { BILL_NO, "提单号" }); list.Add(new string[] { LOADVEHICLE_TYPE, "提单类型" }); list.Add(new string[] { CUSTOMER_NM, "订货单位" }); list.Add(new string[] { RECEIV_NM, "收货单位" }); list.Add(new string[] { CARRY_COMPANY_NAME, "承运公司" }); list.Add(new string[] { ACT_COUNT, "支数" }); list.Add(new string[] { ACT_WEIGHT, "重量" }); list.Add(new string[] { SEND_NUM, "实发数" }); list.Add(new string[] { "BILL_CK", "货款" }); list.Add(new string[] { "OUTSTOCK_CK", "出库费" }); list.Add(new string[] { "TRANSMNY_CK", "运费" }); list.Add(new string[] { "ORDERNO", "合同号" }); list.Add(new string[] { "JUDGE_STOVE_NO", "炉号" }); list.Add(new string[] { "BATCH_NO", "批号" }); list.Add(new string[] { "AGENCY_FL", "是否代办" }); list.Add(new string[] { "DELVRY_ADDR", "交货地点" }); list.Add(new string[] { "TRANS_TPE", "出厂方式" }); list.Add(new string[] { "TICKETYPE", "票据类型" }); list.Add(new string[] { "OUTSTOCKMNY", "费用" }); list.Add(new string[] { "TKP", "付费标志" }); list.Add(new string[] { "INDEX_SEQ", "序号" }); list.Add(new string[] { "DESTINATION", "目的地" }); list.Add(new string[] { "SPCL_LN_NM", "专用线" }); list.Add(new string[] { "STATION_NM", "到站" }); list.Add(new string[] { SELECT, "选择" }); list.Add(new string[] { TRANSMNY, "运费" }); list.Add(new string[] { "STAMP_DUTY_MONEY", "印花税" }); list.Add(new string[] { "RECEIV_ADDR", "指定地点" }); list.Add(new string[] { "TICKETTYPE", "单据类型" }); list.Add(new string[] { "VIRSTS", "虚单理货状态" }); list.Add(new string[] { "PLINE_NAME", "产线" }); list.Add(new string[] { "QUANTITY", "提单支数" }); list.Add(new string[] { "WEIGHT", "提单重量" }); list.Add(new string[] { "INVOICEDATE", "打印时间" }); list.Add(new string[] { "MANAGEMENT_NAME", "区域" }); list.Add(new string[] { "SALE_ORG_DESC", "销售组织" }); list.Add(new string[] { "SUPPLY_UNIT_DESC", "制造商" }); list.Add(new string[] { "DISBURASES_BILL", "代垫单号" }); list.Add(new string[] { "TRANS_NO", "运费发票号" }); list.Add(new string[] { "TRANS_AREA", "出库地点" }); return list; } private string[] GetDataStructMain() { return new string[] { this.BILL_CK, this.OUTSTOCK_CK, this.TRANSMNY_CK, CREATE_TIME, "INVOICEDATE", BILL_TICKET_STATUS, OUTSTOCK_TICKET_STATUS, TRANSMNY_TICKET_STATUS, BILL_NO, LOADVEHICLE_TYPE, "VIRSTS", CUSTOMER_NO, CUSTOMER_NM, RECEIV_NO, RECEIV_NM, "MANAGEMENT_NAME", CARRY_COMPANY_CODE, CARRY_COMPANY_NAME, ACT_COUNT, ACT_WEIGHT, "QUANTITY", "WEIGHT", SEND_NUM, "TRANS_TPE", LOADVEHICLE_TYPE, BILL_STATUS, "TRANS_AREA", "SALE_ORG_DESC", "SUPPLY_UNIT_DESC" }; } private string[] GetGrid2DataStruct() { return new string[] { "ORDERNO", "JUDGE_STOVE_NO", "BATCH_NO", "PLINE_NAME", "QUANTITY", "WEIGHT", "ORD_PK", "ORD_LN_PK", "ORD_LN_DLY_PK", "AGENCY_FL", "DELVRY_ADDR", "TRANS_TPE", "TICKETYPE", "OUTSTOCKMNY", "TKP" }; } private string[] GetGrid3DataStruct() { return new string[] { SELECT, TRANSMNY, "STAMP_DUTY_MONEY", "TICKETTYPE", // "INDEX_SEQ", "AGENCY_FL", "DISBURASES_BILL", "TRANS_NO" //"TRANSIT_TYP", //"DESTINATION", //"STATION_NM", //"SPCL_LN_NM", //"DELVRY_ADDR" , //"RECEIV_ADDR", //"ORD_PK", // "ORD_LN_PK", // "ORD_LN_DLY_PK" }; } private string CREATE_TIME = "CREATE_TIME"; private string CUSTOMER_NO = "CUSTOMER_NO"; private string CUSTOMER_NM = "CUSTOMER_NM"; private string RECEIV_NO = "RECEIV_NO"; private string RECEIV_NM = "RECEIV_NM"; private string CARRY_COMPANY_CODE = "CARRY_COMPANY_CODE"; private string CARRY_COMPANY_NAME = "CARRY_COMPANY_NAME"; private string ACT_COUNT = "ACT_COUNT"; private string ACT_WEIGHT = "ACT_WEIGHT"; private string BILL_NO = "BILL_NO"; private string SEND_NUM = "SEND_NUM"; private string LOADVEHICLE_TYPE = "LOADVEHICLE_TYPE"; private string BILL_TICKET_STATUS = "BILL_TICKET_STATUS"; private string OUTSTOCK_TICKET_STATUS = "OUTSTOCK_TICKET_STATUS"; private string TRANSMNY_TICKET_STATUS = "TRANSMNY_TICKET_STATUS"; private string BILL_CK = "BILL_CK"; private string OUTSTOCK_CK = "OUTSTOCK_CK"; private string TRANSMNY_CK = "TRANSMNY_CK"; private string ORD_PK = "ORD_PK"; private string ORD_LN_PK = "ORD_LN_PK"; private string ORD_LN_DLY_PK = "ORD_LN_DLY_PK"; private string SELECT = "SELECT"; private string TRANSMNY = "TRANSMNY"; private string BILL_STATUS = "BILL_STATUS"; private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { this.QueryGrid2(); QueryGrid3(); } private void textBox7_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { this.Query(); } } private void uchkDate_CheckedChanged(object sender, EventArgs e) { if (uchkDate.Checked) { dateTimePicker3.Enabled = true; dateTimePicker4.Enabled = true; } else { dateTimePicker3.Enabled = false; dateTimePicker4.Enabled = false; } } } }