Exemplo n.º 1
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     try
     {
         bs.EndEdit();
         if (_bill.单据类型 != (int)BillType.StockMove)
         {
             MessageHelper.ShowError("请输入有效的单据类型!移库单据类型为:" + (int)BillType.StockMove);
             return;
         }
         var detailList = (List <TB_STOCK_MOVE>)bs.DataSource;
         if (detailList.Count == 0)
         {
             MessageHelper.ShowError("请维护移动明细!");
             return;
         }
         SpareEntities db = EntitiesFactory.CreateSpareInstance();
         BillHandler.AddStockMove(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), detailList);
         EntitiesFactory.SaveDb(db);
         MessageHelper.ShowInfo("保存成功!");
     }
     catch (Exception ex)
     {
         MessageHelper.ShowInfo(ex.ToString());
     }
 }
Exemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "文件(*.*)|*.*";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                var attach = new TA_Attach()
                {
                    TableName   = TableName,
                    TablePKID   = TablePKID,
                    CreateDate  = DateTime.Now,
                    CreatorName = GlobalVar.Oper.OperName,
                    FileName    = Path.GetFileName(dlg.FileName)
                };
                FileStream fs = File.OpenRead(dlg.FileName);
                fs.Position = 0;
                byte[] blobdata = new Byte[fs.Length];
                fs.Read(blobdata, 0, (int)fs.Length);
                attach.FileData = blobdata;
                fs.Close();
                SpareEntities db = EntitiesFactory.CreateSpareInstance();
                AttachController.AddOrUpdate(db, attach, GlobalVar.Oper);
                EntitiesFactory.SaveDb(db);
                MessageHelper.ShowInfo("保存成功!");
                RefreshData();
            }
        }
Exemplo n.º 3
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     try
     {
         bs.EndEdit();
         if (_bill.单据类型 != (int)BillType.OtherInOut)
         {
             MessageHelper.ShowError("请输入有效的单据类型!其他出入库单据类型为:" + (int)BillType.OtherInOut);
             return;
         }
         if (_bill.子单据类型 != (int)SubBillType.OtherIn)
         {
             MessageHelper.ShowError("维护的子单据类型无效!其他入库类型为:" + (int)SubBillType.OtherIn);
             return;
         }
         var detailList = (List <TB_OTHER_IN>)bs.DataSource;
         if (detailList.Count == 0)
         {
             MessageHelper.ShowError("请维护其他入库明细!");
             return;
         }
         SpareEntities db = EntitiesFactory.CreateSpareInstance();
         BillHandler.AddOtherIn(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), detailList);
         EntitiesFactory.SaveDb(db);
         NotifyController.AddStockSafeQty(db, GlobalVar.Oper.OperName);
         MessageHelper.ShowInfo("保存成功!");
     }
     catch (Exception ex)
     {
         MessageHelper.ShowInfo(ex.ToString());
     }
 }
Exemplo n.º 4
0
        private void ItemBtnReturn_Click(object sender, EventArgs e)
        {
            if (_bill == null || _bill.单据编号 == null)
            {
                MessageHelper.ShowInfo("请选择单据");
                return;
            }

            if (_bill.状态 != (int)BillState.Finished)
            {
                MessageHelper.ShowInfo("选中单据状态错误,无法执行");
                return;
            }
            var details = SpareOutController.GetList(_db, _bill.单据编号);

            try
            {
                string strInfo = BillHandler.HandleMaterialReturn(_db, _bill.VWToBill(GlobalVar.Oper.DeptCode), details);
                if (strInfo != "OK")
                {
                    MessageHelper.ShowError(strInfo);
                }
                else
                {
                    MessageHelper.ShowInfo("生成领用还回单成功");
                    EntitiesFactory.SaveDb(_db);
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowError(ex.ToString());
                throw;
            }
        }
Exemplo n.º 5
0
 private void BtnDeliver_Click(object sender, EventArgs e)
 {
     if (_bill == null || _bill.单据编号 == null)
     {
         MessageHelper.ShowInfo("请选择单据");
         return;
     }
     if (MessageHelper.ShowQuestion("确定要执行选定的领用单?") == DialogResult.Yes)
     {
         SpareEntities db      = EntitiesFactory.CreateSpareInstance();
         var           outlist = SpareOutController.GetList(db, _bill.单据编号);
         foreach (var spout in outlist)
         {
             if (string.IsNullOrEmpty(spout.TakeUser))
             {
                 MessageHelper.ShowError("领用详细中的领用人信息不能为空!");
                 return;
             }
         }
         BillHandler.FinishMaterialOut(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), outlist);
         EntitiesFactory.SaveDb(db);
         NotifyController.AddStockSafeQty(db, GlobalVar.Oper.OperName);
         MessageHelper.ShowInfo("保存成功!");
     }
 }
Exemplo n.º 6
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     if (_bill == null || _bill.单据编号 == null)
     {
         MessageHelper.ShowInfo("请选择单据!");
         return;
     }
     if (_bill.状态 != (int)BillState.New)
     {
         MessageHelper.ShowError("非新建单据,禁止取消!");
         return;
     }
     if (MessageHelper.ShowQuestion("是否要取消盘点计划单?") == DialogResult.Yes)
     {
         BillController.UpdateState(_db, _bill.VWToBill(GlobalVar.Oper.DeptCode), BillState.Cancelled);
         NotifyController.AddNotify(_db, _bill.操作者, NotifyType.InventoryPlanCancel, _bill.单据编号, "");
         var InventoryLocs = InventoryController.GetLocList(_db, _bill.单据编号);
         foreach (var inventoryLoc in InventoryLocs)
         {
             InventoryController.LocCancel(_db, inventoryLoc);
         }
         EntitiesFactory.SaveDb(_db);
         MessageHelper.ShowInfo("取消盘点计划成功!");
         SetMasterDataSource(grid.PageSize);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 ///     创建【拣料单】
 /// </summary>
 /// <param name="db"></param>
 /// <param name="billPickFact">拣料单</param>
 /// <param name="details">拣料明细</param>
 /// <returns></returns>
 public static void AddMaterialOut(SpareEntities db, TB_BILL billPickFact, List <TB_OUT> details)
 {
     {
         //校验单据状态是否为新建
         if (billPickFact.State != (int)BillState.New)
         {
             throw new WmsException(ResultCode.DataStateError,
                                    billPickFact.BillNum, "状态错误,不应为:" + billPickFact.State);
         }
         if (string.IsNullOrEmpty(billPickFact.BillNum))
         {
             SetBillNum(billPickFact);                               //设置单据编号
             details.ForEach(p => p.BillNum = billPickFact.BillNum); //设置明细编号
             NotifyController.AddNotify(db, billPickFact.OperName, NotifyType.MaterialOut, billPickFact.BillNum, "");
         }
         else
         {
             var dbOutList = db.TB_OUT.Where(p => p.BillNum == billPickFact.BillNum).ToList();
             foreach (var det in dbOutList)
             {
                 if (details.FirstOrDefault(p => p.UID == det.UID) == null)
                 {
                     SpareOutController.RemaveDetail(db, det);
                 }
             }
             NotifyController.AddNotify(db, billPickFact.OperName, NotifyType.MaterialOutUpdate, billPickFact.BillNum, "");
         }
         BillController.AddOrUpdate(db, billPickFact);    //添加【原料拣料单】单据
         SpareOutController.AddOrUpdateList(db, details); //更新【实际拣料单】明细
         EntitiesFactory.SaveDb(db);
     }
 }
Exemplo n.º 8
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     try
     {
         bs.EndEdit();
         if (_bill.单据类型 != (int)BillType.MaterialAsk)
         {
             MessageHelper.ShowError("请输入有效的单据类型!申请单单据类型为:" + (int)BillType.MaterialAsk);
             return;
         }
         if (_bill.子单据类型 != (int)SubBillType.SpareLoan && _bill.子单据类型 != (int)SubBillType.SpareOut)
         {
             MessageHelper.ShowError("维护的子单据类型无效!领用出库类型为:" + (int)SubBillType.SpareOut + "借用出库类型为:" + (int)SubBillType.SpareLoan);
             return;
         }
         var detailList = (List <TB_ASK>)bs.DataSource;
         if (detailList.Count == 0)
         {
             MessageHelper.ShowError("请维护领用申请明细!");
             return;
         }
         var bill = _bill.VWToBill(GlobalVar.Oper.DeptCode);
         //List<TB_ASK> detailList = (from TB_ASK d in _list select d).ToList();
         SpareEntities db = EntitiesFactory.CreateSpareInstance();
         BillHandler.AddMaterialAsk(db, bill, detailList);
         EntitiesFactory.SaveDb(db);
         MessageHelper.ShowInfo("保存成功!");
     }
     catch (Exception ex)
     {
         MessageHelper.ShowInfo(ex.ToString());
     }
 }
Exemplo n.º 9
0
        public void ModifyPassword(TS_OPERATOR oper)
        {
            PowerEntities db = EntitiesFactory.CreatePowerInstance();

            OperController.AddOrModify(db, oper);
            EntitiesFactory.SaveDb(db);
        }
Exemplo n.º 10
0
 private void SaveData()
 {
     int iFind = -1;
     SpareEntities db = EntitiesFactory.CreateSpareInstance();
     for (int i = 0; i < gr.Length; i++)
     {
         if (gr[i].Check)
         {
             FileStream fs = new FileStream(gr[i].FullName, FileMode.Open, FileAccess.Read);
             UpdateControl.SaveFile2DB(db,"Update", gr[i].FileName, fs);
             iFind = servers.Find(gr[i].FileName);
             if (iFind >= 0)
             {
                 if (servers[iFind].ModifyDate < DateTime.Parse(gr[i].lModifyDate))
                 {
                     servers[iFind].ModifyDate = DateTime.Parse(gr[i].lModifyDate);
                     servers[iFind].FileSize = long.Parse(gr[i].lFileSize);
                 }
             }
             else
             {
                 UpdateItem item = new UpdateItem();
                 item.FileName = gr[i].FileName;
                 item.FileSize = long.Parse(gr[i].lFileSize);
                 item.ModifyDate = DateTime.Parse(gr[i].lModifyDate);
                 servers.Add(item);
             }
         }
     }
     UpdateControl.SaveObj(db,"Updates", "Updates", servers);
     EntitiesFactory.SaveDb(db);
     MessageHelper.ShowInfo("保存成功!");
     RefreshData();
 }
Exemplo n.º 11
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     try
     {
         bs.EndEdit();
         if (_bill.单据类型 != (int)BillType.SpareReturn)
         {
             MessageHelper.ShowError("请输入有效的单据类型!领用归还单据类型为:" + (int)BillType.SpareReturn);
             return;
         }
         var detailList = (List <TB_RETURN>)bs.DataSource;
         if (detailList.Count == 0)
         {
             MessageHelper.ShowError("请维护领用还回明细!");
             return;
         }
         //List<TB_RETURN> detailList = (from TB_RETURN d in _list select d).ToList();
         SpareEntities db = EntitiesFactory.CreateSpareInstance();
         BillHandler.AddMaterialReturn(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), detailList);
         EntitiesFactory.SaveDb(db);
         MessageHelper.ShowInfo("保存成功!");
     }
     catch (Exception ex)
     {
         MessageHelper.ShowInfo(ex.ToString());
     }
 }
Exemplo n.º 12
0
        public TS_OPERATOR Login(string operCode, string password)
        {
            PowerEntities db   = EntitiesFactory.CreatePowerInstance();
            var           oper = OperController.Login(db, operCode, password);

            //            if (oper != null) oper.State = LoginState.Online.ToString();
            EntitiesFactory.SaveDb(db);
            return(oper);
        }
Exemplo n.º 13
0
 private void CloseNotify()
 {
     if (_selectedData == null || _selectedData.UID == 0)
     {
         return;
     }
     NotifyController.CloseNotify(_db, GlobalVar.Oper.OperName, _selectedData);
     EntitiesFactory.SaveDb(_db);
     Init();
 }
Exemplo n.º 14
0
        private void BgwFromErpDoWork(object sender, DoWorkEventArgs e)
        {
            SpareEntities     db   = EntitiesFactory.CreateSpareInstance();
            InterfaceEntities OAdb = EntitiesFactory.CreateInterfaceInstance();

            ReadErpFiles(db);
            GetOAData(OAdb, db);
            EntitiesFactory.SaveDb(db);
            EntitiesFactory.SaveDb(OAdb);
        }
Exemplo n.º 15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (MessageHelper.ShowQuestion("确定要关闭所有提示吗?") != DialogResult.Yes)
            {
                return;
            }

            NotifyController.CloseNotifyList(_db, GlobalVar.Oper.OperName, _dataList);
            EntitiesFactory.SaveDb(_db);
            Init();
        }
Exemplo n.º 16
0
 private void ItemBtnApprove_Click(object sender, EventArgs e)
 {
     if (_bill == null || _bill.单据编号 == null)
     {
         MessageHelper.ShowInfo("请选择单据!");
         return;
     }
     BillController.UpdateState(_db, _bill.VWToBill(GlobalVar.Oper.DeptCode), BillState.Approve);
     EntitiesFactory.SaveDb(_db);
     NotifyController.AddNotify(_db, _bill.操作者, NotifyType.MaterialAskApprove, _bill.单据编号, "");
     MessageHelper.ShowInfo("审核通过!");
     SetMasterDataSource(1, grid.PageSize);
 }
Exemplo n.º 17
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                SpareEntities db = EntitiesFactory.CreateSpareInstance();
//            BillHandler.AddMaterialAsk(db,_bill, tList);
                EntitiesFactory.SaveDb(db);
            }
            catch (Exception ex)
            {
                MessageHelper.ShowInfo(ex.ToString());
            }
        }
Exemplo n.º 18
0
        public static void CloseNotify(int id, Form form)
        {
            var notify = NotifyList.SingleOrDefault(p => p.UID == id);

            if (notify == null)
            {
                return;
            }
            if (notify.State == (int)BillState.Finished)
            {
                return;
            }
            using (SpareEntities db = EntitiesFactory.CreateSpareInstance())
            {
                try
                {
                    NotifyController.CloseNotify(db, GlobalVar.Oper.OperName, notify);
                    EntitiesFactory.SaveDb(db);
                }
                catch (Exception ex)
                {
                    MessageHelper.ShowInfo(ex.ToString());
                }
            }
            NotifyType notifyType = (NotifyType)notify.NotifyType;
            var        formMain   = (FormMain)form;

            if (formMain == null)
            {
                return;
            }

            /*  switch (notifyType)
             * {
             *    case NotifyType.Ask:
             *        formMain.SetMdiForm("仓库申请单", typeof(FormWhseAskView));
             *        break;
             *    case NotifyType.Stock:
             *        formMain.SetMdiForm("仓库库存", typeof(FormStockProduct));
             *        break;
             *    case NotifyType.TransferSend:
             *        formMain.SetMdiForm("中转发运单", typeof(FormFactoryTransferSend));
             *        break;
             *    case NotifyType.DirectSend:
             *        formMain.SetMdiForm("直送发运单", typeof(FormFactoryDirectSend));
             *        break;
             *    case NotifyType.WhseSend:
             *        formMain.SetMdiForm("仓库发运单", typeof(FormWhseSend));
             *        break;
             * }*/
        }
Exemplo n.º 19
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtOperCode.Text == "")
                {
                    MessageHelper.ShowError("请输入人员编号!");
                    txtOperCode.Focus();
                    return;
                }
                TS_OPERATOR oper     = new TS_OPERATOR();
                string      operCode = txtOperCode.Text;
                string      password = EncryptHelper.Encrypt(txtPassword.Text);
                using (PowerEntities powerdb = EntitiesFactory.CreatePowerInstance())
                {
                    oper = OperController.Login(powerdb, operCode, password);
                    if (oper == null)
                    {
                        MessageHelper.ShowError("错误的用户名或密码,登录失败!");
                        txtOperCode.Focus();
                        txtOperCode.SelectAll();
                        return;
                    }
                    this.DialogResult = DialogResult.OK;
                    //EntitiesFactory.SaveDb(powerdb);
                    GlobalVar.Oper          = oper;
                    GlobalVar.PowerMenuList = PowerController.GetPowerMenuList(powerdb, GlobalVar.PortalCode,
                                                                               oper.OperCode);
                    GlobalVar.NotifytypeList = PowerController.GetNotiFyTypeList(powerdb, GlobalVar.PortalCode,
                                                                                 oper.OperCode);
                    GlobalBuffer.FactoryCode = GlobalVar.Oper.DeptCode;
                }

                using (SpareEntities wmsdb = EntitiesFactory.CreateSpareInstance())
                {
                    OperLogController.AddLog(wmsdb, LogType.Login, oper.OperName, operCode, "登录成功");

                    EntitiesFactory.SaveDb(wmsdb);
                    GlobalVar.InitGlobalVar(wmsdb, GlobalVar.Oper);
                }
            }
            catch (WmsException ex)
            {
                MessageHelper.ShowInfo(ex.ToString());
            }
            catch (Exception ex)
            {
                var inner = ex.InnerException;
                MessageHelper.ShowError((string.IsNullOrEmpty(inner?.Message)) ? ex : inner);
            }
        }
Exemplo n.º 20
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (txtOldPwd.Text.Trim() == string.Empty)
            {
                MessageHelper.ShowInfo("原密码不能为空");
                return;
            }
            if (txtNewPwd.Text.Trim() == string.Empty)
            {
                MessageHelper.ShowInfo("新密码不能为空");
                return;
            }
            if (txtNewPwd.Text.Length < 6 || txtNewPwd.Text.Length > 20)
            {
                MessageHelper.ShowInfo("新密码长度应该在6到20位之间");
                return;
            }

            if (txtNewPwd.Text != txtNewPwd2.Text)
            {
                MessageHelper.ShowInfo("两次输入的新密码不一致,请重新输入");
                return;
            }
            string enOldPwd = EncryptHelper.Encrypt(txtOldPwd.Text);

            if (enOldPwd != GlobalVar.Oper.OperPassword)
            {
                MessageHelper.ShowInfo("原密码输入错误");
                return;
            }
            if (enOldPwd == txtNewPwd.Text)
            {
                MessageHelper.ShowInfo("新密码不能与原密码相同");
                return;
            }
            string enNewPwd = EncryptHelper.Encrypt(txtNewPwd.Text);

            GlobalVar.Oper.OperPassword = enNewPwd;
            using (PowerEntities db = EntitiesFactory.CreatePowerInstance())
            {
                var oper_B = new TS_OPERATOR();
                oper_B.OperCode     = GlobalVar.Oper.OperCode;
                oper_B.OperName     = GlobalVar.Oper.OperName;
                oper_B.OperPassword = GlobalVar.Oper.OperPassword;
                OperController.AddOrModify(db, oper_B);
                MessageHelper.ShowInfo("密码修改成功");
                EntitiesFactory.SaveDb(db);
            }
            Close();
        }
Exemplo n.º 21
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     try
     {
         BillHandler.CancelMaterialAsk(_db, _bill.VWToBill(GlobalVar.Oper.DeptCode));
         NotifyController.AddNotify(_db, _bill.操作者, NotifyType.MaterialOutCancel, _bill.单据编号, "");
         EntitiesFactory.SaveDb(_db);
         SetMasterDataSource(grid.PageIndex, grid.PageSize);
     }
     catch (Exception ex)
     {
         MessageHelper.ShowError(ex.ToString());
     }
 }
Exemplo n.º 22
0
 public static string GetBillNum(BillType billType)
 {
     using (var db = EntitiesFactory.CreateSpareInstance())
     {
         var bt         = db.TA_BILLTYPE.SingleOrDefault(p => p.BillType == (int)billType);
         var rules      = bt.BillNumRule.Split('|');
         var sb         = CreateNewBillNum(rules, bt);
         var strBillNum = sb.TrimEnd(Separator);
         bt.LastNumber  += 1;
         bt.LastBillNum  = strBillNum;
         bt.LastBillTime = DateTime.Now;
         EntitiesFactory.SaveDb(db);
         return(strBillNum);
     }
 }
Exemplo n.º 23
0
 private void btnExecute_Click(object sender, EventArgs e)
 {
     if (_bill == null || _bill.单据编号 == null)
     {
         MessageHelper.ShowInfo("请选择单据!");
         return;
     }
     if (MessageHelper.ShowQuestion("确定要执行选定的领用还回单?") == DialogResult.Yes)
     {
         SpareEntities db = EntitiesFactory.CreateSpareInstance();
         BillHandler.ExecuteSpareReturn(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), (List <TB_RETURN>)(grid.Detail1DataSource));
         EntitiesFactory.SaveDb(db);
         MessageHelper.ShowInfo("保存成功!");
     }
 }
Exemplo n.º 24
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         bs.EndEdit();
         var           detailList = (List <TB_INVENTORY_DETAIL>)bs.DataSource;
         SpareEntities db         = EntitiesFactory.CreateSpareInstance();
         BillHandler.AddOrUpdateInventoryDetail(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), detailList);
         EntitiesFactory.SaveDb(db);
         MessageHelper.ShowInfo("保存成功!");
     }
     catch (Exception ex)
     {
         MessageHelper.ShowInfo(ex.ToString());
     }
 }
Exemplo n.º 25
0
        private void buttonItem1_Click(object sender, EventArgs e)
        {
            var tList = (BindingList <TS_ROLE_NOTIFYTYPE>)gridNotifyType.PrimaryGrid.DataSource;


            _db.TS_ROLE_NOTIFYTYPE.AddOrUpdate(p => new { p.RoleCode, p.PortalCode, p.NotifyType }, tList.ToArray());
            try
            {
                EntitiesFactory.SaveDb(_db);
                MessageHelper.ShowInfo("角色权限保存成功:" + _selectedData.RoleName);
                gridNotifyType.PrimaryGrid.ClearDirtyRowMarkers();
            }
            catch (Exception ex)
            {
                MessageHelper.ShowInfo(ex.ToString());
            }
        }
Exemplo n.º 26
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (_selectrow == null)
     {
         MessageHelper.ShowError("请选择要删除的附件!");
         return;
     }
     if (MessageHelper.ShowQuestion("确认要删除选中的附件吗?") == DialogResult.Yes)
     {
         SpareEntities db     = EntitiesFactory.CreateSpareInstance();
         var           attach = AttachController.GetList(_db).FirstOrDefault(p => p.UID == (int)_selectrow[gcUID].Value);
         AttachController.Delete(db, attach, GlobalVar.Oper);
         EntitiesFactory.SaveDb(db);
         MessageHelper.ShowInfo("删除成功!");
         RefreshData();
     }
 }
Exemplo n.º 27
0
 private void btnExecute_Click(object sender, EventArgs e)
 {
     if (_bill == null || _bill.单据编号 == null)
     {
         MessageHelper.ShowInfo("请选择单据!");
         return;
     }
     if (MessageHelper.ShowQuestion("确定要执行选定的领用还回单?") == DialogResult.Yes)
     {
         SpareEntities db         = EntitiesFactory.CreateSpareInstance();
         var           returnlist = db.TB_RETURN.Where(p => p.BillNum == _bill.单据编号).ToList();
         BillHandler.ExecuteSpareReturn(db, _bill.VWToBill(GlobalVar.Oper.DeptCode), returnlist);
         EntitiesFactory.SaveDb(db);
         NotifyController.AddStockSafeQty(db, GlobalVar.Oper.OperName);
         MessageHelper.ShowInfo("保存成功!");
     }
 }
Exemplo n.º 28
0
        /// <summary>
        ///     添加【原料收货单】
        /// </summary>
        /// <param name="db"></param>
        /// <param name="billList">原料收货单列表</param>
        /// <param name="detailList">原料收货明细列表</param>
        /// <returns></returns>
        public static void AddMaterialIn(SpareEntities db, List <TB_BILL> billList,
                                         List <TB_IN> detailList)
        {
            {
                foreach (var bill in billList)
                {
                    SetBillNum(bill);                                  //设置单据编号
                    detailList.ForEach(p => p.BillNum = bill.BillNum); //设置明细编号

                    BillController.AddOrUpdate(db, bill);              //添加【原料收货单】单据
                    SpareInController.AddList(db, detailList);         //添加【原料收货单】明细

                    var stockDetails = detailList.Select(detail => detail.ToStockDetailIn(bill)).ToList();
                    StockDetailController.ListIn(db, bill, stockDetails);  //更新【库存主表】【库存明细】
                }
                EntitiesFactory.SaveDb(db);
            }
        }
Exemplo n.º 29
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     try
     {
         if (_bill == null || _bill.单据编号 == null)
         {
             MessageHelper.ShowInfo("请选择单据!");
             return;
         }
         BillController.UpdateState(_db, _bill.VWToBill(GlobalVar.Oper.DeptCode), BillState.Cancelled);
         EntitiesFactory.SaveDb(_db);
         SetMasterDataSource(grid.PageIndex, grid.PageSize);
     }
     catch (Exception ex)
     {
         MessageHelper.ShowError(ex.ToString());
     }
 }
Exemplo n.º 30
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (_bill.State != (int)BillState.New)
                {
                    throw new WmsException(ResultCode.DataStateError, _bill.BillNum, "状态错误,不应为:" + _bill.State);
                }
                PoController.UpdateState(_db, _bill, BillState.Cancelled); //更新状态为:取消

                EntitiesFactory.SaveDb(_db);
                SetMasterDataSource(grid.PageSize);
            }
            catch (Exception ex)
            {
                MessageHelper.ShowError(ex.ToString());
            }
        }