Exemplo n.º 1
0
        public void Create(WMS_M105_MatSotre WMS_M105_MatSotre)
        {
            WMS_M105_MatSotre.CreateDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            WMS_M105_MatSotre.CreateUser = tempUser.UserName;
            WMS_M105_MatSotre.Validate();
            this.WMS_M105_MatSotreRepository.Add(WMS_M105_MatSotre);
            this.runtimeService.Commit();
        }
Exemplo n.º 2
0
        public void Update(WMS_M105_MatSotre WMS_M105_MatSotre)
        {
            WMS_M105_MatSotre.ModifyDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            WMS_M105_MatSotre.ModifyUser = tempUser.UserName;
            WMS_M105_MatSotre.Validate();
            var existstb_Sys_Menu = this.GetById(WMS_M105_MatSotre.Id);

            this.WMS_M105_MatSotreRepository.SetValues(WMS_M105_MatSotre, existstb_Sys_Menu);
            this.runtimeService.Commit();
        }
Exemplo n.º 3
0
        public void Save(WMS_M105_MatReturn matGet, List <WMS_M105_MatReturnDetail> matDetailList)
        {
            tb_Sys_User tempUser    = appCacheService.GetItem("user") as tb_Sys_User;
            var         existslotTx = this.GetById(matGet.Id);

            if (existslotTx == null)
            {
                matGet.CompCode   = tempUser.CompCode;
                matGet.CreateDt   = DateTime.Now;
                matGet.CreateUser = tempUser.UserName;
                matGet.Validate();
                this.WMS_M105_MatReturnRepository.Add(matGet);
            }
            else
            {
                matGet.ModifyDt   = DateTime.Now;
                matGet.ModifyUser = tempUser.UserName;
                matGet.Validate();
                this.WMS_M105_MatReturnRepository.SetValues(matGet, existslotTx);
            }
            if (matDetailList != null)
            {
                foreach (var detail in matDetailList)
                {
                    var existstLotTxNG = this.WMS_M105_MatReturnDetailRepository.GetByID(detail.Id);
                    if (existstLotTxNG == null)
                    {
                        detail.CompCode   = tempUser.CompCode;
                        detail.CreateDt   = DateTime.Now;
                        detail.CreateUser = tempUser.UserName;
                        detail.ReturnNo   = matGet.ReturnNo;
                        detail.Validate();
                        this.WMS_M105_MatReturnDetailRepository.Add(detail);
                        //更新库存
                        var matStore = this.WMS_M105_MatSotreRepository.GetMany(a => a.MatSpecCode == detail.MatSpecCode).SingleOrDefault();
                        if (matStore != null)
                        {
                            matStore.StoreAmount -= detail.RetQty;
                        }
                        else
                        {
                            matStore             = new WMS_M105_MatSotre();
                            matStore.CompCode    = detail.CompCode;
                            matStore.MatSpecCode = detail.MatSpecCode;
                            matStore.MatSpec     = detail.MatSpec;
                            matStore.MatType     = detail.MatType;
                            matStore.Suppode     = detail.Suppode;
                            matStore.StoreAmount = detail.RetQty;
                            this.WMS_M105_MatSotreRepository.Add(matStore);
                        }
                    }
                    else
                    {
                        //更新库存
                        var matStore = this.WMS_M105_MatSotreRepository.GetMany(a => a.MatSpecCode == detail.MatSpecCode).SingleOrDefault();
                        if (matStore != null)
                        {
                            matStore.StoreAmount += (detail.RetQty - existstLotTxNG.RetQty);
                        }
                        else
                        {
                            matStore             = new WMS_M105_MatSotre();
                            matStore.CompCode    = detail.CompCode;
                            matStore.MatSpecCode = detail.MatSpecCode;
                            matStore.MatSpec     = detail.MatSpec;
                            matStore.MatType     = detail.MatType;
                            matStore.Suppode     = detail.Suppode;
                            matStore.StoreAmount = detail.RetQty;
                            this.WMS_M105_MatSotreRepository.Add(matStore);
                        }
                        this.WMS_M105_MatReturnDetailRepository.SetValues(detail, existstLotTxNG);
                    }
                }
            }
            this.runtimeService.Commit();
        }