11
啊鑫
2025-08-25 cdd325cf78ca5bac74f941a917d8c90f34fa63e6
MES.Service/service/BasicData/MesDepotsManager.cs
@@ -42,7 +42,7 @@
    }
    // 更新仓库状态的方法
    private bool UpdateDepotStatus(SqlSugarScope db, decimal depotId,
    private bool UpdateDepotStatus(SqlSugarScope db, long depotId,
        string status)
    {
        var result = db.Updateable<MesDepots>()
@@ -89,30 +89,42 @@
    // 将 ErpDepots 对象转换为 MesDepots 对象的方法
    private MesDepots GetMesDepots(ErpDepots depots)
    {
        return new MesDepots
        var entity = new MesDepots
        {
            Guid = depots.Id,
            DepotCode = depots.FNumber,
            DepotName = depots.FName,
            DepotId = Convert.ToDecimal(depots.Id),
            DepotId = string.IsNullOrEmpty(depots.Id)
                ? DateTimeOffset.UtcNow.ToUnixTimeSeconds()
                : long.Parse(depots.Id),
            IsFkc = depots.FAllowMinusQty,
            CreateBy = depots.FPrincipal,
            Depottype = depots.FStockProperty,
            IsNg = depots.FForbidStatus,
            Zuid = depots.FGroup,
            FSubsidiary = depots.FUseOrgId,
            Fumbrella = depots.FCreateOrgId,
            CreateDate = DateTime.Now,
            LastupdateDate = DateTime.Now,
            SupplierId = depots.FSUPPLIERID,
            Company = "1000",
            Factory = "1000",
            FCustomerId = depots.FCustomerId,
            FDocumentStatus = depots.FDocumentStatus,
            FStockStatusType = depots.FStockStatusType
            DocumentStatus = depots.FDocumentStatus,
            
            UseOrg = string.IsNullOrEmpty(depots.FUseOrgId)
                ? 1
                : long.Parse(depots.FUseOrgId),
            CreateOrg = string.IsNullOrEmpty(depots.FCreateOrgId)
                ? 1
                : long.Parse(depots.FCreateOrgId),
            CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            LastupdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            Company = "1000",
            Factory = "1000"
        };
        var mesDepots = Db.Queryable<MesDepots>()
            .Where(s => s.DepotCode == entity.DepotCode)
            .First();
        if (mesDepots != null)
        {
            entity.DepotId = mesDepots.DepotId;
        }
        return entity;
    }
    // SaveList 方法用于保存多个仓库记录,根据类型批量执行不同的操作