private void DeleteTrayEventHandler(object sender, TrayEventArgs e)
        {
            if (e.GsRunStatus != EnumGSRunStatus.任务完成.ToString())
            {
                this.View.ShowMessage("信息提示", "货位正在运行不允许删除料框信息!");
                return;
            }
            int ask = this.View.AskMessBox("您确定要删除条码为:" + e.TrayID + "的料框信息么?");

            //this.mainPre.ShowLog(EnumLogCategory
            if (ask == 0)
            {
                StockDetailModel deleteStockDetailModel = bllStockDetail.GetModelByTrayID(e.TrayID);
                bool             status = bllStockDetail.DeteleModelByTrayID(e.TrayID);
                if (status)
                {
                    this.View.ShowMessage("信息提示", "删除料框信息成功!");
                }
                this.mainPre.View.AddLog(EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",删除条码+" + e.TrayID
                                         + ",货位号:" + e.GoodsSiteName);

                //库存删掉后要清空库存和货位状态,只有任务完成的时候才可以删除此时只需更新库存状态和货位状态
                if (deleteStockDetailModel == null)
                {
                    this.View.ShowMessage("信息提示", "料框详细为空!!");
                    return;
                }
                StockListModel deleteStockListModel = bllStockList.GetModel(deleteStockDetailModel.StockListID);

                if (deleteStockListModel == null)
                {
                    this.View.ShowMessage("信息提示", "库存列表信息为空!!");
                    return;
                }

                StockModel deleteStockModel = bllStock.GetModel(deleteStockListModel.StockID);
                if (deleteStockModel == null)
                {
                    return;
                }
                List <StockDetailModel> stockDetailList = bllStockDetail.GetDetailModelList(deleteStockListModel.StockListID);//查询当前库存料框所有
                if (stockDetailList == null || stockDetailList.Count == 0)
                {
                    bllStock.Delete(deleteStockListModel.StockID);

                    bllGoodsSite.UpdateGoodsSiteStatus(EnumGSStoreStatus.空货位.ToString(), EnumGSRunStatus.待用.ToString(), EnumTaskCategory.出入库.ToString(), deleteStockModel.GoodsSiteID);
                    this.View.RefreshGoodsSite();
                }

                RefreshStockDetail(currentSelectGSID);
                //this.View.RefreshStorage();
            }
        }
        private void AddTrayEventHandler(object sender, TrayEventArgs e)
        {
            if (e.GsRunStatus != EnumGSRunStatus.任务完成.ToString())
            {
                this.View.ShowMessage("信息提示", "货位正在运行不允许添加料框信息!");
                return;
            }
            if (this.currentSelectGSID != 999999)
            {
                View_QueryStockListModel viewStockListModel = bllView_QueryStockList.GetModelByGSID(currentSelectGSID);
                if (viewStockListModel != null)
                {
                    TB_Tray_indexModel trayModel = bllTrayIndex.GetModel(e.TrayID);
                    if (trayModel == null)
                    {
                        this.View.ShowMessage("信息提示", "条码在数据库不存在!");
                        return;
                    }
                    if (currStockListModel != null)
                    {
                        List <StockDetailModel> stockDetailList = bllStockDetail.GetDetailModelList(currStockListModel.StockListID);
                        if (stockDetailList != null)
                        {
                            if (viewStockListModel.StoreHouseName == EnumStoreHouse.A1库房.ToString())
                            {
                                if (stockDetailList.Count >= 2)
                                {
                                    this.View.ShowMessage("信息提示", "A库房每个货位只能存储2个料框!");
                                    return;
                                }
                            }
                            else if (viewStockListModel.StoreHouseName == EnumStoreHouse.B1库房.ToString())
                            {
                                if (stockDetailList.Count >= 6)
                                {
                                    this.View.ShowMessage("信息提示", "B库房每个货位只能存储6个料框!");
                                    return;
                                }
                            }

                            bool isTheSame = true;
                            for (int i = 0; i < stockDetailList.Count; i++)
                            {
                                TB_Tray_indexModel existTrayModel = bllTrayIndex.GetModel(stockDetailList[i].TrayID);
                                if (existTrayModel.Tf_BatchID != trayModel.Tf_BatchID)
                                {
                                    isTheSame = false;
                                    this.View.ShowMessage("信息提示", "您添加的托盘号所属批次号与现有库存的托盘批次不一致!若您要添加请将现有库存的托盘删除!");
                                    break;
                                }
                            }
                            if (isTheSame == false)
                            {
                                return;
                            }
                        }
                    }

                    StockDetailModel stockDetailModel = new StockDetailModel();
                    stockDetailModel.TrayID      = e.TrayID;
                    stockDetailModel.StockListID = viewStockListModel.StockListID;
                    bllStockDetail.Add(stockDetailModel);

                    currStockListModel.ProductBatchNum = trayModel.Tf_BatchID;
                    bllStockList.Update(currStockListModel);//更新库存列表

                    RefreshStockDetail(currentSelectGSID);
                    this.mainPre.View.AddLog(EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",添加条码+" + trayModel.Tf_TrayId
                                             + ",货位号:" + viewStockListModel.GoodsSiteName);
                }
                else
                {
                    this.View.ShowMessage("信息提示", "此货位没有库存信息!");
                }
            }
            else
            {
                this.View.ShowMessage("信息提示", "请选择要添加料框的货位!");
            }
        }
Exemple #3
0
        private void TrayDetailEventHandler(object sender, TrayEventArgs e)
        {
            List <TB_After_GradeDataModel> coreModelList = bllAfterGradeData.GetListByTrayCode(e.TrayID);

            this.View.ShowTrayDetail(coreModelList);
        }