Exemplo n.º 1
0
 public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     // MessageBox.Show(e.Item.Caption);
     //新增
     if (e.Item.Caption == BtnCommandEnum.Add)
     {
         this.wMSM105MatReturnBindingSource.AddNew();
         WMS_M105_MatReturn temp = this.wMSM105MatReturnBindingSource.Current as WMS_M105_MatReturn;
         //temp.ReturnNo = "1001";
         OpenForm("新增领料单", BtnCommandEnum.Add);
     }
     else if (e.Item.Caption == BtnCommandEnum.Edit)
     {
         OpenForm("修改领料单", BtnCommandEnum.Edit);
     }
     else if (e.Item.Caption == BtnCommandEnum.Delete)
     {
         if (ERPHelper.Instance.MessageDel())
         {
             WMS_M105_MatReturn tempData = this.wMSM105MatReturnBindingSource.Current as WMS_M105_MatReturn;
             matGetService.Delete(tempData.Id);
             this.wMSM105MatReturnBindingSource.RemoveCurrent();
         }
     }
 }
Exemplo n.º 2
0
        void wMSM105MatReturnBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            WMS_M105_MatReturn temp = this.wMSM105MatReturnBindingSource.Current as WMS_M105_MatReturn;

            if (temp != null)
            {
                this.wMSM105MatReturnDetailBindingSource.DataSource = matGetService.GetMatDetailQuery().Where(a => a.ReturnNo == temp.ReturnNo).ToList();
            }
        }
Exemplo n.º 3
0
        public void Create(WMS_M105_MatReturn WMS_M105_MatReturn)
        {
            WMS_M105_MatReturn.CreateDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

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

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

            this.WMS_M105_MatReturnRepository.SetValues(WMS_M105_MatReturn, existstb_Sys_Menu);
            this.runtimeService.Commit();
        }
Exemplo n.º 5
0
        private void OpenForm(string formText, string btnCommand)
        {
            WMS_M105_MatReturn      temp = this.wMSM105MatReturnBindingSource.Current as WMS_M105_MatReturn;
            WMS105MatReturnEditForm edit = new WMS105MatReturnEditForm(temp, matGetService);

            edit.Text = formText;
            edit.Tag  = btnCommand;
            if (edit.ShowDialog() != DialogResult.OK)
            {
                this.wMSM105MatReturnBindingSource.CancelEdit();
            }
            else
            {
                wMSM105MatReturnBindingSource_CurrentChanged(null, null);
            }
        }
Exemplo n.º 6
0
 public WMS105MatReturnEditForm(WMS_M105_MatReturn outStore, IWMS_M105_MatReturnService matReturnService)
 {
     InitializeComponent();
     this.tempData         = outStore;
     this.matReturnService = matReturnService;
 }
Exemplo n.º 7
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();
        }