Exemplo n.º 1
0
 public void UpdBusinessAndDetailsInUnitOfWork(BusinessDispose oldBusinessDispose, List <BusinessDisposeDetail> theBusDisList)
 {
     foreach (BusinessDisposeDetail bdd in oldBusinessDispose.BusinessDisposeDetails)
     {
         _unitOfWork.AddAction(bdd, DataActions.Delete);
     }
     foreach (BusinessDisposeDetail bdd in theBusDisList)
     {
         bdd.business_dispose_number = oldBusinessDispose.business_dispose_number;
         _unitOfWork.AddAction(bdd, DataActions.Add);
     }
     _unitOfWork.Save();
 }
Exemplo n.º 2
0
        private void ShowMessageInfo(IRFIDTagIssueService myservice, string cardID)
        {
            //读取卡信息,如果读取不到就退回
            Enrolment     tempEnrolment = myservice.FindRunnigRFIDTagIssueByCode(cardID);
            PlanTaskBatch ptb           = tempEnrolment.PlanTasks.Last().PlanTaskBatches.Last();

            //读取到卡信息,加载卡信息
            if (tempEnrolment != null)
            {
                //清理信息
                ClearAll();
                //卡编号
                if (tempEnrolment.RFIDTagIssues.Count > 0)
                {
                    lblCardNumber.Text = tempEnrolment.RFIDTagIssues.Last().RFIDTag.tag_number;
                }
                //货主
                if (tempEnrolment.owner_name != null && tempEnrolment.owner_name != string.Empty)
                {
                    lblOwnerName.Text = tempEnrolment.owner_name;
                }
                else if (tempEnrolment.carrier_name != null && tempEnrolment.carrier_name != string.Empty)
                {
                    lblOwnerName.Text = tempEnrolment.carrier_name;
                }
                //车船号
                lblCarNumber.Text = tempEnrolment.plate_number;
                //产地
                lblChanDi.Text = tempEnrolment.districtName;
                //品种
                lblGoodsKind.Text = tempEnrolment.goodsKindName;
                //客户
                lblKeHu.Text = tempEnrolment.customerName;
                //计划编号

                if (ptb != null)
                {
                    lblPlantaskNumber.Text = ptb.plantask_number;
                    //批次编号
                    lblPTBatchNumber.Text = ptb.plantask_batch_number;
                }
                //assay
                CardInfoAssay NewCardInfoAssay = new CardInfoAssay();
                if (ptb.Samples != null && ptb.Samples.Count > 0)
                {
                    Assay tempAssay = ptb.Samples.First().Assays.First();
                    NewCardInfoAssay.AssayNumber = tempAssay.assay_number;
                    IList <AssayResult> theAssayResultList = tempAssay.AssayBills.First().AssayResults.ToList();
                    foreach (AssayResult tempAR in theAssayResultList)
                    {
                        if (tempAR.GrainQualityIndex.name.Contains("水"))
                        {
                            NewCardInfoAssay.ShuiFen = tempAR.assay_result_value;
                        }
                        if (tempAR.GrainQualityIndex.name.Contains("杂质"))
                        {
                            NewCardInfoAssay.ZaZhi = tempAR.assay_result_value;
                        }
                        if (tempAR.GrainQualityIndex.name.Contains("容重"))
                        {
                            NewCardInfoAssay.RongZhong = tempAR.assay_result_value;
                        }
                        if (tempAR.GrainQualityIndex.name.Contains("不完善"))
                        {
                            NewCardInfoAssay.BuWanShanLi = tempAR.assay_result_value;
                        }
                        if (tempAR.GrainQualityIndex.name.Contains("出糙"))
                        {
                            NewCardInfoAssay.ChuCaolv = tempAR.assay_result_value;
                        }
                        if (tempAR.GrainQualityIndex.name.Contains("整精米"))
                        {
                            NewCardInfoAssay.ZhengJingMiLi = tempAR.assay_result_value;
                        }
                    }
                }

                //PLAN
                CardInfoPlan NewCardInfoPlan = new CardInfoPlan();
                decimal      JingZhong       = 0;
                NewCardInfoPlan.BangDian = ptb.PlanTaskBatchSiteScales.FirstOrDefault() == null ? "无" : ptb.PlanTaskBatchSiteScales.FirstOrDefault().SiteScale.scale_name;
                if (ptb.gross_weight.HasValue)
                {
                    NewCardInfoPlan.GrossWeight = ptb.gross_weight.Value.ToString("#");
                }
                else
                {
                    NewCardInfoPlan.GrossWeight = string.Empty;
                }
                if (ptb.tare_weight.HasValue)
                {
                    NewCardInfoPlan.TareWeight = ptb.tare_weight.Value.ToString("#");
                }
                else
                {
                    NewCardInfoPlan.TareWeight = string.Empty;
                }
                if (ptb.batch_count.HasValue)
                {
                    JingZhong = ptb.batch_count.Value;
                }
                decimal kouLiang = 0;
                if (ptb.BusinessDisposes != null && ptb.BusinessDisposes.Count > 0)
                {
                    BusinessDispose tempBusinessDispose = ptb.BusinessDisposes.FirstOrDefault();
                    if (tempBusinessDispose.BusinessDisposeDetails != null && tempBusinessDispose.BusinessDisposeDetails.Count > 0)
                    {
                        kouLiang = tempBusinessDispose.BusinessDisposeDetails.Sum(bdd => bdd.dispose_count) * JingZhong;
                        NewCardInfoPlan.KouLiang = kouLiang.ToString("0.00");
                    }
                }
                NewCardInfoPlan.JieSuanShuLiang = (JingZhong - kouLiang).ToString("0.00");
                List <CardInfoAssay> assayList = new List <CardInfoAssay>();
                assayList.Add(NewCardInfoAssay);
                dgvAssay.DataSource = assayList;
                List <CardInfoPlan> planList = new List <CardInfoPlan>();
                planList.Add(NewCardInfoPlan);
                dgvPlan.DataSource = planList;
            }
        }