public void AddStockList(long gsID, string boxCodeList) { GoodsSiteModel gsm = bllGs.GetModel(gsID); if (gsm == null) { return; } if (gsm.GoodsSiteStatus == EnumCellStatus.空料框.ToString()) { this.view.ShowMessage("空料框状态不允许修改库存信息,若需求更改库存请更改货位状态为非空料框状态!"); return; } List <View_StockModel> stockView = bllViewStock.GetModelListByGSID(gsID); char[] splitArr = { ',', ',' }; string[] stockListStr = boxCodeList.Split(splitArr); long stockID = 0; if (stockView == null || stockView.Count == 0)//没有增加stock { StockModel stock = new StockModel(); stock.GoodsSiteID = gsID; stock.IsFull = true; stockID = bllStock.Add(stock); } else//更新原有stock { stockID = stockView[0].StockID; } for (int i = 0; i < stockListStr.Length; i++) { StockListModel slm = new StockListModel(); slm.StockID = stockID; slm.MeterialboxCode = stockListStr[i]; slm.InHouseTime = DateTime.Now; bllStockList.Add(slm); } string reStr = ""; this.iStorageManage.AddGSOperRecord(this.currHouseName, new CellCoordModel(gsm.GoodsSiteRow, gsm.GoodsSiteColumn, gsm.GoodsSiteLayer), EnumGSOperateType.手动增加库存, "手动增加或者修改库存信息!", ref reStr); GetGSDetail(gsID); }
/// <summary> /// 查询货位状态 /// </summary> /// <param name="houseName">库房名称</param> /// <param name="cellCoord">货位位置</param> /// <param name="cellStatus">货位状态</param> /// <param name="taskStatus">货位任务状态</param> /// <returns>查询状态</returns> public bool GetCellStatus(string houseName, CellCoordModel cellCoord, ref EnumCellStatus cellStatus, ref EnumGSTaskStatus taskStatus) { StoreHouseModel houseModel = bllStoreHouse.GetModelByName(houseName); if (houseModel == null) { return(false); } GoodsSiteModel gsm = bllGoodsSite.GetModelByRCL(houseModel.StoreHouseID, cellCoord.Row, cellCoord.Col, cellCoord.Layer); if (gsm == null) { return(false); } cellStatus = (EnumCellStatus)Enum.Parse(typeof(EnumCellStatus), gsm.GoodsSiteStatus); taskStatus = (EnumGSTaskStatus)Enum.Parse(typeof(EnumGSTaskStatus), gsm.GoodsSiteTaskStatus); return(true); }
private void CreateGoodsSite(string houseName, int rowCount, int colCount, int layerCount) { for (int r = 1; r < rowCount + 1; r++) { for (int c = 1; c < colCount + 1; c++) { for (int l = 1; l < layerCount + 1; l++) { GoodsSiteModel gsm = new GoodsSiteModel(); bool status = CreateNewGS(houseName, r, c, l, ref gsm); if (false == status) { continue; } bllGoodsSite.AddModelUntilRemove(gsm); } } } }
/// <summary> /// 添加空料筐库存 /// </summary> /// <param name="houseName">库房名称</param> /// <param name="cellCoord">货位位置</param> /// <param name="reStr">执行状态描述</param> /// <returns>执行状态结果</returns> public bool AddEmptyMeterialBox(string houseName, CellCoordModel cellCoord, ref string reStr) { StoreHouseModel houseModel = bllStoreHouse.GetModelByName(houseName); if (houseModel == null) { reStr = "不存在此库房!"; return(false); } GoodsSiteModel gsm = bllGoodsSite.GetModelByRCL(houseModel.StoreHouseID, cellCoord.Row, cellCoord.Col, cellCoord.Layer); if (gsm == null) { reStr = "不存在此库存!"; return(false); } StockModel sm = new StockModel(); sm.GoodsSiteID = gsm.GoodsSiteID; sm.IsFull = true; sm.TrayID = "12345678";//测试 long stockID = bllStock.Add(sm); StockListModel slm = new StockListModel(); slm.InHouseTime = DateTime.Now; slm.StockID = stockID; slm.MeterialBatch = ""; //暂时没有 slm.MeterialboxCode = ""; slm.MeterialStatus = ""; //暂时没有赋值,若有库存详细应在此增加 long stockListID = bllStockList.Add(slm); StockDetailModel sdm = new StockDetailModel(); sdm.StockListID = stockListID; sdm.MeterialName = "空料筐"; bllStockDetail.Add(sdm); // string operateStr = "库房:" + houseName + ",货位:" + cellCoord.Row + "排" + cellCoord.Col + "列" //+ cellCoord.Layer + "层," + "添加空料框"; // AddGSOperRecord(houseName, cellCoord, EnumGSOperateType.系统添加空料框, operateStr, ref reStr); return(true); }
/// <summary> /// 更新货位启用状态 /// </summary> /// <param name="houseName">库房名称</param> /// <param name="cellCoord">货位位置</param> /// <param name="enabledStatus">货位禁用状态</param> /// <param name="reStr">执行状态描述</param> /// <returns>执行状态</returns> public bool UpdateGsEnabledStatus(string houseName, CellCoordModel cellCoord, EnumGSEnabledStatus enabledStatus, ref string reStr) { StoreHouseModel houseModel = bllStoreHouse.GetModelByName(houseName); if (houseModel == null) { return(false); } GoodsSiteModel gsm = bllGoodsSite.GetModelByRCL(houseModel.StoreHouseID, cellCoord.Row, cellCoord.Col, cellCoord.Layer); if (gsm == null) { return(false); } bool gsEnabledSta = false; if (enabledStatus == EnumGSEnabledStatus.启用) { gsEnabledSta = true; } else { gsEnabledSta = false; } bool updateStatus = bllGoodsSite.UpdateGSEnabledStatusByID(gsm.GoodsSiteID, gsEnabledSta); if (updateStatus == true) { OnUpdateGsStatus(); //string operateStr = "库房:" + houseName + ",货位:" + cellCoord.Row + "排" + cellCoord.Col + "列" + cellCoord.Layer + "层," + "货位启用状态更改为:" + enabledStatus.ToString(); //AddGSOperRecord(houseName, cellCoord, EnumGSOperateType.系统修改状态, operateStr, ref reStr); reStr = "货位更新成功!"; return(true); } else { reStr = "货位更新失败!"; return(false); } }
private bool CreateNewGS(string houseName, int rowth, int colth, int layerth, ref GoodsSiteModel gsModel) { GoodsSiteModel gsm = new GoodsSiteModel(); gsm.GoodsSiteColumn = colth; gsm.GoodsSiteOperate = EnumGSOperate.入库.ToString(); gsm.GoodsSiteLayer = layerth; gsm.GoodsSiteName = rowth.ToString() + "排" + colth.ToString() + "列" + layerth.ToString() + "层"; gsm.GoodsSitePos = rowth.ToString() + "-" + colth.ToString() + "-" + layerth.ToString(); gsm.GoodsSiteRow = rowth; gsm.GoodsSiteStatus = EnumCellStatus.空闲.ToString(); gsm.GsEnabled = true; StoreHouseModel houseModel = bllStoreHouse.GetModelByName(houseName);//默认简历库区1 if (houseModel == null) { return(false); } gsm.StoreHouseID = houseModel.StoreHouseID; gsm.GoodsSiteTaskStatus = EnumGSTaskStatus.完成.ToString(); gsModel = gsm; return(true); }
public void ModifyGsStatus(List <GsPosModel> gsList, string gsStatus, string gsTaskStatus) { string reStr = ""; for (int i = 0; i < gsList.Count; i++) { StoreHouseModel house = bllStoreHouse.GetModelByName(gsList[i].HouseName); if (null == house) { return; } GoodsSiteModel oldgsm = bllGs.GetModelByRCL(house.StoreHouseID, gsList[i].Rowth, gsList[i].Colth, gsList[i].Layerth); if (oldgsm == null) { return; } if (oldgsm.GsEnabled == false) { this.view.AddLog("库存列表", "被禁用的货位不允许修改状态!", LogInterface.EnumLoglevel.提示); return; } bllGs.UpdateGSStatusByRCL(gsList[i].HouseName, gsList[i].Rowth, gsList[i].Colth, gsList[i].Layerth, (EnumCellStatus)Enum.Parse(typeof(EnumCellStatus), gsStatus)); bllGs.UpdateGsTaskStatusByRCL(gsList[i].HouseName, gsList[i].Rowth, gsList[i].Colth, gsList[i].Layerth, (EnumGSTaskStatus)Enum.Parse(typeof(EnumGSTaskStatus), gsTaskStatus)); if (gsTaskStatus == EnumGSTaskStatus.出库允许.ToString()) { bllGs.UpdateOperateByRCL(gsList[i].HouseName, gsList[i].Rowth, gsList[i].Colth, gsList[i].Layerth, EnumGSOperate.出库); } string operteDetail = "[" + oldgsm.GoodsSiteName + "]货位状态由《" + oldgsm.GoodsSiteStatus + "》变更为《" + gsStatus + "》;" + "货位任务状态由《" + oldgsm.GoodsSiteTaskStatus + "》变更为《" + gsTaskStatus + "》"; this.iStorageManager.AddGSOperRecord(gsList[i].HouseName, new CellCoordModel(gsList[i].Rowth, gsList[i].Colth, gsList[i].Layerth), EnumGSOperateType.手动修改状态, operteDetail, ref reStr); QueryStock(this.currHouseName, this.currHouseArea, this.currRowth, this.currColth, this.currLayerth, this.gsStatus, this.gsTaskSta, this.currProBatch, this.isChecked, this.materialBoxCode); this.view.AddLog("库存管理", operteDetail, LogInterface.EnumLoglevel.提示); } }
/// <summary> /// 添加库存 /// </summary> /// <param name="houseName">库房名称</param> /// <param name="cellCoord">货位位置</param> /// <param name="goodsInfo">库存信息</param> /// <param name="reStr">执行状态描述</param> /// <returns>执行状态结果</returns> public bool AddStack(string houseName, CellCoordModel cellCoord, string proBatch, string[] goodsInfo, ref string reStr) { StoreHouseModel houseModel = bllStoreHouse.GetModelByName(houseName); if (houseModel == null) { reStr = "不存在此库房!"; return(false); } GoodsSiteModel gsm = bllGoodsSite.GetModelByRCL(houseModel.StoreHouseID, cellCoord.Row, cellCoord.Col, cellCoord.Layer); if (gsm == null) { reStr = "不存在此库存!"; return(false); } if (goodsInfo == null) { reStr = "传入空货位信息!"; return(false); } StockModel sm = new StockModel(); sm.GoodsSiteID = gsm.GoodsSiteID; sm.IsFull = true; sm.TrayID = "12345678";//测试 long stockID = bllStock.Add(sm); for (int i = 0; i < goodsInfo.Length; i++) { StockListModel slm = new StockListModel(); slm.StockID = stockID; slm.InHouseTime = DateTime.Now; slm.MeterialBatch = proBatch; //暂时没有 slm.MeterialboxCode = goodsInfo[i]; slm.MeterialStatus = ""; //暂时没有赋值,若有库存详细应在此增加 long stockListID = bllStockList.Add(slm); StockDetailModel sdm = new StockDetailModel(); sdm.StockListID = stockListID; sdm.MeterialName = "电芯"; bllStockDetail.Add(sdm); } string goodsInforStr = ""; for (int i = 0; i < goodsInfo.Length; i++) { if (i == 0) { goodsInforStr += goodsInfo[i]; } else { goodsInforStr += "," + goodsInfo[i]; } } //string operateStr = "库房:" + houseName + ",货位:" + cellCoord.Row + "排" + cellCoord.Col + "列" // + cellCoord.Layer + "层," + "添加库存:" + goodsInforStr; //AddGSOperRecord(houseName, cellCoord, EnumGSOperateType.系统添加库存, operateStr, ref reStr); return(true); }
private void InStoreByHandEventHandler(object sender, InStoreByHandEventArgs e) { int taskTypeCode = (int)(EnumTaskName)Enum.Parse(typeof(EnumTaskName), e.TaskTypeName); TaskTypeModel taskType = bllTaskType.GetModel(taskTypeCode); GoodsSiteModel goodsSiteModel = null; string[] trayIDs = SplitStringArray(e.TrayIDs); if (trayIDs != null) { for (int i = 0; i < trayIDs.Length; i++) { TB_Tray_indexModel trayModel = bllTbTrayIndex.GetModel(trayIDs[i]); if (trayModel == null) { this.View.ShowMessage("信息提示", "条码:“" + trayIDs[i] + "”不存在此条码信息,请重新输入"); return; } } } int createStatus = this.View.AskMessBox("您确定要手动生成“" + e.TaskTypeName + "”任务么?"); if (createStatus == 0) { if (taskType != null)//控制任务接口插入一个任务申请 { if (taskType.TaskTypeCode == (int)EnumTaskName.空料框出库) { //查询空料框 goodsSiteModel = bllGoodsSite.GetGoodsSite(taskType.StartLogicAreaID, EnumGSStoreStatus.空料框, EnumGSRunStatus.任务完成, EnumGSType.货位); if (goodsSiteModel == null) { if (mainPres != null) { mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "库中没有空料框了,手动生成“" + e.TaskTypeName + "”任务失败!"); } return; } else { ControlInterfaceModel controlInterModel = new ControlInterfaceModel(); controlInterModel.CreateTime = DateTime.Now; controlInterModel.DeviceCode = taskType.EndDevice; controlInterModel.InterfaceStatus = EnumCtrlInterStatus.未生成.ToString(); controlInterModel.InterfaceType = EnumTaskCategory.出库.ToString(); //生成控制条码 需要跟控制层 controlInterModel.TaskCode = bllControlInter.GetNewTaskCode(); controlInterModel.InterfaceParameter = e.TrayIDs; long controlInterID = bllControlInter.Add(controlInterModel); if (controlInterID != 1) { if (mainPres != null) { mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",手动生成“" + e.TaskTypeName + "”任务成功!"); //mainPres.View.AddLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "手动生成“" + e.TaskTypeName + "”任务成功!"); } } } } else if (taskType.TaskTypeCode == (int)EnumTaskName.电芯入库_A1 || taskType.TaskTypeCode == (int)EnumTaskName.电芯入库_B1 || taskType.TaskTypeCode == (int)EnumTaskName.分容入库_A1 || taskType.TaskTypeCode == (int)EnumTaskName.空料框入库) { goodsSiteModel = bllGoodsSite.GetGoodsSite(taskType.EndLogicAreaID, EnumGSStoreStatus.空货位, EnumGSRunStatus.待用, EnumGSType.货位); if (goodsSiteModel == null) { if (mainPres != null) { mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",库中没有空料框了,手动生成“" + e.TaskTypeName + "”任务失败!"); } return; } else { ControlInterfaceModel controlInterModel = new ControlInterfaceModel(); controlInterModel.CreateTime = DateTime.Now; controlInterModel.DeviceCode = taskType.StartDevice; controlInterModel.InterfaceStatus = EnumCtrlInterStatus.未生成.ToString(); controlInterModel.InterfaceType = EnumTaskCategory.入库.ToString(); controlInterModel.InterfaceParameter = e.TrayIDs; controlInterModel.TaskCode = bllControlInter.GetNewTaskCode(); long controlInterID = bllControlInter.Add(controlInterModel); if (controlInterID != 1) { if (mainPres != null) { mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",手动生成“" + e.TaskTypeName + "”任务成功!"); } } } } } DataTable dtCtrlTaskList = bllControlTask.GetCtrlDatatable(this.currentEnumTaskName, this.currentEnumTaskStatus , this.currentHouseName, this.currentCreateMode, this.currentTaskType); this.View.ShowControlTaskData(dtCtrlTaskList); } }
/// <summary> /// 手动取消任务 /// 删除控制任务、管理任务 /// 删除控制任务接口 /// 更新货位状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CancelTaskEventHandler(object sender, ControlTaskEventArgs e) { int taskStatus = this.View.AskMessBox("您确定要手动删除选中任务么?"); try { if (taskStatus == 0) { if (e.ControlTaskIDArr.Count() > 0)//只有任务没有完成的时候才可以取消 { for (int i = 0; i < e.ControlTaskIDArr.Count(); i++) { Hashtable deleteManaHs = null; Hashtable deleteControlInterHs = null; Hashtable deleteStockHs = null; Hashtable updateGsHs = null; ControlTaskModel controlTaskModel = bllControlTask.GetModel(e.ControlTaskIDArr[i]); if (controlTaskModel == null) { continue; } if (controlTaskModel.TaskStatus == EnumTaskStatus.执行中.ToString()) { this.View.ShowMessage("信息提示", "任务在执行中不允许删除!!"); continue; } if (controlTaskModel.TaskStatus == EnumTaskStatus.错误.ToString() || controlTaskModel.TaskStatus == EnumTaskStatus.超时.ToString()) { //要调用控制层的接口,处理控制层; MainPresenter.wcs.ClearTask(controlTaskModel); } ManageTaskModel manaTaskModel = bllManaTask.GetModel(controlTaskModel.TaskID); if (manaTaskModel == null) { continue; } StockListModel stockListModel = null; StockModel stockModel = null; GoodsSiteModel gsModel = null; if (controlTaskModel.TaskTypeCode == (int)EnumTaskName.电芯入库_A1 || controlTaskModel.TaskTypeCode == (int)EnumTaskName.分容入库_A1 || controlTaskModel.TaskTypeCode == (int)EnumTaskName.电芯入库_B1 || controlTaskModel.TaskTypeCode == (int)EnumTaskName.空料框入库) //任务完成后需要更新货位状态 { stockListModel = bllStockList.GetModelByManaTaskID(controlTaskModel.TaskID); stockModel = bllStock.GetModel(stockListModel.StockID); if (stockListModel != null && stockModel != null) { deleteStockHs = bllStock.GetDeleteModelHash(stockModel.StockID);//入库任务取消要删除库存 updateGsHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.空货位.ToString(), EnumGSRunStatus.待用.ToString() , EnumTaskCategory.出入库.ToString(), stockModel.GoodsSiteID); } } else if (controlTaskModel.TaskTypeCode == (int)EnumTaskName.分容出库_A1 || controlTaskModel.TaskTypeCode == (int)EnumTaskName.电芯出库_A1) //出库删除任务不删除库存 { gsModel = bllGoodsSite.GetGoodsSite(EnumStoreHouse.A1库房, controlTaskModel.StartDevice); stockModel = bllStock.GetModelByGsID(gsModel.GoodsSiteID); if (stockModel != null) { updateGsHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务完成.ToString() , EnumTaskCategory.入库.ToString(), stockModel.GoodsSiteID); } } else if (controlTaskModel.TaskTypeCode == (int)EnumTaskName.电芯出库_B1) { gsModel = bllGoodsSite.GetGoodsSite(EnumStoreHouse.B1库房, controlTaskModel.StartDevice); stockModel = bllStock.GetModelByGsID(gsModel.GoodsSiteID); if (stockModel != null) { updateGsHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务完成.ToString() , EnumTaskCategory.入库.ToString(), stockModel.GoodsSiteID); } } else if (controlTaskModel.TaskTypeCode == (int)EnumTaskName.空料框出库) { gsModel = bllGoodsSite.GetGoodsSite(EnumStoreHouse.B1库房, controlTaskModel.StartDevice); stockModel = bllStock.GetModelByGsID(gsModel.GoodsSiteID); if (stockModel != null) { updateGsHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.空料框.ToString(), EnumGSRunStatus.任务完成.ToString() , EnumTaskCategory.入库.ToString(), stockModel.GoodsSiteID); } } deleteManaHs = bllManaTask.GetDeleteModelHash(manaTaskModel.TaskID); deleteControlInterHs = bllControlInterface.GetDeleteHash(controlTaskModel.ControlCode); List <Hashtable> hashList = new List <Hashtable>(); hashList.Add(deleteManaHs); hashList.Add(deleteControlInterHs); hashList.Add(deleteStockHs); hashList.Add(updateGsHs); bool executeTran = ExecuteManyHashSqls(hashList); if (executeTran == true) { if (mainPres != null) { mainPres.View.AddLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",ID:" + controlTaskModel.ControlTaskID + "任务开始位置:" + controlTaskModel.StartDevice + "任务结束位置:" + controlTaskModel.TargetDevice + ",“" + manaTaskModel.TaskTypeName + "”任务手动删除成功!"); } } else { if (mainPres != null) { mainPres.View.AddLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",ID:" + controlTaskModel.ControlTaskID + "任务开始位置:" + controlTaskModel.StartDevice + "任务结束位置:" + controlTaskModel.TargetDevice + ",“" + manaTaskModel.TaskTypeName + "”任务手动删除失败!"); } } } } DataTable dtCtrlTaskList = bllControlTask.GetCtrlDatatable(this.currentEnumTaskName, this.currentEnumTaskStatus , this.currentHouseName, this.currentCreateMode, this.currentTaskType); this.View.ShowControlTaskData(dtCtrlTaskList); } } catch (Exception ex) { mainPres.View.AddLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.错误, ex.StackTrace); } }
private bool CreatePos(GoodsSiteModel gsModel, ref Positions posRef) { if (gsModel == null) { return(false); } Positions pos = new Positions(); pos.Columnth = gsModel.GoodsSiteColumn; pos.Layer = gsModel.GoodsSiteLayer; pos.Rowth = gsModel.GoodsSiteRow; pos.StoreStatus = gsModel.GoodsSiteStatus; pos.TaskType = gsModel.GoodsSiteTaskStatus; pos.GoodsSiteID = gsModel.GoodsSiteID; pos.enbled = gsModel.GsEnabled; pos.Visible = true; posRef = pos; //此处增加库房和库房区域ID pos.Color = gsStatusColor[gsModel.GoodsSiteStatus]; if (gsModel.StoreHouseLogicAreaID == null) { pos.BorderColor = Color.Black;//没有分区默认为黑色 } else { pos.BorderColor = areaColor[(long)gsModel.StoreHouseLogicAreaID]; } // pos.BorderColor = Color.LightGray; if (gsModel.GoodsSiteTaskStatus == EnumGSTaskStatus.锁定.ToString()) { pos.Color = gsStatusColor[gsModel.GoodsSiteTaskStatus]; if (gsModel.GoodsSiteOperate == EnumGSOperate.出库.ToString()) { pos.PosText = "出"; } else if (gsModel.GoodsSiteOperate == EnumGSOperate.入库.ToString()) { pos.PosText = "入"; } else if (gsModel.GoodsSiteOperate == EnumGSOperate.移入库.ToString()) { } else if (gsModel.GoodsSiteOperate == EnumGSOperate.移出库.ToString()) { } else { } } if (gsModel.GoodsSiteTaskStatus == EnumGSTaskStatus.出库允许.ToString()) { pos.Style = 2; } else { pos.Style = 1; } if (pos.Enbled == false) { pos.Color = gsStatusColor[EnumGSEnabledStatus.禁用.ToString()]; } return(true); }
private void OutHouseByHandEventHandler(object sender, OutHouseByHandEventArgs e) { int outHouse = this.View.AskMessBox("您确定要将选中货位手动出库么?"); if (outHouse == 0) { GoodsSiteModel gsModel = bllGoodsSite.GetModel(e.GoodsSiteID); if (gsModel == null) { if (this.mainPre != null) { this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "此货位为空,不能出库!"); return; } } if (!((e.GsStoreStatus == EnumGSStoreStatus.货 || e.GsStoreStatus == EnumGSStoreStatus.空料框) && e.GsRunStatus == EnumGSRunStatus.任务完成 && gsModel.GoodsSiteInOutType == EnumTaskCategory.入库.ToString())) { if (this.mainPre != null) { this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "请选择货位任务类型为“入库”,并且货位存储类型为“有货”或“空料框”,并且货位任务状态为“任务完成”的货位出库!!"); return; } } View_QueryStockListModel viewGsStockModel = bllView_QueryStockList.GetOutHouseModel(e.GoodsSiteID, e.GsStoreStatus, e.GsRunStatus); if (viewGsStockModel != null) { Hashtable updateGsStatusHs = null; TaskTypeModel taskType = null; StockModel stockModel = bllStock.GetModelByGsID(e.GoodsSiteID); bool exeHandTask = false;//执行手动选择的任务类型 if (stockModel != null) { StockListModel stockListModel = bllStockList.GetModelByStockID(stockModel.StockID); if (stockListModel != null) { string shouldTaskName = GetTaskName(stockListModel.StoreHouseName, stockListModel.ProductStatus); #region 根据人工选定的出库类型出库 if (e.OutHouseType != shouldTaskName) { if (this.View.AskMessBox("当前产品状态出库类型应为“" + shouldTaskName + "”,您确定要“" + e.OutHouseType + "”么?") == 0) { EnumTaskName handTaskName = (EnumTaskName)Enum.Parse(typeof(EnumTaskName), e.OutHouseType); taskType = bllTaskType.GetModel((int)handTaskName); switch (handTaskName) { case EnumTaskName.电芯出库_A1: updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID); //获取更新货位状态Hs break; case EnumTaskName.电芯出库_B1: updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID); //获取更新货位状态Hs break; case EnumTaskName.空料框出库: updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.空料框.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID); //获取更新货位状态Hs break; case EnumTaskName.分容出库_A1: updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID); //获取更新货位状态Hs break; } exeHandTask = true; } } #endregion #region 根据货物状态出库 if (exeHandTask == false) { if (stockListModel.StoreHouseName == EnumStoreHouse.A1库房.ToString())//手动出库根据物料状态出库 { if (viewGsStockModel.ProductStatus == EnumProductStatus.A1库静置10小时.ToString()) { taskType = bllTaskType.GetModel((int)EnumTaskName.电芯出库_A1); updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID); //获取更新货位状态Hs } else if (viewGsStockModel.ProductStatus == EnumProductStatus.A1库老化3天.ToString()) { taskType = bllTaskType.GetModel((int)EnumTaskName.分容出库_A1); updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID); //获取更新货位状态Hs } } else if (stockListModel.StoreHouseName == EnumStoreHouse.B1库房.ToString()) { if (stockListModel.ProductStatus == EnumProductStatus.空料框.ToString()) { taskType = bllTaskType.GetModel((int)EnumTaskName.空料框出库); updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.空料框.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID); //获取更新货位状态Hs } else { taskType = bllTaskType.GetModel((int)EnumTaskName.电芯出库_B1); updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString(), EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), viewGsStockModel.GoodsSiteID); //获取更新货位状态Hs } } } #endregion #region 出库处理逻辑 long manaTaskID = 0; ManageTaskModel manaTaskModel = AutoCreateManaTask(stockModel, stockListModel, taskType, ref manaTaskID); ManageTaskListModel manaTaskListModel = AutoCreateManaTaskList(manaTaskID, manaTaskModel, stockListModel); AutoCreateControlTask(manaTaskModel, manaTaskID, taskType); List <Hashtable> hashList = new List <Hashtable>(); hashList.Add(updateGsStatusHs); bool executeStatus = ExecuteManyHashSqls(hashList); if (executeStatus == true) { if (this.mainPre != null) { string trayIDListStr = bllStockDetail.GetTrayIDStrList(stockListModel.StockListID); this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + "生成出库“" + taskType.TaskTypeName + "”任务成功!" + "开始位置:" + manaTaskModel.TaskStartPostion + ",结束位置:" + manaTaskModel.TaskEndPostion + "托盘号:" + trayIDListStr); } } else { if (this.mainPre != null) { this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + "生成出库“" + taskType.TaskTypeName + "”任务失败!" + "开始位置:" + manaTaskModel.TaskStartPostion + ",结束位置:" + manaTaskModel.TaskEndPostion); } } #endregion } } else { if (this.mainPre != null) { this.mainPre.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "没有货物出库!"); this.View.ShowMessage("信息提示", "没有货物出库!"); } } } } }
private void OutHouseEventHandler(object sender, StockEventArgs e) { int outHouse = this.View.AskMessBox("您确定要将选中库存手动出库么?"); if (outHouse == 0) { for (int i = 0; i < e.StockIDArr.Count(); i++) { //if (!(e.GsStoreStatusArr[i] == (EnumGSStoreStatus.有货 | EnumGSStoreStatus.空料框)&&e.GsRunStatusArr[i] == EnumGSRunStatus.任务完成 // &&e.GSTaskTypeArr[i] == EnumTaskCategory.入库)) //{ // if (this.mainPres != null) // { // this.mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "请选择货位任务类型为“入库”,并且货位存储类型为“有货”或“空料框”,并且货位任务状态为“任务完成”的货位出库!!"); // continue; // } //} if (!((e.GsStoreStatusArr[i] == EnumGSStoreStatus.货 || e.GsStoreStatusArr[i] == EnumGSStoreStatus.空料框) && e.GsRunStatusArr[i] == EnumGSRunStatus.任务完成 && e.GSTaskTypeArr[i] == EnumTaskCategory.入库)) { if (this.mainPres != null) { this.mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "请选择货位任务类型为“入库”,并且货位存储类型为“有货”或“空料框”,并且货位任务状态为“任务完成”的货位出库!!"); return; } } Hashtable updateGsStatusHs = null; TaskTypeModel taskType = null; StockModel stockModel = bllStock.GetModel(e.StockIDArr[i]); if (stockModel == null) { continue; } StockListModel stockListModel = bllStockList.GetModelByStockID(e.StockIDArr[i]); if (stockListModel == null) { continue; } GoodsSiteModel goodsSiteModel = bllGoodsSite.GetModel(stockModel.GoodsSiteID); if (goodsSiteModel == null) { continue; } ManageTaskListModel existManaTaskList = bllTaskList.GetModelByStockListID(stockListModel.StockListID); if (existManaTaskList == null) { if (stockListModel.StoreHouseName == EnumStoreHouse.A1库房.ToString())//手动出库默认出库任务类型为一次检测出库 { if (e.ProductStatusArr[i] == EnumProductStatus.A1库老化3天) { taskType = bllTaskType.GetModel((int)EnumTaskName.分容出库_A1); } else if (e.ProductStatusArr[i] == EnumProductStatus.A1库静置10小时) { taskType = bllTaskType.GetModel((int)EnumTaskName.电芯出库_A1); } updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString() , EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), goodsSiteModel.GoodsSiteID); //获取更新货位状态Hs } else if (stockListModel.StoreHouseName == EnumStoreHouse.B1库房.ToString()) { if (e.ProductStatusArr[i] == EnumProductStatus.空料框) { taskType = bllTaskType.GetModel((int)EnumTaskName.空料框出库); updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.空料框.ToString() , EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), goodsSiteModel.GoodsSiteID); //获取更新货位状态Hs } else { taskType = bllTaskType.GetModel((int)EnumTaskName.电芯出库_B1); updateGsStatusHs = bllGoodsSite.GetUpdateModelHs(EnumGSStoreStatus.货.ToString() , EnumGSRunStatus.任务锁定.ToString(), EnumTaskCategory.出库.ToString(), goodsSiteModel.GoodsSiteID); //获取更新货位状态Hs } } long manaTaskID = 0; ManageTaskModel manaTaskModel = AutoCreateManaTask(stockModel, stockListModel, taskType, ref manaTaskID); ManageTaskListModel manaTaskListModel = AutoCreateManaTaskList(manaTaskID, manaTaskModel, stockListModel); AutoCreateControlTask(manaTaskModel, manaTaskID, taskType); List <Hashtable> hashList = new List <Hashtable>(); hashList.Add(updateGsStatusHs); bool executeStatus = ExecuteManyHashSqls(hashList); if (executeStatus == true) { if (this.mainPres != null) { string trayIDListStr = bllStockDetail.GetTrayIDStrList(stockListModel.StockListID); this.mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + ",货位:" + goodsSiteModel.GoodsSiteName + "生成“" + taskType.TaskTypeName + "”任务成功!" + "托盘号:" + trayIDListStr); } } else { if (this.mainPres != null) { this.mainPres.ShowLog(ECAMSModel.EnumLogCategory.管理层日志, EnumLogType.提示, "用户:" + this.userNameStr + "货位:" + goodsSiteModel.GoodsSiteName + "生成“" + taskType.TaskTypeName + "”任务失败!"); } } } } } }