| | |
| | | if (isChai == "0") |
| | | { |
| | | var boxInfo = Db.Queryable<DataBoxInfo>().Where(w => w.IsDel == "0" && w.PalletNo == item.PalletNo && w.BitBoxMark == "1").ToList(); |
| | | if (boxInfo != null)//托盘上有零箱需要拆箱 |
| | | if (boxInfo.Count>0)//托盘上有零箱需要拆箱 |
| | | { |
| | | isChai = "1"; |
| | | unstackingMode2 = "1";//需要拆箱需走PDA拆垛 |
| | |
| | | //添加操作日志记录 |
| | | var k = new OperationSOServer().AddLogOperationSo("出库作业", "出库日志", TtaskNo, "完成", $"点击完成按钮、完成任务号为:{TtaskNo}的任务", userId); |
| | | } |
| | | if (outLine != "") |
| | | if (outLine != "" && outLine != "009" && outLine != "013" && outLine != "018" && outLine != "022") |
| | | { |
| | | #region 分配出库目的位 |
| | | string positionStart = outLine, positionEnd = "" ,type ="D00"; |
| | | string positionStart = outLine, positionEnd = "", type = "D00"; |
| | | var type1 = Db.Queryable<BllExportNotice>().Where(m => m.SONo == allot.First().SONo && m.IsDel == "0" && m.Status == "3").First(); |
| | | if (type1 == null) |
| | | { |
| | | var locateno = Db.Queryable<SysStorageLocat>().Where(m => m.AreaNo == "B13").ToList(); |
| | | type = "D02" ; //空托盘垛出库 |
| | | if (outLine == "443")//西侧出库 |
| | | type = "D02"; //空托盘垛出库 |
| | | if (outLine == "443")//西侧出库 |
| | | { |
| | | positionEnd = locateno.First(m => m.LocatNo.Substring(3, 2) == "01" && m.LocatNo.Substring(3, 2) == "02" && m.LocatNo.Substring(3, 2) == "03" && |
| | | m.Status == "0" && m.Flag == "0").LocatNo; |
| | | positionEnd = locateno.First(m => m.Row == 1 && m.Status == "0" && m.Flag == "0").LocatNo; |
| | | } |
| | | else if (outLine == "440") //东侧出库 |
| | | { |
| | | positionEnd = locateno.First(m => m.LocatNo.Substring(4, 2) == "04" && m.LocatNo.Substring(4, 2) == "05" && m.LocatNo.Substring(4, 2) == "06" && |
| | | m.Status == "0" && m.Flag == "0").LocatNo; //东侧房间库位 |
| | | positionEnd = locateno.First(m => m.Row == 2 && m.Status == "0" && m.Flag == "0").LocatNo; //东侧房间库位 |
| | | } |
| | | else //1楼空托盘出库不调用AGV |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | if (type1.Type == "1" && (type1.Type == "5" || (positionStart == "440" && positionStart == "440"))) //3楼领料出库 /3L中间品出库 |
| | | { |
| | | var locateno = Db.Queryable<SysStorageLocat>().Where(m => m.AreaNo == "B11").ToList(); |
| | | if (outLine == "443")//西侧出库 |
| | | else |
| | | { |
| | | if (type1.Type == "1" || (type1.Type == "5" && (positionStart == "440" || positionStart == "443"))) //3楼领料出库 /3L中间品出库 |
| | | { |
| | | positionEnd = locateno.First(m => m.LocatNo.Substring(3, 2) == "01"&& m.LocatNo.Substring(4, 2) == "02" && m.Status == "0" && m.Flag == "0").LocatNo; //西侧房间库位 |
| | | } |
| | | else if(outLine == "440") //东侧出库 |
| | | { |
| | | positionEnd = locateno.First(m => m.LocatNo.Substring(3, 2) == "03" && m.LocatNo.Substring(4, 2) == "04" && m.LocatNo.Substring(4, 2) == "05" && |
| | | m.LocatNo.Substring(4, 2) == "06" && m.LocatNo.Substring(3, 2) == "07" && m.Status == "0" && m.Flag == "0").LocatNo; //东侧房间库位 |
| | | } |
| | | } |
| | | else if (type1.Type == "2" && type1.Type == "3") //抽检出库 /取样出库 |
| | | { |
| | | positionEnd = Db.Queryable<SysStorageLocat>().First(m => m.AreaNo == "B04" && m.Status == "0" && m.Flag == "0").LocatNo; |
| | | } |
| | | else if (type1.Type == "4")//不合格品出库 |
| | | { |
| | | var locateno = Db.Queryable<SysStorageLocat>().Where(m => m.AreaNo == "B11").ToList(); |
| | | if (outLine == "443")//西侧出库 |
| | | { |
| | | |
| | | positionEnd = Db.Queryable<SysStorageLocat>().First(m => m.AreaNo == "B03" && m.Status == "0" && m.Flag == "0").LocatNo; |
| | | } |
| | | else //其他单据类型都存放发货缓存区 |
| | | { |
| | | positionEnd = Db.Queryable<SysStorageLocat>().First(m => m.AreaNo == "B02" && m.Status == "0" && m.Flag == "0").LocatNo; |
| | | positionEnd = locateno.OrderBy(m => m.LocatNo).First(m => m.Row == 1 && m.Status == "0" && m.Flag == "0").LocatNo; //西侧房间库位和对面房间 |
| | | } |
| | | else if (outLine == "440") //东侧出库 |
| | | { |
| | | positionEnd = locateno.OrderBy(m => m.LocatNo).First(m => m.Row == 2 && m.Status == "0" && m.Flag == "0").LocatNo; //东侧房间库位 |
| | | } |
| | | } |
| | | else if (type1.Type == "2" || type1.Type == "3") //抽检出库 /取样出库 |
| | | { |
| | | positionEnd = Db.Queryable<SysStorageLocat>().OrderBy(m=>m.LocatNo).First(m => m.AreaNo == "B04" && m.Status == "0" && m.Flag == "0").LocatNo; |
| | | } |
| | | else if (type1.Type == "4")//不合格品出库 |
| | | { |
| | | |
| | | positionEnd = Db.Queryable<SysStorageLocat>().OrderBy(m => m.LocatNo).First(m => m.AreaNo == "B03" && m.Status == "0" && m.Flag == "0").LocatNo; |
| | | } |
| | | else //其他单据类型都存放发货缓存区 |
| | | { |
| | | positionEnd = Db.Queryable<SysStorageLocat>().OrderBy(m => m.LocatNo).First(m => m.AreaNo == "B02" && m.Status == "0" && m.Flag == "0").LocatNo; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | |
| | | LogFile.SaveLogToFile($"AGV任务反馈执行通知:( {jsonData} ),", logStr); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 添加出库任务信息 |
| | | |
| | | var taskNonew = new Common().GetMaxNo("TK"); |
| | | var exTask = new LogTask //小车移库任务 |
| | | { |
| | | TaskNo = TtaskNo, |
| | | Sender = "WMS", |
| | | Receiver = "AGV", |
| | | IsSuccess = 1, //是否下发成功 0失败 1成功 |
| | | |
| | | StartLocat = positionStart,//起始位置 |
| | | EndLocat = positionEnd,//目标位置 |
| | | PalletNo = task.PalletNo,//托盘码 |
| | | IsSend = 1,//是否可再次下发 |
| | | IsCancel = 1,//是否可取消 |
| | | IsFinish = 1,//是否可完成 |
| | | Type = "2",//任务类型 0 入库任务 1 出库任务 2 移库任务 |
| | | Status = "1",//任务状态0:等待执行1正在执行2执行完成 |
| | | OrderType = "3",//0 入库单 1 出库单 2 盘点单 3 移库单 |
| | | CreateTime = DateTime.Now, //创建时间 |
| | | CreateUser = userId, //创建人 |
| | | Msg = "小车从" + positionStart + "到" + positionEnd + "的移库任务", //关键信息 |
| | | //FinishDate = serverTime, //完成时间 |
| | | }; |
| | | Db.Insertable(exTask).ExecuteCommand(); |
| | | |
| | | #endregion |
| | | |
| | | #region 储位状态变更 |
| | | //更改储位状态为出库中 |
| | | var locat = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == positionEnd); |
| | | locat.Status = "4"; //4 移入中 |
| | | Db.Updateable(locat).ExecuteCommand();//修改储位信息 |
| | | #endregion |
| | | } |
| | | Db.CommitTran(); |
| | |
| | | } |
| | | } |
| | | var boxInfo = Db.Queryable<DataBoxInfo>().Where(w => w.IsDel == "0" && w.PalletNo == item.PalletNo && w.BitBoxMark == "1").ToList(); |
| | | if (boxInfo != null)//托盘上有零箱需要拆箱 |
| | | if (boxInfo.Count>0)//托盘上有零箱需要拆箱 |
| | | { |
| | | result = "1";//需要拆箱 |
| | | break; |
| | |
| | | try |
| | | { |
| | | // 判断当前任务状态 Status 1:正在执行 3:异常结束 |
| | | var taskModel = Db.Queryable<LogTask>().First(m => m.TaskNo == model.TaskNo && m.IsDel == "0" && m.Status == "1"); |
| | | var taskModel = Db.Queryable<LogTask>().First(m => m.TaskNo == model.TaskNo && m.IsDel == "0" ); |
| | | if (taskModel == null) |
| | | { |
| | | throw new Exception("此任务不存在或任务状态已变更!"); |
| | | } |
| | | // 验证托盘分配信息 |
| | | var palletBindModel = Db.Queryable<BllExportAllot>().First(m => m.PalletNo == model.PalletNo && m.TaskNo == model.TaskNo && m.IsDel == "0" && m.Status == "1"); |
| | | if (palletBindModel != null) |
| | | var palletBindModel = Db.Queryable<BllExportAllot>().First(m => m.PalletNo == model.PalletNo && m.TaskNo == model.TaskNo && m.IsDel == "0" && m.Status == "2"); |
| | | if (palletBindModel == null) |
| | | { |
| | | throw new Exception("未找到当前托盘分配任务信息!"); |
| | | } |