예제 #1
0
        public BasicMessage OutComingByUniqNr(string UniqNr)
        {
            if (string.IsNullOrEmpty(UniqNr))
            {
                Message.MsgText = "唯一码不能为空";
                Message.Result  = false;
                return(Message);
            }
            if (UniqRep.UnqiNrExist(UniqNr) == false)
            {
                Message.MsgText = "唯一码在UniqItem表中不存在";
                Message.Result  = false;
                return(Message);
            }
            UniqueItem UI = UniqRep.SearchByUniqNr(UniqNr);
            Storage    Sg = SaRep.SearchByUniqueNr(UniqNr);

            if (string.IsNullOrEmpty(Sg.PositionNr))
            {
                Message.MsgText = "PositionNr在Storage表中不存在";
                Message.Result  = false;
                return(Message);
            }
            bool DeRe = SaRep.Delete(Sg);

            if (DeRe)
            {
                bool OutMoRe = CreateOutcomingMovement(Sg.PositionNr, UI.CreatedAt);
                if (OutMoRe)
                {
                    Message.MsgText = "出库成功,并且写入Movement表";
                    Message.Result  = true;
                    return(Message);
                }
                else
                {
                    Message.MsgText = "出库成功,但无法写入Movement表";
                    Message.Result  = false;
                    return(Message);
                }
            }
            else
            {
                Message.MsgText = "出库失败";
                Message.Result  = false;
                return(Message);
            }
        }
예제 #2
0
 public UniqueItem SearchByUniqNr(string UniqNr)
 {
     return(UIRep.SearchByUniqNr(UniqNr));
 }
예제 #3
0
        public BasicMessage IncomingByNr(string UniqNr, string PositionNr)
        {
            if (UniqRep.UnqiNrExist(UniqNr) == false)
            {
                Message.MsgText = "唯一吗不在UniqItem表中";
                Message.Result  = false;
                return(Message);
            }
            UniqueItem UI = UniqRep.SearchByUniqNr(PositionNr);

            string   PartNr = UI.PartNr;
            DateTime FIFO   = UI.CreatedAt;


            if (PoRep.PositionNrExist(PositionNr) == false)
            {
                Message.MsgText = "PositionNr不在Position表中";
                Message.Result  = false;
                return(Message);
            }
            if (SaRep.PositionNrExist(PositionNr))
            {
                Message.MsgText = "PositionNr已占用库位";
                Message.Result  = false;
            }
            Storage sg = new Storage
            {
                PositionNr = PositionNr,
                PartNr     = PartNr,
                FIFO       = FIFO,
                UniqItemNr = UniqNr,
                CreatedAt  = DateTime.Now
            };

            try
            {
                bool SaCre = SaRep.Create(sg);
                if (SaCre)
                {
                    bool InMoCre = CreateIncomingMovement(PositionNr, UI.CreatedAt);


                    if (InMoCre)
                    {
                        Message.MsgText = "入库成功并写入日志";
                        Message.Result  = true;
                        return(Message);
                    }
                    else
                    {
                        Message.MsgText = "入库成功,但未写入日志";
                        Message.Result  = false;
                        return(Message);
                    }
                }
                else
                {
                    Message.MsgText = "入库未成功";
                    Message.Result  = false;
                    return(Message);
                }
            }
            catch (Exception ex)
            {
                Message.MsgText = ex.Message;
                Message.Result  = false;
                return(Message);
            }
        }