Controllers/AGV/AgvApiController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Controllers/AGV/MesClient.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Controllers/AGV/app.config | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Controllers/Warehouse/MesCgthSqController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
NewPdaSqlServer.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
service/Warehouse/MesBarCFManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
service/Warehouse/MesCgthSqManager.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Controllers/AGV/AgvApiController.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,218 @@ using System.Dynamic; using Azure; using Microsoft.AspNetCore.Mvc; using NewPdaSqlServer.Dto.service; using NewPdaSqlServer.entity; using NewPdaSqlServer.util; using Newtonsoft.Json.Linq; using System.ServiceModel; using System.IO; namespace NewPdaSqlServer.Controllers.AGV; [Route("api/[controller]")] [ApiController] public class AgvApiController : ControllerBase { OaApiService m = new OaApiService(); //å¨ç±»å æ·»å æ¥å¿æ¹æ³ // private void LogToFile(string methodName, object request, string response) //{ // string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs", $"AgvLog_{DateTime.Now:yyyyMMdd}.log"); // Directory.CreateDirectory(Path.GetDirectoryName(logPath)); // string logContent = $"[{DateTime.Now:HH:mm:ss}] æ¹æ³ï¼{methodName}\n" + // $"请æ±åæ°ï¼{JObject.FromObject(request)}\n" + // $"ååºç»æï¼{response}\n\n"; // File.AppendAllText(logPath, logContent); //} // ä¿®æ¹ç°ææ¹æ³ï¼ä»¥AgvTest为ä¾ï¼ [HttpPost("AgvTest")] public ResponseResult AgvTest(dynamic queryObj) { try { var binding = new BasicHttpBinding { /* åæé ç½® */ }; var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); var factory = new ChannelFactory<IImesInterface>(binding, endpoint); var channel = factory.CreateChannel(); string result = channel.PrintHello(); ((IClientChannel)channel).Close(); // è®°å½æ¥å¿ //LogToFile(nameof(AgvTest), new { queryObj }, result); return new ResponseResult { status = 0, message = "OK", data = result }; } catch (Exception ex) { //LogToFile(nameof(AgvTest), new { queryObj }, $"å¼å¸¸ï¼{ex}"); return ResponseResult.ResponseError(ex); } } //ç«åºéæ£ [HttpPost("DefineTask_001")] public ResponseResult DefineTask_001(dynamic queryObj) { try { var binding = new BasicHttpBinding { MaxReceivedMessageSize = 10485760, // 10MB TextEncoding = System.Text.Encoding.UTF8 }; var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); var factory = new ChannelFactory<IImesInterface>(binding, endpoint); var channel = factory.CreateChannel(); string result = channel.DefineTask_001("GS2025070700001","TEST.01","AGVæµè¯ç©æåç§°", "AGVæµè¯ç©æè§æ ¼",100,"å°",1); ((IClientChannel)channel).Close(); return new ResponseResult { status = 0, message = "OK", data = result }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } //ç«åºæ£éª [HttpPost("DefineTask_002")] public ResponseResult DefineTask_002(dynamic queryObj) { try { var binding = new BasicHttpBinding { MaxReceivedMessageSize = 10485760, // 10MB TextEncoding = System.Text.Encoding.UTF8 }; var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); var factory = new ChannelFactory<IImesInterface>(binding, endpoint); var channel = factory.CreateChannel(); string result = channel.DefineTask_002("GS2025070900010", "åæ ¼"); ((IClientChannel)channel).Close(); return new ResponseResult { status = 0, message = "OK", data = result }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } //ç«åºå¼å« [HttpPost("DefineTask_005")] public ResponseResult DefineTask_005(dynamic queryObj) { try { var binding = new BasicHttpBinding { MaxReceivedMessageSize = 10485760, // 10MB TextEncoding = System.Text.Encoding.UTF8 }; var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); var factory = new ChannelFactory<IImesInterface>(binding, endpoint); var channel = factory.CreateChannel(); string result = channel.DefineTask_005(); ((IClientChannel)channel).Close(); return new ResponseResult { status = 0, message = "OK", data = result }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } //ç«åºå ¥åº [HttpPost("DefineTask_006")] public ResponseResult DefineTask_006(dynamic queryObj) { try { var binding = new BasicHttpBinding { MaxReceivedMessageSize = 10485760, // 10MB TextEncoding = System.Text.Encoding.UTF8 }; var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet"); var factory = new ChannelFactory<IImesInterface>(binding, endpoint); var channel = factory.CreateChannel(); string result = channel.DefineTask_006("C2025070400040", "2.02.51.463", "管线饮水æº", "C638-1HA(ä¸åVGX-SR-1A-XMç½)", 48, "å°", 4); ((IClientChannel)channel).Close(); return new ResponseResult { status = 0, message = "OK", data = result }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } } // å¨ç±»å¤é¨æ·»å æå¡å¥çº¦æ¥å£ [ServiceContract(Namespace = "http://tempuri.org/")] public interface IImesInterface { [OperationContract(Action = "http://tempuri.org/ImesInterface/PrintHello", ReplyAction = "http://tempuri.org/ImesInterface/PrintHelloResponse")] string PrintHello(); //ç«åºéæ£ [OperationContract(Action = "http://tempuri.org/ImesInterface/DefineTask_001", ReplyAction = "http://tempuri.org/ImesInterface/DefineTask_001Response")] string DefineTask_001(string MesId, string MatId, string MatName, string MatStandard, int MatNumber, string MatUnit, int Postition); //ç«åºæ£éª [OperationContract(Action = "http://tempuri.org/ImesInterface/DefineTask_002", ReplyAction = "http://tempuri.org/ImesInterface/DefineTask_002Response")] string DefineTask_002(string MesId, string MatStatus); //ç«åºå¼å« [OperationContract(Action = "http://tempuri.org/ImesInterface/DefineTask_005", ReplyAction = "http://tempuri.org/ImesInterface/DefineTask_005Response")] string DefineTask_005(); //ç«åºå ¥åº [OperationContract(Action = "http://tempuri.org/ImesInterface/DefineTask_006", ReplyAction = "http://tempuri.org/ImesInterface/DefineTask_006Response")] string DefineTask_006(string MesId,string MatId,string MatName,string MatStandard,int MatNumber,string MatUnit,int Postition); } Controllers/AGV/MesClient.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,402 @@ //------------------------------------------------------------------------------ // <auto-generated> // æ¤ä»£ç ç±å·¥å ·çæã // è¿è¡æ¶çæ¬:4.0.30319.42000 // // å¯¹æ¤æä»¶çæ´æ¹å¯è½ä¼å¯¼è´ä¸æ£ç¡®çè¡ä¸ºï¼å¹¶ä¸å¦æ // éæ°çæä»£ç ï¼è¿äºæ´æ¹å°ä¼ä¸¢å¤±ã // </auto-generated> //------------------------------------------------------------------------------ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.ServiceContractAttribute(ConfigurationName="ImesInterface")] public interface ImesInterface { // CODEGEN: å½åç©ºé´ çå ç´ åç§° PrintHelloResult 以åçæçæ¶æ¯å宿ªæ 记为 nillable [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/PrintHello", ReplyAction="http://tempuri.org/ImesInterface/PrintHelloResponse")] PrintHelloResponse PrintHello(PrintHelloRequest request); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/PrintHello", ReplyAction="http://tempuri.org/ImesInterface/PrintHelloResponse")] System.Threading.Tasks.Task<PrintHelloResponse> PrintHelloAsync(PrintHelloRequest request); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/DefineTask_001", ReplyAction="http://tempuri.org/ImesInterface/DefineTask_001Response")] DefineTask_001Response DefineTask_001(DefineTask_001Request request); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/DefineTask_001", ReplyAction="http://tempuri.org/ImesInterface/DefineTask_001Response")] System.Threading.Tasks.Task<DefineTask_001Response> DefineTask_001Async(DefineTask_001Request request); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/DefineTask_006", ReplyAction="http://tempuri.org/ImesInterface/DefineTask_006Response")] DefineTask_006Response DefineTask_006(DefineTask_006Request request); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/DefineTask_006", ReplyAction="http://tempuri.org/ImesInterface/DefineTask_006Response")] System.Threading.Tasks.Task<DefineTask_006Response> DefineTask_006Async(DefineTask_006Request request); } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class PrintHelloRequest { [System.ServiceModel.MessageBodyMemberAttribute(Name="PrintHello", Namespace="http://tempuri.org/", Order=0)] public PrintHelloRequestBody Body; public PrintHelloRequest() { } public PrintHelloRequest(PrintHelloRequestBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.Runtime.Serialization.DataContractAttribute()] public partial class PrintHelloRequestBody { public PrintHelloRequestBody() { } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class PrintHelloResponse { [System.ServiceModel.MessageBodyMemberAttribute(Name="PrintHelloResponse", Namespace="http://tempuri.org/", Order=0)] public PrintHelloResponseBody Body; public PrintHelloResponse() { } public PrintHelloResponse(PrintHelloResponseBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] [System.Runtime.Serialization.DataContractAttribute(Namespace="")] public partial class PrintHelloResponseBody { [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] public string PrintHelloResult; public PrintHelloResponseBody() { } public PrintHelloResponseBody(string PrintHelloResult) { this.PrintHelloResult = PrintHelloResult; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class DefineTask_001Request { [System.ServiceModel.MessageBodyMemberAttribute(Name="DefineTask_001", Namespace="http://tempuri.org/", Order=0)] public DefineTask_001RequestBody Body; public DefineTask_001Request() { } public DefineTask_001Request(DefineTask_001RequestBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Namespace="")] public partial class DefineTask_001RequestBody { [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] public string taskName; [System.Runtime.Serialization.DataMemberAttribute(Order=1)] public int taskId; public DefineTask_001RequestBody() { } public DefineTask_001RequestBody(string taskName, int taskId) { this.taskName = taskName; this.taskId = taskId; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class DefineTask_001Response { [System.ServiceModel.MessageBodyMemberAttribute(Name="DefineTask_001Response", Namespace="http://tempuri.org/", Order=0)] public DefineTask_001ResponseBody Body; public DefineTask_001Response() { } public DefineTask_001Response(DefineTask_001ResponseBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Namespace="")] public partial class DefineTask_001ResponseBody { [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] public string DefineTaskResult; [System.Runtime.Serialization.DataMemberAttribute(Order=1)] public int taskStatusCode; public DefineTask_001ResponseBody() { } public DefineTask_001ResponseBody(string DefineTaskResult, int taskStatusCode) { this.DefineTaskResult = DefineTaskResult; this.taskStatusCode = taskStatusCode; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class DefineTask_006Request { [System.ServiceModel.MessageBodyMemberAttribute(Name="DefineTask_006", Namespace="http://tempuri.org/", Order=0)] public DefineTask_006RequestBody Body; public DefineTask_006Request() { } public DefineTask_006Request(DefineTask_006RequestBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Namespace="")] public partial class DefineTask_006RequestBody { [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] public string taskName; [System.Runtime.Serialization.DataMemberAttribute(Order=1)] public int taskId; public DefineTask_006RequestBody() { } public DefineTask_006RequestBody(string taskName, int taskId) { this.taskName = taskName; this.taskId = taskId; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.MessageContractAttribute(IsWrapped=false)] public partial class DefineTask_006Response { [System.ServiceModel.MessageBodyMemberAttribute(Name="DefineTask_006Response", Namespace="http://tempuri.org/", Order=0)] public DefineTask_006ResponseBody Body; public DefineTask_006Response() { } public DefineTask_006Response(DefineTask_006ResponseBody Body) { this.Body = Body; } } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Namespace="")] public partial class DefineTask_006ResponseBody { [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)] public string DefineTaskResult; [System.Runtime.Serialization.DataMemberAttribute(Order=1)] public int taskStatusCode; public DefineTask_006ResponseBody() { } public DefineTask_006ResponseBody(string DefineTaskResult, int taskStatusCode) { this.DefineTaskResult = DefineTaskResult; this.taskStatusCode = taskStatusCode; } } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public interface ImesInterfaceChannel : ImesInterface, System.ServiceModel.IClientChannel { } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public partial class ImesInterfaceClient : System.ServiceModel.ClientBase<ImesInterface>, ImesInterface { public ImesInterfaceClient() { } //public ImesInterfaceClient(string endpointConfigurationName) : // base(endpointConfigurationName) //{ //} //public ImesInterfaceClient(string endpointConfigurationName, string remoteAddress) : // base(endpointConfigurationName, remoteAddress) //{ //} //public ImesInterfaceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : // base(endpointConfigurationName, remoteAddress) //{ //} public ImesInterfaceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] PrintHelloResponse ImesInterface.PrintHello(PrintHelloRequest request) { return base.Channel.PrintHello(request); } public string PrintHello() { PrintHelloRequest inValue = new PrintHelloRequest(); inValue.Body = new PrintHelloRequestBody(); PrintHelloResponse retVal = ((ImesInterface)(this)).PrintHello(inValue); return retVal.Body.PrintHelloResult; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] System.Threading.Tasks.Task<PrintHelloResponse> ImesInterface.PrintHelloAsync(PrintHelloRequest request) { return base.Channel.PrintHelloAsync(request); } public System.Threading.Tasks.Task<PrintHelloResponse> PrintHelloAsync() { PrintHelloRequest inValue = new PrintHelloRequest(); inValue.Body = new PrintHelloRequestBody(); return ((ImesInterface)(this)).PrintHelloAsync(inValue); } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] DefineTask_001Response ImesInterface.DefineTask_001(DefineTask_001Request request) { return base.Channel.DefineTask_001(request); } public string DefineTask_001(string taskName, int taskId, out int taskStatusCode) { DefineTask_001Request inValue = new DefineTask_001Request(); inValue.Body = new DefineTask_001RequestBody(); inValue.Body.taskName = taskName; inValue.Body.taskId = taskId; DefineTask_001Response retVal = ((ImesInterface)(this)).DefineTask_001(inValue); taskStatusCode = retVal.Body.taskStatusCode; return retVal.Body.DefineTaskResult; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] System.Threading.Tasks.Task<DefineTask_001Response> ImesInterface.DefineTask_001Async(DefineTask_001Request request) { return base.Channel.DefineTask_001Async(request); } public System.Threading.Tasks.Task<DefineTask_001Response> DefineTask_001Async(string taskName, int taskId) { DefineTask_001Request inValue = new DefineTask_001Request(); inValue.Body = new DefineTask_001RequestBody(); inValue.Body.taskName = taskName; inValue.Body.taskId = taskId; return ((ImesInterface)(this)).DefineTask_001Async(inValue); } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] DefineTask_006Response ImesInterface.DefineTask_006(DefineTask_006Request request) { return base.Channel.DefineTask_006(request); } public string DefineTask_006(string taskName, int taskId, out int taskStatusCode) { DefineTask_006Request inValue = new DefineTask_006Request(); inValue.Body = new DefineTask_006RequestBody(); inValue.Body.taskName = taskName; inValue.Body.taskId = taskId; DefineTask_006Response retVal = ((ImesInterface)(this)).DefineTask_006(inValue); taskStatusCode = retVal.Body.taskStatusCode; return retVal.Body.DefineTaskResult; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] System.Threading.Tasks.Task<DefineTask_006Response> ImesInterface.DefineTask_006Async(DefineTask_006Request request) { return base.Channel.DefineTask_006Async(request); } public System.Threading.Tasks.Task<DefineTask_006Response> DefineTask_006Async(string taskName, int taskId) { DefineTask_006Request inValue = new DefineTask_006Request(); inValue.Body = new DefineTask_006RequestBody(); inValue.Body.taskName = taskName; inValue.Body.taskId = taskId; return ((ImesInterface)(this)).DefineTask_006Async(inValue); } } Controllers/AGV/app.config
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_ImesInterface" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://192.168.35.251:8000/MesGet" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ImesInterface" contract="ImesInterface" name="BasicHttpBinding_ImesInterface" /> </client> </system.serviceModel> </configuration> Controllers/Warehouse/MesCgthSqController.cs
@@ -66,7 +66,7 @@ //ScanCode /// <summary> /// è·åææå·²ç»å®¡æ ¸çç³è¯·å /// éè´éè´§ /// </summary> /// <returns></returns> [HttpPost("ScanCode")] @@ -98,6 +98,59 @@ } } //ScanCode /// <summary> /// éè´éªé /// </summary> /// <returns></returns> [HttpPost("ScanCgyt")] public ResponseResult ScanCgyt(dynamic query) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = m.ScanCgyt(query); resultInfos.YtItem = m.getYtItem(resultInfos.tbBillList.ytdh); resultInfos.YtBarInfo = m.getYtBarInfo(resultInfos.tbBillList.ytdh); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } //ScanCode /// <summary> /// éè´éè´§å é¤ /// </summary> /// <returns></returns> [HttpPost("deleteCgyt")] public ResponseResult deleteCgyt(dynamic query) { try { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = m.deleteCgyt(query); return new ResponseResult { status = 0, message = "OK", data = resultInfos }; } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } [HttpPost("ScanCodeCF")] public ResponseResult ScanCodeCF(WarehouseQuery query) { NewPdaSqlServer.csproj
@@ -20,6 +20,7 @@ <PackageReference Include="System.Data.SqlClient" Version="4.8.6" /> <PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" /> <PackageReference Include="System.Security.Cryptography.Xml" Version="9.0.4" /> <PackageReference Include="System.ServiceModel.Http" Version="8.1.2" /> </ItemGroup> <ItemGroup> service/Warehouse/MesBarCFManager.cs
@@ -34,6 +34,13 @@ if(KcInfo.Count > 0) throw new Exception("该æ¡ç å·²å ¥åºä¸è½è¿è¡å ¥åºåæåï¼"); //var sql3 = @"SELECT 1 FROM MES_INV_ITEM_CGYT_C_DETAILS WHERE ITEM_BARCODE =@barcode"; //var YtInfo = Db.Ado.SqlQuery<dynamic>(sql3, sqlParams); //if (YtInfo.Count > 0) throw new Exception("该æ¡ç å·²æ«æéæä¸è½è¿è¡å ¥åºåæåï¼"); var sql2 = @"SELECT ITEM_ID,QUANTITY FROM MES_INV_ITEM_BARCODES WHERE ITEM_BARCODE =@barcode "; var barInfo = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams).FirstOrDefault(); service/Warehouse/MesCgthSqManager.cs
@@ -6,6 +6,7 @@ using NewPdaSqlServer.entity; using NewPdaSqlServer.entity.Base; using SqlSugar; using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace NewPdaSqlServer.service.Warehouse; @@ -224,4 +225,164 @@ } } } /// <summary> /// éè´æ«ç éªé /// </summary> /// <param name="query"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentException"></exception> /// <exception cref="Exception"></exception> public dynamic ScanCgyt(dynamic query) { if (query == null) throw new ArgumentNullException(nameof(query), "åæ°å¯¹è±¡ä¸è½ä¸º null"); // 2. ä½¿ç¨ string.IsNullOrEmpty ç´æ¥å¤æåç¬¦ä¸²å±æ§ï¼é¿å NullReferenceExceptionï¼ if (string.IsNullOrEmpty(query.userName?.ToString())) throw new ArgumentException("ç¨æ·åä¸å 许为空", nameof(query.userName)); if (string.IsNullOrEmpty(query.barcode?.ToString())) throw new ArgumentException("éè´ç©ææ¡ç ä¸å 许为空", nameof(query.barcode)); using (var conn = new SqlConnection(DbHelperSQL.strConn)) { using (var cmd = new SqlCommand("prc_pda_scan_CGYT", conn)) { cmd.CommandType = CommandType.StoredProcedure; var parameters = new SqlParameter[] { new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName }, new("@pi_barcode", SqlDbType.NVarChar, 100) { Value = query.barcode }, new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, new("@po_outSum", SqlDbType.Int) { Direction = ParameterDirection.Output }, new("@po_ygdh", SqlDbType.NVarChar, 200) { Direction = ParameterDirection.Output } }; cmd.Parameters.AddRange(parameters); conn.Open(); cmd.ExecuteNonQuery(); var result = new { result = parameters[3].Value.ToString(), barcode = query.barcode, ytdh = parameters[4].Value.ToString(), msg = parameters[2].Value.ToString() }; if (result.result == "-1") throw new Exception(parameters[2].Value.ToString()); return result; } } } /// <summary> /// å é¤éªéå /// </summary> /// <param name="query"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentException"></exception> /// <exception cref="Exception"></exception> public dynamic deleteCgyt(dynamic query) { if (query == null) throw new ArgumentNullException(nameof(query), "åæ°å¯¹è±¡ä¸è½ä¸º null"); // 2. ä½¿ç¨ string.IsNullOrEmpty ç´æ¥å¤æåç¬¦ä¸²å±æ§ï¼é¿å NullReferenceExceptionï¼ if (string.IsNullOrEmpty(query.userName?.ToString())) throw new ArgumentException("ç¨æ·åä¸å 许为空", nameof(query.userName)); if (string.IsNullOrEmpty(query.ytdh?.ToString())) throw new ArgumentException("追溯ç ä¸å 许为空", nameof(query.ytdh)); using (var conn = new SqlConnection(DbHelperSQL.strConn)) { using (var cmd = new SqlCommand("prc_pda_delete_CGYT", conn)) { cmd.CommandType = CommandType.StoredProcedure; var parameters = new SqlParameter[] { new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName }, new("@pi_ytdh", SqlDbType.NVarChar, 100) { Value = query.ytdh }, new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, new("@po_outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } }; cmd.Parameters.AddRange(parameters); conn.Open(); cmd.ExecuteNonQuery(); var result = new { result = parameters[3].Value.ToString(), msg = parameters[2].Value.ToString(), }; if (result.result == "-1") throw new Exception(parameters[2].Value.ToString()); return result; } } } /// <summary> /// è·åéªéåå·²æ«ç©æä¿¡æ¯ /// </summary> /// <param name="query"></param> /// <returns></returns> public dynamic getYtItem(string ytdh) { if (string.IsNullOrEmpty(ytdh?.ToString())) throw new ArgumentException("éªéåå·ä¸å 许为空", nameof(ytdh)); var sqlParams = new List<SugarParameter> { new("@ytdh", ytdh) }; var sql1 = @"SELECT C.item_id,C.item_no,C.item_name,C.item_model,A.quantity FROM MES_INV_ITEM_CGYT_ITEMS A LEFT JOIN MES_INV_ITEM_CGYT B ON A.item_cgyt_id = B.GUID LEFT JOIN MES_ITEMS C ON A.item_id = C.item_id WHERE B.item_cgyt_no = @ytdh"; var YtItem = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams); //if (YtItem.Count < 1) //{ // throw new Exception($"该éªéåå·{ytdh}ç©ææç»ä¸åå¨ï¼"); //} return YtItem; } /// <summary> /// è·åéªéåå·²æ«æ¡ç ä¿¡æ¯ /// </summary> /// <param name="query"></param> /// <returns></returns> public dynamic getYtBarInfo(string ytdh) { if (string.IsNullOrEmpty(ytdh?.ToString())) throw new ArgumentException("éªéåå·ä¸å 许为空", nameof(ytdh)); var sqlParams = new List<SugarParameter> { new("@ytdh", ytdh) }; var sql1 = @"SELECT C.item_id,C.item_no,C.item_name,C.item_model,A.quantity,A.ITEM_BARCODE FROM MES_INV_ITEM_CGYT_C_DETAILS A LEFT JOIN MES_INV_ITEM_CGYT B ON A.item_cgyt_id = B.GUID LEFT JOIN MES_ITEMS C ON A.item_id = C.item_id WHERE B.item_cgyt_no = @ytdh"; var YtBarInfo = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams); //if (YtBarInfo.Count < 1) //{ // throw new Exception($"该éªéåå·{ytdh}ä»ä»¬ä¸åå¨ï¼"); //} return YtBarInfo; } }