private void SetTransOutLineLotInfo(TransOutLine transOutLine, LotMaster.EntityKey lotKey)
        {
            if (lotKey == null)
            {
                return;
            }
            LotMaster lotMaster = lotKey.GetEntity();

            transOutLine.LotInfo = new LotMasterInfo();
            transOutLine.LotInfo.DisabledDatetime = lotMaster.InvalidTime;
            transOutLine.LotInfo.LotCode          = lotMaster.LotCode;
            transOutLine.LotInfo.LotMaster        = lotMaster;
            transOutLine.LotInfo.LotValidDate     = lotMaster.ValidDate;
        }
Example #2
0
        /// <summary>
        /// 生成批号
        /// </summary>
        /// <param name="item"></param>
        /// <param name="lotCode"></param>
        /// <param name="actualLength"></param>
        public static LotMaster.EntityKey CreateLot(ItemMaster item, string lotCode, int actualLength)
        {
            if (item.InventoryInfo.LotParamKey == null)
            {
                throw new Exception(string.Format("料品{0}没有启用批号管理,不能生成批号档案!", item.Code));
            }

            LotMaster lot = LotMaster.Finder.Find(string.Format("LotCode='{0}'and ItemCode = '{1}' ", lotCode, item.Code));

            if (lot != null)
            {
                return(lot.Key);
            }

            // 生成批号主挡
            LotRequestDTO lotReqDTO = new LotRequestDTO();

            lotReqDTO.Item = item.Key;
            //lotReqDTO.ItemCode = item.Code;
            lotReqDTO.ItemOrg   = item.OrgKey;
            lotReqDTO.QueryTime = Base.Context.LoginDateTime;
            lotReqDTO.UsingOrg  = Base.Context.LoginOrg.Key;
            lotReqDTO.Lot       = lotCode;

            lotReqDTO.EffectiveTime = Base.Context.LoginDate;
            lotReqDTO.InvalidTime   = DateTime.Parse("3000-1-1");
            lotReqDTO.ValidDays     = (lotReqDTO.InvalidTime - lotReqDTO.EffectiveTime).Days;
            //段长
            lotReqDTO.DescFlexSegments             = new Base.FlexField.DescFlexField.DescFlexSegments();
            lotReqDTO.DescFlexSegments.PubDescSeg1 = actualLength.ToString();

            CreateLotOnlineSV onlineLot = new CreateLotOnlineSV();

            onlineLot.LotRequestDTO = lotReqDTO;
            LotInfo lotInfo = onlineLot.Do();

            if (lotInfo == null)
            {
                return(null);
            }
            if (lotInfo.LotMaster == null)
            {
                return(null);
            }
            if (lotInfo.LotMaster.EntityID <= 0L)
            {
                return(null);
            }
            return(new LotMaster.EntityKey(lotInfo.LotMaster.EntityID));
        }
        private void SetRcvLineLotInfo(RcvLine rcvLine, LotMaster.EntityKey lotKey)
        {
            if (lotKey == null)
            {
                return;
            }
            LotMaster lotMaster = lotKey.GetEntity();

            //rcvLine.RcvLotKey = lotKey;
            //rcvLine.RcvLotCode = lotMaster.LotCode;

            rcvLine.InvLotKey        = lotKey;
            rcvLine.InvLotCode       = lotMaster.LotCode;
            rcvLine.InvLotEnableDate = lotMaster.EffectiveDatetime;
            rcvLine.InvLotValidDate  = lotMaster.ValidDate;
        }