| | |
| | | throw new Exception("该车间净桶区暂无空余储位"); |
| | | } |
| | | break; |
| | | case "0"://接料设备申请储位(混料桶申请储位) |
| | | case "0"://接料设备申请储位(预混料桶申请储位) |
| | | //判断是否有批次号 |
| | | if (string.IsNullOrWhiteSpace(model.LotNo)) |
| | | { |
| | | throw new Exception("批次号为空!"); |
| | | } |
| | | //校验此批次是否有入库单 |
| | | /*sql2 = $"select * from BllArrivalNoticeDetail where LotNo = '{pallnetmsg.LotNo}' order by CreateTime desc"; |
| | | noticeDetail = Db.Ado.SqlQuery<BllArrivalNoticeDetail>(sql).FirstOrDefault(); |
| | | if (noticeDetail == null) |
| | | { |
| | | throw new Exception("该批次没有对应的入库单"); |
| | | } |
| | | noticeno = noticeDetail.Id.ToString();*/ |
| | | sql += $" and (AreaNo like '%02' or AreaNo like '%12' or AreaNo like '%22' or AreaNo like '%32') and WareHouseNo = '{houseNo}'"; |
| | | loction = Db.Ado.SqlQuery<SysStorageLocat>(sql).OrderByDescending(a => a.CreateTime).FirstOrDefault(); |
| | | if (loction == null) |
| | |
| | | Endport = loction.LocatNo, |
| | | Pallno = model.PalletNo, |
| | | Type = model.Type, |
| | | Crtype = "0", |
| | | Crtype = "0",//入库 |
| | | Noticedetailno = int.Parse(noticeno), |
| | | LotNo = model.LotNo, |
| | | }; |
| | |
| | | { |
| | | try |
| | | { |
| | | var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == taskDetial.Pallno);//桶库存明细 |
| | | if (stockDetail == null) |
| | | { |
| | | throw new Exception($"该桶未在库存中,桶号:{taskDetial.Pallno}"); |
| | | } |
| | | //开启事务 |
| | | Db.BeginTran(); |
| | | var typeDesc = ""; |
| | |
| | | var sql2 = ""; |
| | | var ordertype = "3"; |
| | | //涉及出入库单据的状态信息改变 |
| | | if (taskDetial.Type == "2" && taskDetial.Crtype =="1")//半成品出库 |
| | | if (taskDetial.Type == "2" && taskDetial.Crtype == "1")//半成品出库 |
| | | { |
| | | ordertype = "1"; |
| | | sql = $"UPDATE BllExportNotice SET Status ='1' " + |
| | | $"where SoNO = (select SoNO from BllExportNoticeDetail where id = {taskDetial.Noticedetailno})"; |
| | | Db.Ado.ExecuteCommand(sql); |
| | | } |
| | | else if(taskDetial.Type =="2" && taskDetial.Crtype == "0")//半成品入库 |
| | | else if (taskDetial.Type == "0" && taskDetial.Crtype == "0")//接料设备申请储位(混料桶申请储位) |
| | | { |
| | | stockDetail.LotNo = taskDetial.LotNo;//批次号 |
| | | //更新桶库存明细批次号 |
| | | Db.Updateable(stockDetail).ExecuteCommand(); |
| | | } |
| | | else if (taskDetial.Type == "1" && taskDetial.Crtype == "0")//混料设备申请储位(半成品桶申请储位) |
| | | { |
| | | ordertype = "0"; |
| | | var ArrivalMsg = Db.Queryable<BllArrivalNoticeDetail>().First(it => it.Id == taskDetial.Noticedetailno); |
| | |
| | | sql2 = $"UPDATE DataStockDetail SET SkuNo = '{ArrivalMsg.SkuNo}',SkuName = '{ArrivalMsg.SkuName}' " + |
| | | $"where PalletNo = '{taskDetial.Pallno}'and LotNo = '{taskDetial.LotNo}'"; |
| | | Db.Ado.ExecuteCommand(sql2); |
| | | } |
| | | else if (taskDetial.Type == "1" && taskDetial.Crtype == "0")//预混桶入库 |
| | | { |
| | | //预混桶入库时添加到库存中此托盘的批次信息 |
| | | sql2 = $"UPDATE DataStockDetail SET LotNo = '{taskDetial.LotNo}' where PalletNo = '{taskDetial.Pallno}'"; |
| | | Db.Ado.ExecuteCommand(sql2); |
| | | } |
| | | } |
| | | |
| | | //判断任务是否为新任务 |
| | | if (string.IsNullOrWhiteSpace(taskDetial.Taskno)) |
| | |
| | | //起始位置 |
| | | PositionCodePath path1 = new PositionCodePath(); |
| | | path1.positionCode = taskDetial.Startport; |
| | | path1.type = "05"; |
| | | if (taskDetial.Crtype == "1")//叫桶(桶出库) |
| | | { |
| | | path1.type = "00"; |
| | | } |
| | | else//申请储位(桶入库) |
| | | { |
| | | path1.type = "05"; |
| | | } |
| | | |
| | | |
| | | pahtList.Add(path1); |
| | | |
| | | //目标位置 |
| | | PositionCodePath path2 = new PositionCodePath(); |
| | | path2.positionCode = taskDetial.Endport; |
| | | path2.type = "00"; |
| | | if (taskDetial.Crtype == "1")//叫桶(桶出库) |
| | | { |
| | | path2.type = "05"; |
| | | } |
| | | else//申请储位(桶入库) |
| | | { |
| | | path2.type = "00"; |
| | | } |
| | | |
| | | pahtList.Add(path2); |
| | | //下车任务单 |
| | | AgvSchedulingTask agvTask = new AgvSchedulingTask(); |
| | | agvTask.reqCode = logTaskEntry.TaskNo;//任务号 |
| | | agvTask.ctnrTyp = "3"; |
| | | agvTask.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//请求时间 |
| | | agvTask.taskTyp = "Z2";//任务类型 线边到托盘收集器 Z1, 托盘垛申请入库 Z2 |
| | | agvTask.ctnrTyp = "1"; |
| | | agvTask.reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//请求时间 |
| | | agvTask.wbCode = ""; |
| | | agvTask.positionCodePath = pahtList;//小车路径 |
| | | agvTask.podCode = ""; |
| | | agvTask.userCallCode = taskDetial.Endport;//目标位置 |
| | | |
| | | if (taskDetial.Crtype == "1")//叫桶(桶出库) |
| | | { |
| | | agvTask.taskTyp = "Z3";//任务类型 线边到托盘收集器 Z1, 托盘垛申请入库 Z2 |
| | | } |
| | | else//申请储位(桶入库) |
| | | { |
| | | agvTask.taskTyp = "Z4";//任务类型 线边到托盘收集器 Z1, 托盘垛申请入库 Z2 |
| | | } |
| | | agvTaskList.Add(agvTask); |
| | | |
| | | // 正式运行程序放开 |
| | |
| | | jsonData = jsonData.Substring(1); |
| | | jsonData = jsonData.Substring(0, jsonData.Length - 1); |
| | | string response = ""; |
| | | |
| | | try |
| | | { |
| | | logTaskEntry.SendDate = DateTime.Now;//发送时间 |