Exemple #1
0
 public void AddInspectOrderDetail(InspectOrderDetail inspectOrderDetail)
 {
     if (this.InspectOrderDetails == null)
     {
         this.InspectOrderDetails = new List <InspectOrderDetail>();
     }
     this.InspectOrderDetails.Add(inspectOrderDetail);
 }
 public void AddInspectOrderDetail(InspectOrderDetail inspectOrderDetail)
 {
     if (this.InspectOrderDetails == null)
     {
         this.InspectOrderDetails = new List<InspectOrderDetail>();
     }
     this.InspectOrderDetails.Add(inspectOrderDetail);
 }
        public IList<InspectOrderDetail> ConvertTransformerToInspectDetail(IList<Transformer> transformerList, bool includeZero)
        {
            IList<InspectOrderDetail> inspectDetailList = new List<InspectOrderDetail>();
            InspectOrderDetail inspectDetail = new InspectOrderDetail();
            if (transformerList != null && transformerList.Count > 0)
            {
                foreach (Transformer transformer in transformerList)
                {
                    if (transformer.TransformerDetails != null && transformer.TransformerDetails.Count > 0)
                    {
                        foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                        {
                            InspectOrderDetail inspectOrderDetail = this.LoadInspectOrderDetail(transformerDetail.Id);

                            inspectOrderDetail.CurrentQualifiedQty = transformerDetail.CurrentQty;
                            inspectOrderDetail.CurrentRejectedQty = transformerDetail.CurrentRejectQty;

                            if (inspectOrderDetail.CurrentQualifiedQty != 0 || inspectOrderDetail.CurrentRejectedQty != 0 || includeZero)
                            {
                                inspectDetailList.Add(inspectOrderDetail);
                            }
                        }
                    }
                    else
                    {
                        InspectOrderDetail inspectOrderDetail = this.LoadInspectOrderDetail(transformer.Id);

                        inspectOrderDetail.CurrentQualifiedQty = transformer.CurrentQty;
                        inspectOrderDetail.CurrentRejectedQty = transformer.CurrentRejectQty;

                        if (inspectOrderDetail.CurrentQualifiedQty != 0 || inspectOrderDetail.CurrentRejectedQty != 0 || includeZero)
                        {
                            inspectDetailList.Add(inspectOrderDetail);
                        }
                    }
                }
            }

            return inspectDetailList;
        }
        protected override bool FillValuesImpl(String templateFileName, IList<object> list)
        {
            try
            {

                InspectOrder inspectOrder = (InspectOrder)list[0];

                if (inspectOrder == null)
                {
                    return false;
                }
                IList<InspectOrderDetail> inspectOrderDetailsTemp = null;
                if (list.Count == 2)
                {
                    inspectOrderDetailsTemp = (IList<InspectOrderDetail>)list[1];
                }
                else
                {
                    inspectOrderDetailsTemp = inspectOrder.InspectOrderDetails;
                }

                if (inspectOrderDetailsTemp == null || inspectOrderDetailsTemp.Count == 0)
                {
                    return false;
                }

                IList<InspectOrderDetail> inspectOrderDetails = new List<InspectOrderDetail>();
                for (int i = 0; i < inspectOrderDetailsTemp.Count; i++)
                {
                    InspectOrderDetail inspectOrderDetail = new InspectOrderDetail();
                    CloneHelper.CopyProperty(inspectOrderDetailsTemp[i], inspectOrderDetail);
                    if (i == 0)
                    {
                        inspectOrderDetails.Add(inspectOrderDetail);
                    }
                    else
                    {
                        InspectOrderDetail inspectOrderDetailPrev = inspectOrderDetails[inspectOrderDetails.Count - 1];
                        if (inspectOrderDetail.LocationLotDetail.Item.Code == inspectOrderDetailPrev.LocationLotDetail.Item.Code
                            && inspectOrderDetail.LocationFrom.Code == inspectOrderDetailPrev.LocationFrom.Code
                            && inspectOrderDetail.LocationTo.Code == inspectOrderDetailPrev.LocationTo.Code
                            && (
                                (
                                   inspectOrderDetail.LocationLotDetail.Hu != null
                                && inspectOrderDetail.LocationLotDetail.Hu.Uom.Code == inspectOrderDetailPrev.LocationLotDetail.Hu.Uom.Code
                                && inspectOrderDetail.LocationLotDetail.Hu.UnitCount == inspectOrderDetailPrev.LocationLotDetail.Hu.UnitCount)
                                ||
                                (
                                 inspectOrderDetail.LocationLotDetail.Hu == null
                                && inspectOrderDetail.LocationLotDetail.Item.Uom.Code == inspectOrderDetailPrev.LocationLotDetail.Item.Uom.Code
                                && inspectOrderDetail.LocationLotDetail.Item.UnitCount == inspectOrderDetailPrev.LocationLotDetail.Item.UnitCount
                                )
                                )
                        )
                        {
                            //待检数
                            if (inspectOrderDetailPrev.InspectQty != null)
                            {
                                inspectOrderDetailPrev.InspectQty += inspectOrderDetail.InspectQty;
                            }
                            //合格数
                            if (inspectOrderDetailPrev.QualifiedQty != null)
                            {
                                inspectOrderDetailPrev.QualifiedQty += inspectOrderDetail.QualifiedQty;
                            }
                            //不合格数
                            if (inspectOrderDetailPrev.RejectedQty != null)
                            {
                                inspectOrderDetailPrev.RejectedQty += inspectOrderDetail.RejectedQty;
                            }
                        }
                        else
                        {
                            inspectOrderDetails.Add(inspectOrderDetail);
                        }
                    }
                }

                this.barCodeFontName = this.GetBarcodeFontName(2, 6);
                //this.SetRowCellBarCode(0, 2, 6);

                this.CopyPage(inspectOrderDetails.Count);

                this.FillHead(inspectOrder);

                int pageIndex = 1;
                int rowIndex = 0;
                int rowTotal = 0;
                foreach (InspectOrderDetail inspectOrderDetail in inspectOrderDetails)
                {

                    //物料号
                    this.SetRowCell(pageIndex, rowIndex, 0, inspectOrderDetail.LocationLotDetail.Item.Code);
                    //物料描述
                    this.SetRowCell(pageIndex, rowIndex, 1, inspectOrderDetail.LocationLotDetail.Item.Description);
                    //"单位Unit"
                    this.SetRowCell(pageIndex, rowIndex, 2, inspectOrderDetail.LocationLotDetail.Item.Uom.Code);
                    //"单包装UC"
                    this.SetRowCell(pageIndex, rowIndex, 3, inspectOrderDetail.LocationLotDetail.Item.UnitCount.ToString("0.########"));
                    //来源库位
                    this.SetRowCell(pageIndex, rowIndex, 4, inspectOrderDetail.LocationFrom.Code);
                    //目的库位
                    this.SetRowCell(pageIndex, rowIndex, 5, inspectOrderDetail.LocationTo.Code);
                    //待检数
                    this.SetRowCell(pageIndex, rowIndex, 6, inspectOrderDetail.InspectQty == null ? string.Empty : inspectOrderDetail.InspectQty.ToString("0.########"));
                    //合格数
                    this.SetRowCell(pageIndex, rowIndex, 7, inspectOrderDetail.QualifiedQty == null ? string.Empty : inspectOrderDetail.QualifiedQty.Value.ToString("0.########"));
                    //不合格数
                    this.SetRowCell(pageIndex, rowIndex, 8, inspectOrderDetail.RejectedQty == null ? string.Empty : inspectOrderDetail.RejectedQty.Value.ToString("0.########"));

                    if (this.isPageBottom(rowIndex, rowTotal))//页的最后一行
                    {
                        pageIndex++;
                        rowIndex = 0;
                    }
                    else
                    {
                        rowIndex++;
                    }
                    rowTotal++;
                }

                this.sheet.DisplayGridlines = false;
                this.sheet.IsPrintGridlines = false;

                if (inspectOrder.IsPrinted == null || inspectOrder.IsPrinted == false)
                {
                    inspectOrder.IsPrinted = true;
                    inspectOrderMgr.UpdateInspectOrder(inspectOrder);
                }

            }
            catch (Exception)
            {
                return false;
            }
            return true;
        }
 public static TransformerDetail ConvertInspectDetailToTransformerDetail(InspectOrderDetail inspectDetail)
 {
     TransformerDetail transformerDetail = new TransformerDetail();
     transformerDetail.Id = inspectDetail.Id;
     transformerDetail.ItemCode = inspectDetail.LocationLotDetail.Item.Code;
     transformerDetail.ItemDescription = inspectDetail.LocationLotDetail.Item.Description;
     if (inspectDetail.LocationLotDetail.Hu != null)
     {
         transformerDetail.UomCode = inspectDetail.LocationLotDetail.Hu.Uom.Code;
         transformerDetail.UnitCount = inspectDetail.LocationLotDetail.Hu.UnitCount;
         transformerDetail.Qty = inspectDetail.InspectedQty / inspectDetail.LocationLotDetail.Hu.UnitQty;
     }
     else
     {
         transformerDetail.UomCode = inspectDetail.LocationLotDetail.Item.Uom.Code;
         transformerDetail.UnitCount = inspectDetail.LocationLotDetail.Item.UnitCount;
         transformerDetail.Qty = inspectDetail.InspectedQty;
     }
     transformerDetail.HuId = inspectDetail.LocationLotDetail.Hu == null ? null : inspectDetail.LocationLotDetail.Hu.HuId;
     transformerDetail.LotNo = inspectDetail.LocationLotDetail.LotNo;
     transformerDetail.CurrentQty = 0;
     return transformerDetail;
 }
 public virtual void DeleteInspectOrderDetail(InspectOrderDetail entity)
 {
     Delete(entity);
 }
 public virtual void UpdateInspectOrderDetail(InspectOrderDetail entity)
 {
     Update(entity);
 }
 public virtual void CreateInspectOrderDetail(InspectOrderDetail entity)
 {
     Create(entity);
 }