From 51f7eb771322a65ee552ca9b60280632f72760e6 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期三, 15 十月 2025 16:55:08 +0800
Subject: [PATCH] 修改物料管理列表
---
Wms/Wms/Controllers/UpApiController.cs | 65 ++++++++++++++++++++++++--------
1 files changed, 48 insertions(+), 17 deletions(-)
diff --git a/Wms/Wms/Controllers/UpApiController.cs b/Wms/Wms/Controllers/UpApiController.cs
index 3f77a43..0543cb8 100644
--- a/Wms/Wms/Controllers/UpApiController.cs
+++ b/Wms/Wms/Controllers/UpApiController.cs
@@ -29,6 +29,8 @@
using ZXing.QrCode.Internal;
using System.Xml.Linq;
using WMS.IBLL.ISysServer;
+using ZXing;
+using WMS.IBLL.IBllQualityServer;
namespace Wms.Controllers
{
@@ -48,12 +50,13 @@
private readonly IPdaAsnServer _pdaAsnServer;// PDA
private readonly IMaterialsServer _materialSvc;//鐗╂枡Svc
private readonly ICustomerServer _customerSvc;//瀹㈡埛Svc
+ private readonly IQualityInspectServer _inspectSvc;//璐ㄩ噺Svc
private readonly IHttpServer _http;
private string logStr = $@".\log\SAP璧嬬爜\Sap涓嬪彂鎶ユ枃" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
- public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer, IMaterialsServer materialSvc, ICustomerServer customerSvc, IHttpServer http)
+ public UpApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IArrivalNoticeServer arrivalNoticeServer, IStockCheckServer stockCheckSvc, IProcurePlanServer procurePlanSvc, IPdaAsnServer pdaAsnServer, IMaterialsServer materialSvc, ICustomerServer customerSvc,IQualityInspectServer inspectSvc, IHttpServer http)
{
_config = setting.Value;
_exNoticeSvc = exNoticeSvc;
@@ -63,6 +66,7 @@
_pdaAsnServer = pdaAsnServer;
_materialSvc = materialSvc;
_customerSvc = customerSvc;
+ _inspectSvc = inspectSvc;
_http = http;
}
#endregion
@@ -122,11 +126,16 @@
if (!str.Contains("0"))
{
list = new { Success = -1, Message = str };
+
+ LogFile.SaveLogToFile($"瀹㈡埛渚涘簲鍟嗕富鏁版嵁鍚屾锛�( {JsonConvert.SerializeObject(list)} ),", logStr);
+ return Ok(new { result = false, code = "400", message = str });
}
+ else
+ {
+ LogFile.SaveLogToFile($"瀹㈡埛渚涘簲鍟嗕富鏁版嵁鍚屾锛�( {JsonConvert.SerializeObject(list)} ),", logStr);
- LogFile.SaveLogToFile($"瀹㈡埛渚涘簲鍟嗕富鏁版嵁鍚屾锛�( {JsonConvert.SerializeObject(list)} ),", logStr);
-
- return Ok(new { result = true, code = "1", message = "success" });
+ return Ok(new { result = true, code = "1", message = "success" });
+ }
}
catch (Exception e)
{
@@ -142,16 +151,33 @@
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
- public IActionResult CreateAsn(object model)
+ public IActionResult CreateAsn(SapAsnVm model)
{
-
+ var logStr = $@".\log\SAP\鍏ュ簱鍗曚笅鍙�" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
try
{
- LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曚笅鍙戯細( {model} ),", logStr);
- return Ok(new { result = true, code = "1", message = "success" });
+ var jsonData = JsonConvert.SerializeObject(model);
+ LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曟暟鎹細( {jsonData} ),", logStr);
+
+ var _result = _arrivalNoticeSvc.CreateAsn(model.data, model.@operator);
+
+ var list = new { Success = 0, Message = "涓嬪彂鎴愬姛" };
+ if (_result.Success == 0)
+ {
+ LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曚笅鍙戞垚鍔燂細( {JsonConvert.SerializeObject(list)} ),", logStr);
+ return Ok(new { result = true, code = "1", message = "success" });
+ }
+ else
+ {
+ list = new { Success = -1, Message = _result.Message };
+
+ LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曚笅鍙戝け璐ワ細( {JsonConvert.SerializeObject(list)} ),", logStr);
+ return Ok(new { result = false, code = "400", message = _result.Message });
+ }
}
catch (Exception e)
{
+ LogFile.SaveLogToFile($"Sap鍏ュ簱鍗曚笅鍙戝紓甯革細{e.Message}", logStr);
return Ok(new { result = false, code = "400", message = e.Message });
}
}
@@ -163,12 +189,16 @@
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
- public IActionResult CreateSo(object model)
+ public IActionResult CreateSo(SapSoVm model)
{
-
+ var logStr = $@".\log\SAP\鍑哄簱鍗曚笅鍙�" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
try
{
- LogFile.SaveLogToFile($"Sap鍑哄簱鍗曚笅鍙戯細( {model} ),", logStr);
+ var jsonData = JsonConvert.SerializeObject(model);
+ LogFile.SaveLogToFile($"Sap鍑哄簱鍗曚笅鍙戯細( {jsonData} ),", logStr);
+
+ _exNoticeSvc.ErpAddExportNotice(model.data);
+
return Ok(new { result = true, code = "1", message = "success" });
}
catch (Exception e)
@@ -185,14 +215,15 @@
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
- public IActionResult UpQuality(object model)
+ public IActionResult UpQuality(SapQualityVm model)
{
-
+ var logStr = $@".\log\SAP\搴撳瓨璐ㄩ噺鐘舵�佹帴鏀�" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
try
{
- // var sd = JsonConvert.SerializeObject(model);
- // var sd2 = JsonConvert.DeserializeObject<BoxPalletBindVm>(sd);
- LogFile.SaveLogToFile($"Sap璐ㄩ噺鐘舵�佸彉鏇达細( {model} ),", logStr);
+ var jsonData = JsonConvert.SerializeObject(model);
+ LogFile.SaveLogToFile($"Sap搴撳瓨璐ㄩ噺鐘舵�佷笅鍙戯細( {jsonData} ),", logStr);
+
+ _inspectSvc.InsertQualitySap(model.data);
return Ok(new { result = true, code = "1", message = "success" });
}
catch (Exception e)
@@ -349,7 +380,7 @@
{
return Ok(new { code = 1, msg = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
}
- _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
+ _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, _config.ErpHost + _config.SoFinishUrl2, int.Parse(userId));
return Ok(new { code = 0, count = 0, msg = "鍑哄簱鍗曞鏍稿苟涓婁紶鎴愬姛" });
}
catch (Exception e)
--
Gitblit v1.8.0