Tjiny
2025-05-23 cd195e83605f60ac51db6e0b4f0fcaeeb200768d
海成入库货位分配逻辑开发
5个文件已添加
5个文件已修改
816 ■■■■■ 已修改文件
HH.WCS.Mobox3.HaiCheng/Controller/Service/TaskService.cs 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/Entity/CntrItemDetail.cs 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/Entity/Container.cs 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/Entity/LocCntrRel.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/HH.WCS.Mobox3.HaiCheng.csproj 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/Program.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/Util/Helper/AdoSqlHelper.cs 288 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/Util/Helper/HelperMethod.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/Util/Helper/LogHelper.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/config/config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HH.WCS.Mobox3.HaiCheng/Controller/Service/TaskService.cs
New file
@@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using HH.WCS.Mobox3.Template.Entity;
using HH.WCS.Mobox3.Template.Util.Helper;
namespace HH.WCS.Mobox3.Template.Controller.Service;
/// <summary>
/// 任务
/// </summary>
public static class TaskService
{
    /// <summary>
    /// 创建作业
    /// </summary>
    /// <returns></returns>
    public static void CreateTask()
    {
        // 1. 查询任务是否已创建
        var operation = AdoSqlHelper<Operation>.QueryFirstByDecs(p => p.N_B_STATE == 0, p => p.T_CREATE);
        if (operation == null)
        {
            return;
        }
        // 任务存在,根据任务类型做不同的操作
        if (operation.N_TYPE == 1)
        {
            var inputLocation = InputLocation(operation.S_CNTR_CODE);
            if (inputLocation == null)
            {
                LogHelper.Info($"当前容器未绑定物料,请检查", "出入库流程日志");
                return;
            }
            // 任务
            var task = new Task()
            {
                // 作业编码
                S_OP_CODE = operation.S_CODE,
                // 任务号
                S_CODE = HelperMethod.GenerateTaskNo("任务号", "TA"),
                // 任务类型
                N_TYPE = operation.N_TYPE,
                // 任务类型
                S_TYPE = Task.GetStateType(operation.N_TYPE),
                // 起点货位
                S_START_LOC = operation.S_START_LOC,
                // 终点货位
                S_END_LOC = inputLocation.S_CODE,
                // 容器编码
                S_CNTR_CODE = operation.S_CNTR_CODE,
            };
            // 修改作业状态为执行中
            operation.N_B_STATE = 1;
            operation.S_B_STATE = "执行";
            operation.T_START_TIME = DateTime.Now;
            var querySqlSugarClient = AdoSqlHelper<object>.QuerySqlSugarClient();
            try
            {
                querySqlSugarClient.BeginTran();
                AdoSqlHelper<Task>.AddFirstTran(querySqlSugarClient, task);
                AdoSqlHelper<Operation>.UpdateFirstTran(querySqlSugarClient, operation,
                    p => new { p.N_B_STATE, p.S_B_STATE, p.T_START_TIME });
                querySqlSugarClient.CommitTran();
            }
            catch (Exception e)
            {
                if (operation.N_TYPE == 1)
                {
                    LogHelper.Info($"作业号为:{operation.S_CODE}的任务创建失败", "出入库流程日志");
                }
                else
                {
                    LogHelper.Info($"作业号为:{operation.S_CODE}的任务创建失败", "出入库流程日志");
                }
                querySqlSugarClient.RollbackTran();
            }
        }
    }
    /// <summary>
    /// 入库货位分配
    /// </summary>
    /// <returns></returns>
    private static Location InputLocation(string container)
    {
        var cntrItemDetail = AdoSqlHelper<CntrItemDetail>.QueryFirst(p => p.S_CNTR_CODE == container);
        if (cntrItemDetail == null)
        {
            return null;
        }
        return AdoSqlHelper<Location>.QueryInputLocation(cntrItemDetail.S_ITEM_CODE);
    }
}
HH.WCS.Mobox3.HaiCheng/Entity/CntrItemDetail.cs
New file
@@ -0,0 +1,187 @@
using System;
using System.ComponentModel;
using SqlSugar;
namespace HH.WCS.Mobox3.Template.Entity;
/// <summary>
/// 容器货品明细
/// </summary>
[SugarTable("TN_CG_Detail")]
public class CntrItemDetail : BaseModel
{
    /// <summary>
    /// 容器货品ID
    /// </summary>
    public string S_CG_ID { get; set; }
    /// <summary>
    /// 容器编码
    /// </summary>
    public string S_CNTR_CODE { get; set; }
    /// <summary>
    ///相同 ITEM 合并
    /// </summary>
    public string C_ITEM_MERGE { get; set; } = "空";
    /// <summary>
    /// 箱格号
    /// </summary>
    public char S_CELL_NO { get; set; }
    /// <summary>
    /// 货品系列号
    /// </summary>
    public string S_SERIAL_NO { get; set; }
    /// <summary>
    /// 货品编码
    /// </summary>
    public string S_ITEM_CODE { get; set; }
    /// <summary>
    /// 货品名称
    /// </summary>
    public string S_ITEM_NAME { get; set; }
    /// <summary>
    /// 货品规格
    /// </summary>
    public string S_ITEM_SPEC { get; set; }
    /// <summary>
    /// 货品状态
    /// </summary>
    public string S_ITEM_STATE { get; set; } = "合格";
    /// <summary>
    /// 货品状态
    /// </summary>
    public int N_ITEM_STATE { get; set; }
    /// <summary>
    /// 批次号
    /// </summary>
    public string S_BATCH_NO { get; set; }
    /// <summary>
    /// 使用者
    /// </summary>
    public string S_END_USER { get; set; }
    /// <summary>
    /// 货主编码
    /// </summary>
    public string S_OWNER { get; set; }
    /// <summary>
    /// 供应商编码
    /// </summary>
    public string S_SUPPLIER_NO { get; set; }
    /// <summary>
    /// 供应商名称
    /// </summary>
    public string S_SUPPLIER_NAME { get; set; }
    /// <summary>
    /// 数量
    /// </summary>
    public float F_QTY { get; set; }
    /// <summary>
    /// 计量单位
    /// </summary>
    public string S_UOM { get; set; } = "kg";
    /// <summary>
    /// 分配量
    /// </summary>
    public float F_ALLOC_QTY { get; set; }
    /// <summary>
    /// 来源类型
    /// </summary>
    public string S_BS_TYPE { get; set; }
    /// <summary>
    /// 来源单号
    /// </summary>
    public string S_BS_NO { get; set; }
    /// <summary>
    /// 来源单行号
    /// </summary>
    public int N_BS_ROW_NO { get; set; }
    /// <summary>
    /// 生产日期
    /// </summary>
    public string D_PRD_DATE { get; set; }
    /// <summary>
    /// 过期日期
    /// </summary>
    public string D_EXP_DATE { get; set; }
    /// <summary>
    /// 体积
    /// </summary>
    public float F_VOLUME { get; set; }
    /// <summary>
    /// 重量
    /// </summary>
    public float F_WEIGHT { get; set; }
    /// <summary>
    /// 入库时间
    /// </summary>
    public DateTime T_INBOUND_TIME { get; set; }
    /// <summary>
    /// ERP仓库
    /// </summary>
    public string S_ERP_WH_CODE { get; set; }
    /// <summary>
    /// 扩展属性1
    /// </summary>
    public string S_EXT_ATTR1 { get; set; }
    /// <summary>
    /// 扩展属性2
    /// </summary>
    public string S_EXT_ATTR2 { get; set; }
    /// <summary>
    /// 扩展属性3
    /// </summary>
    public string S_EXT_ATTR3 { get; set; }
    /// <summary>
    /// 扩展属性4
    /// </summary>
    public string S_EXT_ATTR4 { get; set; }
    /// <summary>
    /// 扩展属性5
    /// </summary>
    public string S_EXT_ATTR5 { get; set; }
    /// <summary>
    /// 是否入库(1:默认未入库,2:入库)
    /// </summary>
    public int N_ALR_ENTR { get; set; } = 1;
    /// <summary>
    /// 地址码
    /// </summary>
    public string S_ADDRESS_CODE { get; set; }
    /// <summary>
    /// 仓库编码
    /// </summary>
    public string S_WH_CODE { get; set; }
}
HH.WCS.Mobox3.HaiCheng/Entity/Container.cs
New file
@@ -0,0 +1,133 @@
using System.Collections.Generic;
using SqlSugar;
namespace HH.WCS.Mobox3.Template.Entity;
/// <summary>
/// 容器模型
/// </summary>
[SugarTable("TN_Container")]
public class Container : BaseModel
{
    /// <summary>
    /// 容器编码
    /// </summary>
    public string S_CODE { get; set; }
    /// <summary>
    /// 容器类型
    /// </summary>
    public string S_TYPE { get; set; }
    /// <summary>
    /// 容器类型
    /// </summary>
    public int N_TYPE { get; set; }
    /// <summary>
    /// 容器规格
    /// </summary>
    public string S_SPEC { get; set; }
    /// <summary>
    /// 自重
    /// </summary>
    public float F_WEIGHT { get; set; }
    /// <summary>
    /// 货品重量
    /// </summary>
    public float F_GOOD_WEIGHT { get; set; }
    /// <summary>
    /// 承重
    /// </summary>
    public float F_MAX_WEIGHT { get; set; }
    /// <summary>
    /// 长
    /// </summary>
    //public float F_LENGTH { get; set; }
    /// <summary>
    /// 宽
    /// </summary>
    //public float F_WIDTH { get; set; }
    /// <summary>
    /// 高
    /// </summary>
    //public float F_HEIGHT { get; set; }
    /// <summary>
    /// 是否为虚拟容器
    /// </summary>
    public char C_IS_VIRTUAL { get; set; }
    /// <summary>
    /// 是否可用
    /// </summary>
    public char C_ENABLE { get; set; } = 'Y';
    /// <summary>
    /// 容器明细条数
    /// </summary>
    public int N_DETAIL_COUNT { get; set; }
    /// <summary>
    /// 容器业务状态(0:空闲,1:入库中,2:出库中)
    /// </summary>
    public int N_B_STATE { get; set; }
    /// <summary>
    /// 锁定业务号
    /// </summary>
    public string S_LOCK_OP_CODE { get; set; }
    /// <summary>
    /// 最大体积
    /// </summary>
    public float F_MAX_VOLUME { get; set; }
    /// <summary>
    /// 货品体积
    /// </summary>
    public float F_GOOD_VOLUME { get; set; }
    /// <summary>
    /// 空满状态
    /// </summary>
    //public int N_EMPTY_FULL { get; set; }
    /// <summary>
    /// 最大料格数量
    /// </summary>
    //public int N_MAX_CELL_NUM { get; set; }
    /// <summary>
    /// 空料格数量
    /// </summary>
    //public int N_EMPTY_CELL_NUM { get; set; }
    /// <summary>
    /// 强制置满
    /// </summary>
    //public char C_FORCED_FILL { get; set; }
    /// <summary>
    /// 锁状态(0:无,1:入库锁,2:出库锁)
    /// </summary>
    public string S_LOCK_STATE { get; set; }
    /// <summary>
    /// 锁状态(0:无,1:入库锁,2:出库锁)
    /// </summary>
    public int N_LOCK_STATE { get; set; }
    /// <summary>
    /// 容器货品明细关联
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    [Navigate(NavigateType.OneToMany, nameof(CntrItemDetail.S_CNTR_CODE), nameof(S_CODE))]
    public List<CntrItemDetail> CntrItemRels { get; set; }
}
HH.WCS.Mobox3.HaiCheng/Entity/LocCntrRel.cs
New file
@@ -0,0 +1,29 @@
using System.Collections.Generic;
using SqlSugar;
namespace HH.WCS.Mobox3.Template.Entity;
/// <summary>
/// ��λ����
/// </summary>
[SugarTable("TN_Loc_Container")]
public class LocCntrRel : BaseModel
{
    /// <summary>
    /// ��λ����
    /// </summary>
    [SugarColumn(IsPrimaryKey = true)]
    public string S_LOC_CODE { get; set; }
    /// <summary>
    /// ��������
    /// </summary>
    public string S_CNTR_CODE { get; set; }
    /// <summary>
    /// ������λ��ϸ����
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    [Navigate(NavigateType.OneToMany, nameof(S_CNTR_CODE))]
    public List<CntrItemDetail> CntrItemRels { get; set; }
}
HH.WCS.Mobox3.HaiCheng/HH.WCS.Mobox3.HaiCheng.csproj
@@ -142,8 +142,11 @@
    <Compile Include="Controller\FourWayCarController.cs" />
    <Compile Include="Controller\Service\FourWayCarService.cs" />
    <Compile Include="Controller\Service\OperationService.cs" />
    <Compile Include="Controller\Service\TaskService.cs" />
    <Compile Include="Controller\Service\ThirdPartyService.cs" />
    <Compile Include="Entity\BaseModel.cs" />
    <Compile Include="Entity\CntrItemDetail.cs" />
    <Compile Include="Entity\Container.cs" />
    <Compile Include="Entity\Dto\ContainerDto.cs" />
    <Compile Include="Entity\Dto\ConveyorlinesInfoDto.cs" />
    <Compile Include="Entity\Dto\FourWayCarCommanDto.cs" />
@@ -152,6 +155,7 @@
    <Compile Include="Entity\Dto\LineTaskDto.cs" />
    <Compile Include="Entity\Dto\ResultDto.cs" />
    <Compile Include="Entity\Location.cs" />
    <Compile Include="Entity\LocCntrRel.cs" />
    <Compile Include="Entity\Operation.cs" />
    <Compile Include="Entity\Task.cs" />
    <Compile Include="Procss\ThreadTask.cs" />
@@ -166,6 +170,7 @@
    <Compile Include="Util\EquipmentCommunication\TcpClient.cs" />
    <Compile Include="Util\EquipmentCommunication\TcpServer.cs" />
    <Compile Include="Util\Helper\AdoSqlHelper.cs" />
    <Compile Include="Util\Helper\HelperMethod.cs" />
    <Compile Include="Util\Helper\HttpHelper.cs" />
    <Compile Include="Util\Helper\LogHelper.cs" />
    <Compile Include="Util\Helper\NdcHelper.cs" />
HH.WCS.Mobox3.HaiCheng/Program.cs
@@ -30,8 +30,10 @@
            StartTcp();
            //3.0 开启线程
            var rc = HostFactory.Run(x => {
                x.Service<WorkThread>(s => {
            var rc = HostFactory.Run(x =>
            {
                x.Service<WorkThread>(s =>
                {
                    s.ConstructUsing(name => new WorkThread());
                    s.WhenStarted(tc => tc.Start());
                    s.WhenStopped(tc => tc.Stop());
@@ -131,6 +133,7 @@
                        Thread.Sleep(4000);
                    }
                });
                return task;
            }
        }
HH.WCS.Mobox3.HaiCheng/Util/Helper/AdoSqlHelper.cs
@@ -1,6 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using HH.WCS.Mobox3.Template.Entity;
using SqlSugar;
namespace HH.WCS.Mobox3.Template.Util.Helper
{
@@ -14,14 +17,14 @@
        /// </summary>
        /// <param name="condition">条件</param>
        /// <returns></returns>
        public static T QueryFirst(Expression<Func<T,bool>> condition)
        public static T QueryFirst(Expression<Func<T, bool>> condition)
        {
            var db = new SqlHelper<object>().GetInstance();
            // 返回数据
            return db.Queryable<T>().First(condition);
        }
        /// <summary>
        /// 根据条件查询多条数据
        /// </summary>
@@ -29,7 +32,7 @@
        public static List<T> QueryList(Expression<Func<T, bool>> condition)
        {
            var db = new SqlHelper<object>().GetInstance();
            // 返回数据
            return db.Queryable<T>().Where(condition).ToList();
        }
@@ -39,11 +42,34 @@
        /// </summary>
        /// <param name="condition">条件</param>
        /// <returns></returns>
        public static int QueryCount(Expression<Func<T,bool>> condition)
        public static int QueryCount(Expression<Func<T, bool>> condition)
        {
            var db = new SqlHelper<object>().GetInstance();
            // 返回数据
            return db.Queryable<T>().Count(condition);
        }
        /// <summary>
        /// 根据条件修改一条数据(事务)
        /// </summary>
        /// <param name="sqlSugarClient">数据库上下文连接</param>
        /// <param name="model">需要进行修改的对象</param>
        /// <param name="condition">修改条件</param>
        /// <returns></returns>
        public static bool UpdateFirstTran(SqlSugarClient sqlSugarClient, T model, Expression<Func<T, object>> condition)
        {
            // 修改数据
            var executeCommand = sqlSugarClient.Updateable(model).UpdateColumns(condition).ExecuteCommand();
            if (executeCommand > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
@@ -54,17 +80,56 @@
        /// <returns></returns>
        public static bool UpdateFirst(T model, Expression<Func<T, object>> condition)
        {
            var db = new SqlHelper<object>().GetInstance();
            var sqlSugarClient = new SqlHelper<object>().GetInstance();
            // 修改数据
            var executeCommand = db.Updateable(model).UpdateColumns(condition).ExecuteCommand();
            var executeCommand = sqlSugarClient.Updateable(model).UpdateColumns(condition).ExecuteCommand();
            if (executeCommand > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 根据条件修改一条数据的状态(sql语句)
        /// </summary>
        /// <param name="model">需要进行修改的对象</param>
        /// <param name="sql">修改条件</param>
        /// <returns></returns>
        public static bool UpdateFirstOutBoundStart(T model, string sql)
        {
            var sqlSugarClient = new SqlHelper<object>().GetInstance();
            // 修改数据
            var executeCommand = sqlSugarClient.Ado.ExecuteCommand(sql, model);
            if (executeCommand > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 根据条件修改多条数据(事务)
        /// </summary>
        /// <param name="sqlSugarClient">数据库上下文连接</param>
        /// <param name="models"></param>
        /// <param name="condition"></param>
        /// <returns></returns>
        public static int UpdateListTran(SqlSugarClient sqlSugarClient, List<T> models,
            Expression<Func<T, object>> condition)
        {
            // 修改数据
            return sqlSugarClient.Updateable(models).UpdateColumns(condition).ExecuteCommand();
        }
        /// <summary>
@@ -75,84 +140,168 @@
        /// <returns></returns>
        public static int UpdateList(List<T> models, Expression<Func<T, object>> condition)
        {
            var db = new SqlHelper<object>().GetInstance();
            var sqlSugarClient = new SqlHelper<object>().GetInstance();
            // 修改数据
            return db.Updateable(models).UpdateColumns(condition).ExecuteCommand();
            return sqlSugarClient.Updateable(models).UpdateColumns(condition).ExecuteCommand();
        }
        /// <summary>
        /// 新增一条数据
        /// 新增一条数据(事务)
        /// </summary>
        /// <param name="model"></param>
        /// <param name="sqlSugarClient">数据库上下文连接</param>
        /// <param name="model">需要新增的数据</param>
        /// <returns></returns>
        public static bool AddFirstTran(SqlSugarClient sqlSugarClient, T model)
        {
            var executeCommand = sqlSugarClient.Insertable(model).ExecuteCommand();
            if (executeCommand > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 新增一条数据(事务)
        /// </summary>
        /// <param name="model">需要新增的数据</param>
        /// <returns></returns>
        public static bool AddFirst(T model)
        {
            var db = new SqlHelper<object>().GetInstance();
            var sqlSugarClient = new SqlHelper<object>().GetInstance();
            var executeCommand = db.Insertable(model).ExecuteCommand();
            var executeCommand = sqlSugarClient.Insertable(model).ExecuteCommand();
            if (executeCommand > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 新增多条数据(事务)
        /// </summary>
        /// <param name="sqlSugarClient">数据库上下文连接</param>
        /// <param name="models">需要新增的数据集合</param>
        /// <returns></returns>
        public static int AddListTran(SqlSugarClient sqlSugarClient, List<T> models)
        {
            return sqlSugarClient.Insertable(models).ExecuteCommand();
        }
        /// <summary>
        /// 新增多条数据
        /// </summary>
        /// <param name="models"></param>
        /// <param name="models">需要新增的数据集合</param>
        /// <returns></returns>
        public static int AddList(List<T> models)
        {
            var db = new SqlHelper<object>().GetInstance();
            var executeCommand = db.Insertable(models).ExecuteCommand();
            return executeCommand;
            var sqlSugarClient = new SqlHelper<object>().GetInstance();
            return sqlSugarClient.Insertable(models).ExecuteCommand();
        }
        /// <summary>
        /// 删除一条数据
        /// 删除一条数据(事务)
        /// </summary>
        /// <param name="sqlSugarClient">数据库上下文连接</param>
        /// <param name="model">需要删除的对象</param>
        /// <returns></returns>
        public static bool DeleteFirstTran(SqlSugarClient sqlSugarClient, T model)
        {
            var executeCommand = sqlSugarClient.Deleteable(model).ExecuteCommand();
            if (executeCommand > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 删除一条数据(事务)
        /// </summary>
        /// <param name="model">需要删除的对象</param>
        /// <returns></returns>
        public static bool DeleteFirst(T model)
        {
            var db = new SqlHelper<object>().GetInstance();
            var sqlSugarClient = new SqlHelper<object>().GetInstance();
            var executeCommand = db.Deleteable(model).ExecuteCommand();
            var executeCommand = sqlSugarClient.Deleteable(model).ExecuteCommand();
            if (executeCommand > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 删除多条数据
        /// 删除多条数据(事务)
        /// </summary>
        /// <param name="sqlSugarClient">数据库上下文连接</param>
        /// <param name="models">需要删除的对象集合</param>
        /// <returns></returns>
        public static int DeleteListTran(SqlSugarClient sqlSugarClient, List<T> models)
        {
            return sqlSugarClient.Deleteable(models).ExecuteCommand();
        }
        /// <summary>
        /// 删除多条数据(事务)
        /// </summary>
        /// <param name="models">需要删除的对象集合</param>
        /// <returns></returns>
        public static int DeleteList(List<T> models)
        {
            var db = new SqlHelper<object>().GetInstance();
            return db.Deleteable(models).ExecuteCommand();
            var sqlSugarClient = new SqlHelper<object>().GetInstance();
            return sqlSugarClient.Deleteable(models).ExecuteCommand();
        }
        /// <summary>
        /// 根据条件删除数据
        /// 根据条件删除数据(事务)
        /// </summary>
        /// <param name="sqlSugarClient">数据库上下文连接</param>
        /// <param name="condition">条件</param>
        /// <returns></returns>
        public static int DeleteListTran(SqlSugarClient sqlSugarClient, Expression<Func<T, bool>> condition)
        {
            return sqlSugarClient.Deleteable<T>().Where(condition).ExecuteCommand();
        }
        /// <summary>
        /// 根据条件删除数据(事务)
        /// </summary>
        /// <param name="condition">条件</param>
        /// <returns></returns>
        public static int DeleteList(Expression<Func<T, bool>> condition)
        {
            var db = new SqlHelper<object>().GetInstance();
            return db.Deleteable<T>().Where(condition).ExecuteCommand();
            var sqlSugarClient = new SqlHelper<object>().GetInstance();
            return sqlSugarClient.Deleteable<T>().Where(condition).ExecuteCommand();
        }
        /// <summary>
        /// 获取数据库上下文连接
        /// </summary>
        /// <returns></returns>
        public static SqlSugarClient QuerySqlSugarClient()
        {
            return new SqlHelper<object>().GetInstance();
        }
        /// <summary>
        /// 按照时间倒序查询
@@ -167,5 +316,70 @@
            // 返回数据
            return db.Queryable<T>().OrderByDescending(orderBy).First(condition);
        }
        #region 特定查询
        /// <summary>
        /// 分配入库货位
        /// </summary>
        /// <returns></returns>
        public static Location QueryInputLocation(string itemCode)
        {
            var areaCodeList = new List<string>
            {
                "1","2","3","4"
            };
            var db = new SqlHelper<object>().GetInstance();
            var listMaxCol = db.Queryable<Location>()
                .LeftJoin<LocCntrRel>((l, lc) => l.S_CODE == lc.S_LOC_CODE)
                .LeftJoin<CntrItemDetail>((l, lc, ci) => lc.S_CNTR_CODE == ci.S_CNTR_CODE)
                .Where((l, lc, ci) => l.N_CURRENT_NUM > 0
                                      && areaCodeList.Contains(l.S_GROUP)
                                      && ci.S_ITEM_CODE == itemCode)
                .OrderByDescending((l, lc, ci) => l.N_COL)
                .Take(1)
                .PartitionBy((l, lc, ci) => new { l.S_GROUP, l.N_ROW })
                .ToList();
            // 有同种物料所占据的排
            if (listMaxCol.Count > 0)
            {
                foreach (var item in listMaxCol)
                {
                    //排有锁也排除(锁表示后面可能要改)
                    if (db.Queryable<Location>().Count(a =>
                            a.S_GROUP == item.S_GROUP && a.N_ROW == item.N_ROW && a.N_LOCK_STATE != 0) > 0)
                    {
                        continue;
                    }
                    // 没锁
                    var end = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a =>
                        a.S_GROUP == item.S_GROUP && a.N_ROW == item.N_ROW &&
                        a.N_CURRENT_NUM == 0 &&
                        a.N_COL >= item.N_COL).First();
                    if (end != null)
                    {
                        return end;
                    }
                }
            }
            Location location = db.Queryable<Location>().OrderBy(a => a.S_GROUP).First(p => p.N_COL == 1 && p.N_LOCK_STATE == 0);
            if (location != null)
            {
                return location;
            }
            return null;
        }
        #endregion
    }
}
HH.WCS.Mobox3.HaiCheng/Util/Helper/HelperMethod.cs
New file
@@ -0,0 +1,59 @@
using System;
using HH.WCS.Mobox3.Template.Entity.Dto;
using Newtonsoft.Json;
namespace HH.WCS.Mobox3.Template.Util.Helper;
/// <summary>
/// 方法帮助类
/// </summary>
public static class HelperMethod
{
    /// <summary>
    /// Http帮助类
    /// </summary>
    private static readonly HttpHelper apiHelper = new HttpHelper();
    /// <summary>
    /// 创建序列号
    /// </summary>
    /// <param name="snType">序列号类型</param>
    /// <param name="prefix">序列号前缀</param>
    /// <returns></returns>
    internal static string GenerateTaskNo(string snType, string prefix)
    {
        var date = DateTime.Now.ToString("yyMMdd");
        var id = SYSHelper.GetSerialNumber(snType, prefix + date);
        return $"{prefix}{date}{id.ToString().PadLeft(4, '0')}";
    }
    /// <summary>
    /// 根据获取到的任务号转换为任务表中的数据
    /// </summary>
    /// <param name="TaskNo"></param>
    /// <returns></returns>
    public static string GetTask(string TaskNo)
    {
        string taskNo = "";
        taskNo = "TN" + DateTime.Now.Year.ToString().Substring(2, 2) + TaskNo.PadLeft(8, '0');
        return taskNo;
    }
    /// <summary>
    /// 按照固定格式新增任务号
    /// </summary>
    /// <returns></returns>
    public static string GetTaskNo()
    {
        string dateString = "";
        // 获取当前时间
        DateTime currentTime = DateTime.Now;
        // 将日期格式化为字符串
        dateString = currentTime.ToString("yyyy-MM-dd").Replace("-", "").Substring(2);
        return dateString;
    }
}
HH.WCS.Mobox3.HaiCheng/Util/Helper/LogHelper.cs
@@ -82,7 +82,7 @@
        /// 通过配置文件配置日志
        /// </summary>
        static LogFactory() {
            var loggerNames = new List<string>() { "四向车和WCS接口交互" };
            var loggerNames = new List<string>() { "四向车和WCS接口交互", "出入库流程日志" };
            LogManager.Configuration = DefaultConfig(loggerNames);
        }
        
HH.WCS.Mobox3.HaiCheng/config/config.json
@@ -1,7 +1,7 @@
{
  "HostToAgvServerUrl": "http://172.16.10.41:9988/HostToAGV.cgi",
  "HASeverUrl": "http://172.16.10.41",
  "SqlServer": "Data Source=172.16.10.41;Initial Catalog=OIMobox;User ID=sa;Password=X07pLI2Z",
  "SqlServer": "Data Source=TJY\\SQLEXPRESS;Initial Catalog=OIMobox;User ID=sa;Password=1234",
  "ApiPort": 8901,
  "WMSBaseUrl": "http://172.16.10.41",
  "FourWayCarBaseUrl": "http://172.16.10.41:3000",