From 5a0a406dd7d49e175a71eda9d6488badfa97375a Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期五, 19 十二月 2025 14:33:30 +0800
Subject: [PATCH] 客户信息:销售员编码转ID、物料信息:转编码逻辑修正
---
MES.Service/service/BasicData/MesItemsManager.cs | 158 ++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 145 insertions(+), 13 deletions(-)
diff --git a/MES.Service/service/BasicData/MesItemsManager.cs b/MES.Service/service/BasicData/MesItemsManager.cs
index 36ff2a1..ce51cce 100644
--- a/MES.Service/service/BasicData/MesItemsManager.cs
+++ b/MES.Service/service/BasicData/MesItemsManager.cs
@@ -133,7 +133,7 @@
ItemNo = item.FNumber,
ItemName = item.FName,
ItemModel = item.FSpecification,
- ItemUnit = item.FBaseUnitId,
+ ItemUnit = item.FBaseUnitId,//鐗╂枡鍩烘湰鍗曚綅缂栫爜杞琁D
Lowlimit = Convert.ToDouble(item.FSafeStock),
Highlimit = Convert.ToDouble(item.FMaxStock),
PrdPack = Convert.ToDouble(item.FMinPackCount),
@@ -142,7 +142,15 @@
Remarks = item.FDescription,
Ffinishreceiptoverrate =
Convert.ToDecimal(item.FFinishReceiptOverRate),
- Fissuetype = item.FIssueType,
+ //鍙戞枡鏂瑰紡
+ Fissuetype = item.FIssueType switch
+ {
+ "1" => "閫愭壒棰嗘枡",
+ "2" => "鑷姩鎵f枡",
+ _ => item.FIssueType
+ },
+ //Fissuetype = item.FIssueType,
+
//鎵瑰彿绠$悊
Fisbatchmanage = item.FIsBatchManage switch
{
@@ -156,7 +164,7 @@
Fpurchaseunitid = item.FPurchaseUnitId,
Storeunit = item.FStoreUnitID,
Saleunit = item.FSaleUnitId,
- //Fforbidstatus = item.FForbidStatus,
+ Fforbidstatus = item.FForbidStatus,//鍚敤涓庣鐢�
MaterialProperti = item.FErpClsID,
ProductionWorkshop = item.FWorkShopId,
ProduceUnit = item.FPRODUCEUNITID,
@@ -180,19 +188,144 @@
FSubsidiary = string.IsNullOrEmpty(item.FUseOrgId) ? "1" : item.FUseOrgId,
Fumbrella = string.IsNullOrEmpty(item.FCreateOrgId) ? "1" : item.FCreateOrgId,
};
-
- // ERP: 0=鏈鐢�, 1=绂佺敤
- // MES: A=鏈鐢�, B=绂佺敤
- if (string.IsNullOrEmpty(item.FForbidStatus))
+ //鐗╂枡鍩烘湰鍗曚綅缂栫爜杞琁D,ItemUnit = item.FBaseUnitId
+ var entityItemUnit = Db.Queryable<MesUnit>()
+ .Where(x => x.Fnumber == item.FBaseUnitId)
+ .Select(x => x.Id.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entityItemUnit))
{
- entity.Fforbidstatus = "A";
+ entity.ItemUnit = entityItemUnit;
}
else
{
- //鎴戞湡鏈涚殑鍊兼槸A=鍚�,B=鏄�
- //瀹為檯缁欐垜鐨勫�兼槸0鎴�1锛屾垜甯屾湜涓烘垜杞崲浠嶢鍜孊鐨勬柟寮�
- entity.Fforbidstatus = item.FForbidStatus == "1" ? "B" : "A";
+ entity.ItemUnit = "0";
}
+
+ //鐗╂枡閿�鍞崟浣嶇紪鐮佽浆ID,Saleunit = item.FSaleUnitId
+ var entitySaleunit = Db.Queryable<MesUnit>()
+ .Where(x => x.Fnumber == item.FSaleUnitId)
+ .Select(x => x.Id.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entitySaleunit))
+ {
+ entity.Saleunit = entitySaleunit;
+ }
+ else
+ {
+ entity.Saleunit = "0";
+ }
+
+ //鐗╂枡搴撴埧鍗曚綅缂栫爜杞琁D,Storeunit = item.FStoreUnitID
+ var entityStoreunit = Db.Queryable<MesUnit>()
+ .Where(x => x.Fnumber == item.FStoreUnitID)
+ .Select(x => x.Id.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entityStoreunit))
+ {
+ entity.Storeunit = entityStoreunit;
+ }
+ else
+ {
+ entity.Storeunit = "0";
+ }
+
+ //鐗╂枡閲囪喘鍗曚綅缂栫爜杞琁D,Fpurchaseunitid = item.FPurchaseUnitId
+ var entityFpurchaseunitid = Db.Queryable<MesUnit>()
+ .Where(x => x.Fnumber == item.FPurchaseUnitId)
+ .Select(x => x.Id.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entityFpurchaseunitid))
+ {
+ entity.Fpurchaseunitid = entityFpurchaseunitid;
+ }
+ else
+ {
+ entity.Fpurchaseunitid = "0";
+ }
+
+ //鐗╂枡鐢熶骇鍗曚綅缂栫爜杞琁D,ProduceUnit = item.FPRODUCEUNITID
+ var entityProduceUnit = Db.Queryable<MesUnit>()
+ .Where(x => x.Fnumber == item.FPRODUCEUNITID)
+ .Select(x => x.Id.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entityProduceUnit))
+ {
+ entity.ProduceUnit = entityProduceUnit;
+ }
+ else
+ {
+ entity.ProduceUnit = "0";
+ }
+
+ //鐗╂枡濮斿鍗曚綅缂栫爜杞琁D,SubconUnit = item.FSUBCONUNITID
+ var entitySubconUnit = Db.Queryable<MesUnit>()
+ .Where(x => x.Fnumber == item.FSUBCONUNITID)
+ .Select(x => x.Id.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entitySubconUnit))
+ {
+ entity.SubconUnit = entitySubconUnit;
+ }
+ else
+ {
+ entity.SubconUnit = "0";
+ }
+
+ //榛樿浠撳簱缂栫爜杞琁D,DepotCode = item.FStockId,
+ var entityDepotCode = Db.Queryable<MesDepots>()
+ .Where(x => x.DepotCode == item.FStockId)
+ .Select(x => x.DepotId.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entityDepotCode))
+ {
+ entity.DepotCode = entityDepotCode;
+ }
+ else
+ {
+ entity.DepotCode = "0";
+ }
+
+ //閲囪喘鍛樼紪鐮佽浆ID,Fpurchaserid = item.FPurchaserId,
+ var entityFpurchaserid = Db.Queryable<MesStaff>()
+ .Where(x => x.StaffNo == item.FPurchaserId)
+ .Select(x => x.Id.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entityFpurchaserid))
+ {
+ entity.Fpurchaserid = entityFpurchaserid;
+ }
+ else
+ {
+ entity.Fpurchaserid = "0";
+ }
+
+ //宸ヤ綔涓績缂栫爜杞琁D,ProductionWorkshop = item.FWorkShopId,
+ var entityProductionWorkshop = Db.Queryable<SysDepartment>()
+ .Where(x => x.WorkshopCenterCode == item.FWorkShopId)
+ .Select(x => x.Id.ToString())
+ .First();
+ if (!string.IsNullOrWhiteSpace(entityProductionWorkshop))
+ {
+ entity.ProductionWorkshop = entityProductionWorkshop;
+ }
+ else
+ {
+ entity.ProductionWorkshop = "0";
+ }
+
+ //// ERP: Y=鏈鐢�, N=绂佺敤
+ //// MES: A=鏈鐢�, B=绂佺敤
+ //if (string.IsNullOrEmpty(item.FForbidStatus))
+ //{
+ // entity.Fforbidstatus = "A";
+ //}
+ //else
+ //{
+ // //鎴戞湡鏈涚殑鍊兼槸A=鍚敤,B=绂佺敤
+ // //瀹為檯缁欐垜鐨勫�兼槸Y鎴朜锛屾垜甯屾湜涓烘垜杞崲浠嶢鍜孊鐨勬柟寮�
+ // entity.Fforbidstatus = item.FForbidStatus == "N" ? "B" : "A";
+ //}
return entity;
}
@@ -215,8 +348,7 @@
return newId;
}
- private bool UpdateItemStatusBatch(SqlSugarScope db,
- List<MesItems> itemList, string status)
+ private bool UpdateItemStatusBatch(SqlSugarScope db,List<MesItems> itemList, string status)
{
var ids = itemList.Select(it => it.Id).ToArray();
var result = db.Updateable<MesItems>()
--
Gitblit v1.9.3