Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -2,9 +2,12 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model.InterFaceModel;
using Model.ModelDto.BllCheckDto;
using Model.ModelDto.PdaDto;
using Newtonsoft.Json;
using SqlSugar;
using Utility.Tools;
using WMS.BLL.LogServer;
using WMS.DAL;
using WMS.Entity.BllAsnEntity;
@@ -880,7 +883,7 @@
        /// <param name="palletNo"></param>
        /// <param name="areaNo"></param>
        /// <param name="ruku"></param>
        public void AgvTransport(string palletNo, string areaNo, string ruku, int userId)
        public void AgvTransport(string palletNo, string areaNo, string ruku, int userId, string url)
        {
            if (string.IsNullOrEmpty(palletNo))
            {
@@ -998,12 +1001,60 @@
                }               
                //添加操作日志记录
                var k = new OperationCrServer().AddLogOperationCr("PDA模块", "AGV转运", palletNo, "移库", $"PDA呼叫小车对托盘号:{palletNo}发起转运", userId);
                //提交事务
                Db.CommitTran();
                #region 呼叫小车代码
                List<AgvSchedulingTask> agvTaskList = new List<AgvSchedulingTask>();
                AgvSchedulingTask agvTask = new AgvSchedulingTask();
                agvTask.ReqCode = taskNo;
                agvTask.TaskTyp = "F01";
                agvTask.WbCode = "";
                agvTask.PositionCodePath = null;
                agvTask.PodCode = "-1";
                agvTaskList.Add(agvTask);
                var IsTrue = false;
                while (IsTrue == true)
                {
                    // 正式运行程序放开
                    string str = "";
                    var list2 = agvTaskList.Select(m => m.ReqCode).ToList();
                    var jsonData = JsonConvert.SerializeObject(agvTaskList);
                    string response = "";
                    try
                    {
                        var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss")
                        response = HttpHelper.DoPost(url, jsonData, "下发给AGV转运命令", "AGV");
                        var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss")
                        //////解析返回数据
                        var agvModel = JsonConvert.DeserializeObject<OutCommanAgvDto>(response);
                        if (agvModel.Code == "0")
                        {
                            //更改任务的发送返回时间//
                            new TaskServer().EditTaskIssueOk(list2, time1, time2);
                            str += "下发成功";
                            IsTrue = true;
                        }
                        if (agvModel.Code == "1")
                        {
                            new TaskServer().EditTaskIssueNo(list2, time1, time2, agvModel.Message);
                            throw new Exception(agvModel.Message);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
                #endregion
                //提交事务
                Db.CommitTran();
            }
            catch (Exception ex)
            {
@@ -1018,7 +1069,7 @@
        /// <param name="palletNo"></param>
        /// <param name="areaNo"></param>
        /// <param name="userId"></param>
        public void AgvTransport2(string soNo,string palletNo, string areaNo, int userId)
        public void AgvTransport2(string soNo, string palletNo, string areaNo, int userId, string url)
        {
            if (string.IsNullOrEmpty(soNo))
            {
@@ -1032,6 +1083,8 @@
            {
                //开启事务
                Db.BeginTran();
                List<AgvSchedulingTask> agvTaskList = new List<AgvSchedulingTask>();
                //出库单信息
                var notice = Db.Queryable<BllExportNotice>().First(w => w.IsDel == "0" && w.SONo == soNo);
                if (notice == null)
@@ -1130,6 +1183,15 @@
                    };
                    Db.Insertable(exTask).ExecuteCommand();
                    AgvSchedulingTask agvTask = new AgvSchedulingTask();
                    agvTask.ReqCode = taskNo;
                    agvTask.TaskTyp = "F01";
                    agvTask.WbCode = "";
                    agvTask.PositionCodePath = null;
                    agvTask.PodCode = "-1";
                    agvTaskList.Add(agvTask);
                    //修改库存明细信息
                    item.Status = "4";//移库锁定
                    item.LockQty = item.Qty;//锁定库存数量
@@ -1157,12 +1219,51 @@
                    //添加操作日志记录
                    var k = new OperationCrServer().AddLogOperationCr("PDA模块", "AGV转运", palletNo, "移库", $"PDA呼叫小车对托盘号:{palletNo}发起转运", userId);
                }
                //提交事务
                Db.CommitTran();
                #region 呼叫小车代码
                var IsTrue = false;
                while (IsTrue == true)
                {
                    // 正式运行程序放开
                    string str = "";
                    var list2 = agvTaskList.Select(m => m.ReqCode).ToList();
                    var jsonData = JsonConvert.SerializeObject(agvTaskList);
                    string response = "";
                    try
                    {
                        var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss")
                        response = HttpHelper.DoPost(url, jsonData, "下发给AGV转运取货命令", "AGV");
                        var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss")
                        //////解析返回数据
                        var agvModel = JsonConvert.DeserializeObject<OutCommanAgvDto>(response);
                        if (agvModel.Code == "0")
                        {
                            //更改任务的发送返回时间//
                            new TaskServer().EditTaskIssueOk(list2, time1, time2);
                            str += "下发成功";
                            IsTrue = true;
                        }
                        if (agvModel.Code == "1")
                        {
                            new TaskServer().EditTaskIssueNo(list2, time1, time2, agvModel.Message);
                            throw new Exception(agvModel.Message);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
                #endregion
                //提交事务
                Db.CommitTran();
            }
            catch (Exception ex)
            {