/// <summary> /// 根据父编码获取下级节点编码(父编码+2位逐级递增的数值) /// </summary> /// <param name="strCode"></param> /// <returns></returns> public string GetMineNewChildCode(string strCode) { string strNewCode = strCode; CmcsMine mine = new CmcsMine(); if (strCode == "00") { mine = commonDAO.SelfDber.Entity <CmcsMine>("where ParentId=:ParentId order by Code desc ", new { ParentId = "-1" }); } else { mine = commonDAO.SelfDber.Entity <CmcsMine>("where Code like :Code ||'%' and Code !=:Code order by Code desc ", new { Code = strCode }); } if (mine != null) { strNewCode = mine.Code.Replace(strCode, ""); strNewCode = strCode + (Convert.ToInt32(strNewCode) + 1).ToString().PadLeft(2, '0'); } else { if (strCode == "00") { strNewCode = "0001"; } else { strNewCode = strCode + "01"; } } return(strNewCode); }
DevComponents.AdvTree.Node CreateNode(CmcsMine entity) { DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node(entity.Name + ((entity.Valid == "有效") ? "" : "(无效)")); node.Tag = entity; node.Expanded = true; return(node); }
private void btnSubmit_Click(object sender, EventArgs e) { if (strEditMode == "add") { CmcsMine mine = new CmcsMine() { Code = carTransportDao.GetMineNewChildCode(Output.Code), Name = txt_Name.Text, Valid = chb_IsUse.Checked ? "有效" : "无效", Sequence = dbi_Sequence.Value, ReMark = txt_ReMark.Text, ParentId = Output.Id }; carTransportDao.InsertMine(mine); } else { //Output.Code = carTransportDao.GetMineNewChildCode(Output.Code); //Output.NodeCode = carTransportDao.GetMineNewChildCode(Output.Code); Output.Name = txt_Name.Text; Output.Sequence = dbi_Sequence.Value; Output.Valid = chb_IsUse.Checked ? "有效" : "无效"; Output.ReMark = txt_ReMark.Text; carTransportDao.InsertMine(Output); } FrmMine_List_Shown(null, null); }
private void InitTree() { IList <CmcsMine> rootList = Dbers.GetInstance().SelfDber.Entities <CmcsMine>(); if (rootList.Count == 0) { //初始化根节点 CmcsMine rootFuelKind = new CmcsMine(); rootFuelKind.Id = "-1"; rootFuelKind.Name = "矿点管理"; rootFuelKind.Code = "00"; rootFuelKind.IsStop = 0; rootFuelKind.Sequence = 0; Dbers.GetInstance().SelfDber.Insert <CmcsMine>(rootFuelKind); } advTree1.Nodes.Clear(); CmcsMine rootEntity = Dbers.GetInstance().SelfDber.Get <CmcsMine>("-1"); DevComponents.AdvTree.Node rootNode = CreateNode(rootEntity); LoadData(rootEntity, rootNode); advTree1.Nodes.Add(rootNode); ProcessFromRequest(eEditMode.查看); }
void addCmcsMine(CmcsMine item) { txt_Name.Text = item.Name; txt_ReMark.Text = item.ReMark; dbi_Sequence.Text = item.Sequence.ToString(); chb_IsUse.Checked = (item.Valid == "有效"); }
/// <summary> /// 生成运输记录 /// </summary> /// <param name="autotruck"></param> /// <param name="mine"></param> /// <param name="fuelKind"></param> /// <param name="ticketWeight"></param> /// <param name="inFactoryTime"></param> /// <param name="remark"></param> /// <returns></returns> public bool JoinQueueBuyFuelTransport(CmcsAutotruck autotruck, CmcsMine mine, CmcsFuelKind fuelKind, decimal ticketWeight, DateTime inFactoryTime, string remark, ref CmcsBuyFuelTransport transport) { transport = new CmcsBuyFuelTransport { SerialNumber = carTransportDAO.CreateNewTransportSerialNumber(eTransportType.原料煤入场, inFactoryTime), AutotruckId = autotruck.Id, CarNumber = autotruck.CarNumber, InFactoryPlace = CommonAppConfig.GetInstance().AppIdentifier, MineId = mine.Id, MineName = mine.Name, FuelKindId = fuelKind.Id, FuelKindName = fuelKind.FuelName, TicketWeight = ticketWeight, InFactoryTime = inFactoryTime, IsFinish = 0, IsUse = 1, StepName = eTruckInFactoryStep.入厂.ToString(), Remark = remark }; CmcsInFactoryBatch inFactoryBatch = carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(transport, null); if (SelfDber.Insert(transport) > 0) { // 插入未完成运输记录 return(SelfDber.Insert(new CmcsUnFinishTransport { TransportId = transport.Id, CarType = eCarType.入场煤.ToString(), AutotruckId = autotruck.Id, PrevPlace = CommonAppConfig.GetInstance().AppIdentifier }) > 0); } return(false); }
void Return() { //if (advTree1.SelectedNode.Parent == null) return; this.Output = (advTree1.SelectedNode.Tag as CmcsMine); addCmcsMine(Output); strEditMode = "edit"; EnableLeft(); }
/// <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); }
private void btnSelectSupplier_BuyFuel_Click(object sender, EventArgs e) { FrmMine_Select frm = new FrmMine_Select("where IsStop=0 order by Name asc"); if (frm.ShowDialog() == DialogResult.OK) { this.SelectedSupplier_BuyFuel = frm.Output; } }
private void FrmMine_Select_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.Output = null; this.DialogResult = DialogResult.Cancel; this.Close(); } }
void Return() { if (advTree1.SelectedNode.Parent == null) { return; } this.Output = (advTree1.SelectedNode.Tag as CmcsMine); addCmcsMine(Output); }
/// <summary> /// 判断煤种编码是否存在 /// </summary> /// <param name="fuelCode">煤种编码</param> /// <returns></returns> public bool IsExistMineCode(string code) { CmcsMine entity = Dbers.GetInstance().SelfDber.Entity <CmcsMine>("where Code=:code", new { Code = code }); if (entity != null) { return(true); } return(false); }
private void BtnMine_Click(object sender, EventArgs e) { FrmMine_Select Frm = new FrmMine_Select(string.Empty); Frm.ShowDialog(); if (Frm.DialogResult == DialogResult.OK) { this.CmcsMine = Frm.Output; } }
private void BtnMine_Click(object sender, EventArgs e) { FrmMine_Select Frm = new FrmMine_Select("where Id!='-1' and IsStop=0"); Frm.ShowDialog(); if (Frm.DialogResult == DialogResult.OK) { this.CmcsMine = Frm.Output; } }
/// <summary> /// 判断煤种名称是否存在 /// </summary> /// <param name="Name">煤种名称</param> /// <returns></returns> public bool IsExistMineName(string name, string id) { CmcsMine entity = Dbers.GetInstance().SelfDber.Entity <CmcsMine>("where Name=:Name and Id<>:Id", new { Name = name, Id = id }); if (entity != null) { return(true); } return(false); }
private void BtnMine_Click(object sender, EventArgs e) { FrmMine_Select Frm = new FrmMine_Select(); Frm.ShowDialog(); if (Frm.DialogResult == DialogResult.OK) { cmcsMine = Frm.Output; this.txt_MineName.Text = Frm.Output.Name; } }
/// <summary> /// 获取排序号 /// </summary> /// <param name="parentMine"></param> /// <returns></returns> public int GetMineOrderNumBer(CmcsMine parentMine) { CmcsMine mine = commonDAO.SelfDber.Entity <CmcsMine>(" where ParentId=:ParentId order by Sequence desc", new { ParentId = parentMine.Id }); if (mine != null) { mine.Sequence++; return(mine.Sequence); } return(0); }
/// <summary> /// 获取矿点顺序号 /// </summary> /// <param name="fuelCode"></param> /// <returns></returns> public int GetMineNewSort(CmcsMine mine) { int Sequence = 1; CmcsMine kind = Dbers.GetInstance().SelfDber.Entity <CmcsMine>("where ParentId=:ParentId order by Sequence desc", new { ParentId = mine.Id }); if (kind != null) { Sequence = kind.Sequence + 1; } return(Sequence); }
void Return() { GridRow gridRow = superGridControl1.PrimaryGrid.ActiveRow as GridRow; if (gridRow == null) { return; } this.Output = (gridRow.DataItem as CmcsMine); this.DialogResult = DialogResult.OK; this.Close(); }
/// <summary> /// 更新矿点 /// </summary> /// <param name="video"></param> /// <returns></returns> public bool InsertMine(CmcsMine video) { CmcsMine entity = commonDAO.SelfDber.Entity <CmcsMine>("where Id=:Id", new { Id = video.Id }); if (entity == null) { return(commonDAO.SelfDber.Insert(video) > 0); } else { return(commonDAO.SelfDber.Update(video) > 0); } }
void LoadData(CmcsMine entity, DevComponents.AdvTree.Node node) { if (entity == null || node == null) { return; } foreach (CmcsMine item in Dbers.GetInstance().SelfDber.Entities <CmcsMine>("where ParentId=:ParentId order by Sequence asc", new { ParentId = entity.Id })) { DevComponents.AdvTree.Node newNode = CreateNode(item); node.Nodes.Add(newNode); LoadData(item, newNode); } }
private void FrmMine_List_Shown(object sender, EventArgs e) { advTree1.Nodes.Clear(); CmcsMine rootEntity = Dbers.GetInstance().SelfDber.Entity <CmcsMine>("where ParentId is null"); DevComponents.AdvTree.Node rootNode = CreateNode(rootEntity); LoadData(rootEntity, rootNode); advTree1.Nodes.Add(rootNode); addCmcsMine(rootEntity); CMCS.CarTransport.WeighterHand.Utilities.Helper.ControlReadOnly(panelLeft); CMCS.CarTransport.WeighterHand.Utilities.Helper.ControlReadOnly(panelRight); }
private void FrmAppletLog_Oper_Load(object sender, EventArgs e) { if (this.noSampler != null) { this.CmcsMine = CommonDAO.GetInstance().SelfDber.Get <CmcsMine>(noSampler.MineId); dtpStartTime.Value = noSampler.StartTime; dtpEndTime.Value = noSampler.EndTime; } if (this.EditMode == eEditMode.查看) { btnSubmit.Enabled = false; HelperUtil.ControlReadOnly(panelEx2, true); } }
/// <summary> /// 同步全过程基础信息(矿点信息) /// </summary> public void SyncBaseInfoForKB(Action <string, eOutputType> output, SqlServerDapperDber sqlDapperDber) { int res = 0; try { foreach (View_kb qgc_kb in sqlDapperDber.Entities <View_kb>()) { if (commonDAO.SelfDber.Get <View_kb>(qgc_kb.Dbid.ToString()) != null) { commonDAO.SelfDber.Update <View_kb>(qgc_kb); } else { commonDAO.SelfDber.Insert <View_kb>(qgc_kb); } CmcsMine cmcsMine = commonDAO.SelfDber.Entity <CmcsMine>("where PkId=:PkId", new { PkId = qgc_kb.Dbid }); if (cmcsMine == null) { commonDAO.SelfDber.Insert(new CmcsMine() { ParentId = "-1", PkId = qgc_kb.Dbid, Code = qgc_kb.Kbbm, Name = qgc_kb.Kbmc, IsStop = int.Parse(qgc_kb.Is_valid) }); } else { cmcsMine.ParentId = "-1"; cmcsMine.PkId = qgc_kb.Dbid; cmcsMine.Code = qgc_kb.Kbbm; cmcsMine.Name = qgc_kb.Kbmc; cmcsMine.IsStop = int.Parse(qgc_kb.Is_valid); commonDAO.SelfDber.Update(cmcsMine); } res++; } } catch (Exception ex) { output("同步矿点信息报错," + ex.Message, eOutputType.Error); } output(string.Format("同步矿点信息{0}条", res), eOutputType.Normal); }
private void btnSave_Click(object sender, EventArgs e) { if (!ValidatePage()) { return; } if (EditMode == eEditMode.新增) { if (this.SelCmcsMine == null) { return; } CmcsMine entity = new CmcsMine(); entity.Code = commonDAO.GetMineNewChildCode(this.SelCmcsMine.Code); entity.Name = txt_Name.Text; entity.Sort = dbi_Sequence.Value; entity.ParentId = this.SelCmcsMine.Id; entity.IsStop = chb_IsUse.Checked ? 0 : 1; Dbers.GetInstance().SelfDber.Insert <CmcsMine>(entity); } else if (EditMode == eEditMode.修改) { if (this.SelCmcsMine == null) { return; } //是否更新子节点状态 if (this.SelCmcsMine.IsStop != (chb_IsUse.Checked ? 0 : 1)) { if (MessageBoxEx.Show("是否将启用状态应用到子节点", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { commonDAO.UpdateMineChildsIsUse(this.SelCmcsMine.Id, chb_IsUse.Checked ? 0 : 1); } } this.SelCmcsMine.Name = txt_Name.Text; this.SelCmcsMine.Code = txt_Code.Text; this.SelCmcsMine.Sort = dbi_Sequence.Value; this.SelCmcsMine.IsStop = chb_IsUse.Checked ? 0 : 1; this.SelCmcsMine.ReMark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Update <CmcsMine>(this.SelCmcsMine); } InitTree(); }
private void FrmMine_List_Shown(object sender, EventArgs e) { advTree1.Nodes.Clear(); CmcsMine rootEntity = Dbers.GetInstance().SelfDber.Entity <CmcsMine>("where ParentId is null"); DevComponents.AdvTree.Node rootNode = CreateNode(rootEntity); LoadData(rootEntity, rootNode); advTree1.Nodes.Add(rootNode); addCmcsMine(rootEntity); CMCS.CarTransport.Queue.Utilities.Helper.ControlReadOnly(this); //01查看 02增加 03修改 04删除 BtnAdd.Visible = QueuerDAO.GetInstance().CheckPower(this.GetType().ToString(), "02", SelfVars.LoginUser); BtnUpdate.Visible = QueuerDAO.GetInstance().CheckPower(this.GetType().ToString(), "03", SelfVars.LoginUser); BtnDelete.Visible = QueuerDAO.GetInstance().CheckPower(this.GetType().ToString(), "04", SelfVars.LoginUser); }
/// <summary> /// 删除矿点 /// </summary> /// <param name="video"></param> /// <returns></returns> public bool DelMine(CmcsMine video) { int res = 0; foreach (var item in commonDAO.SelfDber.Entities <CmcsMine>("where ParentId=:ParentId ", new { ParentId = video.Id })) { DelMine(item); } try { if (commonDAO.SelfDber.Delete <CmcsMine>(video.Id) > 0) { res++; } } catch (Exception) { return(false); } return(res > 0); }
private void btnSave_Click(object sender, EventArgs e) { if (!ValidatePage()) { return; } if (EditMode == eEditMode.新增) { if (this.SelCmcsMine == null) { return; } CmcsMine entity = new CmcsMine(); entity.Code = commonDAO.GetFuelKindNewChildCode(this.SelCmcsMine.Code); entity.Name = txt_Name.Text; entity.Sequence = dbi_Sequence.Value; entity.ParentId = this.SelCmcsMine.Id; entity.IsStop = chb_IsUse.Checked ? 0 : 1; entity.ReMark = txt_ReMark.Text; Dbers.GetInstance().SelfDber.Insert <CmcsMine>(entity); } else if (EditMode == eEditMode.修改) { if (this.SelCmcsMine == null) { return; } this.SelCmcsMine.Name = txt_Name.Text; this.SelCmcsMine.Code = txt_Code.Text; this.SelCmcsMine.Sequence = dbi_Sequence.Value; this.SelCmcsMine.IsStop = chb_IsUse.Checked ? 0 : 1; this.SelCmcsMine.ReMark = txt_ReMark.Text; this.SelCmcsMine.IsSynch = 0; Dbers.GetInstance().SelfDber.Update <CmcsMine>(this.SelCmcsMine); } InitTree(); }
private void btnSubmit_Click(object sender, EventArgs e) { if (strEditMode == "add") { if (CommonDAO.GetInstance().SelfDber.Count <CmcsMine>(" where Name=:Name", new { Name = txt_Name.Text }) > 0) { MessageBoxEx.Show("该矿点名称已存在!,", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CmcsMine mine = new CmcsMine() { Code = carTransportDao.GetMineNewChildCode(Output.Code), Name = txt_Name.Text, Valid = chb_IsUse.Checked ? "有效" : "无效", Sequence = dbi_Sequence.Value, ReMark = txt_ReMark.Text, ParentId = Output.Id }; carTransportDao.InsertMine(mine); } else { CmcsMine mine_check = CommonDAO.GetInstance().SelfDber.Entity <CmcsMine>(" where Name=:Name", new { Name = txt_Name.Text }); if (mine_check != null && mine_check.Id != Output.Id) { MessageBoxEx.Show("该矿点名称已存在!,", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //Output.Code = carTransportDao.GetMineNewChildCode(Output.Code); //Output.NodeCode = carTransportDao.GetMineNewChildCode(Output.Code); Output.Name = txt_Name.Text; Output.Sequence = dbi_Sequence.Value; Output.Valid = chb_IsUse.Checked ? "有效" : "无效"; Output.ReMark = txt_ReMark.Text; Output.IsSynch = "0"; carTransportDao.InsertMine(Output); } FrmMine_List_Shown(null, null); }
/// <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); }