Esempio 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.wMSC101InStoreBindingSource.AddNew();
         WMS_C101_InStore temp = this.wMSC101InStoreBindingSource.Current as WMS_C101_InStore;
         temp.StoreInDate = DateTime.Now.Date;
         temp.DriverDt    = DateTime.Now.Date;
         temp.InStoreNo   = this.instoreService.GetInStoreNo();
         tb_Sys_Menu menuInfo = this.Tag as tb_Sys_Menu;
         temp.StockArea = menuInfo.MenuType;
         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_C101_InStore tempData = this.wMSC101InStoreBindingSource.Current as WMS_C101_InStore;
             instoreService.Delete(tempData.Id);
             this.wMSC101InStoreBindingSource.RemoveCurrent();
         }
     }
 }
Esempio n. 2
0
 public InStoreEditForm(WMS_C101_InStore inStore, IWMS_C101_InStoreService instoreService)
 {
     InitializeComponent();
     this.tempData = inStore;
     this.SuppCodeTextEdit.Focus();
     this.instoreService = instoreService;
 }
Esempio n. 3
0
        public void Create(WMS_C101_InStore WMS_C101_InStore)
        {
            WMS_C101_InStore.CreateDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

            WMS_C101_InStore.CreateUser = tempUser.UserName;

            WMS_C101_InStore.Validate();
            this.WMS_C101_InStoreRepository.Add(WMS_C101_InStore);
            this.runtimeService.Commit();
        }
Esempio n. 4
0
        public void Update(WMS_C101_InStore WMS_C101_InStore)
        {
            WMS_C101_InStore.ModifyDt = DateTime.Now;
            tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User;

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

            this.WMS_C101_InStoreRepository.SetValues(WMS_C101_InStore, existstb_Sys_Menu);
            this.runtimeService.Commit();
        }
Esempio n. 5
0
        void wMSC101InStoreBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            WMS_C101_InStore tempData = this.wMSC101InStoreBindingSource.Current as WMS_C101_InStore;

            if (tempData != null)
            {
                this.wMSC102InStoreDetailBindingSource.DataSource = instoreService.GetDetailListByInstoreId(tempData.Id);
            }
            else
            {
                this.wMSC102InStoreDetailBindingSource.DataSource = null;
            }
        }
Esempio n. 6
0
        private void OpenForm(string formText, string btnCommand)
        {
            WMS_C101_InStore temp = this.wMSC101InStoreBindingSource.Current as WMS_C101_InStore;
            InStoreEditForm  edit = new InStoreEditForm(temp, instoreService);

            edit.Text = formText;
            edit.Tag  = btnCommand;
            if (edit.ShowDialog() != DialogResult.OK)
            {
                this.wMSC101InStoreBindingSource.CancelEdit();
            }
            else
            {
                wMSC101InStoreBindingSource_CurrentChanged(null, null);
            }
        }
Esempio n. 7
0
        public void Save(WMS_C101_InStore instore, List <WMS_C102_InStoreDetail> instoreDetailList)
        {
            //if (instore.BeforeAmount < instore.ActualAmount)
            //    throw new AppException("实际入库数不能大于计划入库数");
            tb_Sys_User tempUser    = appCacheService.GetItem("user") as tb_Sys_User;
            var         existslotTx = this.GetById(instore.Id);

            if (existslotTx == null)
            {
                instore.CreateDt   = DateTime.Now;
                instore.CreateUser = tempUser.UserName;
                instore.Validate();
                this.WMS_C101_InStoreRepository.Add(instore);
            }
            else
            {
                instore.ModifyDt   = DateTime.Now;
                instore.ModifyUser = tempUser.UserName;
                instore.Validate();
                this.WMS_C101_InStoreRepository.SetValues(instore, existslotTx);
            }
            if (instoreDetailList != null)
            {
                foreach (var detail in instoreDetailList)
                {
                    var existstLotTxNG = this.instoreDetailRepository.GetByID(detail.Id);
                    if (existstLotTxNG == null)
                    {
                        detail.CreateDt   = DateTime.Now;
                        detail.CreateUser = tempUser.UserName;
                        detail.Validate();
                        this.instoreDetailRepository.Add(detail);
                        WMS_C103_Stock stock = new WMS_C103_Stock();
                        stock.InStoreDetailId = detail.Id;
                        stock.InStoreId       = detail.InStoreId;
                        stock.StoreAmount     = detail.Amount;
                        stock.StockStatus     = "合格";
                        stock.ARCode          = detail.ARCode;
                        stock.SuppLot         = detail.SuppLot;
                        stock.SuppCode        = instore.SuppCode;
                        stock.PartSpec        = detail.PartSpec;
                        stock.MatClass2       = detail.MatClass2;

                        stock.CreateDt   = DateTime.Now;
                        stock.CreateUser = tempUser.UserName;
                        this.stockRepository.Add(stock);
                    }
                    //else if (existstLotTxNG.Amount != detail.Amount)
                    //{
                    //    //如果已经入库的修改,则判断是否已经出库,如果已经出库,则不允许修改
                    //    var stock = this.stockRepository.GetMany(i => i.InStoreDetailId == detail.Id).FirstOrDefault();
                    //    if (stock != null)
                    //    {
                    //        var outstore = this.outstoreDetailRepository.GetMany(i => i.StockId == stock.Id).FirstOrDefault();
                    //        if (outstore != null)
                    //            throw new AppException(string.Format("单号{0}在{1}已出库,不允许修改", detail.ARCode));
                    //        else
                    //        {
                    //            //stock.LotNo = detail.LotNo;
                    //            stock.ARCode = detail.ARCode;
                    //            stock.StoreAmount = detail.Amount;
                    //            stock.ModifyDt = DateTime.Now;
                    //            stock.ModifyUser = tempUser.UserName;
                    //            stock.SuppLot = detail.SuppLot;
                    //            detail.Validate();
                    //            this.instoreDetailRepository.SetValues(detail, existstLotTxNG);
                    //        }

                    //    }
                    //    //detail.Validate();
                    //   // this.instoreDetailRepository.SetValues(detail, existstLotTxNG);
                    //}
                }
            }
            this.runtimeService.Commit();
        }