From f5249dffc2a3ee71ca6878912452b73a12d57564 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 11 十二月 2025 09:12:47 +0800
Subject: [PATCH] 采购订单:字段预转换为编码
---
MES.Service/service/BasicData/MesRohInManager.cs | 94 ++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 88 insertions(+), 6 deletions(-)
diff --git a/MES.Service/service/BasicData/MesRohInManager.cs b/MES.Service/service/BasicData/MesRohInManager.cs
index d1ab5ed..6871fd2 100644
--- a/MES.Service/service/BasicData/MesRohInManager.cs
+++ b/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 =
--
Gitblit v1.9.3