Beispiel #1
0
        /// <summary>
        /// 删除库存
        /// </summary>
        /// <param name="manageID"></param>
        /// <returns></returns>
        public static bool DeleteStock(string palletCode)
        {
            View_StockListModel stockModel = bllViewStockList.GetModelByPalletCode(palletCode, EnumCellType.货位.ToString());

            if (stockModel == null)
            {
                return(false);
            }
            return(bllStock.Delete(stockModel.Stock_ID));
        }
Beispiel #2
0
        public bool InHouseResponse(List <View_PlanListModel> planList, ref string jsonStr, ref string reStr)
        {
            try
            {
                if (planList == null || planList.Count == 0)
                {
                    return(false);
                }
                InHouseOrderResponse inHouseResponse = new InHouseOrderResponse();//入库完成给erp反馈,否则没有货位信息
                inHouseResponse.wms_order_code = planList[0].Plan_Code;
                inHouseResponse.order_code     = Guid.NewGuid().ToString();
                if (planList[0].Plan_Create_Time != null)
                {
                    inHouseResponse.order_date = planList[0].Plan_Create_Time.ToString();
                }
                inHouseResponse.order_maker       = planList[0].Plan_From_User;
                inHouseResponse.order_voucherType = planList[0].Plan_List_Resever1;
                inHouseResponse.warehouse_code    = planList[0].Plan_Remark;
                WH_WareHouseModel house = bllWareHouse.GetModelByCode(planList[0].Plan_Remark);
                if (house != null)
                {
                    inHouseResponse.warehouse_name = house.WareHouse_Name;
                }
                List <InventoryInfo> inventoryInfoList = new List <InventoryInfo>();
                foreach (View_PlanListModel plan in planList)
                {
                    InventoryInfo inventoryInfo = new InventoryInfo();
                    inventoryInfo.serial = plan.Plan_List_Remark;//批次
                    View_StockListModel stock = bllViewStockList.GetModeByPlanListID(plan.Plan_List_ID);
                    if (stock != null)
                    {
                        inventoryInfo.inventory_code = stock.Cell_Code;
                        inventoryInfo.inventory_name = stock.Cell_Name + "-" + stock.Cell_Chlid_Position;
                    }
                    inventoryInfo.quantity = plan.Plan_List_Finished_Quantity;
                    inventoryInfo.serial   = plan.Plan_List_Remark;

                    inventoryInfoList.Add(inventoryInfo);
                }
                inHouseResponse.InventoryList = inventoryInfoList;
                reStr   = "获取成功!";
                jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(inHouseResponse);

                return(true);
            }
            catch (Exception ex)
            {
                reStr = ex.StackTrace;
                return(false);
            }
        }
Beispiel #3
0
        public bool InHouseResponse(List <View_PlanListModel> planList, ref string jsonStr, ref string reStr)
        {
            try
            {
                if (planList == null || planList.Count == 0)
                {
                    return(false);
                }
                InHouseOrderResponse inHouseResponse = new InHouseOrderResponse();//入库完成给erp反馈,否则没有货位信息
                inHouseResponse.erp_receipt_no = planList[0].Plan_Code;
                inHouseResponse.mes_receipt_no = Guid.NewGuid().ToString();
                if (planList[0].Plan_Create_Time != null)
                {
                    inHouseResponse.mes_into_date = planList[0].Plan_Create_Time.ToString();
                }
                View_StockListModel stockList = bllViewStockList.GetModeByPlanListID(planList[0].Plan_List_ID);//只有入库可这么查询,出库就没有库存了
                if (stockList != null)
                {
                    inHouseResponse.mes_warehouse_code = stockList.WareHouse_Code;
                }
                inHouseResponse.mes_creator      = planList[0].Plan_Operater;
                inHouseResponse.mes_receipt_type = planList[0].Plan_List_Resever1;

                List <InventoryInfo> inventoryInfoList = new List <InventoryInfo>();
                foreach (View_PlanListModel plan in planList)
                {
                    InventoryInfo inventoryInfo = new InventoryInfo();
                    inventoryInfo.mes_lot_no = plan.Plan_List_Remark;//批次
                    View_StockListModel stock = bllViewStockList.GetModeByPlanListID(plan.Plan_List_ID);
                    if (stock != null)
                    {
                        inventoryInfo.mes_materiel_code = stock.Goods_Code;
                        inventoryInfo.mes_unit          = stock.Goods_Unit;
                    }
                    inventoryInfo.mes_total_qty = plan.Plan_List_Finished_Quantity;

                    inventoryInfoList.Add(inventoryInfo);
                }
                inHouseResponse.backIntoDetails = inventoryInfoList;
                reStr   = "获取成功!";
                jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(inHouseResponse);

                return(true);
            }
            catch (Exception ex)
            {
                reStr = ex.StackTrace;
                return(false);
            }
        }
Beispiel #4
0
        public void GetCellDetailByPalletCode(string houseName, string palletCode)
        {
            WH_WareHouseModel house = bllHouse.GetModelByName(houseName);

            if (house == null)
            {
                this.View.ShowMessage("信息提示", "不存在此库房!");
                return;
            }
            View_StockListModel stockModel = bllViewStockList.GetModelByHousePallet(house.WareHouse_ID, palletCode, EnumCellType.货位.ToString());

            if (stockModel == null)
            {
                this.View.ShowMessage("信息提示", "无此托盘库存信息!");
                return;
            }
            GetGSDetail(stockModel.Cell_Child_ID);
            this.View.SetRowTxt(stockModel.Cell_Row.ToString());
            this.View.SetPosTxt(stockModel.Cell_Chlid_Position);
            this.View.GsSearch((int)stockModel.Cell_Column, (int)stockModel.Cell_Layer);
        }
        private bool UpateCellStatus(string palletCode, EnumGSOperate cellOperStatus, EnumGSTaskStatus taskStatus)
        {
            View_StockListModel stockModel = bllViewStockList.GetModelByPalletCode(palletCode, EnumCellType.货位.ToString());

            if (stockModel == null)
            {
                this.WmsFrame.WriteLog("下架逻辑", "", "提示", "更新货位状态时,没有找到所选物料库存!");
                return(false);
            }
            WH_Cell_ChildrenModel cellChildModel = bllCellChild.GetModel(stockModel.Cell_Child_ID);

            if (cellChildModel == null)
            {
                this.WmsFrame.WriteLog("下架逻辑", "", "提示", "更新货位状态时,没有找到所选物料货位!");
                return(false);
            }
            cellChildModel.Cell_Child_Run_Status   = taskStatus.ToString();
            cellChildModel.Cell_Child_Operate_Type = cellOperStatus.ToString();
            bllCellChild.Update(cellChildModel);
            this.WmsFrame.WriteLog("下架逻辑", "", "提示", "更新货位状态成功!");
            return(true);
        }
Beispiel #6
0
        public static bool CreateUnshelveManageTask(string planCode, string palletCode, string houseName, string unshelveStationName, ref string manageID, ref string restr)
        {
            ManageModel manage = new ManageModel();

            manage.Mange_CreateTime = DateTime.Now;
            WH_WareHouseModel wareHouse = bllWareHouse.GetModelByName(houseName);

            if (wareHouse == null)
            {
                restr = "库房名称错误!";
                return(false);
            }
            WH_Station_LogicModel targetCell = bllStationLogic.GetStationByName(wareHouse.WareHouse_ID, unshelveStationName);

            if (targetCell == null)
            {
                restr = "下架站台不存在!";
                return(false);
            }

            View_CellModel      startCell  = null;
            View_StockListModel stockModel = bllViewStockList.GetModelByPalletCode(palletCode, EnumCellType.货位.ToString());

            if (stockModel == null)
            {
                restr = "没有找到所选物料库存!";
                return(false);
            }
            startCell = bllViewCell.GetModelByWHAndCellName(stockModel.WareHouse_Name, stockModel.Cell_Name, stockModel.Cell_Chlid_Position);
            if (startCell == null)
            {
                restr = "没有找到所选物料货位!";
                return(false);
            }
            if (startCell.Shelf_Type == EnumShelfType.双深.ToString() && startCell.Cell_Chlid_Position == EnumCellPos.后.ToString())//双深工位如果选中前面的工位要判断后面是否有料
            {
                View_CellModel forwordCell = bllViewCell.GetCell(stockModel.WareHouse_ID, stockModel.Cell_Name, EnumCellPos.前.ToString());


                if (forwordCell != null && forwordCell.Cell_Child_Status == "空闲" && forwordCell.Cell_Child_Run_Status == "完成")//前面的已经出去了
                {
                }
                else
                {
                    restr = "双深工位出库需要先将外面的库存出库,再出库里面的!";
                    return(false);
                }
            }


            manage.Mange_ID = Guid.NewGuid().ToString();

            manage.Mange_Start_Cell_ID     = startCell.Cell_Chlid_ID;
            manage.Mange_End_Cell_ID       = targetCell.Cell_Child_ID;
            manage.Mange_Status            = EnumManageTaskStatus.待执行.ToString();
            manage.Manage_BreakDown_Status = "待分解";
            manage.Mange_Stock_Barcode     = palletCode;

            //manage.Mange_Type_ID = EnumManageTaskType.下架.ToString();
            manage.Mange_Type_ID = "8";//下架
            PlanMainModel planModel = null;

            if (planCode == "-1")
            {
                manage.Plan_ID = "-1";
            }
            else
            {
                planModel = bllPlan.GetModelByPlanCode(planCode);
                if (planModel == null)
                {
                    restr = "不存在此计划!";
                    return(false);
                }
                manage.Plan_ID = planModel.Plan_ID;
            }

            manageID = manage.Mange_ID;
            bllManage.Add(manage);

            bool status = CreateUnshelveManageListTask(planCode, manage.Mange_ID, palletCode, ref restr);

            if (status == true)
            {
                restr += "生成托盘[" + palletCode + "]下架任务成功:起点:" + startCell.WareHouse_Name + startCell.Cell_Name + startCell.Cell_Chlid_Position;
                EnumCellStatus cellStatus = (EnumCellStatus)Enum.Parse(typeof(EnumCellStatus), startCell.Cell_Child_Status);
                UpdateCellStatus(startCell.Cell_Chlid_ID, cellStatus, EnumGSTaskStatus.锁定, EnumGSOperate.出库);
                return(true);
            }
            else
            {
                restr += "生成托盘[" + palletCode + "]下架任务失败:起点:" + startCell.WareHouse_Name + startCell.Cell_Name + startCell.Cell_Chlid_Position;
                return(false);
            }
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="palletCode"></param>
        /// <param name="houseName"></param>
        /// <param name="putawayStationName"></param>
        /// <param name="isAssign"></param>
        /// <param name="targetStation"></param>
        /// <param name="taskType">任务类型</param>
        /// <param name="manageID"></param>
        /// <param name="restr"></param>
        /// <returns></returns>
        public static bool CreatePutawayManageTask(string palletCode, string houseName, string putawayStationName,
                                                   bool isAssign, string targetStation, EnumManageTaskType taskType, ref string manageID, ref string restr)
        {
            ManageModel manage = new ManageModel();

            manage.Mange_CreateTime = DateTime.Now;
            WH_WareHouseModel house = bllWareHouse.GetModelByName(houseName);

            if (house == null)
            {
                restr = "库房对象为空!";
                return(false);
            }
            WH_Station_LogicModel stationCell = bllStationLogic.GetStationByName(house.WareHouse_ID, putawayStationName);

            if (stationCell == null)
            {
                restr = "上架站台不存在!";
                return(false);
            }
            WH_WareHouseModel wareHouse = bllWareHouse.GetModelByName(houseName);

            if (wareHouse == null)
            {
                restr = "库房名称错误!";
                return(false);
            }
            View_StockListModel stock = bllViewStockList.GetModelByPalletCode(palletCode, EnumCellType.货位.ToString());

            if (stock != null)
            {
                restr = "库存中已经有此托盘条码!";
                return(false);
            }
            View_CellModel targetCell = null;

            if (isAssign == true)//分配货位要做校验
            {
                string[] targetPos = targetStation.Split('-');
                if (targetPos == null || targetPos.Length != 2)
                {
                    restr = "指定货位格式错误!";
                    return(false);
                }
                string cellName = targetPos[0];
                string cellPos  = targetPos[1];
                targetCell = bllViewCell.GetCell(wareHouse.WareHouse_ID, cellName, cellPos);
                if (targetCell == null || targetCell.Cell_Child_Status != EnumCellStatus.空闲.ToString() || targetCell.Cell_Child_Run_Status != EnumGSTaskStatus.完成.ToString())
                {
                    restr = "当前货位不可用!";
                    return(false);
                }
            }
            else
            {
                targetCell = bllViewCell.ApplyCell(wareHouse.WareHouse_ID);
            }

            if (targetCell == null)
            {
                restr = "库房已满,没有货位可以申请了!";
                return(false);
            }
            if (targetCell.Shelf_Type == EnumShelfType.双深.ToString() && targetCell.Cell_Chlid_Position == EnumCellPos.前.ToString())//双深工位如果选中前面的工位要判断后面是否有料
            {
                View_CellModel backCell = bllViewCell.GetCell(wareHouse.WareHouse_ID, targetCell.Cell_Name, EnumCellPos.后.ToString());


                if (backCell != null && backCell.Cell_Child_Run_Status == EnumGSTaskStatus.完成.ToString() && backCell.Cell_Child_Status == EnumCellStatus.空闲.ToString())
                {
                    restr = "此货位为双深工位 ,需要先送入后面的货位再入前面的货位!";
                    return(false);
                }
                if (backCell != null && backCell.Cell_Child_Run_Status == EnumGSTaskStatus.锁定.ToString())
                {
                    restr = "此货位为双深工位 ,需要先送入后面的货位再入前面的货位,后面的工位处于锁定状态!";
                    return(false);
                }
            }
            if (targetCell.Cell_Child_Run_Status != EnumGSTaskStatus.完成.ToString() && targetCell.Cell_Child_Status != EnumCellStatus.空闲.ToString())
            {
                restr = "指定货位已经被占用!";
                return(false);
            }

            manage.Mange_ID = Guid.NewGuid().ToString();

            manage.Mange_Start_Cell_ID     = stationCell.Cell_Child_ID;
            manage.Mange_End_Cell_ID       = targetCell.Cell_Chlid_ID;
            manage.Mange_Status            = EnumManageTaskStatus.待执行.ToString();
            manage.Manage_BreakDown_Status = "待分解";
            manage.Mange_Stock_Barcode     = palletCode;
            if (taskType == EnumManageTaskType.空托盘上架)
            {
                manage.Mange_Type_ID = "7";// EnumManageTaskType.空托盘上架.ToString();
            }
            else if (taskType == EnumManageTaskType.架)
            {
                manage.Mange_Type_ID = "6";//上架
            }
            else
            {
                restr = "任务类型错误!";
                return(false);
            }
            View_StockListModel vslm = bllViewStockList.GetModelByPalletCode(palletCode, EnumCellType.配盘工位.ToString());//

            if (vslm == null)
            {
                restr = "没有配盘,请查看!";
                return(false);
            }
            EnumOrderType orderType = EnumOrderType.计划;

            if (vslm.Plan_List_ID == "-1")//无计划的
            {
                manage.Plan_ID = "-1";
                orderType      = EnumOrderType.非计划;
            }
            else
            {
                orderType = EnumOrderType.计划;
                View_Plan_StockListModel plan = bllViewPalnStockList.GetModelByPalletCode(palletCode);
                if (plan == null)
                {
                    restr = "当前库存没有对应计划!";
                    return(false);
                }
                manage.Plan_ID = plan.Plan_ID;
            }
            manageID = manage.Mange_ID;
            bllManage.Add(manage);
            bool status = CreatePutawayManageListTask(manage.Mange_ID, orderType, palletCode, ref restr);

            if (status == true)
            {
                restr += "生成托盘[" + palletCode + "]上架任务成功:终点:" + houseName + targetCell.Cell_Name + targetCell.Cell_Chlid_Position;
                UpdateCellStatus(targetCell.Cell_Chlid_ID, EnumCellStatus.空闲, EnumGSTaskStatus.锁定, EnumGSOperate.入库);
                return(true);
            }
            else
            {
                restr += "生成托盘[" + palletCode + "]上架任务失败:终点:" + houseName + targetCell.Cell_Name + targetCell.Cell_Chlid_Position;
                return(false);
            }
        }