예제 #1
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);
        }
        /// <summary>
        /// 插入车辆信息至翻车衡交互数据库
        /// </summary>
        /// <param name="trunNumber"></param>
        /// <param name="transport"></param>
        public static bool InsertCarToTurnCarWeighter(string trunNumber, CmcsTransport transport)
        {
            if (transport != null && !string.IsNullOrEmpty(transport.InFactoryBatchId))
            {
                CmcsRCSampling sampling = Dbers.GetInstance().SelfDber.Entity <CmcsRCSampling>("where InFactoryBatchId=:InFactoryBatchId and SamplingType not like '%抽查%' order by SamplingDate desc", new { InFactoryBatchId = transport.InFactoryBatchId });
                if (sampling != null)
                {
                    if (DcDbers.GetInstance().TurnCarWeighterMutualDber.Entity <CarInfoMutual>(" where  TurnCarNumber='" + trunNumber + "' and  CarNumber='" + transport.TransportNo + "' and DataFlag=0 ") == null)
                    {
                        DcDbers.GetInstance().TurnCarWeighterMutualDber.Execute(" update CarInfoMutual set DataFlag=1 where TurnCarNumber='" + trunNumber + "'");

                        return(DcDbers.GetInstance().TurnCarWeighterMutualDber.Insert(new CarInfoMutual()
                        {
                            TurnCarNumber = trunNumber,
                            CarNumber = transport.TransportNo,
                            SampleBillNumber = sampling.SampleCode,
                            InFactoryDate = transport.InfactoryTime,
                            TicketWeight = (double)transport.TicketQty,
                            CreateDate = System.DateTime.Now,
                            WeightDate = DateTime.Now,
                            DataFlag = 0,
                            CancelSign = 0
                        }) > 0);
                    }
                }
            }
            return(false);
        }
예제 #3
0
        /// <summary>
        /// 保存出厂煤运输记录
        /// </summary>
        /// <param name="transportId"></param>
        /// <param name="place"></param>
        /// <returns></returns>
        public bool SaveSaleFuelTransport(string transportId, DateTime dt, string place)
        {
            CmcsSaleFuelTransport transport = SelfDber.Get <CmcsSaleFuelTransport>(transportId);

            if (transport == null)
            {
                return(false);
            }
            transport.IsSynch = "0";

            transport.StepName     = eTruckInFactoryStep.采样.ToString();
            transport.SamplingTime = dt;
            transport.SamplePlace  = place;
            CmcsRCSampling sample = Dbers.GetInstance().SelfDber.Get <CmcsRCSampling>(transport.SamplingId);

            if (sample != null)
            {
                if (sample.SamplingDate.Year < 2000)
                {
                    sample.SamplingDate = DateTime.Now;
                }
                if (string.IsNullOrEmpty(sample.CARNUMS) || !sample.CARNUMS.Contains(transport.CarNumber))
                {
                    sample.CARNUMS += "," + transport.CarNumber;
                    sample.TOTALNUM++;
                    if (sample.CARNUMS.StartsWith(","))
                    {
                        sample.CARNUMS.Remove(0, 1);
                    }
                }
                Dbers.GetInstance().SelfDber.Update(sample);
            }
            return(SelfDber.Update(transport) > 0);
        }
예제 #4
0
        /// <summary>
        /// 根据入场煤运输记录生成批次并返回。
        /// 根据入场时间(实际到厂时间)、供煤单位、煤种生成,已存在则不创建
        /// </summary>
        /// <param name="buyFuelTransport"></param>
        /// <returns></returns>
        public CmcsInFactoryBatch GCQCInFactoryBatchByBuyFuelTransport(CmcsBuyFuelTransport buyFuelTransport, CmcsLMYB lmyb)
        {
            bool isSuccess = false;

            CmcsInFactoryBatch entity = HasInFactoryBatch(buyFuelTransport);

            if (entity == null)
            {
                //记录运输方式Id
                CodeContent        transporttype = new CodeContent();
                List <CodeContent> par           = commonDAO.GetCodeContentByKind("运输方式");
                if (par != null)
                {
                    transporttype = par.Where(a => a.Content == "汽车").FirstOrDefault();
                }

                entity = new CmcsInFactoryBatch()
                {
                    Batch              = CreateNewBatchNumber("QC", buyFuelTransport.InFactoryTime),
                    BatchType          = "汽车",
                    TransportTypeId    = transporttype != null ? transporttype.Id : "",
                    TransportTypeName  = "汽车",
                    PlanArriveDate     = buyFuelTransport.InFactoryTime,
                    FactArriveDate     = buyFuelTransport.InFactoryTime,
                    FuelKindId         = buyFuelTransport.FuelKindId,
                    SupplierId         = buyFuelTransport.SupplierId,
                    SentSupplierId     = buyFuelTransport.SupplierId,
                    SendSupplierId     = buyFuelTransport.SupplierId,
                    MineId             = buyFuelTransport.MineId,
                    RunDate            = buyFuelTransport.InFactoryTime,
                    TransportCompanyId = buyFuelTransport.TransportCompanyId,
                    Remark             = "由汽车煤智能化自动创建",
                    IsFinish           = 0,
                    IsCheck            = 0,
                    IsCTAutoCreate     = 1,
                    IsScale            = 0,
                    BACKBATCHDATE      = buyFuelTransport.InFactoryTime,
                    InFactoryType      = buyFuelTransport.InFactoryType
                };
                if (lmyb != null)
                {
                    entity.LMYBID         = lmyb.Id;
                    entity.PlanArriveDate = lmyb.InFactoryTime;
                    entity.QCal           = lmyb.Q;
                    entity.Stad           = lmyb.S;
                    entity.Vad            = lmyb.V;
                }
                // 创建新批次
                isSuccess = SelfDber.Insert(entity) > 0;
            }
            if (buyFuelTransport.SamplingType != eSamplingType.人工采样.ToString())
            {
                // 生成采制化数据记录
                CmcsRCSampling rCSampling = commonDAO.GCSamplingMakeAssay(entity, buyFuelTransport.SamplingType, "由汽车煤智能化自动创建", eAssayType.级编码化验);
                buyFuelTransport.SamplingId = rCSampling.Id;
            }
            buyFuelTransport.InFactoryBatchId = entity.Id;
            return(entity);
        }
예제 #5
0
        /// <summary>
        /// 根据批次Id加载采样单列表
        /// </summary>
        /// <param name="superGridControl"></param>
        /// <param name="batchId"></param>
        private void LoadRCSamplingList(SuperGridControl superGridControl, string batchId)
        {
            this.CurrentRCSampling = null;

            List <CmcsRCSampling> list = commonDAO.GetSamplings(batchId);

            superGridControl.PrimaryGrid.DataSource = list;
        }
예제 #6
0
        /// <summary>
        /// 同步历史卸样结果
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode"></param>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            res = 0;
            // 第三方 > 集中管控
            foreach (EquQCJXCYJUnloadResult entity in this.EquDber.Entities <EquQCJXCYJUnloadResult>("where DataFlag=0"))
            {
                InfQCJXCYJUnloadResult oldUnloadResult = commonDAO.SelfDber.Get <InfQCJXCYJUnloadResult>(entity.Id);
                if (oldUnloadResult == null)
                {
                    // 查找采样命令
                    EquQCJXCYJSampleCmd qCJXCYJSampleCmd = this.EquDber.Entity <EquQCJXCYJSampleCmd>("where SampleCode=@SampleCode", new { SampleCode = entity.SampleCode });
                    if (qCJXCYJSampleCmd != null)
                    {
                        CmcsRCSampling sampling = commonDAO.SelfDber.Entity <CmcsRCSampling>("where SampleCode=:SampleCode", new { SampleCode = entity.SampleCode });
                        //生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            BarrelCode       = entity.BarrelCode,
                            BarrellingTime   = entity.UnloadTime,
                            BarrelNumber     = entity.BarrelCode,
                            InFactoryBatchId = qCJXCYJSampleCmd.InFactoryBatchId,
                            SamplerName      = this.MachineCode,
                            SampleType       = eSamplingType.机械采样.ToString(),
                            SamplingId       = sampling != null ? sampling.Id : entity.SamplingId,
                            SampleWeight     = entity.SampleWeigh
                        };

                        if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                        {
                            if (commonDAO.SelfDber.Insert(new InfQCJXCYJUnloadResult
                            {
                                SampleCode = entity.SampleCode,
                                BarrelCode = entity.BarrelCode,
                                UnloadTime = entity.UnloadTime,
                                DataFlag = entity.DataFlag
                            }) > 0)
                            {
                                CmcsCYJCodeInfo codeInfo = commonDAO.SelfDber.Entity <CmcsCYJCodeInfo>("where SampleCode=:SampleCode and BarrelCode=:BarrelCode and SamplerName=:SamplerName and IsClear=0", new { SampleCode = entity.SampleCode, BarrelCode = entity.BarrelCode, SamplerName = this.MachineCode });
                                if (codeInfo != null)
                                {
                                    codeInfo.ClearTime = entity.UnloadTime;
                                    codeInfo.IsClear   = 1;
                                    commonDAO.SelfDber.Update(codeInfo);
                                }
                                entity.DataFlag = 1;
                                this.EquDber.Update(entity);

                                res++;
                            }
                        }
                    }
                }
            }
            output(string.Format("{0}-同步卸样结果 {0} 条(第三方 > 集中管控)", this.MachineCode, res), eOutputType.Normal);
        }
예제 #7
0
        private void superGridControl1_CellClick(object sender, GridCellClickEventArgs e)
        {
            string sampleCode = (e.GridCell.GridRow.DataItem as CmcsEquInfSampleBarrel).SampleCode;
            string batchId    = (e.GridCell.GridRow.DataItem as CmcsEquInfSampleBarrel).InFactoryBatchId;

            CheckedSameBarrelRow(sender as SuperGridControl, sampleCode);
            CheckedSampleInfo(superGridControl2, batchId);
            this.currentCmcsRCSampling = null;
            lblSampleCode.Text         = "####";
            lblSampleType.Text         = "####";
        }
예제 #8
0
        /// <summary>
        /// 根据采样单Id获取批次
        /// </summary>
        /// <returns></returns>
        /// <param name="rCSamplingId">采样单Id</param>
        public CmcsInFactoryBatch GetBatchByRCSamplingId(string rCSamplingId)
        {
            CmcsRCSampling rCSampling = SelfDber.Get <CmcsRCSampling>(rCSamplingId);

            if (rCSampling != null)
            {
                return(SelfDber.Get <CmcsInFactoryBatch>(rCSampling.InFactoryBatchId));
            }

            return(null);
        }
예제 #9
0
        /// <summary>
        /// 根据当前发送制样命令,判断该批次是否还有未卸完的样
        /// </summary>
        /// <param name="SampleID"></param>
        /// <returns></returns>
        public string getStr(string SampleID)
        {
            string                str        = String.Empty;
            CmcsRCSampling        rCSampling = commonDAO.SelfDber.Get <CmcsRCSampling>(SampleID);
            InfEquInfSampleBarrel entity     = commonDAO.SelfDber.Entity <InfEquInfSampleBarrel>("where SampleCode='" + rCSampling.SampleCode + "'");

            if (entity != null)
            {
                str = entity.MachineCode;
            }
            return(str);
        }
예제 #10
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);
        }
예제 #11
0
        /// <summary>
        /// 同步历史卸样结果
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode"></param>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            res = 0;
            // 第三方 > 集中管控
            foreach (EquQCJXCYJUnloadResult entity in this.EquDber.Entities <EquQCJXCYJUnloadResult>("where DataFlag=0"))
            {
                InfQCJXCYJUnloadResult oldUnloadResult = commonDAO.SelfDber.Get <InfQCJXCYJUnloadResult>(entity.Id);
                if (oldUnloadResult == null)
                {
                    // 查找采样命令
                    EquQCJXCYJSampleCmd qCJXCYJSampleCmd = this.EquDber.Entity <EquQCJXCYJSampleCmd>("where SampleCode=@SampleCode", new { SampleCode = entity.SampleCode });
                    if (qCJXCYJSampleCmd != null)
                    {
                        CmcsRCSampling sample = commonDAO.SelfDber.Entity <CmcsRCSampling>("where SamplingType='机械采样' and InFactoryBatchId=:InFactoryBatchId order by CreateDate desc", new { InFactoryBatchId = qCJXCYJSampleCmd.InFactoryBatchId });
                        // 生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            BarrelCode       = entity.BarrelCode,
                            BarrellingTime   = entity.UnloadTime,
                            BarrelNumber     = entity.BarrelNumber,
                            InFactoryBatchId = qCJXCYJSampleCmd.InFactoryBatchId,
                            SamplerName      = this.MachineCode,
                            SampleType       = eSamplingType.机械采样.ToString(),
                            SamplingId       = sample != null ? sample.Id : "",
                            SampSecondCode   = entity.BarrelCode
                        };

                        if (commonDAO.SelfDber.Insert(rCSampleBarrel) > 0)
                        {
                            if (commonDAO.SelfDber.Insert(new InfQCJXCYJUnloadResult
                            {
                                SampleCode = entity.SampleCode,
                                BarrelCode = entity.BarrelCode,
                                UnloadTime = entity.UnloadTime,
                                SamplingId = sample != null ? sample.Id : "",
                                DataFlag = entity.DataFlag
                            }) > 0)
                            {
                                entity.DataFlag = 1;
                                this.EquDber.Update(entity);

                                res++;
                            }
                        }
                    }
                }
            }
            output(string.Format("{0}同步卸样结果 {1} 条(第三方 > 集中管控)", this.MachineCode, res), eOutputType.Normal);
        }
예제 #12
0
        private void superGridControl2_CellClick(object sender, GridCellClickEventArgs e)
        {
            currentCmcsRCSampling = e.GridCell.GridRow.DataItem as CmcsRCSampling;
            string sampleCode = currentCmcsRCSampling.SampleCode;

            lblSampleCode.Text = sampleCode;
            lblSampleType.Text = currentCmcsRCSampling.SamplingType;

            foreach (GridRow gridRow in superGridControl2.PrimaryGrid.Rows)
            {
                CmcsRCSampling cmcsRCSampling = gridRow.DataItem as CmcsRCSampling;
                gridRow.Checked = (cmcsRCSampling != null && !string.IsNullOrWhiteSpace(cmcsRCSampling.SampleCode) && !string.IsNullOrWhiteSpace(sampleCode) && cmcsRCSampling.SampleCode == sampleCode);
            }
        }
예제 #13
0
        /// <summary>
        /// 判断样桶使用情况,是否发生采样计划
        /// </summary>
        /// <param name="cmcsRCSampling"></param>
        /// <param name="MachineCode"></param>
        /// <returns></returns>
        public bool CheckSampleBarrel(CmcsRCSampling cmcsRCSampling, string MachineCode)
        {
            bool res = false;
            List <InfEquInfSampleBarrel> barrelList = Dbers.GetInstance().SelfDber.Entities <InfEquInfSampleBarrel>("where MachineCode=:MachineCode"
                                                                                                                    , new { MachineCode = MachineCode });
            InfEquInfSampleBarrel infEquInfSampleBarrel = barrelList.Where(a => a.IsCurrent == 1).FirstOrDefault();

            if (infEquInfSampleBarrel.BarrelStatus == "空桶")
            {
                res = true;
            }
            else if (infEquInfSampleBarrel.BarrelStatus == "未满")
            {
                if (infEquInfSampleBarrel.SampleCode == cmcsRCSampling.SampleCode)
                {
                    res = true;
                }
                else
                {
                    if (barrelList.Where(a => a.BarrelStatus == "空桶").ToList().Count > 0)
                    {
                        res = true;
                    }
                    else
                    {
                        res = false;
                    }
                }
            }
            else
            {
                if (barrelList.Where(a => a.BarrelStatus == "空桶").ToList().Count > 0)
                {
                    res = true;
                }
                else
                {
                    res = false;
                }
            }

            if (!res)
            {
                commonDAO.SaveEquInfHitch(MachineCode, DateTime.Now, MachineCode + "无空桶,不能采样!");
            }

            return(res);
        }
예제 #14
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);
        }
예제 #15
0
        /// <summary>
        /// 新增采样明细
        /// </summary>
        /// <param name="sampleId"></param>
        /// <returns></returns>
        public bool SaveSampleDetail(string sampleId, decimal weight)
        {
            CmcsRCSampling sample = Dbers.GetInstance().SelfDber.Get <CmcsRCSampling>(sampleId);

            if (sample != null)
            {
                CmcsRCSampleBarrel sampleBarrel = new CmcsRCSampleBarrel();
                sampleBarrel.SamplingId     = sampleId;
                sampleBarrel.BarrellingTime = DateTime.Now;
                sampleBarrel.SampSecondCode = CommonDAO.GetInstance().CreateSampleDetailCode(sample.SampleCode);
                sampleBarrel.BarrelWeight   = (double)weight;
                sampleBarrel.SampleCode     = sample.SampleCode;
                sampleBarrel.SampleType     = "人工采样";
                sampleBarrel.SampleMachine  = "人工";
                return(Dbers.GetInstance().SelfDber.Insert(sampleBarrel) > 0);
            }
            return(false);
        }
예제 #16
0
        /// <summary>
        /// 根据运输记录生成批次并返回。
        /// 根据入厂时间(实际到厂时间)、供煤单位、煤种生成,已存在则不创建
        /// </summary>
        /// <param name="buyFuelTransport"></param>
        /// <returns></returns>
        public CmcsInFactoryBatch GCQCInFactoryBatchByBuyFuelTransport(CmcsBuyFuelTransport buyFuelTransport)
        {
            bool isSuccess = true;

            CmcsInFactoryBatch entity = HasInFactoryBatch(buyFuelTransport);

            if (entity == null)
            {
                entity = new CmcsInFactoryBatch()
                {
                    Batch             = CreateNewBatchNumber("QC", buyFuelTransport.CreationTime),
                    TransportTypeName = "汽车",
                    FactArriveDate    = buyFuelTransport.InFactoryTime,
                    FuelKindId        = buyFuelTransport.FuelKindId,
                    FuelKindName      = buyFuelTransport.FuelKindName,
                    SupplierId        = buyFuelTransport.SupplierId,
                    SupplierName      = buyFuelTransport.SupplierName,
                    MineId            = buyFuelTransport.MineId,
                    RunDate           = buyFuelTransport.InFactoryTime,
                    SendSupplierId    = buyFuelTransport.TransportCompanyId,
                    Remark            = "由汽车煤智能化自动创建",
                    BatchCreateType   = 1,
                    FuelType          = "长协煤",
                    DispatchDate      = DateTime.Now.Date,
                };

                // 创建新批次
                isSuccess = SelfDber.Insert(entity) > 0;
            }

            if (isSuccess)
            {
                // 生成采制化数据记录
                CmcsRCSampling rCSampling = commonDAO.GCSamplingMakeAssay(entity, buyFuelTransport.SamplingType, "由汽车煤智能化自动创建");

                buyFuelTransport.SamplingId       = rCSampling.Id;
                buyFuelTransport.InFactoryBatchId = entity.Id;
            }

            return(entity);
        }
예제 #17
0
        private void superGridControl2_BeforeCheck(object sender, GridBeforeCheckEventArgs e)
        {
            GridRow gridRow = (e.Item as GridRow);

            if (gridRow == null || gridRow.Checked)
            {
                e.Cancel = true; return;
            }

            this.CurrentRCSampling = gridRow.DataItem as CmcsRCSampling;
            e.Cancel = string.IsNullOrEmpty(this.CurrentRCSampling.SampleCode);

            // 取消其他行的选中状态
            foreach (GridRow gridRowItem in superGridControl2.PrimaryGrid.Rows)
            {
                CmcsRCSampling rCSampling = gridRowItem.DataItem as CmcsRCSampling;
                if (rCSampling.Id == this.CurrentRCSampling.Id)
                {
                    continue;
                }

                gridRowItem.Checked = false;
            }
        }
예제 #18
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);
        }
예제 #19
0
        private void superGridControl1_CellDoubleClick(object sender, DevComponents.DotNetBar.SuperGrid.GridCellDoubleClickEventArgs e)
        {
            GridRow gridRow = (sender as SuperGridControl).PrimaryGrid.ActiveRow as GridRow;

            if (gridRow == null)
            {
                return;
            }

            CmcsInFactoryBatch entity = (gridRow.DataItem as CmcsInFactoryBatch);

            if (entity != null)
            {
                IList <CmcsRCSampling> rCSample = cZYHandlerDAO.GetRGSamplingByBatchId(entity.Id);
                if (rCSample != null && rCSample.Count > 0)
                {
                    DataTable dt = cZYHandlerDAO.GetSampleInfo(rCSample[0].Id);
                    listSampleInfo.Clear();
                    foreach (DataRow drSample in dt.Rows)
                    {
                        listSampleInfo.Add(new SampleInfo()
                        {
                            Id               = drSample["Id"].ToString(),
                            Batch            = drSample["Batch"].ToString(),
                            BatchId          = drSample["BatchId"].ToString(),
                            SupplierName     = drSample["SupplierName"].ToString(),
                            MineName         = drSample["MineName"].ToString(),
                            KindName         = drSample["KindName"].ToString(),
                            StationName      = drSample["StationName"].ToString(),
                            FactarriveDate   = DateTime.Parse(drSample["FactarriveDate"].ToString()),
                            SampleCode       = drSample["SampleCode"].ToString(),
                            SamplingDate     = DateTime.Parse(drSample["SamplingDate"].ToString()),
                            SamplingType     = drSample["SamplingType"].ToString(),
                            BatchType        = drSample["InFactoryType"].ToString(),
                            FuelSupplierName = drSample["FuelSupplierName"].ToString(),
                        });
                        _Form1.CurrentSampleInfo = listSampleInfo[0];
                    }
                }
                else
                {
                    if (MessageBoxEx.Show("该批次没有人工采样单,是否生成人工采样?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        // 生成采制化数据记录
                        CmcsRCSampling rCSampling = CommonDAO.GetInstance().GCSamplingMakeAssay(entity, eSamplingType.人工采样.ToString(), "由人工制样室自动创建", eAssayType.级编码化验, SelfVars.LoginUser.UserName);
                        DataTable      dt         = cZYHandlerDAO.GetSampleInfo(rCSampling.Id);
                        listSampleInfo.Clear();
                        foreach (DataRow drSample in dt.Rows)
                        {
                            listSampleInfo.Add(new SampleInfo()
                            {
                                Id               = drSample["Id"].ToString(),
                                Batch            = drSample["Batch"].ToString(),
                                BatchId          = drSample["BatchId"].ToString(),
                                SupplierName     = drSample["SupplierName"].ToString(),
                                MineName         = drSample["MineName"].ToString(),
                                KindName         = drSample["KindName"].ToString(),
                                StationName      = drSample["StationName"].ToString(),
                                FactarriveDate   = DateTime.Parse(drSample["FactarriveDate"].ToString()),
                                SampleCode       = drSample["SampleCode"].ToString(),
                                SamplingDate     = DateTime.Parse(drSample["SamplingDate"].ToString()),
                                SamplingType     = drSample["SamplingType"].ToString(),
                                BatchType        = drSample["InFactoryType"].ToString(),
                                FuelSupplierName = drSample["FuelSupplierName"].ToString(),
                            });
                            _Form1.CurrentSampleInfo = listSampleInfo[0];
                        }
                    }
                }

                isExit = false;
                this.Close();
            }
        }
예제 #20
0
        /// <summary>
        /// 同步集样罐信息到集中管控
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public void SyncBarrel(Action <string, eOutputType> output)
        {
            int res = 0;

            List <EquQCJXCYJBarrel> infpdcybarrels = this.EquDber.Entities <EquQCJXCYJBarrel>("where DataFlag=0");

            foreach (EquQCJXCYJBarrel entity in infpdcybarrels)
            {
                if (commonDAO.SaveEquInfSampleBarrel(new InfEquInfSampleBarrel
                {
                    BarrelNumber = entity.BarrelNumber,
                    BarrelStatus = entity.BarrelStatus.ToString(),
                    MachineCode = this.MachineCode,
                    InFactoryBatchId = entity.InFactoryBatchId,
                    InterfaceType = "西马智深汽车采样机接口",
                    IsCurrent = entity.IsCurrent,
                    SampleCode = entity.SampleCode,
                    SampleCount = entity.SampleCount,
                    UpdateTime = entity.UpdateTime,
                    BarrelType = "密码罐",
                    SampleWeight = entity.SampleWeigh
                }))
                {
                    if (!string.IsNullOrEmpty(entity.BarrelNumber) && !string.IsNullOrEmpty(entity.SampleCode))
                    {
                        //写入采样码记录
                        CmcsRCSampling  sampling = commonDAO.SelfDber.Entity <CmcsRCSampling>("where SampleCode=:SampleCode", new { SampleCode = entity.SampleCode });
                        CmcsCYJCodeInfo codeInfo = commonDAO.SelfDber.Entity <CmcsCYJCodeInfo>("where SampleCode=:SampleCode and BarrelCode=:BarrelCode and SamplerName=:SamplerName and IsClear=0", new { SampleCode = entity.SampleCode, BarrelCode = entity.BarrelNumber, SamplerName = this.MachineCode });
                        int             carCount = 0;
                        if (sampling != null)
                        {
                            carCount = commonDAO.SelfDber.Count <CmcsBuyFuelTransport>("where SamplingId=:SamplingId and SamplePlace=:SamplePlace", new { SamplingId = sampling.Id, SamplePlace = this.MachineCode });
                        }
                        if (codeInfo == null)
                        {
                            codeInfo              = new CmcsCYJCodeInfo();
                            codeInfo.SampleCode   = entity.SampleCode;
                            codeInfo.BarrelCode   = Convert.ToInt32(entity.BarrelNumber);
                            codeInfo.SampleCount  = entity.SampleCount;
                            codeInfo.CarCount     = entity.SampleCount;
                            codeInfo.SampleWeight = entity.SampleWeigh;
                            codeInfo.SamplerName  = this.MachineCode;
                            codeInfo.SamplingId   = sampling != null ? sampling.Id : "";
                            codeInfo.StartTime    = entity.UpdateTime;
                            codeInfo.IsClear      = 0;
                            commonDAO.SelfDber.Insert(codeInfo);
                        }
                        else
                        {
                            codeInfo.SampleCount  = entity.SampleCount;
                            codeInfo.CarCount     = entity.SampleCount;
                            codeInfo.SampleWeight = entity.SampleWeigh;
                            codeInfo.EndTime      = DateTime.Now;
                            commonDAO.SelfDber.Update(codeInfo);
                        }
                    }
                    entity.DataFlag = 1;
                    this.EquDber.Update(entity);

                    res++;
                }
            }

            output(string.Format("{0}-同步集样罐记录 {1} 条", this.MachineCode, res), eOutputType.Normal);
        }
예제 #21
0
        /// <summary>
        /// 同步历史卸样结果
        /// </summary>
        /// <param name="output"></param>
        /// <param name="MachineCode"></param>
        public void SyncUnloadResult(Action <string, eOutputType> output)
        {
            int res = 0;

            res = 0;
            // 第三方 > 集中管控
            foreach (KY_CYJ_P_BARREL entity in DcDbers.GetInstance().BeltSampler_Dber.Entities <KY_CYJ_P_BARREL>("where DateDiff(dd,EditDate,getdate())<=7"))
            {
                // 查找采样命令
                CmcsRCSampling sampling = commonDAO.SelfDber.Entity <CmcsRCSampling>("where SampleCode=:SampleCode", new { SampleCode = entity.Barrel_Name });
                if (sampling != null)
                {
                    CmcsRCSampleBarrel cmcsRCSampleBarrel = commonDAO.SelfDber.Entity <CmcsRCSampleBarrel>("where BarrelNumber='" + entity.Barrel_Name + "' and to_char(BarrellingTime,'yyyy-mm-dd hh24:mi:ss')= '" + entity.EditDate.ToString("yyyy-MM-dd HH:mm:ss") + "' and SamplerName = '" + KYToMachineCode(entity.CYJ_Machine) + "'");
                    if (cmcsRCSampleBarrel == null)
                    {
                        // 生成采样桶记录
                        CmcsRCSampleBarrel rCSampleBarrel = new CmcsRCSampleBarrel()
                        {
                            SamplingId     = sampling.Id,
                            BarrellingTime = entity.EditDate,
                            BarrelNumber   = entity.Barrel_Name,
                            SamplerName    = KYToMachineCode(entity.CYJ_Machine),
                            SampleType     = eSamplingType.机械采样.ToString(),
                            //SampleCount = barrel.SampleCount,
                            SampleWeight = entity.Barrel_Weight,
                            BarrelCode   = entity.Barrel_Code
                        };
                        commonDAO.SelfDber.Insert(rCSampleBarrel);
                    }
                    else
                    {
                        cmcsRCSampleBarrel.SampleWeight = entity.Barrel_Weight;
                        commonDAO.SelfDber.Update(cmcsRCSampleBarrel);
                    }
                }


                InfBeltSamplerUnloadResult oldUnloadResult = commonDAO.SelfDber.Entity <InfBeltSamplerUnloadResult>("where samplecode='" + entity.Barrel_Name + "' and to_char(UnloadTime,'yyyy-mm-dd hh24:mi:ss')= '" + entity.EditDate.ToString("yyyy-MM-dd HH:mm:ss") + "'");
                if (oldUnloadResult == null)
                {
                    if (commonDAO.SelfDber.Insert(new InfBeltSamplerUnloadResult
                    {
                        MachineCode = KYToMachineCode(entity.CYJ_Machine),
                        SampleCode = entity.Barrel_Name,
                        BarrelCode = entity.Barrel_Code,
                        UnloadTime = entity.EditDate
                    }) > 0)
                    {
                        //entity.DataFlag = 1;
                        //this.EquDber.Update(entity);

                        res++;
                    }
                }
                else
                {
                    oldUnloadResult.MachineCode = KYToMachineCode(entity.CYJ_Machine);
                    oldUnloadResult.SampleCode  = entity.Barrel_Name;
                    oldUnloadResult.BarrelCode  = entity.Barrel_Code;
                    oldUnloadResult.UnloadTime  = entity.EditDate;

                    if (commonDAO.SelfDber.Update(oldUnloadResult) > 0)
                    {
                        //entity.DataFlag = 1;
                        //this.EquDber.Update(entity);

                        res++;
                    }
                }
            }
            output(string.Format("同步卸样结果 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
        }
예제 #22
0
        private void makeImage(object sender, PrintPageEventArgs e)
        {
            Font fontTitle = new Font("黑体", instance.FontSize, FontStyle.Bold, GraphicsUnit.Pixel);
            CmcsBuyFuelTransport entity = this.cmcsSupplier;
            String sampleCode           = "";
            String BatchCode            = "";
            String weight    = "";
            String carNumber = "";

            CmcsInFactoryBatch batch = Dbers.GetInstance().SelfDber.Get <CmcsInFactoryBatch>(entity.InFactoryBatchId);

            BatchCode = batch == null ? "" : batch.Batch;
            CmcsRCSampling sampling = Dbers.GetInstance().SelfDber.Entities <CmcsRCSampling>(" where InFactoryBatchId=:InFactoryBatchId", new { InFactoryBatchId = entity.InFactoryBatchId }).FirstOrDefault();

            sampleCode = sampling == null ? "" : sampling.SampleCode;

            DataTable lmyb = Dbers.GetInstance().SelfDber.ExecuteDataTable(String.Format("select a.CoalNumber,a.TRANSFERNUMBER from fultbtransfer a where id=(select t.lmybid from fultbinfactorybatch t where t.id='{0}')", entity.InFactoryBatchId));

            if (lmyb != null && lmyb.Rows.Count > 0)
            {
                weight    = instance.ParseDecimal(lmyb.Rows[0][0]).ToString("F2");
                carNumber = instance.ParseDecimal(lmyb.Rows[0][1]).ToString("F0");
            }
            Graphics g;
            Bitmap   result = new Bitmap(600, 600);

            if (e == null)
            {
                g = Graphics.FromImage(result);
                g.FillRectangle(new SolidBrush(System.Drawing.Color.White), 0, 0, result.Width, result.Height);
            }
            else
            {
                g = e.Graphics;
            }

            // 行间距 30
            float  TopValue = 0;
            Bitmap bmp      = null;

            QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();

            qrCodeEncoder.QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.BYTE;
            qrCodeEncoder.QRCodeScale        = instance.ImgSize;
            qrCodeEncoder.QRCodeVersion      = 0;
            qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
            bmp = qrCodeEncoder.Encode(sampleCode);

            string printValue = "";

            g.DrawImage(bmp, instance.ImgLeftPadding, instance.ImgTopPadding);
            //TopValue = instance.ImgTopPadding + bmp.Height + instance.CharToImg;
            TopValue = instance.CharToImg;
            float leftValue = instance.ImgLeftPadding + bmp.Width + instance.CharLeftPadding;

            printValue = "车    号:" + entity.CarNumber;
            TopValue   = DrawContent(fontTitle, g, TopValue, printValue, leftValue);

            //printValue = "批次编号:" + BatchCode;
            //TopValue = DrawContent(fontTitle, g, instance.ImgTopPadding + bmp.Height + 5, printValue, instance.ImgLeftPadding + 5);

            //printValue = "采样编码:" + sampleCode;
            //TopValue = DrawContent(fontTitle, g, TopValue, printValue);
            printValue = "计划车数:" + (String.IsNullOrEmpty(carNumber) ? "0  " : carNumber) + " 车";
            TopValue   = DrawContent(fontTitle, g, TopValue, printValue, leftValue);


            printValue = "计划煤量:" + (String.IsNullOrEmpty(weight) ? "0.00" : weight) + " 吨";
            TopValue   = DrawContent(fontTitle, g, TopValue, printValue, leftValue);


            printValue = "批次编号:" + BatchCode;
            TopValue   = DrawContent(fontTitle, g, instance.ImgTopPadding + bmp.Height + 5, printValue, instance.ImgLeftPadding + 5);

            if (e == null)
            {
                this.pictureBox1.Image = result;
                g.Dispose();
            }
        }
예제 #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
        /// <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);
        }
예제 #25
0
        /// <summary>
        /// 读卡、车号识别任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Stop();
            timer1.Interval = 2000;

            try
            {
                // 执行远程命令
                ExecAppRemoteControlCmd();

                switch (this.CurrentFlowFlag)
                {
                case eFlowFlag.等待车辆:
                    #region

                    if (this.InductorCoil1)
                    {
                        // 当读卡区域地感有信号,触发读卡或者车号识别

                        List <string> tags = Hardwarer.Rwer1.ScanTags();
                        if (tags.Count > 0)
                        {
                            passCarQueuer.Enqueue(tags[0]);
                        }
                    }

                    if (passCarQueuer.Count > 0)
                    {
                        this.CurrentFlowFlag = eFlowFlag.验证车辆;
                    }

                    #endregion
                    break;

                case eFlowFlag.验证车辆:
                    #region

                    // 队列中无车时,等待车辆
                    if (passCarQueuer.Count == 0)
                    {
                        this.CurrentFlowFlag = eFlowFlag.等待车辆;
                        break;
                    }

                    this.CurrentImperfectCar = passCarQueuer.Dequeue();

                    // 方式一:根据识别的车牌号查找车辆信息
                    this.CurrentAutotruck = carTransportDAO.GetAutotruckByCarNumber(this.CurrentImperfectCar.Voucher);

                    if (this.CurrentAutotruck == null)
                    {
                        //// 方式二:根据识别的标签卡查找车辆信息
                        this.CurrentAutotruck = carTransportDAO.GetAutotruckByTagId(this.CurrentImperfectCar.Voucher);
                    }

                    if (this.CurrentAutotruck != null)
                    {
                        UpdateLedShow(this.CurrentAutotruck.CarNumber + "读卡成功");
                        this.voiceSpeaker.Speak(this.CurrentAutotruck.CarNumber + " 读卡成功", 1, false);

                        if (this.CurrentAutotruck.IsUse == 1)
                        {
                            if (this.CurrentAutotruck.CarriageLength > 0 && this.CurrentAutotruck.CarriageWidth > 0 && this.CurrentAutotruck.CarriageBottomToFloor > 0)
                            {
                                // 未完成运输记录
                                CmcsUnFinishTransport unFinishTransport = carTransportDAO.GetUnFinishTransportByAutotruckId(this.CurrentAutotruck.Id, eCarType.入厂煤.ToString());
                                if (unFinishTransport != null)
                                {
                                    this.CurrentBuyFuelTransport = carTransportDAO.GetBuyFuelTransportById(unFinishTransport.TransportId);
                                    if (this.CurrentBuyFuelTransport != null)
                                    {
                                        // 判断路线设置
                                        string nextPlace;
                                        if (carTransportDAO.CheckNextTruckInFactoryWay(this.CurrentAutotruck.CarType, this.CurrentBuyFuelTransport.StepName, "采样", CommonAppConfig.GetInstance().AppIdentifier, out nextPlace))
                                        {
                                            BackGateUp();

                                            btnSendSamplingPlan.Enabled = true;

                                            this.CurrentFlowFlag = eFlowFlag.发送计划;

                                            UpdateLedShow(this.CurrentAutotruck.CarNumber, "采样请下车");
                                            this.voiceSpeaker.Speak(this.CurrentAutotruck.CarNumber + " 采样请下车", 1, false);
                                        }
                                        else
                                        {
                                            UpdateLedShow("路线错误", "禁止通过");
                                            this.voiceSpeaker.Speak("路线错误 禁止通过 " + (!string.IsNullOrEmpty(nextPlace) ? "请前往" + nextPlace : ""), 1, false);

                                            timer1.Interval      = 8000;
                                            this.CurrentFlowFlag = eFlowFlag.异常重置;
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        commonDAO.SelfDber.Delete <CmcsUnFinishTransport>(unFinishTransport.Id);
                                    }
                                }
                                else
                                {
                                    this.UpdateLedShow(this.CurrentAutotruck.CarNumber, "未排队");
                                    this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 未找到排队记录", 1, false);

                                    timer1.Interval      = 8000;
                                    this.CurrentFlowFlag = eFlowFlag.异常重置;
                                    break;
                                }
                            }
                            else
                            {
                                this.UpdateLedShow(this.CurrentAutotruck.CarNumber, "车厢未测量");
                                this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 车厢未测量", 1, false);

                                timer1.Interval      = 8000;
                                this.CurrentFlowFlag = eFlowFlag.异常重置;
                                break;
                            }
                        }
                        else
                        {
                            UpdateLedShow(this.CurrentAutotruck.CarNumber, "已停用");
                            this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 已停用,禁止通过", 1, false);

                            timer1.Interval      = 8000;
                            this.CurrentFlowFlag = eFlowFlag.异常重置;
                            break;
                        }
                    }
                    else
                    {
                        UpdateLedShow(this.CurrentImperfectCar.Voucher, "未登记");

                        // 方式一:车号识别
                        this.voiceSpeaker.Speak("车牌号 " + this.CurrentImperfectCar.Voucher + " 未登记,禁止通过", 1, false);
                        //// 方式二:刷卡方式
                        //this.voiceSpeaker.Speak("卡号未登记,禁止通过", 1, false);

                        timer1.Interval      = 8000;
                        this.CurrentFlowFlag = eFlowFlag.异常重置;
                        break;
                    }

                    #endregion
                    break;

                case eFlowFlag.发送计划:
                    #region

                    if (this.SamplerSystemStatus == eEquInfSamplerSystemStatus.就绪待机)
                    {
                        CmcsRCSampling sampling = carTransportDAO.GetRCSamplingById(this.CurrentBuyFuelTransport.SamplingId);
                        if (sampling != null)
                        {
                            txtSampleCode.Text = sampling.SampleCode;

                            this.CurrentSampleCMD = new InfQCJXCYSampleCMD()
                            {
                                MachineCode      = this.SamplerMachineCode,
                                CarNumber        = this.CurrentBuyFuelTransport.CarNumber,
                                InFactoryBatchId = this.CurrentBuyFuelTransport.InFactoryBatchId,
                                SampleCode       = sampling.SampleCode,
                                Mt = 0,
                                // 根据预报
                                TicketWeight = 0,
                                // 根据预报
                                CarCount = 0,
                                // 采样点数根据相关逻辑计算
                                PointCount            = 3,
                                CarriageLength        = this.CurrentAutotruck.CarriageLength,
                                CarriageWidth         = this.CurrentAutotruck.CarriageWidth,
                                CarriageHeight        = this.CurrentAutotruck.CarriageHeight,
                                CarriageBottomToFloor = this.CurrentAutotruck.CarriageBottomToFloor,
                                Obstacle1             = this.CurrentAutotruck.LeftObstacle1,
                                Obstacle2             = this.CurrentAutotruck.LeftObstacle2,
                                Obstacle3             = this.CurrentAutotruck.LeftObstacle3,
                                Obstacle4             = this.CurrentAutotruck.LeftObstacle4,
                                Obstacle5             = this.CurrentAutotruck.LeftObstacle5,
                                Obstacle6             = this.CurrentAutotruck.LeftObstacle6,
                                ResultCode            = eEquInfCmdResultCode.默认.ToString(),
                                DataFlag = 0
                            };

                            // 发送采样计划
                            if (commonDAO.SelfDber.Insert <InfQCJXCYSampleCMD>(CurrentSampleCMD) > 0)
                            {
                                this.CurrentFlowFlag = eFlowFlag.等待采样;
                            }
                        }
                        else
                        {
                            this.UpdateLedShow("未找到采样单信息");
                            this.voiceSpeaker.Speak("未找到采样单信息,请联系管理员", 1, false);

                            timer1.Interval = 5000;
                        }
                    }
                    else
                    {
                        this.UpdateLedShow("采样机未就绪");
                        this.voiceSpeaker.Speak("采样机未就绪", 1, false);

                        timer1.Interval = 5000;
                    }

                    #endregion
                    break;

                case eFlowFlag.等待采样:
                    #region

                    // 判断采样是否完成
                    InfQCJXCYSampleCMD qCJXCYSampleCMD = commonDAO.SelfDber.Get <InfQCJXCYSampleCMD>(this.CurrentSampleCMD.Id);
                    if (qCJXCYSampleCMD.ResultCode == eEquInfCmdResultCode.成功.ToString())
                    {
                        if (jxSamplerDAO.SaveBuyFuelTransport(this.CurrentBuyFuelTransport.Id, DateTime.Now, CommonAppConfig.GetInstance().AppIdentifier))
                        {
                            FrontGateUp();

                            this.UpdateLedShow("采样完毕", " 请离开");
                            this.voiceSpeaker.Speak("采样完毕,请离开", 1, false);

                            this.CurrentFlowFlag = eFlowFlag.等待离开;
                        }
                    }

                    // 降低灵敏度
                    timer1.Interval = 4000;

                    #endregion
                    break;

                case eFlowFlag.等待离开:

                    BackGateUp();

                    // 采样区域及道闸 地感无信号
                    ResetBuyFuel();

                    // 降低灵敏度
                    timer1.Interval = 4000;

                    break;
                }

                //// 所有地感无信号时重置
                //if (this.AutoHandMode && !this.InductorCoil1 && !this.InductorCoil2 && !this.InductorCoil3 && !this.InductorCoil4 && this.CurrentFlowFlag != eFlowFlag.等待车辆
                //    && this.CurrentImperfectCar != null) ResetBuyFuel();

                RefreshEquStatus();
            }
            catch (Exception ex)
            {
                Log4Neter.Error("timer1_Tick", ex);
            }
            finally
            {
                timer1.Start();
            }

            timer1.Start();
        }
예제 #26
0
        /// <summary>
        /// 读卡、车号识别任务
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Stop();
            timer1.Interval = 2000;

            try
            {
                switch (this.CurrentFlowFlag)
                {
                case eFlowFlag.等待车辆:
                    #region

                    //if (this.InductorCoil1)
                    //{
                    //    // 当读卡区域地感有信号,触发读卡或者车号识别

                    //    List<string> tags = Hardwarer.Rwer1.ScanTags();
                    //    if (tags.Count > 0) passCarQueuer.Enqueue(tags[0]);
                    //}

                    //if (passCarQueuer.Count > 0) this.CurrentFlowFlag = eFlowFlag.验证车辆;

                    #endregion
                    break;

                case eFlowFlag.验证车辆:
                    #region

                    // 队列中无车时,等待车辆
                    if (passCarQueuer.Count == 0)
                    {
                        this.CurrentFlowFlag = eFlowFlag.等待车辆;
                        break;
                    }

                    this.CurrentImperfectCar = passCarQueuer.Dequeue();
                    panCurrentCarNumber.Text = this.CurrentImperfectCar.Voucher;

                    // 方式一:根据识别的车牌号查找车辆信息
                    this.CurrentAutotruck = carTransportDAO.GetAutotruckByCarNumber(this.CurrentImperfectCar.Voucher);

                    if (this.CurrentAutotruck != null)
                    {
                        UpdateLedShow(this.CurrentAutotruck.CarNumber + "读卡成功");
                        this.voiceSpeaker.Speak(this.CurrentAutotruck.CarNumber + " 读卡成功", 1, false);

                        if (this.CurrentAutotruck.IsUse == 1)
                        {
                            //if (this.CurrentAutotruck.CarriageLength > 0 && this.CurrentAutotruck.CarriageWidth > 0 && this.CurrentAutotruck.CarriageBottomToFloor > 0)
                            //{
                            // 未完成运输记录
                            CmcsUnFinishTransport unFinishTransport = carTransportDAO.GetUnFinishTransportByAutotruckId(this.CurrentAutotruck.Id, eCarType.入厂煤.ToString());
                            if (unFinishTransport != null)
                            {
                                this.CurrentBuyFuelTransport = carTransportDAO.GetBuyFuelTransportById(unFinishTransport.TransportId);
                                if (this.CurrentBuyFuelTransport != null)
                                {
                                    CmcsNoSampler noSampler = commonDAO.SelfDber.Entity <CmcsNoSampler>("where MineId=:MineId and StartTime<=:CreateDate and EndTime>=:CreateDate order by CreateDate desc", new { MineId = this.CurrentBuyFuelTransport.MineId, CreateDate = DateTime.Now });
                                    if (noSampler != null)
                                    {
                                        UpdateLedShow(this.CurrentAutotruck.CarNumber, "无需采样");
                                        this.voiceSpeaker.Speak(this.CurrentAutotruck.CarNumber + " 无需采样 直接离开", 1, false);
                                        this.CurrentFlowFlag = eFlowFlag.等待离开;
                                        break;
                                    }
                                    //if (this.CurrentBuyFuelTransport.InFactoryTime.Date < DateTime.Now.Date)
                                    //{
                                    this.CurrentBuyFuelTransport.InFactoryTime = DateTime.Now;
                                    carTransportDAO.GCQCInFactoryBatchByBuyFuelTransport(this.CurrentBuyFuelTransport);
                                    commonDAO.SelfDber.Update(this.CurrentBuyFuelTransport);
                                    //}
                                    // 判断路线设置
                                    string nextPlace;
                                    if (carTransportDAO.CheckNextTruckInFactoryWay(this.CurrentAutotruck.CarType, this.CurrentBuyFuelTransport.StepName, "采样", CommonAppConfig.GetInstance().AppIdentifier, out nextPlace))
                                    {
                                        btnSendSamplingPlan.Enabled = true;

                                        this.CurrentFlowFlag = eFlowFlag.发送计划;
                                        timer1.Interval      = 200;
                                        UpdateLedShow(this.CurrentAutotruck.CarNumber, "等待驶入");
                                        this.voiceSpeaker.Speak(this.CurrentAutotruck.CarNumber + " 等待驶入", 1, false);
                                    }
                                    else
                                    {
                                        UpdateLedShow("路线错误", "禁止通过");
                                        this.voiceSpeaker.Speak("路线错误 禁止通过 " + (!string.IsNullOrEmpty(nextPlace) ? "请前往" + nextPlace : ""), 1, false);

                                        timer1.Interval = 20000;
                                    }
                                }
                                else
                                {
                                    commonDAO.SelfDber.Delete <CmcsUnFinishTransport>(unFinishTransport.Id);
                                }
                            }
                            else
                            {
                                this.UpdateLedShow(this.CurrentAutotruck.CarNumber, "未排队");
                                this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 未找到排队记录", 1, false);
                                timer1.Interval = 20000;
                            }
                            //}
                            //else
                            //{
                            //	this.UpdateLedShow(this.CurrentAutotruck.CarNumber, "车厢未测量");
                            //	this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 车厢未测量", 1, false);

                            //	timer1.Interval = 20000;
                            //}
                        }
                        else
                        {
                            UpdateLedShow(this.CurrentAutotruck.CarNumber, "已停用");
                            this.voiceSpeaker.Speak("车牌号 " + this.CurrentAutotruck.CarNumber + " 已停用,禁止通过", 1, false);

                            timer1.Interval = 20000;
                        }
                    }
                    else
                    {
                        UpdateLedShow(this.CurrentImperfectCar.Voucher, "未登记");

                        // 方式一:车号识别
                        this.voiceSpeaker.Speak("车牌号 " + this.CurrentImperfectCar.Voucher + " 未登记,禁止通过", 1, false);

                        timer1.Interval = 20000;
                    }

                    #endregion
                    break;

                case eFlowFlag.发送计划:
                    #region

                    if (this.SamplerSystemStatus == eEquInfSamplerSystemStatus.就绪待机)
                    {
                        CmcsRCSampling sampling = carTransportDAO.GetRCSamplingById(this.CurrentBuyFuelTransport.SamplingId);
                        if (sampling != null)
                        {
                            txtSampleCode.Text = sampling.SampleCode;
                            if (this.CurrentAutotruck.CarriageLength == 0)
                            {
                                this.CurrentAutotruck.CarriageTotalLength   = 16000;
                                this.CurrentAutotruck.CarriageLength        = 13000;
                                this.CurrentAutotruck.CarriageWidth         = 2400;
                                this.CurrentAutotruck.CarriageHeight        = 1800;
                                this.CurrentAutotruck.CarriageBottomToFloor = 1500;
                            }

                            this.CurrentSampleCMD = new InfQCJXCYSampleCMD()
                            {
                                MachineCode      = this.SamplerMachineCode,
                                CarNumber        = this.CurrentBuyFuelTransport.CarNumber,
                                InFactoryBatchId = this.CurrentBuyFuelTransport.InFactoryBatchId,
                                SampleCode       = sampling.SampleCode,
                                Mt = 0,
                                // 根据预报
                                TicketWeight = 0,
                                // 根据预报
                                CarCount = 0,
                                // 采样点数根据相关逻辑计算
                                PointCount            = Convert.ToInt32(dbtxtSampleCount.Value),
                                CarriageTotalLength   = this.CurrentAutotruck.CarriageTotalLength,
                                CarriageLength        = this.CurrentAutotruck.CarriageLength,
                                CarriageWidth         = this.CurrentAutotruck.CarriageWidth,
                                CarriageHeight        = this.CurrentAutotruck.CarriageHeight,
                                CarriageBottomToFloor = this.CurrentAutotruck.CarriageBottomToFloor,
                                Obstacle1             = this.CurrentAutotruck.LeftObstacle1.ToString(),
                                Obstacle2             = this.CurrentAutotruck.LeftObstacle2.ToString(),
                                Obstacle3             = this.CurrentAutotruck.LeftObstacle3.ToString(),
                                Obstacle4             = this.CurrentAutotruck.LeftObstacle4.ToString(),
                                Obstacle5             = this.CurrentAutotruck.LeftObstacle5.ToString(),
                                Obstacle6             = this.CurrentAutotruck.LeftObstacle6.ToString(),
                                ResultCode            = eEquInfCmdResultCode.默认.ToString(),
                                DataFlag = 0
                            };

                            // 发送采样计划
                            if (commonDAO.SelfDber.Insert <InfQCJXCYSampleCMD>(CurrentSampleCMD) > 0)
                            {
                                this.CurrentFlowFlag = eFlowFlag.等待采样;
                                this.UpdateLedShow("等待采样");
                                this.voiceSpeaker.Speak("等待采样", 1, false);
                            }
                        }
                        else
                        {
                            this.UpdateLedShow("未找到采样单信息");
                            this.voiceSpeaker.Speak("未找到采样单信息,请联系管理员", 1, false);

                            timer1.Interval = 5000;
                        }
                    }
                    else
                    {
                        this.UpdateLedShow("采样机未就绪");
                        this.voiceSpeaker.Speak("采样机未就绪", 1, false);

                        timer1.Interval = 5000;
                    }

                    #endregion
                    break;

                case eFlowFlag.等待采样:
                    #region

                    // 判断采样是否完成
                    InfQCJXCYSampleCMD qCJXCYSampleCMD = commonDAO.SelfDber.Get <InfQCJXCYSampleCMD>(this.CurrentSampleCMD.Id);
                    if (qCJXCYSampleCMD.ResultCode == eEquInfCmdResultCode.成功.ToString())
                    {
                        if (jxSamplerDAO.SaveBuyFuelTransport(this.CurrentBuyFuelTransport.Id, DateTime.Now, CommonAppConfig.GetInstance().AppIdentifier))
                        {
                            this.UpdateLedShow("采样完毕", " 请离开");
                            this.voiceSpeaker.Speak("采样完毕,请离开", 1, false);

                            this.CurrentFlowFlag = eFlowFlag.等待离开;
                        }
                    }

                    // 降低灵敏度
                    timer1.Interval = 4000;

                    #endregion
                    break;

                case eFlowFlag.等待离开:

                    ResetBuyFuel();

                    // 降低灵敏度
                    timer1.Interval = 4000;

                    break;
                }

                RefreshEquStatus();
            }
            catch (Exception ex)
            {
                Log4Neter.Error("timer1_Tick", ex);
            }
            finally
            {
                timer1.Start();
            }

            timer1.Start();
        }
예제 #27
0
        /// <summary>
        /// 同步翻车衡过衡数据
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public int SyncLwCarsInfo(Action <string, eOutputType> output)
        {
            int res = 0;

            IList <CarInfoMutual> carInfos = DcDbers.GetInstance().TurnCarWeighterMutualDber.Entities <CarInfoMutual>(" where DataFlag=1 and SuttleWeight>0 and CreateDate>=to_date('" + DateTime.Now.Date.AddDays(-2) + "','yyyy/mm/dd HH24:MI:SS')");

            foreach (var item in carInfos)
            {
                //同步到批次明细
                CmcsTransport transport = Dbers.GetInstance().SelfDber.Entity <CmcsTransport>(" where TransportNo=:TransportNo and InfactoryTime>=:InfactoryTime ", new { TransportNo = item.CarNumber, InfactoryTime = DateTime.Now.Date.AddDays(-2) });
                if (transport != null && !string.IsNullOrEmpty(transport.InFactoryBatchId))
                {
                    if (item.GrossWeight != 0 && transport.GrossQty == 0)
                    {
                        transport.GrossQty = (decimal)item.GrossWeight;
                    }

                    if (item.TareWeight != 0 && transport.SkinQty == 0)
                    {
                        transport.SkinQty = (decimal)item.TareWeight;
                    }

                    if (item.SuttleWeight != 0 && transport.SuttleQty == 0)
                    {
                        transport.SuttleQty = (decimal)item.SuttleWeight;
                        transport.MarginQty = (decimal)(item.SuttleWeight - item.TicketWeight);
                    }
                    transport.MeasureMan = "自动";
                    transport.IsDeleted  = item.CancelSign;
                    transport.ArriveDate = item.WeightDate;
                    transport.TareDate   = item.WeightDate.AddMinutes(3).AddSeconds(1.2);
                    transport.TrackCode  = item.TurnCarNumber == "#1" ? "#4" : "#2";
                    if (item.TurnCarNumber == "#1")
                    {
                        CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_TrunOver_1, eSignalDataName.当前车号.ToString(), string.Empty);
                    }
                    else
                    {
                        CommonDAO.GetInstance().SetSignalDataValue(GlobalVars.MachineCode_TrunOver_2, eSignalDataName.当前车号.ToString(), string.Empty);
                    }

                    res += Dbers.GetInstance().SelfDber.Update(transport);

                    //同步到轨道衡数据表
                    CmcsTrainWeightRecord trainRecord = Dbers.GetInstance().SelfDber.Entity <CmcsTrainWeightRecord>("where TrainNumber=:TrainNumber and ArriveTime>=:ArriveTime", new { TrainNumber = item.CarNumber, ArriveTime = DateTime.Now.Date.AddDays(-2) });
                    CmcsRCSampling        sampling    = Dbers.GetInstance().SelfDber.Entity <CmcsRCSampling>("where InFactoryBatchId=:InFactoryBatchId order by SamplingDate", new { InFactoryBatchId = transport.InFactoryBatchId });
                    if (trainRecord != null)
                    {
                        trainRecord.TrainTipperMachineCode = item.TurnCarNumber;
                        trainRecord.FuelKind     = transport.TheBatch.FuelKindName;
                        trainRecord.MineName     = sampling != null ? sampling.SampleCode : "";
                        trainRecord.SupplierName = "";
                        trainRecord.StationName  = transport.TheBatch.TheStation.Name;

                        trainRecord.SerialNumber           = item.RecordId;
                        trainRecord.TicketWeight           = (decimal)item.TicketWeight;
                        trainRecord.GrossTime              = item.WeightDate;
                        trainRecord.GrossWeight            = (decimal)item.GrossWeight;
                        trainRecord.SkinTime               = item.WeightDate.AddMinutes(3).AddSeconds(1.2);
                        trainRecord.SkinWeight             = (decimal)item.TareWeight;
                        trainRecord.StandardWeight         = (decimal)item.SuttleWeight;
                        trainRecord.MarginWeight           = trainRecord.StandardWeight - trainRecord.TicketWeight - trainRecord.DeductWeight;
                        trainRecord.MesureMan              = "自动";
                        trainRecord.TrainTipperMachineCode = item.TurnCarNumber;
                        trainRecord.MachineCode            = item.TurnCarNumber == "#1" ? "#4" : "#2";
                        trainRecord.IsTurnover             = "已翻";
                        trainRecord.UnloadTime             = item.WeightDate;

                        Dbers.GetInstance().SelfDber.Update(trainRecord);
                    }
                }

                item.DataFlag = 2;
                DcDbers.GetInstance().TurnCarWeighterMutualDber.Update(item);
            }
            output(string.Format("同步翻车衡数据 {0} 条(第三方 > 集中管控)", res), eOutputType.Normal);
            return(res);
        }