private void _PrintDocument_PrintPage(object sender, PrintPageEventArgs e) { Graphics g = e.Graphics; if (this.gs != null) { g = this.gs; } string SerialNumber = string.Empty, CarNumber = string.Empty, CustomerName = string.Empty, CompanyName = string.Empty, FuelKindName = string.Empty, GrossTime = string.Empty, TareTime = string.Empty, TicketWeight = string.Empty, GrossWeight = string.Empty, TareWeight = string.Empty, SuttleWeight = string.Empty, UserName = string.Empty; if (this._BuyFuelTransport != null) { SerialNumber = this._BuyFuelTransport.SerialNumber; CarNumber = this._BuyFuelTransport.CarNumber; CmcsFuelKind fuelkind = Dbers.GetInstance().SelfDber.Get <CmcsFuelKind>(this._BuyFuelTransport.FuelKindId); if (fuelkind != null) { FuelKindName = fuelkind.FuelName; } CmcsSupplier customer = this._BuyFuelTransport.TheSupplier; if (customer != null) { CustomerName = customer.Name; } CmcsTransportCompany company = Dbers.GetInstance().SelfDber.Get <CmcsTransportCompany>(this._BuyFuelTransport.TransportCompanyId); if (company != null) { CompanyName = company.Name; } GrossTime = DisposeTime(this._BuyFuelTransport.GrossTime.ToString(), "yyyy-MM-dd HH:mm"); TareTime = DisposeTime(this._BuyFuelTransport.TareTime.ToString(), "yyyy-MM-dd HH:mm"); GrossWeight = this._BuyFuelTransport.GrossWeight.ToString("F2").PadLeft(6, ' '); TareWeight = this._BuyFuelTransport.TareWeight.ToString("F2").PadLeft(6, ' '); SuttleWeight = this._BuyFuelTransport.SuttleWeight.ToString("F2").PadLeft(6, ' '); #region 销售煤 // 行间距 24 float TopValue = 53; string printValue = ""; g.DrawString("河南煤炭储配交易中心有限公司", new Font("黑体", 16, FontStyle.Bold, GraphicsUnit.Pixel), Brushes.Black, 30, TopValue); TopValue += 34; g.DrawString("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm"), ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawLine(new Pen(Color.Black, 2), 0, TopValue, 300 - 10, TopValue); TopValue += 15; g.DrawString("车 牌 号:" + CarNumber, ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; printValue = printValue = "发 货 方:鹤壁园区"; if (printValue.Length > 19) { g.DrawString(printValue.Substring(0, 19), ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawString(printValue.Substring(19, printValue.Length - 19), ContentFont, Brushes.Black, 105, TopValue); TopValue += 24; } else { g.DrawString(printValue, ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; } printValue = printValue = "收货单位:" + CustomerName; if (printValue.Length > 19) { g.DrawString(printValue.Substring(0, 19), ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawString(printValue.Substring(19, printValue.Length - 19), ContentFont, Brushes.Black, 105, TopValue); TopValue += 24; } else { g.DrawString(printValue, ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; } printValue = printValue = "运输单位:" + CompanyName; if (printValue.Length > 19) { g.DrawString(printValue.Substring(0, 19), ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawString(printValue.Substring(19, printValue.Length - 19), ContentFont, Brushes.Black, 105, TopValue); TopValue += 24; } else { g.DrawString(printValue, ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; } g.DrawString("煤 种:" + FuelKindName, ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawString(string.Format("毛 重:{0} 吨", GrossWeight), ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawString(string.Format("皮 重:{0} 吨", TareWeight), ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawString(string.Format("净 重:{0} 吨", SuttleWeight), ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawString(string.Format("操 作 员:{0}", SelfVars.LoginUser.UserName), ContentFont, Brushes.Black, 30, TopValue); TopValue += 24; g.DrawString(string.Format("签 字:"), ContentFont, Brushes.Black, 30, TopValue); TopValue += 34; // g.DrawString(PageIndex.ToString() + "联", ContentFont, Brushes.Black, 110, TopValue); //TopValue += 24; #endregion } }
/// <summary> /// 生成入厂煤运输排队记录,同时生成批次信息以及采制化三级编码 /// </summary> /// <param name="autotruck">车</param> /// <param name="supplier">供煤单位</param> /// <param name="mine">矿点</param> /// <param name="transportCompany">运输单位</param> /// <param name="fuelKind">煤种</param> /// <param name="ticketWeight">矿发量</param> /// <param name="inFactoryTime">入厂时间</param> /// <param name="Mpph">全过程煤批编号</param> /// <param name="sampler">指定采样机编号</param> /// <param name="remark">备注</param> /// <param name="place">地点</param> /// <returns></returns> public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsSupplier supplier, CmcsMine mine, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, decimal ticketWeight, DateTime inFactoryTime, string Mpph, string sampler, string remark, string place) { CmcsBuyFuelTransport transport = new CmcsBuyFuelTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(eCarType.入厂煤, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, SupplierId = supplier.Id, SupplierName = supplier.Name, MineId = mine.Id, MineName = mine.Name, TransportCompanyId = transportCompany.Id, TransportCompanyName = transportCompany.Name, FuelKindId = fuelKind.Id, FuelKindName = fuelKind.Name, TicketWeight = ticketWeight, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, Mpph = Mpph, SamplePlace = sampler, StepName = eTruckInFactoryStep.入厂.ToString(), HistoryTareAvg = GetHistoryTareAvg(autotruck.CarNumber), Remark = remark }; // 生成批次以及采制化三级编码数据 //CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport); //if (inFactoryBatch != null) //{ if (SelfDber.Insert(transport) > 0) { // 插入未完成运输记录 return(SelfDber.Insert(new CmcsUnFinishTransport { TransportId = transport.Id, CarType = eCarType.入厂煤.ToString(), AutotruckId = autotruck.Id, PrevPlace = place, }) > 0); } //} return(false); }
private void FrmBuyFuelTransport_Oper_Load(object sender, EventArgs e) { LoadSampleType(cmb_SampingType); cmbFuelName_BuyFuel.DisplayMember = "FuelName"; cmbFuelName_BuyFuel.ValueMember = "Id"; cmbFuelName_BuyFuel.DataSource = Dbers.GetInstance().SelfDber.Entities <CmcsFuelKind>("where Valid='有效' and ParentId is not null"); cmbFuelName_BuyFuel.SelectedIndex = 0; if (!String.IsNullOrEmpty(id)) { this.cmcsBuyFuelTransport = Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(this.id); txt_SerialNumber.Text = cmcsBuyFuelTransport.SerialNumber; txt_CarNumber.Text = cmcsBuyFuelTransport.CarNumber; CmcsInFactoryBatch cmcsinfactorybatch = Dbers.GetInstance().SelfDber.Get <CmcsInFactoryBatch>(cmcsBuyFuelTransport.InFactoryBatchId); if (cmcsinfactorybatch != null) { txt_InFactoryBatchNumber.Text = cmcsinfactorybatch.Batch; } if (cmcsBuyFuelTransport.SupplierId != null) { CmcsSupplier supplier = Dbers.GetInstance().SelfDber.Get <CmcsSupplier>(cmcsBuyFuelTransport.SupplierId); if (supplier != null) { txt_SupplierName.Text = supplier.Name; } } if (cmcsBuyFuelTransport.TransportCompanyId != null) { CmcsTransportCompany company = Dbers.GetInstance().SelfDber.Get <CmcsTransportCompany>(cmcsBuyFuelTransport.TransportCompanyId); if (company != null) { txt_TransportCompanyName.Text = company.Name; } } if (cmcsBuyFuelTransport.MineId != null) { CmcsMine mine = Dbers.GetInstance().SelfDber.Get <CmcsMine>(cmcsBuyFuelTransport.MineId); if (mine != null) { txt_MineName.Text = mine.Name; } } if (cmcsBuyFuelTransport.FuelKindId != null) { CmcsFuelKind fuelkind = Dbers.GetInstance().SelfDber.Get <CmcsFuelKind>(cmcsBuyFuelTransport.FuelKindId); if (fuelkind != null) { cmbFuelName_BuyFuel.Text = fuelkind.FuelName; } } cmb_SampingType.SelectedItem = cmcsBuyFuelTransport.SamplingType; dbi_TicketWeight.Value = (double)cmcsBuyFuelTransport.TicketWeight; dbi_GrossWeight.Value = (double)cmcsBuyFuelTransport.GrossWeight; dbi_TareWeight.Value = (double)cmcsBuyFuelTransport.TareWeight; dbi_DeductWeight.Value = (double)cmcsBuyFuelTransport.DeductWeight; dbi_SuttleWeight.Value = (double)cmcsBuyFuelTransport.SuttleWeight; dbi_CheckWeight.Value = (double)cmcsBuyFuelTransport.CheckWeight; dbi_ProfitWeight.Value = (double)cmcsBuyFuelTransport.ProfitAndLossWeight; dbi_KgWeight.Value = (double)cmcsBuyFuelTransport.KgWeight; dbi_KsWeight.Value = (double)cmcsBuyFuelTransport.KsWeight; dbi_AutoKsWeight.Value = (double)cmcsBuyFuelTransport.AutoKsWeight; txt_UnloadArea.Text = cmcsBuyFuelTransport.UnLoadArea; txt_InFactoryTime.Text = cmcsBuyFuelTransport.InFactoryTime.Year == 1 ? "" : cmcsBuyFuelTransport.InFactoryTime.ToString(); txt_SamplingTime.Text = cmcsBuyFuelTransport.SamplingTime.Year == 1 ? "" : cmcsBuyFuelTransport.SamplingTime.ToString(); txt_GrossTime.Text = cmcsBuyFuelTransport.GrossTime.Year == 1 ? "" : cmcsBuyFuelTransport.GrossTime.ToString(); txt_UploadTime.Text = cmcsBuyFuelTransport.UploadTime.Year == 1 ? "" : cmcsBuyFuelTransport.UploadTime.ToString(); txt_TareTime.Text = cmcsBuyFuelTransport.TareTime.Year == 1 ? "" : cmcsBuyFuelTransport.TareTime.ToString(); txt_OutFactoryTime.Text = cmcsBuyFuelTransport.OutFactoryTime.Year == 1 ? "" : cmcsBuyFuelTransport.OutFactoryTime.ToString(); txt_Remark.Text = cmcsBuyFuelTransport.Remark; chb_IsFinish.Checked = (cmcsBuyFuelTransport.IsFinish == 1); chb_IsUse.Checked = (cmcsBuyFuelTransport.IsUse == 1); cmb_SampingType.Text = cmcsBuyFuelTransport.SamplingType; ShowDeduct(this.cmcsBuyFuelTransport.Id); } if (!edit) { btnSubmit.Enabled = false; CMCS.CarTransport.Queue.Utilities.Helper.ControlReadOnly(panelEx2); } }
/// <summary> /// 生成入厂煤运输排队记录,同时生成批次信息以及采制化三级编码 /// </summary> /// <param name="autotruck">车</param> /// <param name="supplier">供煤单位</param> /// <param name="mine">矿点</param> /// <param name="transportCompany">运输单位</param> /// <param name="fuelKind">煤种</param> /// <param name="ticketWeight">矿发量</param> /// <param name="inFactoryTime">入厂时间</param> /// <param name="remark">备注</param> /// <param name="place">地点</param> /// <param name="samplingType">采样方式</param> /// <param name="heavyweight">重车磅</param> /// <param name="samplingType">船号</param> /// <returns></returns> public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsSupplier supplier, CmcsMine mine, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, decimal ticketWeight, DateTime inFactoryTime, string remark, string place, string heavyweight, string shipnumber) { CmcsBuyFuelTransport transport = new CmcsBuyFuelTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(eCarType.入厂煤, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, SupplierId = supplier.Id, SupplierName = supplier.Name, MineId = mine != null ? mine.Id:"", MineName = mine != null ? mine.Name:"", TransportCompanyId = transportCompany != null?transportCompany.Id:"", TransportCompanyName = transportCompany != null ? transportCompany.Name:"", FuelKindId = fuelKind != null?fuelKind.Id:"", FuelKindName = fuelKind != null ? fuelKind.Name:"", TicketWeight = ticketWeight, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, StepName = eTruckInFactoryStep.入厂.ToString(), Remark = remark, HeavyWeight = heavyweight, ShipName = shipnumber, Recorder = GlobalVars.LoginUser.Name }; // 生成批次以及采制化三级编码数据 CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport); if (inFactoryBatch != null) { if (SelfDber.Insert(transport) > 0) { // 插入未完成运输记录 return(SelfDber.Insert(new CmcsUnFinishTransport { TransportId = transport.Id, CarType = eCarType.入厂煤.ToString(), AutotruckId = autotruck.Id, PrevPlace = place, }) > 0); } } return(false); }
public bool JoinQueueSaleFuelTransport(CmcsAutotruck autotruck, CmcsSupplier supplier, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, DateTime inFactoryTime, string remark, string place, string loadarea) { CmcsSaleFuelTransport transport = new CmcsSaleFuelTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(eCarType.销售煤, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, TransportCompanyName = transportCompany.Name, TransportCompanyId = transportCompany.Id, SupplierName = supplier.Name, SupplierId = supplier.Id, FuelKindName = fuelKind.Name, FuelKindId = fuelKind.Id, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, StepName = eTruckInFactoryStep.入厂.ToString(), LoadArea = loadarea, Remark = remark }; if (SelfDber.Insert(transport) > 0) { // 插入未完成运输记录 return(SelfDber.Insert(new CmcsUnFinishTransport { TransportId = transport.Id, CarType = eCarType.销售煤.ToString(), AutotruckId = autotruck.Id, PrevPlace = place, }) > 0); } return(false); }
/// <summary> /// 生成入厂煤运输排队记录,同时生成批次信息以及采制化三级编码 /// </summary> /// <param name="autotruck">车</param> /// <param name="supplier">供煤单位</param> /// <param name="mine">矿点</param> /// <param name="transportCompany">运输单位</param> /// <param name="fuelKind">煤种</param> /// <param name="ticketWeight">矿发量</param> /// <param name="inFactoryTime">入厂时间</param> /// <param name="remark">备注</param> /// <param name="place">地点</param> /// <param name="samplingType">采样方式</param> /// <returns></returns> public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsMine mine, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, CmcsInNetTransport inNetTransport, decimal ticketWeight, string samplerCode, string weighterCode, DateTime inFactoryTime, string remark, string place, CmcsSupplier supplier = null) { CmcsBuyFuelTransport transport = new CmcsBuyFuelTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(eCarType.入厂煤, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, MineId = mine.Id, MineName = mine.Name, TransportCompanyId = transportCompany.Id, TransportCompanyName = transportCompany.Name, FuelKindId = fuelKind.Id, FuelKindName = fuelKind.Name, TicketWeight = ticketWeight, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, StepName = eTruckInFactoryStep.入厂.ToString(), OutNetTransportId = inNetTransport == null ? "" : inNetTransport.Id, SamplePlace = samplerCode, GrossPlace = weighterCode, Remark = remark, SamplingType = eSamplingType.机械采样.ToString() }; if (supplier != null) { transport.SupplierId = supplier.Id; transport.SupplierName = supplier.Name; } // 生成批次以及采制化三级编码数据 CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport); if (inFactoryBatch != null) { if (SelfDber.Insert(transport) > 0) { if (inNetTransport != null) { //更新内网矿发运输记录节点状态 inNetTransport.StepName = eTruckInFactoryStep.入厂.ToString(); inNetTransport.Infactorytime = inFactoryTime; SelfDber.Update(inNetTransport); } // 插入未完成运输记录 return(SelfDber.Insert(new CmcsUnFinishTransport { TransportId = transport.Id, CarType = eCarType.入厂煤.ToString(), AutotruckId = autotruck.Id, PrevPlace = place, }) > 0); } } return(false); }
/// <summary> /// 生成入厂煤运输排队记录,同时生成批次信息以及采制化三级编码 /// </summary> /// <param name="autotruck"></param> /// <param name="supplier"></param> /// <param name="mine"></param> /// <param name="transportCompany"></param> /// <param name="fuelKind"></param> /// <param name="ticketWeight"></param> /// <param name="inFactoryTime"></param> /// <param name="remark"></param> /// <param name="samplingType"></param> /// <param name="lmyb"></param> /// <param name="inFactoryType"></param> /// <returns></returns> public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsSupplier supplier, CmcsMine mine, CmcsTransportCompany transportCompany, CmcsFuelKind fuelKind, decimal ticketWeight, DateTime inFactoryTime, string remark, string samplingType, CmcsLMYB lmyb, string inFactoryType) { eTransportType TransportType; Enum.TryParse(inFactoryType, out TransportType); CmcsBuyFuelTransport transport = new CmcsBuyFuelTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(TransportType, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, SupplierId = supplier.Id, SupplierName = supplier.Name, InFactoryPlace = CommonAppConfig.GetInstance().AppIdentifier, MineId = mine.Id, MineName = mine.Name, TransportCompanyId = (transportCompany == null ? null : transportCompany.Id), FuelKindId = fuelKind.Id, FuelKindName = fuelKind.FuelName, TicketWeight = ticketWeight, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, SamplingType = samplingType, InFactoryType = inFactoryType.ToString(), StepName = eTruckInFactoryStep.入厂.ToString(), Remark = remark, LMYBId = lmyb != null ? lmyb.Id : "", YbNum = lmyb != null ? lmyb.YbNum : "" }; // 生成批次以及采制化三级编码数据 CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport, lmyb); if (inFactoryBatch != null) { if (SelfDber.Insert(transport) > 0) { // 插入未完成运输记录 return(SelfDber.Insert(new CmcsUnFinishTransport { TransportId = transport.Id, CarType = inFactoryType.ToString(), AutotruckId = autotruck.Id, PrevPlace = CommonAppConfig.GetInstance().AppIdentifier, }) > 0); } } return(false); }
/// <summary> /// 生成出场煤运输排队记录,同时生成批次信息 /// </summary> /// <param name="autotruck"></param> /// <param name="transportsales"></param> /// <param name="supplyReceive"></param> /// <param name="company"></param> /// <param name="fuelKind"></param> /// <param name="inFactoryTime"></param> /// <param name="remark"></param> /// <param name="place"></param> /// <param name="loadarea"></param> /// <returns></returns> public bool JoinQueueSaleFuelTransport(CmcsAutotruck autotruck, CmcsLMYB transportsales, CmcsSupplier supplyReceive, CmcsTransportCompany company, CmcsFuelKind fuelKind, DateTime inFactoryTime, string remark, string place, string loadarea, string transportType, string sampleType, Tuple <string, string> CPC, Tuple <string, string> storageName) { eTransportType TransportType; Enum.TryParse(transportType, out TransportType); CmcsSaleFuelTransport transport = new CmcsSaleFuelTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(TransportType, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, TransportSalesNum = transportsales != null ? transportsales.YbNum : "", TransportSalesId = transportsales != null ? transportsales.Id : "", TransportCompanyName = company.Name, TransportCompanyId = company.Id, TransportNo = transportsales != null ? transportsales.TransportNo : "", SupplierId = supplyReceive.Id, SupplierName = supplyReceive.Name, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, StepName = eTruckInFactoryStep.入厂.ToString(), LoadArea = loadarea, Remark = remark, FuelKindId = fuelKind != null ? fuelKind.Id : "", OutFactoryType = transportType, SampleType = sampleType, CPCId = CPC.Item1, CPCName = CPC.Item2, StorageId = storageName.Item1, StorageName = storageName.Item2, LMYBId = transportsales != null ? transportsales.Id : "" }; //生成批次数据 CmcsInFactoryBatch inOutBatch = carTransportDAO.GCQCInFactoryBatchBySaleFuelTransport(transport, transportsales); if (inOutBatch != null) { if (SelfDber.Insert(transport) > 0) { // 插入未完成运输记录 return(SelfDber.Insert(new CmcsUnFinishTransport { TransportId = transport.Id, CarType = transportType.ToString(), AutotruckId = autotruck.Id, PrevPlace = place, }) > 0); } } return(false); }
/// <summary> /// 同步全过程基础信息(供应商信息) /// </summary> public void SyncBaseInfoForGYS(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_gys qgc_gys in sqlDapperDber.Entities <View_gys>()) { if (commonDAO.SelfDber.Get <View_gys>(qgc_gys.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_gys>(qgc_gys); } else { commonDAO.SelfDber.Insert <View_gys>(qgc_gys); } CmcsSupplier cmcsSupplier = commonDAO.SelfDber.Entity <CmcsSupplier>("where PkId=:PkId", new { PkId = qgc_gys.Dbid }); if (cmcsSupplier == null) { commonDAO.SelfDber.Insert(new CmcsSupplier() { PkId = qgc_gys.Dbid, Name = qgc_gys.Gysqc, ShortName = qgc_gys.Gysjc, Code = qgc_gys.Gysbm, IsStop = int.Parse(qgc_gys.Is_valid) }); } else { cmcsSupplier.PkId = qgc_gys.Dbid; cmcsSupplier.Name = qgc_gys.Gysqc; cmcsSupplier.ShortName = qgc_gys.Gysjc; cmcsSupplier.Code = qgc_gys.Gysbm; cmcsSupplier.IsStop = int.Parse(qgc_gys.Is_valid); commonDAO.SelfDber.Update(cmcsSupplier); } CmcsTransportCompany cmcsTransportCompany = commonDAO.SelfDber.Entity <CmcsTransportCompany>("where PkId=:PkId", new { PkId = qgc_gys.Dbid }); if (cmcsTransportCompany == null) { commonDAO.SelfDber.Insert(new CmcsTransportCompany() { PkId = qgc_gys.Dbid, Name = qgc_gys.Gysqc, IsStop = int.Parse(qgc_gys.Is_valid), Code = qgc_gys.Gysbm }); } else { cmcsTransportCompany.PkId = qgc_gys.Dbid; cmcsTransportCompany.Name = qgc_gys.Gysqc; cmcsTransportCompany.IsStop = int.Parse(qgc_gys.Is_valid); cmcsTransportCompany.Code = qgc_gys.Gysbm; commonDAO.SelfDber.Update(cmcsTransportCompany); } res++; } } catch (Exception ex) { output("同步供应商信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步供应商信息{0}条", res), eOutputType.Normal); }
/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { if (txt_Name.Text.Length == 0) { MessageBoxEx.Show("运输单位名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txt_Code.Text.Length == 0) { MessageBoxEx.Show("运输单位编号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txt_OrganizationCode.Text.Length == 0) { MessageBoxEx.Show("组织机构代码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txt_ShortName.Text.Length == 0) { MessageBoxEx.Show("运输单位简称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((CmcsTransportCompany == null || CmcsTransportCompany.Name != txt_Name.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsTransportCompany>(" where Name=:Name", new { Name = txt_Name.Text }).Count > 0) { MessageBoxEx.Show("该单位名称不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((CmcsTransportCompany == null || CmcsTransportCompany.Code != txt_Code.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsTransportCompany>(" where Code=:Code", new { Code = txt_Code.Text }).Count > 0) { MessageBoxEx.Show("该单位编号不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((CmcsTransportCompany == null || CmcsTransportCompany.OrganizationCode != txt_OrganizationCode.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsTransportCompany>(" where OrganizationCode=:OrganizationCode", new { OrganizationCode = txt_OrganizationCode.Text }).Count > 0) { MessageBoxEx.Show("组织机构代码不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (this.EditMode == eEditMode.修改) { CmcsTransportCompany.Name = txt_Name.Text; CmcsTransportCompany.Code = txt_Code.Text; CmcsTransportCompany.IsStop = (chb_IsUse.Checked ? 0 : 1); CmcsTransportCompany.ShortName = txt_ShortName.Text; CmcsTransportCompany.OrganizationCode = txt_OrganizationCode.Text; CmcsTransportCompany.Remark = txt_Remark.Text; CmcsTransportCompany.IsSynch = 0; Dbers.GetInstance().SelfDber.Update(CmcsTransportCompany); } else if (this.EditMode == eEditMode.新增) { CmcsTransportCompany = new CmcsTransportCompany(); CmcsTransportCompany.Name = txt_Name.Text; CmcsTransportCompany.Code = txt_Code.Text; CmcsTransportCompany.IsStop = (chb_IsUse.Checked ? 0 : 1); CmcsTransportCompany.ShortName = txt_ShortName.Text; CmcsTransportCompany.OrganizationCode = txt_OrganizationCode.Text; CmcsTransportCompany.Remark = txt_Remark.Text; Dbers.GetInstance().SelfDber.Insert(CmcsTransportCompany); } this.DialogResult = DialogResult.OK; this.Close(); }