zhaowc
2 天以前 bb0b78e7ef5317a38adc18a648e41aa8cc4711bc
Wms/WMS.BLL/BllTransServer/RcsServer.cs
@@ -7,6 +7,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
@@ -941,17 +943,12 @@
                    stockDetail.PalletStatus = "0";
                    stockDetail.Status = "0";//待分配
                }
                else if (endAreaInfo.Type == "1")//预混区
                {
                    stockDetail.PalletStatus = "1";
                    stockDetail.Status = "0";//待分配
                }
                else if (endAreaInfo.Type == "2")//半成品区
                else if (endAreaInfo.Type == "1")//满桶
                {
                    stockDetail.PalletStatus = "2";
                    stockDetail.Status = "0";//待分配
                }
                else if (endAreaInfo.Type == "3")//脏桶区
                else if (endAreaInfo.Type == "2")//脏桶区
                {
                    stockDetail.PalletStatus = "3";
                    stockDetail.LotNo = "";//批次
@@ -1097,18 +1094,16 @@
                }
                locatEnd.Status = "0"; //空储位
                Db.Updateable(locatEnd).ExecuteCommand();
                if (task.Type == "1")//出库任务
                //修改库存明细
                var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == task.PalletNo);
                if (stockDetail == null)
                {
                    //修改库存明细
                    var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == task.PalletNo && w.Status == "2");
                    if (stockDetail == null)
                    {
                        throw new Exception("未查询到该桶库存信息,请检查!");
                    }
                    stockDetail.Status = "0";//待分配
                    Db.Updateable(stockDetail).ExecuteCommand();
                    throw new Exception("未查询到该桶库存信息,请检查!");
                }
                stockDetail.Status = "0";//待分配
                Db.Updateable(stockDetail).ExecuteCommand();
                //添加操作日志记录
                var k = new OperationCrServer().AddLogOperationCr("库内作业", "库内日志", taskNo, "取消", $"点击取消按钮、取消了任务号为:{taskNo}的任务", userId);
                Db.CommitTran();
@@ -1125,7 +1120,7 @@
        /// <param name="taskNo"></param>
        /// <param name="userId"></param>
        /// <exception cref="Exception"></exception>
        public void DownTask(string taskNo, int userId,string url)
        public void DownTask(string taskNo, int userId,string url,string bindUrl)
        {
            try
            {
@@ -1142,7 +1137,7 @@
                    throw new Exception("只有等待执行的任务才可手动下发");
                }
                //查找该桶有没有正在执行的任务
                var tasking = Db.Queryable<LogTask>().First(w => w.IsDel == "0" && w.Status == "1" && w.PalletNo == logTaskEntry.PalletNo);
                var tasking = Db.Queryable<LogTask>().First(w => w.IsDel == "0" && w.Status == "1"  && w.PalletNo == logTaskEntry.PalletNo);
                if (tasking != null)
                {
                    throw new Exception($"该桶有正在执行的任务");
@@ -1153,20 +1148,20 @@
                {
                    throw new Exception($"未查询到起始储位信息");
                }
                if (startLocatInfo.Status != "1")
                {
                    throw new Exception($"起始储位状态异常");
                }
                //if (startLocatInfo.Status != "1")
                //{
                //    throw new Exception($"起始储位状态异常");
                //}
                //目标储位信息
                var endLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == logTaskEntry.EndLocat);
                if (endLocatInfo == null)
                {
                    throw new Exception($"未查询到目标储位信息");
                }
                if (endLocatInfo.Status != "0")
                {
                    throw new Exception($"目标储位状态异常");
                }
                //if (endLocatInfo.Status != "0")
                //{
                //    throw new Exception($"目标储位状态异常");
                //}
                //组织给小车下发任务信息
                var task = new TaskDetial
                {
@@ -1179,30 +1174,33 @@
                string agvMsg = string.Empty;
                //给下车下发任务
                logTaskEntry.SendDate = DateTime.Now;//发送时间
                var agvResult = CreateTaskForAgv(task, url, out agvMsg);
                if (agvResult)//成功
                //先给货位绑定载具
                var bind = RcsHelper.BindPalletAndSite(logTaskEntry.PalletNo, logTaskEntry.StartLocat, bindUrl, out string agvBindMsg);
                if (bind)
                {
                    //请求成功修改任务表相应字段状态
                    logTaskEntry.IsSuccess = 1;
                    logTaskEntry.IsSend = 0;
                    logTaskEntry.IsCancel = 0;
                    logTaskEntry.BackDate = DateTime.Now;
                    logTaskEntry.Status = "1";//正在执行
                    Db.Insertable(logTaskEntry).ExecuteCommand();
                    var agvResult = CreateTaskForAgv(task, url, out agvMsg);
                    if (agvResult)//成功
                    {
                        //请求成功修改任务表相应字段状态
                        logTaskEntry.IsSuccess = 1;
                        logTaskEntry.IsSend = 1;
                        logTaskEntry.IsCancel = 1;
                        logTaskEntry.BackDate = DateTime.Now;
                        Db.Updateable(logTaskEntry).ExecuteCommand();
                    startLocatInfo.Status = "3";//出库中
                    Db.Updateable(startLocatInfo).ExecuteCommand();
                        startLocatInfo.Status = "3";//出库中
                        Db.Updateable(startLocatInfo).ExecuteCommand();
                    endLocatInfo.Status = "2";//入库中
                    Db.Updateable(endLocatInfo).ExecuteCommand();
                        endLocatInfo.Status = "2";//入库中
                        Db.Updateable(endLocatInfo).ExecuteCommand();
                    }
                    else//失败
                    {
                        logTaskEntry.IsSuccess = 0;
                        logTaskEntry.Information = agvMsg;
                        Db.Updateable(logTaskEntry).ExecuteCommand();
                    }
                }
                else//失败
                {
                    logTaskEntry.IsSuccess = 0;
                    logTaskEntry.Information = agvMsg;
                    Db.Insertable(logTaskEntry).ExecuteCommand();
                }
                //添加操作日志记录
                var k = new OperationCrServer().AddLogOperationCr("库内作业", "库内日志", taskNo, "下发", $"点击下发按钮、任务号为:{taskNo}的任务", userId);
                Db.CommitTran();