Ejemplo n.º 1
0
        public IList <InspectOrderDetail> ConvertResolverToInspectOrderDetails(Resolver resolver)
        {
            IList <InspectOrderDetail> inspectDetailList = new List <InspectOrderDetail>();

            if (resolver != null && resolver.Transformers != null)
            {
                foreach (Transformer transformer in resolver.Transformers)
                {
                    if (transformer.TransformerDetails != null)
                    {
                        foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                        {
                            InspectOrderDetail inspectDetail = inspectOrderDetailMgr.LoadInspectOrderDetail(transformerDetail.Id);
                            inspectDetail.CurrentQualifiedQty = transformerDetail.CurrentQty;
                            inspectDetail.CurrentRejectedQty  = transformerDetail.CurrentRejectQty;
                            if (inspectDetail.CurrentQualifiedQty != 0 || inspectDetail.CurrentRejectedQty != 0)
                            {
                                inspectDetailList.Add(inspectDetail);
                            }
                        }
                    }
                }
            }
            return(inspectDetailList);
        }
Ejemplo n.º 2
0
        protected override void SetDetail(Resolver resolver)
        {
            InspectOrderDetail inspectOrderDetail = inspectOrderDetailMgr.CheckAndGetInspectOrderDetail(resolver.Input);
            TransformerDetail  transformerDetail  = TransformerHelper.ConvertInspectDetailToTransformerDetail(inspectOrderDetail);

            resolver.AddTransformerDetail(transformerDetail);
            resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
        }
Ejemplo n.º 3
0
 protected void GV_List_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         InspectOrderDetail inspectOrderDetail = (InspectOrderDetail)e.Row.DataItem;
         //if (inspectOrderDetail.LocationLotDetail.Hu != null)
         //{
         ((TextBox)e.Row.FindControl("tbCurrentQualifiedQty")).ReadOnly = true;
         ((TextBox)e.Row.FindControl("tbCurrentRejectedQty")).ReadOnly  = true;
         ((TextBox)e.Row.FindControl("tbCurrentQualifiedQty")).Text     = inspectOrderDetail.PendingQualifiedQty.ToString("F2");
         ((TextBox)e.Row.FindControl("tbCurrentRejectedQty")).Text      = inspectOrderDetail.PendingRejectedQty.ToString("F2");
         //}
     }
 }
Ejemplo n.º 4
0
    public IList <InspectOrderDetail> PopulateInspectOrderDetailList()
    {
        IList <InspectOrderDetail> inspectOrderDetailList = new List <InspectOrderDetail>();

        for (int i = 0; i < this.GV_List.Rows.Count; i++)
        {
            GridViewRow row = this.GV_List.Rows[i];


            HiddenField        hfId = (HiddenField)row.FindControl("hfId");
            InspectOrderDetail inspectOrderDetail = TheInspectOrderDetailMgr.LoadInspectOrderDetail(int.Parse(hfId.Value));
            //if (inspectOrderDetail.LocationLotDetail.Hu == null)
            //{

            //    TextBox tbCurrentQualifiedQty = (TextBox)row.FindControl("tbCurrentQualifiedQty");
            //    decimal currentQualifiedQty = 0;
            //    if (tbCurrentQualifiedQty.Text.Trim() != string.Empty)
            //    {
            //        currentQualifiedQty = decimal.Parse(tbCurrentQualifiedQty.Text.Trim());
            //    }

            //    TextBox tbCurrentRejectedQty = (TextBox)row.FindControl("tbCurrentRejectedQty");
            //    decimal currentRejectedQty = 0;
            //    if (tbCurrentRejectedQty.Text.Trim() != string.Empty)
            //    {
            //        currentRejectedQty = decimal.Parse(tbCurrentRejectedQty.Text.Trim());
            //    }
            //    if (currentQualifiedQty != 0 || currentRejectedQty != 0)
            //    {
            //        inspectOrderDetail.CurrentQualifiedQty = currentQualifiedQty;
            //        inspectOrderDetail.CurrentRejectedQty = currentRejectedQty;
            //        inspectOrderDetailList.Add(inspectOrderDetail);
            //    }
            //}
            //else
            //{
            CheckBox checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox;
            if (checkBoxGroup.Checked)
            {
                inspectOrderDetail.CurrentQualifiedQty = inspectOrderDetail.PendingQualifiedQty;
                inspectOrderDetail.CurrentRejectedQty  = inspectOrderDetail.PendingRejectedQty;
                inspectOrderDetailList.Add(inspectOrderDetail);
            }
            //}
        }

        return(inspectOrderDetailList);
    }
        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 void GV_List_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            InspectOrderDetail inspectOrderDetail = (InspectOrderDetail)e.Row.DataItem;

            decimal qualifiedQty = inspectOrderDetail.QualifiedQty.HasValue ? (decimal)inspectOrderDetail.QualifiedQty : 0;
            decimal rejectedQty  = inspectOrderDetail.RejectedQty.HasValue ? (decimal)inspectOrderDetail.RejectedQty : 0;
            if (inspectOrderDetail.InspectQty > qualifiedQty + rejectedQty + inspectOrderDetail.PendingQualifiedQty + inspectOrderDetail.PendingRejectedQty)
            {
                ((TextBox)e.Row.FindControl("tbCurrentQualifiedQty")).ReadOnly = false;
                ((TextBox)e.Row.FindControl("tbCurrentRejectedQty")).ReadOnly  = false;

                ((com.Sconit.Control.CodeMstrLabel)e.Row.FindControl("lblDisposition")).Visible = false;
            }
            else
            {
                //((CheckBox)e.Row.FindControl("CheckBoxGroup")).Visible = false;

                ((com.Sconit.Control.CodeMstrDropDownList)e.Row.FindControl("ddlDisposition")).Visible = false;
            }
        }
    }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 public virtual void CreateInspectOrderDetail(InspectOrderDetail entity)
 {
     entityDao.CreateInspectOrderDetail(entity);
 }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        public void ProcessInspectOrder(IList <InspectOrderDetail> inspectOrderDetailList, User user)
        {
            #region 过滤检验数量为0的检验明细
            IList <InspectOrderDetail> noneZeroInspectOrderDetailList = new List <InspectOrderDetail>();

            if (inspectOrderDetailList != null && inspectOrderDetailList.Count > 0)
            {
                foreach (InspectOrderDetail inspectOrderDetail in inspectOrderDetailList)
                {
                    if (inspectOrderDetail.CurrentQualifiedQty > 0 || inspectOrderDetail.CurrentRejectedQty > 0)
                    {
                        noneZeroInspectOrderDetailList.Add(inspectOrderDetail);
                    }
                }
            }

            if (noneZeroInspectOrderDetailList.Count == 0)
            {
                throw new BusinessErrorException("Order.Error.Inspection.DetailEmpty");
            }
            #endregion

            #region 循环检验单明细
            IDictionary <string, InspectOrder> cachedInspectOrderDic = new Dictionary <string, InspectOrder>();
            //string inrNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION_RESULT);  //检验结果单号
            foreach (InspectOrderDetail inspectOrderDetail in noneZeroInspectOrderDetailList)
            {
                #region 缓存检验单头
                InspectOrder inspectOrder = inspectOrderDetail.InspectOrder;
                if (!cachedInspectOrderDic.ContainsKey(inspectOrder.InspectNo))
                {
                    cachedInspectOrderDic.Add(inspectOrder.InspectNo, inspectOrder);
                }
                #endregion

                #region 检验数量
                InspectOrderDetail oldInspectOrderDetail = this.inspectOrderDetailMgr.LoadInspectOrderDetail(inspectOrderDetail.Id);
                //oldInspectOrderDetail.Disposition = inspectOrderDetail.Disposition;
                oldInspectOrderDetail.CurrentQualifiedQty = inspectOrderDetail.CurrentQualifiedQty;
                oldInspectOrderDetail.CurrentRejectedQty  = inspectOrderDetail.CurrentRejectedQty;

                if (oldInspectOrderDetail.LocationLotDetail.Hu != null)
                {
                    if (oldInspectOrderDetail.PendingQualifiedQty != inspectOrderDetail.CurrentQualifiedQty &&
                        oldInspectOrderDetail.PendingRejectedQty != inspectOrderDetail.CurrentRejectedQty)
                    {
                        //有条码的只能检验一次
                        throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.HuInspectQtyNotMatch", oldInspectOrderDetail.LocationLotDetail.Hu.HuId);
                    }
                }
                else
                {
                    if (oldInspectOrderDetail.PendingQualifiedQty < inspectOrderDetail.CurrentQualifiedQty)
                    {
                        throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.QualifyQtyExcceed", oldInspectOrderDetail.LocationLotDetail.Item.Code);
                    }
                    if (oldInspectOrderDetail.PendingRejectedQty < inspectOrderDetail.CurrentRejectedQty)
                    {
                        throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.RejectQtyExcceed", oldInspectOrderDetail.LocationLotDetail.Item.Code);
                    }
                }
                #endregion

                #region 合格品
                if (oldInspectOrderDetail.CurrentQualifiedQty > 0)
                {
                    oldInspectOrderDetail.LocationLotDetail.CurrentInspectQty = oldInspectOrderDetail.CurrentQualifiedQty;

                    //出待验库位
                    this.locationMgr.InspectOut(oldInspectOrderDetail.LocationLotDetail, user, true, inspectOrder.InspectNo, oldInspectOrderDetail.LocationTo);

                    //入合格品库位
                    this.locationMgr.InspectIn(oldInspectOrderDetail.LocationLotDetail, oldInspectOrderDetail.LocationTo, oldInspectOrderDetail.CurrentStorageBin, user, true, inspectOrder.InspectNo, null, inspectOrderDetail.Id);

                    //更新合格品数量
                    if (!oldInspectOrderDetail.QualifiedQty.HasValue)
                    {
                        oldInspectOrderDetail.QualifiedQty = 0;
                    }
                    oldInspectOrderDetail.QualifiedQty        += oldInspectOrderDetail.CurrentQualifiedQty;
                    oldInspectOrderDetail.PendingQualifiedQty -= oldInspectOrderDetail.CurrentQualifiedQty;
                }
                #endregion

                #region  合格品
                if (oldInspectOrderDetail.CurrentRejectedQty > 0)
                {
                    oldInspectOrderDetail.LocationLotDetail.CurrentInspectQty = oldInspectOrderDetail.CurrentRejectedQty;

                    //出待验库位
                    this.locationMgr.InspectOut(oldInspectOrderDetail.LocationLotDetail, user, false, inspectOrder.InspectNo, this.locationMgr.GetRejectLocation());

                    //入不合格品库位
                    this.locationMgr.InspectIn(oldInspectOrderDetail.LocationLotDetail, this.locationMgr.GetRejectLocation(), user, false, inspectOrder.InspectNo, null, inspectOrderDetail.Id);

                    //更新不合格品数量
                    if (!oldInspectOrderDetail.RejectedQty.HasValue)
                    {
                        oldInspectOrderDetail.RejectedQty = 0;
                    }
                    oldInspectOrderDetail.RejectedQty        += oldInspectOrderDetail.CurrentRejectedQty;
                    oldInspectOrderDetail.PendingRejectedQty -= oldInspectOrderDetail.CurrentRejectedQty;
                }
                #endregion

                #region 更新检验单明细
                this.inspectOrderDetailMgr.UpdateInspectOrderDetail(oldInspectOrderDetail);
                #endregion
            }
            #endregion

            #region 更新检验单
            DateTime dataTimeNow = DateTime.Now;
            foreach (InspectOrder oldInspectOrder in cachedInspectOrderDic.Values)
            {
                InspectOrder inspectOrder = this.LoadInspectOrder(oldInspectOrder.InspectNo);
                inspectOrder.LastModifyUser = user;
                inspectOrder.LastModifyDate = dataTimeNow;

                bool allClose = true;
                IList <InspectOrderDetail> detailList = inspectOrderDetailMgr.GetInspectOrderDetail(inspectOrder);
                foreach (InspectOrderDetail inspectOrderDetail in detailList)
                {
                    if (inspectOrderDetail.InspectQty !=
                        (inspectOrderDetail.QualifiedQty.HasValue ? inspectOrderDetail.QualifiedQty.Value : 0)
                        + (inspectOrderDetail.RejectedQty.HasValue ? inspectOrderDetail.RejectedQty.Value : 0))
                    {
                        allClose = false;
                        break;
                    }
                }

                if (allClose)
                {
                    inspectOrder.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE;
                }

                this.UpdateInspectOrder(inspectOrder);
            }
            #endregion
        }
Ejemplo n.º 11
0
        public void PendInspectOrder(IList <InspectOrderDetail> inspectOrderDetailList, User user, string rejNo)
        {
            #region 过滤检验数量为0的检验明细
            IList <InspectOrderDetail> noneZeroInspectOrderDetailList = new List <InspectOrderDetail>();

            if (inspectOrderDetailList != null && inspectOrderDetailList.Count > 0)
            {
                foreach (InspectOrderDetail inspectOrderDetail in inspectOrderDetailList)
                {
                    if (inspectOrderDetail.CurrentQualifiedQty > 0 || inspectOrderDetail.CurrentRejectedQty > 0)
                    {
                        noneZeroInspectOrderDetailList.Add(inspectOrderDetail);
                    }
                }
            }

            if (noneZeroInspectOrderDetailList.Count == 0)
            {
                throw new BusinessErrorException("Order.Error.Inspection.DetailEmpty");
            }
            #endregion

            #region 循环检验单明细
            IDictionary <string, InspectOrder> cachedInspectOrderDic = new Dictionary <string, InspectOrder>();
            string irNo = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION_RESULT);  //检验结果单号
            IList <InspectOrderDetail> pendingList = new List <InspectOrderDetail>();

            foreach (InspectOrderDetail inspectOrderDetail in noneZeroInspectOrderDetailList)
            {
                #region 缓存检验单头
                InspectOrder inspectOrder = inspectOrderDetail.InspectOrder;
                if (!cachedInspectOrderDic.ContainsKey(inspectOrder.InspectNo))
                {
                    cachedInspectOrderDic.Add(inspectOrder.InspectNo, inspectOrder);
                }
                #endregion

                #region 检验数量
                InspectOrderDetail oldInspectOrderDetail = this.inspectOrderDetailMgr.LoadInspectOrderDetail(inspectOrderDetail.Id);
                oldInspectOrderDetail.Disposition         = inspectOrderDetail.Disposition;
                oldInspectOrderDetail.CurrentQualifiedQty = inspectOrderDetail.CurrentQualifiedQty;
                oldInspectOrderDetail.CurrentRejectedQty  = inspectOrderDetail.CurrentRejectedQty;
                decimal totalInspectedQty = (oldInspectOrderDetail.QualifiedQty.HasValue ? oldInspectOrderDetail.QualifiedQty.Value : 0)
                                            + (oldInspectOrderDetail.RejectedQty.HasValue ? oldInspectOrderDetail.RejectedQty.Value : 0)
                                            + oldInspectOrderDetail.PendingQualifiedQty
                                            + oldInspectOrderDetail.PendingRejectedQty
                                            + oldInspectOrderDetail.CurrentQualifiedQty
                                            + oldInspectOrderDetail.CurrentRejectedQty;

                if (oldInspectOrderDetail.LocationLotDetail.Hu != null &&
                    oldInspectOrderDetail.InspectQty != totalInspectedQty)
                {
                    //有条码的只能检验一次
                    throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.HuInspectQtyNotMatch", oldInspectOrderDetail.LocationLotDetail.Hu.HuId);
                }

                if (oldInspectOrderDetail.InspectQty < totalInspectedQty)
                {
                    throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.InspectQtyExcceed", oldInspectOrderDetail.LocationLotDetail.Item.Code);
                }
                #endregion

                #region 合格品
                if (oldInspectOrderDetail.CurrentQualifiedQty > 0)
                {
                    //更新待处理合格品数量
                    oldInspectOrderDetail.PendingQualifiedQty += oldInspectOrderDetail.CurrentQualifiedQty;
                }
                #endregion

                #region  合格品
                if (oldInspectOrderDetail.CurrentRejectedQty > 0)
                {
                    //更新不合格品数量
                    oldInspectOrderDetail.PendingRejectedQty += oldInspectOrderDetail.CurrentRejectedQty;
                }
                #endregion

                #region 保存检验结果
                InspectResult inspectResult = new InspectResult();
                inspectResult.InspectResultNo    = irNo;
                inspectResult.InspectOrderDetail = oldInspectOrderDetail;
                inspectResult.QualifiedQty       = oldInspectOrderDetail.CurrentQualifiedQty;
                inspectResult.RejectedQty        = oldInspectOrderDetail.CurrentRejectedQty;
                inspectResult.CreateDate         = DateTime.Now;
                inspectResult.CreateUser         = user;
                inspectResult.LastModifyDate     = DateTime.Now;
                inspectResult.LastModifyUser     = user;
                inspectResult.PrintCount         = 0;
                inspectResult.IsPrinted          = false;
                if (rejNo != null && rejNo != string.Empty)
                {
                    inspectResult.PrintNo   = rejNo;
                    inspectResult.IsPrinted = true;
                }

                this.inspectResultMgr.CreateInspectResult(inspectResult);
                #endregion

                #region 更新检验单明细
                this.inspectOrderDetailMgr.UpdateInspectOrderDetail(oldInspectOrderDetail);
                #endregion

                #region 根据库位标记确认
                if (!oldInspectOrderDetail.LocationTo.IsAutoConfirm)
                {
                    oldInspectOrderDetail.CurrentQualifiedQty = 0;
                }
                if (!locationMgr.GetRejectLocation().IsAutoConfirm)
                {
                    oldInspectOrderDetail.CurrentRejectedQty = 0;
                }
                if (oldInspectOrderDetail.CurrentQualifiedQty > 0 || oldInspectOrderDetail.CurrentRejectedQty > 0)
                {
                    pendingList.Add(oldInspectOrderDetail);
                }
                #endregion
            }
            #endregion

            #region 将需要确认的自动确认
            if (pendingList != null && pendingList.Count > 0)
            {
                ProcessInspectOrder(pendingList, user);
            }
            #endregion

            #region 更新检验单
            DateTime dataTimeNow = DateTime.Now;
            foreach (InspectOrder oldInspectOrder in cachedInspectOrderDic.Values)
            {
                InspectOrder inspectOrder = this.LoadInspectOrder(oldInspectOrder.InspectNo);
                inspectOrder.LastModifyUser = user;
                inspectOrder.LastModifyDate = dataTimeNow;
                this.UpdateInspectOrder(inspectOrder);
            }
            #endregion
        }
Ejemplo n.º 12
0
        public InspectOrder CreateFgInspectOrder(string locationCode, IDictionary <string, decimal> itemFgQtyDic, User user)
        {
            #region 创建检验单头
            DateTime     dateTimeNow  = DateTime.Now;
            InspectOrder inspectOrder = new InspectOrder();
            inspectOrder.InspectNo      = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION);
            inspectOrder.Status         = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
            inspectOrder.CreateUser     = user;
            inspectOrder.CreateDate     = dateTimeNow;
            inspectOrder.LastModifyUser = user;
            inspectOrder.LastModifyDate = dateTimeNow;
            inspectOrder.IsDetailHasHu  = false;
            inspectOrder.IsSeperated    = true;
            inspectOrder.Region         = this.locationMgr.CheckAndLoadLocation(locationCode).Region.Code;

            this.CreateInspectOrder(inspectOrder);
            #endregion

            #region 创建检验明细
            if (itemFgQtyDic != null && itemFgQtyDic.Count > 0)
            {
                Location location             = this.locationMgr.CheckAndLoadLocation(locationCode);
                string   itemCode             = string.Empty;
                string   fgCode               = string.Empty;
                string   defectClassification = string.Empty;
                string   defectFactor         = string.Empty;

                foreach (string itemFgCode in itemFgQtyDic.Keys)
                {
                    if (itemFgQtyDic[itemFgCode] == 0)
                    {
                        continue;
                    }
                    string[] itemFg = itemFgCode.Split('-');
                    itemCode             = itemFg[0];
                    fgCode               = itemFg[1];
                    defectClassification = itemFg[2];
                    defectFactor         = itemFg[3];

                    Item item = this.itemMgr.CheckAndLoadItem(itemCode);

                    //零件出库
                    this.locationMgr.InspectOut(location, item, itemFgQtyDic[itemFgCode], user, inspectOrder.InspectNo, this.locationMgr.GetInspectLocation());

                    //入待验库位
                    IList <InventoryTransaction> inventoryTransactionList = this.locationMgr.InspectIn(item, itemFgQtyDic[itemFgCode], user, inspectOrder.InspectNo, null, location);

                    if (inventoryTransactionList != null && inventoryTransactionList.Count > 0)
                    {
                        foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList)
                        {
                            InspectOrderDetail inspectOrderDetail = new InspectOrderDetail();
                            inspectOrderDetail.InspectOrder         = inspectOrder;
                            inspectOrderDetail.InspectQty           = inventoryTransaction.Qty;
                            inspectOrderDetail.LocationLotDetail    = this.locationLotDetailMgr.LoadLocationLotDetail(inventoryTransaction.LocationLotDetailId);
                            inspectOrderDetail.LocationFrom         = location;
                            inspectOrderDetail.LocationTo           = location;
                            inspectOrderDetail.FinishGoods          = this.itemMgr.LoadItem(fgCode);
                            inspectOrderDetail.DefectClassification = defectClassification;
                            inspectOrderDetail.DefectFactor         = defectFactor;

                            this.inspectOrderDetailMgr.CreateInspectOrderDetail(inspectOrderDetail);

                            inspectOrder.AddInspectOrderDetail(inspectOrderDetail);
                        }
                    }
                }
            }
            #endregion

            return(inspectOrder);
        }
Ejemplo n.º 13
0
        public InspectOrder CreateInspectOrder(string locationCode, IDictionary <string, decimal> itemQtyDic, User user)
        {
            if (locationCode == BusinessConstants.SYSTEM_LOCATION_INSPECT ||
                locationCode == BusinessConstants.SYSTEM_LOCATION_REJECT)
            {
                throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.LocationFrom", locationCode);
            }

            #region 创建检验单头
            DateTime     dateTimeNow  = DateTime.Now;
            InspectOrder inspectOrder = new InspectOrder();
            inspectOrder.InspectNo      = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION);
            inspectOrder.Status         = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
            inspectOrder.CreateUser     = user;
            inspectOrder.CreateDate     = dateTimeNow;
            inspectOrder.LastModifyUser = user;
            inspectOrder.LastModifyDate = dateTimeNow;
            inspectOrder.IsDetailHasHu  = false;
            inspectOrder.IsSeperated    = true;

            Location location = this.locationMgr.CheckAndLoadLocation(locationCode);
            inspectOrder.Region = location.Region.Code;

            this.CreateInspectOrder(inspectOrder);
            #endregion

            #region 创建检验明细
            if (itemQtyDic != null && itemQtyDic.Count > 0)
            {
                foreach (string itemCode in itemQtyDic.Keys)
                {
                    if (itemQtyDic[itemCode] == 0)
                    {
                        continue;
                    }

                    Item item = this.itemMgr.CheckAndLoadItem(itemCode);

                    //零件出库
                    IList <InventoryTransaction> inventoryTransactionList = this.locationMgr.InspectOut(location, item, itemQtyDic[itemCode], user, inspectOrder.InspectNo, this.locationMgr.GetInspectLocation());

                    //入待验库位
                    foreach (InventoryTransaction outInventoryTransaction in inventoryTransactionList)
                    {
                        IList <InventoryTransaction> inInventoryTransactionList = this.locationMgr.InspectIn(item, 0 - outInventoryTransaction.Qty, user, inspectOrder.InspectNo, outInventoryTransaction.PlannedBill, location);

                        if (inInventoryTransactionList != null && inInventoryTransactionList.Count > 0)
                        {
                            foreach (InventoryTransaction inInventoryTransaction in inInventoryTransactionList)
                            {
                                InspectOrderDetail inspectOrderDetail = new InspectOrderDetail();
                                inspectOrderDetail.InspectOrder      = inspectOrder;
                                inspectOrderDetail.InspectQty        = inInventoryTransaction.Qty;
                                inspectOrderDetail.LocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inInventoryTransaction.LocationLotDetailId);
                                inspectOrderDetail.LocationFrom      = location;
                                inspectOrderDetail.LocationTo        = location;


                                this.inspectOrderDetailMgr.CreateInspectOrderDetail(inspectOrderDetail);

                                inspectOrder.AddInspectOrderDetail(inspectOrderDetail);
                            }
                        }
                    }
                }
            }
            #endregion

            return(inspectOrder);
        }
    public IList <InspectOrderDetail> PopulateInspectOrder(bool?isQualified)
    {
        IList <InspectOrderDetail> inspectOrderDetailList = new List <InspectOrderDetail>();

        if (this.IsPartQualified || !this.IsDetailHasHu)
        {
            #region 允许部分合格/按照数量
            for (int i = 0; i < this.GV_List.Rows.Count; i++)
            {
                GridViewRow row = this.GV_List.Rows[i];
                TextBox     tbCurrentQualifiedQty = (TextBox)row.FindControl("tbCurrentQualifiedQty");
                decimal     currentQualifiedQty   = 0;
                if (tbCurrentQualifiedQty.Text.Trim() != string.Empty)
                {
                    currentQualifiedQty = decimal.Parse(tbCurrentQualifiedQty.Text.Trim());
                }


                TextBox tbCurrentRejectedQty = (TextBox)row.FindControl("tbCurrentRejectedQty");
                decimal currentRejectedQty   = 0;
                if (tbCurrentRejectedQty.Text.Trim() != string.Empty)
                {
                    currentRejectedQty = decimal.Parse(tbCurrentRejectedQty.Text.Trim());
                }
                if (currentQualifiedQty != 0 || currentRejectedQty != 0)
                {
                    HiddenField        hfId = (HiddenField)row.FindControl("hfId");
                    InspectOrderDetail inspectOrderDetail = TheInspectOrderDetailMgr.LoadInspectOrderDetail(int.Parse(hfId.Value));
                    inspectOrderDetail.CurrentQualifiedQty = currentQualifiedQty;
                    inspectOrderDetail.CurrentRejectedQty  = currentRejectedQty;
                    com.Sconit.Control.DropDownList ddlDisposition = (com.Sconit.Control.DropDownList)row.FindControl("ddlDisposition");
                    if (ddlDisposition.SelectedIndex != -1 && inspectOrderDetail.CurrentRejectedQty > 0)
                    {
                        inspectOrderDetail.Disposition = ddlDisposition.SelectedValue;
                    }
                    inspectOrderDetailList.Add(inspectOrderDetail);
                }
            }
            #endregion
        }
        else
        {
            #region 全部合格/不合格
            for (int i = 0; i < this.GV_List.Rows.Count; i++)
            {
                GridViewRow row           = this.GV_List.Rows[i];
                CheckBox    checkBoxGroup = row.FindControl("CheckBoxGroup") as CheckBox;
                if (checkBoxGroup.Checked)
                {
                    HiddenField        hfId = (HiddenField)row.FindControl("hfId");
                    InspectOrderDetail inspectOrderDetail = TheInspectOrderDetailMgr.LoadInspectOrderDetail(int.Parse(hfId.Value));
                    if ((bool)isQualified)
                    {
                        inspectOrderDetail.CurrentQualifiedQty = inspectOrderDetail.InspectQty;
                    }
                    else
                    {
                        inspectOrderDetail.CurrentRejectedQty = inspectOrderDetail.InspectQty;
                    }

                    com.Sconit.Control.DropDownList ddlDisposition = (com.Sconit.Control.DropDownList)row.FindControl("ddlDisposition");
                    if (ddlDisposition.SelectedIndex != -1 && inspectOrderDetail.CurrentRejectedQty > 0)
                    {
                        inspectOrderDetail.Disposition = ddlDisposition.SelectedValue;
                    }

                    inspectOrderDetailList.Add(inspectOrderDetail);
                }
            }
            #endregion
        }

        return(inspectOrderDetailList);
    }
Ejemplo n.º 15
0
 public virtual void UpdateInspectOrderDetail(InspectOrderDetail entity)
 {
     entityDao.UpdateInspectOrderDetail(entity);
 }
Ejemplo n.º 16
0
 public virtual void DeleteInspectOrderDetail(InspectOrderDetail entity)
 {
     entityDao.DeleteInspectOrderDetail(entity);
 }
Ejemplo n.º 17
0
        public InspectOrder CreateInspectOrder(IList <LocationLotDetail> locationLotDetailList, User user, string ipNo, string receiptNo, bool isSeperated)
        {
            IList <LocationLotDetail> noneZeroLocationLotDetailList = new List <LocationLotDetail>();

            bool?  isDetailHasHu = null;
            string region        = null;

            if (locationLotDetailList != null && locationLotDetailList.Count > 0)
            {
                foreach (LocationLotDetail locationLotDetail in locationLotDetailList)
                {
                    if (locationLotDetail.Location.Code == BusinessConstants.SYSTEM_LOCATION_INSPECT ||
                        locationLotDetail.Location.Code == BusinessConstants.SYSTEM_LOCATION_REJECT)
                    {
                        throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.LocationFrom", locationLotDetail.Location.Code);
                    }

                    if (locationLotDetail.CurrentInspectQty > 0)
                    {
                        if (isDetailHasHu == null)
                        {
                            isDetailHasHu = (locationLotDetail.Hu != null);
                        }
                        else if (isDetailHasHu != (locationLotDetail.Hu != null))
                        {
                            throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.NotAllDetailHasHu");
                        }
                        noneZeroLocationLotDetailList.Add(locationLotDetail);
                    }

                    if (region == null)
                    {
                        region = locationLotDetail.Location.Region.Code;
                    }
                    else if (region != locationLotDetail.Location.Region.Code)
                    {
                        throw new BusinessErrorException("MasterData.Inventory.Inspect.Error.RegionNotEqual");
                    }
                }
            }

            if (noneZeroLocationLotDetailList.Count == 0)
            {
                throw new BusinessErrorException("Order.Error.Inspection.DetailEmpty");
            }

            #region 创建检验单头
            DateTime     dateTimeNow  = DateTime.Now;
            InspectOrder inspectOrder = new InspectOrder();
            inspectOrder.InspectNo      = this.numberControlMgr.GenerateNumber(BusinessConstants.CODE_PREFIX_INSPECTION);
            inspectOrder.Status         = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
            inspectOrder.CreateUser     = user;
            inspectOrder.CreateDate     = dateTimeNow;
            inspectOrder.LastModifyUser = user;
            inspectOrder.LastModifyDate = dateTimeNow;
            inspectOrder.IsDetailHasHu  = isDetailHasHu.Value;
            inspectOrder.IpNo           = ipNo;
            inspectOrder.ReceiptNo      = receiptNo;
            inspectOrder.IsSeperated    = isSeperated;
            inspectOrder.Region         = region;

            this.CreateInspectOrder(inspectOrder);
            #endregion

            #region 创建检验明细
            foreach (LocationLotDetail locationLotDetail in noneZeroLocationLotDetailList)
            {
                //零件出库
                this.locationMgr.InspectOut(locationLotDetail, user, false, inspectOrder.InspectNo, this.locationMgr.GetInspectLocation());

                //入待验库位
                IList <InventoryTransaction> inventoryTransactionList = this.locationMgr.InspectIn(locationLotDetail, this.locationMgr.GetInspectLocation(), user, false, inspectOrder.InspectNo, null, null);

                if (inventoryTransactionList != null && inventoryTransactionList.Count > 0)
                {
                    foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList)
                    {
                        InspectOrderDetail inspectOrderDetail = new InspectOrderDetail();
                        inspectOrderDetail.InspectOrder      = inspectOrder;
                        inspectOrderDetail.InspectQty        = inventoryTransaction.Qty;
                        inspectOrderDetail.LocationLotDetail = this.locationLotDetailMgr.LoadLocationLotDetail(inventoryTransaction.LocationLotDetailId);
                        inspectOrderDetail.LocationFrom      = locationLotDetail.Location;
                        inspectOrderDetail.LocationTo        = locationLotDetail.InspectQualifyLocation != null ? locationLotDetail.InspectQualifyLocation : locationLotDetail.Location;

                        this.inspectOrderDetailMgr.CreateInspectOrderDetail(inspectOrderDetail);

                        inspectOrder.AddInspectOrderDetail(inspectOrderDetail);
                    }
                }
            }
            #endregion

            return(inspectOrder);
        }