zhaowc
2025-05-20 d09a1552e45e6cfc8f83c0249cd296b8706c0dc2
Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs
@@ -217,7 +217,7 @@
        /// <param name="lotNo">批次</param>
        /// <param name="userId">操作人</param>
        /// <exception cref="Exception"></exception>
        public void jiaoLiaoHopper(string areaNo,string endLocate,string plnStatus,string standard,string skuNo,string lotNo,string url,int userId)
        public void jiaoLiaoHopper(string areaNo,string endLocate,string plnStatus,string standard,string skuNo,string lotNo,string url, string bindUrl, int userId)
        {
            try
            {
@@ -306,7 +306,7 @@
                    {
                        throw new Exception("未找到对应桶信息");
                    }
                    resultYi = YikuTask(palletModel.PalletNo, taskNo, url);
                    resultYi = YikuTask(palletModel.PalletNo, taskNo, url,bindUrl);
                }
                #endregion
                //起始储位地址信息
@@ -358,29 +358,41 @@
                    string agvMsg = string.Empty;
                    //给下车下发任务
                    logTaskEntry.SendDate = DateTime.Now;//发送时间
                    var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg);
                    if (agvResult)//成功
                    //下发载具类型
                    var bind = RcsHelper.BindPalletAndSite(palletModel.PalletNo, palletModel.LocatNo, url, 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 = RcsHelper.CreateTaskForAgv(task, url, out agvMsg);
                        if (agvResult)//成功
                        {
                            //请求成功修改任务表相应字段状态
                            logTaskEntry.IsSuccess = 1;
                            logTaskEntry.IsSend = 0;
                            //logTaskEntry.IsCancel = 0;
                            logTaskEntry.BackDate = DateTime.Now;
                            logTaskEntry.Status = "1";//正在执行
                            Db.Insertable(logTaskEntry).ExecuteCommand();
                        startLoction.Status = "3";//出库中
                        Db.Updateable(startLoction).ExecuteCommand();
                            startLoction.Status = "3";//出库中
                            Db.Updateable(startLoction).ExecuteCommand();
                        endLocateInfo.Status = "2";//入库中
                        Db.Updateable(endLocateInfo).ExecuteCommand();
                            endLocateInfo.Status = "2";//入库中
                            Db.Updateable(endLocateInfo).ExecuteCommand();
                        }
                        else//失败
                        {
                            logTaskEntry.IsSuccess = 0;
                            logTaskEntry.Information = agvMsg;
                            Db.Insertable(logTaskEntry).ExecuteCommand();
                        }
                    }
                    else//失败
                    else
                    {
                        logTaskEntry.IsSuccess = 0;
                        logTaskEntry.Information = agvMsg;
                        logTaskEntry.Information = "货架与货位绑定失败,原因:"+agvBindMsg;
                        Db.Insertable(logTaskEntry).ExecuteCommand();
                    }
                }
                //提交事务
                Db.CommitTran();
@@ -405,7 +417,7 @@
        /// <param name="lotNo">批次</param>
        /// <param name="userId">操作人</param>
        /// <exception cref="Exception"></exception>
        public void jiaoCheHopper(string areaNo, string StartLocate, string plnNo, string plnStatus, decimal weight,  string skuNo, string lotNo, string url,int userId)
        public void jiaoCheHopper(string areaNo, string StartLocate, string plnNo, string plnStatus, decimal weight,  string skuNo, string lotNo, string url,string bindUrl,int userId)
        {
            try
            {
@@ -550,29 +562,42 @@
                string agvMsg = string.Empty;
                //给下车下发任务
                logTaskEntry.SendDate = DateTime.Now;//发送时间
                var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg);
                if (agvResult)//成功
                //下发载具与货位绑定
                var bind = RcsHelper.BindPalletAndSite(plnNo, StartLocate, 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 = RcsHelper.CreateTaskForAgv(task, url, out agvMsg);
                    if (agvResult)//成功
                    {
                        //请求成功修改任务表相应字段状态
                        logTaskEntry.IsSuccess = 1;
                        logTaskEntry.IsSend = 0;
                        //logTaskEntry.IsCancel = 0;
                        logTaskEntry.BackDate = DateTime.Now;
                        logTaskEntry.Status = "1";//正在执行
                        Db.Insertable(logTaskEntry).ExecuteCommand();
                    startLoction.Status = "3";//出库中
                    Db.Updateable(startLoction).ExecuteCommand();
                        startLoction.Status = "3";//出库中
                        Db.Updateable(startLoction).ExecuteCommand();
                    endLocatInfo.Status = "2";//入库中
                    Db.Updateable(endLocatInfo).ExecuteCommand();
                        endLocatInfo.Status = "2";//入库中
                        Db.Updateable(endLocatInfo).ExecuteCommand();
                    }
                    else//失败
                    {
                        logTaskEntry.IsSuccess = 0;
                        logTaskEntry.Information = agvMsg;
                        Db.Insertable(logTaskEntry).ExecuteCommand();
                    }
                }
                else//失败
                else
                {
                    logTaskEntry.IsSuccess = 0;
                    logTaskEntry.Information = agvMsg;
                    logTaskEntry.Information = "货架与货位绑定失败,原因:"+agvBindMsg;
                    Db.Insertable(logTaskEntry).ExecuteCommand();
                }
                //提交事务
                Db.CommitTran();
@@ -727,7 +752,7 @@
        /// <param name="deviceStation">叫料点位:”input”-入口(叫脏桶),”output”-出口(净桶申请储位)</param>
        /// <param name="status"></param>
        /// <exception cref="Exception"></exception>
        public void RCSCleanRequest(string deviceID,string deviceStation,string status,string url)
        public void RCSCleanRequest(string deviceID,string deviceStation,string status,string url,string bindUrl)
        {
            try
            {
@@ -859,29 +884,41 @@
                string agvMsg = string.Empty;
                //给下车下发任务
                logTaskEntry.SendDate = DateTime.Now;//发送时间
                var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg);
                if (agvResult)//成功
                //下发载具与货位绑定
                var bind = RcsHelper.BindPalletAndSite(palletModel.PalletNo, palletModel.LocatNo, 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 = RcsHelper.CreateTaskForAgv(task, url, out agvMsg);
                    if (agvResult)//成功
                    {
                        //请求成功修改任务表相应字段状态
                        logTaskEntry.IsSuccess = 1;
                        logTaskEntry.IsSend = 0;
                        //logTaskEntry.IsCancel = 0;
                        logTaskEntry.BackDate = DateTime.Now;
                        logTaskEntry.Status = "1";//正在执行
                        Db.Insertable(logTaskEntry).ExecuteCommand();
                    startLoction.Status = "3";//出库中
                    Db.Updateable(startLoction).ExecuteCommand();
                        startLoction.Status = "3";//出库中
                        Db.Updateable(startLoction).ExecuteCommand();
                    endLoction.Status = "2";//入库中
                    Db.Updateable(endLoction).ExecuteCommand();
                        endLoction.Status = "2";//入库中
                        Db.Updateable(endLoction).ExecuteCommand();
                    }
                    else//失败
                    {
                        logTaskEntry.IsSuccess = 0;
                        logTaskEntry.Information = agvMsg;
                        Db.Insertable(logTaskEntry).ExecuteCommand();
                    }
                }
                else//失败
                else
                {
                    logTaskEntry.IsSuccess = 0;
                    logTaskEntry.Information = agvMsg;
                    logTaskEntry.Information = agvBindMsg;
                    Db.Insertable(logTaskEntry).ExecuteCommand();
                }
                //提交事务
                Db.CommitTran();
            }
@@ -893,7 +930,7 @@
            }
        }
        private bool YikuTask(string palletNo, string taskNo, string url)
        private bool YikuTask(string palletNo, string taskNo, string url,string bindUrl)
        {
            try
            {
@@ -985,33 +1022,47 @@
                        string agvMsg = string.Empty;
                        //给下车下发任务
                        logTaskEntry.SendDate = DateTime.Now;//发送时间
                        var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70");
                        if (agvResult)//成功
                                                             //下发载具与货位绑定
                        var bind = RcsHelper.BindPalletAndSite(palletInfoYi.LocatNo, palletInfoYi.PalletNo, 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 = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70");
                            if (agvResult)//成功
                            {
                                //请求成功修改任务表相应字段状态
                                logTaskEntry.IsSuccess = 1;
                                logTaskEntry.IsSend = 0;
                                //logTaskEntry.IsCancel = 0;
                                logTaskEntry.BackDate = DateTime.Now;
                                logTaskEntry.Status = "1";//正在执行
                                Db.Insertable(logTaskEntry).ExecuteCommand();
                            //修改移出储位状态
                            locatInfo.Status = "5";//移出中
                            Db.Updateable(locatInfo).ExecuteCommand();
                                //修改移出储位状态
                                locatInfo.Status = "5";//移出中
                                Db.Updateable(locatInfo).ExecuteCommand();
                            //修改移入储位状态
                            transferLocat.Status = "4";//移入中
                            Db.Updateable(transferLocat).ExecuteCommand();
                                //修改移入储位状态
                                transferLocat.Status = "4";//移入中
                                Db.Updateable(transferLocat).ExecuteCommand();
                            }
                            else//失败
                            {
                                logTaskEntry.IsSuccess = 0;
                                logTaskEntry.Information = agvMsg;
                                Db.Insertable(logTaskEntry).ExecuteCommand();
                                throw new Exception($"给小车下发移库任务失败,桶号:{palletInfoYi.PalletNo}");
                            }
                        }
                        else//失败
                        else
                        {
                            logTaskEntry.IsSuccess = 0;
                            logTaskEntry.Information = agvMsg;
                            logTaskEntry.Information = agvBindMsg;
                            Db.Insertable(logTaskEntry).ExecuteCommand();
                            throw new Exception($"给小车下发移库任务失败,桶号:{palletInfoYi.PalletNo}");
                        }
                    }
                }
                return true;
@@ -1027,7 +1078,7 @@
        /// <param name="taskNo"></param>
        /// <param name="url"></param>
        /// <exception cref="Exception"></exception>
        public void OutBinAgv(string taskNo,string url)
        public void OutBinAgv(string taskNo,string url, string bindUrl)
        {
            try
            {
@@ -1080,33 +1131,47 @@
                    string agvMsg = string.Empty;
                    //给下车下发任务
                    logTaskInfoZ.SendDate = DateTime.Now;//发送时间
                    var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70");
                    if (agvResult)//成功
                    //下发载具与货们绑定
                    var bind = RcsHelper.BindPalletAndSite(logTaskInfoZ.PalletNo, logTaskInfoZ.StartLocat, bindUrl, out string agvBindMsg);
                    if (bind)
                    {
                        //请求成功修改任务表相应字段状态
                        logTaskInfoZ.IsSuccess = 1;
                        logTaskInfoZ.IsSend = 0;
                        //logTaskEntry.IsCancel = 0;
                        logTaskInfoZ.BackDate = DateTime.Now;
                        logTaskInfoZ.Status = "1";//正在执行
                        Db.Insertable(logTaskInfoZ).ExecuteCommand();
                        var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70");
                        if (agvResult)//成功
                        {
                            //请求成功修改任务表相应字段状态
                            logTaskInfoZ.IsSuccess = 1;
                            logTaskInfoZ.IsSend = 0;
                            //logTaskEntry.IsCancel = 0;
                            logTaskInfoZ.BackDate = DateTime.Now;
                            logTaskInfoZ.Status = "1";//正在执行
                            Db.Insertable(logTaskInfoZ).ExecuteCommand();
                        //修改移出储位状态
                        startLocatInfoZ.Status = "5";//移出中
                        Db.Updateable(startLocatInfoZ).ExecuteCommand();
                            //修改移出储位状态
                            startLocatInfoZ.Status = "5";//移出中
                            Db.Updateable(startLocatInfoZ).ExecuteCommand();
                        //修改移入储位状态
                        endLocatInfoZ.Status = "4";//移入中
                        Db.Updateable(endLocatInfoZ).ExecuteCommand();
                            //修改移入储位状态
                            endLocatInfoZ.Status = "4";//移入中
                            Db.Updateable(endLocatInfoZ).ExecuteCommand();
                        }
                        else//失败
                        {
                            logTaskInfoZ.IsSuccess = 0;
                            logTaskInfoZ.Information = agvMsg;
                            Db.Insertable(logTaskInfoZ).ExecuteCommand();
                            throw new Exception($"给小车下发移库任务失败,桶号:{logTaskInfoZ.PalletNo}");
                        }
                    }
                    else//失败
                    else
                    {
                        logTaskInfoZ.IsSuccess = 0;
                        logTaskInfoZ.Information = agvMsg;
                        logTaskInfoZ.Information = agvBindMsg;
                        Db.Insertable(logTaskInfoZ).ExecuteCommand();
                        throw new Exception($"给小车下发移库任务失败,桶号:{logTaskInfoZ.PalletNo}");
                    }
                }
            }
            catch (Exception e)
@@ -1122,7 +1187,7 @@
        /// </summary>
        /// <param name="url"></param>
        /// <exception cref="Exception"></exception>
        public void TransferBackTimer(string url)
        public void TransferBackTimer(string url,string bindUrl)
        {
            try
            {
@@ -1197,33 +1262,47 @@
                        string agvMsg = string.Empty;
                        //给下车下发任务
                        logTaskEntry.SendDate = DateTime.Now;//发送时间
                        var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg);
                        if (agvResult)//成功
                        //下发载具与货位绑定
                        var bind = RcsHelper.BindPalletAndSite(detailInfo.PalletNo, detailInfo.LocatNo, 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 = RcsHelper.CreateTaskForAgv(task, url, out agvMsg);
                            if (agvResult)//成功
                            {
                                //请求成功修改任务表相应字段状态
                                logTaskEntry.IsSuccess = 1;
                                logTaskEntry.IsSend = 0;
                                //logTaskEntry.IsCancel = 0;
                                logTaskEntry.BackDate = DateTime.Now;
                                logTaskEntry.Status = "1";//正在执行
                                Db.Insertable(logTaskEntry).ExecuteCommand();
                            //修改移出储位状态
                            locatModel.Status = "5";//移出中
                            Db.Updateable(locatModel).ExecuteCommand();
                                //修改移出储位状态
                                locatModel.Status = "5";//移出中
                                Db.Updateable(locatModel).ExecuteCommand();
                            //修改移入储位状态
                            endLocatInfo.Status = "4";//移入中
                            Db.Updateable(endLocatInfo).ExecuteCommand();
                                //修改移入储位状态
                                endLocatInfo.Status = "4";//移入中
                                Db.Updateable(endLocatInfo).ExecuteCommand();
                            }
                            else//失败
                            {
                                logTaskEntry.IsSuccess = 0;
                                logTaskEntry.Information = agvMsg;
                                Db.Insertable(logTaskEntry).ExecuteCommand();
                                throw new Exception($"给小车下发移库任务失败,桶号:{detailInfo.PalletNo}");
                            }
                        }
                        else//失败
                        else
                        {
                            logTaskEntry.IsSuccess = 0;
                            logTaskEntry.Information = agvMsg;
                            logTaskEntry.Information = agvBindMsg;
                            Db.Insertable(logTaskEntry).ExecuteCommand();
                            throw new Exception($"给小车下发移库任务失败,桶号:{detailInfo.PalletNo}");
                        }
                    }
                }
                //提交事务