chengsc
2025-05-08 8a83e6f21af0a764950e45b2565a370fff74daa5
Wms/WMS.BLL/BllAsnServer/PalletBindServer.cs
@@ -2589,21 +2589,21 @@
                try
                {
                    var time1 = DateTime.Now;//发送时间 .ToString("yyyy-MM-dd HH:mm:ss")
                    response = HttpHelper.DoPost(url, jsonData, "下发给WCS入库命令", "WCS");
                    //response = HttpHelper.DoPost(url, jsonData, "下发给WCS入库命令", "WCS");
                    var time2 = DateTime.Now;//返回时间 .ToString("yyyy-MM-dd HH:mm:ss")
                    var list = new List<string>() { model.TaskNo };
                    //解析返回数据
                    var wcsModel = JsonConvert.DeserializeObject<WcsModel2>(response);
                    if (wcsModel.code == 200)
                    {
                    ////解析返回数据
                    //var wcsModel = JsonConvert.DeserializeObject<WcsModel2>(response);
                    //if (wcsModel.code == 200)
                    //{
                        //更改任务的发送返回时间//
                        new TaskServer().EditTaskIssueOk(list, time1, time2);
                    }else
                    {
                        new TaskServer().EditTaskIssueNo(list, time1, time2, wcsModel.message);
                        throw new Exception("WCS反馈:"+wcsModel.message);
                    }
                    //}else
                    //{
                    //    new TaskServer().EditTaskIssueNo(list, time1, time2, wcsModel.message);
                    //    throw new Exception("WCS反馈:"+wcsModel.message);
                    //}
                }
                catch (Exception ex)
                {
@@ -2616,85 +2616,7 @@
            }
        }
        /// <summary>
        /// 入库任务完成JC34
        /// </summary>
        /// <param name="taskNo"></param>
        /// <param name="userId"></param>
        /// <exception cref="Exception"></exception>
        public void ArrivalSuccess2(string taskNo, int userId)
        {
            try
            {
                //正常入库
                var task = Db.Queryable<LogTask>().First(m => m.IsDel == "0" && m.TaskNo == taskNo);
                if (task == null)
                {
                    throw new Exception("未查询到任务信息");
                }
                if (task.Status == "2")
                {
                    throw new Exception("当前任务已完成");
                }
                var stockDetail = Db.Queryable<DataStockDetail>().Where(m => m.PalletNo == task.PalletNo).ToList();
                var upShelf = Db.Queryable<BllPalletUpShelf>().First(m => m.TaskNo == taskNo);
                if (upShelf == null)
                {
                    throw new Exception("没有找到托盘上架信息");
                }
                //当前任务中的储位信息
                var locate = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == task.EndLocat);
                if (locate == null)
                {
                    throw new Exception($"未查询到任务中的储位信息");
                }
                Db.BeginTran();
                task.Status = "2";//任务状态
                task.IsSend = 0;
                task.IsCancel = 0;
                task.IsFinish = 0;
                task.FinishDate = DateTime.Now;//完成时间
                Db.Updateable(task).ExecuteCommand();
                if (userId != 0)
                {
                    //添加操作日志记录
                    var k = new OperationASNServer().AddLogOperationAsn("入库作业", "入库日志", taskNo, "完成", $"点击完成按钮、完成任务号为:{taskNo}的任务", userId);
                }
                //判断是否是回流入库完成
                if (stockDetail.Any())
                {
                    throw new Exception("没有查询到库存信息");
                }
                foreach (var item in stockDetail)
                {
                    item.WareHouseNo = locate.WareHouseNo;
                    item.RoadwayNo = locate.RoadwayNo;
                    item.AreaNo = locate.AreaNo;
                    item.LocatNo = locate.LocatNo;
                    item.UpdateTime = DateTime.Now;
                    if (userId != 0)
                    {
                        item.UpdateUser = userId;
                    }
                }
                upShelf.Status = "2";
                Db.Updateable(upShelf).ExecuteCommand();
                locate.Status = "1";
                Db.Updateable(locate).ExecuteCommand();
                Db.Updateable(stockDetail).ExecuteCommand();
                Db.CommitTran();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        #endregion
@@ -4330,7 +4252,8 @@
                var upShelfList = Db.Queryable<BllPalletUpShelf>().Where(m => m.IsDel == "0" && m.TaskNo == taskNo && m.PalletNo == task.PalletNo).ToList();
                foreach (var upShelf in upShelfList)
                {
                    upShelf.IsDel = "1";
                    //upShelf.IsDel = "1";
                    upShelf.Status = "4";
                    Db.Updateable(upShelf).ExecuteCommand();
                }