示例#1
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);
            }
        }
示例#2
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);
            }
        }