From 7a4c218909936721fe281737491d10efc7378e09 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 19 七月 2024 17:53:30 +0800
Subject: [PATCH] 优化工单信息页面
---
代码管理/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 102 insertions(+), 1 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
index 7359fba..2eabf1a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/ToMES/ToMesServer.cs"
@@ -1,15 +1,26 @@
-锘縰sing System;
+锘縰sing Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Common;
+using WIDESEA_Core.FreeDB;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
+using WIDESEA_Entity.ToAGV;
+using static FreeSql.Internal.GlobalFilter;
namespace WIDESEA_WCS
{
public partial class ToMesServer
{
+
/// <summary>
/// 娣诲姞宸ュ崟淇℃伅
/// </summary>
@@ -30,5 +41,95 @@
WebResponseContent content = new WebResponseContent();
return content;
}
+
+ /// <summary>
+ /// MES涓嬪彂WMS宸ュ崟鎺ュ彛
+ /// </summary>
+ /// <param name="json"></param>
+ /// <returns></returns>
+ public static WebResponseContent AddMes_Info(object json)
+ {
+ WebResponseContent content = new WebResponseContent();
+ FreeDB freeDB = new FreeDB();
+ dt_mes_head mes_Head = null;
+ try
+ {
+ Mes_WorkInfo workInfo = JsonConvert.DeserializeObject<Mes_WorkInfo>(json.ToString());
+
+ if (workInfo == null)
+ {
+ //return content.Error("宸ュ崟淇℃伅鏁版嵁涓虹┖");
+ throw new Exception("宸ュ崟淇℃伅鏁版嵁涓虹┖");
+ }
+
+ var mesinfo = freeDB.Select<dt_mes_head>().Where(x => x.jobID == workInfo.jobID).First();
+ if (mesinfo != null)
+ {
+ //return content.Error($"宸ュ崟缂栧彿{mesinfo.jobID}宸插瓨鍦�,璇锋牳瀹炲悗閲嶆柊鍙戦�侊紒");
+ throw new Exception($"宸ュ崟缂栧彿{mesinfo.jobID}宸插瓨鍦�,璇锋牳瀹炲悗閲嶆柊鍙戦�侊紒");
+ }
+
+ Guid head = Guid.NewGuid();
+ mes_Head = new dt_mes_head
+ {
+ mes_id = head,
+ CreateTime = DateTime.Now,
+ creator = "MES",
+ drawingNo = workInfo.drawingNo,
+ drawingNoVer = workInfo.drawingNoVer,
+ expectedFinishTime = workInfo.expectedFinishTime,
+ expectedStartTime = workInfo.expectedStartTime,
+ jobID = workInfo.jobID,
+ materialCode = workInfo.materialCode,
+ maxDiameterDiff = workInfo.maxDiameterDiff,
+ productDesc = workInfo.productDesc,
+ productName = workInfo.productName,
+ quantity = workInfo.quantity,
+ reqID = workInfo.reqID,
+ reqIDLineNo = workInfo.reqIDLineNo,
+ //stackNoRange = workInfo.stackNoRange,
+ typeID = workInfo.typeID,
+ workOrder = workInfo.workOrder,
+ processCode = workInfo.processCode,
+ finishNum = 0,
+ };
+ freeDB.Add(mes_Head);
+
+ foreach (var item in workInfo.details)
+ {
+ dt_mes_detail mes_Detail = new dt_mes_detail
+ {
+ mes_detail_id = Guid.NewGuid(),
+ mes_id = head,
+ jobID = item.jobID,
+ billetID = item.billetID,
+ heatBatchID = item.heatBatchID,
+ heatID = item.heatID,
+ SN = item.SN
+ };
+ freeDB.Add(mes_Detail);
+ }
+
+ #region 鏌ヨ褰撳墠宸ュ崟鐨勫浘鍙蜂俊鎭槸鍚﹀瓨鍦�
+ var dt_Geometry_Data = Pipeline.QueryMateriel(workInfo.drawingNo);
+ //var dt_Geometry_Data1 = Pipeline.QueryMateriel1(workInfo.drawingNo);
+ if (dt_Geometry_Data == null /*&& dt_Geometry_Data1 == null*/)
+ {
+ throw new Exception($"鏈壘鍒板浘鍙凤細{workInfo.drawingNo}鐨勮溅杞俊鎭紒宸ュ崟缂栧彿锛歿workInfo.jobID}");
+ }
+ #endregion
+ //WriteWMSLog.LogAdd(requestTask.TASK_NO, "鎴愬姛 ", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
+ //return content.OK();
+ content.OK();
+ }
+ catch (Exception ex)
+ {
+ //return content.Error(ex.Message);
+ content.Error(ex.Message);
+ }
+
+ WritePCSLog.LogAdd("", content.Status ? "鎴愬姛 " : "澶辫触", "PCS", "MES", JsonConvert.SerializeObject(mes_Head), JsonConvert.SerializeObject(content), $"MES涓嬪彂宸ュ崟", "AddMes_Info", content.Message);
+ return content;
+ }
}
}
--
Gitblit v1.9.3