//[OperationBehavior]
        public void DoEx(ICommonDataContract commonData, List <UFIDA.U9.Cust.JSDY.BarCode.ProductBarCodeByCompleteApplyDTOData> productBarCodeDTOs)
        {
            this.CommonData = commonData;
            try
            {
                BeforeInvoke("UFIDA.U9.Cust.JSDY.BarCode.GenProductBarCodesByCompleteApply");
                GenProductBarCodesByCompleteApply objectRef = new GenProductBarCodesByCompleteApply();


                if (productBarCodeDTOs != null)
                {
                    DeSerializeKey(productBarCodeDTOs);
                    List <UFIDA.U9.Cust.JSDY.BarCode.ProductBarCodeByCompleteApplyDTO> listProductBarCodeDTOs = new List <UFIDA.U9.Cust.JSDY.BarCode.ProductBarCodeByCompleteApplyDTO>();
                    foreach (UFIDA.U9.Cust.JSDY.BarCode.ProductBarCodeByCompleteApplyDTOData obj in productBarCodeDTOs)
                    {
                        if (obj == null)
                        {
                            continue;
                        }

                        UFIDA.U9.Cust.JSDY.BarCode.ProductBarCodeByCompleteApplyDTO child = new UFIDA.U9.Cust.JSDY.BarCode.ProductBarCodeByCompleteApplyDTO();
                        child.FromEntityData(obj);
                        //值对象应该是依赖主创建的.但此处不是.可能的问题?
                        listProductBarCodeDTOs.Add(child);
                    }
                    objectRef.ProductBarCodeDTOs = listProductBarCodeDTOs;
                }

                //处理返回类型.
                objectRef.Do();                 //没有返回值
            }
            catch (System.Exception e)
            {
                DealException(e);
                throw;
            }
            finally
            {
                FinallyInvoke("UFIDA.U9.Cust.JSDY.BarCode.GenProductBarCodesByCompleteApply");
            }
        }
        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);
        }