From 52e709fcf50517c2b953eae2be753b71df347fa5 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 11 十二月 2025 17:10:43 +0800
Subject: [PATCH] 供应商信息:采购员和负责人电话推送
---
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..e98e3a8 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 if (!string.IsNullOrWhiteSpace(item.FBaseUnitId))
+ {
+ entity.ItemUnit = item.FBaseUnitId;
}
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 if (!string.IsNullOrWhiteSpace(item.FSaleUnitId))
+ {
+ entity.Saleunit = item.FSaleUnitId;
+ }
+ 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 if (!string.IsNullOrWhiteSpace(item.FStoreUnitID))
+ {
+ entity.Storeunit = item.FStoreUnitID;
+ }
+ 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 if (!string.IsNullOrWhiteSpace(item.FPurchaseUnitId))
+ {
+ entity.Fpurchaseunitid = item.FPurchaseUnitId;
+ }
+ 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 if (!string.IsNullOrWhiteSpace(item.FPRODUCEUNITID))
+ {
+ entity.ProduceUnit = item.FPRODUCEUNITID;
+ }
+ 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 if (!string.IsNullOrWhiteSpace(item.FSUBCONUNITID))
+ {
+ entity.SubconUnit = item.FSUBCONUNITID;
+ }
+ 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 if (!string.IsNullOrWhiteSpace(item.FStockId))
+ {
+ entity.DepotCode = item.FStockId;
+ }
+ else
+ {
+ entity.SubconUnit = "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