| | |
| | | { |
| | | case "3"://清洗设备申请储位(净桶申请储位) |
| | | //查找到该车间净桶区 |
| | | List<string> areaNoList = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "0" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First(); |
| | | //List<string> areaNoList = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "0" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | //loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList.Contains(w.AreaNo) && w.Status == "0" && w.Flag == "0").OrderByDescending(o => o.CreateTime).First(); |
| | | loction = GetLocatModel(houseNo, "0"); |
| | | if (loction == null) |
| | | { |
| | | throw new Exception("该车间净桶区暂无空余储位"); |
| | |
| | | throw new Exception("批次号为空!"); |
| | | } |
| | | //查找到该车间预混区 |
| | | List<string> areaNoList2 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "1" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList2.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First(); |
| | | //List<string> areaNoList2 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "1" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | //loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList2.Contains(w.AreaNo) && w.Status == "0" && w.Flag == "0").OrderByDescending(o => o.CreateTime).First(); |
| | | loction = GetLocatModel(houseNo, "1"); |
| | | if (loction == null) |
| | | { |
| | | throw new Exception("该车间预混区暂无空余储位"); |
| | |
| | | Db.Updateable(notice).ExecuteCommand(); |
| | | |
| | | //查找到该车间半成品区 |
| | | List<string> areaNoList3 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "2" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList3.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First(); |
| | | //List<string> areaNoList3 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "2" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | //loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList3.Contains(w.AreaNo) && w.Status == "0" && w.Flag == "0").OrderByDescending(o => o.CreateTime).First(); |
| | | loction = GetLocatModel(houseNo, "2"); |
| | | if (loction == null) |
| | | { |
| | | throw new Exception("该车间半成品区暂无空余储位"); |
| | |
| | | break; |
| | | case "2"://下料设备申请储位(脏桶申请储位) |
| | | //查找到该车间脏桶区 |
| | | List<string> areaNoList4 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "3" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList4.Contains(w.AreaNo)).OrderByDescending(o => o.CreateTime).First(); |
| | | //List<string> areaNoList4 = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == "3" && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | //loction = storageLocat.Where(w => w.WareHouseNo == houseNo && areaNoList4.Contains(w.AreaNo) && w.Status == "0" && w.Flag == "0").OrderByDescending(o => o.CreateTime).First(); |
| | | loction = GetLocatModel(houseNo, "3"); |
| | | if (loction == null) |
| | | { |
| | | throw new Exception("该车间脏桶区暂无空余储位"); |
| | |
| | | { |
| | | //回滚事务 |
| | | Db.RollbackTran(); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取空储位 |
| | | /// </summary> |
| | | /// <param name="houseNo">车间编号</param> |
| | | /// <param name="Type">类别 0:净桶区 1:预混区 2:半成品区 3:脏桶区</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | private SysStorageLocat GetLocatModel(string houseNo,string type) |
| | | { |
| | | try |
| | | { |
| | | //通过类别查找车间区域 |
| | | List<string> areaNoList = Db.Queryable<SysStorageArea>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Type == type && w.WareHouseNo == houseNo).Select(s => s.AreaNo).ToList(); |
| | | //查找储位 |
| | | var loctionModel = Db.Queryable<SysStorageLocat>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Flag == "0" && w.WareHouseNo == houseNo && areaNoList.Contains(w.AreaNo)) |
| | | .OrderBy(o => o.Row).OrderByDescending(o => o.Column).First(); |
| | | if (loctionModel == null) |
| | | { |
| | | throw new Exception("该车间净桶区暂无空余储位"); |
| | | } |
| | | return loctionModel; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | |
| | | bool result = false; |
| | | |
| | | #region 呼叫小车代码 |
| | | List<AgvSchedulingTask> agvTaskList = new List<AgvSchedulingTask>(); |
| | | |
| | | List<PositionCodePath> pahtList = new List<PositionCodePath>(); |
| | | //起始位置 |
| | | PositionCodePath path1 = new PositionCodePath(); |
| | |
| | | agvTask.reqCode = taskDetial.Taskno;//请求编号 |
| | | agvTask.taskCode = taskDetial.Taskno;//任务号 |
| | | agvTask.ctnrCode = taskDetial.Pallno;//桶号 |
| | | agvTask.ctnrTyp = "1"; |
| | | agvTask.ctnrTyp = "1";// 1:桶 3:托盘 |
| | | agvTask.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//请求时间 |
| | | agvTask.wbCode = ""; |
| | | agvTask.positionCodePath = pahtList;//小车路径 |
| | |
| | | { |
| | | agvTask.taskTyp = "Z4";//任务类型 线边到托盘收集器 Z1, 托盘垛申请入库 Z2 |
| | | } |
| | | agvTaskList.Add(agvTask); |
| | | |
| | | // 正式运行程序放开 |
| | | var list2 = agvTaskList.Select(m => m.reqCode).ToList(); |
| | | var jsonData = JsonConvert.SerializeObject(agvTaskList); |
| | | jsonData = jsonData.Substring(1); |
| | | jsonData = jsonData.Substring(0, jsonData.Length - 1); |
| | | |
| | | var jsonData = JsonConvert.SerializeObject(agvTask); |
| | | string response = HttpHelper.DoPost(url, jsonData, "下发给AGV转运命令", "AGV"); |
| | | //解析返回数据 |
| | | var agvModel = JsonConvert.DeserializeObject<OutCommanAgvDto>(response); |