From cb3c9098f3ed921918162a31b82bf3009383b917 Mon Sep 17 00:00:00 2001
From: wbc <2597324127@qq.com>
Date: 星期三, 11 十二月 2024 14:39:39 +0800
Subject: [PATCH] 字段修改
---
MES.Service/service/BasicData/ProductionOrderManager.cs | 69 +++++++++++++++++++++++++++++-----
1 files changed, 59 insertions(+), 10 deletions(-)
diff --git a/MES.Service/service/BasicData/ProductionOrderManager.cs b/MES.Service/service/BasicData/ProductionOrderManager.cs
index c46462b..a47432f 100644
--- a/MES.Service/service/BasicData/ProductionOrderManager.cs
+++ b/MES.Service/service/BasicData/ProductionOrderManager.cs
@@ -1,8 +1,11 @@
-锘縰sing System.Globalization;
+锘縰sing System.Data;
+using System.Globalization;
using MES.Service.DB;
using MES.Service.Dto.webApi;
using MES.Service.Modes;
using SqlSugar;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
+using DbType = System.Data.DbType;
namespace MES.Service.service.BasicData;
@@ -35,7 +38,7 @@
return UpdateData(db, mesRohIn, mesRohInDatas) ? 1 : 0;
case "2":
case "4":
- return SaveOrUpdateData(db, mesRohIn, mesRohInDatas)
+ return SaveOrUpdateData(db, mesRohIn, mesRohInDatas, erpProductionOrderDto.Type)
? 1
: 0;
default:
@@ -51,7 +54,7 @@
var decimals = mesRohInDatas.Select(s => s.Id).ToArray();
var update = base.DeleteById(mesRohIn.Id);
var insertOrUpdate = db
- .Deleteable<MesRohInData>().In(decimals)
+ .Deleteable<ProductionOrderSub>().In(decimals)
.ExecuteCommand() > 0;
if (update && insertOrUpdate) return true;
@@ -60,7 +63,7 @@
// 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶
private bool SaveOrUpdateData(SqlSugarScope db, ProductionOrder mesRohIn,
- List<ProductionOrderSub> mesRohInDatas)
+ List<ProductionOrderSub> mesRohInDatas,string type)
{
if (mesRohIn.Id != null) base.DeleteById(mesRohIn.Id);
@@ -70,7 +73,52 @@
var orUpdate = base.Insert(mesRohIn);
var baOrUpdate = _productionOrderSubManager.InsertRange(mesRohInDatas);
- if (orUpdate && baOrUpdate) return true;
+ if (orUpdate && baOrUpdate)
+ {
+ if ("4".Equals(type)||"3".Equals(type)||"2".Equals(type))
+ {
+ //璋冪敤瀛樺偍杩囩▼
+ try
+ {
+ // 瀹氫箟杈撳嚭鍙傛暟
+ var outputResult = new SugarParameter("C_RESULT", null,
+ DbType.Int32, ParameterDirection.Output,
+ 4000);
+
+ var outputMessage = new SugarParameter("MSG", null, DbType.String,
+ ParameterDirection.Output, 4000);
+
+ // 瀹氫箟杈撳叆鍙傛暟
+ var parameters = new List<SugarParameter>
+ {
+
+ new("P_ID",mesRohIn.ErpId , DbType.String,
+ ParameterDirection.Input),
+ outputResult,
+ outputMessage
+ };
+
+ // 浣跨敤 SqlSugar 鎵ц瀛樺偍杩囩▼
+ Db.Ado.ExecuteCommand(
+ "BEGIN PRC_MES_WW_UPDATE_BS(:P_ID, :C_RESULT, :MSG); END;",
+ parameters.ToArray());
+
+ // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+ var resultValue = outputResult.Value?.ToString();
+ var messageValue = outputMessage.Value?.ToString();
+
+ if ("1".Equals(resultValue)) throw new Exception("鏇存柊澶辫触");
+
+ return true;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ }
+ return true;
+ }
+
throw new NotImplementedException("鎻掑叆鎴栨洿鏂板け璐�");
}
@@ -86,10 +134,10 @@
{
DateTime parsedDate;
- // 鏃堕棿鏍煎紡杞崲鍑芥暟锛孍RP鏃堕棿鏍煎紡涓� "yyyy-MM-dd HH:mm:ss.fff"
+ // 鏃堕棿鏍煎紡杞崲鍑芥暟锛孍RP鏃堕棿鏍煎紡涓� "yyyy-MM-dd HH:mm:ss"
DateTime? ParseDateTime(string dateStr)
{
- if (DateTime.TryParseExact(dateStr, "yyyy-MM-dd HH:mm:ss.fff",
+ if (DateTime.TryParseExact(dateStr, "yyyy-MM-dd HH:mm:ss",
CultureInfo.InvariantCulture,
DateTimeStyles.None,
out parsedDate))
@@ -111,9 +159,9 @@
WorkOrderQty = Convert.ToDouble(erpDto.FQty),
PlanningGroup = erpDto.FWorkGroupId,
Planner = erpDto.FPlannerID,
- EstimatedStartTime =
+ PlanStartDate =
ParseDateTime(erpDto.FPlanStartDate) ?? null,
- EstimatedEndTime =
+ PlanFinishDate =
ParseDateTime(erpDto.FPlanFinishDate) ?? null,
StorageUpperLimit = Convert.ToDouble(erpDto.FStockInLimitH),
StorageLowerLimit = Convert.ToDouble(erpDto.FStockInLimitL),
@@ -143,7 +191,8 @@
// Convert.ToDecimal(erpDto.F_UNW_BaseProperty_jjds),
StockInQty = Convert.ToDecimal(erpDto.FBaseStockInQty),
NoStockInQty = Convert.ToDouble(erpDto.FBaseNoStockInQty),
- StockOwner = erpDto.FInStockOwnerId
+ StockOwner = erpDto.FInStockOwnerId,
+ SUPPLIER = erpDto.FSUPPLIERID
};
var single = base.GetSingle(it => it.ErpId == erpDto.FPPOMID);
--
Gitblit v1.9.3