コード例 #1
0
 /// <summary>
 /// 获取皮带采样机系统状态
 /// </summary>
 /// <param name="machineCode">设备编码</param>
 /// <returns></returns>
 public string GetBeltSamplerSystemStatue(string machineCode)
 {
     return(CommonDAO.GetInstance().GetSignalDataValue(machineCode, eSignalDataName.系统.ToString()));
 }
コード例 #2
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);
        }