Beispiel #1
0
        /// <summary>
        /// 删除收料计划,只有在待执行的时候可以删除
        /// </summary>
        /// <param name="planCode"></param>
        /// <returns></returns>
        public ResponseData DeletePlan(string planCode)
        {
            ResponseData response = new ResponseData();

            try
            {
                PlanMainModel plan = bllPlan.GetModelByPlanCode(planCode);
                if (plan == null)
                {
                    response.Status   = false;
                    response.Describe = "不存在:[" + planCode + "]计划";
                    return(response);
                }
                if (plan.Plan_Status == EnumPlanStatus.执行中.ToString())
                {
                    response.Status   = false;
                    response.Describe = "收料计划已经在执行中不允许删除!";
                    return(response);
                }
                bllPlan.Delete(plan.Plan_ID);
                response.Status   = true;
                response.Describe = "收料计划删除成功!";
                return(response);
            }
            catch (Exception ex)
            {
                response.Status   = false;
                response.Describe = "收料计划删除失败:" + ex.Message;
                return(response);
            }
        }
Beispiel #2
0
        public void AddPlan(string planCode, string planTypeName, string planPerson, DateTime planDate, string remark)
        {
            try
            {
                Plan_TypeModel planType = bllPlanType.GetModelByName(planTypeName);
                if (planType == null)
                {
                    this.View.ShowMessage("信息提示", "计划类型错误!");
                    return;
                }
                if (ViewDataManager.PLANINPUTDATA.PlanListData.Count() == 0)
                {
                    this.View.ShowMessage("信息提示", "请为计划添加物料信息!");
                    return;
                }
                PlanMainModel checkPlan = bllPlan.GetModelByPlanCode(planCode);
                if (checkPlan != null)
                {
                    this.View.ShowMessage("信息提示", "计划编号已存在:[" + planCode + "]");
                    return;
                }

                PlanMainModel plan = new PlanMainModel();

                plan.Plan_Code        = planCode;
                plan.Plan_ID          = Guid.NewGuid().ToString();
                plan.Plan_Type_ID     = planType.Plan_Type_ID;
                plan.Plan_Create_Time = planDate;
                plan.Plan_Status      = EnumPlanStatus.待执行.ToString();
                plan.Plan_Operater    = planPerson;
                plan.Plan_Remark      = remark;

                bllPlan.Add(plan);
                foreach (PlanListModel goods in ViewDataManager.PLANINPUTDATA.PlanListData)
                {
                    Plan_ListModel planList   = new Plan_ListModel();
                    GoodsModel     goodsModel = bllGoods.GetModelByCode(goods.物料编码);
                    if (goods == null)
                    {
                        this.WmsFrame.WriteLog("PlanInputPresenter", "", "错误", "物料编码错误!");
                        return;
                    }
                    planList.Goods_ID = goodsModel.Goods_ID;
                    planList.Plan_ID  = plan.Plan_ID;
                    planList.Plan_List_Finished_Quantity = "0";
                    planList.Plan_List_ID = Guid.NewGuid().ToString();
                    planList.Plan_List_Ordered_Quantity = "0";
                    planList.Plan_List_Quantity         = goods.计划数量;
                    bllPlanList.Add(planList);
                }
                this.View.ShowMessage("信息提示", "计划添加成功!");
                ViewDataManager.PLANINPUTDATA.PlanListData.Clear();//添加计划口清空计划列表
            }
            catch (Exception ex)
            {
                this.View.ShowMessage("信息提示", "计划添加失败!" + ex.Message);
            }
        }
Beispiel #3
0
        public void CompletePlanManual(string planCode)
        {
            PlanMainModel plan = bllPlan.GetModelByPlanCode(planCode);

            if (plan == null)
            {
                this.View.ShowMessage("信息提示", "");
                return;
            }
            plan.Plan_Status = EnumPlanStatus.完成.ToString();
            bllPlan.Update(plan);
            this.WmsFrame.WriteLog("代办工作逻辑", "", "提示", "计划手动完成成功!");
            QueryPlan(this.querySDate, this.queryEDate, this.queryPlanType, this.queryPlanCode);
        }
Beispiel #4
0
        public static bool UpdatePlanStatus(string planID, EnumPlanStatus planStatus)
        {
            PlanMainModel planModel = bllPlan.GetModel(planID);

            if (planModel == null)
            {
                return(false);
            }
            planModel.Plan_Status = planStatus.ToString();
            if (planStatus == EnumPlanStatus.完成)
            {
                planModel.Plan_End_Time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            bllPlan.Update(planModel);
            return(true);
        }
Beispiel #5
0
        public void DeletePlanList(string planCode)
        {
            if (this.View.AskMessage("询问", "您确定要删除此计划么?") != 0)
            {
                return;
            }
            PlanMainModel planModel = bllPlan.GetModelByPlanCode(planCode);

            if (planModel == null)
            {
                return;
            }
            if (planModel.Plan_Status != EnumPlanStatus.待执行.ToString())
            {
                this.View.ShowMessage("提示", "只有待执行的计划可以删除!");
                return;
            }
            bllPlan.Delete(planModel.Plan_ID);
            QueryPlan(this.querySDate, this.queryEDate, this.queryPlanType, this.queryPlanCode);
        }
Beispiel #6
0
        public void ExePlan(string planCode)
        {
            PlanMainModel planModel = bllPlan.GetModelByPlanCode(planCode);

            if (planModel != null && planModel.Plan_Status == EnumPlanStatus.待执行.ToString())
            {
                planModel.Plan_Status     = EnumPlanStatus.执行中.ToString();
                planModel.Plan_Begin_Time = DateTime.Now;
                Plan_TypeModel plantype = bllPlanType.GetModel(planModel.Plan_Type_ID);
                if (plantype == null)
                {
                    this.View.ShowMessage("信息提示", "计划类型错误!");
                    return;
                }
                bllPlan.Update(planModel);
                this.WmsFrame.WriteLog("待办工作", "", "提示", "计划[" + planModel.Plan_Code + "],计划名称:" + plantype.Plan_Type_Name + ",开始执行!");
            }
            else
            {
                this.WmsFrame.WriteLog("待办工作", "", "提示", "只有状态为【待执行】的任务可以执行!");
            }
            QueryPlan(this.querySDate, this.queryEDate, this.queryPlanType, this.queryPlanCode);
        }
Beispiel #7
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 #8
0
        //private void PutwayEventHandler(object sender,PutwayEventArgs e)
        //{
        //  View_Plan_StockListModel planStock =  bllViewPlanStockList.GetModelByPalletCode(e.PalletCode);

        //}
        public bool AddExternPlan(string planCode, string planTypeName, string planPerson, DateTime planDate, string warehouseCode, List <PlanListModel> planDetailList, string planTypeReserve, ref string restr)
        {
            try
            {
                Plan_TypeModel planType = bllPlanType.GetModelByName(planTypeName);
                if (planType == null)
                {
                    restr = "计划类型错误!";
                    return(false);
                }
                if (planDetailList == null || planDetailList.Count == 0)
                {
                    restr = "请为计划添加物料信息!";
                    return(false);
                }
                PlanMainModel checkPlan = bllPlan.GetModelByPlanCode(planCode);
                if (checkPlan != null)
                {
                    restr = "计划编号已存在:[" + planCode + "]";
                    return(false);
                }
                if (planDetailList == null)
                {
                    return(false);
                }
                foreach (PlanListModel goods in planDetailList)
                {
                    Plan_ListModel planList   = new Plan_ListModel();
                    GoodsModel     goodsModel = bllGoods.GetModelByCode(goods.物料编码);
                    if (goodsModel == null)
                    {
                        restr = "物料编码错误!";
                        return(false);
                    }
                }
                PlanMainModel plan = new PlanMainModel();

                plan.Plan_Code        = planCode;
                plan.Plan_ID          = Guid.NewGuid().ToString();
                plan.Plan_Type_ID     = planType.Plan_Type_ID;
                plan.Plan_Create_Time = planDate;
                plan.Plan_Status      = EnumPlanStatus.待执行.ToString();
                plan.Plan_Operater    = planPerson;
                plan.Plan_Remark      = warehouseCode;
                bllPlan.Add(plan);

                foreach (PlanListModel goods in planDetailList)
                {
                    Plan_ListModel planList   = new Plan_ListModel();
                    GoodsModel     goodsModel = bllGoods.GetModelByCode(goods.物料编码);
                    if (goodsModel == null)
                    {
                        restr = "物料编码错误!";
                        return(false);
                    }
                    planList.Goods_ID = goodsModel.Goods_ID;
                    planList.Plan_ID  = plan.Plan_ID;
                    planList.Plan_List_Finished_Quantity = "0";
                    planList.Plan_List_ID = Guid.NewGuid().ToString();
                    planList.Plan_List_Ordered_Quantity = "0";
                    planList.Plan_List_Quantity         = goods.计划数量;
                    planList.Plan_List_Remark           = goods.物料批次;
                    planList.Plan_List_Resever1         = planTypeReserve;//订单类型描述
                    bllPlanList.Add(planList);
                }

                return(true);
            }
            catch (Exception ex)
            {
                restr = "计划添加失败" + ex.StackTrace.ToString();
                return(false);
            }
        }
Beispiel #9
0
        /// <summary>
        /// 收料通知
        /// </summary>
        /// <param name="plan">计划</param>
        /// <param name="planList">计划详细</param>
        /// <returns></returns>

        public ResponseData ReceiveGoodsPlan(Plan plan, List <PlanList> planList)
        {
            ResponseData response = new ResponseData();

            try
            {
                if (plan == null)
                {
                    response.Status   = false;
                    response.Describe = "计划单据对象为空!";
                    return(response);
                }
                if (planList == null)
                {
                    response.Status   = false;
                    response.Describe = "计划单据详单为空!";
                    return(response);
                }

                PlanMainModel planMainModel = bllPlan.GetModelByPlanCode(plan.PlanCode);
                if (planMainModel != null)
                {
                    bllPlan.DeleteByPlanCode(planMainModel.Plan_Code);
                }
                planMainModel         = new PlanMainModel();
                planMainModel.Plan_ID = Guid.NewGuid().ToString();

                planMainModel.Plan_Create_Time = DateTime.Now;
                planMainModel.Plan_Remark      = plan.Payee;
                planMainModel.Plan_Code        = plan.PlanCode;

                Plan_TypeModel planTypeModel = bllPlanType.GetModelByCode(plan.PlanType);

                if (planTypeModel == null)
                {
                    response.Status   = false;
                    response.Describe = "不存在[" + plan.PlanCode + "]类型计划!";
                    return(response);
                }

                planMainModel.Plan_Type_ID = planTypeModel.Plan_Type_ID;
                DateTime recDate       = DateTime.Now;
                bool     recDataStatus = DateTime.TryParse(plan.RecvDateTime, out recDate);
                if (recDataStatus == true)
                {
                    planMainModel.Plan_Bill_Time = recDate;
                }
                else
                {
                    response.Status   = false;
                    response.Describe = "收料时间格式错误!" + plan.RecvDateTime;
                    return(response);
                }

                planMainModel.Plan_From_User = plan.Settlement;
                planMainModel.Plan_Reserve1  = plan.SettlementGroup;
                planMainModel.Plan_From_Dept = plan.Supplyer;
                planMainModel.Plan_Status    = EnumPlanStatus.待执行.ToString();
                bllPlan.UpdatePlan(planMainModel);

                foreach (PlanList pl in planList)
                {
                    Plan_ListModel planListModel = new Plan_ListModel();
                    planListModel.Plan_ID      = planMainModel.Plan_ID;
                    planListModel.Plan_List_ID = Guid.NewGuid().ToString();
                    planListModel.Plan_List_Ordered_Quantity  = "0";
                    planListModel.Plan_List_Quantity          = pl.RecvNum;
                    planListModel.Plan_List_Finished_Quantity = "0";
                    planListModel.Plan_List_Remark            = pl.NeedCheck.ToString();

                    GoodsModel goods = bllGoods.GetModelByCode(pl.GoodsCode);
                    if (goods == null)
                    {
                        response.Status   = false;
                        response.Describe = "不存在[" + pl.GoodsCode + "]物料!";
                        return(response);
                    }

                    planListModel.Goods_ID           = goods.Goods_ID;
                    planListModel.Plan_List_Resever1 = pl.NeedGroup + "," + pl.RecvUnit + "," + pl.StockUnit;
                    planListModel.Plan_List_Resever2 = pl.Sum + "," + pl.UnitPrice + "," + pl.ValuationUnit;

                    bllPlanList.Add(planListModel);
                }


                response.Status   = true;
                response.Describe = "收料成功!";
                return(response);
            }
            catch (Exception ex)
            {
                response.Status   = false;
                response.Describe = "收料失败:" + ex.Message;
                return(response);
            }
        }