public override object Do(object obj)
        {
            GenProductBarCodesByRMA bpObj = (GenProductBarCodesByRMA)obj;

            if (bpObj.ProductBarCodeDTOs == null || bpObj.ProductBarCodeDTOs.Count == 0)
            {
                return(null);
            }

            //生成销售退回收货单
            CreateReceivementProxy createRcv = new CreateReceivementProxy();

            createRcv.RcvHeadDTOs = CreateRcvHeadDTOs(bpObj.ProductBarCodeDTOs);
            List <BusinessEntity.EntityKey> resultKeys = createRcv.Do();

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

            using (Session s = Session.Open())
            {
                List <ProductBarCodeByRMADTO> barCodeDTOs = new List <ProductBarCodeByRMADTO>(bpObj.ProductBarCodeDTOs);

                foreach (BusinessEntity.EntityKey resultKey in resultKeys)
                {
                    Receivement rcv = new Receivement.EntityKey(resultKey.ID).GetEntity();
                    foreach (RcvLine rcvLine in rcv.RcvLines)
                    {
                        ProductBarCodeByRMADTO barCodeDTO = FindProductBarCodeDTO(barCodeDTOs, rcvLine);
                        barCodeDTOs.Remove(barCodeDTO);
                        //生成批号数据
                        LotMaster.EntityKey lotKey = LotBuilder.CreateLot(rcvLine.ItemInfo.ItemID, barCodeDTO.BarCode, barCodeDTO.ActualLength);
                        //设置收货行批号
                        SetRcvLineLotInfo(rcvLine, lotKey);
                        //生成成品条码记录
                        ProductBarCode productBarCode = ProductBarCode.Create();
                        productBarCode.OrgKey       = new Base.Organization.Organization.EntityKey(barCodeDTO.OrgID);
                        productBarCode.BarCode      = barCodeDTO.BarCode;
                        productBarCode.ActualLength = barCodeDTO.ActualLength;
                        productBarCode.ItemKey      = rcvLine.ItemInfo.ItemIDKey;
                        productBarCode.LotKey       = lotKey;
                        productBarCode.OperatorsKey = new CBO.HR.Operator.Operators.EntityKey(barCodeDTO.QcOperator);

                        productBarCode.RMAKey             = new SM.RMA.RMA.EntityKey(barCodeDTO.RMA);
                        productBarCode.RMALineKey         = new SM.RMA.RMALine.EntityKey(barCodeDTO.RMALine);
                        productBarCode.ReceivementKey     = rcvLine.ReceivementKey;
                        productBarCode.RcvLineKey         = rcvLine.Key;
                        productBarCode.ProductBarCodeKind = ProductBarCodeKindEnum.RMR;
                    }
                }
                s.Commit();
            }
            return(null);
        }
Esempio n. 2
0
        public override object Do(object obj)
        {
            GetBaseBarCode bpObj = (GetBaseBarCode)obj;

            return(ProductBarCode.GetBaseBarCode(bpObj.ItemCode, bpObj.SegLength, bpObj.BusinessDate, bpObj.OperatorCode));
        }
        public override object Do(object obj)
        {
            GenProductBarCodesByCompleteApply bpObj = (GenProductBarCodesByCompleteApply)obj;

            if (bpObj.ProductBarCodeDTOs == null || bpObj.ProductBarCodeDTOs.Count == 0)
            {
                return(null);
            }

            CompleteApplyDoc completeApplyDoc = new CompleteApplyDoc.EntityKey(bpObj.ProductBarCodeDTOs[0].CompleteApplyDoc).GetEntity();

            if (completeApplyDoc == null)
            {
                return(null);
            }

            if (completeApplyDoc.DocState != CompleteApplyDocStatusEnum.Approved)
            {
                throw new Exception(string.Format("完工申报单{0}没有审核,不允许生成成品入库单和成品条码记录", completeApplyDoc.DocNo));
            }

            //生成成品入库单
            CreateRcvRptDocProxy createRcvRptDoc = new CreateRcvRptDocProxy();

            createRcvRptDoc.CompleteDocInfoDTOList = CreateCompleteDocInfos(bpObj.ProductBarCodeDTOs);
            createRcvRptDoc.Direction = 0;     //0是入库、1是出库
            createRcvRptDoc.IsOffLine = false; //是否在制品入库(影响成品入库单单据类型的选择)
            List <WOKeyData> woKeys = createRcvRptDoc.Do();

            RcvRptDoc rcvRptDoc = new RcvRptDoc.EntityKey(woKeys[0].ID).GetEntity();

            if (rcvRptDoc == null)
            {
                return(null);
            }

            using (Session s = Session.Open())
            {
                foreach (RcvRptDocLine rcvRptDocLine in rcvRptDoc.RcvRptDocLines)
                {
                    ProductBarCodeByCompleteApplyDTO barCodeDTO = FindProductBarCodeDTO(bpObj.ProductBarCodeDTOs, rcvRptDocLine);
                    //生成成品条码记录
                    ProductBarCode productBarCode = ProductBarCode.Create();
                    productBarCode.OrgKey       = new Base.Organization.Organization.EntityKey(barCodeDTO.OrgID);
                    productBarCode.BarCode      = barCodeDTO.BarCode;
                    productBarCode.ActualLength = barCodeDTO.ActualLength;
                    productBarCode.ItemKey      = rcvRptDocLine.ItemKey;
                    productBarCode.LotKey       = rcvRptDocLine.RcvLotMasterKey;
                    productBarCode.OperatorsKey = new CBO.HR.Operator.Operators.EntityKey(barCodeDTO.QcOperator);

                    productBarCode.CompleteApplyDocKey     = new CompleteApplyDoc.EntityKey(barCodeDTO.CompleteApplyDoc);
                    productBarCode.CompleteApplyDocLineKey = new CompleteApplyDocLine.EntityKey(barCodeDTO.CompleteApplyDocLine);
                    productBarCode.RcvRptDocKey            = rcvRptDocLine.RcvRptDocKey;
                    productBarCode.RcvRptDocLineKey        = rcvRptDocLine.Key;

                    productBarCode.ScanBy             = barCodeDTO.ScanBy;
                    productBarCode.ScanOn             = DateTime.Now; // barCodeDTO.ScanOn;
                    productBarCode.ProductBarCodeKind = ProductBarCodeKindEnum.Rcv;
                }
                s.Commit();
            }

            return(null);
        }
        public override object Do(object obj)
        {
            GenProductBarCodesByShip bpObj = (GenProductBarCodesByShip)obj;

            if (bpObj.ProductBarCodeDTOs == null || bpObj.ProductBarCodeDTOs.Count == 0)
            {
                return(null);
            }

            //销售订单转调出单
            SOToTransOutBP soToTransOut = new SOToTransOutBP();

            soToTransOut.SOToTransOutDTOs = CreateSOToTransOutDTOs(bpObj.ProductBarCodeDTOs);
            soToTransOut.SplitMergeRule   = new List <string>();
            List <SOToTransOutResultDTO> resultDTOs = soToTransOut.Do();

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

            using (Session s = Session.Open())
            {
                List <ProductBarCodeByShipDTO> barCodeDTOs = new List <ProductBarCodeByShipDTO>(bpObj.ProductBarCodeDTOs);

                foreach (SOToTransOutResultDTO resultDTO in resultDTOs)
                {
                    TransferOut transferOut = new TransferOut.EntityKey(resultDTO.TransOut).GetEntity();
                    foreach (TransOutLine transOutline in transferOut.TransOutLines)
                    {
                        ProductBarCodeByShipDTO barCodeDTO = FindProductBarCodeDTO(barCodeDTOs, transOutline);
                        barCodeDTOs.Remove(barCodeDTO);
                        //生成批号数据
                        LotMaster.EntityKey lotKey = LotBuilder.CreateLot(transOutline.ItemInfo.ItemID, barCodeDTO.BarCode, barCodeDTO.ActualLength);
                        //设置调出行批号
                        SetTransOutLineLotInfo(transOutline, lotKey);
                        //记录来源关系
                        ShipPlanLine shipPlanline = ShipPlanLine.Finder.FindByID(barCodeDTO.ShipPlanLine);
                        transOutline.DescFlexSegments.PrivateDescSeg3 = shipPlanline.ID.ToString();        //来源出货计划行ID
                        transOutline.DescFlexSegments.PrivateDescSeg4 = shipPlanline.ShipPlan.DocNo;       //来源出货计划单号
                        transOutline.DescFlexSegments.PrivateDescSeg5 = shipPlanline.DocLineNo.ToString(); //来源出货计划行号

                        //生成成品条码记录
                        ProductBarCode productBarCode = ProductBarCode.Create();
                        productBarCode.OrgKey       = new Base.Organization.Organization.EntityKey(barCodeDTO.OrgID);
                        productBarCode.BarCode      = barCodeDTO.BarCode;
                        productBarCode.ActualLength = barCodeDTO.ActualLength;
                        productBarCode.ItemKey      = transOutline.ItemInfo.ItemIDKey;
                        productBarCode.LotKey       = lotKey;
                        productBarCode.OperatorsKey = new CBO.HR.Operator.Operators.EntityKey(barCodeDTO.QcOperator);
                        productBarCode.ScanBy       = barCodeDTO.ScanBy;
                        productBarCode.ScanOn       = DateTime.Now; // barCodeDTO.ScanOn;

                        productBarCode.ShipPlanKey        = new ShipPlan.EntityKey(barCodeDTO.ShipPlan);
                        productBarCode.ShipPlanLineKey    = new ShipPlanLine.EntityKey(barCodeDTO.ShipPlanLine);
                        productBarCode.TransferOutKey     = transOutline.TransferOutKey;
                        productBarCode.TransferOutLineKey = transOutline.Key;
                        productBarCode.ProductBarCodeKind = ProductBarCodeKindEnum.Ship;
                    }
                }
                s.Commit();
            }

            return(null);
        }
Esempio n. 5
0
        public override object Do(object obj)
        {
            GetBarCodeFlowNo bpObj = (GetBarCodeFlowNo)obj;

            return(ProductBarCode.GetBarCodeFlowNo(bpObj.BaseBarCode));
        }