public void CancelTask(string palletCode) { string restr = ""; ManageModel manage = bllManage.GetModelByPalletCode(palletCode); if (manage == null) { this.View.ShowMessage("信息提示", "获取管理任务失败!"); return; } if (manage.Mange_Status != EnumManageTaskStatus.待执行.ToString()) { this.View.ShowMessage("信息提示", "只有待执行的任务可以取消!"); return; } if (manage.Mange_Type_ID == "1" || manage.Mange_Type_ID == "6" || manage.Mange_Type_ID == "7")//入库的 { TaskHandleMethod.UpdateCellStatus(manage.Mange_End_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.入库); TaskHandleMethod.AddCellOperRecord(manage.Mange_End_Cell_ID, EnumGSOperateType.手动取消任务, "人工手动取消入库任务", ref restr); } else if (manage.Mange_Type_ID == "5")//移库的 { TaskHandleMethod.UpdateCellStatus(manage.Mange_Start_Cell_ID, EnumCellStatus.满位, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.UpdateCellStatus(manage.Mange_End_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.入库); TaskHandleMethod.AddCellOperRecord(manage.Mange_Start_Cell_ID, EnumGSOperateType.手动取消任务, "人工手动取消移库开始任务", ref restr); TaskHandleMethod.AddCellOperRecord(manage.Mange_End_Cell_ID, EnumGSOperateType.手动取消任务, "人工手动取消移库目标任务", ref restr); } else if (manage.Mange_Type_ID == "2" || manage.Mange_Type_ID == "8" || manage.Mange_Type_ID == "9")//出库的 { TaskHandleMethod.UpdateCellStatus(manage.Mange_Start_Cell_ID, EnumCellStatus.满位, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.AddCellOperRecord(manage.Mange_Start_Cell_ID, EnumGSOperateType.手动取消任务, "人工手动取消出库任务", ref restr); } else { this.View.ShowMessage("信息提示", "任务类型错误!任务编码:" + manage.Mange_Type_ID); return; } bllManage.Delete(manage.Mange_ID); this.View.ShowMessage("信息提示", "取消任务成功!"); this.WmsFrame.WriteLog("任务列表", "", "提示", "手动取消任务:托盘[" + palletCode + "]" + ",任务类型:" + manage.Mange_Type_ID); ViewDataManager.TASKLISTDATA.TaskDetailData.Clear();//取消配盘后要将任务详细清楚 QueryTask(currentDtStart, currentDtEnd, this.currtaskType, this.currtaskStatus); }
/// <summary> /// 任务开始所关联的计划更改为执行中;货位状态锁定(配盘时已经更改成锁定); /// </summary> /// <param name="manageTask"></param> /// <returns></returns> public override bool ChangeStatus(View_ManageModel manageTask) { try { if (manageTask == null) { return(false); } //更新计划,无计划可不更新,无计划的计划ID为-1 //if (manageTask.Plan_ID != "-1")//有计划任务 //{ // if (TaskHandleMethod.UpdatePlanStatus(manageTask.Plan_ID, EnumPlanStatus.执行中) == false) // { // StatusManager.wmsFrame.WriteLog("TaskRunning", "", "错误", "计划状态更新失败!"); // return false; // } //} if (manageTask.Manage_Type_Name == EnumManageTaskType.空托盘上架.ToString()) { if (TaskHandleMethod.UpdateCellStatus(manageTask.Mange_End_Cell_ID, EnumCellStatus.空料框, EnumGSTaskStatus.锁定, EnumGSOperate.入库) == false) { StatusManager.wmsFrame.WriteLog("TaskRunning", "", "错误", "货位状态更新失败!"); return(false); } } else if (manageTask.Manage_Type_Name == EnumManageTaskType.架.ToString()) { if (TaskHandleMethod.UpdateCellStatus(manageTask.Mange_End_Cell_ID, EnumCellStatus.满位, EnumGSTaskStatus.锁定, EnumGSOperate.入库) == false) { StatusManager.wmsFrame.WriteLog("TaskRunning", "", "错误", "货位状态更新失败!"); return(false); } } else if (manageTask.Manage_Type_Name == EnumManageTaskType.空托盘下架.ToString()) { if (TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空料框, EnumGSTaskStatus.锁定, EnumGSOperate.出库) == false) { StatusManager.wmsFrame.WriteLog("TaskRunning", "", "错误", "货位状态更新失败!"); return(false); } } else if (manageTask.Manage_Type_Name == EnumManageTaskType.盘点下架.ToString() || manageTask.Manage_Type_Name == EnumManageTaskType.架.ToString()) { if (TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.满位, EnumGSTaskStatus.锁定, EnumGSOperate.出库) == false) { StatusManager.wmsFrame.WriteLog("TaskRunning", "", "错误", "货位状态更新失败!"); return(false); } } else { StatusManager.wmsFrame.WriteLog("TaskRunning", "", "错误", "任务类型错误!"); return(false); } return(true); } catch (Exception ex) { StatusManager.wmsFrame.WriteLog("TaskRunning", "", "错误", "任务执行处理失败!" + ex.Message); return(false); } }
/// <summary> /// 任务完成:更新货位状态;更新库存(出库库操作不同);更新计划状态及当前完成数量;管理任务删除(保留15天数据);出入库记录更新; /// </summary> /// <param name="manageTask"></param> /// <returns></returns> public override bool ChangeStatus(View_ManageModel manageTask) { try { string restr = ""; if (manageTask == null) { return(false); } if (manageTask.Manage_Type_Name == EnumManageTaskType.空托盘上架.ToString()) //空托盘没有库存,无计划 { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_End_Cell_ID, EnumCellStatus.空料框, EnumGSTaskStatus.完成, EnumGSOperate.入库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_End_Cell_ID, EnumGSOperateType.系统添加空料框, "空托盘上架任务完成,更新货位状态", ref restr); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID); } else if (manageTask.Manage_Type_Name == EnumManageTaskType.架.ToString()) { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_End_Cell_ID, EnumCellStatus.满位, EnumGSTaskStatus.完成, EnumGSOperate.入库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_End_Cell_ID, EnumGSOperateType.系统更新货位操作, "物料上架任务完成,更新货位状态", ref restr); TaskHandleMethod.UpdatePlanCompleteNum(manageTask.Mange_ID); TaskHandleMethod.UpdateStockUpdateTime(manageTask.Mange_Stock_Barcode, DateTime.Now); TaskHandleMethod.UpdateStockPos(manageTask.Mange_Stock_Barcode, manageTask.Mange_End_Cell_ID, ref restr); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID); } else if (manageTask.Manage_Type_Name == EnumManageTaskType.空托盘下架.ToString()) { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_Start_Cell_ID, EnumGSOperateType.系统更新货位操作, "空托盘下架任务完成,更新货位状态", ref restr); } else if (manageTask.Manage_Type_Name == EnumManageTaskType.架.ToString()) //下架完成后,删除库存 { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_Start_Cell_ID, EnumGSOperateType.系统更新货位操作, "货物下架任务完成,更新货位状态", ref restr); TaskHandleMethod.UpdatePlanCompleteNum(manageTask.Mange_ID); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID);//删除stock前 TaskHandleMethod.DeleteStock(manageTask.Mange_Stock_Barcode); } else if (manageTask.Manage_Type_Name == EnumManageTaskType.盘点下架.ToString()) { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_Start_Cell_ID, EnumGSOperateType.系统更新货位操作, "货物下架任务完成,更新货位状态", ref restr); //TaskHandleMethod.UpdatePlanCompleteNum(manageTask.Mange_ID); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID); TaskHandleMethod.DeleteStock(manageTask.Mange_ID); } else if (manageTask.Manage_Type_Name == EnumManageTaskType.拣选下架.ToString()) { } else if (manageTask.Manage_Type_Name == EnumManageTaskType.移库.ToString()) { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.UpdateCellStatus(manageTask.Mange_End_Cell_ID, EnumCellStatus.满位, EnumGSTaskStatus.完成, EnumGSOperate.入库); TaskHandleMethod.UpdateStockCell(manageTask.Mange_Stock_Barcode, manageTask.Mange_End_Cell_ID, ref restr); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_Start_Cell_ID, EnumGSOperateType.系统更新货位操作, "货物移库任务完成,更新货位状态", ref restr); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID); } else { return(false); } TaskHandleMethod.CheckPlanCompleteStatus(manageTask.Plan_ID, ref restr);//检查计划是否完成,如果完成自动更新计划通过计划数量和完成数量相等判断 TaskHandleMethod.UpdateManageCompleteTime(manageTask.Mange_ID, DateTime.Now); TaskHandleMethod.UpdateManageHandleStatus(manageTask.Mange_ID, EnumBreakDowmStatus.已处理); StatusManager.wmsFrame.WriteLog("服务管理", "", "提示", restr); return(true); } catch (Exception ex) { StatusManager.wmsFrame.WriteLog("服务管理", "", "错误", "任务完成处理失败!" + ex.Message); return(false); } }
/// <summary> /// 任务完成:更新货位状态;更新库存(出库库操作不同);更新计划状态及当前完成数量;管理任务删除(保留15天数据);出入库记录更新; /// </summary> /// <param name="manageTask"></param> /// <returns></returns> public override bool ChangeStatus(View_ManageModel manageTask) { try { string restr = ""; if (manageTask == null) { return(false); } View_CellModel viewCell = null; if (manageTask.Manage_Type_Name == EnumManageTaskType.空托盘上架.ToString()) //空托盘没有库存,无计划 { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_End_Cell_ID, EnumCellStatus.空料框, EnumGSTaskStatus.完成, EnumGSOperate.入库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_End_Cell_ID, EnumGSOperateType.系统添加空料框, "空托盘上架任务完成,更新货位状态", ref restr); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID); viewCell = bllView.GetModelByChildCellID(manageTask.Mange_End_Cell_ID); if (viewCell != null) { restr = "空托盘上架任务完成,更新货位[" + viewCell.WareHouse_Name + "," + viewCell.Cell_Name + "," + viewCell.Cell_Chlid_Position + "]状态,空料框、完成。"; } } else if (manageTask.Manage_Type_Name == EnumManageTaskType.架.ToString()) { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_End_Cell_ID, EnumCellStatus.满位, EnumGSTaskStatus.完成, EnumGSOperate.入库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_End_Cell_ID, EnumGSOperateType.系统更新货位操作, "物料上架任务完成,更新货位状态", ref restr); TaskHandleMethod.UpdatePlanCompleteNum(manageTask.Mange_ID); TaskHandleMethod.UpdateStockUpdateTime(manageTask.Mange_Stock_Barcode, DateTime.Now); TaskHandleMethod.UpdateStockPos(manageTask.Mange_Stock_Barcode, manageTask.Mange_End_Cell_ID, ref restr); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID); viewCell = bllView.GetModelByChildCellID(manageTask.Mange_End_Cell_ID); if (viewCell != null) { restr = "上架任务完成,更新货位[" + viewCell.WareHouse_Name + "," + viewCell.Cell_Name + "," + viewCell.Cell_Chlid_Position + "]状态,满筐、完成。"; } } else if (manageTask.Manage_Type_Name == EnumManageTaskType.空托盘下架.ToString()) { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_Start_Cell_ID, EnumGSOperateType.系统更新货位操作, "空托盘下架任务完成,更新货位状态", ref restr); viewCell = bllView.GetModelByChildCellID(manageTask.Mange_Start_Cell_ID); if (viewCell != null) { restr = "空托盘下架任务完成,更新货位[" + viewCell.WareHouse_Name + "," + viewCell.Cell_Name + "," + viewCell.Cell_Chlid_Position + "]状态,空闲、完成。"; } } else if (manageTask.Manage_Type_Name == EnumManageTaskType.架.ToString()) //下架完成后,删除库存 { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_Start_Cell_ID, EnumGSOperateType.系统更新货位操作, "货物下架任务完成,更新货位状态", ref restr); TaskHandleMethod.UpdatePlanCompleteNum(manageTask.Mange_ID); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID);//删除stock前 TaskHandleMethod.DeleteStock(manageTask.Mange_Stock_Barcode); viewCell = bllView.GetModelByChildCellID(manageTask.Mange_Start_Cell_ID); if (viewCell != null) { restr = "下架任务完成,更新货位[" + viewCell.WareHouse_Name + "," + viewCell.Cell_Name + "," + viewCell.Cell_Chlid_Position + "]状态,空闲、完成。"; } } else if (manageTask.Manage_Type_Name == EnumManageTaskType.盘点下架.ToString()) { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_Start_Cell_ID, EnumGSOperateType.系统更新货位操作, "货物下架任务完成,更新货位状态", ref restr); //TaskHandleMethod.UpdatePlanCompleteNum(manageTask.Mange_ID); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID); TaskHandleMethod.DeleteStock(manageTask.Mange_ID); viewCell = bllView.GetModelByChildCellID(manageTask.Mange_Start_Cell_ID); if (viewCell != null) { restr = "盘点下架任务完成,更新货位[" + viewCell.WareHouse_Name + "," + viewCell.Cell_Name + "," + viewCell.Cell_Chlid_Position + "]状态,空闲、完成。"; } } else if (manageTask.Manage_Type_Name == EnumManageTaskType.拣选下架.ToString()) { } else if (manageTask.Manage_Type_Name == EnumManageTaskType.移库.ToString()) { TaskHandleMethod.UpdateCellStatus(manageTask.Mange_Start_Cell_ID, EnumCellStatus.空闲, EnumGSTaskStatus.完成, EnumGSOperate.出库); TaskHandleMethod.UpdateCellStatus(manageTask.Mange_End_Cell_ID, EnumCellStatus.满位, EnumGSTaskStatus.完成, EnumGSOperate.入库); TaskHandleMethod.UpdateStockCell(manageTask.Mange_Stock_Barcode, manageTask.Mange_End_Cell_ID, ref restr); TaskHandleMethod.AddCellOperRecord(manageTask.Mange_Start_Cell_ID, EnumGSOperateType.系统更新货位操作, "货物移库任务完成,更新货位状态", ref restr); TaskHandleMethod.AddStockRecord(manageTask.Mange_ID); View_CellModel startCell = bllView.GetModelByChildCellID(manageTask.Mange_Start_Cell_ID); View_CellModel endCell = bllView.GetModelByChildCellID(manageTask.Mange_End_Cell_ID); if (startCell != null && endCell != null) { restr = "移库任务完成,更新货位[" + startCell.WareHouse_Name + "," + startCell.Cell_Name + "," + startCell.Cell_Chlid_Position + "]状态,空闲、完成;"; restr = "更新货位[" + endCell.WareHouse_Name + "," + endCell.Cell_Name + "," + endCell.Cell_Chlid_Position + "]状态,满位、完成。"; } } else { return(false); } StatusManager.wmsFrame.WriteLog("服务管理", "", "提示", restr); TaskHandleMethod.CheckPlanCompleteStatus(manageTask.Plan_ID, ref restr);//检查计划是否完成,如果完成自动更新计划通过计划数量和完成数量相等判断 TaskHandleMethod.UpdateManageCompleteTime(manageTask.Mange_ID, DateTime.Now); TaskHandleMethod.UpdateManageHandleStatus(manageTask.Mange_ID, EnumBreakDowmStatus.已处理); return(true); } catch (Exception ex) { StatusManager.wmsFrame.WriteLog("服务管理", "", "错误", "任务完成处理失败!" + ex.Message); return(false); } }