快乐的昕的电脑
8 小时以前 8328aed1bca2a30c3105b19f41d324acb59437c9
MES.Service/service/BasicData/MesDepotsManager.cs
@@ -4,7 +4,9 @@
using SqlSugar;
namespace MES.Service.service.BasicData;
/// <summary>
/// 仓库信息
/// </summary>
public class MesDepotsManager : Repository<MesDepots>
{
    // Save 方法用于保存单个仓库记录,根据类型执行不同的操作
@@ -77,7 +79,7 @@
    }
    /// <summary>
    /// 同步物料信息new_0/4
    /// 同步仓库信息new_0/4
    /// </summary>
    /// <param name="db"></param>
    /// <param name="entity"></param>
@@ -157,8 +159,8 @@
            Depottype = depots.FStockProperty,
            IsNg = depots.FForbidStatus,
            Zuid = depots.FGroup,
            FSubsidiary = depots.FUseOrgId,
            Fumbrella = depots.FCreateOrgId,
            //FSubsidiary = depots.FUseOrgId,
            //Fumbrella = depots.FCreateOrgId,
            // 如果存在,使用现有的CreateDate,后续将删除后重新插入
            // 如果不存在,设为当前时间
            CreateDate = existingCustomer?.CreateDate ?? DateTime.Now,
@@ -172,6 +174,8 @@
            factory_name = depots.factory_name,
            Remark4 = depots.remark4,
            Remark5 = depots.remark5,
            FSubsidiary = string.IsNullOrEmpty(depots.FUseOrgId) ? "1" : depots.FUseOrgId,
            Fumbrella = string.IsNullOrEmpty(depots.FCreateOrgId) ? "1" : depots.FCreateOrgId,
        };
        // ERP: 0=未禁用, 1=禁用
        // MES: A=未禁用, B=禁用
@@ -240,8 +244,7 @@
    }
    // 批量更新仓库状态的方法
    private bool UpdateDepotStatusBatch(SqlSugarScope db,
        List<MesDepots> depotList, string status)
    private bool UpdateDepotStatusBatch(SqlSugarScope db,List<MesDepots> depotList, string status)
    {
        var ids = depotList.Select(it => it.DepotId).ToArray();
        var result = db.Updateable<MesDepots>()
@@ -255,8 +258,7 @@
    }
    // 批量插入仓库的方法
    private bool InsertDepotBatch(SqlSugarScope db,
        List<MesDepots> depotList)
    private bool InsertDepotBatch(SqlSugarScope db,List<MesDepots> depotList)
    {
        var insertRange = db.Insertable(depotList).ExecuteCommand();
        if (insertRange > 0)
@@ -280,8 +282,7 @@
    }
    // 批量插入或更新仓库的方法
    private bool InsertOrUpdateBatch(SqlSugarScope db,
        List<MesDepots> depotList)
    private bool InsertOrUpdateBatch(SqlSugarScope db,List<MesDepots> depotList)
    {
        return depotList.All(entity => InsertOrUpdate(db, entity));
    }