private void btnSubmit_Click(object sender, EventArgs e) { if (txt_SerialNumber.Text.Length == 0) { MessageBoxEx.Show("该标车牌号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if ((cmcsVisitTransport == null || cmcsVisitTransport.CarNumber != txt_SerialNumber.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsVisitTransport>(" where CarNumber=:CarNumber", new { CarNumber = txt_SerialNumber.Text }).Count > 0) { MessageBoxEx.Show("该标车牌号不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cmcsVisitTransport != null) { if (!CompareClass.CompareClassValue(this.cmcsVisitTransport, Dbers.GetInstance().SelfDber.Get <CmcsVisitTransport>(this.id))) { MessageBoxEx.Show("数据已更改请重新打开页面修改保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } cmcsVisitTransport.Remark = txt_Remark.Text; cmcsVisitTransport.IsFinish = (chb_IsFinish.Checked ? 1 : 0); cmcsVisitTransport.IsToServer = 0; Dbers.GetInstance().SelfDber.Update(cmcsVisitTransport); } else { cmcsVisitTransport = new CmcsVisitTransport(); cmcsVisitTransport.Remark = txt_Remark.Text; cmcsVisitTransport.IsFinish = (chb_IsFinish.Checked ? 1 : 0); Dbers.GetInstance().SelfDber.Insert(cmcsVisitTransport); } this.DialogResult = DialogResult.OK; this.Close(); }
private void btnSubmit_Click(object sender, EventArgs e) { if (!CheckInPut()) { return; } if (this.cmcsMake != null) { if (!CompareClass.CompareClassValue(this.cmcsMake, Dbers.GetInstance().SelfDber.Get <CmcsRCMake>(this.id))) { MessageBoxEx.Show("数据已更改请重新打开页面修改保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } this.cmcsMake.CreateUser = SelfVars.LoginUser.UserAccount; this.cmcsMake.OperUser = SelfVars.LoginUser.UserAccount; this.cmcsMake.GetPle = txt_GetPle.Text; if (string.IsNullOrEmpty(txt_MakeCode.Text)) { txt_MakeCode.Text = CommonDAO.GetInstance().CreateNewMakeCode(dt_UseTime.Value); } this.cmcsMake.MakeCode = txt_MakeCode.Text; this.cmcsMake.MakePle = txt_MakePle.Text; this.cmcsMake.SendUnit = txt_SendUnit.Text; this.cmcsMake.MakePle = txt_MakePle.Text; this.cmcsMake.UseTime = dt_UseTime.Value; this.cmcsMake.GetDate = dt_GetDate.Value; this.cmcsMake.MakeEndTime = dt_MakeEndTime.Value; this.cmcsMake.MakeStartTime = dt_MakeStartTime.Value; this.cmcsMake.GetBarrelWeight = Convert.ToDecimal(dbi_GetBarrelWeight.Value); this.cmcsMake.IsSynch = "0"; SaveAndUpdate(cmcsMake, GetDetails()); } else { this.cmcsMake = new CmcsRCMake(); this.cmcsMake.MakeType = "监督样制样"; this.cmcsMake.MakeStyle = eMakeType.人工制样.ToString(); this.cmcsMake.GetPle = txt_GetPle.Text; this.cmcsMake.MakeCode = txt_MakeCode.Text; this.cmcsMake.MakePle = txt_MakePle.Text; this.cmcsMake.SendUnit = txt_SendUnit.Text; this.cmcsMake.MakePle = txt_MakePle.Text; this.cmcsMake.UseTime = dt_UseTime.Value; this.cmcsMake.GetDate = dt_GetDate.Value; this.cmcsMake.MakeEndTime = dt_MakeEndTime.Value; this.cmcsMake.MakeStartTime = dt_MakeStartTime.Value; this.cmcsMake.GetBarrelWeight = Convert.ToDecimal(dbi_GetBarrelWeight.Value); this.cmcsMake.Remark = txt_Remark.Text + " 由人工制样室创建"; this.cmcsMake.IsSynch = "0"; if (this.cmcsMakeDetail.Count == 0) { btn_CreateMakeDetail_Click(null, null); } SaveAndUpdate(cmcsMake, GetDetails().Count == 0 ? this.cmcsMakeDetail : GetDetails()); } this.DialogResult = DialogResult.OK; this.Close(); }
private void btnSubmit_Click(object sender, EventArgs e) { if (txt_SerialNumber.Text.Length == 0) { MessageBoxEx.Show("该标车牌号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if ((cmcsBuyFuelTransport == null || cmcsBuyFuelTransport.CarNumber != txt_CarNumber.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsBuyFuelTransport>(" where CarNumber=:CarNumber and IsFinish=0", new { CarNumber = txt_CarNumber.Text }).Count > 0) { MessageBoxEx.Show("该标车牌号不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cmcsBuyFuelTransport != null) { if (!CompareClass.CompareClassValue(this.cmcsBuyFuelTransport, Dbers.GetInstance().SelfDber.Get <CmcsBuyFuelTransport>(this.id))) { MessageBoxEx.Show("数据已更改请重新打开页面修改保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cmcsBuyFuelTransport.CarNumber != txt_CarNumber.Text) { CmcsAutotruck autotruck = Dbers.GetInstance().SelfDber.Entity <CmcsAutotruck>(" where CarNumber=:CarNumber", new { CarNumber = this.txt_CarNumber.Text }); if (autotruck != null) { cmcsBuyFuelTransport.AutotruckId = autotruck.Id; CmcsUnFinishTransport unfinish = Dbers.GetInstance().SelfDber.Entity <CmcsUnFinishTransport>(" where TransportId=:TransportId", new { TransportId = cmcsBuyFuelTransport.Id }); if (unfinish != null) { unfinish.AutotruckId = autotruck.Id; Dbers.GetInstance().SelfDber.Update(unfinish); } } } cmcsBuyFuelTransport.SerialNumber = txt_SerialNumber.Text; cmcsBuyFuelTransport.CarNumber = txt_CarNumber.Text; if (cmcsSupplier != null) { cmcsBuyFuelTransport.SupplierId = cmcsSupplier.Id; cmcsBuyFuelTransport.SupplierName = cmcsSupplier.Name; } if (cmcsTransportCompany != null) { cmcsBuyFuelTransport.TransportCompanyId = cmcsTransportCompany.Id; } if (cmcsMine != null) { cmcsBuyFuelTransport.MineId = cmcsMine.Id; cmcsBuyFuelTransport.MineName = cmcsMine.Name; } if (cmcsFuelKind != null) { cmcsBuyFuelTransport.FuelKindId = cmcsFuelKind.Id; cmcsBuyFuelTransport.FuelKindName = cmcsFuelKind.FuelName; } cmcsBuyFuelTransport.SamplingType = (string)cmb_SampingType.Text; cmcsBuyFuelTransport.TicketWeight = (decimal)dbi_TicketWeight.Value; cmcsBuyFuelTransport.GrossWeight = (decimal)dbi_GrossWeight.Value; cmcsBuyFuelTransport.KsWeight = (decimal)dbi_KsWeight.Value; cmcsBuyFuelTransport.KgWeight = (decimal)dbi_KgWeight.Value; cmcsBuyFuelTransport.AutoKsWeight = (decimal)dbi_AutoKsWeight.Value; cmcsBuyFuelTransport.DeductWeight = cmcsBuyFuelTransport.KsWeight + cmcsBuyFuelTransport.KgWeight + cmcsBuyFuelTransport.AutoKsWeight; cmcsBuyFuelTransport.TareWeight = (decimal)dbi_TareWeight.Value; cmcsBuyFuelTransport.SuttleWeight = (decimal)dbi_SuttleWeight.Value; txt_Remark.Text = cmcsBuyFuelTransport.Remark; cmcsBuyFuelTransport.IsFinish = (chb_IsFinish.Checked ? 1 : 0); cmcsBuyFuelTransport.IsUse = (chb_IsUse.Checked ? 1 : 0); CmcsInFactoryBatch inFactoryBatch = CarTransportDAO.GetInstance().GCQCInFactoryBatchByBuyFuelTransport(cmcsBuyFuelTransport, null); if (inFactoryBatch != null) { cmcsBuyFuelTransport.InFactoryBatchId = inFactoryBatch.Id; } else { MessageBoxEx.Show("供应商、矿点、煤种不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } cmcsBuyFuelTransport.IsSynch = "0"; WeighterDAO.GetInstance().SaveBuyFuelTransport(cmcsBuyFuelTransport); SaveAndUpdate(cmcsBuyFuelTransport, cmcsbuyfueltransportdeducts); } else { cmcsBuyFuelTransport = new CmcsBuyFuelTransport(); cmcsBuyFuelTransport.SerialNumber = txt_SerialNumber.Text; cmcsBuyFuelTransport.CarNumber = txt_CarNumber.Text; if (cmcsSupplier != null) { cmcsBuyFuelTransport.SupplierId = cmcsSupplier.Id; } if (cmcsTransportCompany != null) { cmcsBuyFuelTransport.TransportCompanyId = cmcsTransportCompany.Id; } if (cmcsMine != null) { cmcsBuyFuelTransport.MineId = cmcsMine.Id; } if (cmcsFuelKind != null) { cmcsBuyFuelTransport.FuelKindId = cmcsFuelKind.Id; } cmcsBuyFuelTransport.SamplingType = (string)cmb_SampingType.SelectedItem; cmcsBuyFuelTransport.TicketWeight = (decimal)dbi_TicketWeight.Value; cmcsBuyFuelTransport.GrossWeight = (decimal)dbi_GrossWeight.Value; cmcsBuyFuelTransport.DeductWeight = (decimal)dbi_DeductWeight.Value; cmcsBuyFuelTransport.TareWeight = (decimal)dbi_TareWeight.Value; txt_Remark.Text = cmcsBuyFuelTransport.Remark; cmcsBuyFuelTransport.IsFinish = (chb_IsFinish.Checked ? 1 : 0); cmcsBuyFuelTransport.IsUse = (chb_IsUse.Checked ? 1 : 0); WeighterDAO.GetInstance().SaveBuyFuelTransport(cmcsBuyFuelTransport); SaveAndUpdate(cmcsBuyFuelTransport, cmcsbuyfueltransportdeducts); } this.DialogResult = DialogResult.OK; this.Close(); }
private void btnSubmit_Click(object sender, EventArgs e) { if (txt_SerialNumber.Text.Length == 0) { MessageBoxEx.Show("该标车牌号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if ((cmcsGoodsTransport == null || cmcsGoodsTransport.CarNumber != txt_SerialNumber.Text) && Dbers.GetInstance().SelfDber.Entities <CmcsGoodsTransport>(" where CarNumber=:CarNumber", new { CarNumber = txt_SerialNumber.Text }).Count > 0) { MessageBoxEx.Show("该标车牌号不可重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cmcsGoodsTransport != null) { if (!CompareClass.CompareClassValue(this.cmcsGoodsTransport, Dbers.GetInstance().SelfDber.Get <CmcsGoodsTransport>(this.id))) { MessageBoxEx.Show("数据已更改请重新打开页面修改保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cmcsGoodsTransport.CarNumber != txt_CarNumber.Text) { CmcsAutotruck autotruck = Dbers.GetInstance().SelfDber.Entity <CmcsAutotruck>(" where CarNumber=:CarNumber", new { CarNumber = this.txt_CarNumber.Text }); if (autotruck != null) { cmcsGoodsTransport.AutotruckId = autotruck.Id; CmcsUnFinishTransport unfinish = Dbers.GetInstance().SelfDber.Entity <CmcsUnFinishTransport>(" where TransportId=:TransportId", new { TransportId = cmcsGoodsTransport.Id }); if (unfinish != null) { unfinish.AutotruckId = autotruck.Id; Dbers.GetInstance().SelfDber.Update(unfinish); } } } cmcsGoodsTransport.CarNumber = txt_CarNumber.Text; cmcsGoodsTransport.FirstWeight = (decimal)dbi_FirstWeight.Value; cmcsGoodsTransport.SecondWeight = (decimal)dbi_SecondWeight.Value; if (dbi_FirstWeight.Value != 0 && (decimal)dbi_SecondWeight.Value != 0) { cmcsGoodsTransport.SuttleWeight = Math.Abs((decimal)dbi_FirstWeight.Value - (decimal)dbi_SecondWeight.Value); } if (supplyUnit != null) { cmcsGoodsTransport.ReceiveUnitId = receiveUnit.Id; } if (receiveUnit != null) { cmcsGoodsTransport.SupplyUnitId = supplyUnit.Id; } if (cmcsGoodsType != null) { cmcsGoodsTransport.GoodsTypeId = cmcsGoodsType.Id; } txt_Remark.Text = cmcsGoodsTransport.Remark; cmcsGoodsTransport.IsFinish = (chb_IsFinish.Checked ? 1 : 0); cmcsGoodsTransport.IsUse = (chb_IsUse.Checked ? 1 : 0); cmcsGoodsTransport.IsSynch = "0"; Dbers.GetInstance().SelfDber.Update(cmcsGoodsTransport); } else { cmcsGoodsTransport = new CmcsGoodsTransport(); cmcsGoodsTransport.FirstWeight = (decimal)dbi_FirstWeight.Value; cmcsGoodsTransport.SecondWeight = (decimal)dbi_SecondWeight.Value; if (dbi_FirstWeight.Value != 0 && (decimal)dbi_SecondWeight.Value != 0) { cmcsGoodsTransport.SuttleWeight = Math.Abs((decimal)dbi_FirstWeight.Value - (decimal)dbi_SecondWeight.Value); } if (supplyUnit != null) { cmcsGoodsTransport.ReceiveUnitId = receiveUnit.Id; } if (receiveUnit != null) { cmcsGoodsTransport.SupplyUnitId = supplyUnit.Id; } if (cmcsGoodsType != null) { cmcsGoodsTransport.GoodsTypeId = cmcsGoodsType.Id; } txt_Remark.Text = cmcsGoodsTransport.Remark; cmcsGoodsTransport.IsFinish = (chb_IsFinish.Checked ? 1 : 0); cmcsGoodsTransport.IsUse = (chb_IsUse.Checked ? 1 : 0); Dbers.GetInstance().SelfDber.Insert(cmcsGoodsTransport); } this.DialogResult = DialogResult.OK; this.Close(); }