コード例 #1
0
ファイル: EquAutoMakerDAO.cs プロジェクト: radtek/Applet_NXQL
        /// <summary>
        /// 同步样品信息到集中管控入厂煤制样明细表
        /// </summary>
        /// <param name="makeDetail"></param>
        private bool SyncToRCMakeDetail(EquQZDZYJDetail makeDetail)
        {
            CmcsRCMake rCMake = commonDAO.SelfDber.Entity <CmcsRCMake>("where MakeCode=:MakeCode and IsDeleted=0", new { MakeCode = makeDetail.MakeCode });

            if (rCMake != null)
            {
                // 修改制样结束时间
                rCMake.MakeType = eMakeType.机械制样.ToString();

                rCMake.GetDate  = DateTime.Now;
                rCMake.MakeDate = makeDetail.StartTime;

                commonDAO.SelfDber.Update(rCMake);

                CmcsRCMakeDetail rCMakeDetail = commonDAO.SelfDber.Entity <CmcsRCMakeDetail>("where MakeId=:MakeId and SampleType=:SampleType and IsDeleted=0", new { MakeId = rCMake.Id, SampleType = makeDetail.YPType });
                if (rCMakeDetail != null)
                {
                    rCMakeDetail.LastModificAtionTime = DateTime.Now;
                    rCMakeDetail.CreationTime         = DateTime.Now;
                    rCMakeDetail.SampleWeight         = makeDetail.YPWeight;
                    rCMakeDetail.SampleCode           = makeDetail.BarrelCode;
                    return(commonDAO.SelfDber.Update(rCMakeDetail) > 0);
                }
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// 保存交接样记录的交样
        /// </summary>
        /// <returns></returns>
        public bool SaveHandSamplingReceive(string sampleId, string makeReceivePle, DateTime makeReceiveDate)
        {
            CmcsRCSampling     sampling     = Dbers.GetInstance().SelfDber.Get <CmcsRCSampling>(sampleId);
            CmcsRCHandSampling handSampling = Dbers.GetInstance().SelfDber.Entity <CmcsRCHandSampling>("where SamplingId=:SamplingId order by CreateDate desc", new { SamplingId = sampleId });

            if (handSampling == null)
            {
                handSampling = new CmcsRCHandSampling();
                handSampling.SamplingSendPle  = sampling != null ? sampling.SamplingPle : "";
                handSampling.SamplingSendDate = sampleId != null ? sampling.SamplingDate : DateTime.MinValue;
                handSampling.SamplingId       = sampleId;
                handSampling.MakeReceivePle   = makeReceivePle;
                handSampling.MakeReceiveDate  = makeReceiveDate;
                return(Dbers.GetInstance().SelfDber.Insert(handSampling) > 0);
            }
            CmcsRCMake make = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where SamplingId=:SamplingId order by Createdate desc", new { SamplingId = sampleId });

            if (make != null)
            {
                make.GetPle     = makeReceivePle;
                make.GetDate    = makeReceiveDate;
                make.IsHandOver = 1;
                Dbers.GetInstance().SelfDber.Update(make);
            }
            handSampling.MakeReceivePle  = makeReceivePle;
            handSampling.MakeReceiveDate = makeReceiveDate;
            return(Dbers.GetInstance().SelfDber.Update(handSampling) > 0);
        }
コード例 #3
0
        /// <summary>
        /// 发送倒料命令
        /// </summary>
        /// <param name="rCSamplingCode"></param>
        /// <returns></returns>
        public bool SendPackingBatch(string machineCode, string rCSamplingCode, out string currentMessage)
        {
            CmcsRCMake rcMake = AutoMakerDAO.GetInstance().GetRCMakeBySampleCode(rCSamplingCode);

            if (rcMake != null)
            {
                string fuelKindName = string.Empty;

                InfPackingBatchCmd packingbatch = new InfPackingBatchCmd()
                {
                    InterfaceType = CommonDAO.GetInstance().GetMachineInterfaceTypeByCode(machineCode),
                    MachineCode   = machineCode,
                    SampleCode    = rCSamplingCode,
                    MakeCode      = rcMake.MakeCode,
                    ResultCode    = eEquInfCmdResultCode.默认.ToString(),
                    SyncFlag      = 0,
                    DataFlag      = 0
                };
                if (CommonDAO.GetInstance().SelfDber.Insert(packingbatch) > 0)
                {
                    currentMessage = "倒料命令发送成功";
                    return(true);
                }
                else
                {
                    currentMessage = "倒料命令发送失败";
                    return(false);
                }
            }
            else
            {
                currentMessage = "未找到制样主记录信息";
                return(false);
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: 18672200484/YNWLY_Applet
        /// <summary>
        /// 发送制样计划
        /// </summary>
        /// <returns></returns>
        private bool SendMakePlan(string RCSamplingId, string infactoryBatchId)
        {
            CmcsRCMake rcmake = MakerDAO.GetInstance().GetRCMakeBySampleId(RCSamplingId);

            if (rcmake != null)
            {
                CmcsMakerPlan makerPlan = new CmcsMakerPlan()
                {
                    InterfaceType    = GlobalVars.InterfaceType_NCGM_QZDZYJ,
                    MachineCode      = GlobalVars.MachineCode_NCGM_QZDZYJ_1,
                    InFactoryBatchId = infactoryBatchId,
                    MakeCode         = rcmake.MakeCode,
                    FuelKindName     = "褐煤",
                    Mt       = "湿煤",
                    MakeType = "在线制样",
                    CoalSize = "小粒度"
                };
                MakerDAO.GetInstance().SaveMakerPlan(makerPlan, out currentMessage);
                rTxtOutputer.Output(currentMessage, eOutputType.Normal);
                return(true);
            }
            else
            {
                rTxtOutputer.Output("制样计划发送失败:未找到制样主记录信息!", eOutputType.Error);
            }
            return(false);
        }
コード例 #5
0
        /// <summary>
        /// 加载制样明细记录
        /// </summary>
        private void LoadRCMakeDetail()
        {
            CmcsRCMake rCMake = czyHandlerDAO.GetRCMake(txtInputMakeCode.Text.Trim().ToUpper());

            if (rCMake != null)
            {
                List <CmcsRCMakeDetail> rCMakeDetails = czyHandlerDAO.GetRCMakeDetails(txtInputMakeCode.Text.Trim().ToUpper(), out resMessage);
                if (rCMakeDetails.Count == 0)
                {
                    ShowMessage(resMessage, eOutputType.Error);
                    if (MessageBoxEx.Show("该制样单无制样明细,是否生成制样明细?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        rCMakeDetails = CreateRcMakeDetail(rCMake);
                    }
                }
                else
                {
                    this.CurrentFlowFlag = eFlowFlag.样品登记;
                }
                superGridControl1.PrimaryGrid.DataSource = rCMakeDetails;
            }
            else
            {
                ShowMessage("未找到制样信息", eOutputType.Error);
            }
        }
コード例 #6
0
        /// <summary>
        /// 同步样品信息到集中管控入厂煤制样明细表
        /// </summary>
        /// <param name="makeDetail"></param>
        private bool SyncToRCMakeDetail(ZY_Record_Tb makeDetail)
        {
            CmcsRCMake rCMake = commonDAO.SelfDber.Entity <CmcsRCMake>("where MakeCode=:MakeCode", new { MakeCode = makeDetail.SampleID });

            if (rCMake != null)
            {
                // 修改制样结束时间
                rCMake.MakeStyle = eMakeType.机器制样.ToString();
                if (rCMake.MakeEndTime < makeDetail.EndTime)
                {
                    rCMake.MakeEndTime = makeDetail.EndTime;
                }
                if (rCMake.MakeStartTime != rCMake.CreateDate && rCMake.MakeStartTime > makeDetail.StartTime)
                {
                    rCMake.GetDate       = DateTime.Now;
                    rCMake.MakeStartTime = makeDetail.StartTime;
                }
                if (rCMake.MakeStartTime < makeDetail.StartTime)
                {
                    rCMake.MakeStartTime = makeDetail.StartTime;
                }
                if (rCMake.MakeEndTime < makeDetail.EndTime)
                {
                    rCMake.MakeEndTime = makeDetail.EndTime;
                }
                commonDAO.SelfDber.Update(rCMake);

                CmcsRCMakeDetail rCMakeDetail = commonDAO.SelfDber.Entity <CmcsRCMakeDetail>("where MakeId=:MakeId and SampleType=:SampleType", new { MakeId = rCMake.Id, SampleType = makeDetail.SampleType });
                if (rCMakeDetail != null)
                {
                    rCMakeDetail.OperDate   = DateTime.Now;
                    rCMakeDetail.CreateDate = DateTime.Now;
                    rCMakeDetail.Weight     = makeDetail.SamepleWeight;
                    rCMakeDetail.SampleType = makeDetail.SampleType;                    //AutoMakerDAO.GetInstance().GetKYMakeType(makeDetail.SampleType.ToString());
                    //rCMakeDetail.BarrelCode = makeDetail.PackCode;
                    return(commonDAO.SelfDber.Update(rCMakeDetail) > 0);
                }
                else
                {
                    rCMakeDetail            = new CmcsRCMakeDetail();
                    rCMakeDetail.MakeId     = rCMake.Id;
                    rCMakeDetail.OperDate   = DateTime.Now;
                    rCMakeDetail.CreateDate = DateTime.Now;
                    rCMakeDetail.Weight     = makeDetail.SamepleWeight;
                    rCMakeDetail.SampleType = makeDetail.SampleType;                    //AutoMakerDAO.GetInstance().GetKYMakeType(makeDetail.SampleType.ToString());
                    rCMakeDetail.BarrelCode = makeDetail.PackCode;
                    return(commonDAO.SelfDber.Insert(rCMakeDetail) > 0);
                }
            }
            else
            {
                return(true);
            }
        }
コード例 #7
0
        /// <summary>
        /// 根据采样码获取制样记录
        /// </summary>
        /// <param name="sampleId"></param>
        /// <returns></returns>
        public CmcsRCMake GetRCMakeBySampleCode(string sampleCode)
        {
            CmcsRCSampling rcsampling = Dbers.GetInstance().SelfDber.Entity <CmcsRCSampling>("where SampleCode=:SampleCode", new { SampleCode = sampleCode });

            if (rcsampling == null)
            {
                return(null);
            }
            CmcsRCMake rcmake = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where SamplingId=:SamplingId", new { SamplingId = rcsampling.Id });

            return(rcmake);
        }
コード例 #8
0
        /// <summary>
        /// 从卸样记录中获取最新的采样编码,判断是否能卸样
        /// </summary>
        /// <param name="cmcsCMEquipment"></param>
        /// <returns></returns>
        private bool HandleWhetherSampleUnloadCmd(CmcsCMEquipment cmcsCMEquipment)
        {
            string tempSamplingId = string.Empty;

            if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(cmcsCMEquipment.Parentid).EquipmentCode == "皮带采样机")
            {
                InfBeltSampleUnloadCmd entity = commonDAO.SelfDber.Entity <InfBeltSampleUnloadCmd>(" where MachineCode='" + cmcsCMEquipment.EquipmentCode + "' order by createdate desc");
                if (entity != null)
                {
                    tempSamplingId = entity.SamplingId;
                }
            }
            else if (Dbers.GetInstance().SelfDber.Get <CmcsCMEquipment>(cmcsCMEquipment.Parentid).EquipmentCode == "汽车机械采样机")
            {
                InfQCJXCYUnLoadCMD entity = commonDAO.SelfDber.Entity <InfQCJXCYUnLoadCMD>(" where MachineCode='" + cmcsCMEquipment.EquipmentCode + "' order by createdate desc");
                if (entity != null)
                {
                    tempSamplingId = entity.SamplingId;
                }
            }
            else
            {
                rTxtOutputer.Output("无此编码类型,请查证\"皮带采样机\"和\"汽车机械采样机\"类型!", eOutputType.Error);
                return(false);
            }

            if (!string.IsNullOrEmpty(tempSamplingId))
            {
                //同一批次可以继续卸样
                if (this.CurrentRCSampling.Id == tempSamplingId)
                {
                    return(true);
                }

                CmcsRCMake rcMake = AutoMakerDAO.GetInstance().GetRCMakeBySampleId(tempSamplingId);
                if (rcMake != null)
                {
                    //未找到制样记录需要提示是否继续操作
                    InfMakerPlan infMakerPlan = Dbers.GetInstance().SelfDber.Entity <InfMakerPlan>("where MakeCode=:MakeCode", new { MakeCode = rcMake.MakeCode });
                    if (infMakerPlan == null)
                    {
                        if (MessageBoxEx.Show("该卸样记录与上一次未制样的记录不是同一批次,为防止混样,确定是否继续", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == System.Windows.Forms.DialogResult.OK)
                        {
                            if (new FrmConfirmOperationLog("确定人为操作继续卸样").ShowDialog() == DialogResult.OK)
                            {
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
コード例 #9
0
        /// <summary>
        /// 根据化验码转换制样码
        /// </summary>
        /// <param name="assayCode"></param>
        /// <returns></returns>
        public string GetMakeCodeByAssayCode(string assayCode)
        {
            string      makeCode = string.Empty;
            CmcsRCAssay rCAssay  = Dbers.GetInstance().SelfDber.Entity <CmcsRCAssay>("where AssayCode=:AssayCode", new { AssayCode = assayCode });

            if (rCAssay != null)
            {
                CmcsRCMake rCMake = Dbers.GetInstance().SelfDber.Get <CmcsRCMake>(rCAssay.MakeId);
                if (rCMake != null)
                {
                    makeCode = rCMake.MakeCode;
                }
            }
            return(makeCode);
        }
コード例 #10
0
        /// <summary>
        /// 制样码转换化验码
        /// </summary>
        /// <param name="makeCode"></param>
        /// <returns></returns>
        public string MakeCodeToAssayCode(string makeCode)
        {
            CmcsRCMake make = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where MakeCode=:MakeCode", new { MakeCode = makeCode });

            if (make == null)
            {
                return(string.Empty);
            }
            CmcsRCAssay assay = Dbers.GetInstance().SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId", new { MakeId = make.Id });

            if (assay != null)
            {
                return(assay.AssayCode);
            }
            return(string.Empty);
        }
コード例 #11
0
        public bool CreateAssay(CmcsRCMake rCMake)
        {
            // 入厂煤化验
            CmcsRCAssay rCAssay = CommonDAO.GetInstance().SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId and AssayWay='监督样化验'", new { MakeId = rCMake.Id });

            if (rCAssay == null)
            {
                // 入厂煤煤质

                CmcsFuelQuality fuelQuality = new CmcsFuelQuality()
                {
                    Id = Guid.NewGuid().ToString(),
                    Mt = Convert.ToDecimal(dbiMt.Value)
                };

                if (CommonDAO.GetInstance().SelfDber.Insert(fuelQuality) > 0)
                {
                    rCAssay = new CmcsRCAssay()
                    {
                        MakeId        = rCMake.Id,
                        AssayType     = eAssayType.级编码化验.ToString(),
                        AssayWay      = eAssayType.监督样化验.ToString(),
                        AssayCode     = CommonDAO.GetInstance().CreateNewAssayCode(rCMake.CreateDate),
                        FuelQualityId = fuelQuality.Id,
                        AssayPle      = "",
                        WfStatus      = 0,
                        BackBatchDate = rCMake.UseTime,
                        AssayPoint    = this.assayTarget.TrimEnd(',')
                    };
                    return(CommonDAO.GetInstance().SelfDber.Insert(rCAssay) > 0);
                }
            }
            else
            {
                rCAssay.AssayPoint = this.assayTarget.TrimEnd(',');
                CmcsFuelQuality fuelQuality = rCAssay.TheFuelQuality;
                if (fuelQuality != null)
                {
                    fuelQuality.Mt = Convert.ToDecimal(dbiMt.Value);
                    CommonDAO.GetInstance().SelfDber.Update(fuelQuality);
                }

                return(CommonDAO.GetInstance().SelfDber.Update(rCAssay) > 0);
            }
            return(false);
        }
コード例 #12
0
        /// <summary>
        /// 发送制样计划
        /// </summary>
        /// <param name="rCSamplingId">采样单Id</param>
        /// <param name="infactoryBatchId">批次Id</param>
        /// <returns></returns>
        private bool SendMakePlan(string rCSamplingId)
        {
            CmcsRCSampling rCSampling = commonDAO.SelfDber.Get <CmcsRCSampling>(rCSamplingId);
            CmcsRCMake     rcMake     = AutoMakerDAO.GetInstance().GetRCMakeBySampleId(rCSamplingId);

            if (rcMake != null)
            {
                string fuelKindName = string.Empty;

                CmcsInFactoryBatch inFactoryBatch = commonDAO.GetBatchByRCSamplingId(rCSamplingId);
                if (inFactoryBatch != null)
                {
                    CmcsFuelKind fuelKind = commonDAO.SelfDber.Get <CmcsFuelKind>(inFactoryBatch.FuelKindId);
                    if (fuelKind != null)
                    {
                        fuelKindName = fuelKind.FuelName;
                    }
                }

                // 需调整:发送的制样计划中煤种、颗粒度、水分等相关信息视接口而定
                InfMakerPlan makerPlan = new InfMakerPlan()
                {
                    InterfaceType    = commonDAO.GetMachineInterfaceTypeByCode(this.CurrentmakerMachineCode),
                    MachineCode      = this.CurrentmakerMachineCode,
                    InFactoryBatchId = rCSampling != null ? rCSampling.InFactoryBatchId : "",
                    MakeCode         = rcMake.MakeCode,
                    FuelKindName     = fuelKindName,
                    //Mt = "湿煤",
                    MakeType = "在线制样",
                    //CoalSize = "小粒度",
                    SyncFlag = 0
                };
                AutoMakerDAO.GetInstance().SaveMakerPlanAndStartCmd(makerPlan, out currentMessage);

                rTxtOutputer.Output(currentMessage, eOutputType.Normal);

                return(true);
            }
            else
            {
                rTxtOutputer.Output("制样计划发送失败:未找到制样主记录信息", eOutputType.Error);
            }

            return(false);
        }
コード例 #13
0
        /// <summary>
        /// 生成制样明细
        /// </summary>
        /// <param name="rcMake"></param>
        /// <returns></returns>
        public List <CmcsRCMakeDetail> CreateRcMakeDetail(CmcsRCMake rcMake)
        {
            IList <CodeContent> maketype = commonDAO.GetCodeContentByKind("样品类型");

            foreach (CodeContent item in maketype)
            {
                CmcsRCMakeDetail makedetail = commonDAO.SelfDber.Entity <CmcsRCMakeDetail>("where MakeId=:MakeId and SampleType=:SampleType", new { MakeId = rcMake.Id, SampleType = item.Content });
                if (makedetail == null)
                {
                    makedetail            = new CmcsRCMakeDetail();
                    makedetail.MakeId     = rcMake.Id;
                    makedetail.SampleType = item.Content;
                    makedetail.BarrelCode = commonDAO.CreateNewMakeBarrelCodeByMakeCode(rcMake.MakeCode, item.Content);
                    commonDAO.SelfDber.Insert(makedetail);
                }
            }
            return(commonDAO.SelfDber.Entities <CmcsRCMakeDetail>("where MakeId=:MakeId", new { MakeId = rcMake.Id }));
        }
コード例 #14
0
        /// <summary>
        /// 更改制样送样人
        /// </summary>
        /// <param name="rCMakeDetail"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        public bool UpdateSendPle(CmcsRCMakeDetail rCMakeDetail, string userName)
        {
            CmcsRCAssay assay = Dbers.GetInstance().SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId order by CreateDate desc", new { MakeId = rCMakeDetail.MakeId });

            if (assay != null)
            {
                assay.SendPle = userName;
                //更新制样人
                CmcsRCMake make = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where SamplingId=:SamplingId order by CreateDate desc", new { SamplingId = rCMakeDetail.TheRCMake.SamplingId });
                if (make != null)
                {
                    make.MakePle     = userName;
                    make.MakeEndTime = DateTime.Now;
                    Dbers.GetInstance().SelfDber.Update(make);
                }
                return(Dbers.GetInstance().SelfDber.Update(assay) > 0);
            }
            return(false);
        }
コード例 #15
0
        private void superGridControl1_CellMouseDown(object sender, DevComponents.DotNetBar.SuperGrid.GridCellMouseEventArgs e)
        {
            CmcsRCMake entity = Dbers.GetInstance().SelfDber.Get <CmcsRCMake>(superGridControl1.PrimaryGrid.GetCell(e.GridCell.GridRow.Index, superGridControl1.PrimaryGrid.Columns["clmId"].ColumnIndex).Value.ToString());

            switch (superGridControl1.PrimaryGrid.Columns[e.GridCell.ColumnIndex].Name)
            {
            case "clmShow":
                FrmJDYMake_Oper frmShow = new FrmJDYMake_Oper(entity.Id, false);
                if (frmShow.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmEdit":
                FrmJDYMake_Oper frmEdit = new FrmJDYMake_Oper(entity.Id, true);
                if (frmEdit.ShowDialog() == DialogResult.OK)
                {
                    BindData();
                }
                break;

            case "clmDelete":
                if (MessageBoxEx.Show("确定要删除该记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        CommonDAO.GetInstance().SaveAppletLog(eAppletLogLevel.Warn, "删除监督样记录:", string.Format("送样单位:{0};接样人:{1};制样人:{2};制样码:{3};操作人:{4}", entity.SendUnit, entity.GetPle, entity.MakePle, entity.MakeCode, SelfVars.LoginUser.UserName));
                        Dbers.GetInstance().SelfDber.DeleteBySQL <CmcsRCMakeDetail>("where MakeId=:MakeId", new { MakeId = entity.Id });
                        Dbers.GetInstance().SelfDber.Delete <CmcsRCMake>(entity.Id);
                    }
                    catch (Exception)
                    {
                        MessageBoxEx.Show("该记录正在使用中,禁止删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    BindData();
                }
                break;
            }
        }
コード例 #16
0
        /// <summary>
        /// 打印化验码
        /// </summary>
        private void PrintAssayCode()
        {
            this.CurrentFlowFlag = eFlowFlag.打印化验码;

            if (this.RCAssay == null)
            {
                return;
            }

            if (MessageBoxEx.Show("样品类型:" + this.currentMakeDetail.SampleType + ",立刻打印化验码?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (this.currentMakeDetail != null)
                {
                    this.currentMakeDetail.PrintCount++;
                    this.currentMakeDetail.PrintTime = DateTime.Now;
                    this.currentMakeDetail.CheckType = "扫码";
                    this.currentMakeDetail.CheckUser = SelfVars.LoginUser.UserName;
                    this.currentMakeDetail.IsCheck   = 1;
                    if (this.IsUseWeight)
                    {
                        this.currentMakeDetail.CheckWeight = wber.Weight;
                    }
                    commonDAO.SelfDber.Update(this.currentMakeDetail);
                    CmcsRCMake rcMake = commonDAO.SelfDber.Get <CmcsRCMake>(this.currentMakeDetail.MakeId);
                    czyHandlerDAO.RelieveAssay(this.currentMakeDetail, rcMake != null ? rcMake.MakePle : "", SelfVars.LoginUser.UserName);
                }

                //this.RCAssay.IsRelieve = 1;
                //this.RCAssay.GetDate = DateTime.Now;
                //this.RCAssay.GetPle = SelfVars.LoginUser.UserName;
                //commonDAO.SelfDber.Update(this.RCAssay);
                this._CodePrinter.Print(this.RCAssay.AssayCode);

                Restet();
            }
            else
            {
                Restet();
            }
        }
コード例 #17
0
        /// <summary>
        /// 根据制样码获取制样从表明细集合
        /// </summary>
        /// <param name="makeCode">制样码</param>
        /// <param name="message"></param>
        /// <returns></returns>
        public List <CmcsRCMakeDetail> GetRCMakeDetails(string makeCode, out string message)
        {
            message = "";

            List <CmcsRCMakeDetail> list = new List <CmcsRCMakeDetail>();
            CmcsRCMake rcmake            = GetRCMake(makeCode);

            if (rcmake != null)
            {
                list = Dbers.GetInstance().SelfDber.Entities <CmcsRCMakeDetail>(" where MakeId=:MakeId order by CreateDate asc", new { MakeId = rcmake.Id });
                if (list.Count == 0)
                {
                    message = "未找到制样明细记录";
                }
            }
            else
            {
                message = "未找到制样记录,制样码:" + makeCode;
            }

            return(list);
        }
コード例 #18
0
        void SaveAndUpdate(CmcsRCMake rCMake, IList <CmcsRCMakeDetail> details)
        {
            CmcsRCMake oldmake = Dbers.GetInstance().SelfDber.Get <CmcsRCMake>(rCMake.Id);

            if (oldmake != null)
            {
                Dbers.GetInstance().SelfDber.Update(rCMake);
                CreateAssay(rCMake);
            }
            else
            {
                Dbers.GetInstance().SelfDber.Insert(rCMake);
                CreateAssay(rCMake);
            }

            List <CmcsRCMakeDetail> olds = Dbers.GetInstance().SelfDber.Entities <CmcsRCMakeDetail>(" where MakeId=:MakeId", new { MakeId = rCMake.Id });

            foreach (CmcsRCMakeDetail old in olds)
            {
                CmcsRCMakeDetail del = details.Where(a => a.Id == old.Id).FirstOrDefault();
                if (del == null)
                {
                    Dbers.GetInstance().SelfDber.Delete <CmcsRCMakeDetail>(old.Id);
                }
            }
            foreach (var detail in details)
            {
                detail.MakeId = rCMake.Id;
                CmcsRCMakeDetail insertorupdate = olds.Where(a => a.Id == detail.Id).FirstOrDefault();
                if (insertorupdate == null)
                {
                    Dbers.GetInstance().SelfDber.Insert(detail);
                }
                else
                {
                    Dbers.GetInstance().SelfDber.Update(detail);
                }
            }
        }
コード例 #19
0
        /// <summary>
        /// 根据制样码获取制样从表明细集合
        /// </summary>
        /// <param name="makeCode">制样码</param>
        /// <param name="message"></param>
        /// <returns></returns>
        public List <CmcsRCMakeDetail> GetRCMakeDetails(string makeCode, ref string makeId, ref bool res, out string message)
        {
            message = "扫码成功";
            res     = false;

            List <CmcsRCMakeDetail> list = new List <CmcsRCMakeDetail>();
            CmcsRCMake rcmake            = GetRCMake(makeCode);

            if (rcmake != null)
            {
                makeId = rcmake.Id;

                list = Dbers.GetInstance().SelfDber.Entities <CmcsRCMakeDetail>(" where MakeId=:MakeId and IsDeleted=0 order by CreateDate asc", new { MakeId = rcmake.Id });

                res = true;
            }
            else
            {
                message = "未找到制样记录,制样码:" + makeCode;
            }

            return(list);
        }
コード例 #20
0
        /// <summary>
        /// 根据制样码获取制样明细
        /// </summary>
        /// <param name="makeCode"></param>
        /// <returns></returns>
        public IList <CmcsRCMakeDetail> GetMakeDetailsByMakeBillNumber(string makeCode, out string message)
        {
            message = "";

            IList <CmcsRCMakeDetail> details = Dbers.GetInstance().SelfDber.Entities <CmcsRCMakeDetail>("where BarrelCode=:BarrelCode order by CreateDate desc ", new { BarrelCode = makeCode });

            if (details == null || details.Count == 0)
            {
                CmcsRCMake make = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where MakeCode=:MakeCode", new { MakeCode = makeCode });
                if (make != null)
                {
                    details = Dbers.GetInstance().SelfDber.Entities <CmcsRCMakeDetail>("where MakeId=:MakeId", new { MakeId = make.Id });
                    if (details.Count == 0)
                    {
                        message = "未找到制样明细记录";
                    }
                }
                else
                {
                    message = "未找到制样记录,制样码:" + makeCode;
                }
            }
            return(details);
        }
コード例 #21
0
        /// <summary>
        /// 创建采制化三级数据
        /// </summary>
        /// <param name="inFactoryBatch">批次</param>
        /// <param name="samplingType">采样方式</param>
        /// <param name="remark">备注</param>
        /// <param name="assayType">化验方式</param>
        /// <returns></returns>
        public CmcsRCSampling GCSamplingMakeAssay(CmcsInFactoryBatch inFactoryBatch, string samplingType, string remark)
        {
            bool isSuccess = false;

            // 入厂煤采样
            CmcsRCSampling rCSampling = SelfDber.Entity <CmcsRCSampling>("where InFactoryBatchId=:InFactoryBatchId and SamplingType=:SamplingType and IsDeleted=0", new { InFactoryBatchId = inFactoryBatch.Id, SamplingType = samplingType });

            if (rCSampling == null)
            {
                rCSampling = new CmcsRCSampling()
                {
                    InFactoryBatchId = inFactoryBatch.Id,
                    SamplingType     = samplingType,
                    SamplingDate     = inFactoryBatch.FactArriveDate,
                    SamplingPle      = "自动",
                    SampleCode       = CreateNewSampleCode(inFactoryBatch.FactArriveDate),
                    Remark           = remark
                };

                isSuccess = SelfDber.Insert(rCSampling) > 0;
            }

            // 入厂煤制样
            CmcsRCMake rCMake = SelfDber.Entity <CmcsRCMake>("where SamplingId=:SamplingId and IsDeleted=0", new { SamplingId = rCSampling.Id });

            if (rCMake == null)
            {
                rCMake = new CmcsRCMake()
                {
                    SamplingId = rCSampling.Id,
                    MakeType   = "三级编码制样",
                    MakeStyle  = "机器制样",
                    MakeDate   = rCSampling.SamplingDate,
                    MakeCode   = CreateNewMakeCode(rCSampling.SamplingDate),
                    MakePle    = "自动",
                    Remark     = remark
                };

                isSuccess = SelfDber.Insert(rCMake) > 0;
            }

            //入厂煤制样明细
            foreach (CodeContent item in CommonDAO.GetInstance().GetCodeContentByKind("样品类型"))
            {
                CmcsRCMakeDetail rCMakeDetail = SelfDber.Entity <CmcsRCMakeDetail>("where MakeId=:MakeId and SampleType=:SampleType", new { MakeId = rCMake.Id, SampleType = item.Content });
                if (rCMakeDetail == null)
                {
                    rCMakeDetail            = new CmcsRCMakeDetail();
                    rCMakeDetail.MakeId     = rCMake.Id;
                    rCMakeDetail.SampleCode = CreateNewMakeBarrelCodeByMakeCode(rCMake.MakeCode, item.Content);
                    rCMakeDetail.SampleType = item.Content;
                    isSuccess = SelfDber.Insert(rCMakeDetail) > 0;
                }
            }

            // 入厂煤化验
            CmcsRCAssay rCAssay = SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId and IsDeleted=0", new { MakeId = rCMake.Id });

            if (rCAssay == null)
            {
                // 入厂煤煤质

                CmcsFuelQuality fuelQuality = new CmcsFuelQuality()
                {
                    Id = Guid.NewGuid().ToString()
                };

                if (SelfDber.Insert(fuelQuality) > 0)
                {
                    rCAssay = new CmcsRCAssay()
                    {
                        MakeId           = rCMake.Id,
                        AssayCode        = CreateNewAssayCode(rCMake.CreateDate),
                        InFactoryBatchId = inFactoryBatch.Id,
                        FuelQualityId    = fuelQuality.Id,
                        AssayDate        = rCMake.MakeDate,
                        Remark           = remark,
                        IsAssay          = 0,
                        BackBatchDate    = inFactoryBatch.BackBatchDate,
                    };

                    isSuccess = SelfDber.Insert(rCAssay) > 0;
                }
            }

            return(rCSampling);
        }
コード例 #22
0
        /// <summary>
        /// 根据采样id获取制样记录
        /// </summary>
        /// <param name="sampleId"></param>
        /// <returns></returns>
        public CmcsRCMake GetRCMakeBySampleId(string sampleId)
        {
            CmcsRCMake rcmake = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where SamplingId=:SamplingId and IsDeleted=0", new { SamplingId = sampleId });

            return(rcmake);
        }
コード例 #23
0
        /// <summary>
        /// 生成制样及化验
        /// </summary>
        /// <param name="makeCode"></param>
        /// <param name="assayType"></param>
        /// <param name="user"></param>
        /// <param name="assayTarget"></param>
        /// <returns></returns>
        public bool CreateMakeAndAssay(ref string makeCode, string assayType, string user, string assayTarget)
        {
            bool       isSuccess = false;
            CmcsRCMake make      = Dbers.GetInstance().SelfDber.Entity <CmcsRCMake>("where MakeCode=:MakeCode order by CreateDate desc ", new { MakeCode = makeCode });

            if (make != null)
            {
                CmcsRCSampling rCSampling = Dbers.GetInstance().SelfDber.Get <CmcsRCSampling>(make.SamplingId);
                if (rCSampling != null)
                {
                    // 入厂煤制样
                    CmcsRCMake rCMake = new CmcsRCMake()
                    {
                        SamplingId    = rCSampling.Id,
                        MakeStyle     = eMakeType.机器制样.ToString(),
                        MakeType      = assayType,
                        MakeStartTime = DateTime.Now,
                        MakeEndTime   = DateTime.Now,
                        MakeCode      = CommonDAO.GetInstance().CreateNewMakeCode(DateTime.Now),
                        MakePle       = user,
                        ParentMakeId  = make.Id
                    };

                    isSuccess = Dbers.GetInstance().SelfDber.Insert(rCMake) > 0;
                    makeCode  = rCMake.MakeCode;
                    //入厂煤制样明细
                    foreach (CodeContent item in CommonDAO.GetInstance().GetCodeContentByKind("制样类型"))
                    {
                        CmcsRCMakeDetail rCMakeDetail = Dbers.GetInstance().SelfDber.Entity <CmcsRCMakeDetail>("where MakeId=:MakeId and SampleType=:SampleType", new { MakeId = rCMake.Id, SampleType = item.Content });
                        if (rCMakeDetail == null)
                        {
                            rCMakeDetail            = new CmcsRCMakeDetail();
                            rCMakeDetail.MakeId     = rCMake.Id;
                            rCMakeDetail.BarrelCode = CommonDAO.GetInstance().CreateNewMakeBarrelCodeByMakeCode(rCMake.MakeCode, item.Content);
                            rCMakeDetail.SampleType = item.Content;
                            isSuccess = Dbers.GetInstance().SelfDber.Insert(rCMakeDetail) > 0;
                        }
                    }
                    // 入厂煤化验
                    CmcsRCAssay rCAssay = Dbers.GetInstance().SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId", new { MakeId = rCMake.Id });
                    if (rCAssay == null)
                    {
                        // 入厂煤煤质

                        CmcsFuelQuality fuelQuality = new CmcsFuelQuality()
                        {
                            Id = Guid.NewGuid().ToString()
                        };

                        if (Dbers.GetInstance().SelfDber.Insert(fuelQuality) > 0)
                        {
                            rCAssay = new CmcsRCAssay()
                            {
                                MakeId           = rCMake.Id,
                                AssayType        = assayType,
                                AssayWay         = assayType,
                                AssayCode        = CommonDAO.GetInstance().CreateNewAssayCode(rCMake.CreateDate),
                                InFactoryBatchId = rCSampling.InFactoryBatchId,
                                FuelQualityId    = fuelQuality.Id,
                                AssayDate        = rCMake.CreateDate,
                                WfStatus         = 0,
                                AssayPoint       = assayTarget
                            };

                            isSuccess = Dbers.GetInstance().SelfDber.Insert(rCAssay) > 0;
                        }
                    }
                }
            }
            return(isSuccess);
        }
コード例 #24
0
        private void FrmJDYMake_Oper_Load(object sender, EventArgs e)
        {
            InitFrom();
            superGridControl1.PrimaryGrid.AutoGenerateColumns = false;

            txt_GetPle.Text  = SelfVars.LoginUser.UserName;
            txt_MakePle.Text = SelfVars.LoginUser.UserName;
            if (!String.IsNullOrEmpty(id))
            {
                this.cmcsMake = Dbers.GetInstance().SelfDber.Get <CmcsRCMake>(this.id);
                if (this.cmcsMake != null)
                {
                    CmcsRCAssay assay = this.cmcsMake.TheRcAssay;
                    if (assay != null)
                    {
                        if (assay.AssayPoint == "全指标")
                        {
                            rbtnAll.Checked = true;
                        }
                        else if (assay.AssayPoint == "日常分析")
                        {
                            rbtnNormal.Checked = true;
                        }
                        else
                        {
                            rbtnHandChoose.Checked = true;
                            string[] assayPoint = assay.AssayPoint.Split(',');
                            System.Windows.Forms.Control.ControlCollection controls = panelAssayTarget.Controls;
                            foreach (Control item in controls)
                            {
                                CheckBoxX check = (CheckBoxX)item;
                                if (assayPoint.Contains(check.Text))
                                {
                                    check.Checked = true;
                                }
                            }
                        }
                        if (assay.TheFuelQuality != null)
                        {
                            dbiMt.Value = Convert.ToDouble(assay.TheFuelQuality.Mt);
                        }
                    }
                    txt_GetPle.Text           = cmcsMake.GetPle;
                    txt_MakeCode.Text         = cmcsMake.MakeCode;
                    txt_MakePle.Text          = cmcsMake.MakePle;
                    txt_SendUnit.Text         = cmcsMake.SendUnit;
                    txt_MakePle.Text          = cmcsMake.MakePle;
                    dt_UseTime.Value          = cmcsMake.UseTime;
                    dt_GetDate.Value          = cmcsMake.GetDate;
                    dt_MakeEndTime.Value      = cmcsMake.MakeEndTime;
                    dbi_GetBarrelWeight.Value = Convert.ToDouble(cmcsMake.GetBarrelWeight);
                    dt_MakeStartTime.Value    = cmcsMake.MakeStartTime;
                    txt_Remark.Text           = cmcsMake.Remark;
                    IList <CmcsRCMakeDetail> details = CommonDAO.GetInstance().SelfDber.Entities <CmcsRCMakeDetail>("where MakeId=:MakeId", new { MakeId = this.id });
                    this.cmcsMakeDetail = details;
                }
            }
            if (!edit)
            {
                btnSubmit.Enabled            = false;
                btn_CreateMakeDetail.Enabled = false;
                CMCS.WeighCheck.SampleMake.Utilities.Helper.ControlReadOnly(panelEx2);
                CMCS.WeighCheck.SampleMake.Utilities.Helper.ControlReadOnly(superGridControl1);
            }
        }
コード例 #25
0
        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();
        }
コード例 #26
0
ファイル: CommonDAO.cs プロジェクト: isliulin/HNWN_Applet
        /// <summary>
        /// 创建采制化三级数据
        /// </summary>
        /// <param name="inFactoryBatch">批次</param>
        /// <param name="samplingType">采样方式</param>
        /// <param name="remark">备注</param>
        /// <param name="assayType">化验方式</param>
        /// <returns></returns>
        public CmcsRCSampling GCSamplingMakeAssay(CmcsInFactoryBatch inFactoryBatch, string samplingType, string remark)
        {
            bool isSuccess = false;

            // 入厂煤采样
            CmcsRCSampling rCSampling = SelfDber.Entity <CmcsRCSampling>("where InFactoryBatchId=:InFactoryBatchId and SamplingType=:SamplingType and IsDeleted=0", new { InFactoryBatchId = inFactoryBatch.Id, SamplingType = samplingType });

            if (rCSampling == null)
            {
                rCSampling = new CmcsRCSampling()
                {
                    InFactoryBatchId = inFactoryBatch.Id,
                    SamplingType     = samplingType,
                    SamplingDate     = DateTime.Now,
                    SamplingPle      = "自动",
                    SampleCode       = CreateNewSampleCode(inFactoryBatch.FactArriveDate),
                    Remark           = remark
                };

                isSuccess = SelfDber.Insert(rCSampling) > 0;
            }

            // 入厂煤制样
            CmcsRCMake rCMake = SelfDber.Entity <CmcsRCMake>("where SamplingId=:SamplingId and IsDeleted=0", new { SamplingId = rCSampling.Id });

            if (rCMake == null)
            {
                rCMake = new CmcsRCMake()
                {
                    SamplingId = rCSampling.Id,
                    MakeType   = "机器制样",
                    MakeDate   = rCSampling.CreateDate,
                    MakeCode   = CreateNewMakeCode(rCSampling.CreateDate),
                    MakePle    = "自动",
                    Remark     = remark
                };

                isSuccess = SelfDber.Insert(rCMake) > 0;
            }


            // 入厂煤化验
            CmcsRCAssay rCAssay = SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId and IsDeleted=0", new { MakeId = rCMake.Id });

            if (rCAssay == null)
            {
                // 入厂煤煤质

                CmcsFuelQuality fuelQuality = new CmcsFuelQuality()
                {
                    Id = Guid.NewGuid().ToString()
                };

                if (SelfDber.Insert(fuelQuality) > 0)
                {
                    rCAssay = new CmcsRCAssay()
                    {
                        MakeId           = rCMake.Id,
                        AssayCode        = CreateNewAssayCode(rCMake.CreateDate),
                        InFactoryBatchId = inFactoryBatch.Id,
                        FuelQualityId    = fuelQuality.Id,
                        AssayDate        = rCMake.CreateDate,
                        Remark           = remark,
                        IsAssay          = 0
                    };

                    isSuccess = SelfDber.Insert(rCAssay) > 0;
                }
            }

            return(rCSampling);
        }
コード例 #27
0
        /// <summary>
        /// 生成抽查样
        /// </summary>
        /// <param name="assay">原化验记录</param>
        /// <param name="UserName">操作人</param>
        /// <param name="assayPoint">化验指标</param>
        /// <param name="PreFix">化验类型</param>
        /// <returns></returns>
        public bool CreateSpotAssay(CmcsRCAssay entity, string userName, string userAccount, string assayPoint, string PreFix, ref CmcsRCAssay assay)
        {
            try
            {
                assay            = new CmcsRCAssay();
                assay.AssayPoint = assayPoint;
                assay.AssayType  = "三级编码化验";
                assay.SendDate   = GlobalVars.ServerNowDateTime;

                //assay.AssayDate = GlobalVars.ServerNowDateTime;
                CmcsRCMake make = entity.TheRcMake;
                if (make.TheRcSampling != null && make.TheRcSampling.TheInFactoryBatch != null)
                {
                    assay.InFactoryBatchId = make.TheRcSampling.TheInFactoryBatch.Id;
                }
                assay.MakeId        = make.Id;
                assay.IsRelieve     = 1;
                assay.AssayPle      = userName;
                assay.AssayCode     = CommonDAO.GetInstance().CreateNewAssayCode(DateTime.Now);
                assay.AssayWay      = PreFix;
                assay.Remark        = "由化验室接样程序手动生成";
                assay.ParentId      = entity.Id;
                assay.BackBatchDate = entity.BackBatchDate;
                CmcsFuelQuality quality_new = new CmcsFuelQuality();
                CmcsRCAssay     assay_new   = CommonDAO.GetInstance().SelfDber.Entity <CmcsRCAssay>("where MakeId=:MakeId order by CreateDate desc", new { MakeId = make.Id });
                if (assay_new != null)
                {
                    quality_new = (CmcsFuelQuality)Clone(assay_new.TheFuelQuality);
                }
                quality_new.CreateDate = quality_new.OperDate = DateTime.Now;
                if (assayPoint.Contains("全水分") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析"))
                {
                    quality_new.Mar = 0;
                }
                if (assayPoint.Contains("空干基水分") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析"))
                {
                    quality_new.Mad  = 0;
                    quality_new.FCad = 0;
                }
                if (assayPoint.Contains("灰分") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析"))
                {
                    quality_new.Aad  = 0;
                    quality_new.Ad   = 0;
                    quality_new.Aar  = 0;
                    quality_new.FCad = 0;
                }
                if (assayPoint.Contains("挥发分") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析"))
                {
                    quality_new.Vad  = 0;
                    quality_new.Vdaf = 0;
                    quality_new.Vd   = 0;
                    quality_new.Var  = 0;
                    quality_new.FCad = 0;
                }
                if (assayPoint.Contains("全硫") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析"))
                {
                    quality_new.Stad = 0;
                    quality_new.Star = 0;
                    quality_new.Std  = 0;
                    quality_new.Sd   = 0;
                }
                if (assayPoint.Contains("热值") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析"))
                {
                    quality_new.QbAd  = 0;
                    quality_new.Qgrad = 0;
                    quality_new.Qgrar = 0;
                    quality_new.Qgrd  = 0;
                    quality_new.QCal  = 0;
                    quality_new.QJ    = 0;
                }
                if (assayPoint.Contains("氢值") || assayPoint.Contains("全指标") || assayPoint.Contains("日常分析"))
                {
                    quality_new.Hd  = 0;
                    quality_new.Had = 0;
                    quality_new.Har = 0;
                }
                if (assayPoint.Contains("灰熔融") || assayPoint.Contains("全指标"))
                {
                    quality_new.DT = 0;
                    quality_new.HT = 0;
                    quality_new.FT = 0;
                    quality_new.ST = 0;
                }

                quality_new.Id         = Guid.NewGuid().ToString();
                quality_new.CreateUser = userAccount;
                quality_new.OperUser   = userAccount;

                assay.FuelQualityId = quality_new.Id;
                Dbers.GetInstance().SelfDber.Insert(quality_new);
                Dbers.GetInstance().SelfDber.Insert(assay);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #28
0
        /// <summary>
        /// 同步样品信息到集中管控入厂煤制样明细表
        /// </summary>
        /// <param name="makeDetail"></param>
        private bool SyncToRCMakeDetail(ZY_Record_Tb makeDetail)
        {
            CmcsRCMake rCMake = commonDAO.SelfDber.Entity <CmcsRCMake>("where MakeCode=:MakeCode", new { MakeCode = makeDetail.SampleID });

            if (rCMake != null)
            {
                // 修改制样结束时间
                rCMake.MakeType = eMakeType.机械制样.ToString();
                //if (rCMake.MakeDate < makeDetail.EndTime) rCMake.MakeDate = makeDetail.EndTime;
                //if (rCMake.MakeDate != rCMake.CreationTime && rCMake.MakeDate > makeDetail.StartTime)
                //{
                //	//rCMake.GetDate = makeDetail.StartTime;
                //	rCMake.MakeDate = makeDetail.EndTime;

                //	//取归批时间
                //	string sql = string.Format(@"select a.backbatchdate from
                //								fultbinfactorybatch a
                //								left join cmcstbrcsampling b on a.id=b.infactorybatchid
                //								left join cmcstbmake c on b.id=c.samplingid
                //								where c.id='{0}'", rCMake.Id);
                //	DataTable dt = commonDAO.SelfDber.ExecuteDataTable(sql);
                //	if (dt != null && dt.Rows.Count>0)
                //	{
                //		rCMake.GetDate = Convert.ToDateTime(dt.Rows[0]["backbatchdate"]);
                //	}
                //}

                rCMake.MakeDate = makeDetail.StartTime;

                //取归批时间
                string    sql = string.Format(@"select a.backbatchdate from 
												fultbinfactorybatch a 
												left join cmcstbrcsampling b on a.id=b.infactorybatchid
												left join cmcstbmake c on b.id=c.samplingid
												where c.id='{0}'"                                                , rCMake.Id);
                DataTable dt  = commonDAO.SelfDber.ExecuteDataTable(sql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    rCMake.GetDate = Convert.ToDateTime(dt.Rows[0]["backbatchdate"]);
                }

                commonDAO.SelfDber.Update(rCMake);

                CmcsRCMakeDetail rCMakeDetail = commonDAO.SelfDber.Entity <CmcsRCMakeDetail>("where MakeId=:MakeId and SampleType=:SampleType", new { MakeId = rCMake.Id, SampleType = MakeTypeChange(makeDetail.SampleType) });
                if (rCMakeDetail != null)
                {
                    rCMakeDetail.LastModificAtionTime = DateTime.Now;
                    rCMakeDetail.CreationTime         = DateTime.Now;
                    rCMakeDetail.SampleWeight         = makeDetail.SamepleWeight;
                    rCMakeDetail.SampleType           = MakeTypeChange(makeDetail.SampleType);
                    rCMakeDetail.SampleCode           = makeDetail.PackCode;
                    return(commonDAO.SelfDber.Update(rCMakeDetail) > 0);
                }
                else
                {
                    rCMakeDetail        = new CmcsRCMakeDetail();
                    rCMakeDetail.MakeId = rCMake.Id;
                    rCMakeDetail.LastModificAtionTime = DateTime.Now;
                    rCMakeDetail.CreationTime         = DateTime.Now;
                    rCMakeDetail.SampleWeight         = makeDetail.SamepleWeight;
                    rCMakeDetail.SampleType           = MakeTypeChange(makeDetail.SampleType);          //AutoMakerDAO.GetInstance().GetKYMakeType(makeDetail.SampleType.ToString());
                    rCMakeDetail.SampleCode           = makeDetail.PackCode;
                    return(commonDAO.SelfDber.Insert(rCMakeDetail) > 0);
                }
            }
            else
            {
                return(true);
            }
        }