快乐的昕的电脑
5 天以前 f5249dffc2a3ee71ca6878912452b73a12d57564
采购订单:字段预转换为编码
已修改1个文件
94 ■■■■■ 文件已修改
MES.Service/service/BasicData/MesRohInManager.cs 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MES.Service/service/BasicData/MesRohInManager.cs
@@ -8,7 +8,9 @@
using System.Security.AccessControl;
namespace MES.Service.service.BasicData;
/// <summary>
/// 采购订单
/// </summary>
public class MesRohInManager : Repository<MesRohIn>
{
    private readonly MesRohInDataManager rohInDataManager = new();
@@ -68,8 +70,14 @@
    // 插入或更新数据的方法
    private bool SaveOrUpdateData(SqlSugarScope db, MesRohIn mesRohIn,List<MesRohInData> mesRohInDatas, string type)
    {
        ////传什么,c就改成什么
        //if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C"))//C表示已审核状态
        //{
        //    mesRohIn.BillNo = mesRohIn.BillNo + "F" + mesRohIn.EbelnK3id.ToString();
        //}
        if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "C"))
        //传什么,c就改成什么
        if (type == "3" || (mesRohIn.DocumentStatus != null && mesRohIn.DocumentStatus != "F"))//C表示已审核状态
        {
            mesRohIn.BillNo = mesRohIn.BillNo + "F" + mesRohIn.EbelnK3id.ToString();
        }
@@ -138,10 +146,48 @@
            mesRohIn.PurchaseDate = DateTime.ParseExact(rohIn.FDate,
                "yyyy-MM-dd HH:mm:ss", null);
        mesRohIn.Supplier = rohIn.FSupplierId;
        //供应商转编码
        var mesRohInSupplier = Db.Queryable<MesSupplier>()
            .Where(x => x.SuppNo == rohIn.FSupplierId)
            .Select(x => x.Id.ToString())
            .First();
        if (!string.IsNullOrWhiteSpace(mesRohInSupplier))
        {
            mesRohIn.Supplier = mesRohInSupplier;
        }
        else if (!string.IsNullOrWhiteSpace(rohIn.FSupplierId))
        {
            mesRohIn.Supplier = rohIn.FSupplierId;
        }
        else
        {
            mesRohIn.Supplier = "0";
        }
        //mesRohIn.Supplier = rohIn.FSupplierId;
        mesRohIn.CloseStatus = rohIn.FCloseStatus;
        mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId;
        mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId;
        //mesRohIn.PurchaseOrg = rohIn.FPurchaseOrgId;
        mesRohIn.PurchaseOrg = string.IsNullOrEmpty(rohIn.FPurchaseOrgId) ? "1" : rohIn.FPurchaseOrgId;//采购组织
        //采购部门转编码
        var mesRohInPurchaseDept = Db.Queryable<SysDepartment>()
            .Where(x => x.Departmentcode == rohIn.FPurchaseDeptId)
            .Select(x => x.Departmentid.ToString())
            .First();
        if (!string.IsNullOrWhiteSpace(mesRohInPurchaseDept))
        {
            mesRohIn.PurchaseDept = mesRohInPurchaseDept;
        }
        else if (!string.IsNullOrWhiteSpace(rohIn.FPurchaseDeptId))
        {
            mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId;
        }
        else
        {
            mesRohIn.PurchaseDept = "0";
        }
        //mesRohIn.PurchaseDept = rohIn.FPurchaseDeptId;
        mesRohIn.PurchaseGroup = rohIn.FPurchaserGroupId;
        mesRohIn.Purchaser = rohIn.FPurchaserId;
        mesRohIn.SettlementParty = rohIn.FSettleId;
@@ -269,7 +315,7 @@
                ChangeFlag = s.FChangeFlag,
                DemandSource = s.FDEMANDTYPE,
                DemandDocumentId = s.FDEMANDBILLNO,
                DemandDocumentLineId = s.FDEMANDBILLENTRYSEQ,
                OrderLineId = s.FDEMANDBILLENTRYSEQ,
                DemandOrg = s.FRequireOrgId,
                ReceivingOrg = s.FReceiveOrgId,
                SettlementOrg = s.FEntrySettleOrgId,
@@ -284,6 +330,42 @@
                SalesOrderId = s.F_UNW_Text_xsddh
            };
            //采购单位转编码
            var entityPurchaseUnit = Db.Queryable<MesUnit>()
                .Where(x => x.Fnumber == s.FUnitId)
                .Select(x => x.Id.ToString())
                .First();
            if (!string.IsNullOrWhiteSpace(entityPurchaseUnit))
            {
                entity.PurchaseUnit = entityPurchaseUnit;
            }
            else if (!string.IsNullOrWhiteSpace(s.FUnitId))
            {
                entity.PurchaseUnit = s.FUnitId;
            }
            else
            {
                entity.PurchaseUnit = "0";
            }
            //计价单位转编码
            var entityPricingUnit = Db.Queryable<MesUnit>()
                .Where(x => x.Fnumber == s.FPriceUnitId)
                .Select(x => x.Id.ToString())
                .First();
            if (!string.IsNullOrWhiteSpace(entityPricingUnit))
            {
                entity.PricingUnit = entityPricingUnit;
            }
            else if (!string.IsNullOrWhiteSpace(s.FPriceUnitId))
            {
                entity.PricingUnit = s.FPriceUnitId;
            }
            else
            {
                entity.PricingUnit = "0";
            }
            if (s.FFreezeDate != null)
                if (!s.FFreezerId.IsNullOrEmpty())
                    entity.FreezeTime =