public static bool UpdatePlanCompleteNum(string manageID) { List <View_ManageStockListModel> stockList = bllViewManageStockList.GetModelListByManageID(manageID); if (stockList == null) { return(false); } foreach (View_ManageStockListModel manageStock in stockList) { List <View_PlanListModel> planList = bllViewPlanList.GetModelListByPlanAndGoodsID(manageStock.Plan_ID, manageStock.Goods_ID); if (planList == null) { return(false); } foreach (View_PlanListModel pl in planList) { Plan_ListModel plm = bllPlanList.GetModel(pl.Plan_List_ID); plm.Plan_List_Finished_Quantity = (float.Parse(plm.Plan_List_Finished_Quantity) + float.Parse(manageStock.Manage_List_Quantity)).ToString(); //plm.Plan_List_Ordered_Quantity = (int.Parse(plm.Plan_List_Ordered_Quantity) - int.Parse(manageStock.Manage_List_Quantity)).ToString(); bllPlanList.Update(plm); } } return(true); }
private static bool CreatePutawayManageListTask(string manageID, EnumOrderType orderType, string palletCode, ref string restr) { List <View_StockListModel> stockList = bllViewStockList.GetModelListByPalletCode(palletCode, EnumCellType.配盘工位.ToString()); if (stockList == null) { restr = "储存为空!"; return(false); } foreach (View_StockListModel stock in stockList) { Manage_ListModel manageListModel = new Manage_ListModel(); if (orderType == EnumOrderType.计划) { Plan_ListModel planList = bllPlanList.GetModel(stock.Plan_List_ID); planList.Plan_List_Ordered_Quantity = stock.Stock_List_Quantity; bllPlanList.Update(planList); } manageListModel.Manage_List_ID = Guid.NewGuid().ToString(); manageListModel.Manage_List_Quantity = stock.Stock_List_Quantity; manageListModel.Mange_ID = manageID; manageListModel.Stock_List_ID = stock.Stock_List_ID; bllManageList.Add(manageListModel); } return(true); }
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); } }
private bool UpdatePlanNum(string planListID, string materialCode, float materialNum, ref string restr) { Plan_ListModel planListModel = bllPlanList.GetModel(planListID); if (planListModel == null) { restr = "计划列表编码错误:" + planListID; return(false); } float orderNum = 0; if (planListModel.Plan_List_Ordered_Quantity.Trim() != "") { orderNum = int.Parse(planListModel.Plan_List_Ordered_Quantity); } orderNum += materialNum; planListModel.Plan_List_Ordered_Quantity = orderNum.ToString(); bllPlanList.Update(planListModel); return(true); }
/// <summary> /// 某物料的下达数量大于计划数量 /// </summary> /// <param name="planListID"></param> /// <returns></returns> public static bool IsOrderNumBiggerThanPlan(string planListID, string num) { try { Plan_ListModel planList = bllPlanList.GetModel(planListID); if (planList == null) { return(true); } if (float.Parse(planList.Plan_List_Ordered_Quantity) + float.Parse(num) > float.Parse(planList.Plan_List_Quantity)) { return(true); } else { return(false); } } catch { return(true); } }
public static bool CreateMoveManageTask(string startCellID, string endCellID, ref string restr) { View_CellModel startCell = bllViewCell.GetModelByChildCellID(startCellID); if (startCell == null) { restr = "起始货位为空!"; return(false); } View_CellModel endCell = bllViewCell.GetModelByChildCellID(endCellID); if (endCell == null) { restr = "终止货位为空!"; return(false); } if (startCell.Cell_Child_Status != EnumCellStatus.满位.ToString() || startCell.Cell_Child_Run_Status != EnumGSTaskStatus.完成.ToString()) { restr = "起始货位状态错误,不能移库!"; return(false); } if (endCell.Cell_Child_Status != EnumCellStatus.空闲.ToString() || endCell.Cell_Child_Run_Status != EnumGSTaskStatus.完成.ToString()) { restr = "终止货位状态错误,不能移库!"; return(false); } List <View_StockListModel> stockList = bllViewStockList.GetModelListByCellID(startCellID); //if(stockList== null) ManageModel manage = new ManageModel(); manage.Mange_CreateTime = DateTime.Now; manage.Mange_ID = Guid.NewGuid().ToString(); manage.Manage_BreakDown_Status = "待分解"; manage.Mange_Start_Cell_ID = startCellID; manage.Mange_End_Cell_ID = endCellID; manage.Mange_Type_ID = "5"; if (stockList != null && stockList.Count > 0) { manage.Mange_Full_Flag = stockList[0].Stock_Full_Flag; manage.Mange_Status = EnumManageTaskStatus.待执行.ToString(); manage.Mange_Stock_Barcode = stockList[0].Stock_Tray_Barcode; manage.Mange_Type_ID = "5"; Plan_ListModel planList = bllPlanList.GetModel(stockList[0].Plan_List_ID); if (planList != null) { manage.Plan_ID = planList.Plan_ID; } else { manage.Plan_ID = "-1"; } } else//空托盘 { } bllManage.Add(manage); bool status = CreateMoveMangeListTask(startCellID, manage.Mange_ID, ref restr); if (status == true) { restr += "生成托盘[" + manage.Mange_Stock_Barcode + "]移库任务成功:起点:" + startCell.WareHouse_Name + startCell.Cell_Name + startCell.Cell_Chlid_Position + "终点:" + endCell.WareHouse_Name + endCell.Cell_Name + endCell.Cell_Chlid_Position; EnumCellStatus cellStatus = (EnumCellStatus)Enum.Parse(typeof(EnumCellStatus), startCell.Cell_Child_Status); UpdateCellStatus(startCell.Cell_Chlid_ID, cellStatus, EnumGSTaskStatus.锁定, EnumGSOperate.出库); UpdateCellStatus(endCell.Cell_Chlid_ID, EnumCellStatus.空闲, EnumGSTaskStatus.锁定, EnumGSOperate.入库); return(true); } else { restr += "生成托盘[" + manage.Mange_Stock_Barcode + "]移库任务失败:起点:" + startCell.WareHouse_Name + startCell.Cell_Name + startCell.Cell_Chlid_Position + "终点:" + endCell.WareHouse_Name + endCell.Cell_Name + endCell.Cell_Chlid_Position; return(false); } }
//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); } }
/// <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); } }