コード例 #1
0
        private void dgvStoreList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Action act = () =>
            {
                if (e.RowIndex >= 0)
                {
                    var curCell = dgvStoreList.Rows[e.RowIndex].Cells[e.ColumnIndex];
                    ViewStoreInfoModel storeInfo = dgvStoreList.Rows[e.RowIndex].DataBoundItem as ViewStoreInfoModel;
                    string             cellVal   = curCell.FormattedValue.ToString();
                    switch (cellVal)
                    {
                    case "修改":
                        ShowStoreInfoPage(2, storeInfo.StoreId);
                        break;

                    case "删除":
                        DeleteStoreInfo(1, storeInfo);
                        break;

                    case "恢复":
                        DeleteStoreInfo(0, storeInfo);
                        break;

                    case "移除":
                        DeleteStoreInfo(2, storeInfo);
                        break;
                    }
                }
            };

            act.TryCatch("操作单位信息数据异常!");
        }
コード例 #2
0
 /// <summary>
 /// 详情
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsbtnInfo_Click(object sender, EventArgs e)
 {
     if (dgvStoreList.CurrentRow != null)
     {
         ViewStoreInfoModel storeInfo = dgvStoreList.CurrentRow.DataBoundItem as ViewStoreInfoModel;
         if (storeInfo != null)
         {
             ShowStoreInfoPage(4, storeInfo.StoreId);
         }
     }
     else
     {
         MsgBoxHelper.MsgErrorShow("请选择要查看的仓库信息!");
         return;
     }
 }
コード例 #3
0
        /// <summary>
        /// 仓库信息删除处理(删除、恢复、移除)
        /// </summary>
        /// <param name="v"></param>
        /// <param name="storeInfo"></param>
        private void DeleteStoreInfo(int isDeleted, ViewStoreInfoModel storeInfo)
        {
            string delTypeName = FormUtility.GetDeleteTypeName(isDeleted);
            string msgTitle    = $"仓库信息{delTypeName}";

            if (MsgBoxHelper.MsgBoxConfirm(msgTitle, $"您确定要{delTypeName}该仓库信息?") == DialogResult.Yes)
            {
                bool bl = false;
                switch (isDeleted)
                {
                case 1:    //删除
                           //如果仓库在使用中,不允许删除
                    bool isStoreUse = RequestStar.CheckStoreUse(storeInfo.StoreId);
                    if (!isStoreUse)
                    {
                        bl = RequestStar.DeleteStoreInfo(storeInfo.StoreId);
                    }
                    else
                    {
                        MsgBoxHelper.MsgErrorShow($"该仓库:{storeInfo.StoreName} 在使用中,不能删除!");
                        return;
                    }
                    break;

                case 0:    //恢复
                    bl = RequestStar.RecoverStoreInfo(storeInfo.StoreId, uName);
                    break;

                case 2:    //移除
                    bl = RequestStar.RemoveStoreInfo(storeInfo.StoreId);
                    break;
                }
                string sucType = bl ? "成功" : "失败";
                string delMsg  = $"仓库信息:{storeInfo.StoreName} {delTypeName} {sucType}";
                if (bl)
                {
                    MsgBoxHelper.MsgBoxShow(msgTitle, delMsg);
                    LoadStoreList();
                }
                else
                {
                    MsgBoxHelper.MsgErrorShow(delMsg);
                    return;
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// 仓库信息批量删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbtnDelete_Click(object sender, EventArgs e)
        {
            Action act = () =>
            {
                //SelectedRows 选定行的集合(MultiSelect True )  多个行
                if (dgvStoreList.SelectedRows.Count == 0)
                {
                    MsgBoxHelper.MsgErrorShow("请选择要删除的仓库信息");
                    return;
                }
                string title = "删除仓库信息";
                if (MsgBoxHelper.MsgBoxConfirm(title, "您确定要删除选择的这些仓库信息吗?") == DialogResult.Yes)
                {
                    List <int> storeIds        = new List <int>();
                    string     IsUseStoreNames = "";
                    foreach (DataGridViewRow row in dgvStoreList.SelectedRows)
                    {
                        ViewStoreInfoModel sInfo = row.DataBoundItem as ViewStoreInfoModel;
                        //如果该类别添加了仓库,不允许删除
                        bool isStoreUsee = RequestStar.CheckStoreUse(sInfo.StoreId);
                        if (!isStoreUsee)
                        {
                            storeIds.Add(sInfo.StoreId);
                        }
                        else
                        {
                            if (IsUseStoreNames.Length > 0)
                            {
                                IsUseStoreNames += ",";
                            }
                            IsUseStoreNames += sInfo.StoreName;
                        }
                    }
                    if (storeIds.Count > 0)
                    {
                        bool   bl     = RequestStar.DeleteStoreInfos(storeIds);//执行批量删除
                        string sucMsg = bl ? "成功" : "失败";
                        string msg    = $"选择的仓库信息中符合删除要求的信息 删除 {sucMsg}!";

                        if (bl)
                        {
                            if (!string.IsNullOrEmpty(IsUseStoreNames))
                            {
                                msg += $" {IsUseStoreNames} 已经使用,不能删除!";
                            }
                            MsgBoxHelper.MsgBoxShow(title, msg);
                            LoadStoreList();
                        }
                        else
                        {
                            MsgBoxHelper.MsgErrorShow(msg);
                        }
                    }
                    else
                    {
                        MsgBoxHelper.MsgErrorShow("没有符合删除要求的仓库信息!");
                    }
                }
            };

            act.TryCatch("批量删除仓库信息异常!");
        }
コード例 #5
0
ファイル: FrmChooseStores.cs プロジェクト: mosdong/PSI
        /// <summary>
        /// 选择仓库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChoose_Click(object sender, EventArgs e)
        {
            ViewStoreInfoModel selInfo = null;

            if (dgvStoreList.SelectedRows.Count == 0)
            {
                selInfo = dgvStoreList.Rows[0].DataBoundItem as ViewStoreInfoModel;
            }
            else
            {
                selInfo = dgvStoreList.SelectedRows[0].DataBoundItem as ViewStoreInfoModel;
            }

            StoreInfoModel storeInfo = new StoreInfoModel()
            {
                StoreId   = selInfo.StoreId,
                StoreName = selInfo.StoreName
            };

            //typecode   区分要返回的页面
            switch (typeName)
            {
            case "Store-StartStock":    //期初入库单页面
                FrmStartStockInfo fStartStockInfo = cModel.FGet as FrmStartStockInfo;
                fStartStockInfo.store = storeInfo;
                break;

            case "Store-PerchaseInStore":    //采购单页面
                FrmPerchaseInStore fPerchaseInStoreInfo = cModel.FGet as FrmPerchaseInStore;
                fPerchaseInStoreInfo.store = storeInfo;
                break;

            case "Store-SaleOutStore":    //销售单页面
                FrmSaleOutStore fSaleOutStoreInfo = cModel.FGet as FrmSaleOutStore;
                fSaleOutStoreInfo.store = storeInfo;
                break;

            case "Store-SheetQuery":    //单据选择页面
                FrmSheetQuery fSheetQuery = cModel.FGet as FrmSheetQuery;
                fSheetQuery.store = storeInfo;
                break;

            case "Store-PerQueryBySupplier":    //采购统计按供应商选择页面
                FrmPerchaseQueryBySupplier fPerBySupplier = cModel.FGet as FrmPerchaseQueryBySupplier;
                fPerBySupplier.store = storeInfo;
                break;

            case "Store-PerQueryByStore":    //采购统计按仓库选择页面
                FrmPerchaseQueryByStore fPerByStore = cModel.FGet as FrmPerchaseQueryByStore;
                fPerByStore.store = storeInfo;
                break;

            case "Store-PerQueryByGoods":    //采购统计按商品选择页面
                FrmPerchaseQueryByGoods fPerByGoods = cModel.FGet as FrmPerchaseQueryByGoods;
                fPerByGoods.store = storeInfo;
                break;

            case "Store-SaleQueryByCustomer":    //销售统计按客户选择页面
                FrmSaleQueryByCustomer fSaleByCustomer = cModel.FGet as FrmSaleQueryByCustomer;
                fSaleByCustomer.store = storeInfo;
                break;

            case "Store-SaleQueryByStore":    //销售统计按客户选择页面
                FrmSaleQueryByStore fSaleByStore = cModel.FGet as FrmSaleQueryByStore;
                fSaleByStore.store = storeInfo;
                break;

            case "Store-SaleQueryByGoods":    //销售统计按商品选择页面
                FrmSaleQueryByGoods fSaleByGoods = cModel.FGet as FrmSaleQueryByGoods;
                fSaleByGoods.store = storeInfo;
                break;

            case "Store-StoreStockQuery":    //仓库库存查询页面
                FrmStoreStockQuery fStoreStockQuery = cModel.FGet as FrmStoreStockQuery;
                fStoreStockQuery.store = storeInfo;
                break;
            }
            this.SetStore?.Invoke();
            this.Close();
        }