/// <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); }
/// <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); }