Administrator
2025-05-08 f928756ecbf68886443ab87ce458b99aba73a763
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
using WMS.BLL.LogServer;
using WMS.Entity.Context;
using WMS.Entity.DataEntity;
using WMS.Entity.LogEntity;
using WMS.Entity.SysEntity;
using WMS.IBLL;
 
namespace WMS.BLL
{
    public class HttpServer:IHttpServer
    {
        private static readonly SqlSugarScope Db = DataContext.Db;
        public HttpServer() { }
 
        public void UpLocateByAgvOut(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 != "1")
                {
                    throw new Exception("当前任务已完成");
                }
                if (userId != 0)
                {
                    //添加操作日志记录
                    var k = new OperationASNServer().AddLogOperationAsn("入库作业", "入库日志", taskNo, "完成", $"点击完成按钮、完成任务号为:{taskNo}的任务", userId);
                }
                
                var locate = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == task.StartLocat);
                if (locate == null)
                {
                    throw new Exception($"未查询到任务中的储位信息");
                }
                var pingAreaStr = Db.Queryable<SysStorageArea>().Where(m => m.IsDel == "0" && m.WareHouseNo == "W04" && m.AreaNo != "B06" && m.AreaNo != "B07").Select(m => m.AreaNo).ToList();
                var pingLocateInfo = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == locate.LocatNo && pingAreaStr.Contains(m.AreaNo) && m.IsDel == "0");
                if (pingLocateInfo == null)
                {
                    throw new Exception("当前任务起始储位不在平库储位");
                }
                locate.Status = "0";
                Db.Updateable(locate).ExecuteCommand();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
    }
}