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; using CoreFS.CA06; using Core.StlMes.Client.YdmBase; using Core.Mes.Client.Comm.Tool; using System.Collections; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; using Core.StlMes.Client.PipeLeaveFactory.YdmObject; using Core.Mes.Client.Comm.Format; using com.steering.pss.ydm.entity; using Core.StlMes.Client.PipeLeaveFactory.Tool; using Core.StlMes.Client.SaleOrder.ReviewForm; using Core.StlMes.Client.YdmPipeManage; using Infragistics.Win.UltraWinEditors; using Core.StlMes.Client.PipeLeaveFactory.Dialog; namespace Core.StlMes.Client.PipeLeaveFactory { public partial class frmPipeTrainBill : FrmBase { /// /// 销售权限 /// private string[] _salgPersion = null; /// /// 提示信息 /// private string errMessage = ""; ArrayList pram = new ArrayList(); private string _sendPlanNo = ""; private string _ordLnDlyPk = ""; private string _ordLnDlyPkSoure = ""; private string _billNo = ""; private string departid;//对应部门ID private string departname;//对应部门 private string management_no;//对应科室id private string management_name;//对应科室 public frmPipeTrainBill() { InitializeComponent(); this.IsLoadUserView = true; } UltraComboEditor uceVstel = new UltraComboEditor();//装车地点 UltraComboEditor uceStorag = new UltraComboEditor();//出库地点 UltraComboEditor uceLoad = new UltraComboEditor(); UltraComboEditor uceDelvryN = new UltraComboEditor();//发货去向 private void frmPipeTrainBill_Load(object sender, EventArgs e) { _salgPersion = BaseHelper.InitPermissions(this.ValidDataPurviewIds, this.ob); BaseHelper.setOtherColumnReadOnly(ultraGridSendPlan, new string[] { "" }); BaseHelper.setOtherColumnReadOnly(ultraGridOrder, new string[] { "" }); BaseHelper.setOtherColumnReadOnly(ultraGridSourse, new string[] { "CHC", "ActCount", "Vstel", "SendNum" }); BaseHelper.setOtherColumnReadOnly(ultraGridBillM, new string[] { "CHC", "DelvryWhereabouts", "Realinvoiceno1" }); BaseHelper.setOtherColumnReadOnly(ultraGridBillC, new string[] { "CANCELDOWN", "StorageNo", "CHK", "Vstel" }); EntityHelper.ShowGridCaption(ultraGridSourse.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridBillM.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridBillC.DisplayLayout.Bands[0]); //EntityHelper.ShowGridCaption(ultraGridPipeMat.DisplayLayout.Bands[0]); BillBtime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); BillEtime.Value = DateTime.Parse(DateTime.Now.AddDays(10).ToString("yyyy-MM-dd")); DateTime now = DateTime.Now; DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天 DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天 billNoStime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); BillNoEtime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); YdmBaseClass.SetComboItemHeight(ComStatus); YdmBaseClass.SetComboItemHeight(ComBillStratus); BaseHelper.InitCellPosition(ultraGridSendPlan, new string[] { "PLAN_WT" }); BaseHelper.InitCellPosition(ultraGridOrder, new string[] { "PREP_WT", "PLAN_WT", "WGT_ESTMT" }); BaseHelper.InitCellPosition(ultraGridSourse, new string[] { "ActCount", "ActWeight", "YbCount", "YbWeight", "KcCount", "KcWeight", "ActLen", "YbLen", "KcLen", "SendNum" }); BaseHelper.InitCellPosition(ultraGridBillM, new string[] { "PlanWt", "PlanNum", "PlanTotlLen", "SendNum" }); BaseHelper.InitCellPosition(ultraGridBillC, new string[] { "ActHeight", "ActDimater", "ActLenMin1", "ActLenMax1", "ActCount", "ActWeight", "PrepWeight", "PrepCount", "BeenCount", "BeenWeight", "PrepLen", "BeenLen", "ActLen", "SendNum" }); DoInitComDrop(); BaseHelper.setUltraGridColumnColor(ultraGridSourse, new string[] { "ActCount", "Vstel", "ActLen", "SendNum" }, Color.FromArgb(255, 255, 192)); BaseHelper.InitYear(ComYear); BaseHelper.InitMonth(ComMonth); ComYear.Value = DateTime.Now.Year.ToString(); ComMonth.Value = string.Format("{0:00}", DateTime.Now.Month); BaseHelper.setUltraGridColumnMaxInput(ultraGridSendPlan, new string[] { "PLAN_WT" }); BaseHelper.setUltraGridColumnMaxInput(ultraGridOrder, new string[] { "PLAN_WT", "PREP_WT", "WGT_ESTMT" }); BaseHelper.setUltraGridColumnMaxInput(ultraGridSourse, new string[] { "ActWeight", "YbWeight", "KcWeight", "SendNum" }); DivideInterface(CustomInfo); BaseHelper.setUltraGridColumnMaxInput(ultraGridBillM, new string[] { "PlanWt" }); BaseHelper.setUltraGridColumnMaxInput(ultraGridBillC, new string[] { "ActWeight", "PrepWeight", "BeenWeight", "SendNum" }); //长度 BaseHelper.setUltraGridColumnMaxInputLen(ultraGridSourse, new string[] { "ActLen", "YbLen", "KcLen" }); BaseHelper.setUltraGridColumnMaxInputLen(ultraGridBillM, new string[] { "PlanTotlLen", "SendNum" }); BaseHelper.setUltraGridColumnMaxInputLen(ultraGridBillC, new string[] { "PrepLen", "BeenLen", "ActLen" }); //统计字段(吨) BaseHelper.GridColumnSum(ultraGridOrder, new string[] { "PLAN_WT", "PREP_WT", "WGT_ESTMT" }); BaseHelper.GridColumnSum(ultraGridSourse, new string[] { "ActWeight", "KcWeight", "YbWeight", "SendNum" }); BaseHelper.GridColumnSum(ultraGridBillM, new string[] { "PlanWt", "SendNum" }); BaseHelper.GridColumnSum(ultraGridBillC, new string[] { "ActWeight", "PrepWeight", "BeenWeight", "SendNum" }); BaseHelper.GridColumnSum(ultraGridSendPlan, new string[] { "PLAN_WT" }); //统计字段(支) BaseHelper.GridColumnCount(ultraGridSourse, new string[] { "ActCount", "KcCount", "YbCount" }); BaseHelper.GridColumnCount(ultraGridBillM, new string[] { "PlanNum" }); BaseHelper.GridColumnCount(ultraGridBillC, new string[] { "ActCount", "PrepCount", "BeenCount" }); //统计字段(长度) BaseHelper.GridColumnCountLen(ultraGridSourse, new string[] { "ActLen", "YbLen", "KcLen" }); BaseHelper.GridColumnCountLen(ultraGridBillM, new string[] { "PlanTotlLen" }); BaseHelper.GridColumnCountLen(ultraGridBillC, new string[] { "PrepLen", "BeenLen", "ActLen" }); YdmBaseClass.InitComboEditor(uceVstel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false); YdmBaseClass.BindColumn(uceVstel, "Vstel", this.Controls, this.ultraGridSourse, 0); YdmBaseClass.InitComboEditor(uceStorag, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false); YdmBaseClass.BindColumn(uceStorag, "StorageNo", this.Controls, this.ultraGridBillC, 0); YdmBaseClass.InitComboEditor(uceLoad, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false); YdmBaseClass.BindColumn(uceLoad, "Vstel", this.Controls, this.ultraGridBillC, 0); YdmBaseClass.InitComboEditor(uceDelvryN, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false); YdmBaseClass.BindColumn(uceDelvryN, "DelvryWhereabouts", this.Controls, this.ultraGridBillM, 0); management_no = this.UserInfo.GetDeptid(); management_name = this.UserInfo.GetDepartment(); departid = ClsBaseInfo.GetDepartIdBySectionId(UserInfo.GetDeptid(), this.ob); departname = ClsBaseInfo.GetDepartBySectionId(UserInfo.GetDeptid(), this.ob); } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": DoQuery(); break; case "Add": DoAddBill(); break; case "Update": DoDelete(); break; case "Down": DoDown(); break; case "Refresh": DoInitComDrop(); break; case "Export": Export(); break; case "CancelDown": CancelDown(); break; case "BillDrawOff": BillDrawOff(); break; case "CancelBillDrawOff": CancelBillDrawOff(); break; case "Print": Print(); break; case "UpdateStoage": doUpdateStoage();//修改出库地点 break; case "UpdateLoad": doUpdateLoad();//修改装车地点 break; case "BillOut": doBillOut(); break; case "DeleteBillOut": doDeleteBillOut();//撤销出库 break; case "UpdateDelvryWhereabouts": UpdateDelvryWhereabouts();//修改发货去向 break; case "UpdateRealinvoiceno1": UpdateRealinvoiceno1();//修改结算状态 break; case "Close": this.Close(); break; } } private void UpdateRealinvoiceno1() { ultraGridBillC.UpdateData(); ultraGridBillM.UpdateData(); UltraGridRow ugr1 = ultraGridBillM.ActiveRow; if (ugr1 == null) return; int count = 0; ArrayList list1 = new ArrayList(); foreach (UltraGridRow row in ultraGridBillM.Rows) { if (Convert.ToBoolean(row.Cells["CHC"].Text) == true) { if (row.Cells["saleOrg"].Text != "100102") { MessageUtil.ShowTips("请选择要国际贸易部的提单!"); return; } count += 1; ArrayList list = new ArrayList(); list.Add(row.Cells["BillNo"].Value.ToString()); list.Add(row.Cells["Realinvoiceno1"].Text); list1.Add(list); } } if (count == 0) { MessageUtil.ShowTips("请选择要修改提单信息!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否修改结算状态") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp.MethodName = "UpdateRealinvoiceno1"; ccp.ServerParams = new object[] { list1 }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; if (ccp.ReturnInfo.Equals("修改成功!")) { DoQuery(); } } /// /// 修改发货去向 /// private void UpdateDelvryWhereabouts() { ultraGridBillC.UpdateData(); ultraGridBillM.UpdateData(); UltraGridRow ugr1 = ultraGridBillM.ActiveRow; if (ugr1 == null) return; int count = 0; ArrayList list1 = new ArrayList(); foreach (UltraGridRow row in ultraGridBillM.Rows) { if (Convert.ToBoolean(row.Cells["CHC"].Text) == true) { count += 1; ArrayList list = new ArrayList(); list.Add(row.Cells["BillNo"].Value.ToString()); list.Add(row.Cells["DelvryWhereabouts"].Text); list1.Add(list); } } if (count == 0) { MessageUtil.ShowTips("请选择要修改提单信息!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否修改发货去向") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp.MethodName = "UpdateDelvryWhereabouts"; ccp.ServerParams = new object[] { list1 }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; if (ccp.ReturnInfo.Equals("修改成功!")) { DoQuery(); } } private void Export() { if (ultraTabControl1.SelectedTab.Key.Equals("0")) { GridHelper.ulGridToExcel(ultraGridSendPlan, "计划信息"); } else { int count = 0; List _billNo = new List(); foreach (UltraGridRow ugr in ultraGridBillM.Rows) { if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true) { count += 1; _billNo.Add(ugr.Cells["BillNo"].Text.Trim()); } } if (count == 0) { MessageUtil.ShowTips("请选择需要导出的提单!"); return; } FrmBillDiaLog fpdc = new FrmBillDiaLog(_billNo.ToArray(), ob); fpdc.AutoSize = true; fpdc.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fpdc.Text = "导出提单信息"; fpdc.ShowDialog(); } } /// /// 绑定下拉框数据 /// private void DoInitComDrop() { //订货单位 BaseHelper.InitOrderUnit(ComRecive, _salgPersion, this.ob); BaseHelper.InitOrderUnit(ComReceiv1, _salgPersion, this.ob); //收货单位 BaseHelper.InitReceivingUnit(ComCustomer, _salgPersion, this.ob); BaseHelper.InitReceivingUnit(ComCustomer1, _salgPersion, this.ob); //专用线 YdmBaseClass.InitComboEditor(ComSpcl1, "com.steering.pss.ydm.pipeleavefactory.FrmPipeSendList.queryPrivateSid", "SPCL_LN_NO", ob, false); YdmBaseClass.InitComboEditor(ComSpcl, "com.steering.pss.ydm.pipeleavefactory.FrmPipeSendList.queryPrivateSid", "SPCL_LN_NO", ob, false); //到站 YdmBaseClass.InitComboEditor(ComStation1, "com.steering.pss.ydm.pipeleavefactory.FrmPipeSendList.queryArriveStation", "STATION_NO", ob, false); YdmBaseClass.InitComboEditor(ComStation, "com.steering.pss.ydm.pipeleavefactory.FrmPipeSendList.queryArriveStation", "STATION_NO", ob, false); } /// /// Checkbox 选择事件 /// /// /// private void Chc_CheckedChanged(object sender, EventArgs e) { //发运计划 if (ChcApplyTime.Checked) { ComYear.Enabled = true; ComMonth.Enabled = true; } else { ComYear.Enabled = false; ComMonth.Enabled = false; } if (ChcOrderNo.Checked) { TxtOrderNo.Enabled = true; } else { TxtOrderNo.Enabled = false; } if (ChcPlanNo.Checked) { TxtPlanNo.Enabled = true; } else { TxtPlanNo.Enabled = false; } if (ChcStation.Checked) { ComStation.Enabled = true; } else { ComStation.Enabled = false; } if (ChcSpcl.Checked) { ComSpcl.Enabled = true; } else { ComSpcl.Enabled = false; } if (ChcRecive.Checked) { ComRecive.Enabled = true; } else { ComRecive.Enabled = false; } if (ChcCustomer.Checked) { ComCustomer.Enabled = true; } else { ComCustomer.Enabled = false; } if (ChcStatus.Checked) { ComStatus.Enabled = true; } else { ComStatus.Enabled = false; } if (ChcBillNo.Checked) { TxtBillNo.Enabled = true; } else { TxtBillNo.Enabled = false; } //提单 if (ChcBillTime.Checked) { billNoStime.Enabled = true; BillNoEtime.Enabled = true; } else { billNoStime.Enabled = false; BillNoEtime.Enabled = false; } if (ChcBillNo1.Checked) { TxtBillNo1.Enabled = true; } else { TxtBillNo1.Enabled = false; } if (ChcPlanNo1.Checked) { TxtPlanNo1.Enabled = true; } else { TxtPlanNo1.Enabled = false; } if (ChcReceiv1.Checked) { ComReceiv1.Enabled = true; } else { ComReceiv1.Enabled = false; } if (ChcSpcl1.Checked) { ComSpcl1.Enabled = true; } else { ComSpcl1.Enabled = false; } if (ChkStation1.Checked) { ComStation1.Enabled = true; } else { ComStation1.Enabled = false; } if (ChcCustomer1.Checked) { ComCustomer1.Enabled = true; } else { ComCustomer1.Enabled = false; } if (ChcOrderNo1.Checked) { TxtOrderNo1.Enabled = true; } else { TxtOrderNo1.Enabled = false; } if (ChcBillStatus.Checked) { ComBillStratus.Enabled = true; } else { ComBillStratus.Enabled = false; } if (ChcReceiv1.Checked) { ComReceiv1.Enabled = true; } else { ComReceiv1.Enabled = false; } } /// /// 初始化提单号 /// /// 计划号 private void InitBillNo(string sendPlanNo) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getBillNoBySendPlanNo", new object[] { sendPlanNo, "110502" }, this.ob); DataRow dr = dt.NewRow(); dr["BILL_NO"] = ""; dr["BILL_NO"] = ""; dt.Rows.Add(dr); ComBillNo.DataSource = dt; ComBillNo.DisplayMember = "BILL_NO"; ComBillNo.ValueMember = "BILL_NO"; } /// /// 发运计划查询条件 /// /// private ArrayList QuerySendPlanCondition() { ArrayList param = new ArrayList(); string applytime = ""; string orderNo = ""; string sendPlanNo = ""; string station = ""; string spcl = ""; string reciveName = ""; string customerName = ""; string billNo = ""; string status = ""; if (ChcApplyTime.Checked && ComYear.Value != null && ComMonth.Value != null) { applytime = ComYear.Value.ToString() + ComMonth.Value.ToString(); } if (ChcOrderNo.Checked) { orderNo = TxtOrderNo.Text.Trim(); } if (ChcPlanNo.Checked) { sendPlanNo = TxtPlanNo.Text.Trim(); } if (ChcStation.Checked && ComStation.Value != null) { station = ComStation.Value.ToString(); } if (ChcSpcl.Checked && ComSpcl.Value != null) { spcl = ComSpcl.Value.ToString(); } if (ChcRecive.Checked) { reciveName = ComRecive.Text.Trim(); } if (ChcCustomer.Checked) { customerName = ComCustomer.Text.Trim(); } if (ChcBillNo.Checked) { billNo = TxtBillNo.Text.Trim(); } if (ChcStatus.Checked && ComStatus.Value != null) { status = ComStatus.Value.ToString().Trim(); } if (!ChcApplyTime.Checked && orderNo.Equals("") && sendPlanNo.Equals("") && station.Equals("") && spcl.Equals("") && reciveName.Equals("") && customerName.Equals("") && status.Equals("") && billNo.Equals("")) { errMessage = "请至少选择一个查询条件!"; return null; } param.Add(applytime); param.Add(orderNo); param.Add(sendPlanNo); param.Add(station); param.Add(spcl); param.Add(reciveName); param.Add(customerName); param.Add(billNo); param.Add(status); return param; } /// /// 查询发运计划 /// private void QuerySendPlan() { ArrayList param = QuerySendPlanCondition(); if (param == null) { MessageUtil.ShowTips(errMessage); return; } DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.querySendPlan", new object[] { param, this.ValidDataPurviewIds }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); if (dt.Rows.Count == 0) { GridHelper.ClearGridDataSourceData(ultraGridOrder); GridHelper.ClearGridDataSourceData(ultraGridSourse); } } /// /// 查询合同信息 /// /// 计划号 /// 日计划号 private void QueryOrderInfo(string sendPlanNo) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.queryOrderInfo", new object[] { sendPlanNo }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); } /// /// 查询仓库资源信息 /// /// 合同主键 /// 合同行主键 /// 交货行主键 private void QuerySourse(UltraGridRow row,string ordPk, string ordLnPk, string ordLnDlyPk) { List listSourse = EntityHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.querySourse", new object[] { ordPk, ordLnPk, ordLnDlyPk }, this.ob); matInfoEntityBindingSource.DataSource = listSourse; UltraGridColumn[] col = new UltraGridColumn[] { ultraGridSourse.DisplayLayout.Bands[0].Columns["StdName"], ultraGridSourse.DisplayLayout.Bands[0].Columns["CHC"], ultraGridSourse.DisplayLayout.Bands[0].Columns["ActCount"], ultraGridSourse.DisplayLayout.Bands[0].Columns["YbCount"],ultraGridSourse.DisplayLayout.Bands[0].Columns["Vstel"] }; GridHelper.RefreshAndAutoSizeExceptColumns(ultraGridSourse, col); foreach (UltraGridRow ugr in ultraGridSourse.Rows) { ugr.Cells["Vstel"].Value = ugr.Cells["StorageNo"].Value.ToString(); } if (row.Cells["ORDER_UNIT"].Text.Equals("米") || row.Cells["ORDER_UNIT"].Text.Equals("英尺")) { foreach (UltraGridRow ugr1 in ultraGridSourse.Rows) { ugr1.Cells["SendNum"].Value = ugr1.Cells["ActLen"].Value.ToString(); ugr1.Cells["SendNum"].Appearance.BackColor = Color.FromArgb(255, 255, 192); ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.None; ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; } } else if (row.Cells["ORDER_UNIT"].Text.Equals("支") || row.Cells["ORDER_UNIT"].Text.Equals("个")) { foreach (UltraGridRow ugr1 in ultraGridSourse.Rows) { ugr1.Cells["SendNum"].Value = ugr1.Cells["ActCount"].Value.ToString(); ugr1.Cells["SendNum"].Appearance.BackColor = Color.Transparent; ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.Default; ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; } } else { foreach (UltraGridRow ugr1 in ultraGridSourse.Rows) { ugr1.Cells["SendNum"].Appearance.BackColor = Color.Transparent; ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.Default; ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; ugr1.Cells["SendNum"].Value = ugr1.Cells["ActWeight"].Value.ToString(); } } } /// /// 查询 /// private void DoQuery() { if (ultraTabControl1.SelectedTab.Key.Equals("0")) { if (!ValidQuery()) return; QuerySendPlan(); } else { if (!ValidQuery1()) return; QueryBillMInfo(); } } private void ultraGridSendPlan_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = ultraGridSendPlan.ActiveRow; if (ugr == null) { ComBillNo.DataSource = null; return; } else { string sendPlanNo = ugr.Cells["SEND_PLAN_NO"].Text; QueryOrderInfo(sendPlanNo); InitBillNo(sendPlanNo); BaseHelper.UltraGridLocation(ultraGridOrder, new string[] { "ORD_LN_DLY_PK" }, new string[] { _ordLnDlyPk }); _ordLnDlyPk = ""; } PraFlag.Checked = false; } private void ultraGridOrder_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = ultraGridOrder.ActiveRow; if (ugr == null) { return; } else { if (ultraGridSendPlan.ActiveRow.Cells["SUPPLY_UNIT"].Value.ToString() != "120504") { ChcVirtual.Checked = false; if (!string.IsNullOrWhiteSpace(ugr.Cells["OUTBOUND_CALCULATE"].Text.ToString2())) { PraFlag.Enabled = false; if (!ugr.Cells["OUTBOUND_CALCULATE"].Text.ToString2().Equals("0")) { PraFlag.Checked = true; } } else { PraFlag.Enabled = true; PraFlag.Checked = false; } } string ordPk = ugr.Cells["ORD_PK"].Text; string ordLnPk = ugr.Cells["ORD_LN_PK"].Text; string ordLnDlyPk = ugr.Cells["ORD_LN_DLY_PK"].Text; //if (!ugr.Cells["PRD_CLS"].Text.Equals("405005"))//判断是否坯子 //{ ultraGridPipeMat.Visible = false; ultraGridSourse.Visible = true; QuerySourse(ugr, ordPk, ordLnPk, ordLnDlyPk); BaseHelper.UltraGridLocation(ultraGridSourse, new string[] { "OrdLnDlyPk" }, new string[] { _ordLnDlyPkSoure }); //} //else //{ // ultraGridPipeMat.Visible = true; // ultraGridSourse.Visible = false; // QueryPipeMat(ugr, ordLnDlyPk); // BaseHelper.UltraGridLocation(ultraGridPipeMat, new string[] { "OrdLnDlyPk" }, new string[] { _ordLnDlyPkSoure }); //} _ordLnDlyPkSoure = ""; } ultraGroupBox4.Text = "资源信息区"; } /// /// 查询管坯库存 /// /// /// private void QueryPipeMat(UltraGridRow row, string ordLnDlyPk) { EntityHelper.ShowGridCaption(ultraGridPipeMat.DisplayLayout.Bands[0]); YdmBaseClass.InitComboEditor(uceVstel, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false); YdmBaseClass.BindColumn(uceVstel, "Vstel", this.Controls, this.ultraGridPipeMat, 0); BaseHelper.setUltraGridColumnMaxInput(ultraGridPipeMat, new string[] { "ActWeight", "YbWeight", "KcWeight", "SendNum" }); List listSourse = EntityHelper.GetData("com.steering.pss.ydm.acasleavefactory.CoreCasCarBill.queryPipeMat", new object[] { ordLnDlyPk }, this.ob); pipeMatGpMbindingSource.DataSource = listSourse; UltraGridColumn[] col = new UltraGridColumn[] {ultraGridPipeMat.DisplayLayout.Bands[0].Columns["CHK"], ultraGridPipeMat.DisplayLayout.Bands[0].Columns["ActCount"], ultraGridPipeMat.DisplayLayout.Bands[0].Columns["YbCount"],ultraGridPipeMat.DisplayLayout.Bands[0].Columns["Vstel"] }; GridHelper.RefreshAndAutoSizeExceptColumns(ultraGridPipeMat, col); foreach (UltraGridRow ugr in ultraGridPipeMat.Rows) { ugr.Cells["Vstel"].Value = ugr.Cells["StorageNo"].Value.ToString(); } if (row.Cells["ORDER_UNIT"].Text.Equals("米") || row.Cells["ORDER_UNIT"].Text.Equals("英尺")) { foreach (UltraGridRow ugr1 in ultraGridPipeMat.Rows) { ugr1.Cells["SendNum"].Appearance.BackColor = Color.FromArgb(255, 255, 192); ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.None; ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; } } else if (row.Cells["ORDER_UNIT"].Text.Equals("支") || row.Cells["ORDER_UNIT"].Text.Equals("个")) { foreach (UltraGridRow ugr1 in ultraGridSourse.Rows) { ugr1.Cells["SendNum"].Value = ugr1.Cells["ActCount"].Value.ToString(); ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; } } else { foreach (UltraGridRow ugr1 in ultraGridPipeMat.Rows) { ugr1.Cells["SendNum"].Appearance.BackColor = Color.FromArgb(255, 255, 192); ugr1.Cells["SendNum"].Appearance.BackHatchStyle = BackHatchStyle.None; ugr1.Cells["SendNum"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; ugr1.Cells["SendNum"].Value = ugr1.Cells["ActWeight"].Value.ToString(); } } } /// /// 提单查询条件 /// /// ArrayList private ArrayList QueryBillCondition() { ArrayList param = new ArrayList(); string billStime = "2000-01-01 00:00:00"; string billEtime = "2100-12-30 00:00:00"; string orderNo = ""; string sendPlanNo = ""; string station = ""; string spcl = ""; string reciveName = ""; string customerName = ""; string billNo = ""; string status = ""; if (ChcBillTime.Checked) { if (billNoStime.Value == null || BillNoEtime.Value == null || billNoStime.Value > BillNoEtime.Value) { errMessage = "请选择正确的提单日期区间!"; return null; } billStime = billNoStime.Value.ToString(); billEtime = BillNoEtime.Value.ToString(); } if (ChcOrderNo1.Checked) { orderNo = TxtOrderNo1.Text.Trim(); } if (ChcPlanNo1.Checked) { sendPlanNo = TxtPlanNo1.Text.Trim(); } if (ChkStation1.Checked && ComStation1.Value != null) { station = ComStation1.Value.ToString(); } if (ChcSpcl.Checked && ComSpcl.Value != null) { spcl = ComSpcl.Value.ToString(); } if (ChcReceiv1.Checked) { reciveName = ComReceiv1.Text.Trim(); } if (ChcCustomer1.Checked) { customerName = ComCustomer1.Text.Trim(); } if (ChcBillNo1.Checked) { billNo = TxtBillNo1.Text.Trim(); } if (ChcBillStatus.Checked && ComBillStratus.Value != null) { status = ComBillStratus.Value.ToString().Trim(); } //if (!ChcBillTime.Checked && orderNo.Equals("") && sendPlanNo.Equals("") && station.Equals("") && spcl.Equals("") && reciveName.Equals("") && customerName.Equals("") && status.Equals("") && billNo.Equals("")) //{ // errMessage = "请至少选择一个查询条件!"; // return null; //} param.Add(billStime); param.Add(billEtime); param.Add(orderNo); param.Add(sendPlanNo); param.Add(station); param.Add(spcl); param.Add(reciveName); param.Add(customerName); param.Add(billNo); param.Add(status); return param; } /// /// 查询提单信息 /// private void QueryBillMInfo() { ArrayList param = QueryBillCondition(); if (param == null) { MessageUtil.ShowTips(errMessage); return; } //string prdCls = ComTransitTyp.Value.ToString(); DataSourceList listBillM = EntityHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.queryBillM", new object[] { param, this.ValidDataPurviewIds }, this.ob); ydmZcBillMEntityBindingSource.DataSource = listBillM; if (listBillM == null || listBillM.Count == 0) { QueryBillCInfo(""); } } private DataSourceList listBillC; /// /// 查询提单从表信息 /// /// private void QueryBillCInfo(String billNo) { listBillC = EntityHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.queryBillC", new object[] { billNo }, this.ob); ydmZcBillCEntityBindingSource.DataSource = listBillC; listBillC.AcceptChanges(); foreach (UltraGridRow ugr in ultraGridBillC.Rows) { ugr.Cells["CANCELDOWN"].Value = "撤销"; } } private void ultraGridBillM_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = ultraGridBillM.ActiveRow; if (ugr == null) { return; } string billNo = ugr.Cells["BillNo"].Text; QueryBillCInfo(billNo); } /// /// 验证提单量 /// /// /// private void ultraGridSourse_CellChange(object sender, CellEventArgs e) { UltraGridRow urg = ultraGridOrder.ActiveRow; if (e.Cell.Column.Key.Equals("ActCount")) { if (e.Cell.Row.Cells["ActCount"].Value == null) { e.Cell.Row.Cells["ActCount"].Value = "0"; e.Cell.Row.Cells["ActWeight"].Value = "0"; e.Cell.Row.Cells["ActLen"].Value = "0"; if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支")) { e.Cell.Row.Cells["SendNum"].Value = 0; } } else { ultraGridSourse.UpdateData(); string actCount = e.Cell.Row.Cells["ActCount"].Value.ToString(); if (!StringUtil.IsInt(actCount) || actCount == "0") { e.Cell.Row.Cells["ActCount"].Value = "0"; e.Cell.Row.Cells["ActWeight"].Value = "0"; e.Cell.Row.Cells["ActLen"].Value = "0"; if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支")) { e.Cell.Row.Cells["SendNum"].Value = 0; } } else { MatInfoEntity matInfoEntity = (MatInfoEntity)ultraGridSourse.ActiveRow.ListObject; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.checkMatWeight", new object[] { matInfoEntity }, this.ob); if (dt != null && dt.Rows.Count > 0) { e.Cell.Row.Cells["ActWeight"].Value = dt.Rows[0][0].ToString(); e.Cell.Row.Cells["ActCount"].Value = dt.Rows[0][1].ToString(); e.Cell.Row.Cells["ActLen"].Value = dt.Rows[0][2].ToString(); if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支")) { e.Cell.Row.Cells["SendNum"].Value = dt.Rows[0][0].ToString(); } } else { e.Cell.Row.Cells["ActCount"].Value = "0"; e.Cell.Row.Cells["ActWeight"].Value = "0"; e.Cell.Row.Cells["ActLen"].Value = "0"; if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支")) { e.Cell.Row.Cells["SendNum"].Value = 0; } } } } } if (e.Cell.Column.Key.Equals("SendNum")) { if (e.Cell.Row.Cells["SendNum"].Value == null) { e.Cell.Row.Cells["SendNum"].Value = "0"; } else { ultraGridSourse.UpdateData(); string actLen = e.Cell.Row.Cells["SendNum"].Value.ToString(); if (!StringUtil.IsFloat(actLen) || actLen == "0")//actCount == "" || int.Parse(actCount)==0 { e.Cell.Row.Cells["SendNum"].Value = "0"; } } } string storage = ""; foreach (UltraGridRow ugr1 in ultraGridSourse.Rows) { if (Convert.ToBoolean(ugr1.Cells["CHC"].Text) == true) { storage = ugr1.Cells["StorageNo"].Value.ToString(); } } double count = 0; double weght = 0; double len = 0; double send = 0; ultraGroupBox4.Text = "资源信息区"; int i = 0; foreach (UltraGridRow ugr in ultraGridSourse.Rows) { if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true) { if (storage != ugr.Cells["StorageNo"].Value.ToString()) { i++; } ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text; count += double.Parse(ugr.Cells["ActCount"].Value.ToString()); weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString()); len += double.Parse(ugr.Cells["ActLen"].Value.ToString()); send += double.Parse(ugr.Cells["SendNum"].Value.ToString()); } } //if (i > 0) //{ // MessageUtil.ShowTips("您所选择的炉出库地点不一致,不能进行此操作?"); // e.Cell.Row.Cells["CHC"].Value = false; // return; //} ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3") + " 实发数:" + send.ToString("f3"); //if (e.Cell.Column.Key.Equals("Vstel")) //{ // e.Cell.Row.Cells["VstelDesc"].Value = e.Cell.Row.Cells["Vstel"].Text; //} } /// /// 新增提单 /// private void DoAddBill() { ultraGridSourse.UpdateData(); ultraGridPipeMat.UpdateData(); UltraGridRow ugrSendPlan = ultraGridSendPlan.ActiveRow; UltraGridRow ugrOrder = ultraGridOrder.ActiveRow; IQueryable ugrMatNo = ultraGridPipeMat.Rows.AsQueryable().Where(" CHK = 'True'"); IQueryable ugrSourses = ultraGridSourse.Rows.AsQueryable().Where(" CHC = 'True'"); //if (ugrOrder.Cells["PRD_CLS"].Text.Equals("405005"))//判断是否坯子 //{ // if (ugrSendPlan == null || ugrOrder == null || ugrMatNo.Count() == 0) // { // MessageUtil.ShowTips("请选择生成提货单的资源信息!"); // return; // } //} //else //{ if (ugrSendPlan == null || ugrOrder == null || ugrSourses.Count() == 0) { MessageUtil.ShowTips("请选择生成提货单的资源信息!"); return; } //} string producName = ugrOrder.Cells["PRODUCNAME"].Text; string specName = ugrOrder.Cells["SPEC_NAME"].Text; string stdName = ugrOrder.Cells["STD_NAME"].Text; string steeName = ugrOrder.Cells["STEELNAME"].Text; string modelNmae = ugrOrder.Cells["MODEL_DESC"].Text; string stdSty = ugrOrder.Cells["STD_STYLE_DESC"].Text; string changpx = producName + stdSty + steeName + specName + modelNmae;//管 string pipe = producName + specName + stdName;//坯 string billNo = ComBillNo.Text.Trim(); string virtualFlag = "1"; if (ChcVirtual.Checked) { virtualFlag = "2"; } string strPraFlag = "0"; if (PraFlag.Checked) { strPraFlag = "1"; } string plineName = ""; //验证提单号 if (!billNo.Equals("")) { DataTable dt = (DataTable)ComBillNo.DataSource; DataRow[] drs = dt.Select("BILL_NO =" + "'" + billNo + "'"); if (drs == null || drs.Count() == 0) { return; } string beVirtualFlag = drs[0]["LOADVEHICLE_TYPE"].ToString(); plineName = drs[0]["LOADVEHICLE_TYPE"].ToString(); if (virtualFlag.Equals("1") && !virtualFlag.Equals(beVirtualFlag)) { MessageUtil.ShowTips("实际提货单不能追加虚拟提货单类型的信息!"); return; } if (virtualFlag.Equals("2") && !virtualFlag.Equals(beVirtualFlag)) { MessageUtil.ShowTips("虚拟提货单不能追加实际提货单类型的信息!"); return; } } if (ugrOrder.Cells["ORDER_NO"].Text.Equals("")) { MessageUtil.ShowTips("合同号不能为空"); return; } if (BillBtime.Value == null || BillEtime.Value == null || BillBtime.Value > BillEtime.Value) { MessageUtil.ShowTips("请选择正确的提货单开始/结束时间!"); return; } string sendPlanNo = ugrSendPlan.Cells["SEND_PLAN_NO"].Text; string ordPk = ugrOrder.Cells["ORD_PK"].Text; string ordLnPk = ugrOrder.Cells["ORD_LN_PK"].Text; string ordLnDlyPk = ugrOrder.Cells["ORD_LN_DLY_PK"].Text; string billBtime = BillBtime.Value.ToString("yyyy-MM-dd"); string billEtime = BillEtime.Value.ToString("yyyy-MM-dd"); ArrayList paramA = new ArrayList(); paramA.Add(billNo); paramA.Add(sendPlanNo); paramA.Add(ordPk); paramA.Add(ordLnPk); paramA.Add(ordLnDlyPk); paramA.Add(UserInfo.GetUserName()); paramA.Add(UserInfo.GetDeptid()); paramA.Add(UserInfo.GetDepartment()); paramA.Add(virtualFlag); paramA.Add(billBtime); paramA.Add(billEtime); ArrayList paramB = new ArrayList(); DataTable dtOrdLnDlyPk = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryOrdLnDlyPkWT", new object[] { ordLnDlyPk }, this.ob); double ordWt = 0;//交货行量 double delMat = 0; if (dtOrdLnDlyPk.Rows.Count > 0) { ordWt = double.Parse(dtOrdLnDlyPk.Rows[0]["WGT_ESTMT"].ToString()); delMat = double.Parse(dtOrdLnDlyPk.Rows[0]["DELVRY_RANGE_MAX"].ToString()); } DataTable dtBillC = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryBillWeight", new object[] { ordLnDlyPk }, this.ob); double billWeight = double.Parse(dtBillC.Rows[0]["ACT_WEIGHT"].ToString()); double wegiht = 0; DateTime d1 = DateTime.Now;//当前时间 DateTime dt1 = Convert.ToDateTime(d1); //if (ugrOrder.Cells["PRD_CLS"].Text.Equals("405005")) //{ // foreach (UltraGridRow ugr in ugrMatNo) // { // PipeMatGpMEntity matInfoEntity = (PipeMatGpMEntity)ugr.ListObject; // _ordLnDlyPkSoure = matInfoEntity.OrdLnDlyPk; // wegiht += double.Parse(matInfoEntity.ActWeight.ToString()); // if (matInfoEntity.ActCount.Equals("") || matInfoEntity.ActCount.Equals("0")) // { // MessageUtil.ShowTips("资源信息可编制量为0,不能生成提单!"); // return; // } // if (matInfoEntity.StorageName.Equals("") || matInfoEntity.StorageName.Equals("/")) // { // MessageUtil.ShowTips("请确认资源信息出库地点!"); // return; // } // if (pipe != matInfoEntity.Producname + matInfoEntity.SpecName + matInfoEntity.JudgeStdName) // { // if (MessageUtil.ShowYesNoAndQuestion("合同产品信息与炉号产品信息不一致,是否继续!") == DialogResult.No) return; // } // if (ugr.Cells["SendNum"].Text.Equals("0.000")) // { // MessageUtil.ShowTips("请输入实发数!"); // return; // } // DateTime dt2 = Convert.ToDateTime(matInfoEntity.InstockTime); // int months = (dt1.Year - dt2.Year) * 12 + (dt1.Month - dt2.Month); // if (months > 6) // { // if (MessageUtil.ShowYesNoAndQuestion("您所选择的炉号信息入库日期与当前日期相隔6个月,是否继续!") == DialogResult.No) return; // } // paramB.Add(matInfoEntity); // } //} //else //{ string plineCode = ""; foreach (UltraGridRow ugr in ugrSourses) { MatInfoEntity matInfoEntity = (MatInfoEntity)ugr.ListObject; _ordLnDlyPkSoure = matInfoEntity.OrdLnDlyPk; wegiht += double.Parse(matInfoEntity.ActWeight.ToString()); if (matInfoEntity.ActCount.Equals("") || matInfoEntity.ActCount.Equals("0")) { MessageUtil.ShowTips("资源信息可编制量为0,不能生成提单!"); return; } if (matInfoEntity.StorageName.Equals("") || matInfoEntity.StorageName.Equals("/")) { MessageUtil.ShowTips("请确认资源信息出库地点!"); return; } if (changpx != matInfoEntity.Producname + matInfoEntity.StdStyleDesc + matInfoEntity.Steelname + matInfoEntity.SpecName + matInfoEntity.ModelDesc) { if (MessageUtil.ShowYesNoAndQuestion("合同产品信息与炉号产品信息不一致,是否继续!") == DialogResult.No) return; } if (ugr.Cells["SendNum"].Text.Trim().Equals("0.000")) { MessageUtil.ShowTips("请输入实发数!"); return; } if (_salgPersion.Length == 1) { if (!_salgPersion[0].Equals("100102")) { string plineDepart = ""; //根据产线产线管理部门 DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryPlineDepart", new object[] { ugr.Cells["plineCode"].Text.Trim() }, this.ob); if (dt.Rows.Count > 0) { plineDepart = dt.Rows[0]["PROCESS_CODE"].ToString(); } if (plineCode.Equals("")) { plineCode = plineDepart; } else { plineCode = plineCode + "," + plineDepart; } } } else { string plineDepart = ""; //根据产线产线管理部门 DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.queryPlineDepart", new object[] { ugr.Cells["plineCode"].Text.Trim() }, this.ob); if (dt.Rows.Count > 0) { plineDepart = dt.Rows[0]["PROCESS_CODE"].ToString(); } if (plineCode.Equals("")) { plineCode = plineDepart; } else { plineCode = plineCode + "," + plineDepart; } } DateTime dt2 = Convert.ToDateTime(matInfoEntity.JudgeResultTime); int months = (dt1.Year - dt2.Year) * 12 + (dt1.Month - dt2.Month); if (months > 6) { if (MessageUtil.ShowYesNoAndQuestion("您所选择的炉号信息入库日期与当前日期相隔6个月,是否继续!") == DialogResult.No) return; } paramB.Add(matInfoEntity); } if (_salgPersion.Length == 1) { if (!_salgPersion[0].Equals("100102")) { if (plineCode.Contains("G") && plineCode.Contains("D")) { if (MessageUtil.ShowYesNoAndQuestion("选择炉号存在加工和轧管产线,是否继续生成一个提单!") == DialogResult.No) return; } //if (!billNo.Equals("")) //{ // if (!plineName.Equals(ugr.Cells["plineName"].Text.Trim())) // { // if (MessageUtil.ShowYesNoAndQuestion("选择炉号产线不一致,是否继续!") == DialogResult.No) return; // } //} } } else { //if (!billNo.Equals("")) //{ // if (!plineName.Equals(ugr.Cells["plineName"].Text.Trim())) // { // if (MessageUtil.ShowYesNoAndQuestion("选择炉号产线不一致,是否继续!") == DialogResult.No) return; // } //} if (plineCode.Contains("G") && plineCode.Contains("D")) { if (MessageUtil.ShowYesNoAndQuestion("选择炉号存在加工和轧管产线,是否继续生成一个提单!") == DialogResult.No) return; } } //} double ordb =ordWt+ ordWt * (delMat / 100);//交货行上限值 double billW = billWeight + wegiht; if (ordb < billW) { if (MessageUtil.ShowYesNoAndQuestion("生成提单量不能大于交货量上限,交货量为:" + ordWt + "t,交货量上限值为:" + ordb + "t,已生成提单量为:" + billWeight + "t,要生成提单的量为:" + wegiht + "t") == DialogResult.No) { return; } } if (BillBtime.Value == null || BillEtime.Value == null || BillBtime.Value > BillEtime.Value) { MessageUtil.ShowWarning("请选择正确的提单开始/结束时间"); return; } //定位 _sendPlanNo = sendPlanNo; _ordLnDlyPk = ordLnDlyPk; if (MessageUtil.ShowYesNoAndQuestion(billNo.Length == 0 ? "是否新增提货单?" : "是否在原提货单号:" + billNo + "追加提货单信息?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); //if (ugrOrder.Cells["PRD_CLS"].Text.Equals("405005")) //{ // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.CoreCasCarBill"; // ccp.MethodName = "doAddBillInfo"; //} //else //{ ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill"; ccp.MethodName = "doAddBillInfo"; //} ccp.ServerParams = new object[] { paramA, paramB, ugrOrder.Cells["ORDER_NO"].Text, ugrOrder.Cells["ORDER_SEQ"].Text, ugrOrder.Cells["DELIVERY_NO"].Text, strPraFlag, ugrSendPlan.Cells["SUPPLY_UNIT"].Text, ugrSendPlan.Cells["SUPPLY_UNIT_DESC"].Text }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception e) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("新增提货单成功!") || ccp.ReturnInfo.Equals("修改提货单成功!")) { QuerySendPlan(); BaseHelper.UltraGridLocation(ultraGridSendPlan, new string[] { "SEND_PLAN_NO" }, new string[] { _sendPlanNo }); _sendPlanNo = ""; } } } /// /// 撤销提单 /// private void DoDelete() { ultraGridBillM.UpdateData(); IQueryable checkRows = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'"); if (checkRows.Count() == 0) { MessageUtil.ShowTips("请选择需要撤销的提货单!"); return; } ArrayList list = new ArrayList(); ArrayList pram = new ArrayList(); foreach (UltraGridRow ugr in checkRows) { list.Add(ugr.Cells["BillNo"].Text.Trim()); } if (MessageUtil.ShowYesNoAndQuestion("是否撤销提货单?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); //if (ComTransitTyp.Value.ToString().Equals("405005")) //{ // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.CoreCasCarBill"; // ccp.MethodName = "updateBill"; // ccp.ServerParams = new object[] { list, UserInfo.GetUserName(), UserInfo.GetDeptid(), UserInfo.GetDepartment() }; // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //} //else //{ ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp.MethodName = "updateBill"; ccp.ServerParams = new object[] { list, UserInfo.GetUserName(), UserInfo.GetDeptid(), UserInfo.GetDepartment() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //} if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("提单撤销成功!")) { QueryBillMInfo(); foreach (UltraGridRow ugrc in ultraGridBillM.Rows) { if (ugrc.Cells["BillNo"].Text.Equals(_billNo)) { ugrc.Activate(); _billNo = ""; return; } } } } } /// /// 下发 /// private void DoDown() { ultraGridBillM.UpdateData(); UltraGridRow ugr = ultraGridBillM.ActiveRow; if (ugr == null) return; IQueryable ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'"); if (ugrs.Count() == 0) { MessageUtil.ShowTips("请选择您要操作的数据!"); return; } ArrayList param = new ArrayList(); foreach (UltraGridRow row in ugrs) { string[] str = new string[2]; str[0] = row.Cells["BillNo"].Value.ToString(); str[1] = row.Cells["SendPlanNo"].Value.ToString(); param.Add(str); // 查询提单合同金额 DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getBillOrder", new object[] { row.Cells["BillNo"].Value.ToString() }, ob); double price = 0.0; string askDesc = ""; bool next_flag = false; for (int i = 0; i < dt.Rows.Count; i++) { if (!dt.Rows[i]["FST_DRAWEE_UNIT"].ToString2().Equals("120604")) // 天津钢管钢铁贸易有限公司 { next_flag = true; continue; } if (!string.IsNullOrWhiteSpace(dt.Rows[i]["MNY_ASK_DESC"].ToString2()) && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("全额排产") && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("付讫发货") && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("全款提货") && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("全款预付") && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("付讫后发货") && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("全额付款提货") && !dt.Rows[i]["MNY_ASK_DESC"].ToString2().Contains("发货前支付100%货款")) { if (MessageBox.Show(dt.Rows[i]["ORDER_NO"].ToString() + "此合同付款要求是:" + dt.Rows[i]["MNY_ASK_DESC"].ToString2() + "是否继续下发?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } next_flag = true; continue; } if (string.IsNullOrWhiteSpace(dt.Rows[i]["BALNCE_PRICE"].ToString2())) { MessageUtil.ShowTips(dt.Rows[i]["ORDER_NO"].ToString() + "/" + dt.Rows[i]["ORDER_SEQ"].ToString() + ",没有合同价格,请维护合同价格!"); return; } price += double.Parse(dt.Rows[0]["MONEY"].ToString3()); askDesc = dt.Rows[i]["MNY_ASK_DESC"].ToString2(); } if (next_flag) { continue; } // 查询账本可发金额 DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getMoneyByBuyercode", new object[] { row.Cells["StlmtUnitNo"].Value.ToString() }, ob); if (dt1.Rows.Count <= 0 || string.IsNullOrWhiteSpace(dt1.Rows[0]["MONEY"].ToString2())) { MessageUtil.ShowTips(row.Cells["StlmtUnitNM"].Value.ToString() + ",没有可发金额,请维护可发金额!"); return; } ArrayList param1 = new ArrayList(); ArrayList list1 = new ArrayList(); list1.Add(row.Cells["BillNo"].Value.ToString()); list1.Add(row.Cells["StlmtUnitNO"].Value.ToString()); list1.Add(row.Cells["StlmtUnitNM"].Value.ToString()); list1.Add(dt1.Rows[0]["MONEY"].ToString3()); list1.Add(price); list1.Add(this.UserInfo.GetUserName()); param1.Add(list1); if (double.Parse(dt1.Rows[0]["MONEY"].ToString3()) <= 0) { if (MessageBox.Show(row.Cells["StlmtUnitNM"].Value.ToString() + ",可发金额(" + dt1.Rows[0]["MONEY"].ToString2() + ")小于等于0!是否确认下发提货单?\n此合同付款要求是:" + askDesc, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } if (double.Parse(dt1.Rows[0]["MONEY"].ToString3()) < price) { if (MessageBox.Show(row.Cells["StlmtUnitNM"].Value.ToString() + ",可发金额(" + dt1.Rows[0]["MONEY"].ToString2() + ")小于结算金额(" + price + ")!是否确认下发提货单?\n此合同付款要求是:" + askDesc, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } if (double.Parse(dt1.Rows[0]["MONEY"].ToString3()) <= 0 || double.Parse(dt1.Rows[0]["MONEY"].ToString3()) < price) { CoreClientParam ccp1 = new CoreClientParam(); ccp1.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp1.MethodName = "DoDownLog"; ccp1.ServerParams = new object[] { param1 }; ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal); } } if (MessageBox.Show("是否确认下发提货单?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp.MethodName = "DoDown"; ccp.ServerParams = new object[] { param, UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("下发成功!")) { QueryBillMInfo(); foreach (UltraGridRow ugrc in ultraGridBillM.Rows) { if (ugrc.Cells["BillNo"].Text.Equals(_billNo)) { ugrc.Activate(); _billNo = ""; return; } } } } } /// /// 撤销下发 /// private void CancelDown() { ultraGridBillM.UpdateData(); UltraGridRow ugr = ultraGridBillM.ActiveRow; if (ugr == null) return; IQueryable ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'"); if (ugrs.Count() == 0) { MessageUtil.ShowTips("请选择您要撤销下发的提货单!"); return; } ArrayList param = new ArrayList(); foreach (UltraGridRow row in ugrs) { string[] str = new string[2]; str[0] = row.Cells["BillNo"].Value.ToString(); str[1] = row.Cells["SendPlanNo"].Value.ToString(); _billNo = str[0]; param.Add(str); } if (MessageBox.Show("是否确认撤销下发的提货单?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp.MethodName = "cancelDown"; ccp.ServerParams = new object[] { param, UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销下发成功!")) { QueryBillMInfo(); foreach (UltraGridRow ugrc in ultraGridBillM.Rows) { if (ugrc.Cells["BillNo"].Text.Equals(_billNo)) { ugrc.Activate(); _billNo = ""; return; } } } } } /// /// 提单划断 /// private void BillDrawOff() { ultraGridBillM.UpdateData(); UltraGridRow ugr = ultraGridBillM.ActiveRow; if (ugr == null) return; IQueryable ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'"); if (ugrs.Count() == 0) { MessageUtil.ShowTips("请选择您要一次关闭的提货单!"); return; } ArrayList param = new ArrayList(); foreach (UltraGridRow row in ugrs) { if (row.Cells["LoadvehicleType"].Value.ToString().Equals("实际")) { MessageUtil.ShowTips("只有虚拟的提货单才能一次关闭!"); return; } string billNo = row.Cells["BillNo"].Value.ToString(); _billNo = billNo; param.Add(billNo); } if (MessageBox.Show("是否提单一次关闭?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp.MethodName = "billDrawOff"; ccp.ServerParams = new object[] { param, UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("提单一次关闭成功!")) { QueryBillMInfo(); foreach (UltraGridRow ugrc in ultraGridBillM.Rows) { if (ugrc.Cells["BillNo"].Text.Equals(_billNo)) { ugrc.Activate(); _billNo = ""; return; } } } } } /// /// 取消划断 /// private void CancelBillDrawOff() { ultraGridBillM.UpdateData(); UltraGridRow ugr = ultraGridBillM.ActiveRow; if (ugr == null) return; IQueryable ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'"); if (ugrs.Count() == 0) { MessageUtil.ShowTips("请选择您要撤销一次关闭的提货单!"); return; } ArrayList param = new ArrayList(); foreach (UltraGridRow row in ugrs) { if (row.Cells["LoadvehicleType"].Value.ToString().Equals("实际")) { MessageUtil.ShowTips("只有虚拟的提货单才能撤销一次关闭!"); return; } string billNo = row.Cells["BillNo"].Value.ToString(); _billNo = billNo; param.Add(billNo); } if (MessageBox.Show("是否撤销一次关闭?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp.MethodName = "cancelBillDrawOff"; ccp.ServerParams = new object[] { param, UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销一次关闭成功!")) { QueryBillMInfo(); foreach (UltraGridRow ugrc in ultraGridBillM.Rows) { if (ugrc.Cells["BillNo"].Text.Equals(_billNo)) { ugrc.Activate(); _billNo = ""; return; } } } } } /// /// 打印 /// private void Print() { string billNo = ""; UltraGridRow ugr = this.ultraGridBillM.ActiveRow; if (ugr == null) { MessageUtil.ShowTips("无数据,请确认!"); return; } int count = 0; foreach (UltraGridRow row in ultraGridBillM.Rows) { if (Convert.ToBoolean(row.Cells["CHC"].Text) == true) { count += 1; billNo = ugr.Cells["BillNo"].Text.Trim(); } } if (count == 0) { MessageUtil.ShowTips("请选择要打印的提货单号!"); return; } if (count > 1) { MessageUtil.ShowTips("请勾选一个提货单号打印!"); return; } DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeBillOfLadingClose.getBillStatus", new Object[] { ugr.Cells["BillNo"].Text.Trim() }, this.ob); if (dt.Rows.Count > 0) { if (dt.Rows[0]["BILL_STATUS"].ToString().Equals("0")) { MessageUtil.ShowTips("该提单是编制状态,请下发之后再打印提单!"); return; } } string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepYdmBill.cpt&op=view" + "&billno=" + billNo; string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ServerHelper.SetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.updatePintFlag", new object[] { time, billNo }, ob); FrmDocPrintExcel fBug = new FrmDocPrintExcel(ob, strurl); fBug.AutoSize = true; fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); // fBug.WindowState = FormWindowState.Maximized; fBug.Text = "提货单打印"; fBug.ShowDialog(); QueryBillMInfo(); } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (toolMenu == null) return; if (CustomInfo.Equals("1")) { if (e.Tab.TabControl.SelectedTab.Key.Equals("0")) { if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Add")) { toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("UpdateDelvryWhereabouts")) { toolMenu.Toolbars[0].Tools["UpdateDelvryWhereabouts"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("UpdateRealinvoiceno1")) { toolMenu.Toolbars[0].Tools["UpdateRealinvoiceno1"].InstanceProps.Visible = DefaultableBoolean.False; } } else { if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("Add")) { toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("UpdateDelvryWhereabouts")) { toolMenu.Toolbars[0].Tools["UpdateDelvryWhereabouts"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("UpdateRealinvoiceno1")) { toolMenu.Toolbars[0].Tools["UpdateRealinvoiceno1"].InstanceProps.Visible = DefaultableBoolean.True; } } } if (CustomInfo.Equals("2")) { if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("Down")) { toolMenu.Toolbars[0].Tools["Down"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("Add")) { toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelDown")) { toolMenu.Toolbars[0].Tools["CancelDown"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("BillDrawOff")) { toolMenu.Toolbars[0].Tools["BillDrawOff"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("CancelBillDrawOff")) { toolMenu.Toolbars[0].Tools["CancelBillDrawOff"].InstanceProps.Visible = DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("UpdateStoage")) { toolMenu.Toolbars[0].Tools["UpdateStoage"].InstanceProps.Visible = DefaultableBoolean.True; } } } private void frmPipeTrainBill_Shown(object sender, EventArgs e) { if (CustomInfo.Equals("1")) { if (toolMenu.Toolbars[0].Tools.Exists("CancelDown")) { toolMenu.Toolbars[0].Tools["CancelDown"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("BillDrawOff")) { toolMenu.Toolbars[0].Tools["BillDrawOff"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelBillDrawOff")) { toolMenu.Toolbars[0].Tools["CancelBillDrawOff"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Down")) { toolMenu.Toolbars[0].Tools["Down"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Print")) { toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("UpdateStoage")) { toolMenu.Toolbars[0].Tools["UpdateStoage"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("UpdateDelvryWhereabouts")) { toolMenu.Toolbars[0].Tools["UpdateDelvryWhereabouts"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("UpdateRealinvoiceno1")) { toolMenu.Toolbars[0].Tools["UpdateRealinvoiceno1"].InstanceProps.Visible = DefaultableBoolean.False; } } if (CustomInfo.Equals("2")) { if (toolMenu.Toolbars[0].Tools.Exists("Update")) { toolMenu.Toolbars[0].Tools["Update"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Add")) { toolMenu.Toolbars[0].Tools["Add"].InstanceProps.Visible = DefaultableBoolean.False; } } } /// /// 划分界面 /// /// private void DivideInterface(string custInfo) { if (custInfo.Equals("2")) { ultraTabControl1.Tabs[0].Visible = false; } else { ultraTabControl1.Tabs[1].Text = "提单信息"; } } private void ultraGridSourse_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { //try //{ // ultraGridSourse.UpdateData(); // foreach (UltraGridRow row in ultraGridSourse.Rows) // { // row.Cells["CHC"].Value = row.Selected; // } //} //catch { } foreach (UltraGridRow uRow in ultraGridSourse.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHC"].Value = true; } } string storage = ""; foreach (UltraGridRow ugr1 in ultraGridSourse.Rows) { if (Convert.ToBoolean(ugr1.Cells["CHC"].Text) == true) { storage = ugr1.Cells["StorageNo"].Value.ToString(); } } double count = 0; double weght = 0; double len = 0; double send = 0; ultraGroupBox4.Text = "资源信息区"; int i = 0; UltraGridRow row = ultraGridSourse.ActiveRow; foreach (UltraGridRow ugr in ultraGridSourse.Rows) { if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true) { if (storage != ugr.Cells["StorageNo"].Value.ToString()) { i++; } ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text; count += double.Parse(ugr.Cells["ActCount"].Value.ToString()); weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString()); len += double.Parse(ugr.Cells["ActLen"].Value.ToString()); send += double.Parse(ugr.Cells["SendNum"].Value.ToString()); } } //if (i > 0) //{ // MessageUtil.ShowTips("您所选择的炉出库地点不一致,不能进行此操作?"); // row.Cells["CHC"].Value = false; // return; //} ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3") + " 实发数:" + send.ToString("f3"); } private void ultraGridBillM_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { // try // { // ultraGridBillM.UpdateData(); // foreach (UltraGridRow row in ultraGridBillM.Rows) // { // row.Cells["CHC"].Value = row.Selected; // } // } // catch { } foreach (UltraGridRow uRow in ultraGridBillM.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHC"].Value = true; } } } /// /// 撤销合同 /// private void CancelDownOrderNo() { UltraGridRow ugrM = ultraGridBillM.ActiveRow; if (ugrM == null) { return; } if (!ugrM.Cells["BillStatus"].Text.Equals("提单编制")) { MessageUtil.ShowTips("提货单号:" + ugrM.Cells["BillNo"].Text + "不是提单编制状态,不能撤销提货单下的合同!"); return; } UltraGridRow ugr = ultraGridBillC.ActiveRow; if (ugr == null) { return; } ArrayList param = new ArrayList(); param.Add(ugr.Cells["BillNo"].Text); param.Add(ugr.Cells["OrdPk"].Text); param.Add(ugr.Cells["OrdLnPk"].Text); param.Add(ugr.Cells["OrdLnDlyPk"].Text); param.Add(ugr.Cells["JudgeStoveNo"].Text); param.Add(ugr.Cells["BatchNo"].Text); param.Add(UserInfo.GetUserName()); param.Add(ugr.Cells["GroupNo"].Text); param.Add(ugr.Cells["LocationNo"].Text); string billNo = ugr.Cells["BillNo"].Text; if (MessageUtil.ShowYesNoAndQuestion("是否撤销提货单:" + ugr.Cells["BillNo"].Text + " 下合同:" + ugr.Cells["OrderNo"].Text + "/" + ugr.Cells["OrderSeq"].Text + "/" + ugr.Cells["DeliveryNo"].Text + "的炉批号:" + ugr.Cells["JudgeStoveNo"].Text + "/" + ugr.Cells["BatchNo"].Text+"/"+ugr.Cells["GroupNo"].Text) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); //if (ComTransitTyp.Value.ToString().Equals("405005")) //{ // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.CoreCasCarBill"; // ccp.MethodName = "cancelDownOrderNo"; //} //else //{ ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill"; ccp.MethodName = "cancelDownOrderNo"; //} ccp.ServerParams = new object[] { param }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销成功!")) { QueryBillMInfo(); foreach (UltraGridRow ugrc in ultraGridBillM.Rows) { if (ugrc.Cells["BillNo"].Text.Equals(billNo)) { ugr.Activate(); return; } } } } } private void ultraGridBillC_ClickCellButton(object sender, CellEventArgs e) { if (e.Cell.Text.Equals("撤销")) { CancelDownOrderNo(); } } /// /// 按回车键触发查询按钮 /// /// /// private void ContPublic_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { DoQuery(); } } /// /// 查询时验证必填项 /// /// private bool ValidQuery() { if (ChcOrderNo.Checked && string.IsNullOrEmpty(TxtOrderNo.Text.Trim())) { MessageBox.Show("请输入合同号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcBillNo.Checked && string.IsNullOrEmpty(TxtBillNo.Text.Trim())) { MessageBox.Show("请输入提货单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcPlanNo.Checked && string.IsNullOrEmpty(TxtPlanNo.Text.Trim())) { MessageBox.Show("请输入出厂计划号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcCustomer.Checked && string.IsNullOrEmpty(ComCustomer.Text.Trim())) { MessageBox.Show("请选择订货单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcRecive.Checked && string.IsNullOrEmpty(ComRecive.Text.Trim())) { MessageBox.Show("请选择收货单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcStation.Checked && string.IsNullOrEmpty(ComStation.Text.Trim())) { MessageBox.Show("请选择到站!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcSpcl.Checked && string.IsNullOrEmpty(ComSpcl.Text.Trim())) { MessageBox.Show("请选择专用线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } return true; } /// /// 查询时验证必填项 /// /// private bool ValidQuery1() { if (ChcBillTime.Checked) { if (DataTimeUtil.JudgeTime(DateTime.Parse(billNoStime.Value.ToString()), DateTime.Parse(BillNoEtime.Value.ToString())) == 0) { MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!"); return false; } } if (ChcOrderNo1.Checked && string.IsNullOrEmpty(TxtOrderNo1.Text.Trim())) { MessageBox.Show("请输入合同号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcBillNo1.Checked && string.IsNullOrEmpty(TxtBillNo1.Text.Trim())) { MessageBox.Show("请输入提货单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcPlanNo1.Checked && string.IsNullOrEmpty(TxtPlanNo1.Text.Trim())) { MessageBox.Show("请输入出厂计划号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcCustomer1.Checked && string.IsNullOrEmpty(ComCustomer1.Text.Trim())) { MessageBox.Show("请选择订货单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcReceiv1.Checked && string.IsNullOrEmpty(ComReceiv1.Text.Trim())) { MessageBox.Show("请选择收货单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChkStation1.Checked && string.IsNullOrEmpty(ComStation1.Text.Trim())) { MessageBox.Show("请选择到站!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (ChcSpcl1.Checked && string.IsNullOrEmpty(ComSpcl1.Text.Trim())) { MessageBox.Show("请选择专用线!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } return true; } /// /// 出库地点修改 /// private void doUpdateStoage() { ultraGridBillC.UpdateData(); UltraGridRow ugr = ultraGridBillC.ActiveRow; UltraGridRow ugr1 = ultraGridBillM.ActiveRow; if (ugr == null) return; int count = 0; ArrayList list1 = new ArrayList(); foreach (UltraGridRow row in ultraGridBillC.Rows) { if (Convert.ToBoolean(row.Cells["CHK"].Text) == true) { count += 1; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeBillOfLadingClose.getBillStatus", new Object[] { row.Cells["BillNo"].Text.Trim() }, this.ob); if (dt.Rows.Count == 0) return; //if (dt.Rows[0]["LOADVEHICLE_TYPE"].ToString().Equals("1")) //{ // if (!dt.Rows[0]["BILL_STATUS"].ToString().Equals("0")) // { // MessageUtil.ShowTips("提货单不是编制状态不能修改出库地点!"); // return; // } //} //else //{ // if (dt.Rows[0]["ISPRECLOSE"].ToString().Equals("2")) // { // MessageUtil.ShowTips("虚单已对齐,不能进行此操作!"); // return; // } string endStatr = "0"; if (row.Cells["EditFlag"].Text.Trim().Equals("已理货")) { endStatr = "1"; } DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getBillCedit", new Object[] { row.Cells["BillNo"].Text.Trim(), row.Cells["JudgeStoveNo"].Text, row.Cells["BatchNo"].Text, row.Cells["GroupNo"].Text, endStatr }, this.ob); if (dt1.Rows[0]["EDIT_FLAG"].ToString().Equals("1")) { MessageUtil.ShowTips("您选择的这炉已理货,不能进行此操作!"); return; } //} ArrayList list = new ArrayList(); list.Add(row.Cells["BillNo"].Value.ToString()); list.Add(row.Cells["JudgeStoveNo"].Value.ToString()); list.Add(row.Cells["BatchNo"].Value.ToString()); list.Add(row.Cells["GroupNo"].Value.ToString()); list.Add(row.Cells["StorageNo"].Value.ToString()); list.Add(row.Cells["StorageNo"].Text); list1.Add(list); } } if (count == 0) { MessageUtil.ShowTips("请选择要修改出库地点对应炉号!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否修改出库地点") == DialogResult.No) return; int update = 0; //if (ComTransitTyp.Value.ToString().Equals("405005")) //{ // update = ServerHelper.SetData("com.steering.pss.ydm.acasleavefactory.CoreCasCarBill.updateStoager", new object[] { list1, ugr1.Cells["PlanTransType"].Text }, ob); //} //else //{ update = ServerHelper.SetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.updateStoager", new object[] { list1 }, ob); //} if (update>0) { MessageUtil.ShowTips("出库地点修改成功!"); QueryBillCInfo(ugr1.Cells["BillNo"].Value.ToString()); } } /// /// 装车地点修改 /// private void doUpdateLoad() { ultraGridBillC.UpdateData(); UltraGridRow ugr = ultraGridBillC.ActiveRow; UltraGridRow ugr1 = ultraGridBillM.ActiveRow; if (ugr == null) return; int count = 0; ArrayList list1 = new ArrayList(); foreach (UltraGridRow row in ultraGridBillC.Rows) { if (Convert.ToBoolean(row.Cells["CHK"].Text) == true) { count += 1; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.CorePipeBillOfLadingClose.getBillStatus", new Object[] { row.Cells["BillNo"].Text.Trim() }, this.ob); if (dt.Rows.Count == 0) return; string endStatr = "0"; if (row.Cells["EditFlag"].Text.Trim().Equals("已理货")) { endStatr = "1"; } DataTable dt1 = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.CorePipeCarBill.getBillCedit", new Object[] { row.Cells["BillNo"].Text.Trim(), row.Cells["JudgeStoveNo"].Text, row.Cells["BatchNo"].Text, row.Cells["GroupNo"].Text, endStatr }, this.ob); if (dt1.Rows[0]["EDIT_FLAG"].ToString().Equals("1")) { MessageUtil.ShowTips("您选择的这炉已理货,不能进行此操作!"); return; } //} ArrayList list = new ArrayList(); list.Add(row.Cells["BillNo"].Value.ToString()); list.Add(row.Cells["JudgeStoveNo"].Value.ToString()); list.Add(row.Cells["BatchNo"].Value.ToString()); list.Add(row.Cells["GroupNo"].Value.ToString()); list.Add(row.Cells["Vstel"].Value.ToString()); list.Add(row.Cells["Vstel"].Text.ToString()); list1.Add(list); } } if (count == 0) { MessageUtil.ShowTips("请选择要修改装车地点对应炉号!"); return; } if (MessageUtil.ShowYesNoAndQuestion("是否修改装车地点") == DialogResult.No) return; int update = 0; update = ServerHelper.SetData("com.steering.pss.ydm.pipeleavefactory.FrmPipeTrainBill.updateLoad", new object[] { list1 }, ob); if (update > 0) { MessageUtil.ShowTips("装车地点修改成功!"); QueryBillCInfo(ugr1.Cells["BillNo"].Value.ToString()); } } private void ultraGridBillC_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { foreach (UltraGridRow uRow in ultraGridBillC.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHK"].Value = true; } } } private void ultraGridBillC_CellChange(object sender, CellEventArgs e) { ultraGridBillC.UpdateData(); listBillC.Change((YdmZcBillCEntity)e.Cell.Row.ListObject); } private void ultraGridBillM_BeforeCellDeactivate(object sender, CancelEventArgs e) { if (listBillC.IsChanged) { if (MessageUtil.ShowYesNoAndQuestion("是否放弃当前编辑?") == DialogResult.No) { e.Cancel = true; } } } private void ultraGridBillM_CellDataError(object sender, CellDataErrorEventArgs e) { e.RaiseErrorEvent = false; } /// /// 直接出库 /// private void doBillOut() { ultraGridBillM.UpdateData(); UltraGridRow ugr = ultraGridBillM.ActiveRow; if (ugr == null) return; IQueryable ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'"); if (ugrs.Count() == 0) { MessageUtil.ShowTips("请选择您要操作的数据!"); return; } ArrayList param = new ArrayList(); ArrayList list = new ArrayList(); foreach (UltraGridRow row in ugrs) { string delvaddr = row.Cells["DelvryAddr"].Text; if (delvaddr.Equals("客户库-腾飞") || delvaddr.Equals("客户库-宝仓") || delvaddr.Equals("客户库-安利") || delvaddr.Equals("客户库-润德") || delvaddr.Equals("客户库-思创") || delvaddr.Equals("客户库-滨城")) { DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmOutAutomatic.queryBillC", new object[] { row.Cells["BillNo"].Value.ToString() }, ob); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string storage = dt.Rows[i]["STORAGE_NO"].ToString(); if (!storage.Equals("LAL1") && !storage.Equals("LAL2") && !storage.Equals("LAL3") && !storage.Equals("LBC1") && !storage.Equals("LBC2") && !storage.Equals("LTF1") && !storage.Equals("LZD1") && !storage.Equals("LZT1")) { if (MessageBox.Show("出库地点与交货地点不一致是否直接出库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; } } } } string typeTran = ""; if (row.Cells["PlanTransType"].Value.ToString().Equals("汽运")) { typeTran = "110501"; } else { typeTran = "110502"; } string[] str = new string[19]; str[0] = row.Cells["BillNo"].Value.ToString(); str[1] = row.Cells["SendPlanNo"].Value.ToString(); str[2] = management_no; str[3] = management_name; str[4] = departid; str[5] = departname; str[6] = row.Cells["SaleOrg"].Value.ToString(); str[7] = row.Cells["SaleOrgDesc"].Value.ToString(); str[8] = typeTran; str[9] = row.Cells["ReceivNo"].Value.ToString(); str[10] = row.Cells["ReceivNm"].Value.ToString(); str[11] = row.Cells["StlmtUnitNo"].Value.ToString(); str[12] = row.Cells["StlmtUnitNm"].Value.ToString(); str[13] = row.Cells["StationNo"].Value.ToString(); str[14] = row.Cells["StationNm"].Value.ToString(); str[15] = row.Cells["SpclLnNo"].Value.ToString(); str[16] = row.Cells["SpclLnNm"].Value.ToString(); str[17] = this.UserInfo.GetUserGroup();//班组 str[18] = this.UserInfo.GetUserOrder();//班次 param.Add(str); } if (MessageBox.Show("是否确认出库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); //if (ComTransitTyp.Value.ToString().Equals("405005")) //{ // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.FrmCasOutAutomatic"; // ccp.MethodName = "addTallyInfo"; //} //else //{ ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.FrmOutAutomatic"; ccp.MethodName = "addTallyInfo"; //} ccp.ServerParams = new object[] { param, this.UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; if (ccp.ReturnCode == -1) return; } catch (Exception ex) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("出库成功!")) { QueryBillMInfo(); foreach (UltraGridRow ugrc in ultraGridBillM.Rows) { if (ugrc.Cells["BillNo"].Text.Equals(_billNo)) { ugrc.Activate(); _billNo = ""; return; } } } } } /// /// 撤销出库 /// private void doDeleteBillOut() { ultraGridBillM.UpdateData(); UltraGridRow ugr = ultraGridBillM.ActiveRow; if (ugr == null) return; IQueryable ugrs = ultraGridBillM.Rows.AsQueryable().Where(" CHC = 'True'"); if (ugrs.Count() == 0) { MessageUtil.ShowTips("请选择您要操作的数据!"); return; } ArrayList param = new ArrayList(); foreach (UltraGridRow row in ugrs) { ArrayList parm = new ArrayList(); parm.Add(row.Cells["BillNo"].Text.Trim()); DataTable dg = ServerHelper.GetData("com.steering.pss.ydm.pipeleavefactory.FrmOutAutomatic.selectYearMoth", new object[] { parm }, ob); if (int.Parse(dg.Rows[0]["ACOUNT"].ToString()) > 0) { MessageUtil.ShowTips("该提货单【" + row.Cells["BillNo"].Text.Trim() + "】对应的炉批信息已进行结转,不允许撤销!"); return; } string[] str = new string[6]; str[0] = row.Cells["BillNo"].Value.ToString(); str[1] = row.Cells["SendPlanNo"].Value.ToString(); str[2] = management_no; str[3] = management_name; str[4] = departid; str[5] = departname; param.Add(str); } if (MessageBox.Show("是否确认撤销出库?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); //if (ComTransitTyp.Value.ToString().Equals("405005")) //{ // ccp.ServerName = "com.steering.pss.ydm.acasleavefactory.FrmCasOutAutomatic"; // ccp.MethodName = "deleteTallyInfo"; //} //else //{ ccp.ServerName = "com.steering.pss.ydm.pipeleavefactory.FrmOutAutomatic"; ccp.MethodName = "deleteTallyInfo"; //} ccp.ServerParams = new object[] { param, this.UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; if (ccp.ReturnCode == -1) return; } catch (Exception ex) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销出库成功!")) { QueryBillMInfo(); foreach (UltraGridRow ugrc in ultraGridBillM.Rows) { if (ugrc.Cells["BillNo"].Text.Equals(_billNo)) { ugrc.Activate(); _billNo = ""; return; } } } } } /// /// 管坯支数 /// /// /// private void ultraGridPipeMat_CellChange(object sender, CellEventArgs e) { UltraGridRow urg = ultraGridOrder.ActiveRow; if (e.Cell.Row.Cells["ActCount"].Value == null) { e.Cell.Row.Cells["ActCount"].Value = "0"; e.Cell.Row.Cells["ActWeight"].Value = "0"; e.Cell.Row.Cells["ActLen"].Value = "0"; if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支")) { e.Cell.Row.Cells["SendNum"].Value = 0; } } else { ultraGridPipeMat.UpdateData(); string actCount = e.Cell.Row.Cells["ActCount"].Value.ToString(); if (!StringUtil.IsInt(actCount) || actCount == "0") { e.Cell.Row.Cells["ActCount"].Value = "0"; e.Cell.Row.Cells["ActWeight"].Value = "0"; e.Cell.Row.Cells["ActLen"].Value = "0"; if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支")) { e.Cell.Row.Cells["SendNum"].Value = 0; } } else { PipeMatGpMEntity matpipeEntity = (PipeMatGpMEntity)ultraGridPipeMat.ActiveRow.ListObject; DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.acasleavefactory.CoreCasCarBill.checkMatWeight", new object[] { JSONFormat.Format(matpipeEntity) }, this.ob); if (dt != null && dt.Rows.Count > 0) { e.Cell.Row.Cells["ActWeight"].Value = dt.Rows[0][0].ToString(); e.Cell.Row.Cells["ActCount"].Value = dt.Rows[0][1].ToString(); e.Cell.Row.Cells["ActLen"].Value = dt.Rows[0][2].ToString(); if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支")) { e.Cell.Row.Cells["SendNum"].Value = dt.Rows[0][0].ToString(); } } else { e.Cell.Row.Cells["ActCount"].Value = "0"; e.Cell.Row.Cells["ActWeight"].Value = "0"; e.Cell.Row.Cells["ActLen"].Value = "0"; if (urg.Cells["ORDER_UNIT"].Text.Equals("吨") || urg.Cells["ORDER_UNIT"].Text.Equals("支")) { e.Cell.Row.Cells["SendNum"].Value = 0; } } } } if (e.Cell.Column.Key.Equals("SendNum")) { if (e.Cell.Row.Cells["SendNum"].Value == null) { e.Cell.Row.Cells["SendNum"].Value = "0"; } else { ultraGridPipeMat.UpdateData(); string actLen = e.Cell.Row.Cells["SendNum"].Value.ToString(); if (!StringUtil.IsFloat(actLen) || actLen == "0")//actCount == "" || int.Parse(actCount)==0 { e.Cell.Row.Cells["SendNum"].Value = "0"; } } } string storage = ""; foreach (UltraGridRow ugr1 in ultraGridPipeMat.Rows) { if (Convert.ToBoolean(ugr1.Cells["CHK"].Text) == true) { storage = ugr1.Cells["StorageNo"].Value.ToString(); } } double count = 0; double weght = 0; double len = 0; ultraGroupBox4.Text = "资源信息区"; int i = 0; foreach (UltraGridRow ugr in ultraGridPipeMat.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { if (storage != ugr.Cells["StorageNo"].Value.ToString()) { i++; } ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text; count += double.Parse(ugr.Cells["ActCount"].Value.ToString()); weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString()); len += double.Parse(ugr.Cells["ActLen"].Value.ToString()); } } ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3"); } /// /// 管坯托选 /// /// /// private void ultraGridPipeMat_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { foreach (UltraGridRow uRow in ultraGridPipeMat.Selected.Rows) { if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow)) { uRow.Cells["CHK"].Value = true; } } string storage = ""; foreach (UltraGridRow ugr1 in ultraGridPipeMat.Rows) { if (Convert.ToBoolean(ugr1.Cells["CHK"].Text) == true) { storage = ugr1.Cells["StorageNo"].Value.ToString(); } } double count = 0; double weght = 0; double len = 0; ultraGroupBox4.Text = "资源信息区"; int i = 0; UltraGridRow row = ultraGridPipeMat.ActiveRow; foreach (UltraGridRow ugr in ultraGridPipeMat.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { if (storage != ugr.Cells["StorageNo"].Value.ToString()) { i++; } ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text; count += double.Parse(ugr.Cells["ActCount"].Value.ToString()); weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString()); len += double.Parse(ugr.Cells["ActLen"].Value.ToString()); } } ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3"); } private void chkAll_CheckedChanged(object sender, EventArgs e) { if (chkAll.Checked) { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGridSourse.Rows) { uRow.Cells["CHC"].Value = true; } } else { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGridSourse.Rows) { uRow.Cells["CHC"].Value = false; } } double count = 0; double weght = 0; double len = 0; double send = 0; ultraGroupBox4.Text = "资源信息区"; UltraGridRow row = ultraGridSourse.ActiveRow; foreach (UltraGridRow ugr in ultraGridSourse.Rows) { if (Convert.ToBoolean(ugr.Cells["CHC"].Text) == true) { ugr.Cells["VstelDesc"].Value = ugr.Cells["Vstel"].Text; count += double.Parse(ugr.Cells["ActCount"].Value.ToString()); weght += double.Parse(ugr.Cells["ActWeight"].Value.ToString()); len += double.Parse(ugr.Cells["ActLen"].Value.ToString()); send += double.Parse(ugr.Cells["SendNum"].Value.ToString()); } } ultraGroupBox4.Text = ultraGroupBox4.Text + " 支:" + count + " 吨:" + weght.ToString("f3") + " 长度:" + len.ToString("f3") + " 实发数:" + send.ToString("f3"); } private void cmbAcount_EditorButtonClick(object sender, EditorButtonEventArgs e) { this.ultraGridSourse.UpdateData(); UltraGridRow row = this.ultraGridSourse.ActiveRow; UltraGridRow ugr = ultraGridOrder.ActiveRow; if (row == null) { return; } FrmMatNo frm = new FrmMatNo(row, ob); frm.ShowDialog(); if (frm.flag.Equals("1")) { row.Cells["MatNo"].Value = frm.matNo.TrimEnd(new char[] { ',' }).ToString(); row.Cells["ActCount"].Value = frm.acount.ToString(); row.Cells["MeasuringSeq"].Value = frm.mesNo.TrimEnd(new char[] { ',' }).ToString(); row.Cells["ActWeight"].Value = frm.wgt; if (ugr.Cells["ORDER_UNIT"].Text.Trim().Equals("米") || ugr.Cells["ORDER_UNIT"].Text.Trim().Equals("英尺")) { row.Cells["SendNum"].Value = frm.sumlength; } else if (ugr.Cells["ORDER_UNIT"].Text.Equals("支") || ugr.Cells["ORDER_UNIT"].Text.Equals("个")) { row.Cells["SendNum"].Value = frm.acount; } else { row.Cells["SendNum"].Value = frm.wgt; } } else { return; } } private void cmbAcount_EditorButtonClick_1(object sender, EditorButtonEventArgs e) { } } }