Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs
@@ -2087,6 +2087,86 @@
            }
        }
        /// <summary>
        /// wcs返回的成功信号(移库成功)
        /// </summary>
        /// <param name="taskNo">任务号</param>
        /// <param name="userId">操作人</param>
        /// <exception cref="Exception"></exception>
        public void RelocationSuccess(string taskNo, int userId)
        {
            try
            {
                //当前任务信息
                var task = Db.Queryable<LogTask>().First(m => m.TaskNo == taskNo && m.IsDel == "0");
                if (task == null)
                {
                    throw new Exception($"未查询到任务号为:‘{taskNo}’的任务信息");
                }
                if (task.Status == "2")
                {
                    throw new Exception("当前任务已完成");
                }
                Db.BeginTran();
                //库存中当前托盘的信息
                var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.PalletNo == task.PalletNo).ToList();
                //当前任务中的目标储位信息
                //当前任务中的原储位
                var locate = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == task.StartLocat);
                if (locate == null)
                {
                    throw new Exception($"WMS系统中没有该{task.StartLocat}储位对应的信息");
                }
                var locate2 = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == task.EndLocat);
                if (locate2 == null)
                {
                    throw new Exception($"WMS系统中没有该{task.EndLocat}储位对应的信息");
                }
                try
                {
                    task.Status = "2";//任务状态
                    task.IsSend = 0;
                    task.IsCancel = 0;
                    task.IsFinish = 0;
                    task.FinishDate = DateTime.Now;//完成时间
                    Db.Updateable(task).ExecuteCommand();
                    #region 修改储位状态
                    //原储位改为空储位 0
                    locate.Status = "0";
                    Db.Updateable(locate).ExecuteCommand();
                    //目标储位改为有货物 1
                    locate2.Status = "1";
                    Db.Updateable(locate2).ExecuteCommand();
                    foreach (var item in stockDetail)
                    {
                        item.WareHouseNo = locate2.WareHouseNo;
                        item.AreaNo = locate2.AreaNo;
                        item.RoadwayNo = locate2.RoadwayNo;
                        item.LocatNo = locate2.LocatNo;
                    }
                    Db.Updateable(stockDetail).ExecuteCommand();
                    #endregion
                    Db.CommitTran();
                }
                catch (Exception ex)
                {
                    Db.RollbackTran();
                    throw new Exception(ex.Message);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("完成反馈失败:" + ex.Message);
            }
        }
        //重新下发出库任务
        public OutCommandDto AgainSendSoTask(string taskNo, int userId, string url)
        {
@@ -3071,10 +3151,7 @@
            var lie = int.Parse(oldAddress.Substring(2, 2));
            var ceng = int.Parse(oldAddress.Substring(4, 2));
            var sqlString = $@"select LocatNo,[Row],[Column],Layer, (ABS(Row-{row}) + ABS([Column]-{lie}) + ABS(Layer-{ceng}))  as distNum
                                from SysStorageLocat
                                where Flag = '0' and Status = '0' and Depth = '02' and RoadwayNo = '{roadWay}' and AreaNo in '{category}'
                                order by distNum;";
            var sqlString = $@"select LocatNo,[Row],[Column],Layer, (ABS(Row-{row}) + ABS([Column]-{lie}) + ABS(Layer-{ceng}))  as distNum from SysStorageLocat where Flag = '0' and Status = '0' and Depth = '02' and RoadwayNo = '{roadWay}' and AreaNo in ('{category.AreaNo}') order by distNum;";
            var addressModels = Db.Ado.SqlQuery<AddressCls>(sqlString).ToList();
            if (addressModels.Count > 0)   // 判断同巷道内排空库位