啊鑫
2025-01-22 eb744ecfecc0f1b6d9c0999c65bc740d93e30eda
StandardPda/MES.Service/service/BasicData/MesRohInManager.cs
@@ -2,7 +2,6 @@
using MES.Service.Dto.webApi;
using MES.Service.Modes;
using SqlSugar;
using System.Security.AccessControl;
namespace MES.Service.service.BasicData;
@@ -15,7 +14,8 @@
    {
        var rohInErpRohIn = rohIn.ErpRohIn;
        var mesRohIn = GetMesRohIn(rohInErpRohIn);
        var mesRohInDatas = GetMesRohInDatas(rohIn.ErpRohinDatas, rohInErpRohIn.Type);
        var mesRohInDatas =
            GetMesRohInDatas(rohIn.ErpRohinDatas, rohInErpRohIn.Type);
        return UseTransaction(db =>
        {
@@ -30,50 +30,6 @@
                    $"type没有{rohInErpRohIn.Type}这个类型")
            };
        }) > 0;
    }
    // 插入数据的方法
    private bool InsertData(SqlSugarScope db, MesRohIn mesRohIn,
        List<MesRohInData> mesRohInDatas, string FBILLTYPE)
    {
        switch (FBILLTYPE)
        {
            case "A":
            {
                var decimals = mesRohInDatas.Select(s => s.Id).ToArray();
                if (mesRohIn.Id != null) base.DeleteById(mesRohIn.Id);
                if (decimals.Length > 0)
                    db.Deleteable<MesRohInData>().In(decimals).ExecuteCommand();
                var insert = base.Insert(mesRohIn);
                var insertRange =
                    rohInDataManager.InsertRange(mesRohInDatas);
                if (insert && insertRange) return true;
                throw new NotImplementedException("插入失败");
            }
            case "B":
            {
                var decimals = mesRohInDatas.Select(s => s.Id).ToArray();
                if (base.DeleteById(mesRohIn.Id) && db
                        .Deleteable<MesRohInData>().In(decimals)
                        .ExecuteCommand() > 0)
                {
                    var insert = base.Insert(mesRohIn);
                    var insertRange =
                        rohInDataManager.InsertRange(mesRohInDatas);
                    if (insert && insertRange) return true;
                    throw new NotImplementedException("插入失败");
                }
                break;
            }
        }
        throw new NotImplementedException("采购订单类型错误");
    }
    // 更新数据的方法
@@ -112,7 +68,7 @@
        //var orUpdate = base.Insert(mesRohIn);
        //var baOrUpdate = rohInDataManager.InsertRange(mesRohInDatas);
        var orUpdate = db.Insertable(mesRohIn)
    .IgnoreColumns(true).ExecuteCommand() > 0;
            .IgnoreColumns(true).ExecuteCommand() > 0;
        var baOrUpdate = db.Insertable(mesRohInDatas).PageSize(1)
@@ -146,7 +102,8 @@
        mesRohIn.DocumentType = rohIn.FBillTypeID;
        mesRohIn.BusinessType = rohIn.FBusinessType;
        if (rohIn.FDate != null)
            mesRohIn.PurchaseDate = DateTime.ParseExact(rohIn.FDate,"yyyy-MM-dd HH:mm:ss", null);
            mesRohIn.PurchaseDate = DateTime.ParseExact(rohIn.FDate,
                "yyyy-MM-dd HH:mm:ss", null);
        mesRohIn.Supplier = rohIn.FSupplierId;
        mesRohIn.CloseStatus = rohIn.FCloseStatus;
        mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId;
@@ -273,7 +230,6 @@
                FCGDDSctzda = s.F_CGDD_SCTZDA,
                FCGDDXHA = s.F_CGDD_XHA,
                FXifgTextApv = s.F_XIFG_Text_apv
            };
            var single = rohInDataManager.GetSingle(it =>