From d0a265713fd18162f3a82bdcd22e267df7298c7b Mon Sep 17 00:00:00 2001 From: 杨前锦 <1010338399@qq.com> Date: 星期一, 26 五月 2025 08:59:52 +0800 Subject: [PATCH] 印尼佳通-半制品代码逻辑优化 --- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WCSHelper.cs | 9 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/MatlInformation.cs | 6 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/CntrItemRel.cs | 58 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/WmsController.cs | 2 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/Monitor.cs | 171 -- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/Overage.cs | 4 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs | 556 +++++-- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/HH.WCS.Mobox3.YNJT_BZP.csproj | 1 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/WMSTask.cs | 4 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/WmsController.cs | 131 + HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/Program.cs | 5 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/core/Monitor.cs | 25 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/ItemBarcodeInfo.cs | 5 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/MatlInformation.cs | 5 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/MoboxController.cs | 48 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/Program.cs | 14 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/WmsController.cs | 2 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/wms/WMSHelper.cs | 12 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs | 75 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiModel.cs | 9 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/process/DeviceProcess.cs | 35 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/ExcetionHelper.cs | 3 /dev/null | 941 ------------- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/SynDataTimeRecord.cs | 2 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WCSHelper.cs | 20 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/OffLineRecord.cs | 23 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/dispatch/WCSDispatch.cs | 88 - HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/Overage.cs | 21 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/config/config.json | 225 --- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiModel.cs | 7 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/WCSCore.cs | 158 +- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/process/TaskProcess.cs | 153 + HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/Overage.cs | 5 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/TableOfBarcodeStatus.cs | 10 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/Settings.cs | 73 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/dispatch/WMSDispatch.cs | 7 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WMSHelper.cs | 807 ++++------ HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/ContainerHelper.cs | 204 -- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/ApiModel.cs | 3 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/WCSCore.cs | 37 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs | 2 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/TaskAction.cs | 2 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/HH.WCS.Mobox3.YNJT_PT.csproj | 4 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/GreenTireInformation.cs | 26 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs | 121 45 files changed, 1,427 insertions(+), 2,692 deletions(-) diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App.config b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App.config deleted file mode 100644 index 75f84bf..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App.config +++ /dev/null @@ -1,59 +0,0 @@ -锘�?xml version="1.0" encoding="utf-8"?> -<configuration> - <configSections> - <section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.23.1, Culture=neutral, PublicKeyToken=89b483f429c47342" /> - </configSections> - <startup> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> - </startup> - <runtime> - <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> - <dependentAssembly> - <assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-5.2.9.0" newVersion="5.2.9.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-5.2.9.0" newVersion="5.2.9.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.122.23.1" newVersion="4.122.23.1" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" /> - </dependentAssembly> - </assemblyBinding> - </runtime> - <system.data> - <DbProviderFactories> - <remove invariant="Oracle.ManagedDataAccess.Client" /> - <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.23.1, Culture=neutral, PublicKeyToken=89b483f429c47342" /> - </DbProviderFactories> - </system.data> -</configuration> \ No newline at end of file diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/Startup.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/Startup.cs deleted file mode 100644 index dc87ce8..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/Startup.cs +++ /dev/null @@ -1,48 +0,0 @@ -锘縰sing System; -using System.Linq; -using System.Net.Http.Formatting; -using System.Threading.Tasks; -using System.Web.Http; -using Microsoft.Owin; -using Owin; -using Swashbuckle.Application; - -[assembly: OwinStartup(typeof(HH.WCS.Mobox3.FJJT.Startup))] - -namespace HH.WCS.Mobox3.FJJT { - public class Startup { - public void Configuration(IAppBuilder app) { - // 鏈夊叧濡備綍閰嶇疆搴旂敤绋嬪簭鐨勮缁嗕俊鎭紝璇疯闂�https://go.microsoft.com/fwlink/?LinkID=316888 - HttpConfiguration config = new HttpConfiguration(); - config.Routes.MapHttpRoute( - name: "DefaultApi", - routeTemplate: "api/{controller}/{action}/{id}", - defaults: new { id = RouteParameter.Optional } - ); - // Web API routes - //config.MapHttpAttributeRoutes(); - //config.EnableSwagger(c => c.SingleApiVersion("v1", "hh wms api")) - // .EnableSwaggerUi(); - //config.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); - //config.Formatters.Add(new JsonMediaTypeFormatter()); - - - //WebApiConfig.Register(config); - // Web API routes - config.MapHttpAttributeRoutes(); - config.EnableSwagger(c => { - c.SingleApiVersion("v1", "hh wms api"); - c.IncludeXmlComments(System.AppDomain.CurrentDomain.BaseDirectory + "\\HH.WCS.Mobox3.FJJT.xml"); - c.CustomProvider((defaultProvider) => new SwaggerCacheProvider(defaultProvider, $@"{System.AppDomain.CurrentDomain.BaseDirectory}\\HH.WCS.Mobox3.FJJT.xml")); - c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); - } - ).EnableSwaggerUi(c => { - c.InjectJavaScript(System.Reflection.Assembly.GetExecutingAssembly(), "swagger.js"); - }); - config.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); - config.Formatters.Add(new JsonMediaTypeFormatter()); - - app.UseWebApi(config); - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/SwaggerConfig.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/SwaggerConfig.cs deleted file mode 100644 index 557097d..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/SwaggerConfig.cs +++ /dev/null @@ -1,255 +0,0 @@ -using System.Web.Http; -using WebActivatorEx; -using HH.WCS.Mobox3.Template; -using Swashbuckle.Application; - -[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] - -namespace HH.WCS.Mobox3.Template -{ - public class SwaggerConfig - { - public static void Register() - { - var thisAssembly = typeof(SwaggerConfig).Assembly; - - GlobalConfiguration.Configuration - .EnableSwagger(c => - { - // By default, the service root url is inferred from the request used to access the docs. - // However, there may be situations (e.g. proxy and load-balanced environments) where this does not - // resolve correctly. You can workaround this by providing your own code to determine the root URL. - // - //c.RootUrl(req => GetRootUrlFromAppConfig()); - - // If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access - // the docs is taken as the default. If your API supports multiple schemes and you want to be explicit - // about them, you can use the "Schemes" option as shown below. - // - //c.Schemes(new[] { "http", "https" }); - - // Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to - // hold additional metadata for an API. Version and title are required but you can also provide - // additional fields by chaining methods off SingleApiVersion. - // - c.SingleApiVersion("v1", "HH.WCS.Mobox3.Template"); - - // If you want the output Swagger docs to be indented properly, enable the "PrettyPrint" option. - // - //c.PrettyPrint(); - - // If your API has multiple versions, use "MultipleApiVersions" instead of "SingleApiVersion". - // In this case, you must provide a lambda that tells Swashbuckle which actions should be - // included in the docs for a given API version. Like "SingleApiVersion", each call to "Version" - // returns an "Info" builder so you can provide additional metadata per API version. - // - //c.MultipleApiVersions( - // (apiDesc, targetApiVersion) => ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), - // (vc) => - // { - // vc.Version("v2", "Swashbuckle Dummy API V2"); - // vc.Version("v1", "Swashbuckle Dummy API V1"); - // }); - - // You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the API. - // See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details. - // NOTE: These only define the schemes and need to be coupled with a corresponding "security" property - // at the document or operation level to indicate which schemes are required for an operation. To do this, - // you'll need to implement a custom IDocumentFilter and/or IOperationFilter to set these properties - // according to your specific authorization implementation - // - //c.BasicAuth("basic") - // .Description("Basic HTTP Authentication"); - // - // NOTE: You must also configure 'EnableApiKeySupport' below in the SwaggerUI section - //c.ApiKey("apiKey") - // .Description("API Key Authentication") - // .Name("apiKey") - // .In("header"); - // - //c.OAuth2("oauth2") - // .Description("OAuth2 Implicit Grant") - // .Flow("implicit") - // .AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog") - // //.TokenUrl("https://tempuri.org/token") - // .Scopes(scopes => - // { - // scopes.Add("read", "Read access to protected resources"); - // scopes.Add("write", "Write access to protected resources"); - // }); - - // Set this flag to omit descriptions for any actions decorated with the Obsolete attribute - //c.IgnoreObsoleteActions(); - - // Each operation be assigned one or more tags which are then used by consumers for various reasons. - // For example, the swagger-ui groups operations according to the first tag of each operation. - // By default, this will be controller name but you can use the "GroupActionsBy" option to - // override with any value. - // - //c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString()); - - // You can also specify a custom sort order for groups (as defined by "GroupActionsBy") to dictate - // the order in which operations are listed. For example, if the default grouping is in place - // (controller name) and you specify a descending alphabetic sort order, then actions from a - // ProductsController will be listed before those from a CustomersController. This is typically - // used to customize the order of groupings in the swagger-ui. - // - //c.OrderActionGroupsBy(new DescendingAlphabeticComparer()); - - // If you annotate Controllers and API Types with - // Xml comments (http://msdn.microsoft.com/en-us/library/b2s063f7(v=vs.110).aspx), you can incorporate - // those comments into the generated docs and UI. You can enable this by providing the path to one or - // more Xml comment files. - // - //c.IncludeXmlComments(GetXmlCommentsPath()); - - // Swashbuckle makes a best attempt at generating Swagger compliant JSON schemas for the various types - // exposed in your API. However, there may be occasions when more control of the output is needed. - // This is supported through the "MapType" and "SchemaFilter" options: - // - // Use the "MapType" option to override the Schema generation for a specific type. - // It should be noted that the resulting Schema will be placed "inline" for any applicable Operations. - // While Swagger 2.0 supports inline definitions for "all" Schema types, the swagger-ui tool does not. - // It expects "complex" Schemas to be defined separately and referenced. For this reason, you should only - // use the "MapType" option when the resulting Schema is a primitive or array type. If you need to alter a - // complex Schema, use a Schema filter. - // - //c.MapType<ProductType>(() => new Schema { type = "integer", format = "int32" }); - - // If you want to post-modify "complex" Schemas once they've been generated, across the board or for a - // specific type, you can wire up one or more Schema filters. - // - //c.SchemaFilter<ApplySchemaVendorExtensions>(); - - // In a Swagger 2.0 document, complex types are typically declared globally and referenced by unique - // Schema Id. By default, Swashbuckle does NOT use the full type name in Schema Ids. In most cases, this - // works well because it prevents the "implementation detail" of type namespaces from leaking into your - // Swagger docs and UI. However, if you have multiple types in your API with the same class name, you'll - // need to opt out of this behavior to avoid Schema Id conflicts. - // - //c.UseFullTypeNameInSchemaIds(); - - // Alternatively, you can provide your own custom strategy for inferring SchemaId's for - // describing "complex" types in your API. - // - //c.SchemaId(t => t.FullName.Contains('`') ? t.FullName.Substring(0, t.FullName.IndexOf('`')) : t.FullName); - - // Set this flag to omit schema property descriptions for any type properties decorated with the - // Obsolete attribute - //c.IgnoreObsoleteProperties(); - - // In accordance with the built in JsonSerializer, Swashbuckle will, by default, describe enums as integers. - // You can change the serializer behavior by configuring the StringToEnumConverter globally or for a given - // enum type. Swashbuckle will honor this change out-of-the-box. However, if you use a different - // approach to serialize enums as strings, you can also force Swashbuckle to describe them as strings. - // - //c.DescribeAllEnumsAsStrings(); - - // Similar to Schema filters, Swashbuckle also supports Operation and Document filters: - // - // Post-modify Operation descriptions once they've been generated by wiring up one or more - // Operation filters. - // - //c.OperationFilter<AddDefaultResponse>(); - // - // If you've defined an OAuth2 flow as described above, you could use a custom filter - // to inspect some attribute on each action and infer which (if any) OAuth2 scopes are required - // to execute the operation - // - //c.OperationFilter<AssignOAuth2SecurityRequirements>(); - - // Post-modify the entire Swagger document by wiring up one or more Document filters. - // This gives full control to modify the final SwaggerDocument. You should have a good understanding of - // the Swagger 2.0 spec. - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md - // before using this option. - // - //c.DocumentFilter<ApplyDocumentVendorExtensions>(); - - // In contrast to WebApi, Swagger 2.0 does not include the query string component when mapping a URL - // to an action. As a result, Swashbuckle will raise an exception if it encounters multiple actions - // with the same path (sans query string) and HTTP method. You can workaround this by providing a - // custom strategy to pick a winner or merge the descriptions for the purposes of the Swagger docs - // - //c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); - - // Wrap the default SwaggerGenerator with additional behavior (e.g. caching) or provide an - // alternative implementation for ISwaggerProvider with the CustomProvider option. - // - //c.CustomProvider((defaultProvider) => new CachingSwaggerProvider(defaultProvider)); - }) - .EnableSwaggerUi(c => - { - // Use the "DocumentTitle" option to change the Document title. - // Very helpful when you have multiple Swagger pages open, to tell them apart. - // - //c.DocumentTitle("My Swagger UI"); - - // Use the "InjectStylesheet" option to enrich the UI with one or more additional CSS stylesheets. - // The file must be included in your project as an "Embedded Resource", and then the resource's - // "Logical Name" is passed to the method as shown below. - // - //c.InjectStylesheet(containingAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css"); - - // Use the "InjectJavaScript" option to invoke one or more custom JavaScripts after the swagger-ui - // has loaded. The file must be included in your project as an "Embedded Resource", and then the resource's - // "Logical Name" is passed to the method as shown above. - // - //c.InjectJavaScript(thisAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript1.js"); - - // The swagger-ui renders boolean data types as a dropdown. By default, it provides "true" and "false" - // strings as the possible choices. You can use this option to change these to something else, - // for example 0 and 1. - // - //c.BooleanValues(new[] { "0", "1" }); - - // By default, swagger-ui will validate specs against swagger.io's online validator and display the result - // in a badge at the bottom of the page. Use these options to set a different validator URL or to disable the - // feature entirely. - //c.SetValidatorUrl("http://localhost/validator"); - //c.DisableValidator(); - - // Use this option to control how the Operation listing is displayed. - // It can be set to "None" (default), "List" (shows operations for each resource), - // or "Full" (fully expanded: shows operations and their details). - // - //c.DocExpansion(DocExpansion.List); - - // Specify which HTTP operations will have the 'Try it out!' option. An empty paramter list disables - // it for all operations. - // - //c.SupportedSubmitMethods("GET", "HEAD"); - - // Use the CustomAsset option to provide your own version of assets used in the swagger-ui. - // It's typically used to instruct Swashbuckle to return your version instead of the default - // when a request is made for "index.html". As with all custom content, the file must be included - // in your project as an "Embedded Resource", and then the resource's "Logical Name" is passed to - // the method as shown below. - // - //c.CustomAsset("index", containingAssembly, "YourWebApiProject.SwaggerExtensions.index.html"); - - // If your API has multiple versions and you've applied the MultipleApiVersions setting - // as described above, you can also enable a select box in the swagger-ui, that displays - // a discovery URL for each version. This provides a convenient way for users to browse documentation - // for different API versions. - // - //c.EnableDiscoveryUrlSelector(); - - // If your API supports the OAuth2 Implicit flow, and you've described it correctly, according to - // the Swagger 2.0 specification, you can enable UI support as shown below. - // - //c.EnableOAuth2Support( - // clientId: "test-client-id", - // clientSecret: null, - // realm: "test-realm", - // appName: "Swagger UI" - // //additionalQueryStringParams: new Dictionary<string, string>() { { "foo", "bar" } } - //); - - // If your API supports ApiKey, you can override the default values. - // "apiKeyIn" can either be "query" or "header" - // - //c.EnableApiKeySupport("apiKey", "header"); - }); - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/SwaggerControllerDescProvider.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/SwaggerControllerDescProvider.cs deleted file mode 100644 index 10ba610..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/App_Start/SwaggerControllerDescProvider.cs +++ /dev/null @@ -1,82 +0,0 @@ -锘縰sing Swashbuckle.Swagger; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Xml; - -namespace HH.WCS.Mobox3.FJJT { - /// <summary> - /// swagger 鏄剧ず鎺у埗鍣ㄧ殑鎻忚堪 - /// </summary> - public class SwaggerCacheProvider : ISwaggerProvider - { - private readonly ISwaggerProvider _swaggerProvider; - private static ConcurrentDictionary<string, SwaggerDocument> _cache = new ConcurrentDictionary<string, SwaggerDocument>(); - private readonly string _xmlPath; - - /// <summary> - /// - /// </summary> - /// <param name="swaggerProvider"></param> - /// <param name="xmlpath">xml鏂囨。璺緞</param> - public SwaggerCacheProvider(ISwaggerProvider swaggerProvider, string xmlpath) - { - _swaggerProvider = swaggerProvider; - _xmlPath = xmlpath; - } - - public SwaggerDocument GetSwagger(string rootUrl, string apiVersion) - { - var cacheKey = string.Format("{0}_{1}", rootUrl, apiVersion); - //鍙鍙栦竴娆�- if (!_cache.TryGetValue(cacheKey, out SwaggerDocument srcDoc)) - { - srcDoc = _swaggerProvider.GetSwagger(rootUrl, apiVersion); - - srcDoc.vendorExtensions = new Dictionary<string, object> - { - { "ControllerDesc", GetControllerDesc() } - }; - _cache.TryAdd(cacheKey, srcDoc); - } - return srcDoc; - } - - /// <summary> - /// 浠嶢PI鏂囨。涓鍙栨帶鍒跺櫒鎻忚堪 - /// </summary> - /// <returns>鎵�湁鎺у埗鍣ㄦ弿杩�/returns> - public ConcurrentDictionary<string, string> GetControllerDesc() - { - ConcurrentDictionary<string, string> controllerDescDict = new ConcurrentDictionary<string, string>(); - if (File.Exists(_xmlPath)) - { - XmlDocument xmldoc = new XmlDocument(); - xmldoc.Load(_xmlPath); - - string[] arrPath; - int cCount = "Controller".Length; - foreach (XmlNode node in xmldoc.SelectNodes("//member")) - { - string type = node.Attributes["name"].Value; - if (type.StartsWith("T:")) - { - arrPath = type.Split('.'); - string controllerName = arrPath[arrPath.Length - 1]; - if (controllerName.EndsWith("Controller")) //鎺у埗鍣�- { - //鑾峰彇鎺у埗鍣ㄦ敞閲�- XmlNode summaryNode = node.SelectSingleNode("summary"); - string key = controllerName.Remove(controllerName.Length - cCount, cCount); - if (summaryNode != null && !string.IsNullOrEmpty(summaryNode.InnerText) && !controllerDescDict.ContainsKey(key)) - { - controllerDescDict.TryAdd(key, summaryNode.InnerText.Trim()); - } - } - } - } - } - return controllerDescDict; - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/HH.WCS.Mobox3.FJJT.csproj b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/HH.WCS.Mobox3.FJJT.csproj deleted file mode 100644 index 3cc55d9..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/HH.WCS.Mobox3.FJJT.csproj +++ /dev/null @@ -1,284 +0,0 @@ -锘�?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{0809739B-B9DF-4757-86FE-045EB5D44798}</ProjectGuid> - <OutputType>Exe</OutputType> - <RootNamespace>HH.WCS.Mobox3.FJJT</RootNamespace> - <AssemblyName>HH.WCS.Mobox3.FJJT</AssemblyName> - <TargetFrameworkVersion>v4.8</TargetFrameworkVersion> - <FileAlignment>512</FileAlignment> - <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> - <Deterministic>true</Deterministic> - <TargetFrameworkProfile /> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <DocumentationFile>bin\Debug\HH.WCS.Mobox3.FJJT.xml</DocumentationFile> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <PlatformTarget>AnyCPU</PlatformTarget> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\Release\</OutputPath> - <DefineConstants>TRACE</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="EasyModbus, Version=5.6.0.0, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>packages\EasyModbusTCP.5.6.0\lib\net40\EasyModbus.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Owin, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Owin.4.2.2\lib\net45\Microsoft.Owin.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Owin.Host.HttpListener, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Owin.Host.HttpListener.4.2.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Owin.Hosting, Version=4.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Owin.Hosting.4.2.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath> - </Reference> - <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath> - </Reference> - <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> - <HintPath>..\ConsoleApp1\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> - </Reference> - <Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL"> - <HintPath>..\packages\NLog.5.1.1\lib\net45\NLog.dll</HintPath> - </Reference> - <Reference Include="Oracle.ManagedDataAccess, Version=4.122.23.1, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL"> - <HintPath>..\packages\Oracle.ManagedDataAccess.23.7.0\lib\net472\Oracle.ManagedDataAccess.dll</HintPath> - </Reference> - <Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL"> - <HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath> - </Reference> - <Reference Include="S7.Net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d5812d469e84c693, processorArchitecture=MSIL"> - <HintPath>..\packages\S7netplus.0.1.9\lib\net45\S7.Net.dll</HintPath> - </Reference> - <Reference Include="SqlSugar, Version=5.1.3.46, Culture=neutral, processorArchitecture=MSIL"> - <HintPath>..\packages\SqlSugar.5.1.3.47\lib\SqlSugar.dll</HintPath> - <Private>True</Private> - </Reference> - <Reference Include="Swashbuckle.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd1bb07a5ac7c7bc, processorArchitecture=MSIL"> - <HintPath>..\packages\Swashbuckle.Core.5.6.0\lib\net40\Swashbuckle.Core.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath> - </Reference> - <Reference Include="System.Configuration" /> - <Reference Include="System.Configuration.Install" /> - <Reference Include="System.Core" /> - <Reference Include="System.Diagnostics.DiagnosticSource, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Diagnostics.DiagnosticSource.6.0.1\lib\net461\System.Diagnostics.DiagnosticSource.dll</HintPath> - </Reference> - <Reference Include="System.Formats.Asn1, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Formats.Asn1.8.0.1\lib\net462\System.Formats.Asn1.dll</HintPath> - </Reference> - <Reference Include="System.IO.Compression" /> - <Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath> - </Reference> - <Reference Include="System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Net.Http.Formatting.dll</HintPath> - </Reference> - <Reference Include="System.Numerics" /> - <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath> - </Reference> - <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath> - </Reference> - <Reference Include="System.ServiceProcess" /> - <Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath> - </Reference> - <Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll</HintPath> - </Reference> - <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath> - </Reference> - <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> - <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath> - </Reference> - <Reference Include="System.Web" /> - <Reference Include="System.Web.Http, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Web.Http.dll</HintPath> - </Reference> - <Reference Include="System.Web.Http.Owin, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\packages\System.Web.Http.Owin.dll</HintPath> - </Reference> - <Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> - <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll</HintPath> - </Reference> - <Reference Include="System.Web.Services" /> - <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="System.Data" /> - <Reference Include="System.Net.Http" /> - <Reference Include="System.Xml" /> - <Reference Include="Topshelf, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL"> - <HintPath>..\packages\Topshelf.4.3.0\lib\net452\Topshelf.dll</HintPath> - </Reference> - <Reference Include="Topshelf.NLog, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b800c4cfcdeea87b, processorArchitecture=MSIL"> - <HintPath>..\packages\Topshelf.NLog.4.3.0\lib\net452\Topshelf.NLog.dll</HintPath> - </Reference> - <Reference Include="WebActivatorEx, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7b26dc2a43f6a0d4, processorArchitecture=MSIL"> - <HintPath>..\packages\WebActivatorEx.2.0\lib\net40\WebActivatorEx.dll</HintPath> - </Reference> - </ItemGroup> - <ItemGroup> - <Compile Include="api\MoboxController.cs" /> - <Compile Include="api\AgvController.cs" /> - <Compile Include="api\ApiModel.cs" /> - <Compile Include="api\DebugController.cs" /> - <Compile Include="App_Start\SwaggerControllerDescProvider.cs" /> - <Compile Include="core\WMSCore.cs" /> - <Compile Include="device\ModbusHelper.cs" /> - <Compile Include="dispatch\NDCApi.cs" /> - <Compile Include="device\PlcHelper.cs" /> - <Compile Include="device\S7Helper.cs" /> - <Compile Include="device\TcpClient.cs" /> - <Compile Include="device\TcpServer.cs" /> - <Compile Include="dispatch\GZRobot.cs" /> - <Compile Include="dispatch\HanAo.cs" /> - <Compile Include="dispatch\NDC.cs" /> - <Compile Include="core\Monitor.cs" /> - <Compile Include="dispatch\WCSDispatch.cs" /> - <Compile Include="models\AbnormalAreaConfig.cs" /> - <Compile Include="models\AlarmRecord.cs" /> - <Compile Include="models\BaseModel.cs" /> - <Compile Include="models\Area.cs" /> - <Compile Include="models\LjItem.cs" /> - <Compile Include="models\LjItemConfig.cs" /> - <Compile Include="models\LjLotCarrier.cs" /> - <Compile Include="models\LjLotOnhand.cs" /> - <Compile Include="models\LjXcOutTask.cs" /> - <Compile Include="models\LjLotOutTask.cs" /> - <Compile Include="models\LjLotStatus.cs" /> - <Compile Include="models\LjXcTask.cs" /> - <Compile Include="models\LjMesTask.cs" /> - <Compile Include="models\LogicConfig.cs" /> - <Compile Include="models\OI_WMS_OP_DEF.cs" /> - <Compile Include="models\OI_WMS_SCHEDULE_TYPE.cs" /> - <Compile Include="models\OI_WMS_TASK_TYPE.cs" /> - <Compile Include="models\other\DayuanIn.cs" /> - <Compile Include="models\other\DayuanOut.cs" /> - <Compile Include="models\ProcessInstance.cs" /> - <Compile Include="models\PutawayDetail.cs" /> - <Compile Include="models\PutawayOrder.cs" /> - <Compile Include="models\Safety_Inventory.cs" /> - <Compile Include="models\SideLocConfig.cs" /> - <Compile Include="models\TN_ASN_Detail.cs" /> - <Compile Include="models\TN_ASN_Order.cs" /> - <Compile Include="models\AZInventory.cs" /> - <Compile Include="models\TN_Business_Source.cs" /> - <Compile Include="models\CntrItemRel.cs" /> - <Compile Include="models\TN_Check_Detail.cs" /> - <Compile Include="models\TN_Check_List.cs" /> - <Compile Include="models\TN_Check_Order.cs" /> - <Compile Include="models\Container.cs" /> - <Compile Include="models\TN_Container_Good.cs" /> - <Compile Include="models\TN_Equipment.cs" /> - <Compile Include="models\TN_Factory.cs" /> - <Compile Include="models\FunctionArea.cs" /> - <Compile Include="models\TN_Inspect_Detail.cs" /> - <Compile Include="models\TN_Inspect_Order.cs" /> - <Compile Include="models\TN_Inspect_Record.cs" /> - <Compile Include="models\TN_LC_Log.cs" /> - <Compile Include="models\Location.cs" /> - <Compile Include="models\TN_Lock.cs" /> - <Compile Include="models\LocCntrRel.cs" /> - <Compile Include="models\TN_Loc_EQ_Link.cs" /> - <Compile Include="models\TN_Material.cs" /> - <Compile Include="models\TN_MQ_EQAction.cs" /> - <Compile Include="models\TN_MQ_EQAction_Msg.cs" /> - <Compile Include="models\TN_OnOff_Shelves.cs" /> - <Compile Include="models\TN_OOS_Detail.cs" /> - <Compile Include="models\TN_OOS_Order.cs" /> - <Compile Include="models\TransfeRelevance.cs" /> - <Compile Include="models\WHInventory.cs" /> - <Compile Include="models\TN_WMS_Const.cs" /> - <Compile Include="models\Zone.cs" /> - <Compile Include="models\ZoneCls.cs" /> - <Compile Include="models\ZoneLink.cs" /> - <Compile Include="models\ZoneLoc.cs" /> - <Compile Include="models\WMSTask.cs" /> - <Compile Include="models\TN_Outbound_Detail.cs" /> - <Compile Include="models\TN_Outbound_Order.cs" /> - <Compile Include="models\TN_Purchase_Detail.cs" /> - <Compile Include="models\TN_Purchase_Order.cs" /> - <Compile Include="models\TN_Receipt_Detail.cs" /> - <Compile Include="models\TN_Receipt_Order.cs" /> - <Compile Include="models\ShippingDetail.cs" /> - <Compile Include="models\ShippingOrder.cs" /> - <Compile Include="models\SortingCompose.cs" /> - <Compile Include="models\SortingDetail.cs" /> - <Compile Include="models\SortingOrder.cs" /> - <Compile Include="models\SortingResult.cs" /> - <Compile Include="models\TN_Supplier.cs" /> - <Compile Include="models\WCSTask.cs" /> - <Compile Include="models\TaskAction.cs" /> - <Compile Include="models\TN_Warehouse.cs" /> - <Compile Include="process\DeviceProcess.cs" /> - <Compile Include="core\WCSCore.cs" /> - <Compile Include="api\WmsController.cs" /> - <Compile Include="api\ApiHelper.cs" /> - <Compile Include="dispatch\HostToAGV.cs" /> - <Compile Include="process\TaskProcess.cs" /> - <Compile Include="util\ExcetionHelper.cs" /> - <Compile Include="util\LogHelper.cs" /> - <Compile Include="util\StrHelper.cs" /> - <Compile Include="util\STAttribute.cs" /> - <Compile Include="wms\ContainerHelper.cs" /> - <Compile Include="wms\LocationHelper.cs" /> - <Compile Include="wms\WMSHelper.cs" /> - <Compile Include="wms\SYSHelper.cs" /> - <Compile Include="wms\TEST.cs" /> - <Compile Include="Program.cs" /> - <Compile Include="Properties\AssemblyInfo.cs" /> - <Compile Include="util\Settings.cs" /> - <Compile Include="util\SqlHelper.cs" /> - <Compile Include="App_Start\Startup.cs" /> - <Compile Include="dispatch\NDCHelper.cs" /> - <Compile Include="util\HttpHelper.cs" /> - <Compile Include="wms\WCSHelper.cs" /> - </ItemGroup> - <ItemGroup> - <None Include="App.config" /> - <None Include="config\config.json"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - <None Include="Oracle.DataAccess.Common.Configuration.Section.xsd"> - <SubType>Designer</SubType> - </None> - <None Include="Oracle.ManagedDataAccess.Client.Configuration.Section.xsd"> - <SubType>Designer</SubType> - </None> - <None Include="packages.config" /> - </ItemGroup> - <ItemGroup> - <Content Include="config\configDesc.txt" /> - <Content Include="readme.txt" /> - <EmbeddedResource Include="swagger.js"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </EmbeddedResource> - </ItemGroup> - <ItemGroup /> - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -</Project> \ No newline at end of file diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/HH.WCS.Mobox3.FJJT.sln b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/HH.WCS.Mobox3.FJJT.sln deleted file mode 100644 index effa4fe..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/HH.WCS.Mobox3.FJJT.sln +++ /dev/null @@ -1,37 +0,0 @@ -锘�-Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.10.35013.160 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HH.WCS.Mobox3.FJJT", "HH.WCS.Mobox3.FJJT.csproj", "{E98DD345-9B0E-46C8-B0AB-20B99B5ACAEA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HH.WCS.Mobox3.HD", "..\HH.WCS.Mobox3.HD\HH.WCS.Mobox3.HD.csproj", "{44207EA0-2B75-4387-8A15-5C3D70A73C20}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HH.WCS.Mobox3.TSSG", "..\HH.WCS.Mobox3.TSSG\HH.WCS.Mobox3.TSSG.csproj", "{8ACEE926-6897-4380-BF9D-9A443FEE6A6F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E98DD345-9B0E-46C8-B0AB-20B99B5ACAEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E98DD345-9B0E-46C8-B0AB-20B99B5ACAEA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E98DD345-9B0E-46C8-B0AB-20B99B5ACAEA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E98DD345-9B0E-46C8-B0AB-20B99B5ACAEA}.Release|Any CPU.Build.0 = Release|Any CPU - {44207EA0-2B75-4387-8A15-5C3D70A73C20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {44207EA0-2B75-4387-8A15-5C3D70A73C20}.Debug|Any CPU.Build.0 = Debug|Any CPU - {44207EA0-2B75-4387-8A15-5C3D70A73C20}.Release|Any CPU.ActiveCfg = Release|Any CPU - {44207EA0-2B75-4387-8A15-5C3D70A73C20}.Release|Any CPU.Build.0 = Release|Any CPU - {8ACEE926-6897-4380-BF9D-9A443FEE6A6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8ACEE926-6897-4380-BF9D-9A443FEE6A6F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8ACEE926-6897-4380-BF9D-9A443FEE6A6F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8ACEE926-6897-4380-BF9D-9A443FEE6A6F}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {754AF9A6-A981-4EEE-BE54-695C6A9A245B} - EndGlobalSection -EndGlobal diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Oracle.DataAccess.Common.Configuration.Section.xsd b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Oracle.DataAccess.Common.Configuration.Section.xsd deleted file mode 100644 index eee2d5c..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Oracle.DataAccess.Common.Configuration.Section.xsd +++ /dev/null @@ -1,138 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> - <xs:simpleType name="parameterDirection"> - <xs:restriction base="xs:string"> - <xs:enumeration value="Output"/> - <xs:enumeration value="InputOutput"/> - <xs:enumeration value="ReturnValue"/> - <xs:enumeration value="Implicit"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType name="customBoolean"> - <xs:restriction base="xs:string"> - <xs:enumeration value="true"/> - <xs:enumeration value="false"/> - </xs:restriction> - </xs:simpleType> - <xs:simpleType name="ONSParameters"> - <xs:restriction base="xs:string"> - <xs:enumeration value="nodeList"/> - <!--<xs:enumeration value="walletFile"/> - <xs:enumeration value="walletPassword"/>--> - </xs:restriction> - </xs:simpleType> - <xs:simpleType name="ONSModeValues"> - <xs:restriction base="xs:string"> - <xs:enumeration value="local"/> - <xs:enumeration value="remote"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="datatype"> - <xs:restriction base="xs:string"> - <xs:enumeration value="System.Binary"/> - <xs:enumeration value="System.Boolean"/> - <xs:enumeration value="System.Byte"/> - <xs:enumeration value="System.Byte[]"/> - <xs:enumeration value="System.Char"/> - <xs:enumeration value="System.DateTime"/> - <xs:enumeration value="System.DateTimeOffset"/> - <xs:enumeration value="System.Decimal"/> - <xs:enumeration value="System.Double"/> - <xs:enumeration value="System.Guid"/> - <xs:enumeration value="System.Int16"/> - <xs:enumeration value="System.Int32"/> - <xs:enumeration value="System.Int64"/> - <xs:enumeration value="System.SByte"/> - <xs:enumeration value="System.Single"/> - <xs:enumeration value="System.String"/> - <xs:enumeration value="System.TimeSpan"/> - <xs:enumeration value="System.UInt16"/> - <xs:enumeration value="System.UInt32"/> - <xs:enumeration value="System.UInt64"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="providerType"> - <xs:restriction base="xs:string"> - <xs:enumeration value="BFile"/> - <xs:enumeration value="BinaryFloat"/> - <xs:enumeration value="BinaryDouble"/> - <xs:enumeration value="Blob"/> - <xs:enumeration value="Byte"/> - <xs:enumeration value="Char"/> - <xs:enumeration value="Clob"/> - <xs:enumeration value="Date"/> - <xs:enumeration value="Decimal"/> - <xs:enumeration value="Double"/> - <xs:enumeration value="Int16"/> - <xs:enumeration value="Int32"/> - <xs:enumeration value="Int64"/> - <xs:enumeration value="IntervalDS"/> - <xs:enumeration value="IntervalYM"/> - <xs:enumeration value="Long"/> - <xs:enumeration value="LongRaw"/> - <xs:enumeration value="NChar"/> - <xs:enumeration value="NClob"/> - <xs:enumeration value="NVarchar2"/> - <xs:enumeration value="Object"/> - <xs:enumeration value="Raw"/> - <xs:enumeration value="Single"/> - <xs:enumeration value="TimeStamp"/> - <xs:enumeration value="TimeStampLTZ"/> - <xs:enumeration value="TimeStampTZ"/> - <xs:enumeration value="Varchar2"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="nativeDataType"> - <xs:restriction base="xs:string"> - <xs:enumeration value="BFile"/> - <xs:enumeration value="Binary_Float"/> - <xs:enumeration value="Binary_Double"/> - <xs:enumeration value="Blob"/> - <xs:enumeration value="Char"/> - <xs:enumeration value="Clob"/> - <xs:enumeration value="Date"/> - <xs:enumeration value="Number"/> - <xs:enumeration value="Interval Day To Second"/> - <xs:enumeration value="Interval Year To Month"/> - <xs:enumeration value="Long"/> - <xs:enumeration value="Long Raw"/> - <xs:enumeration value="NChar"/> - <xs:enumeration value="NClob"/> - <xs:enumeration value="NVarchar2"/> - <xs:enumeration value="Raw"/> - <xs:enumeration value="Rowid"/> - <xs:enumeration value="Timestamp"/> - <xs:enumeration value="Timestamp With Local Time Zone"/> - <xs:enumeration value="Timestamp With Time Zone"/> - <xs:enumeration value="URowid"/> - <xs:enumeration value="UserDefinedType"/> - <xs:enumeration value="Varchar2"/> - <xs:enumeration value="XmlType"/> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="providerDBType"> - <xs:restriction base="xs:string"> - <xs:enumeration value="AnsiString"/> - <xs:enumeration value="AnsiStringFixedLength"/> - <xs:enumeration value="Binary"/> - <xs:enumeration value="Byte"/> - <xs:enumeration value="Date"/> - <xs:enumeration value="DateTime"/> - <xs:enumeration value="DateTimeOffset"/> - <xs:enumeration value="Decimal"/> - <xs:enumeration value="Double"/> - <xs:enumeration value="Int16"/> - <xs:enumeration value="Int32"/> - <xs:enumeration value="Int64"/> - <xs:enumeration value="Object"/> - <xs:enumeration value="Single"/> - <xs:enumeration value="String"/> - <xs:enumeration value="StringFixedLength"/> - <xs:enumeration value="Time"/> - </xs:restriction> - </xs:simpleType> -</xs:schema> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Oracle.ManagedDataAccess.Client.Configuration.Section.xsd b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Oracle.ManagedDataAccess.Client.Configuration.Section.xsd deleted file mode 100644 index 70935a1..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Oracle.ManagedDataAccess.Client.Configuration.Section.xsd +++ /dev/null @@ -1,221 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> - <xs:include schemaLocation="Oracle.DataAccess.Common.Configuration.Section.xsd"/> - <xs:element name="oracle.manageddataaccess.client" > - <xs:complexType> - <xs:choice minOccurs="0" maxOccurs="unbounded"> - <xs:element name="version" type="odpmversiontype" minOccurs="0" /> - </xs:choice> - </xs:complexType> - </xs:element> - <xs:complexType name="odpmversiontype"> - <xs:complexContent> - <xs:extension base="odpmparameters"> - <xs:attribute name="number" type="xs:string" use="required" /> - </xs:extension> - </xs:complexContent> - </xs:complexType> - - <xs:complexType name="odpmparameters"> - <xs:all> - <xs:element minOccurs="0" name="settings"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="setting"> - <xs:complexType> - <xs:attribute name="name" type="xs:string" use="required" /> - <xs:attribute name="value" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element minOccurs="0" name="udtMappings"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="udtMapping"> - <xs:complexType> - <xs:attribute name="typeName" type="xs:string" use="required" /> - <xs:attribute name="factoryName" type="xs:string" use="required" /> - <xs:attribute name="dataSource" type="xs:string" use="required" /> - <xs:attribute name="schemaName" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element minOccurs="0" name="LDAPsettings"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="LDAPsetting"> - <xs:complexType> - <xs:attribute name="name" type="xs:string" use="required" /> - <xs:attribute name="value" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element minOccurs="0" name="distributedTransaction"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="setting"> - <xs:complexType> - <xs:attribute name="name" type="xs:string" use="required" /> - <xs:attribute name="value" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element minOccurs="0" name="dataSources"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="dataSource"> - <xs:complexType> - <xs:attribute name="alias" type="xs:string" use="required" /> - <xs:attribute name="descriptor" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element minOccurs="0" name="connectionPools"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="connectionPool"> - <xs:complexType> - <xs:attribute name="connectionString" type="xs:string" use="required" /> - <xs:attribute name="poolName" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - - - <xs:element minOccurs="0" name="edmMappings"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="edmMapping"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="add"> - <xs:complexType> - <xs:attribute name="name" type="xs:string" use="required" /> - <xs:attribute name="precision" type="xs:int" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="dataType" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - <xs:element minOccurs="0" maxOccurs="unbounded" name="edmNumberMapping"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="add"> - <xs:complexType> - <xs:attribute name="NETType" type="xs:string" use="required" /> - <xs:attribute name="MinPrecision" type="xs:int" use="required" /> - <xs:attribute name="MaxPrecision" type="xs:int" use="required" /> - <xs:attribute name="DBType" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element minOccurs="0" name="implicitRefCursor"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="storedProcedure"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="1" name="refCursor"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="1" minOccurs="1" name="bindInfo"> - <xs:complexType> - <xs:attribute name="mode" type="parameterDirection" use="required" /> - </xs:complexType> - </xs:element> - <xs:element maxOccurs="unbounded" minOccurs="0" name="metadata"> - <xs:complexType> - <xs:attribute name="columnOrdinal" type="xs:int" use="required" /> - <xs:attribute name="columnName" type="xs:string" use="required" /> - <xs:attribute name="baseColumnName" type="xs:string" use="optional" /> - <xs:attribute name="baseSchemaName" type="xs:string" use="optional" /> - <xs:attribute name="baseTableName" type="xs:string" use="optional" /> - <xs:attribute name="providerType" type="providerType" use="optional" /> - <xs:attribute name="columnSize" type="xs:int" use="optional" /> - <xs:attribute name="numericPrecision" type="xs:int" use="optional" /> - <xs:attribute name="numericScale" type="xs:int" use="optional" /> - <xs:attribute name="isUnique" type="customBoolean" use="optional" /> - <xs:attribute name="isKey" type="customBoolean" use="optional" /> - <xs:attribute name="isRowID" type="customBoolean" use="optional" /> - <xs:attribute name="dataType" type="datatype" use="optional" /> - <xs:attribute name="allowDBNull" type="customBoolean" use="optional" /> - <xs:attribute name="isAliased" type="customBoolean" use="optional" /> - <xs:attribute name="isByteSemantic" type="customBoolean" use="optional" /> - <xs:attribute name="isExpression" type="customBoolean" use="optional" /> - <xs:attribute name="isHidden" type="customBoolean" use="optional" /> - <xs:attribute name="isReadOnly" type="customBoolean" use="optional" /> - <xs:attribute name="isLong" type="customBoolean" use="optional" /> - <xs:attribute name="udtTypeName" type="xs:string" use="optional" /> - <xs:attribute name="nativeDataType" type="nativeDataType" use="optional" /> - <xs:attribute name="providerDBType" type="providerDBType" use="optional" /> - <xs:attribute name="objectName" type="xs:string" use="optional" /> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="name" type="xs:string" use="optional" /> - <xs:attribute name="position" type="xs:int" use="optional" /> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="schema" type="xs:string" use="optional" /> - <xs:attribute name="name" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element minOccurs="0" name="onsConfig"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="settings"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="2" minOccurs="0" name="setting"> - <xs:complexType> - <xs:attribute name="name" type="xs:string" use="required" /> - <xs:attribute name="value" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element minOccurs="0" maxOccurs="unbounded" name="ons"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="3" minOccurs="1" name="add"> - <xs:complexType> - <xs:attribute name="name" type="ONSParameters" use="required" /> - <xs:attribute name="value" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="database" type="xs:string" use="required" /> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="configFile" type="xs:string" use="optional" /> - <xs:attribute name="mode" type="ONSModeValues" use="required" /> - </xs:complexType> - </xs:element> - </xs:all> - </xs:complexType> -</xs:schema> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Program.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Program.cs deleted file mode 100644 index 1de6c57..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Program.cs +++ /dev/null @@ -1,115 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.api; -using HH.WCS.Mobox3.FJJT.core; -using HH.WCS.Mobox3.FJJT.device; -using HH.WCS.Mobox3.FJJT.process; -using HH.WCS.Mobox3.FJJT.util; -using HH.WCS.Mobox3.FJJT.wms; -using Microsoft.Owin.Hosting; -using NLog; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Net; -using System.Net.Sockets; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Topshelf; -using Monitor = HH.WCS.Mobox3.FJJT.core.Monitor; - -namespace HH.WCS.Mobox3.FJJT -{ - internal class Program - { - static void Main(string[] args) { - - string currentProcessName = Process.GetCurrentProcess().ProcessName; - Process[] processes = Process.GetProcessesByName(currentProcessName); - if (processes.Length <= 1) - { - Settings.Init(); - //1.0 寮�惎api - Startup(); - //2.0 寮�惎tcp - StartTcp(); - //3.0 寮�惎绾跨▼ - var rc = HostFactory.Run(x => { - x.Service<WorkThread>(s => { - s.ConstructUsing(name => new WorkThread()); - s.WhenStarted(tc => tc.Start()); - s.WhenStopped(tc => tc.Stop()); - }); - x.RunAsLocalSystem(); - - x.SetDescription("hh123"); - x.SetDisplayName("hh123.wms"); - x.SetServiceName("hh123.wms"); - }); - - var exitCode = (int)Convert.ChangeType(rc, rc.GetTypeCode()); - Environment.ExitCode = exitCode; - } - } - - private static void Startup() { - Console.WriteLine("Startup ApiController"); - Task.Run(() => { - //var url = "http://192.168.1.87:8901";//{SettingHelper.port} - var url = $"http://+:{Settings.port}";// - Console.WriteLine(url); - using (WebApp.Start<Startup>(url)) { - Console.WriteLine("Running on {0}", url); - Console.ReadLine(); - } - }); - } - private static void StartTcp() { - //new TcpServer("192.168.1.87"); - var host = Dns.GetHostEntry(Dns.GetHostName()); - foreach (var ip in host.AddressList) { - if (ip.AddressFamily == AddressFamily.InterNetwork) { - Console.WriteLine($"ip= {ip.ToString()}"); - new TcpServer(ip.ToString()); - } - } - } - - public class WorkThread - { - public void Start() { - List<Task> tasks = new List<Task>(); - // 娣诲姞浠诲姟鎺ㄩ�绾跨▼ - tasks.Add(GetTask(WCSCore.Dispatch)); - // 鐩戝惉MES浠诲姟锛屼笅鍙戜换鍔�- tasks.Add(GetTask(Monitor.MonitorMesTask)); - // 鐩戝惉鏂滆鍑哄簱浠诲姟琛�- tasks.Add(GetTask(Monitor.MonitorXcOutTask)); - // 鑷姩琛ュ厖绌哄伐瑁呬换鍔�- tasks.Add(GetTask(Monitor.AutoReplenishEmptyPallet)); - // 鐩戝惉鎵樼洏鐗╂枡琛ㄣ�鐗╂枡琛紝骞舵洿鏂�- tasks.Add(GetTask(Monitor.MonitorPalletAndMateral)); - // 瀹氭椂鏇存柊搴撳瓨涓棿琛�- tasks.Add(GetTask(Monitor.UpdateInventoryRegularly,60000)); - // 瀹氭椂鎵规鐘舵�琛�- tasks.Add(GetTask(Monitor.AutoUpdateBatchStatus, 60000)); - Task.WaitAll(tasks.ToArray()); - } - public void Stop() { Console.WriteLine("work stopped"); } - private Task GetTask(Action action ,int time = 3000) { - var task = Task.Run(() => { - while (true) { - try { - action(); - } - catch (Exception ex) { - LogHelper.Error(ex.Message, ex); - } - Thread.Sleep(time); - } - }); - return task; - } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Properties/AssemblyInfo.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Properties/AssemblyInfo.cs deleted file mode 100644 index f834834..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -锘縰sing System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 鏈夊叧绋嬪簭闆嗙殑涓�埇淇℃伅鐢变互涓�-// 鎺у埗銆傛洿鏀硅繖浜涚壒鎬у�鍙慨鏀�-// 涓庣▼搴忛泦鍏宠仈鐨勪俊鎭� -[assembly: AssemblyTitle("HH.WCS.JunzhouNongfu")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("HH.WCS.JunzhouNongfu")] -[assembly: AssemblyCopyright("Copyright 漏 2023")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 灏�ComVisible 璁剧疆涓�false 浼氫娇姝ょ▼搴忛泦涓殑绫诲瀷 -//瀵�COM 缁勪欢涓嶅彲瑙併�濡傛灉闇�浠�COM 璁块棶姝ょ▼搴忛泦涓殑绫诲瀷 -//璇峰皢姝ょ被鍨嬬殑 ComVisible 鐗规�璁剧疆涓�true銆�-[assembly: ComVisible(false)] - -// 濡傛灉姝ら」鐩悜 COM 鍏紑锛屽垯涓嬪垪 GUID 鐢ㄤ簬绫诲瀷搴撶殑 ID -[assembly: Guid("8e589c0d-7d65-474d-8ced-e34e087126a1")] - -// 绋嬪簭闆嗙殑鐗堟湰淇℃伅鐢变笅鍒楀洓涓�缁勬垚: -// -// 涓荤増鏈�-// 娆$増鏈�-// 鐢熸垚鍙�-// 淇鍙�-// -//鍙互鎸囧畾鎵�湁杩欎簺鍊硷紝涔熷彲浠ヤ娇鐢ㄢ�鐢熸垚鍙封�鍜屸�淇鍙封�鐨勯粯璁ゅ� -//閫氳繃浣跨敤 "*"锛屽涓嬫墍绀� -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/AgvController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/AgvController.cs deleted file mode 100644 index e65bc46..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/AgvController.cs +++ /dev/null @@ -1,74 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.core; -using HH.WCS.Mobox3.FJJT.dispatch; -using HH.WCS.Mobox3.FJJT.process; -using HH.WCS.Mobox3.FJJT.wms; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Web.Http; -using static HH.WCS.Mobox3.FJJT.api.ApiHelper; -using static HH.WCS.Mobox3.FJJT.api.ApiModel; - -namespace HH.WCS.Mobox3.FJJT.api -{ - /// <summary> - /// 杞﹁締浠诲姟淇℃伅涓婃姤锛坔osttoagv涓婃姤銆佹澀濂ュ爢鍨涙満锛�- /// </summary> - //[RoutePrefix("agv")] - public class AgvController : System.Web.Http.ApiController - { - /// <summary> - /// ndc agv浠诲姟鐘舵�鍥炴姤 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - //[Route("AGVCallbackState")] - public ReturnResult AGVCallbackState(AgvTaskState model) { - LogHelper.Info("AGVCallbackState Request锛� + JsonConvert.SerializeObject(model), "HosttoagvTask"); - WCSCore.OperateAgvTaskStatus(model); - LogHelper.Info("AGVCallbackState response锛� , "HosttoagvTask"); - return new ReturnResult(); - } - - /// <summary> - /// ndc agv浜嬩欢鐘舵�鍥炴姤 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - //[Route("AGVCallbackEvent")] - public ReturnResult AGVCallbackEvent(AgvEventInfo model) { - LogHelper.Info("AGVCallbackEvent Request锛� + JsonConvert.SerializeObject(model), "HosttoagvTask"); - return new ReturnResult(); - } - /// <summary> - /// ndc agv杞﹁締鐘舵�鍥炴姤 - /// </summary> - /// <param name="models"></param> - /// <returns></returns> - [HttpPost] - //[Route("AGVDeviceReceive")] - public ReturnResult AGVDeviceReceive(List<AgvDeviceStatus> models) { - LogHelper.Info("AGVDeviceReceive Request锛� + JsonConvert.SerializeObject(models), "HosttoagvCar"); - return new ReturnResult(); - } - - /// <summary> - /// 鏉ゥ绔嬪簱鎵ц閫氱煡 - /// </summary> - /// <param name="models"></param> - /// <returns></returns> - [HttpPost] - //[Route("AGVDeviceReceive")] - public ReturnResult ExecuteState(HanAo.TaskStateInfoModel model) { - LogHelper.Info("ExecuteState Request锛� + JsonConvert.SerializeObject(model), "鏉ゥ"); - WCSCore.OperateHATaskStatus(model); - return new ReturnResult(); - } - - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/ApiHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/ApiHelper.cs deleted file mode 100644 index 1409687..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/ApiHelper.cs +++ /dev/null @@ -1,2268 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJF.models; -using HH.WCS.Mobox3.FJJT.device; -using HH.WCS.Mobox3.FJJT.dispatch; -using HH.WCS.Mobox3.FJJT.models; -using HH.WCS.Mobox3.FJJT.process; -using HH.WCS.Mobox3.FJJT.util; -using HH.WCS.Mobox3.FJJT.wms; -using Newtonsoft.Json; -using NLog; -using NLog.Fluent; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using System.Reflection.Emit; -using System.Threading; -using static HH.WCS.Mobox3.FJJT.api.ApiModel; -using static HH.WCS.Mobox3.FJJT.api.OtherModel; -using static HH.WCS.Mobox3.FJJT.api.WmsController; -using static HH.WCS.Mobox3.FJJT.util.ExcetionHelper; -using static HH.WCS.Mobox3.FJJT.util.Settings; -using static System.Net.Mime.MediaTypeNames; - -namespace HH.WCS.Mobox3.FJJT.api { - /// <summary> - /// api鎺ュ彛杈呭姪绫�- /// </summary> - public class ApiHelper { - static ApiHelper() { - - } - - /// <summary> - /// 绌哄伐瑁呭嚭搴�- /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult emptyPalletOutStock(OutStockModel model) { - ResponseResult result = new ResponseResult(); - - Location endLoc = LocationHelper.GetLoc(model.endLocCode); - if (endLoc == null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"WMS绯荤粺鏈煡璇㈠埌缁堢偣璐т綅锛歿model.endLocCode}"); - throw new BusinessException($"WMS绯荤粺鏈煡璇㈠埌缁堢偣璐т綅锛歿model.endLocCode},璇锋鏌ョ粓鐐硅揣浣嶇紪鐮佹槸鍚︽纭�); - } - else - { - if (endLoc.C_ENABLE == "Y") - { - if (endLoc.N_LOCK_STATE != 0) - { - var existTask = WCSHelper.GetTaskByStartOrEnd(model.endLocCode); - if (existTask != null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"缁堢偣璐т綅锛歿model.endLocCode} 宸叉湁浠诲姟"); - throw new BusinessException($"缁堢偣璐т綅锛歿model.endLocCode} 宸叉湁浠诲姟"); - } - else - { - LocationHelper.UnLockLoc(model.endLocCode); // 娌℃湁浠诲姟灏憋紝鑷姩瑙i攣缁堢偣璐т綅 - } - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"缁堢偣璐т綅锛歿model.endLocCode} 宸茬鐢紝璇疯仈绯荤鐞嗕汉鍛樿В闄ょ鐢�); - throw new BusinessException($"缁堢偣璐т綅锛歿model.endLocCode} 宸茬鐢紝璇疯仈绯荤鐞嗕汉鍛樿В闄ょ鐢�); - } - } - - var transfeRelevance = WMSHelper.GetTransfeRelevance(model.endLocCode); // 鎺ラ┏璐т綅鍏宠仈灞炴� - if (transfeRelevance == null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"缁堢偣璐т綅锛歿model.endLocCode},缂哄皯閰嶇疆灞炴�锛岃鑱旂郴绠$悊浜哄憳杩涜閰嶇疆灞炴�"); - throw new BusinessException($"缁堢偣璐т綅锛歿model.endLocCode},缂哄皯閰嶇疆灞炴�锛岃鑱旂郴绠$悊浜哄憳杩涜閰嶇疆灞炴�"); - } - - Location startLoc = WMSHelper.getOutStockStartLoc(transfeRelevance.S_RELE_AREA, null); - if (startLoc == null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"鏈煡璇㈠埌绌哄伐瑁咃紝绔嬪簱鍙兘缂哄皯绌哄伐瑁�); - throw new BusinessException($"鏈煡璇㈠埌绌哄伐瑁咃紝绔嬪簱鍙兘缂哄皯绌哄伐瑁�); - } - - var locCntrRels = LocationHelper.GetLocCntr(startLoc.S_CODE); - if (locCntrRels.Count > 0) - { - string cntrCode = locCntrRels[0].S_CNTR_CODE; - var wmsTask = new WMSTask() - { - S_CNTR_CODE = cntrCode, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_TYPE = "绌哄伐瑁呭嚭搴撲换鍔�, - S_OP_DEF_NAME = "绌哄伐瑁呭嚭搴撶紦瀛樹綅", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - }; - - if (WMSHelper.CreateWmsTask(wmsTask)) - { - // 鍒涘缓涓�鍏ュ簱浠诲姟 - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE, - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = wmsTask.N_PRIORITY, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - } - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"鏌ヨ鐨勭┖宸ヨ鏈夎锛岄敊璇師鍥狅細鏈煡璇㈠埌璐т綅瀹瑰櫒鐨勭粦瀹氬叧绯�); - throw new BusinessException($"鏌ヨ绌哄伐瑁呴敊璇紝鏈煡璇㈠埌璐т綅瀹瑰櫒鐨勭粦瀹氬叧绯伙紝璇疯仈绯诲紑鍙戜汉鍛樻帓鏌�); - } - return result; - } - - /// <summary> - /// WCS璇荤爜璇锋眰娴佺▼ - /// 1.鍒ゆ柇RFID 鏄惁璇诲彇鎴愬姛锛堟墭鐩樺彿鏄惁涓虹┖锛�- /// 2.鏌ヨ鍏充簬RFID鐨勯鍒涘缓浠诲姟 - /// 3.濡傛灉璇诲彇鎴愬姛锛屽垯婵�椿棰勫垱寤轰换鍔�- /// 4.濡傛灉璇诲彇涓嶆垚鍔燂紝鏌ョ湅寮傚父鍖烘槸鍚︽湁绌鸿揣浣嶏紝鏈夊垯鍒涘缓鎼繍寮傚父鍖轰换鍔★紝鏃犲垯锛岃褰曞紓甯告縺娲婚鍒涘缓浠诲姟 - /// </summary> - /// <param name="request"></param> - /// <returns></returns> - public static ResponseResult readCodeProcess(ReadCodeRequest request) { - ResponseResult responseResult = new ResponseResult(); - - Location loc = LocationHelper.GetLoc(request.loc); - if (loc == null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"璇荤爜浣�{request.loc},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - throw new BusinessException($"璇荤爜浣�{request.loc},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - } - - var locCntrRels = LocationHelper.GetLocCntr(request.loc); - if (locCntrRels.Count > 0) - { - string taskCntrCode = locCntrRels[0].S_CNTR_CODE; - // 2.鏌ヨ鍏充簬RFID鐨勯鍒涘缓浠诲姟 - var cst = WCSHelper.GetPreCreatedTaskByCntr(taskCntrCode); - if (cst != null) - { - bool errFlag = true; - // 1.鍒ゆ柇RFID 鏄惁璇诲彇鎴愬姛锛堟墭鐩樺彿鏄惁涓虹┖锛�- if (request.cntrNo != null) - { - if (request.cntrNo == taskCntrCode) - { - Container container = ContainerHelper.GetCntr(request.cntrNo); - if (container.N_E_STATE == 0) - { - errFlag = false; - WCSHelper.ActivatePreCreateTask(cst.S_OP_CODE); - } - } - else - { - ContainerHelper.UpdateCntrState(taskCntrCode, 1,"WCS鍙嶉RFID涓庝换鍔FID涓嶄竴鑷�); - } - } - else - { - ContainerHelper.UpdateCntrState(taskCntrCode, 1,"WCS鍙嶉RFID涓簄ull"); - } - - // 鏂规1 4.婵�椿棰勫垱寤轰换鍔�- if (errFlag) - { - WCSHelper.ActivatePreCreateTask(cst.S_OP_CODE,1); - } - - // 鏂规2 4.濡傛灉璇诲彇涓嶆垚鍔燂紝鏌ョ湅寮傚父鍖烘槸鍚︽湁绌鸿揣浣� - /* var agvEndLoc = WMSHelper.GetTransfeRelevanceLoc(loc.S_AREA_CODE, "4"); - if (agvEndLoc != null) - { - // 4.1 鏈�鍒欏垱寤烘惉杩愬紓甯稿尯浠诲姟 - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = cst.S_OP_NAME, - S_OP_CODE = cst.S_OP_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = cst.S_CNTR_CODE, - S_TYPE = "寮傚父宸ヨ绉诲簱寮傚父鍖�, - S_START_LOC = loc.S_CODE, - S_START_AREA = loc.S_AREA_CODE, - S_END_LOC = agvEndLoc.S_CODE, - S_END_AREA = agvEndLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = 99, - T_START_TIME = DateTime.Now, - }; - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 1); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - WCSHelper.CancelPreCreateTask(cst.S_OP_CODE); - } - } - else - { - // 4.2 鏃�鍒欒褰曞紓甯告縺娲婚鍒涘缓浠诲姟 - WCSHelper.ActivatePreCreateTask(cst.S_OP_CODE); - }*/ - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"璇荤爜浣�{request.loc}瑙﹀彂璇荤爜璇锋眰锛岃鐮佷綅涓婂鍣�{taskCntrCode}娌℃湁棰勫垱寤轰换鍔�); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"璇荤爜浣�{request.loc},娌℃湁鏌ヨ鍒板鍣�); - throw new BusinessException($"璇荤爜浣�{request.loc},娌℃湁鏌ヨ鍒板鍣�); - } - return responseResult; - } - - - /// <summary> - /// 婊℃枡涓嬬嚎娴佺▼ - /// 1.鍒ゆ柇RFID鏄惁璇诲彇鎴愬姛锛岃鍙栦笉鎴愬姛锛岃褰曞紓甯革紙璇诲彇澶辫触鍚庯紝涓存椂鐢熸垚涓�釜鎵樼洏鐮侊級 - /// 2.鏍规嵁RFID鏌ヨ涓棿琛紝涓嶅瓨鍦紝璁板綍寮傚父 - /// 3.鍒ゆ柇婊℃枡鎺ラ┏浣嶅搴旂殑绌哄伐瑁呯紦瀛樹綅鐘舵�锛堟煡璇㈢嚎浣撳厜鐢碉級 - /// - /// 鐩磋繛 - /// 4.闇�琛ワ紝鍒欑敓鎴愮┖宸ヨ鍑哄簱浠诲姟锛堣儙闈€�鑳庝晶鐩磋繛鎻愰珮浼樺厛绾э級 - /// 5.涓嬪彂婊℃枡鎼繍浠诲姟锛堝笜甯冪洿杩炴彁楂樹紭鍏堢骇锛�- /// - /// 闈炵洿杩�- /// 4.闇�琛ョ┖宸ヨ锛屽垯绌哄伐瑁呭嚭搴撲换鍔★紙瀹屾垚鍚庯紝鐢熸垚婊℃枡鎼繍浠诲姟锛屽苟鎻愰珮浼樺厛绾�9锛�- /// 5.涓嶉渶瑕佽ˉ绌哄伐瑁咃紝鍒欑敓鎴愭弧鏂欐惉杩愪换鍔�- /// - /// 6.璇讳换鍔′腑闂磋〃 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult offLineProcess(OffLineRequest model) { - ResponseResult responseResult = new ResponseResult(); - var existWmsTask = WMSHelper.GetWmsTaskByStart(model.loc); - if (existWmsTask == null) - { - // 鍒ゆ柇婊℃枡鎺ラ┏浣嶅搴旂殑绌哄伐瑁呯紦瀛樹綅鐘舵�锛堟煡璇㈢嚎浣撳厜鐢碉級 - var logicConfig = WMSHelper.getLogicConfigByJtCode(model.jtNo); - if (logicConfig != null) - { - if (logicConfig.S_TASK_TYPE == "1" || logicConfig.S_TASK_TYPE == "2") - { - // 婊℃枡涓嬬嚎锛堢洿杩烇級 - LjMesTask mesTask = null; - if (model.cntrNo != null && model.cntrNo != "") - { - var container = ContainerHelper.GetCntr(model.cntrNo); - if (container == null) - { - ContainerHelper.AddCntr(model.cntrNo); - ContainerHelper.UpdateCntrState(model.cntrNo, 1, $"婊℃枡涓嬬嚎锛堢洿杩烇級,WCS鍙嶉鐨凴FID:{model.cntrNo}鍦╓MS绯荤粺涓笉瀛樺湪"); - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"婊℃枡涓嬬嚎锛堢洿杩烇級,WCS鍙嶉鐨凴FID:{model.cntrNo}鍦╓MS绯荤粺涓笉瀛樺湪"); - } - else - { - ContainerHelper.UpdateCntrState(model.cntrNo, 0, ""); - mesTask = WMSHelper.getLjMesTaskByCntr(model.cntrNo); - if (mesTask == null) - { - ContainerHelper.UpdateCntrState(model.cntrNo, 1, $"鏈煡璇㈠埌MES浠诲姟"); - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"婊℃枡涓嬬嚎锛堢洿杩烇級,瀹瑰櫒:{model.cntrNo}鏈煡璇㈠埌MES浠诲姟"); - } - } - } - else - { - model.cntrNo = ContainerHelper.GenerateCntrNo(); - ContainerHelper.AddCntr(model.cntrNo); - ContainerHelper.UpdateCntrState(model.cntrNo, 1, $"WCS鍙嶉鐨凴FID:{model.cntrNo} 涓虹┖"); - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"WCS鍙嶉鐨凴FID:{model.cntrNo} 涓虹┖"); - } - triggerItemOffLineFlow(model.loc, model.cntrNo, logicConfig, mesTask); - } - else - { - // 婊℃枡涓嬬嚎锛堥潪鐩磋繛锛�- var mesTask = WMSHelper.getLjMesTaskByLoc(model.loc); - triggerItemOffLineFlow4(model.loc, logicConfig,mesTask); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鏈哄彴鍙穥model.jtNo},娌℃湁鍙敤鐨勯�杈戠嚎璺�璇疯仈绯荤鐞嗕汉鍛�); - throw new BusinessException($"鏈哄彴鍙穥model.jtNo},娌℃湁鍙敤鐨勯�杈戠嚎璺紝璇疯仈绯荤鐞嗕汉鍛�); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"涓嬬嚎璐т綅锛歿model.loc}宸叉湁浠诲姟锛岃鍕块噸澶嶄笅鍙戜换鍔�); - throw new BusinessException($"涓嬬嚎璐т綅锛歿model.loc}宸叉湁浠诲姟锛岃鍕块噸澶嶄笅鍙戜换鍔�); - } - return responseResult; - } - - /// <summary> - /// 婊℃枡涓嬬嚎锛堥潪鐩磋繛锛�- /// 1.鍒涘缓婊℃枡涓嬬嚎浣滀笟 - /// 2.鍒ゆ柇鏄惁闇�琛ョ┖宸ヨ锛岄渶瑕佸垯鍒涘缓绌哄伐瑁呰ˉ缂撳瓨浣嶄换鍔�- /// 3.鍒ゆ柇瀹瑰櫒鏄惁鏄紓甯稿伐瑁咃紝鏄紝濡傚紓甯稿尯鏈夌┖璐т綅鍒欏垱寤哄紓甯稿伐瑁呭叆绾胯竟寮傚父鍖轰换鍔★紱鍚︼紝鍒欏垱寤烘弧鏂欏伐瑁呭叆搴撲换鍔★紙濡傞渶瑕佽ˉ绌哄伐瑁咃紝鍒欏皢浠诲姟鐘舵�鏀逛负棰勫垱寤猴紝绛夊緟琛ョ┖宸ヨ浠诲姟瀹屾垚鍚庤Е鍙戯級 - /// 4.浣滀笟鍒涘缓瀹屾垚鍚庯紝璇诲彇涓棿琛紝鏇存柊涓棿琛ㄧ姸鎬�- /// </summary> - /// <param name="offLineLoc"></param> - /// <param name="logicConfig"></param> - /// <returns></returns> - public static bool triggerItemOffLineFlow4(string offLineLoc, LogicConfig logicConfig ,LjMesTask mesTask) - { - bool result = true; - try - { - if (mesTask != null) - { - // 2.鍒ゆ柇鏄惁闇�琛ョ┖宸ヨ锛岄渶瑕侊紝鍒欏垱寤虹┖宸ヨ鍑哄簱浠诲姟 - // TODO 鏌ヨ缂撳瓨浣嶇嚎浣撳厜鐢�+++++ - bool photoStatus = false; - var hcLoc = LocationHelper.GetLoc(logicConfig.S_LKBKHCLOC); - if (hcLoc != null) - { - var transfeRelevance = WMSHelper.GetTransfeRelevance(hcLoc.S_CODE); // 缂撳瓨浣嶅叧鑱斿睘鎬�- if (transfeRelevance != null) - { - photoStatus = true; - // 鏂规1锛屽鏋滈潪鐩磋繛鐨勭紦瀛樹綅鏈夊厜鐢典俊鍙凤紝鍒欐煡璇㈣澶囩姸鎬佸垽鏂槸鍚﹂渶瑕佽ˉ绌哄伐瑁�- /*var deviceStatusDatas = WCSDispatch.getDeviceStatus(new List<string>() { transfeRelevance.S_DEVICE_NO }); - if (deviceStatusDatas != null && deviceStatusDatas.Count > 0) - { - var deviceStatus = deviceStatusDatas[0]; - if (deviceStatus.workStatus == 1 && deviceStatus.manualStatus == 0) - { - photoStatus = deviceStatus.photoStatus == 1; - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"璁惧鍙�{transfeRelevance.S_DEVICE_NO},璁惧褰撳墠澶勪簬涓嶅彲鐢ㄧ姸鎬侊紝璇疯仈绯荤鐞嗕汉鍛樿皟鏁磋澶囩姸鎬�); - throw new BusinessException($"璁惧鍙�{transfeRelevance.S_DEVICE_NO},璁惧褰撳墠澶勪簬涓嶅彲鐢ㄧ姸鎬侊紝璇疯仈绯荤鐞嗕汉鍛樿皟鏁磋澶囩姸鎬�); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"璁惧鍙�{transfeRelevance.S_DEVICE_NO},鏌ヨ璁惧鐘舵�澶辫触锛岃鑱旂郴宸ヤ綔浜哄憳鏌ョ湅璁惧鏄惁姝e父"); - throw new BusinessException($"璁惧鍙�{transfeRelevance.S_DEVICE_NO},鏌ヨ璁惧鐘舵�澶辫触锛岃鑱旂郴宸ヤ綔浜哄憳鏌ョ湅璁惧鏄惁姝e父"); - }*/ - - // 鏂规2锛屽鏋滈潪鐩磋繛鐨勭紦瀛樹綅娌℃湁鍏夌數淇″彿锛屽垯鏍规嵁璐т綅鐘舵�杩涜鍒ゆ柇锛岄渶瑕佹敞鎰忥細浜哄伐鍙栫┖宸ヨ闇�瑙i攣 - - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"缂撳瓨浣�{logicConfig.S_LKBKHCLOC},娌℃湁閰嶇疆灞炴�淇℃伅锛岃鑱旂郴绠$悊浜哄憳閰嶇疆"); - throw new BusinessException($"缂撳瓨浣�{logicConfig.S_LKBKHCLOC},娌℃湁閰嶇疆灞炴�淇℃伅锛岃鑱旂郴绠$悊浜哄憳閰嶇疆"); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"缂撳瓨浣�{logicConfig.S_LKBKHCLOC},娌℃湁WMS绯荤粺涓綍鍏�); - throw new BusinessException($"缂撳瓨浣�{logicConfig.S_LKBKHCLOC},娌℃湁WMS绯荤粺涓綍鍏�); - } - - // 绌哄伐瑁呭嚭搴撳垽鏂潯浠�- Location kgzStartLoc = null; - Location kgzEndLoc = null; - string kgzCntrCode = null; - if (photoStatus) - { - kgzStartLoc = LocationHelper.GetLoc(logicConfig.S_LKKTJBLOC); - kgzEndLoc = LocationHelper.GetLoc(logicConfig.S_LKBKHCLOC); - if (kgzStartLoc == null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"搴撳尯:{logicConfig.S_AREA_CODE},娌℃湁鍙敤鐨勭┖宸ヨ"); - throw new BusinessException($"搴撳尯:{logicConfig.S_AREA_CODE},娌℃湁鍙敤鐨勭┖宸ヨ"); - } - if (kgzEndLoc == null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"绌哄伐瑁呯紦瀛樹綅:{logicConfig.S_LKBKHCLOC},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - throw new BusinessException($"绌哄伐瑁呯紦瀛樹綅:{logicConfig.S_LKBKHCLOC},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - } - - var locCntrRels = LocationHelper.GetLocCntr(kgzStartLoc.S_CODE); - if (locCntrRels.Count > 0) - { - kgzCntrCode = locCntrRels[0].S_CNTR_CODE; - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"绌哄伐瑁呰ˉ鍏呮帴椹充綅:{logicConfig.S_LKKTJBLOC},娌℃湁绌哄伐瑁�); - throw new BusinessException($"绌哄伐瑁呰ˉ鍏呮帴椹充綅:{logicConfig.S_LKKTJBLOC},娌℃湁绌哄伐瑁�); - } - } - - string cntrCode = mesTask.PALLET_ID; - Location startLoc = LocationHelper.GetLoc(offLineLoc); - if (startLoc != null) - { - // 1.鍒涘缓婊℃枡涓嬬嚎浣滀笟 - var wmsTask = new WMSTask() - { - S_CNTR_CODE = cntrCode, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = "铏氭嫙璐т綅", - S_END_AREA = "铏氭嫙搴撳尯", - S_TYPE = "婊℃枡/寮傚父宸ヨ鍏ュ簱浠诲姟(闈炵洿杩�", - S_OP_DEF_NAME = "婊℃枡/寮傚父宸ヨ鍏ュ簱浠诲姟(闈炵洿杩�", - S_OP_DEF_CODE = mesTask.ID.ToString(), - T_START_TIME = DateTime.Now, - }; - - if (WMSHelper.CreateWmsTask(wmsTask)) - { - int priority = 10; - // 2.鍒ゆ柇鏄惁闇�琛ョ┖宸ヨ锛岄渶瑕佸垯鍒涘缓绌哄伐瑁呰ˉ缂撳瓨浣嶄换鍔�- if (photoStatus) - { - WCSTask kgzWcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = kgzCntrCode, - S_TYPE = "绌哄伐瑁呭嚭搴撲换鍔�, - S_START_LOC = kgzStartLoc.S_CODE, - S_START_AREA = kgzStartLoc.S_AREA_CODE, - S_END_LOC = kgzEndLoc.S_CODE, - S_END_AREA = kgzEndLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = priority, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(kgzWcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(kgzWcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(kgzWcsTask.S_END_LOC, 1); - } - } - - // 3.鍒ゆ柇瀹瑰櫒鏄惁鏄紓甯稿伐瑁咃紝鏄紝鍒欏垱寤哄紓甯稿伐瑁呭叆绾胯竟寮傚父鍖轰换鍔★紱 - // 鍚︼紝鍒欏垱寤烘弧鏂欏伐瑁呭叆搴撲换鍔★紙濡傞渶瑕佽ˉ绌哄伐瑁咃紝鍒欏皢浠诲姟鐘舵�鏀逛负棰勫垱寤猴紝绛夊緟琛ョ┖宸ヨ浠诲姟瀹屾垚鍚庤Е鍙戯級 - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = wmsTask.S_END_LOC, - S_END_AREA = wmsTask.S_END_AREA, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = 99, - T_START_TIME = DateTime.Now, - }; - Container container = ContainerHelper.GetCntr(cntrCode); - if (container.N_E_STATE == 0) - { - wcsTask.S_TYPE = "婊℃枡宸ヨ鍏ュ簱浠诲姟(闈炵洿杩�"; - } - else - { - Location ycgzLoc = null; - if (ycgzLoc != null) - { - wcsTask.S_TYPE = "寮傚父宸ヨ鍏ュ簱绾胯竟寮傚父鍖�; - wcsTask.S_END_LOC = ycgzLoc.S_CODE; - wcsTask.S_END_AREA = ycgzLoc.S_AREA_CODE; - } - else - { - wcsTask.S_TYPE = "寮傚父宸ヨ鍏ュ簱"; - } - } - if (photoStatus) - { - wcsTask.N_B_STATE = -1; - wcsTask.S_B_STATE = "棰勫垱寤�; - } - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - } - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - - // 4.浣滀笟鍒涘缓瀹屾垚鍚庯紝璇诲彇涓棿琛紝鏇存柊涓棿琛ㄧ姸鎬�- WMSHelper.readLjMesOffItemTask(wmsTask.S_CODE, mesTask.ID); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"涓嬬嚎浣�{offLineLoc},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - throw new BusinessException($"涓嬬嚎浣�{offLineLoc},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"闈炵洿杩炰笅绾胯揣浣嶏細{offLineLoc}瑙﹀彂涓嬬嚎璇锋眰锛屾湭鏌ヨ鍒癕ES浠诲姟"); - throw new BusinessException($"闈炵洿杩炰笅绾胯揣浣嶏細{offLineLoc}瑙﹀彂涓嬬嚎璇锋眰锛屾湭鏌ヨ鍒癕ES浠诲姟"); - } - } - catch (BusinessException be) - { - throw be; - } - catch (Exception ex) - { - WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, ex.Message); - LogHelper.Error("WMS鍐呴儴閿欒锛氳Е鍙戞弧鏂欎笅绾匡紙闈炵洿杩烇級浣滀笟閿欒 ; ERROR_MGS锛� + ex.Message, ex, "WMS"); - result = false; - } - return result; - } - - /// <summary> - /// 婊℃枡涓嬬嚎锛堢洿杩烇級 - /// 1.鍒涘缓婊℃枡涓嬬嚎浣滀笟 - /// 2.鍒ゆ柇鏄惁闇�琛ョ┖宸ヨ锛岄渶瑕侊紝鍒欏垱寤虹┖宸ヨ鍑哄簱浠诲姟 - /// 3.鍒涘缓婊℃枡鍏ュ簱浠诲姟 - /// 4.鍒ゆ柇鐩磋繛妯″紡锛屽鏄儙渚х洿杩炴ā寮忥紝鍒欐彁楂樼┖宸ヨ鍑哄簱浠诲姟浼樺厛绾э紱濡傛槸甯樺竷鐩磋繛妯″紡鍒欙紝鎻愰珮婊℃枡鍏ュ簱浼樺厛绾�- /// 5.浣滀笟鍒涘缓瀹屾垚鍚庯紝璇诲彇涓棿琛紝鏇存柊涓棿琛ㄧ姸鎬�- /// </summary> - /// <param name="offLineLoc">涓嬬嚎璐т綅</param> - /// <param name="cntrCode">涓嬬嚎瀹瑰櫒缂栫爜</param> - /// <param name="logicConfig">閫昏緫閰嶇疆</param> - /// <returns></returns> - public static bool triggerItemOffLineFlow(string offLineLoc, string cntrCode, LogicConfig logicConfig ,LjMesTask mesTask) { - bool result = true; - try - { - // 2.鍒ゆ柇鏄惁闇�琛ョ┖宸ヨ锛岄渶瑕侊紝鍒欏垱寤虹┖宸ヨ鍑哄簱浠诲姟 - bool photoStatus = false; - var hcLoc = LocationHelper.GetLoc(logicConfig.S_LKBKHCLOC); - if (hcLoc != null) - { - var transfeRelevance = WMSHelper.GetTransfeRelevance(hcLoc.S_CODE); // 缂撳瓨浣嶅叧鑱斿睘鎬�- if (transfeRelevance != null) - { - // 娴嬭瘯浠g爜 - photoStatus = true; - - // 涓氬姟浠g爜锛屽嬁鍒�- /*var deviceStatusDatas = WCSDispatch.getDeviceStatus(new List<string>() { transfeRelevance.S_DEVICE_NO }); - if (deviceStatusDatas != null && deviceStatusDatas.Count > 0) - { - var deviceStatus = deviceStatusDatas[0]; - if (deviceStatus.workStatus == 1 && deviceStatus.manualStatus == 0) - { - photoStatus = deviceStatus.photoStatus == 1; - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"璁惧鍙�{transfeRelevance.S_DEVICE_NO},璁惧褰撳墠澶勪簬涓嶅彲鐢ㄧ姸鎬侊紝璇疯仈绯荤鐞嗕汉鍛樿皟鏁磋澶囩姸鎬�); - throw new BusinessException($"璁惧鍙�{transfeRelevance.S_DEVICE_NO},璁惧褰撳墠澶勪簬涓嶅彲鐢ㄧ姸鎬侊紝璇疯仈绯荤鐞嗕汉鍛樿皟鏁磋澶囩姸鎬�); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"璁惧鍙�{transfeRelevance.S_DEVICE_NO},鏌ヨ璁惧鐘舵�澶辫触锛岃鑱旂郴宸ヤ綔浜哄憳鏌ョ湅璁惧鏄惁姝e父"); - throw new BusinessException($"璁惧鍙�{transfeRelevance.S_DEVICE_NO},鏌ヨ璁惧鐘舵�澶辫触锛岃鑱旂郴宸ヤ綔浜哄憳鏌ョ湅璁惧鏄惁姝e父"); - }*/ - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"缂撳瓨浣�{logicConfig.S_LKBKHCLOC},娌℃湁閰嶇疆灞炴�淇℃伅锛岃鑱旂郴绠$悊浜哄憳閰嶇疆"); - throw new BusinessException($"缂撳瓨浣�{logicConfig.S_LKBKHCLOC},娌℃湁閰嶇疆灞炴�淇℃伅锛岃鑱旂郴绠$悊浜哄憳閰嶇疆"); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"缂撳瓨浣�{logicConfig.S_LKBKHCLOC},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - throw new BusinessException($"缂撳瓨浣�{logicConfig.S_LKBKHCLOC},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - } - - Location startLoc = LocationHelper.GetLoc(offLineLoc); - if (startLoc == null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"涓嬬嚎浣�{offLineLoc},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - throw new BusinessException($"涓嬬嚎浣�{offLineLoc},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - } - - Location endLoc = WMSHelper.getInStockEndLoc(logicConfig.S_AREA_CODE, 1); - if (endLoc == null) - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"搴撳唴娌℃湁绌轰綑璐т綅"); - throw new BusinessException($"搴撳唴娌℃湁绌轰綑璐т綅"); - } - - Container container = ContainerHelper.GetCntr(cntrCode); - if (container != null) - { - // 1.鍒涘缓婊℃枡涓嬬嚎浣滀笟 - var wmsTask = new WMSTask() - { - S_CNTR_CODE = cntrCode, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_TYPE = "婊℃枡/寮傚父宸ヨ鍏ュ簱浠诲姟(鐩磋繛)", - S_OP_DEF_NAME = "婊℃枡/寮傚父宸ヨ鍏ュ簱浠诲姟(鐩磋繛)", - S_OP_DEF_CODE = mesTask != null ? mesTask.ID.ToString() : null, - T_START_TIME = DateTime.Now, - }; - if (WMSHelper.CreateWmsTask(wmsTask)) - { - int priority = 10; - - // 鏄惁鍒涘缓绌哄伐瑁呭嚭鍙d换鍔�- if (photoStatus) - { - Location kgzStartLoc = WMSHelper.getOutStockStartLoc(logicConfig.S_AREA_CODE, null); - Location kgzEndLoc = LocationHelper.GetLoc(logicConfig.S_LKBKHCLOC); - if (kgzStartLoc == null) - { - WMSHelper.DeleteWmsTask(wmsTask.S_CODE); - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"搴撳尯:{logicConfig.S_AREA_CODE},娌℃湁鍙敤鐨勭┖宸ヨ"); - throw new BusinessException($"搴撳尯:{logicConfig.S_AREA_CODE},娌℃湁鍙敤鐨勭┖宸ヨ"); - } - if (kgzEndLoc == null) - { - WMSHelper.DeleteWmsTask(wmsTask.S_CODE); - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"绌哄伐瑁呯紦瀛樹綅:{logicConfig.S_LKBKHCLOC},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - throw new BusinessException($"绌哄伐瑁呯紦瀛樹綅:{logicConfig.S_LKBKHCLOC},娌℃湁鍦╓MS绯荤粺涓綍鍏�); - } - - var locCntrRels = LocationHelper.GetLocCntr(kgzStartLoc.S_CODE); - if (locCntrRels.Count > 0) - { - string kgzCntrCode = locCntrRels[0].S_CNTR_CODE; - // 濡傛槸鑳庝晶鐩磋繛妯″紡锛屽垯鎻愰珮绌哄伐瑁呭嚭搴撲换鍔′紭鍏堢骇 - if (logicConfig.S_TASK_TYPE == "1") - { - priority = 99; - } - WCSTask kgzWcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = kgzCntrCode, - S_TYPE = "绌哄伐瑁呭嚭搴撲换鍔�, - S_START_LOC = kgzStartLoc.S_CODE, - S_START_AREA = kgzStartLoc.S_AREA_CODE, - S_END_LOC = kgzEndLoc.S_CODE, - S_END_AREA = kgzEndLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = priority, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(kgzWcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(kgzWcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(kgzWcsTask.S_END_LOC, 1); - } - } - else - { - WMSHelper.DeleteWmsTask(wmsTask.S_CODE); - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鏌ヨ绌哄伐瑁呰揣浣嶉敊璇紝璐т綅锛歿kgzStartLoc.S_CODE}娌℃湁绌哄伐瑁�); - throw new BusinessException($"鏌ヨ绌哄伐瑁呰揣浣嶉敊璇紝璐т綅锛歿kgzStartLoc.S_CODE}娌℃湁绌哄伐瑁�); - } - } - - // 濡傛槸甯樺竷鐩磋繛妯″紡鍒欙紝鎻愰珮婊℃枡鍏ュ簱浼樺厛绾�- if (logicConfig.S_TASK_TYPE == "2") - { - priority = 99; - } - else - { - priority = 10; - } - - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE, - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = priority, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - } - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - - // 5.浣滀笟鍒涘缓瀹屾垚鍚庯紝璇诲彇涓棿琛紝鏇存柊涓棿琛ㄧ姸鎬�- if (mesTask != null) - { - WMSHelper.readLjMesOffItemTask(wmsTask.S_CODE, mesTask.ID); - } - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鏈煡璇㈠埌瀹瑰櫒涓�{cntrCode}鐨勫鍣�); - throw new BusinessException($"鏈煡璇㈠埌瀹瑰櫒涓�{cntrCode}鐨勫鍣�); - } - } - catch (BusinessException be) - { - throw be; - } - catch (Exception ex) - { - // 鎶ヨ锛歐MS鍐呴儴閿欒锛氳Е鍙戞弧鏂欏伐瑁呬笅绾夸綔涓氶敊璇�- WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, ex.Message); - LogHelper.Info($"WMS鍐呴儴閿欒锛氳Е鍙戞弧鏂欏伐瑁呬笅绾夸綔涓氶敊璇�; 閿欒鍘熷洜锛歿ex.Message}", "WMS"); - result = false; - } - return result; - } - - /// <summary> - /// 鍙枡璇锋眰 - /// 1.鏌ヨ涓棿琛紝鍒ゆ柇鏄惁鏄幆甯︾墿鏂�- /// 2.鏌ヨ搴撳尯鐗╂枡淇℃伅锛屽苟杩囨护鏁呴殰鐨勫爢鍨涙満绔嬪簱 - /// 3.鏃犲簱瀛樺啓鍏ヤ腑闂磋〃寮傚父鍜屽紓甯稿師鍥�- /// 4.璁$畻鍑哄簱璐т綅锛岀敓鎴愬嚭搴撲换鍔�- /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult callMaterialProcess(CallMaterialRequest model) - { - ResponseResult responseResult = new ResponseResult(); - var mesTask = WMSHelper.getLjMesTaskByLoc(model.loc); - if (mesTask != null) - { - Location endLoc = LocationHelper.GetLoc(model.loc); - Location startLoc = null; - Location middleLoc = null; - string scheduleType = ""; - if (mesTask.PALLET_TYPE == "鐜甫") - { - scheduleType = "HDK"; - // 鏌ヨ鐜甫搴撹鐗╂枡搴撳瓨鎯呭喌锛屽苟姣旇緝涓庝腑杞簱鐨勫簱瀛樿繘琛屾瘮杈冿紝鍏堝叆鍏堝嚭 - } - else - { - scheduleType = "WCS"; - // 鏌ヨ搴撳尯鐗╂枡淇℃伅锛屾牴鎹厛鍏ュ厛鍑哄師鍒欒绠楋紝鐗╂枡璧风偣 - startLoc = WMSHelper.getOutStockStartLoc(null, mesTask.MATERIAL_CODE); - } - - if (startLoc == null) - { - // 鏃犲簱瀛樺啓鍏ヤ腑闂磋〃寮傚父鍜屽紓甯稿師鍥�- mesTask.RETURN_CODE = "6"; - mesTask.RECEIVE_MSG = "娌℃湁搴撳瓨鎴栬澶囨晠闅滄棤娉曞嚭搴�; - WMSHelper.updateLjMesTask(mesTask); - - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"MES鍙枡浠诲姟{mesTask.ID},娌℃湁搴撳瓨鎴栬澶囨晠闅滄棤娉曞嚭搴�); - responseResult.code = 1; - responseResult.msg = "娌℃湁搴撳瓨鎴栬澶囨晠闅滄棤娉曞嚭搴�; - return responseResult; - } - - middleLoc = WMSHelper.GetMinTaskTransfeLoc(startLoc.S_AREA_CODE, "1", "2"); - if (middleLoc == null) { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"MES鍙枡浠诲姟{mesTask.ID},绔嬪簱鎺ラ┏浣嶅彲鑳藉浜庨攣瀹氭垨绂佺敤鐘舵�锛岃鏌ョ湅"); - responseResult.code = 1; - responseResult.msg = "绔嬪簱鎺ラ┏浣嶅彲鑳藉浜庨攣瀹氭垨绂佺敤鐘舵�"; - return responseResult; - } - - String cntrCode = ""; - var locCntrs = LocationHelper.GetLocCntr(startLoc.S_CODE); - if (locCntrs != null && locCntrs.Count > 0) - { - cntrCode = locCntrs[0].S_CNTR_CODE; - } - - var wmsTask = new WMSTask() - { - S_CNTR_CODE = "", - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_TYPE = "婊℃枡鍑哄簱浠诲姟", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - }; - - if (WMSHelper.CreateWmsTask(wmsTask)) - { - // 鍒涘缓涓�鍏ュ簱浠诲姟 - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE, - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = middleLoc.S_CODE, - S_END_AREA = middleLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = scheduleType, - N_PRIORITY = wmsTask.N_PRIORITY, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - LocationHelper.LockLoc(wmsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - WMSHelper.updateMesTaskStatus("", "2"); - - // 浠诲姟鍒涘缓鎴愬姛璇诲彇MES浠诲姟 - WMSHelper.readLjMesCallItemTask("", mesTask.ID); - } - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"MES鍙枡浠诲姟{mesTask.ID},MES涓棿琛ㄦ病鏈夎绾胯竟璐т綅鐨勫彨鏂欎换鍔★紝璇锋煡鐪�); - responseResult.code = 1; - responseResult.msg = "MES涓棿琛ㄦ病鏈夎绾胯竟璐т綅鐨勫彨鏂欎换鍔�; - } - return responseResult; - } - - - /// <summary> - /// WCS浠诲姟鐘舵�鍥炴姤 - /// 浠诲姟鐘舵� 1锛氬紑濮�鎵ц涓紱瀹屾垚锛�锛氬噯澶囧彇璐э紱4锛氬彇璐у畬鎴愶紱5锛氬噯澶囧嵏璐э紱6锛氬嵏璐у畬鎴愶紱7锛氬紓甯稿彇娑堬紱8锛氬己鍒跺畬鎴�- /// 1.鏍规嵁浠诲姟鐘舵�鍥炴姤鏇存柊璐т綅鐘舵�銆佷换鍔$姸鎬�- /// 2.鏇存柊浠诲姟涓棿琛ㄧ姸鎬�- /// 4.鏇存柊鍑哄簱浠诲姟涓棿琛ㄧ姸鎬�- /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult taskStatusFeedback(TaskStatusFeedbackModel model) - { - ResponseResult responseResult = new ResponseResult(); - WCSTask cst = WCSHelper.GetTask(model.taskNo); - if (cst != null) - { - WMSTask mst = WMSHelper.GetWmsTask(cst.S_OP_CODE); - if (mst != null) - { - switch (model.status) - { - case 1: - WCSHelper.Begin(cst); - WMSHelper.updateMesTaskStatus(mst.S_CODE, "2"); - if (cst.S_TYPE.Contains("鍑哄簱")) - { - WMSHelper.addLotOutTask(mst.S_START_LOC); - } - break; - case 2: - WCSHelper.End(cst); - break; - case 3: - WCSHelper.UpdateStatus(cst, "鍑嗗鍙栬揣"); - break; - case 4: - WCSHelper.UpdateStatus(cst, "鍙栬揣瀹屾垚"); - TaskProcess.OperateStatus(cst, 4); - break; - case 5: - WCSHelper.UpdateStatus(cst, "鍑嗗鍗歌揣"); - break; - case 6: - WCSHelper.UpdateStatus(cst, "鍗歌揣瀹屾垚"); - TaskProcess.OperateStatus(cst, 6); - break; - case 7: - WCSHelper.UpdateStatus(cst, "寮傚父鍙栨秷"); - TaskProcess.OperateStatus(cst, 7); - mst.N_B_STATE = 3; - WMSHelper.UpdateTaskState(mst); - WMSHelper.updateMesTaskStatus(mst.S_CODE, "5", "WCS寮傚父鍙栨秷浠诲姟"); - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"WCS寮傚父鍙栨秷浠诲姟锛屼换鍔″彿锛歿cst.S_CODE}"); - break; - case 8: - WCSHelper.UpdateStatus(cst, "寮哄埗瀹屾垚"); - break; - } - // 娣诲姞WCS鍔ㄤ綔璁板綍 - WCSHelper.AddActionRecord(model.taskNo, model.status, model.deviceNo, model.loc); - - if (model.status == 2 || model.status == 8) - { - - if (cst.S_TYPE.Contains("鍏ュ簱")) - { - var cntrItemRels = ContainerHelper.GetCntrItemRel(cst.S_CNTR_CODE); - if (cntrItemRels != null && cntrItemRels.Count > 0) - { - foreach (var cntrItem in cntrItemRels) - { - cntrItem.T_INBOUND_TIME = DateTime.Now; - ContainerHelper.updateCntrItemRel(cntrItem); - } - } - } - - if (cst.S_TYPE.Contains("銆愬紓甯搞�")) - { - WCSHelper.ActivatePreCreateTask(mst.S_CODE, 1); - } - else - { - WCSHelper.ActivatePreCreateTask(mst.S_CODE); - } - - if (WMSHelper.isFinishTask(mst.S_CODE)) - { - // 鏇存柊浣滀笟浠诲姟鐘舵� - mst.N_B_STATE = 2; - mst.T_END_TIME = DateTime.Now; - WMSHelper.UpdateTaskState(mst); - - // 鏇存柊浠诲姟涓棿琛ㄧ姸鎬�- WMSHelper.updateMesTaskStatus(mst.S_CODE, "3"); - - if (cst.S_TYPE.Contains("鍑哄簱")) - { - // 鏇存柊鍑哄簱浠诲姟涓棿琛ㄧ姸鎬�- WMSHelper.updateLotOutTask(cst.S_CNTR_CODE, "2"); - } - - } - } - } - } - return responseResult; - } - - /// <summary> - /// WCS鐢宠缁堢偣 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult applyDest(ApplyDestinationModel model) { - ResponseResult result = new ResponseResult(); - - ApplyDest applyDest = new ApplyDest(); - WCSTask cst = WCSHelper.GetTask(model.taskNo); - if (cst != null && cst.N_B_STATE < 3) - { - WMSTask mst = WMSHelper.GetWmsTask(cst.S_OP_CODE); - if (mst != null && mst.N_B_STATE < 2) { - - int emptyFlag = 0; // 瀹瑰櫒绌烘弧鏍囪瘑 - Container cntr = ContainerHelper.GetCntr(cst.S_CNTR_CODE); - if (cntr != null && cntr.N_DETAIL_COUNT > 0) { - emptyFlag = 1; - } - - // 1锛氬爢鍨涙満鏀捐揣寮傚父鐢宠鏂扮粓鐐�- if (model.applyType == 1) { - // 鎶ヨ锛氭祦绋嬪紓甯�- WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"鍫嗗灈鏈烘斁璐у紓甯革紝寮傚父璐т綅锛歿cst.S_END_LOC}"); - - // 1.灏嗗紓甯歌揣浣嶄笂閿侊紝骞舵姤璀�- LocationHelper.LockLoc(cst.S_END_LOC, 3); - - // 2.鏌ヨ鏂扮殑鍏ュ簱缁堢偣 - Location endLoc = WMSHelper.getInStockEndLoc(cst.S_END_AREA, emptyFlag); - cst.S_END_LOC = endLoc.S_CODE; - WCSHelper.UpdateEndLoc(cst); - - LocationHelper.LockLoc(endLoc.S_CODE, 1); - applyDest.destLoc = endLoc.S_CODE; - } - else if (model.applyType == 2) - { - if (cst.S_END_LOC == "铏氭嫙搴撲綅") - { - var transfeRelevance = WMSHelper.GetTransfeRelevance(model.loc); // 鎺ラ┏浣嶅叧鑱斿睘鎬�- if (transfeRelevance != null) - { - // 1.鏌ヨ鏂扮殑鍏ュ簱缁堢偣 - Location endLoc = WMSHelper.getInStockEndLoc(transfeRelevance.S_RELE_AREA, emptyFlag); - cst.S_END_LOC = endLoc.S_CODE; - WCSHelper.UpdateEndLoc(cst); - - LocationHelper.LockLoc(endLoc.S_CODE, 1); - applyDest.destLoc = endLoc.S_CODE; - } - } - } - - } - } - result.data = applyDest; - return result; - } - - /// <summary> - /// AGV鐢宠缁堢偣 - /// 椤哄簭 RFID楠岃瘉 -> RFID涓庝换鍔″彿楠岃瘉 -> 鐗╂枡鍚堟牸鐘舵�楠岃瘉 -> 铏氭嫙缁堢偣 - /// 鐢宠绫诲瀷锛�1.铏氭嫙缁堢偣 2.RFID涓庝换鍔′笉鍖归厤 3.鐗╂枡鐘舵�涓嶅悎鏍�- /// 鍏ュ簱绛栫暐锛氬厛璁$畻搴撳尯鐨勫绉巼锛屽啀璁$畻搴撳尯瀵瑰簲鐨勫叆搴撶珯鍙扮殑浠诲姟鏁帮紝閮藉彇鏈�皬鐨�- /// - /// 1.纭畾浠诲姟鏄惁鍦ㄦ墽琛屼腑 - /// 2.鍒ゆ柇鐢宠绫诲瀷 - /// 1).铏氭嫙缁堢偣锛岃绠楀叆搴撶珯鍙帮紝鍚屾椂棰勫厛鐢熸垚鍏ュ簱绔欏彴-绔嬪簱缁堢偣鐨勬惉杩愪换鍔�- /// 2).RFID楠岃瘉澶辫触,璁板綍寮傚父锛屽苟璁$畻寮傚父鍖虹殑绌鸿揣浣�- /// 3).RFID涓庝换鍔′笉鍖归厤锛岃褰曞紓甯稿苟鎶ヨ锛屽苟璁$畻寮傚父鍖虹殑绌鸿揣浣�- /// 4).鐗╂枡鐘舵�涓嶅悎鏍�璁板綍寮傚父锛岃绠楀叆搴撶珯鍙帮紝鍚屾椂棰勫厛鐢熸垚鍏ュ簱绔欏彴-绔嬪簱缁堢偣鐨勬惉杩愪换鍔�锛涙渶鍚庨噸鏂扮敓鎴愭柊鐨勫嚭搴撲换鍔�- /// - /// 3. 2)\3) 寮傚父鍖烘病鏈夌┖璐т綅锛岃绠楀叆搴撶珯鍙帮紝鍚屾椂棰勫厛鐢熸垚鍏ュ簱绔欏彴-绔嬪簱缁堢偣鐨勬惉杩愪换鍔�- /// - /// 4.浣欐枡/绌哄伐瑁呭洖搴撲换鍔�- /// 1).鏍规嵁RFID鏌ヨ涓棿琛紝鍒ゆ柇鐗╂枡绫诲瀷,濡備负绌哄伐瑁咃紝姝e父鍏ュ簱锛堣绠楀叆搴撶珯鍙帮紝鐢熸垚棰勫垱寤烘惉杩愪换鍔★級 - /// 2).濡傛槸浣欐枡锛屾煡璇㈡槸鍚︽湁浣欐枡鏈夊叧鐨勫彨鏂欎换鍔★紝涓旀湭鎵ц锛屽垯鍙栨秷鍙枡浠诲姟锛屼慨鏀圭粓鐐逛负璇ュ彨鏂欑粓鐐�- /// 3).濡傛病鏈夌浉鍏冲彨鏂欎换鍔★紝鍒欐甯稿叆搴�- /// - /// 5.绌哄伐瑁呭嚭搴撳拰鎴愬瀷鏈哄彨鏂欎换鍔★紝褰撶敵璇风被鍨嬩负2,3,4鏄紝闇�閲嶆柊鐢熸垚浠诲姟 - /// </summary> - /// <param name="taskNo"></param> - /// <param name="loc"></param> - /// <param name="trayCode"></param> - /// <param name="applyType">1.姝e父 2.寮傚父</param> - /// <returns></returns> - public static string AGVApplyDest(string taskNo ,string loc ,string trayCode,string applyType) - { - LogHelper.Info($"AGV鐢宠缁堢偣锛屼换鍔″彿锛歿taskNo},褰撳墠浣嶇疆锛歿loc},鐢宠绫诲瀷锛歿applyType}", "HosttoagvTask"); - string applyDest = null; - try - { - WCSTask cst = WCSHelper.GetTask(taskNo); - if (cst != null && cst.N_B_STATE < 3) - { - WMSTask mst = WMSHelper.GetWmsTask(cst.S_OP_CODE); - if (mst != null && mst.N_B_STATE < 2) - { - // 闃叉閲嶅鐢宠 - if ((applyType != "1" && !cst.S_TYPE.Contains("銆愬紓甯搞�")) || (applyType == "1" && cst.S_END_LOC.Contains("铏氭嫙璐т綅"))) - { - // 鏂滆绔嬪簱 - if (mst.S_OP_DEF_NAME.Contains("鏂滆")) - { - applyDest = applyAgvDestXC(applyType, mst, cst); - } - else - { - applyDest = applyAgvDest(applyType, loc, mst, cst); - } - } - } - } - } - catch (Exception ex) - { - WMSHelper.addAlarmRecord("绯荤粺閿欒","楂�, $"AGV鐢宠缁堢偣锛學MS鍐呴儴閿欒锛岄敊璇師鍥狅細{ex.Message}", "AGV"); - } - return null; - } - - /// <summary> - /// 鏂滆绔嬪簱浠诲姟锛孉GV鐢宠缁堢偣 - /// 1).鏍规嵁RFID鏌ヨ涓棿琛紝鍒ゆ柇鐗╂枡绫诲瀷,濡備负绌哄伐瑁咃紝姝e父鍏ュ簱锛堣绠楀叆搴撶珯鍙帮紝鐢熸垚棰勫垱寤烘惉杩愪换鍔★級 - /// 2).濡傛槸浣欐枡锛屾煡璇㈡槸鍚︽湁浣欐枡鏈夊叧鐨勫彨鏂欎换鍔★紝涓旀湭鎵ц锛屽垯鍙栨秷鍙枡浠诲姟锛屼慨鏀圭粓鐐逛负璇ュ彨鏂欑粓鐐�- /// </summary> - /// <param name="applyType"></param> - /// <param name="mst"></param> - /// <param name="cst"></param> - /// <returns></returns> - public static string applyAgvDestXC(string applyType, WMSTask mst, WCSTask cst) - { - string destLoc = null; - Location agvEndLoc = null; - Location wmsEndLoc = null; - if (applyType == "1") - { - if (mst.S_TYPE == "浣欐枡/绌哄伐瑁呭叆搴�) - { - var mesTask = WMSHelper.GetLjMesTaskById(int.Parse(mst.S_OP_DEF_CODE)); - if (mesTask.QTY != 0) - { - var awaitTask = WMSHelper.GetAwaitWmsTaskByMaterialCode(mesTask.MATERIAL_CODE); - if (awaitTask != null) - { - // 鍙栨秷浠诲姟 - ApiHelper.cancelTask(awaitTask.S_CODE); - // 淇敼缁堢偣 - agvEndLoc = LocationHelper.GetLoc(awaitTask.S_END_LOC); - wmsEndLoc = agvEndLoc; - mst.S_TYPE = "鍙枡鍑哄簱浠诲姟"; - } - } - } - } - - if (agvEndLoc == null) - { - string msg = ""; - if (applyType == "2" || applyType == "3" || applyType == "4") - { - cst.S_TYPE = cst.S_TYPE + "銆愬紓甯搞�"; - msg = "宸ヨ寮傚父"; - } - - // TODO 鍙嶉鏂滆绔嬪簱寮傚父锛岃姹傛枩瑁佸叆搴撶粓鐐�- agvEndLoc = null; - - } - - if (agvEndLoc != null) - { - destLoc = agvEndLoc.S_CODE; - - cst.S_END_LOC = agvEndLoc.S_CODE; - cst.S_END_AREA = agvEndLoc.S_AREA_CODE; - WCSHelper.UpdateEndLoc(cst); - } - - if (wmsEndLoc != null) - { - mst.S_END_LOC = wmsEndLoc.S_CODE; - mst.S_END_AREA = wmsEndLoc.S_AREA_CODE; - WMSHelper.UpdateTaskEnd(mst); - } - return destLoc; - } - - /// <summary> - /// AGV鐢宠缁堢偣 - /// </summary> - /// <param name="applyType">1.姝e父 2.RFID涓庝换鍔FID涓嶅尮閰�3.鐗╂枡鐘舵�涓嶅悎鏍�/param> - /// <param name="loc"></param> - /// <param name="mst"></param> - /// <param name="cst"></param> - /// <returns></returns> - public static string applyAgvDest(string applyType,string loc, WMSTask mst, WCSTask cst) - { - LogHelper.Info($"寮�鐢宠AGV缁堢偣", "AGV"); - string destLoc = null; - Location agvEndLoc = null; - Location wmsEndLoc = null; - Location currentLoc = LocationHelper.GetLoc(loc); - - // RFID 妫�祴姝e父 - if (applyType == "1") - { - // 鍦烘櫙锛�.浣欐枡/绌哄伐瑁呭叆搴撲换鍔�- // 1).鏍规嵁RFID鏌ヨ涓棿琛紝鍒ゆ柇鐗╂枡绫诲瀷,濡備负绌哄伐瑁咃紝姝e父鍏ュ簱锛堣绠楀叆搴撶珯鍙帮紝鐢熸垚棰勫垱寤烘惉杩愪换鍔★級 - // 2).濡傛槸浣欐枡锛屾煡璇㈡槸鍚︽湁浣欐枡鏈夊叧鐨勫彨鏂欎换鍔★紝涓旀湭鎵ц锛屽垯鍙栨秷鍙枡浠诲姟锛屼慨鏀圭粓鐐逛负璇ュ彨鏂欑粓鐐�- if (cst.S_TYPE.Contains("浣欐枡/绌哄伐瑁呭叆搴�)) - { - LogHelper.Info($"浣欐枡/绌哄伐瑁呭叆搴撲换鍔★紝鍒ゆ柇鏄惁鍥炲簱鎴栧彂寰�彨鏂欑偣", "AGV"); - var mesTask = WMSHelper.GetLjMesTaskById(int.Parse(mst.S_OP_DEF_CODE)); - if (mesTask.QTY != 0) - { - var awaitTask = WMSHelper.GetAwaitWmsTaskByMaterialCode(mesTask.MATERIAL_CODE); - if (awaitTask != null) - { - LogHelper.Info($"浣欐枡/绌哄伐瑁呭叆搴撲换鍔★紝瀛樺湪绛夊緟鐨勫彨鏂欎换鍔★紝鍙戝線鍙枡鐐�, "AGV"); - // 鍙栨秷浠诲姟 - ApiHelper.cancelTask(awaitTask.S_CODE); - // 淇敼缁堢偣 - agvEndLoc = LocationHelper.GetLoc(awaitTask.S_END_LOC); - - cst.S_TYPE = "鍙枡鍑哄簱浠诲姟"; - mst.S_TYPE = mst.S_TYPE + "銆愬彨鏂欍�"; - } - } - } - - // 鍦烘櫙锛�.婊℃枡/绌哄伐瑁呭叆搴�2.浣欐枡/绌哄伐瑁呭叆搴�- if (agvEndLoc == null && cst.S_TYPE.Contains("鍏ュ簱")) - { - LogHelper.Info($"濡傛病鏈夋弧瓒虫潯浠剁殑agv缁堢偣璐т綅锛屽垯鍙戝線绔嬪簱", "AGV"); - Container container = ContainerHelper.GetCntr(cst.S_CNTR_CODE); - if (container != null) - { - wmsEndLoc = WMSHelper.getInStockEndLoc(null, container.N_DETAIL_COUNT == 0 ? 0 : 1, container.N_TYPE); - if (wmsEndLoc != null) - { - agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, "1", "1", "2"); // 1.绔嬪簱鎺ラ┏浣�1.鍏ュ簱 2.闈炵洿杩�- if (agvEndLoc != null) - { - LogHelper.Info($"鍒涘缓绔嬪簱绔欏彴鍒扮珛搴撶殑棰勫垱寤轰换鍔★紝agv缁堢偣璐т綅:{agvEndLoc.S_CODE},绔嬪簱缁堢偣璐т綅:{wmsEndLoc.S_CODE}", "AGV"); - // 棰勫厛鐢熸垚鍏ュ簱绔欏彴-绔嬪簱缁堢偣鐨勬惉杩愪换鍔�- WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = mst.S_OP_DEF_NAME, - S_OP_CODE = mst.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = cst.S_CNTR_CODE, - S_TYPE = mst.S_TYPE, - S_START_LOC = agvEndLoc.S_CODE, - S_START_AREA = agvEndLoc.S_AREA_CODE, - S_END_LOC = wmsEndLoc.S_CODE, - S_END_AREA = wmsEndLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = 10, - N_B_STATE = -1, - T_START_TIME = DateTime.Now, - }; - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 1); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"AGV鐢宠缁堢偣澶辫触锛屾湭鏌ヨ鍒扮珛搴撴帴椹充綅"); - return null; - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"AGV鐢宠缁堢偣澶辫触锛屾湭鏌ヨ鍒扮┖浣欑珛搴撹揣浣�); - return null; - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"AGV鐢宠缁堢偣澶辫触锛屾湭鏌ヨ鍒板鍣ㄧ紪鐮�{cst.S_CNTR_CODE}鐨勫鍣�); - return null; - } - } - } - - // 鍦烘櫙锛�.婊℃枡/绌哄伐瑁呭嚭搴撳紓甯�2.婊℃枡/绌哄伐瑁呭叆搴撳紓甯革紙绌哄伐瑁呭嚭搴撳紓甯�銆佹弧鏂欏叆搴撳紓甯革級 - if (applyType == "2" ) - { - WCSHelper.CancelPreCreateTask(mst.S_CODE); - mst.S_TYPE = mst.S_TYPE + "銆愬紓甯搞�"; - - // 1.寮傚父宸ヨ浼樺厛鍙戝線寮傚父鍖�- LogHelper.Info($"寮傚父宸ヨ浼樺厛鍙戝線寮傚父鍖�, "AGV"); - agvEndLoc = WMSHelper.getAbnormalAreaLoc(currentLoc.S_AREA_CODE); - if (agvEndLoc != null) - { - wmsEndLoc = agvEndLoc; - } - else - { - LogHelper.Info($"寮傚父鍖烘病鏈夌┖璐т綅锛屽彂寰�珛搴�, "AGV"); - } - - // 2.寮傚父鍖烘病鏈夌┖璐т綅锛屽垯鍙戝線绔嬪簱 - if (agvEndLoc == null) - { - LogHelper.Info($"濡傛病鏈夋弧瓒虫潯浠剁殑agv缁堢偣璐т綅锛屽垯鍙戝線绔嬪簱", "AGV"); - Container container = ContainerHelper.GetCntr(cst.S_CNTR_CODE); - if (container != null) - { - wmsEndLoc = WMSHelper.getInStockEndLoc(null, container.N_DETAIL_COUNT == 0 ? 0 : 1, container.N_TYPE); - if (wmsEndLoc != null) - { - agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, "1", "1", "2"); // 1.绔嬪簱鎺ラ┏浣�1.鍏ュ簱 2.闈炵洿杩�- if (agvEndLoc != null) - { - LogHelper.Info($"鍒涘缓绔嬪簱绔欏彴鍒扮珛搴撶殑棰勫垱寤轰换鍔★紝agv缁堢偣璐т綅:{agvEndLoc.S_CODE},绔嬪簱缁堢偣璐т綅:{wmsEndLoc.S_CODE}", "AGV"); - // 棰勫厛鐢熸垚鍏ュ簱绔欏彴-绔嬪簱缁堢偣鐨勬惉杩愪换鍔�- WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = mst.S_OP_DEF_NAME, - S_OP_CODE = mst.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = cst.S_CNTR_CODE, - S_TYPE = cst.S_TYPE + "銆愬紓甯搞�", - S_START_LOC = agvEndLoc.S_CODE, - S_START_AREA = agvEndLoc.S_AREA_CODE, - S_END_LOC = wmsEndLoc.S_CODE, - S_END_AREA = wmsEndLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = 10, - N_B_STATE = -1, - T_START_TIME = DateTime.Now, - }; - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 1); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - cst.S_TYPE = cst.S_TYPE + "銆愬紓甯搞�"; - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"AGV鐢宠缁堢偣澶辫触锛屾湭鏌ヨ鍒扮珛搴撴帴椹充綅"); - return null; - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"AGV鐢宠缁堢偣澶辫触锛屾湭鏌ヨ鍒扮┖浣欑珛搴撹揣浣�); - return null; - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"AGV鐢宠缁堢偣澶辫触锛屾湭鏌ヨ鍒板鍣ㄧ紪鐮�{cst.S_CNTR_CODE}鐨勫鍣�); - return null; - } - } - } - - // 閲嶆柊鍙戣捣鏂颁换鍔�- if (applyType != "1") - { - var mesTask = WMSHelper.GetLjMesTaskByAgvorderId(mst.S_CODE); - if (mesTask != null) - { - if (mst.S_TYPE.Contains("鍙枡鍑哄簱浠诲姟")) - { - LogHelper.Info($"鍙枡鍑哄簱浠诲姟寮傚父锛屽啀娆″彂璧峰彨鏂欏嚭搴撲换鍔�, "AGV"); - callMaterial(mesTask.MATERIAL_CODE, mesTask.POSITION_ID, mesTask.ID); - /*againCallMaterial(mst, mesTask.MATERIAL_CODE, mesTask.POSITION_ID, mesTask.ID);*/ - } - - // 婊℃枡涓嬬嚎锛堥潪鐩磋繛锛�- if (mst.S_TYPE.Contains("婊℃枡/寮傚父宸ヨ鍏ュ簱浠诲姟") && cst.S_TYPE.Contains("绌哄伐瑁呭嚭搴撲换鍔�)) - { - LogHelper.Info($"婊℃枡/寮傚父宸ヨ鍏ュ簱浠诲姟寮傚父锛屽啀娆″彂璧锋弧鏂�寮傚父宸ヨ鍏ュ簱浠诲姟", "AGV"); - var logicConfig = WMSHelper.getLogicConfigByJtCode(mesTask.EQP); - if (logicConfig != null) - { - triggerItemOffLineFlow4(mesTask.POSITION_ID, logicConfig, mesTask); - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"MES浠诲姟{mesTask.ID},鏈哄彴鍙凤細{mesTask.EQP},鏈煡璇㈠埌閫昏緫绾胯矾", "AGV"); - } - } - } - } - - if (agvEndLoc != null && wmsEndLoc != null) - { - destLoc = agvEndLoc.S_CODE; - cst.S_END_LOC = agvEndLoc.S_CODE; - cst.S_END_AREA = agvEndLoc.S_AREA_CODE; - WCSHelper.UpdateEndLoc(cst); - - mst.S_END_LOC = wmsEndLoc.S_CODE; - mst.S_END_AREA = wmsEndLoc.S_AREA_CODE; - WMSHelper.UpdateTaskEnd(mst); - } - return destLoc; - } - - /// <summary> - /// 鎴愭柊鏈哄彨鏂�- /// </summary> - /// <param name="materialCode"></param> - /// <param name="endLocCode"></param> - /// <param name="mesTaskId"></param> - public static void callMaterial(string materialCode, string endLocCode, int mesTaskId) - { - var oldWmsTask = WMSHelper.GetWmsTaskByEnd(endLocCode); - if (oldWmsTask == null) { - string cntrCode = ""; - Location endLoc = LocationHelper.GetLoc(endLocCode); - if (endLoc != null) - { - Location middleLoc = null; - Location startLoc = WMSHelper.getOutStockStartLoc(null, materialCode); - if (startLoc == null) - { - var mesTask = WMSHelper.GetLjMesTaskById(mesTaskId); - if (mesTask != null) - { - mesTask.RECEIVE_MSG = "娌℃湁搴撳瓨"; - WMSHelper.updateLjMesTask(mesTask); - } - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鍙枡澶辫触锛岀墿鏂�{materialCode}娌℃湁搴撳瓨"); - return; - } - else - { - var locCntrRels = LocationHelper.GetLocCntr(startLoc.S_CODE); - if (locCntrRels.Count > 0) - { - cntrCode = locCntrRels[0].S_CNTR_CODE; - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鏌ヨ鐗╂枡寮傚父锛岃揣浣�{startLoc.S_CODE}缂哄皯瀹瑰櫒淇℃伅"); - return; - } - } - - middleLoc = WMSHelper.GetTransfeRelevanceLoc(startLoc.S_AREA_CODE, "1" , "2"); - - if (middleLoc != null) - { - // 1.鍒涘缓鎴愭柊鏈哄彨鏂欎綔涓�- var wmsTask = new WMSTask() - { - S_CNTR_CODE = cntrCode, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_TYPE = "鍙枡鍑哄簱浠诲姟", - S_OP_DEF_CODE = mesTaskId.ToString(), - S_OP_DEF_NAME = "鎴愬瀷鏈哄彨鏂欏嚭搴撲换鍔�, - T_START_TIME = DateTime.Now, - }; - if (WMSHelper.CreateWmsTask(wmsTask)) - { - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE + "-WCS", - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = middleLoc.S_CODE, - S_END_AREA = middleLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - } - - // 棰勫垱寤轰簩娈典换鍔�- WCSTask twoWcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE, - S_START_LOC = middleLoc.S_CODE, - S_START_AREA = middleLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - N_B_STATE = -1 - }; - WCSHelper.CreateTask(twoWcsTask); - - WMSHelper.readLjMesCallItemTask(wmsTask.S_CODE, mesTaskId); - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"搴撳尯{startLoc.S_AREA_CODE}鏈煡璇㈠埌鍙敤鐨勬帴椹充綅"); - } - } - } - } - - /// <summary> - /// 鎴愭柊鏈哄彨鏂�鐜甫搴� - /// 1.鏌ヨ鐜甫搴撶墿鏂欏簱瀛�- /// 2.鏌ヨ涓浆搴撳簱瀛橈紝鏍规嵁鍏ュ簱鏃堕棿 杩涜鍏堝叆鍏堝嚭 - /// 3.濡傛灉涓虹幆甯﹀簱鐗╂枡锛屽垯灏唌es浠诲姟鍐欏叆鐜甫搴撲换鍔′腑闂磋〃 - /// </summary> - /// <param name="materialCode"></param> - /// <param name="endLocCode"></param> - /// <param name="mesTaskId"></param> - public static void callMaterialHDK(string materialCode, string endLocCode, int mesTaskId) - { - // 1.鏌ヨ鐜甫搴撶墿鏂欏簱瀛�- - // 2.鏌ヨ涓浆搴撳簱瀛橈紝鏍规嵁鍏ュ簱鏃堕棿 杩涜鍏堝叆鍏堝嚭 - - // 3.灏哅ES浠诲姟鍐欏叆鐜甫搴撲换鍔′腑闂磋〃 - WMSHelper.addLjXcTask(mesTaskId); - } - - /// <summary> - /// 浣欐枡/绌烘墭鍥炲簱 - /// - /// 1.鏌ヨ鎴愬瀷鏈哄彨鏂欑粓鐐瑰搴旂殑 浣欐枡/绌烘墭杩斿洖浣�- /// 2.鏌ヨmes浠诲姟涓棿琛ㄦ槸鍚﹀瓨鍦ㄨ繑鏂欎换鍔�- /// 3.鍒涘缓浣欐枡鍥炲簱浣滀笟锛屽垱寤篴gv鎼繍浠诲姟锛岃櫄鎷熺粓鐐�- /// </summary> - /// <param name="locCode">鎴愬瀷鏈哄彨鏂欑粓鐐�/param> - public static void returnMaterialOrEmptyTray(string locCode) - { - if (locCode != null) - { - // 2.鏌ヨmes浠诲姟涓棿琛�- var mesTask = WMSHelper.getLjMesTaskByLoc(locCode); - if (mesTask != null) - { - createReturnTask(locCode, mesTask); - } - } - } - - /// <summary> - /// 鍒涘缓浣欐枡/绌哄伐瑁呰繑鍥炰换鍔�- /// </summary> - /// <param name="locCode"></param> - /// <param name="mesTask"></param> - public static void createReturnTask(string locCode ,LjMesTask mesTask) { - Location startLoc = LocationHelper.GetLoc(locCode); - Location endLoc = new Location() { S_CODE = "铏氭嫙璐т綅", S_AREA_CODE = "铏氭嫙搴撳尯" }; - - string suffix = ""; - if (mesTask.PALLET_TYPE == "5" || mesTask.PALLET_TYPE == "6") { - suffix = "(鏂滆)"; - } - - var wmsTask = new WMSTask() - { - S_CNTR_CODE = mesTask.PALLET_ID, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_TYPE = "浣欐枡/绌哄伐瑁呭叆搴撲换鍔� + suffix, - S_OP_DEF_CODE = mesTask.ID.ToString(), - S_OP_DEF_NAME = "浣欐枡/绌哄伐瑁呭叆搴� + suffix, - T_START_TIME = DateTime.Now - }; - if (WMSHelper.CreateWmsTask(wmsTask)) - { - // 鍒涘缓涓�鍏ュ簱浠诲姟 - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE, - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = 99, - T_START_TIME = DateTime.Now, - }; - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - - WMSHelper.readLjMesOffItemTask(wmsTask.S_CODE, mesTask.ID); - } - } - } - - /// <summary> - /// 涓嶅悎鏍煎搧鍥炲簱 - /// 1.鍒涘缓鍥炲簱浠诲姟 - /// 2.閲嶆柊鍙戣捣鏂扮殑鍙枡浠诲姟 - /// </summary> - /// <param name="mst"></param> - /// <param name="cst"></param> - /// <returns></returns> - public static bool rejectReturnStock(WMSTask mst, WCSTask cst) - { - bool result = true; - - Location startLoc = LocationHelper.GetLoc(cst.S_END_LOC); - Location agvEndLoc = null; - Location wmsEndLoc = null; - // 鏂滆绔嬪簱 - if (mst.S_OP_DEF_NAME.Contains("鏂滆")) - { - // TODO 鍙嶉鏂滆绔嬪簱寮傚父锛岃姹傛枩瑁佸叆搴撶粓鐐�- agvEndLoc = null; - wmsEndLoc = agvEndLoc; - - if (agvEndLoc != null) - { - // 棰勫厛鐢熸垚鍏ュ簱绔欏彴-绔嬪簱缁堢偣鐨勬惉杩愪换鍔�- WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = mst.S_OP_DEF_NAME, - S_OP_CODE = mst.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = cst.S_CNTR_CODE, - S_TYPE = "涓嶅悎鏍煎搧鍥炲簱", - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = agvEndLoc.S_CODE, - S_END_AREA = agvEndLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 1); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - } - } - } - else - { - Container container = ContainerHelper.GetCntr(cst.S_CNTR_CODE); - wmsEndLoc = WMSHelper.getInStockEndLoc(null, container.N_DETAIL_COUNT == 0 ? 0 : 1, container.N_TYPE); - if (wmsEndLoc != null) - { - agvEndLoc = WMSHelper.GetMinTaskTransfeLoc(wmsEndLoc.S_AREA_CODE, "1", "1", "2"); // 1.绔嬪簱鎺ラ┏浣�1.鍏ュ簱 2.闈炵洿杩�- if (agvEndLoc != null) - { - // 棰勫厛鐢熸垚鍏ュ簱绔欏彴-绔嬪簱缁堢偣鐨勬惉杩愪换鍔�- WCSTask oneWcsTask = new WCSTask() - { - S_OP_NAME = mst.S_OP_DEF_NAME, - S_OP_CODE = mst.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = cst.S_CNTR_CODE, - S_TYPE = "涓嶅悎鏍煎搧鍥炲簱", - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = agvEndLoc.S_CODE, - S_END_AREA = agvEndLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(oneWcsTask)) - { - // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(oneWcsTask.S_START_LOC, 1); - LocationHelper.LockLoc(oneWcsTask.S_END_LOC, 1); - } - - // 棰勫厛鐢熸垚鍏ュ簱绔欏彴-绔嬪簱缁堢偣鐨勬惉杩愪换鍔�- WCSTask twoWcsTask = new WCSTask() - { - S_OP_NAME = mst.S_OP_DEF_NAME, - S_OP_CODE = mst.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = cst.S_CNTR_CODE, - S_TYPE = "涓嶅悎鏍煎搧鍥炲簱", - S_START_LOC = agvEndLoc.S_CODE, - S_START_AREA = agvEndLoc.S_AREA_CODE, - S_END_LOC = wmsEndLoc.S_CODE, - S_END_AREA = wmsEndLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = 10, - N_B_STATE = -1, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(twoWcsTask)) - { - // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(twoWcsTask.S_START_LOC, 1); - LocationHelper.LockLoc(twoWcsTask.S_END_LOC, 1); - } - } - } - - if (cst.S_TYPE == "鍙枡鍑哄簱浠诲姟") - { - var mesTask = WMSHelper.GetLjMesTaskByAgvorderId(mst.S_CODE); - callMaterial( mesTask.MATERIAL_CODE, mesTask.POSITION_ID, mesTask.ID); - } - } - return result; - } - - - /// <summary> - /// 鏌ヨ瀹瑰櫒鐗╂枡淇℃伅锛堜腑闂磋〃锛�- /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult findTrayItemInfo(FindTrayItemInfoModel model) { - ResponseResult responseResult = new ResponseResult(); - var cntrItemRels = ContainerHelper.GetCntrItemRel(model.cntrNo); - if (cntrItemRels != null && cntrItemRels.Count > 0) { - TrayItemInfo trayItemInfo = new TrayItemInfo() - { - S_SERIAL_NO = cntrItemRels[0].S_SERIAL_NO, - S_ITEM_CODE = cntrItemRels[0].S_ITEM_CODE, - S_ITEM_NAME = cntrItemRels[0].S_ITEM_NAME, - S_ITEM_SPEC = cntrItemRels[0].S_ITEM_SPEC, - S_ITEM_STATE = cntrItemRels[0].S_ITEM_STATE, - N_ITEM_STATE = cntrItemRels[0].N_ITEM_STATE, - S_BATCH_NO = cntrItemRels[0].S_BATCH_NO, - F_QTY = cntrItemRels[0].F_QTY, - S_UOM = cntrItemRels[0].S_UOM, - S_CNTR_CODE = cntrItemRels[0].S_CNTR_CODE, - D_PRD_DATE = cntrItemRels[0].D_PRD_DATE, - D_EXP_DATE = cntrItemRels[0].D_EXP_DATE, - D_EXP_DATE1 = cntrItemRels[0].D_EXP_DATE1, - }; - responseResult.data = trayItemInfo; - } - return responseResult; - } - - - - /// <summary> - /// 璁惧鎶ヨ鍙嶉 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult notifyAlarm(DeviceAlertorFeedbackModel model) { - ResponseResult responseResult = new ResponseResult(); - WMSHelper.addAlarmRecord("璁惧鏁呴殰", "楂�, $"璁惧鍙穥model.deviceNo}锛岄敊璇俊鎭細"+model.errMsg); - return responseResult; - } - - /// <summary> - /// 浜哄伐鎵嬪姩鍏ュ簱 - /// 2.鏍规嵁瀹瑰櫒鍙锋煡璇㈠叆搴撲换鍔�- /// 3.濡傛灉娌℃湁鍏ュ簱浠诲姟锛岃褰曞紓甯�- /// 4.杩涜鍏ュ簱 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult manualStorage(ManualStorageModel model) - { - ResponseResult responseResult = new ResponseResult(); - - // 鏌ヨ涓棿琛�- var ljMesTask = WMSHelper.getLjMesTaskByCntr( model.cntrNo); - if (ljMesTask == null) - { - responseResult.code = 1; - responseResult.msg = "鏈煡璇㈠埌MES涓嬪彂鐨勫叆搴撲换鍔�; - return responseResult; - } - - string taskType = ""; - if (ljMesTask.QTY == 0) - { - taskType = "绌哄伐瑁呬汉宸ュ叆搴�; - } - else { - taskType = "婊℃枡宸ヨ浜哄伐鍏ュ簱"; - } - - var startLoc = LocationHelper.GetLoc(model.from); - var transfeRele = WMSHelper.GetTransfeRelevance(model.from); // 鎺ラ┏浣嶅睘鎬�- if (transfeRele != null) - { - var endLoc = WMSHelper.getInStockEndLoc(transfeRele.S_RELE_AREA, ljMesTask.QTY); - if (startLoc == null) - { - responseResult.code = 1; - responseResult.msg = "鎺ラ┏浣嶄笉瀛樺湪锛岃妫�煡璧风偣璐т綅缂栫爜鏄惁鏈夎"; - return responseResult; - } - - if (endLoc == null) - { - responseResult.code = 1; - responseResult.msg = "绔嬪簱绌轰綑搴撲綅涓嶈冻"; - return responseResult; - } - - var wmsTask = new WMSTask() - { - S_CNTR_CODE = model.cntrNo, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_TYPE = taskType, - S_OP_DEF_CODE = ljMesTask.ID.ToString(), - S_OP_DEF_NAME = "浜哄伐鍏ュ簱浠诲姟", - N_PRIORITY = 1, - T_START_TIME = DateTime.Now - }; - if (WMSHelper.CreateWmsTask(wmsTask)) - { - // 鍒涘缓涓�鍏ュ簱浠诲姟 - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE + "-WCS", - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = wmsTask.N_PRIORITY, - T_START_TIME = DateTime.Now, - }; - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - - WMSHelper.readLjMesOffItemTask(wmsTask.S_CODE ,ljMesTask.ID); - } - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"鎺ラ┏浣�{model.from},缂哄皯灞炴�閰嶇疆椤癸紝璇疯仈绯荤鐞嗚繘琛岄厤缃�); - responseResult.code = 1; - responseResult.msg = $"鎺ラ┏浣嶇己灏戝睘鎬ч厤缃」锛岃鑱旂郴绠$悊杩涜閰嶇疆"; - } - - return responseResult; - } - - /// <summary> - /// 浜哄伐鍑哄簱 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static ResponseResult manualDelivery(ManualDeliveryModel model) { - ResponseResult responseResult = new ResponseResult(); - - // 鏌ヨ涓棿琛�- var ljMesTask = WMSHelper.getLjMesTaskByLoc(model.to); - if (ljMesTask == null) - { - responseResult.code = 1; - responseResult.msg = "鏈煡璇㈠埌MES浠诲姟琛ㄦ暟鎹�; - return responseResult; - } - string taskType = ""; - if (ljMesTask.QTY == 0) - { - taskType = "绌哄伐瑁呬汉宸ュ嚭搴�; - } - else - { - taskType = "婊℃枡宸ヨ浜哄伐鍑哄簱"; - } - - var endLoc = LocationHelper.GetLoc(model.to); - var transfeRele = WMSHelper.GetTransfeRelevance(model.to); // 鎺ラ┏浣嶅睘鎬�- if (transfeRele != null) - { - var startLoc = WMSHelper.getOutStockStartLoc(transfeRele.S_RELE_AREA, model.materialCode,model.trayStatus, model.cntrNo); - if (endLoc == null) - { - responseResult.code = 1; - responseResult.msg = "鎺ラ┏浣嶄笉瀛樺湪锛岃妫�煡璧风偣璐т綅缂栫爜鏄惁鏈夎"; - return responseResult; - } - - if (startLoc == null) - { - responseResult.code = 1; - responseResult.msg = "绔嬪簱搴撳瓨涓嶈冻"; - return responseResult; - } - - var wmsTask = new WMSTask() - { - S_CNTR_CODE = model.cntrNo, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_TYPE = taskType, - S_OP_DEF_NAME = "浜哄伐鍑哄簱浠诲姟", - N_PRIORITY = 1, - T_START_TIME = DateTime.Now - }; - if (WMSHelper.CreateWmsTask(wmsTask)) - { - // 鍒涘缓涓�鍏ュ簱浠诲姟 - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE + "-WCS", - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = wmsTask.N_PRIORITY, - T_START_TIME = DateTime.Now, - }; - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - - WMSHelper.readLjMesOffItemTask(wmsTask.S_CODE, ljMesTask.ID); - } - } - } - else { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"鎺ラ┏浣�{model.to},缂哄皯灞炴�閰嶇疆椤癸紝璇疯仈绯荤鐞嗚繘琛岄厤缃�); - responseResult.code = 1; - responseResult.msg = $"鎺ラ┏浣嶇己灏戝睘鎬ч厤缃」锛岃鑱旂郴绠$悊杩涜閰嶇疆"; - } - - return responseResult; - } - - /// <summary> - /// 鍙栨秷浠诲姟 - /// </summary> - /// <param name="taskNo"></param> - public static ResponseResult cancelTask(string taskNo) { - ResponseResult responseResult = new ResponseResult(); - WMSTask wmsTask = WMSHelper.GetWmsTask(taskNo); - if (wmsTask != null && wmsTask.N_B_STATE == 0) - { - - var wcsTaskList = WCSHelper.GetTaskListBySrcNo(wmsTask.S_CODE); - foreach (var wcsTask in wcsTaskList) - { - if (wcsTask != null && wcsTask.N_B_STATE < 3) - { - WCSHelper.Fail(wcsTask); - LocationHelper.UnLockLoc(wcsTask.S_START_LOC); - LocationHelper.UnLockLoc(wcsTask.S_END_LOC); - } - } - - wmsTask.N_B_STATE = 3; - wmsTask.S_B_STATE = "鍙栨秷"; - wmsTask.T_END_TIME = DateTime.Now; - WMSHelper.UpdateTaskState(wmsTask); - } - return responseResult; - } - - /// <summary> - /// 鍒囨崲绔欏彴灞炴� - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static bool switchStationAttribute(SwitchStationAttributeModel model) - { - bool result = false; - var task = WCSHelper.GetTaskByStartOrEnd(model.locCode); - if (task == null) - { - var transfeRelevance= WMSHelper.GetTransfeRelevance(model.locCode); // 鎺ラ┏浣嶅睘鎬�- LogHelper.Info($"鍘熺珯鍙板睘鎬э細{JsonConvert.SerializeObject(transfeRelevance)}", "WMS"); - if (transfeRelevance != null && transfeRelevance.S_TYPE == "1") - { - if (model.signalType == "1") - { - if (transfeRelevance.S_PROPERTY == "2") - { - result = true; - } - else - { - result = WMSHelper.updateTransfeLocProperty(model.locCode, "2"); - } - } - if (model.signalType == "2") - { - if (transfeRelevance.S_PROPERTY == "3") - { - result = true; - } - else - { - result = WMSHelper.updateTransfeLocProperty(model.locCode, "3"); - } - } - } - } - return result; - } - - /// <summary> - /// 璐т綅鐘舵�鍙嶉 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public static bool locStateFeedBack(LocStateFeedBackModel model) - { - bool result = false; - if (model.type == "1") - { - var task = WCSHelper.GetTask(model.req_no); - if (task != null) - { - TaskAction taskAction = null; - if (model.type == "1") - { - taskAction = WCSHelper.getActionRecord(task.S_CODE, 1101); - } - if (model.type == "2") - { - taskAction = WCSHelper.getActionRecord(task.S_CODE, 1102); - } - if (taskAction != null) - { - taskAction.N_S_STATUS = 1; - result = WCSHelper.updateActionRecord(taskAction); - } - } - } - return result; - } - - //---------------------------------------------------------------------------------------------------------------------------- - public class LocModel - { - public string locCode { get; set; } - } - - public class ApplyDest { - public string destLoc { get; set; } // 缁堢偣璐т綅缂栫爜 - } - public class TrayItemInfo - { - public string S_SERIAL_NO { get; set; } // 鍘熸潗鏂欐壒娆″彿 - public string S_ITEM_CODE { get; set; } // 鐗╂枡缂栫爜 - public string S_ITEM_NAME { get; set; } // 鐗╂枡缂栫爜 - public string S_ITEM_SPEC { get; set; } // 瑙勬牸 - public string S_ITEM_STATE { get; set; } = "0"; // 妫�獙鐘舵� 0锛氭湭妫�獙 1锛氬悎鏍硷紝2锛氫笉鍚堟牸 - /// <summary> - /// 1锛氬悎鏍�2锛氫笉鍚堟牸 - /// </summary> - public int N_ITEM_STATE { get; set; } // 鐗╂枡鐘舵� - public string S_BATCH_NO { get; set; } // 鎵规鏉$爜 - public float F_QTY { get; set; } // 鏁伴噺 - public string S_UOM { get; set; } = ""; // 鍗曚綅 - public string S_CNTR_CODE { get; set; } // 瀹瑰櫒 - public string D_PRD_DATE { get; set; } // 鐢熶骇鏃ユ湡 - public string D_EXP_DATE { get; set; } // 鏈�皬鍋滄斁鏃ユ湡 - public string D_EXP_DATE1 { get; set; } // 鏈�ぇ鍋滄斁鏃ユ湡 - } - - /// <summary> - /// 浜哄伐鍑哄簱妯″瀷 - /// </summary> - public class ManualDeliveryModel { - public string to { get; set; } // 鎺ラ┏璐т綅缂栫爜 - public string cntrNo { get; set; } // 瀹瑰櫒鍙�- public int trayStatus { get; set; } // 鎵樼洏鐘舵� 0.姝e父 1.寮傚父 - public string materialCode { get; set; } // 鐗╂枡缂栧彿 鐗╂枡缂栫爜涓虹┖锛岃〃绀虹┖宸ヨ - } - - /// <summary> - /// 浜哄伐鍏ュ簱妯″瀷 - /// </summary> - public class ManualStorageModel { - public string from { get; set; } // 璧风偣 - public string cntrNo { get; set; } // 瀹瑰櫒鍙�- } - - /// <summary> - /// 璁惧鎶ヨ鍙嶉妯″瀷 - /// </summary> - public class DeviceAlertorFeedbackModel { - public string deviceNo { get; set; } // 璁惧鍙�- public string errCode { get; set; } // 閿欒鐮�- public string errMsg { get; set; } // 閿欒淇℃伅 - } - - - /// <summary> - /// 鑾峰彇鎵樼洏鐗╂枡淇℃伅妯″瀷 - /// </summary> - public class FindTrayItemInfoModel { - public string cntrNo { get; set; } // 鎵樼洏鍙�- } - - /// <summary> - /// 鐢宠缁堢偣妯″瀷 - /// </summary> - public class ApplyDestinationModel { - public string taskNo { get; set; } // 浠诲姟鍙�- public string loc { get; set; } // 褰撳墠璐т綅 - public int applyType { get; set; } // 鐢宠绫诲瀷 1锛氬爢鍨涙満鏀捐揣寮傚父鐢宠鏂扮粓鐐癸紱2锛氳緭閫佺嚎鍒拌揪鎺ラ┏浣嶇敵璇风粓鐐癸紱3锛�- - } - - public class AGVApplyDestModel{ - public string taskNo { get; set; } // 浠诲姟鍙�- public string loc { get; set; } // 褰撳墠璐т綅 - public string trayCode { get; set; } // 鎵樼洏鐮侊紙RFID锛�- public string applyType { get; set; } // 1.铏氭嫙缁堢偣 2.RFID楠岃瘉澶辫触 3.RFID涓庝换鍔′笉鍖归厤 4.鐗╂枡鐘舵�涓嶅悎鏍�- } - - - /// <summary> - /// 浠诲姟鐘舵�鍙嶉妯″瀷 - /// </summary> - public class TaskStatusFeedbackModel { - public string taskNo { get; set; } // 浠诲姟鍙�- public string subTaskNo { get; set; } // 瀛愪换鍔″彿 - public int status { get; set; } // 浠诲姟鐘舵� 1锛氬紑濮�鎵ц涓紱2:瀹屾垚锛�锛氬噯澶囧彇璐э紱4锛氬彇璐у畬鎴愶紱5锛氬噯澶囧嵏璐э紱6锛氬嵏璐у畬鎴愶紱7锛氬紓甯稿彇娑堬紱8锛氬己鍒跺畬鎴�- public string deviceNo { get; set; } // 璁惧鍙�- public string errCode { get; set; } // 寮傚父浠g爜 0.鏃犲紓甯�1.璁惧鏁呴殰鐮併�2.rfid鏍¢獙澶辫触銆�.鍙栬揣鏃犺揣銆�.鏀捐揣鏈夎揣 - public string loc { get; set; } // 褰撳墠璐т綅 - } - - /// <summary> - /// 璁惧淇″彿鍙嶉妯″瀷 - /// </summary> - public class DeviceSignalFeedbackModel - { - public string reqId { get; set; } - public string reqTime { get; set; } - public string loc { get; set; } // 璐т綅 涓婃枡鐐广�涓嬫枡鐐广�璇荤爜浣嶃�绉伴噸浣嶏紙蹇呭~锛�- public string cntrNo { get; set; } // 鎵樼洏鍙�- public int signalType { get; set; } //璇锋眰绫诲瀷 1:涓嬬嚎璇锋眰 2锛氬彨鏂欒姹�3锛氳鐮佽姹傦紙蹇呭~锛�- public string deviceNo { get; set; } //璁惧鍙�- public object extData { get; set; } - } - - /// <summary> - /// 鍙枡璇锋眰 - /// </summary> - public class CallMaterialRequest - { - public string loc { get; set; } // 璐т綅 涓婃枡鐐广�涓嬫枡鐐广�璇荤爜浣嶃�绉伴噸浣嶏紙蹇呭~锛�- } - - - /// <summary> - /// 涓嬬嚎璇锋眰 - /// </summary> - public class OffLineRequest - { - public string loc { get; set; } // 璐т綅 涓婃枡鐐广�涓嬫枡鐐广�璇荤爜浣嶃�绉伴噸浣嶏紙蹇呭~锛�- public string cntrNo { get; set; } // 鎵樼洏鍙�- public string jtNo { get; set; } // 鏈哄彴鍙�- } - - /// <summary> - /// 璇荤爜璇锋眰 - /// </summary> - public class ReadCodeRequest - { - public string loc { get; set; } // 璐т綅 涓婃枡鐐广�涓嬫枡鐐广�璇荤爜浣嶃�绉伴噸浣嶏紙蹇呭~锛�- public string cntrNo { get; set; } // 鎵樼洏鍙�- } - - public class AddTaskModel { - public string From { get; set; } - public string To { get; set; } - public string No { get; set; } - } - public class TN_LocationModel { - public string TN_Location { get; set; } - } - public class CodeInfo { - /// <summary> - /// 鐢熶骇璁㈠崟鍐呯爜 - /// </summary> - public string FInterID { get; set; } - /// <summary> - /// 鐢熶骇璁㈠崟缂栧彿 - /// </summary> - public string FSourceNo { get; set; } - /// <summary> - /// 鎵瑰彿 - /// </summary> - public string FGMPBatchNo { get; set; } - public string FState { get; set; } - /// <summary> - /// 鐗╂枡缂栫爜锛堝唴鐮佸氨鏄紪鐮侊級 - /// </summary> - public string Fitemid_XK { get; set; } - /// <summary> - /// 鍒嗗綍id - /// </summary> - public string Fentryid { get; set; } - } - public class NoteInfo : CodeInfo { - public string WmsBillNo { get; set; } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/ApiModel.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/ApiModel.cs deleted file mode 100644 index ce4a67e..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/ApiModel.cs +++ /dev/null @@ -1,207 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.api { - /// <summary> - /// 閫氱敤model - /// </summary> - public class ApiModel { - #region hosttoagv 鐩稿叧 - /// <summary> - /// 杩斿洖缁檋osttoagv - /// </summary> - public class ReturnResult { - public int ResultCode { get; set; } - public string ResultMsg { get; set; } - - } - /// <summary> - /// hosttoagv涓婃姤浠诲姟鐘舵� - /// </summary> - public class AgvTaskState { - public int State { get; set; } - public string No { get; set; } - public string ForkliftNo { get; set; } - public string ErrCode { get; set; } - public string LockNo { get; set; } - public string Ext1 { get; set; } - public string Ext2 { get; set; } - public string N_CNTR_COUNT { get; set; } - public string ExtData { get; set; } - } - /// <summary> - /// hosttoagv涓婃姤杞﹁締鐘舵�锛堝弬鏁板湪hosttoagv鏈嶅姟閰嶇疆锛屽彲淇敼锛�- /// </summary> - public class AgvDeviceStatus { - public string forkliftNo { get; set; } - - public string errCode { get; set; } - - public string errCode2 { get; set; } - - public string faildCode { get; set; } - - public string xPos { get; set; } - - public string yPos { get; set; } - public string battery { get; set; } - public string detail { get; set; } - public string infoType { get; set; } - public string inMapRoute { get; set; } - public string CumInfo { get; set; } - } - /// <summary> - /// osttoagv涓婃姤鍏跺畠浜嬩欢淇℃伅 - /// </summary> - public class AgvEventInfo { - public int Code { get; set; } - public string CarID { get; set; } - public string Param1 { get; set; } - public string Param2 { get; set; } - public string Param3 { get; set; } - - } - - #endregion - - #region mobox 鐩稿叧 - /// <summary> - /// mobox 鍙栨秷浠诲姟銆佹爣璁板畬鎴愪换鍔�- /// </summary> - public class MoboxTaskBase { - public string TaskNo { get; set; } - } - /// <summary> - /// mobox 鎺ュ彛杩斿洖 - /// </summary> - public class SimpleResult { - - public int resultCode { get; set; } - public string resultMsg { get; set; } - public List<object> result { get; set; } = new List<object>(); - } - - public class ResponseResult - { - public int code { get; set; } = 200; - public string msg { get; set; } - public object data { get; set; } - } - - /// <summary> - /// 鍒嗘嫞纭 - /// </summary> - public class SortingResultCheck { - public string sortNo { get; set; } - public string cntrCode { get;set; } - public string itemCode { get; set; } - public float qty { get; set; } - } - public class CheckSortingWholeCntr { - public string cntr { get; set; } - /// <summary> - /// 榛樿0锛�琛ㄧず鑷姩鐢熸垚鍒嗘嫞缁撴灉 - /// </summary> - public int autoSort { get; set; } - } - public class InstockInfo { - public string start { get; set; } - public string cntr { get; set; } - } - /// <summary> - /// lua璋冪敤鎺ュ彛锛岀爜鐩樹俊鎭�- /// </summary> - public class PalletSorting { - public string cntr_code { get; set; } - public string item_code { get; set; } - public float qty { get; set; } - public string arrival_no { get; set; } - } - public class PalletSorting1 { - public string cntr_code { get; set; } - public string bar_code { get; set; } - public string org { get; set; } - public float qty { get; set; } - } - - public class ShippingOrderCheck { - /// <summary> - /// 澶氫釜鍙戣揣鍗曞彿 - /// </summary> - public string out_nos { get; set; } - } - public class SortingOrderCheck { - - public string s_no { get; set; } - } - #endregion - } - - /// <summary> - /// 椤圭洰璁㈠埗model - /// </summary> - public class OtherModel { - /// <summary> - /// mobox3鎺ュ彛鏇夸唬锛屽叆搴撳崟淇℃伅 - /// </summary> - public class Putaway_Order_In { - public DataInfo Data { get; set; } - - public class DataInfo { - /// <summary> - /// 鍏ュ簱鍗曞彿(鍞竴) - /// </summary> - public string arrival_no { get; set; } - /// <summary> - /// 鍗曟嵁绫诲瀷 - /// </summary> - public string op_type { get; set; } - public List<Detail> items { get; set; } - } - public class Detail { - - public string item_code { get; set; } - /// <summary> - /// 淇濈暀4浣嶅皬鏁�- /// </summary> - public float qty { get; set; } - public string batch_no { get; set; } - } - } - - public class OutboundOrder { - public DataInfo1 Data { get; set; } - public class DataInfo1 { - /// <summary> - /// 鍑哄簱鍗曞彿(鍞竴) - /// </summary> - public string out_no { get; set; } - /// <summary> - /// 鍗曟嵁绫诲瀷 - /// </summary> - public string op_type { get; set; } - /// <summary> - /// 鐢熶骇鍑哄簱鐨勯渶瑕佹寚瀹氱嚎杈瑰簱鍖�- /// </summary> - public string line_area { get; set; } - public List<Detail1> items { get; set; } - } - public class Detail1 { - - public string item_code { get; set; } - /// <summary> - /// 淇濈暀4浣嶅皬鏁�- /// </summary> - public float qty { get; set; } - public string batch_no { get; set; } - } - } - public class ApiBaseModel { - public string Name { get; set; } - public string Source { get; set; } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/DebugController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/DebugController.cs deleted file mode 100644 index cf2f4be..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/DebugController.cs +++ /dev/null @@ -1,61 +0,0 @@ -锘�-using HH.WCS.Mobox3.FJJT.device; -using HH.WCS.Mobox3.FJJT.util; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Web.Http; -using static HH.WCS.Mobox3.FJJT.api.ApiHelper; -using static HH.WCS.Mobox3.FJJT.api.ApiModel; -using static HH.WCS.Mobox3.FJJT.api.OtherModel; -using static HH.WCS.Mobox3.FJJT.device.S7Helper; - -namespace HH.WCS.Mobox3.FJJT.api { - /// <summary> - /// 娴嬭瘯鐢紝濡傛灉椤圭洰涓鍜岃澶囧鎺ワ紝鍓嶆湡璁惧鏃犳硶娴嬭瘯锛岀敤鎺ュ彛妯℃嫙 - /// </summary> - [RoutePrefix("api")] - public class DebugController : System.Web.Http.ApiController { - - - [HttpPost] - [Route("s7SetInt")] - public SimpleResult s7SetInt(DBWModel model) { - S7Helper.s7SetInt(model); - return new SimpleResult(); - - } - - - [HttpPost] - [Route("s7SetBit")] - public SimpleResult s7SetBit(DBXModel model) { - S7Helper.s7SetBit(model); - return new SimpleResult(); - - } - [HttpPost] - [Route("s7SetString")] - public SimpleResult s7SetString(DBBModel model) { - S7Helper.s7SetStr(model); - return new SimpleResult(); - - } - - - public SimpleResult testOracle() - { - try - { - // 璋冪敤X5绯荤粺鏌ヨ - var db = new SqlHelper<object>().GetOracleInstance(Settings.OracleServer); - List<Location> locations = db.Queryable<Location>().ToList(); - } - catch (Exception ex) - { - LogHelper.Info("璋冪敤X5绯荤粺閿欒锛岄敊璇師鍥狅細" + ex.Message, "Mobox"); - } - return new SimpleResult(); - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/MoboxController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/MoboxController.cs deleted file mode 100644 index 56f8e9d..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/MoboxController.cs +++ /dev/null @@ -1,84 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.dispatch; -using HH.WCS.Mobox3.FJJT.process; -using HH.WCS.Mobox3.FJJT.wms; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Web.Http; -using static HH.WCS.Mobox3.FJJT.api.ApiHelper; -using static HH.WCS.Mobox3.FJJT.api.ApiModel; -using static HH.WCS.Mobox3.FJJT.api.OtherModel; - -namespace HH.WCS.Mobox3.FJJT.api { - /// <summary> - /// mobox3璋冪敤锛岃剼鏈腑璋冪敤 - /// </summary> - public class MoboxController : System.Web.Http.ApiController { - - /// <summary> - /// 1.浜哄伐鍏ュ簱 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - public ResponseResult manualStorage(ManualStorageModel model) - { - LogHelper.Info("manualStorage Request锛� + JsonConvert.SerializeObject(model), "Mobox"); - ResponseResult result = new ResponseResult(); - result = ApiHelper.manualStorage(model); - LogHelper.Info("manualStorage response锛� + JsonConvert.SerializeObject(model), "Mobox"); - return result; - } - - /// <summary> - /// 2.浜哄伐鍑哄簱 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - public ResponseResult manualDelivery(ManualDeliveryModel model) - { - LogHelper.Info("manualDelivery Request锛� + JsonConvert.SerializeObject(model), "Mobox"); - ResponseResult result = new ResponseResult(); - result = ApiHelper.manualDelivery(model); - LogHelper.Info("manualDelivery response锛� + JsonConvert.SerializeObject(model), "Mobox"); - return result; - } - - /// <summary> - /// 3.鍙栨秷浠诲姟 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - public ResponseResult CancelTask(CancelTaskModel model) - { - LogHelper.Info("鍙栨秷浠诲姟-CancelTask 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "Mobox"); - var result = ApiHelper.cancelTask(model.taskNo); - LogHelper.Info("鍙栨秷浠诲姟-CancelTask 鍑哄弬锛� + JsonConvert.SerializeObject(result), "Mobox"); - return result; - } - - /// <summary> - /// 4.PDA 浣欐枡/绌哄伐瑁呰繑鍥�- /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - public ResponseResult returnMaterialAndPallet(LocModel model) - { - LogHelper.Info("浣欐枡/绌哄伐瑁呰繑鍥�returnMaterialAndPallet 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "Mobox"); - ResponseResult responseResult = new ResponseResult(); - ApiHelper.returnMaterialOrEmptyTray(model.locCode); - LogHelper.Info("浣欐枡/绌哄伐瑁呰繑鍥�returnMaterialAndPallet 鍑哄弬锛� + JsonConvert.SerializeObject(responseResult), "Mobox"); - return responseResult; - } - - - - public class CancelTaskModel { - public string taskNo { get; set; } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/WmsController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/WmsController.cs deleted file mode 100644 index 6f1ff5e..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/api/WmsController.cs +++ /dev/null @@ -1,255 +0,0 @@ -锘�-using HH.WCS.Mobox3.FJJT.wms; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Web.Http; -using static HH.WCS.Mobox3.FJJT.api.ApiHelper; -using static HH.WCS.Mobox3.FJJT.api.ApiModel; -using static HH.WCS.Mobox3.FJJT.util.ExcetionHelper; - -namespace HH.WCS.Mobox3.FJJT.api -{ - /// <summary> - /// 绗笁鏂硅皟鐢ㄧ殑鎺ュ彛 - /// </summary> - /*[RoutePrefix("api")]*/ - public class WmsController : System.Web.Http.ApiController - { - /// <summary> - /// 1.绌哄伐瑁呭嚭搴�- /// 涓氬姟鍦烘櫙锛�- /// 1.鐩磋繛娴佺▼鍒濆鍖栵紝琛ュ厖绌哄伐瑁�- /// 2.闈炵洿杩炴祦绋嬶紝鍥哄畾绔欏彴鑷姩琛ュ厖绌哄伐瑁�- /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /* [Route("emptyPalletOutStock")]*/ - public ResponseResult emptyPalletOutStock(OutStockModel model) - { - LogHelper.Info("emptyPalletOutStock 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - ResponseResult responseResult = new ResponseResult(); - try - { - responseResult = ApiHelper.emptyPalletOutStock(model); - } - catch (BusinessException be) - { - responseResult.code = 501; - responseResult.msg = be.Message; - } - catch (Exception ex) - { - responseResult.code = 500; - responseResult.msg = $"WMS鍐呴儴閿欒锛岃鑱旂郴寮�彂浜哄憳澶勭悊"; - WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"WMS鍐呴儴閿欒: 绌哄伐瑁呭嚭搴撻敊璇紝閿欒鍘熷洜锛歿ex.Message}"); - } - - LogHelper.Info("emptyPalletOutStock 鍑哄弬锛� + JsonConvert.SerializeObject(responseResult), "WMS"); - return responseResult; - } - - - /// <summary> - /// 2.璁惧淇″彿鍙嶉 - /// 涓氬姟鍦烘櫙锛�- /// 1.涓嬬嚎璇锋眰锛屾満鍙扮敓浜у畬鎴愬悗锛屾弧鏂欏伐瑁呴�鍑烘満鍙版椂锛學CS涓嬪彂涓嬬嚎璇锋眰婊℃枡鍏ュ簱 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /*[Route("notifyDeviceSignal")]*/ - public ResponseResult notifyDeviceSignal(DeviceSignalFeedbackModel model) { - LogHelper.Info("notifyDeviceSignal 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - ResponseResult responseResult = new ResponseResult(); - try - { - if (model.signalType == 1) // 鐗╂枡涓嬬嚎鍏ュ簱璇锋眰 - { - OffLineRequest request = new OffLineRequest() { loc = model.loc, cntrNo = model.cntrNo, jtNo = model.deviceNo }; - responseResult = ApiHelper.offLineProcess(request); - } - else if (model.signalType == 3) // 璇荤爜鍏ュ簱璇锋眰 - { - ReadCodeRequest request = new ReadCodeRequest() { loc = model.loc, cntrNo = model.cntrNo }; - responseResult = ApiHelper.readCodeProcess(request); - } - else if (model.signalType == 5) // 寮傚父宸ヨ鍏ュ簱璇锋眰 - { - OffLineRequest request = new OffLineRequest() { loc = model.loc, cntrNo = model.cntrNo, jtNo = model.deviceNo }; - responseResult = ApiHelper.offLineProcess(request); - } - } - catch (BusinessException be) - { - responseResult.code = 501; - responseResult.msg = be.Message; - } - catch (Exception ex) - { - responseResult.code = 500; - responseResult.msg = $"WMS鍐呴儴閿欒锛岃鑱旂郴寮�彂浜哄憳澶勭悊"; - WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"WMS鍐呴儴閿欒: 璁惧淇″彿鍙嶉閿欒锛岄敊璇師鍥狅細{ex.Message}"); - } - LogHelper.Info("notifyDeviceSignal 鍑哄弬锛� + JsonConvert.SerializeObject(responseResult), "WMS"); - return responseResult; - } - - /// <summary> - /// 3.浠诲姟鐘舵�鍙嶉 - /// 涓氬姟鍦烘櫙锛歐CS鍦ㄦ墽琛屼换鍔℃椂锛屽洖鎶ヤ换鍔$姸鎬�- /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /*[Route("notifyTaskStatus")]*/ - public ResponseResult notifyTaskStatus(TaskStatusFeedbackModel model) { - LogHelper.Info("notifyTaskStatus 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - var result = ApiHelper.taskStatusFeedback(model); - LogHelper.Info("notifyTaskStatus 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); - return result; - } - - /// <summary> - /// 3.鐢宠缁堢偣 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /* [Route("applyDest")]*/ - public ResponseResult applyDest(ApplyDestinationModel model) - { - LogHelper.Info("applyDest 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - var result = ApiHelper.applyDest(model); - LogHelper.Info("applyDest 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); - return result; - } - - /// <summary> - /// 4.鑾峰彇鎵樼洏鐗╂枡淇℃伅 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /* [Route("findTrayItemInfo")]*/ - public ResponseResult findTrayItemInfo(FindTrayItemInfoModel model) - { - LogHelper.Info("findTrayItemInfo 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - var result = ApiHelper.findTrayItemInfo(model); - LogHelper.Info("findTrayItemInfo 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); - return result; - } - - /// <summary> - /// 5.璁惧鎶ヨ涓婃姤 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /* [Route("notifyAlarm")]*/ - public ResponseResult notifyAlarm(DeviceAlertorFeedbackModel model) - { - LogHelper.Info("notifyAlarm 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - var result = ApiHelper.notifyAlarm(model); - LogHelper.Info("notifyAlarm 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); - return result; - } - - /// <summary> - /// 5.瑙g粦璐т綅 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /* [Route("notifyAlarm")]*/ - public ResponseResult unBindingLoc(LocModel model) - { - LogHelper.Info("UnBindingLoc 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - ResponseResult result = new ResponseResult(); - LocationHelper.UnBindingLoc(model.locCode); - LogHelper.Info("UnBindingLoc 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); - return result; - } - - /// <summary> - /// 6.缁戝畾璐т綅 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /*[Route("notifyAlarm")]*/ - public ResponseResult bindingLoc(LocCntrModel model) - { - LogHelper.Info("BindingLoc 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - ResponseResult result = new ResponseResult(); - LocationHelper.BindingLoc(model.locCode, new List<string>() { model.cntrCode }); - LogHelper.Info("BindingLoc 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); - return result; - } - - /// <summary> - /// 7.鍒囨崲绔欏彴灞炴� - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /* [Route("notifyAlarm")]*/ - public ResponseResult switchStationAttribute(SwitchStationAttributeModel model) - { - LogHelper.Info("switchStationAttribute 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - ResponseResult result = new ResponseResult(); - var bo = ApiHelper.switchStationAttribute(model); - if (!bo) - { - result.code = 201; - } - LogHelper.Info("switchStationAttribute 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); - return result; - } - - /// <summary> - /// 8.WCS鍙嶉璐т綅鐘舵� - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - [HttpPost] - /* [Route("notifyAlarm")]*/ - public ResponseResult locStateFeedBack(LocStateFeedBackModel model) - { - LogHelper.Info("locStateFeedBack 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); - ResponseResult result = new ResponseResult(); - bool bo = ApiHelper.locStateFeedBack(model); - if (!bo) - { - result.code = 201; - } - LogHelper.Info("locStateFeedBack 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); - return result; - } - - public class LocStateFeedBackModel - { - public string loc_code { get; set; } // 绔欏彴缂栫爜 - public string type { get; set; } // 璇锋眰绫诲瀷 1 鍏佽鍙栬揣 2 鍏佽鏀捐揣 - public string req_no { get; set; } // 绔欏彴缂栫爜 - } - - public class SwitchStationAttributeModel - { - public string locCode { get; set; } // 绔欏彴缂栫爜 - public string signalType { get; set; } // 1.agv涓婃枡妯″紡 2.浜哄伐妯″紡 - } - - public class LocCntrModel - { - public string locCode { get; set; } - public string cntrCode { get; set; } - } - - public class OutStockModel - { - public string endLocCode { get; set; } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/config/config.json b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/config/config.json deleted file mode 100644 index 29127ea..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/config/config.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "HostToAgvServerUrl": "http://192.168.1.146:9988/HostToAGV.cgi", - "HASeverUrl": "http://172.16.10.41", - "SqlServer": "Data Source=192.168.1.188;Initial Catalog=OIMobox;User ID=sa;Password=Am123123", - "SqlServer1": "Data Source=192.168.1.198\\sql2008;Initial Catalog=OIMobox;User ID=sa;Password=sa@2015", - "OracleServer": "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.144)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=Jtfujian)));User Id=system;Password=Hh123321;", - "ApiPort": 8901, - "FacCode": "0000", - "WHCode": "W001", - - // cntrType 1.鑳庨潰锛�.鑳庝晶锛�.鍐呰‖锛�.甯樺竷锛�.鐜甫锛�.鍐犲甫锛�.閽㈠寘 - // type 1.鐩磋繛 2.闈炵洿杩�- "AreaProperty": [ - { - "areaCode": "TMLKQ", - "areaName": "鑳庨潰搴撲竴锛堢洿杩烇級", - "cntrType": [ 1 ], - "type": 1 - }, - { - "areaCode": "TMLKQ2", - "areaName": "鑳庨潰搴撲簩锛堥潪鐩磋繛锛�, - "cntrType": [ 1 ], - "type": 2 - }, - { - "areaCode": "TCLKQ", - "areaName": "鑳庝晶搴撲竴锛堢洿杩烇級", - "cntrType": [ 2 ], - "type": 1 - }, - { - "areaCode": "TCLKQ2", - "areaName": "鑳庝晶搴撲簩锛堥潪鐩磋繛锛�, - "cntrType": [ 2 ], - "type": 2 - }, - { - "areaCode": "NCLKQ", - "areaName": "鍐呰‖搴擄紙闈炵洿杩烇級", - "cntrType": [ 3 ], - "type": 2 - }, - { - "areaCode": "LBLKQ", - "areaName": "甯樺竷搴擄紙鐩磋繛锛�, - "cntrType": [ 4 ], - "type": 1 - }, - { - "areaCode": "LBLKQ", - "areaName": "鐜甫搴�, - "cntrType": [ 5,6 ], - "type": 2 - }, - { - "areaCode": "GBLKQ", - "areaName": "閽㈠寘搴�闈炵洿杩�", - "cntrType": [ 7 ], - "type": 2 - }, - { - "areaCode": "ZZKQ", - "areaName": "涓浆搴�闈炵洿杩�", - "cntrType": [ 7 ], - "type": 2 - } - ], - - - - - "DeviceInfo": [ - { - "address": "127.0.0.11", - "deviceName": "浜х嚎1", - "deviceNo": [], - "downLoc": "婊℃墭涓嬬嚎鐐�", - "upLoc": "婊℃墭涓嬬嚎鐐�", - "location": [ "YLWJG1005", "YLWJG1006" ], - "deviceType": 2, - "enable": 0 - - } - ], - "linePlcInfo": [ - { - "deviceNo": "1", - "address": "192.168.1.202", - "code": "鍫嗗灈鏈�", - "location": "", - "writeAddr": 0, - "readAddr": 0, - "useAddrNo": [ "01" ], - "inLoca": "DQCK-RK-1", - "outLoca": "DQCK-CK-1", - "enable": 1 - } - ], - - "PlcValue": [ - { - "address": "192.168.1.202", - "read": [ - { - "addr": 0, - "type": "Bit", - "length": 2, - "value": "" - }, - { - "addr": 2, - "type": "Int", - "length": 2, - "value": "" - }, - { - "addr": 4, - "type": "Int", - "length": 2, - "value": "" - }, - { - "addr": 18, - "type": "String", - "length": 20, - "value": "" - } - ], - "write": [ - { - "addr": 0, - "type": "Bit", - "length": 2, - "value": "" - }, - { - "addr": 2, - "type": "Int", - "length": 2, - "value": "" - }, - { - "addr": 4, - "type": "Int", - "length": 2, - "value": "" - }, - { - "addr": 18, - "type": "String", - "length": 20, - "value": "" - } - ] - } - ] - -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/config/configDesc.txt b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/config/configDesc.txt deleted file mode 100644 index 60a95ce..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/config/configDesc.txt +++ /dev/null @@ -1 +0,0 @@ -锘块厤缃鏄庯紙json閰嶇疆閲岄潰涓嶈兘鍔犳敞閲婏紝鍗曠嫭鍐欎釜璇存槑鏂囦欢锛�\ No newline at end of file diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/Monitor.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/Monitor.cs deleted file mode 100644 index 70d1b56..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/Monitor.cs +++ /dev/null @@ -1,363 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJF.models; -using HH.WCS.Mobox3.FJJT.api; -using HH.WCS.Mobox3.FJJT.device; -using HH.WCS.Mobox3.FJJT.models; -using HH.WCS.Mobox3.FJJT.process; -using HH.WCS.Mobox3.FJJT.util; -using HH.WCS.Mobox3.FJJT.wms; -using NLog.Fluent; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Web.UI.WebControls; -using static HH.WCS.Mobox3.FJJT.api.ApiHelper; -using static HH.WCS.Mobox3.FJJT.util.Settings; - -namespace HH.WCS.Mobox3.FJJT.core -{ - /// <summary> - /// 瀹氭椂杞浠诲姟 - /// </summary> - internal class Monitor - { - - /// <summary> - /// 鐩戝惉MES浠诲姟涓棿琛�- /// 1.閽㈠寘婊℃枡涓嬬嚎 - /// 2.鎴愬瀷鏈哄彨鏂�- /// </summary> - public static void MonitorMesTask() { - LogHelper.Info("鐩戝惉MES浠诲姟涓棿琛�, "WMS"); - var mesTaskList = WMSHelper.GetLjMesTaskList("PENDING"); - foreach (var mesTask in mesTaskList) - { - // 1.閽㈠寘婊℃枡涓嬬嚎 - List<string> lineLoclist = new List<string>() { }; - lineLoclist.Add("GBJTW-01"); - lineLoclist.Add("GBJTW-02"); - if (mesTask.MSG_TYPE == "1" && mesTask.PALLET_TYPE == "7" && lineLoclist.Contains(mesTask.PALLET_ID)) - { - LogHelper.Info("MES閽㈠寘婊℃枡涓嬬嚎浠诲姟", "WMS"); - OffLineRequest request = new OffLineRequest(){ loc = mesTask.POSITION_ID, cntrNo = mesTask.PALLET_ID}; - ApiHelper.offLineProcess(request); - } - - // 2.鎴愭柊鏈哄彨鏂�- if (mesTask.MSG_TYPE == "0") { - var lineSideLoc = WMSHelper.GetLineSideLoc(mesTask.POSITION_ID); - if (lineSideLoc != null ) - { - LogHelper.Info("MES鎴愭柊鏈哄彨鏂欎换鍔�, "WMS"); - - // 2.1鎴愭柊鏈哄彨鏂�鏂滆) - if (mesTask.PALLET_TYPE == "5" || mesTask.PALLET_TYPE == "6") - { - var xcTask = WMSHelper.GetLjXcTaskById(mesTask.ID); - if (xcTask == null) - { - ApiHelper.callMaterialHDK(mesTask.MATERIAL_CODE, mesTask.POSITION_ID, mesTask.ID); - } - else - { - mesTask.RETURN_CODE = xcTask.RETURN_CODE; - mesTask.RECEIVE_FLAG = xcTask.RECEIVE_FLAG; - mesTask.RECEIVE_DATE = xcTask.RECEIVE_DATE; - WMSHelper.updateLjMesTask(mesTask); - } - } - else - { - // 2.2 鎴愭柊鏈哄彨鏂�- ApiHelper.callMaterial(mesTask.MATERIAL_CODE, mesTask.POSITION_ID, mesTask.ID); - } - } - } - } - } - - /// <summary> - /// 鐩戝惉XC鍑哄簱浠诲姟涓棿琛�- /// 璇诲彇鏂滆绔嬪簱鍑哄簱浠诲姟琛紝鏌ヨ浠诲姟鏄惁鎵ц瀹屾垚锛屽畬鎴愬垯锛岃Е鍙慉GV浠诲姟 - /// </summary> - public static void MonitorXcOutTask() - { - var xcOutTasks = WMSHelper.getLjXcOutTask("PENDING", "2"); - foreach (var outTask in xcOutTasks) - { - var mesTask = WMSHelper.GetLjMesTaskById(outTask.ID); - if (mesTask != null && mesTask.RETURN_CODE == "2") - { - Location startLoc = LocationHelper.GetLoc(outTask.POSITION_ID); - Location endLoc = LocationHelper.GetLoc(mesTask.POSITION_ID); - - var wmsTask = WMSHelper.GetWmsTaskByCntr(outTask.PALLET_ID); - if (wmsTask == null) - { - if (startLoc.N_LOCK_STATE == 0 && endLoc.N_LOCK_STATE == 0) - { - // 1.鍒涘缓鏂滆-鎴愭柊鏈哄彨鏂欎綔涓�- wmsTask = new WMSTask() - { - S_CNTR_CODE = outTask.PALLET_ID, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_TYPE = "鍙枡鍑哄簱浠诲姟", - S_OP_DEF_CODE = mesTask.ID.ToString(), - S_OP_DEF_NAME = "鎴愬瀷鏈哄彨鏂欏嚭搴撲换鍔�鏂滆)", - T_START_TIME = DateTime.Now, - }; - if (WMSHelper.CreateWmsTask(wmsTask)) - { - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE, - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - } - } - } - else - { - LogHelper.Info($"XC鍑哄簱浠诲姟ID锛歿mesTask.ID},鏃犳硶鐢熸垚鍙枡浠诲姟,璧风偣鎴栫粓鐐逛笂閿�, "鏂滆"); - } - } - else - { - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE, - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = endLoc.S_CODE, - S_END_AREA = endLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "AGV", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - } - } - } - } - } - - - /// <summary> - /// 鑷姩琛ュ厖绌哄伐瑁呭埌鎺ラ┏浣�- /// </summary> - public static void AutoReplenishEmptyPallet() - { - var logicConfigs = WMSHelper.getLogicConfigByTaskType("3"); - if (logicConfigs != null && logicConfigs.Count > 0) - { - foreach (var item in logicConfigs) - { - var jbLoc = LocationHelper.GetLoc(item.S_LKKTJBLOC); - var wmsTask = WMSHelper.GetWmsTaskByEnd(item.S_LKKTJBLOC); - if (wmsTask == null && jbLoc.N_CURRENT_NUM == 0) - { - LogHelper.Info($"闈炵洿杩炴帴椹充綅:{jbLoc.S_CODE},闇�琛ュ厖绌哄伐瑁�, "WMS"); - Location startLoc = WMSHelper.getOutStockStartLoc(item.S_AREA_CODE, null); - if (startLoc != null) - { - var locCntrRels = LocationHelper.GetLocCntr(startLoc.S_CODE); - // 1.鍒涘缓鏂滆-鎴愭柊鏈哄彨鏂欎綔涓�- wmsTask = new WMSTask() - { - S_CNTR_CODE = locCntrRels[0].S_CNTR_CODE, - S_CODE = WMSHelper.GenerateTaskNo(), - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = jbLoc.S_CODE, - S_END_AREA = jbLoc.S_AREA_CODE, - S_TYPE = "绌哄伐瑁呭嚭搴�, - S_OP_DEF_NAME = "鑷姩琛ュ厖绌哄伐瑁呭埌鎺ラ┏浣�, - T_START_TIME = DateTime.Now, - }; - if (WMSHelper.CreateWmsTask(wmsTask)) - { - WCSTask wcsTask = new WCSTask() - { - S_OP_NAME = wmsTask.S_OP_DEF_NAME, - S_OP_CODE = wmsTask.S_CODE, - S_CODE = WCSHelper.GenerateTaskNo(), - S_CNTR_CODE = wmsTask.S_CNTR_CODE, - S_TYPE = wmsTask.S_TYPE, - S_START_LOC = startLoc.S_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_END_LOC = jbLoc.S_CODE, - S_END_AREA = jbLoc.S_AREA_CODE, - S_SCHEDULE_TYPE = "WCS", - N_PRIORITY = 10, - T_START_TIME = DateTime.Now, - }; - - if (WCSHelper.CreateTask(wcsTask)) - { - // 璧风偣銆佺粓鐐瑰姞閿�- LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); - LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); - - // 鏇存柊浣滀笟浠诲姟鐘舵� - wmsTask.N_B_STATE = 1; - WMSHelper.UpdateTaskState(wmsTask); - } - } - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"闈炵洿杩炴帴椹充綅:{jbLoc.S_CODE}琛ュ厖绌哄伐瑁呭け璐ワ紝鍘熷洜锛氬簱鍖猴細{item.S_AREA_CODE}娌℃湁绌哄伐瑁�); - } - } - } - } - } - - - /// <summary> - /// 涓浆搴撶┖宸ヨ鍛ㄨ浆c鍘�- /// 1.鐩戝惉MES浠诲姟锛屾煡璇㈠叆搴撲腑杞簱鐨勪换鍔�- /// 2.鏌ヨ鏄惁鍒涘缓瀵瑰簲鐨勭┖宸ヨ鍑哄簱浠诲姟 - /// 3.娌℃湁锛屽垯鏌ヨ涓浆搴撴暟閲忔弧瓒虫槸鍚﹀垱寤哄嚭搴撲换鍔�- /// </summary> - public static void ZZKInStockTaskMonitor() { - - } - - - /// <summary> - /// 鐩戝惉MES鎵樼洏涓庣墿鏂欎俊鎭〃 銆佸熀纭�墿鏂欎俊鎭〃 - /// </summary> - public static void MonitorPalletAndMateral() - { - // 1.鐩戝惉MES鎵樼洏鐗╂枡缁戝畾鍏崇郴琛紝鏇存柊瀹瑰櫒鐗╂枡琛�- LogHelper.Info("鐩戝惉鎵樼洏鐗╂枡缁戝畾鍏崇郴琛紝鏇存柊瀹瑰櫒鐗╂枡琛�, "WMS"); - WMSHelper.updatePalletAndMateral(); - - - // 2.鐩戝惉MES鐗╂枡琛紝鏇存柊鐗╂枡淇℃伅 - LogHelper.Info("鐩戝惉鐗╂枡琛紝鏇存柊鐗╂枡淇℃伅", "WMS"); - WMSHelper.updateMateral(); - } - - /// <summary> - /// 瀹氭椂鏇存柊搴撳瓨淇℃伅 鏇存柊棰戠巼锛�1鍒嗛挓 - /// </summary> - public static void UpdateInventoryRegularly() - { - var db = new SqlHelper<object>().GetInstance(); - var locations = db.Queryable<Location>() - .LeftJoin<LjLotOnhand>((a, b) => a.S_CODE == b.STORAGE_LOCATION) - .LeftJoin<LocCntrRel>((a, b, c) => a.S_CODE == c.S_LOC_CODE) - .Where((a, b, c) => b.PALLET_ID != c.S_CNTR_CODE) - .ToList(); - - foreach (var loc in locations) - { - var lotOnhand = db.Queryable<LjLotOnhand>().Where(a => a.STORAGE_LOCATION == loc.S_CODE).First(); - if (lotOnhand != null) { - db.Deleteable(lotOnhand).ExecuteCommand(); - } - - var locCntrRels = LocationHelper.GetLocCntr(loc.S_CODE); - if (locCntrRels != null && locCntrRels.Count > 0) - { - locCntrRels.ForEach(a => { - var cntrItemRels = ContainerHelper.GetCntrItemRel(a.S_CNTR_CODE); - foreach (var cntrItem in cntrItemRels) - { - var material = WMSHelper.GetMaterial(cntrItem.S_ITEM_CODE); - LjLotOnhand ljLotOnhand = new LjLotOnhand() - { - MATERIAL_CODE = cntrItem.S_ITEM_CODE, - LOT_NAME = cntrItem.S_BATCH_NO, - PALLET_ID = cntrItem.S_CNTR_CODE, - STORAGE_LOCATION = loc.S_CODE, - QC_STATUS = cntrItem.S_ITEM_STATE, - UNIT = material.S_UNIT, - QTY = cntrItem.F_QTY, - IN_DATE = cntrItem.T_INBOUND_TIME, - }; - db.Insertable(lotOnhand).ExecuteCommand(); - } - }); - } - } - } - - /// <summary> - /// 鐩戝惉鎵规鐘舵�琛紝鏇存柊鎵规鐨勬渶闀垮仠鏀炬棩鏈熷拰鏈�皬鍋滄斁鏃ユ湡 - /// 鏇存柊棰戞锛氬垎閽�- /// </summary> - public static void AutoUpdateBatchStatus() { - var db = new SqlHelper<object>().GetInstance(); - var lotStatusList = db.Queryable<LjLotStatus>().Where(a => a.RECEIVE_FLAG.Trim() == "PENDING").ToList(); - foreach (var lotStatus in lotStatusList) - { - var cntrItemRels = db.Queryable<CntrItemRel>().Where(a => a.S_ITEM_CODE.Trim() == lotStatus.MATERIAL_CODE && a.S_BATCH_NO == lotStatus.LOT_NAME).ToList(); - if (cntrItemRels != null && cntrItemRels.Count > 0) - { - foreach (var item in cntrItemRels) - { - item.D_EXP_DATE = lotStatus.SHELFLIFE_DATE; - item.D_EXP_DATE1 = lotStatus.MINSHELFLIFE_DATE; - db.Updateable(lotStatus).ExecuteCommand(); - } - } - lotStatus.RECEIVE_DATE = DateTime.Now; - lotStatus.RECEIVE_FLAG = "COMPLETE"; - db.Updateable(lotStatus).ExecuteCommand(); - } - } - - - /// <summary> - /// 鐩戝惉鐗╂枡閰嶇疆涓棿琛�- /// </summary> - public static void MonitorItemConfig() - { - - - } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/WCSCore.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/WCSCore.cs deleted file mode 100644 index 1a802e0..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/WCSCore.cs +++ /dev/null @@ -1,270 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJF.models; -using HH.WCS.Mobox3.FJJT.api; -using HH.WCS.Mobox3.FJJT.device; -using HH.WCS.Mobox3.FJJT.dispatch; -using HH.WCS.Mobox3.FJJT.process; -using HH.WCS.Mobox3.FJJT.wms; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web.Http; -using static HH.WCS.Mobox3.FJJT.api.ApiHelper; -using static HH.WCS.Mobox3.FJJT.api.ApiModel; - -namespace HH.WCS.Mobox3.FJJT.core { - internal class WCSCore { - - /// <summary> - /// AGV浠诲姟鍥炴姤 - /// 1.鏍规嵁鍥炴姤AGV浠诲姟鐘舵�锛屾洿鏂拌揣浣嶄俊鎭拰浠诲姟鐘舵� - /// 2.鍒ゆ柇WMSTask鏄惁鏄嚭搴撲换鍔★紝鏄紝濡傛灉宸ヨ鍐呮湁鐗╂枡锛屽垯鍒ゆ柇鐗╂枡鏄惁鍚堟牸锛屼笉鍚堟牸锛屽垯鐢熸垚涓嶅悎鏍煎搧鍏ュ簱浠诲姟 - /// 3.濡傛灉鍚堟牸锛屽垯瑙﹀彂浣欐枡/绌烘墭鍥炲簱浠诲姟 - /// </summary> - /// <param name="model"></param> - public static void OperateAgvTaskStatus(AgvTaskState model) { - try - { - if (string.IsNullOrEmpty(model.No)) - { - //鏃犱换鍔″彿璇锋眰(浜ょ) - //DeviceProcess.Traffic(model.ForkliftNo, model.LockNo, model.State==1023); - } - else - { - var cst = WCSHelper.GetTask(model.No); - - if (cst != null) - { - var mst = WMSHelper.GetWmsTask(cst.S_OP_CODE); - if (mst != null) - { - WCSHelper.AddActionRecord(model.No, model.State, model.ForkliftNo, model.ExtData); - if (model.State <= 7) - { - //鏈変换鍔″彿璇锋眰 - switch (model.State) - { - case 1: - WCSHelper.Begin(cst); - WMSHelper.updateMesTaskStatus(mst.S_CODE, "2"); // 鏇存柊MES浠诲姟鐘舵� - break; - #region MyRegion - case 3: - WCSHelper.UpdateStatus(cst, "寮�鍙栬揣"); - var locCntrRels = LocationHelper.GetLocCntr(cst.S_START_LOC); - if (locCntrRels.Count > 0) - { - cst.S_CNTR_CODE = locCntrRels[0].S_CNTR_CODE; - WCSHelper.UpdateWcsTask(cst); - } - break; - case 4: - WCSHelper.UpdateStatus(cst, "鍙栬揣瀹屾垚"); - TaskProcess.OperateStatus(cst, 4); - break; - case 5: - WCSHelper.UpdateStatus(cst, "寮�鍗歌揣"); - break; - case 6: - WCSHelper.UpdateStatus(cst, "鍗歌揣瀹屾垚"); - TaskProcess.OperateStatus(cst, 6); - break; - #endregion - case 2: - WCSHelper.End(cst); - break; - case 7: - TaskProcess.OperateStatus(cst, 7); - WCSHelper.Fail(cst); - break; - } - } - else if (model.State == 1012) - { - LogHelper.Info("寮�杩涜RFID鎵弿", "AGV"); - // 鏌ヨ鎵弿鐨凴FID - // 鍙戦� 00 04 71 02鍒版壂鐮佸櫒 锛屾帴鍙楄繑鍥炴暟鎹苟瑙f瀽 - /* string hexString = TcpClient.SendHexOnce("127.0.0.1", 8080, "00 04 71 02"); - var rfid = hexString.Substring(6, 8);*/ - string rfid = ""; - LogHelper.Info($"鎵弿缁撴潫锛孯FID锛歿rfid}", "AGV"); - if (rfid == cst.S_CNTR_CODE) - { - LogHelper.Info($"鎵弿RFID锛歿rfid}涓庝换鍔FID涓�嚧", "AGV"); - // 淇敼1012鐨勫弬鏁�涓� - /* NDCApi.ChangeOrderParam(cst.S_CODE, 6, "1");*/ - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "浣�, $"鎵弿RFID锛歿rfid}涓庝换鍔FID:{cst.S_CNTR_CODE}涓嶄竴鑷�, "AGV"); - // 淇敼鍙傛暟6涓� - /* NDCApi.ChangeOrderParam(cst.S_CODE, 6, "3");*/ - // 淇敼瀹瑰櫒寮傚父鐘舵� - ContainerHelper.UpdateCntrState(cst.S_CNTR_CODE, 2,$"{model.ForkliftNo}AGV鎵爜鍣�鎵弿RFID:{rfid}涓庝换鍔FID:{cst.S_CNTR_CODE}涓嶄竴鑷�); - } - } - else if (model.State == 1002) - { - LogHelper.Info("寮�鑾峰彇AGV缁堢偣", "AGV"); - // 鏇存柊AGV缁堢偣 - // 鍒ゆ柇瀹瑰櫒鏄惁寮傚父锛屼慨鏀�002鐨勭粓鐐瑰弬鏁�锛屽苟灏嗗弬鏁�淇敼涓� - Container container = ContainerHelper.GetCntr(cst.S_CNTR_CODE); - if (container != null) - { - LogHelper.Info($"瀹瑰櫒鐨勫紓甯哥姸鎬佷负锛歿container.N_E_STATE}", "AGV"); - string agvEndLoc = null; - if (container.N_E_STATE == 0) - { - agvEndLoc = ApiHelper.AGVApplyDest(model.No, cst.S_START_LOC, cst.S_CNTR_CODE, "1"); - } - else - { - agvEndLoc = ApiHelper.AGVApplyDest(model.No, cst.S_START_LOC, cst.S_CNTR_CODE, "2"); - } - - ChangeParamModel paramModel = new ChangeParamModel() - { - task_no = model.No, - param_no = 0, - param = $"{model.No};{cst.S_START_LOC};{cst.S_END_LOC};4;512;0;1" - }; - NDCApi.ChangeOrderParam(paramModel); - LogHelper.Info($"鑾峰彇AGV缁堢偣锛歿agvEndLoc}", "AGV"); - } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "涓�, $"AGV浠诲姟鍥炴姤,浠诲姟瀹瑰櫒缂栫爜:{cst.S_CNTR_CODE}鐨勫鍣ㄦ病鏈夊綍鍏ュ埌WMS绯荤粺","AGV"); - } - } - else - { - //瀹夊叏璇锋眰绛�- TaskProcess.OperateReq(model.No, model.State, model.ForkliftNo, model.ExtData); - } - - // AGV浠诲姟瀹屾垚 - if (model.State == 2) - { - // 妫�祴鐗╂枡鏄惁鍚堟牸,濡備笉鍚堟牸锛�- // 鍒ゆ柇鐗╂枡鏄惁鏄幆甯﹀簱鐗╂枡锛屾槸鍒欏洖鐜甫搴擄紝骞惰鐜甫涓嬪彂鏂扮殑鐗╂枡 - // 闈炵幆甯﹀簱鐗╂枡锛屽垯閫�嚭绔嬪簱锛屽悓鏃朵笅鍙戞柊鐨勭墿鏂欏嚭搴撲换鍔�- if (cst.S_TYPE.Contains("鍙枡鍑哄簱浠诲姟")) - { - var cntrItemRels = ContainerHelper.GetCntrItemRel(cst.S_CNTR_CODE); - if (cntrItemRels != null && cntrItemRels.Count > 0) - { - if (cntrItemRels[0].S_ITEM_STATE == "2") - { - // 涓嶅悎鏍煎搧鍥炲簱 - ApiHelper.rejectReturnStock(mst, cst); - } - } - } - - // 妫�祴鏄惁鏄鐮佷綅锛岄潪璇荤爜浣嶏紝鍙互婵�椿棰勫垱寤轰换鍔�- var transfe = WMSHelper.GetTransfeRelevance(cst.S_END_LOC); // 鎺ラ┏浣嶅睘鎬�- if ((transfe == null || transfe.N_READ_LOC == 0)) - { - if (cst.S_TYPE.Contains("銆愬紓甯搞�")) - { - WCSHelper.ActivatePreCreateTask(mst.S_CODE,1); - } - else - { - WCSHelper.ActivatePreCreateTask(mst.S_CODE); - } - } - - // 鏌ヨ鏄惁鏈夋湭瀹屾垚鐨勪换鍔�- if (WMSHelper.isFinishTask(mst.S_CODE)) - { - // 鏇存柊浣滀笟浠诲姟鐘舵� - mst.N_B_STATE = 2; - mst.T_END_TIME = DateTime.Now; - WMSHelper.UpdateTaskState(mst); - - // 鏇存柊浠诲姟涓棿琛ㄧ姸鎬�- WMSHelper.updateMesTaskStatus(mst.S_CODE, "3"); - - // 濡傛灉浣滀笟鍚嶇О涓烘垚鍨嬫満鍙枡鍑哄簱浠诲姟锛屽垯瑙﹀彂浣欐枡/绌烘墭鎼繍浠诲姟 - string locCode = WMSHelper.getReturnMaterialLocCode(mst.S_END_LOC); - ApiHelper.returnMaterialOrEmptyTray(locCode); - } - - - } - } - else - { - WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"AGV浠诲姟鐘舵�鍥炴姤锛屼綔涓氬彿:{cst.S_OP_CODE}锛屾湭鏌ヨ鍒颁綔涓�,"AGV"); - } - } - else - { - WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"AGV浠诲姟鐘舵�鍥炴姤锛屼换鍔″彿:{model.No}锛屾湭鏌ヨ鍒颁换鍔�,"AGV"); - } - } - } - catch (Exception ex) - { - WMSHelper.addAlarmRecord("绯荤粺閿欒","楂�, $"WMS鍐呴儴閿欒锛歛gv浠诲姟鐘舵�鍥炴姤閿欒锛岄敊璇師鍥�{ex.Message}","AGV"); - } - } - - /// <summary> - /// 浠诲姟鍒嗗彂锛屾牴鎹皟搴︾被鍨嬪彂缁欎笉鍚岀殑璋冨害绯荤粺 - /// </summary> - internal static void Dispatch() { - //鏌ヨ浠诲姟 - //鑾峰彇鎵�湁绛夊緟鐨勪换鍔�- var list = WCSHelper.GetWaitingTaskList(); - if (list.Count > 0) { - list.ForEach(task => { - - if (!TaskProcess.Intercept(task)) { - //浣跨敤鑷畾涔変换鍔℃帹閫�- TaskProcess.SendTask(task); - } - - }); - - - } - } - - /// <summary> - /// 鏉ゥ鍫嗗灈鏈轰俊鍙峰弽棣�- /// </summary> - /// <param name="model"></param> - internal static void OperateHATaskStatus(HanAo.TaskStateInfoModel model) { - var wcsTask = WCSHelper.GetTask(model.requestPk); - if (wcsTask != null) { - if (model.code == "0") { - // - if (wcsTask.S_TYPE == "鍫嗗灈鏈哄叆搴�) { - //缁堢偣鎵樼洏缁戝畾 - if (LocationHelper.BindingLoc(wcsTask.S_END_LOC, new List<string> { wcsTask.S_CNTR_CODE })) { - //淇敼鎵樼洏鐘舵�涓哄彲鐢紝澧炲姞搴撳瓨閲忚〃锛屽悗闈㈠垎鎷e嚭鍙互璁$畻鍒�- - - } - } - else if (wcsTask.S_TYPE == "鍫嗗灈鏈哄嚭搴�) { - //璧风偣鎵樼洏瑙g粦 - LocationHelper.UnBindingLoc(wcsTask.S_START_LOC, new List<string> { wcsTask.S_CNTR_CODE }); - } - //鏍囪浠诲姟瀹屾垚 - //鏍囪浣滀笟瀹屾垚 - wcsTask.N_B_STATE = 3; - WCSHelper.UpdateStatus(wcsTask); - var wmsTask = WMSHelper.GetWmsTask(wcsTask.S_OP_CODE); - if (wmsTask != null) { - wmsTask.N_B_STATE = 2; - WMSHelper.UpdateTaskState(wmsTask); - } - } - } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/WMSCore.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/WMSCore.cs deleted file mode 100644 index cbadd57..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/core/WMSCore.cs +++ /dev/null @@ -1,33 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.wms; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.core { - internal class WMSCore { - /// <summary> - /// 閬嶅巻瀹氱増鐨勫彂璐у崟锛岀敓浜у垎鎷e崟涓昏〃鍜屽瓙琛紙涔熷彲浠ユ墜鍔ㄨ皟鎺ュ彛瑙﹀彂锛�- /// </summary> - internal static void CheckShippingOrder() { - //1.0銆佽幏鍙栧凡缁忓畾鐗堢殑鍙戣揣鍗曪紝鐢熶骇鍒嗘嫞鍗曞瓙琛ㄥ拰涓昏〃锛岃缃�鍙戣揣鍗曘�鐨勪笟鍔$姸鎬�N_B_STATE = 1锛堝緟鍒嗘嫞锛�- //2.0銆佸鏋滃彂璐у崟C_AUTO_SORTING=Y锛屽垯鑷姩灏嗗垎鎷e崟鐘舵�璁剧疆涓哄紑濮嬮厤璐�- - } - /// <summary> - /// 寮�閰嶈揣鍒涘缓鍒嗘嫞鍗曟槑缁�鏀规垚璋冩帴鍙hЕ鍙� - /// </summary> - internal static void CheckSortingOrder() { - //new SortingOrder().N_B_STATE - //1.0銆佽幏鍙�N_B_STATE = 1 (寮�閰嶈揣)鐘舵�鐨勫垎鎷e崟 - //2.0銆侀亶鍘嗗垎鎷e崟瀛愯〃锛屽垱寤哄垎鎷e崟鏄庣粏锛屾洿鏂板垎鎷e崟瀛愯〃鐨勬槑缁嗘眹鎬籉_ACC_S_QTY - //3.0銆佸叏閮ㄥ垎鎷e崟瀛愯〃鐨勬槑缁嗗垱寤哄畬姣曪紝瀛愯〃鏄庣粏姹囨�鍜屽瓙琛ㄦ暟閲忎竴鑷达紝鏇存柊鍒嗘嫞鍗曠姸鎬侊紝N_B_STATE = 2閰嶈揣瀹屾垚 - //4.0銆佸鏋滃垎鎷e崟鏄嚜鍔ㄤ綔涓氾紝灏辩洿鎺ユ洿鏂板埌 N_B_STATE = 3寮�浣滀笟 - //WMSHelper.GetWaitingSortingOrderList(); - - } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/ModbusHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/ModbusHelper.cs deleted file mode 100644 index 30b1d16..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/ModbusHelper.cs +++ /dev/null @@ -1,234 +0,0 @@ -锘縰sing EasyModbus; -using HH.WCS.Mobox3.FJJT; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.JunzhouNongfu.device -{ - /// <summary> - /// modbus tcp 鐢ㄧ涓夋柟鐨勫寘 - /// </summary> - internal static class ModbusHelper - { - private static Dictionary<string, ModbusClient> clients = new Dictionary<string, ModbusClient>(); - - /// <summary> - /// 璇荤嚎鍦�- /// </summary> - /// <param name="address"></param> - /// <param name="qty"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - /// <returns></returns> - internal static bool[] ReadCoils(int address, int qty, string ip, int port = 502) { - bool[] res = new bool[0]; - var client = GetClient(ip, port); - if (client != null && client.Connected) { - try { - res = client.ReadCoils(address, qty); - } - catch (Exception ex) { - //LogHelper.Error(ex.Message, ex); - } - } - return res; - - } - /// <summary> - /// 璇荤鏁h緭鍏�- /// </summary> - /// <param name="address"></param> - /// <param name="qty"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - /// <returns></returns> - internal static bool[] ReadDiscreteInputs(int address, int qty, string ip, int port = 502) { - bool[] res = new bool[0]; - var client = GetClient(ip, port); - if (client != null && client.Connected) { - try { - res = client.ReadDiscreteInputs(address, qty); - } - catch (Exception ex) { - //LogHelper.Error(ex.Message, ex); - } - } - return res; - - } - /// <summary> - /// 璇讳繚鎸佸瘎瀛樺櫒 - /// </summary> - /// <param name="address"></param> - /// <param name="qty"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - /// <returns></returns> - internal static int[] ReadHoldingRegisters(int address, int qty, string ip, int port = 502) { - int[] res = new int[0]; - var client = GetClient(ip, port); - if (client != null && client.Connected) { - try { - //涓�釜瀵勫瓨鍣ㄦ槸16浣嶏紝杩斿洖2涓猧nt绫诲瀷 - res = client.ReadHoldingRegisters(address, qty); - if (res != null) { - Console.WriteLine($"璇诲瘎瀛樺櫒{ip},address={address},qty={qty},length={res.Length},res={string.Join(",", res)}"); - } - else { - Console.WriteLine($"璇诲瘎瀛樺櫒{ip},address={address},qty={qty},澶辫触"); - } - } - catch (Exception ex) { - Console.WriteLine("ReadHoldingRegisters:err=" + ex.Message); - } - } - else { - Console.WriteLine($"{ip}杩炴帴宸茬粡鏂紑"); - } - return res; - } - /// <summary> - /// 璇昏緭鍏ュ瘎瀛樺櫒 - /// </summary> - /// <param name="address"></param> - /// <param name="qty"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - /// <returns></returns> - internal static int[] ReadInputRegisters(int address, int qty, string ip, int port = 502) { - int[] res = new int[0]; - var client = GetClient(ip, port); - if (client != null && client.Connected) { - try { - res = client.ReadInputRegisters(address, qty); - } - catch (Exception ex) { - //LogHelper.Error(ex.Message, ex); - } - } - return res; - - } - /// <summary> - /// 鍐欏崟涓嚎鍦�- /// </summary> - /// <param name="address"></param> - /// <param name="value"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - internal static bool WriteSingleCoil(int address, bool value, string ip, int port = 502) { - var res = false; - var client = GetClient(ip, port); - if (client != null && client.Connected) { - try { - client.WriteSingleCoil(address, value); - res = true; - } - catch (Exception ex) { - //LogHelper.Error(ex.Message, ex); - } - } - return res; - - } - /// <summary> - /// 鍐欏涓嚎鍦�- /// </summary> - /// <param name="address"></param> - /// <param name="values"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - internal static bool WriteMultipleCoils(int address, bool[] values, string ip, int port = 502) { - var res = false; - var client = GetClient(ip, port); - if (client != null && client.Connected) { - try { - client.WriteMultipleCoils(address, values); - res = true; - } - catch (Exception ex) { - //LogHelper.Error(ex.Message, ex); - } - } - return res; - - } - /// <summary> - /// 鍐欏崟涓瘎瀛樺櫒 - /// </summary> - /// <param name="address"></param> - /// <param name="value"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - internal static bool WriteSingleRegister(int address, int value, string ip, int port = 502) { - var res = false; - var client = GetClient(ip, port); - if (client != null && client.Connected) { - try { - client.WriteSingleRegister(address, value); - res = true; - Console.WriteLine($"鍐欏瘎瀛樺櫒{ip},address={address},value={value},鎴愬姛"); - - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - Console.WriteLine($"鍐欏瘎瀛樺櫒{ip},address={address},value={value},澶辫触"); - } - } - return res; - } - /// <summary> - /// 鍐欏涓瘎瀛樺櫒 - /// </summary> - /// <param name="address"></param> - /// <param name="values"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - internal static bool WriteMultipleRegisters(int address, int[] values, string ip, int port = 502) { - var res = false; - var client = GetClient(ip, port); - if (client != null && client.Connected) { - try { - client.WriteMultipleRegisters(address, values); - res = true; - } - catch (Exception ex) { - //LogHelper.Error(ex.Message, ex); - } - } - return res; - } - private static ModbusClient GetClient(string ip, int port) { - ModbusClient client = null; - if (!clients.ContainsKey(ip)) { - client = new ModbusClient(ip, port); - try { - client.Connect(); - clients[ip] = client; - } - catch (Exception ex) { - //LogHelper.Error(ex.Message, ex); - Console.WriteLine($"杩炴帴plc澶辫触{ip},err=" + ex.Message); - } - } - else { - client = clients[ip]; - if (!clients[ip].Connected) { - try { - clients[ip].Connect(); - - } - catch (Exception ex) { - //LogHelper.Error(ex.Message, ex); - Console.WriteLine($"杩炴帴plc澶辫触{ip},err=" + ex.Message); - } - } - - } - return client; - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/PlcHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/PlcHelper.cs deleted file mode 100644 index ec945ed..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/PlcHelper.cs +++ /dev/null @@ -1,99 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.process; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.device -{ - internal class PlcHelper - { - internal static void Receive(string ip, string msg) { - //澶勭悊璁惧淇″彿 - DeviceProcess.Analysis(msg, ip); - } - internal static bool SendHex(string ip, string msg) { - return TcpServer.TcpServerSend(ip, Hex2Bytes(msg)); - - } - internal static void SendAscii(string ip, string msg) { - TcpServer.TcpServerSend(ip, Encoding.ASCII.GetBytes(msg)); - } - - internal static byte[] Hex2Bytes(string hexString) { - hexString = hexString.Replace(" ", ""); - if ((hexString.Length % 2) != 0) - hexString += " "; - byte[] returnBytes = new byte[hexString.Length / 2]; - for (int i = 0; i < returnBytes.Length; i++) - returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); - - return returnBytes; - } - internal static string Hex2Ascii(string hexString) { - hexString = hexString.Replace(" ", ""); - if ((hexString.Length % 2) != 0) - hexString += " "; - byte[] returnBytes = new byte[hexString.Length / 2]; - for (int i = 0; i < returnBytes.Length; i++) - returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); - - return Encoding.ASCII.GetString(returnBytes); - } - - #region 杩涘埗杞崲+CRC - internal static bool CheckCRC(string hex) { - var result = false; - var data = hex.Replace(" ", ""); - if (data.Length % 2 == 0) { - var code1 = data.Substring(data.Length - 4, 4).ToLower(); - var code2 = BitConverter.ToString(CRC16LH(Hex2Bytes(data.Substring(0, data.Length - 4)))).Replace("-", "").Replace(" ", "").ToLower(); - result = code1 == code2; - } - return result; - } - internal static byte[] CRC16LH(byte[] pDataBytes) { - ushort crc = 0xffff; - ushort polynom = 0xA001; - - for (int i = 0; i < pDataBytes.Length; i++) { - crc ^= pDataBytes[i]; - for (int j = 0; j < 8; j++) { - if ((crc & 0x01) == 0x01) { - crc >>= 1; - crc ^= polynom; - } - else { - crc >>= 1; - } - } - } - - byte[] result = BitConverter.GetBytes(crc); - return result; - } - internal static byte[] CRC16HL(byte[] pDataBytes) { - ushort crc = 0xffff; - ushort polynom = 0xA001; - - for (int i = 0; i < pDataBytes.Length; i++) { - crc ^= pDataBytes[i]; - for (int j = 0; j < 8; j++) { - if ((crc & 0x01) == 0x01) { - crc >>= 1; - crc ^= polynom; - } - else { - crc >>= 1; - } - } - } - - byte[] result = BitConverter.GetBytes(crc).Reverse().ToArray(); - return result; - } - - #endregion - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/S7Helper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/S7Helper.cs deleted file mode 100644 index 673a5d9..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/S7Helper.cs +++ /dev/null @@ -1,776 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.api; -using HH.WCS.Mobox3.FJJT.util; -using Newtonsoft.Json.Linq; -using S7.Net; -using S7.Net.Types; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Web.Services.Description; -using static HH.WCS.Mobox3.FJJT.util.Settings; - -namespace HH.WCS.Mobox3.FJJT.device -{ - - /// <summary> - /// 瑗块棬瀛恜lc - /// </summary> - public class S7Helper - { - private static bool debug = true; - private static S7.Net.Plc plc = null; - static S7Helper() - { - Init(); - } - private static Dictionary<string, Plc> plcDic = new Dictionary<string, Plc>(); - private static void Init() - { - //閰嶇疆鏂囦欢璇诲彇鎵�湁鐨刾lc杩涜鍒濆鍖�- try - { - var plc1 = new Plc(CpuType.S71500, "", 0, 1); - plcDic.Add("plc1", plc1); - Link(plc1); - } - catch (Exception ex) - { - - Console.WriteLine("S7Helper Init err=" + ex.Message); - } - } - private static Plc GetPlc(string plc) - { - if (plcDic.ContainsKey(plc)) - { - return plcDic[plc]; - } - else - { - return null; - } - } - public static Dictionary<string, string> s7TestData = new Dictionary<string, string>(); - private static void Link(Plc plc) - { - try - { - //if (!plc.IsConnected) { - plc.Close(); - plc.Open(); - if (plc.IsConnected) - { - Console.WriteLine($"宸茶繛鎺ュ埌plc{plc.IP}"); - } - else - { - Console.WriteLine($"plc{plc.IP}杩炴帴澶辫触"); - LogHelper.Info($"plc{plc.IP}杩炴帴澶辫触", "Plc"); - } - - //} - } - catch (Exception ex) - { - Console.WriteLine($"plc{plc.IP}杩炴帴澶辫触锛宔rr={ex.Message}"); - LogHelper.Info($"plc{plc.IP}杩炴帴澶辫触锛宔rr={ex.Message}"); - //Init(); - } - - } - //https://www.ad.siemens.com.cn/productportal/Prods/S7-1200_PLC_EASY_PLUS/SmartSMS/060.html - //https://www.ad.siemens.com.cn/productportal/Prods/S7-1200_PLC_EASY_PLUS/07-Program/02-basic/01-Data_Type/09-String.html - - - - internal static short[] ReadInt(string device, int db, int byteAddr, int count) - { - short[] result = null; - try - { - if (debug) - { - var s7Key = $"int_{db}_{byteAddr}_{count}"; - if (s7TestData.ContainsKey(s7Key)) - { - var data = s7TestData[s7Key].Split(','); - if (data.Length == count) - { - result = Array.ConvertAll(data, s => short.Parse(s)); - } - else - { - result = new short[count]; - s7TestData[s7Key] = string.Join(",", result); - } - Console.WriteLine($"璇诲彇plc {device}淇℃伅鎴愬姛锛� addr={byteAddr} data={string.Join(",", result)}"); - } - } - else - { - var plc = GetPlc(device); - if (plc != null) - { - if (plc.IsConnected) - { - result = (short[])plc.Read(DataType.DataBlock, db, byteAddr, VarType.Int, count, 0); - Console.WriteLine($"璇诲彇plc {device}淇℃伅鎴愬姛锛宨p={plc.IP} addr={byteAddr} data={string.Join(",", result)}"); - if (result.Length == 0) - { - Console.WriteLine($"plc {device}鍑嗗閲嶆柊杩炴帴"); - Link(plc); - } - } - else - { - Console.WriteLine($"鍑嗗杩炴帴plc {device}"); - Link(plc); - } - } - else - { - Console.WriteLine($"plc {device}涓嶅瓨鍦�); - } - - } - - } - catch (Exception ex) - { - Console.WriteLine($"ReadInt锛宒evice={device} addr={byteAddr} count={count} err={ex.Message}"); - LogHelper.Error($"ReadInt锛宒evice={device} addr={byteAddr} count={count} err={ex.Message}", ex); - } - return result; - } - - /// <summary> - /// - /// </summary> - /// <param name="db"></param> - /// <param name="byteAddr"></param> - /// <param name="data"></param> - /// <returns></returns> - internal static bool WriteInt(int db, int byteAddr, short data) - { - var result = false; - try - { - if (plc.IsConnected) - { - plc.Write(DataType.DataBlock, db, byteAddr, data); - Console.WriteLine($"鍐欏叆plc淇℃伅锛宨p={plc.IP} addr={byteAddr} data={data} "); - LogHelper.Info($"鍐欏叆plc淇℃伅锛宨p={plc.IP} addr={byteAddr} data={data} "); - if (result) - { - //鍐欏畬鍐嶈涓�纭 - var readData = (short)plc.Read(DataType.DataBlock, db, byteAddr, VarType.Int, 1, 0); - Console.WriteLine($"璇诲彇plc淇℃伅锛宨p={plc.IP} addr={byteAddr} data={data} res={string.Join(", ", readData)}"); - LogHelper.Info($"璇诲彇plc淇℃伅锛宨p={plc.IP} addr={byteAddr} data={data} res={string.Join(", ", readData)}", "PLC"); - result = readData == data; - } - - - } - else - { - Console.WriteLine("鍑嗗杩炴帴plc1"); - Link(plc); - } - } - catch (Exception ex) - { - LogHelper.Error($"鍐欏叆plc1淇℃伅澶辫触锛宨p={plc.IP} addr={byteAddr} data={data} err={ex.Message}", ex); - } - return result; - } - public static object ReadBit(string device, int db, int byteAddr, byte bitAddr) - { - object result = null; - try - { - if (debug) - { - var s7Key = $"bit_{db}_{byteAddr}_{bitAddr}"; - if (s7TestData.ContainsKey(s7Key)) - { - var data = s7TestData[s7Key]; - if (data == "1") - { - result = true; - } - else { result = false; } - Console.WriteLine($"璇诲彇plc {device}淇℃伅鎴愬姛锛� addr={byteAddr} data={result.ToString()}"); - } - } - else - { - var plc = GetPlc(device); - if (plc != null) - { - if (plc.IsConnected) - { - result = plc.Read(DataType.DataBlock, db, byteAddr, VarType.Int, 1, bitAddr); - Console.WriteLine($"璇诲彇plc {device}淇℃伅鎴愬姛锛宨p={plc.IP} addr={byteAddr} data={result.ToString()}"); - } - else - { - Console.WriteLine($"鍑嗗杩炴帴plc {device}"); - Link(plc); - } - } - else - { - Console.WriteLine($"plc {device}涓嶅瓨鍦�); - } - } - } - catch (Exception ex) - { - Console.WriteLine($"ReadBit锛宒evice={device} addr={byteAddr} bit={bitAddr} err={ex.Message}"); - LogHelper.Error($"ReadBit锛宒evice={device} addr={byteAddr} bit={bitAddr} err={ex.Message}", ex); - } - return result; - } - public static string ReadStr(string device, int db, int byteAddr, int count) - { - string result = string.Empty; - try - { - if (debug) - { - var s7Key = $"str_{db}_{byteAddr}_{count}"; - if (s7TestData.ContainsKey(s7Key)) - { - var data = s7TestData[s7Key]; - if (data.Length == count) - { - result = data; - Console.WriteLine($"ReadStr 鎴愬姛锛�addr={byteAddr} res={result}"); - } - } - } - else - { - if (plc.IsConnected) - { - result = plc.Read(DataType.DataBlock, 100, byteAddr, VarType.String, count, 0).ToString(); - Console.WriteLine($"ReadStr 鎴愬姛锛宨p={plc.IP} addr={byteAddr} res={result}"); - if (result.Length == 0) - { - Link(plc); - } - } - else - { - Console.WriteLine("鍑嗗杩炴帴plc"); - Link(plc); - } - } - } - catch (Exception ex) - { - Console.WriteLine($"ReadStr锛宒evice={device} addr={byteAddr} count={count} err={ex.Message}"); - LogHelper.Error($"ReadStr锛宒evice={device} addr={byteAddr} count={count} err={ex.Message}", ex); - } - return result; - } - - #region 鎵归噺鍐欏叆 璇诲彇 - - /// <summary> - /// s7鍐欏叆鍙栧�鏂规硶 - /// </summary> - public static void Write() - { - var plcInfo = Settings.linePlcInfo.Where(a => (a.deviceNo == "1") && a.enable == 1).FirstOrDefault(); - - //鑾峰彇閰嶇疆鏂囦欢鍐欏叆鐨勫湴鍧�- List<S7Model> writemodels = Settings.plcValue.Find(a => a.address == plcInfo.address).read; - - if (writemodels.Count > 0) - { - writemodels.Find(a => a.addr == 0).value = "1"; - writemodels.Find(a => a.addr == 2).value = "2"; - writemodels.Find(a => a.addr == 4).value = "4"; - writemodels.Find(a => a.addr == 18).value = "TP24121108"; - byte[] bytes = GetWriteByte(writemodels); - if (PLCWrite(plcInfo, 100, bytes)) - { - Console.WriteLine("鍐欏叆鎴愬姛"); - //鍐欏叆鎴愬姛鏍¢獙鏁版嵁 - Read(); - if (Dictvalues[plcInfo.address].Find(a => a.addr == 2).value == "2") - { - Console.WriteLine("鏁版嵁鏍¢獙鎴愬姛锛屼慨鏀逛换鍔$姸鎬�); - } - } - else - { - Console.WriteLine("鍐欏叆澶辫触"); - } - } - - - } - - /// <summary> - /// 灏嗚鍐欑殑鏁版嵁杞崲鎴恇yte - /// </summary> - /// <param name="writemodels"></param> - /// <returns></returns> - public static byte[] GetWriteByte(List<S7Model> writemodels) - { - var model = writemodels.OrderByDescending(a => a.addr).First(); - var readlen = model.addr + model.length; - byte[] bytes = new byte[readlen]; - - foreach (var item in writemodels) - { - if (!string.IsNullOrEmpty(item.value)) - { - //杞崲byte - switch (item.type) - { - case "Int": - case "Bit": - bytes[item.addr] = (byte)((uint)(int.Parse(item.value) >> 8) & 0xFFu); - bytes[item.addr + 1] = (byte)((uint)(int.Parse(item.value) >> 0) & 0xFFu); - break; - case "DInt": - case "Real": - bytes[item.addr] = (byte)((uint)(int.Parse(item.value) >> 24) & 0xFFu); - bytes[item.addr + 1] = (byte)((uint)(int.Parse(item.value) >> 16) & 0xFFu); - bytes[item.addr + 2] = (byte)((uint)(int.Parse(item.value) >> 8) & 0xFFu); - bytes[item.addr + 3] = (byte)((uint)(int.Parse(item.value) >> 0) & 0xFFu); - break; - case "String": - case "Byte": - var bytevalue = Encoding.UTF8.GetBytes(item.value); - if (bytevalue.Count() <= item.length) - { - for (int i = 0; i < bytevalue.Count(); i++) - { - - bytes[item.addr + item.length - bytevalue.Count() + i] = bytevalue[i]; - } - } - break; - } - } - - } - return bytes; - } - - public static Dictionary<string, List<S7Model>> Dictvalues = new Dictionary<string, List<S7Model>>(); - - /// <summary> - /// s7璇诲彇鏂规硶 - /// </summary> - public static void Read() - { - var plcInfo = Settings.linePlcInfo.Where(a => (a.deviceNo == "1") && a.enable == 1).FirstOrDefault(); - var bytes = new byte[0]; - //鑾峰彇閰嶇疆鏂囦欢璇诲彇鐨勫湴鍧�- List<S7Model> readmodels = Settings.plcValue.Find(a => a.address == plcInfo.address).read; - if (readmodels.Count > 0) - { - //鑾峰彇璇诲彇闀垮害 - - var model = readmodels.OrderByDescending(a => a.addr).First(); - var readlen = model.addr + model.length; - PLCRead(plcInfo, 100, 0, readlen, out bytes); - - //灏嗛厤缃枃浠堕厤缃殑鍋忕Щ閲忚浆鎹㈠瓨鏀惧埌瀛楀吀閲�- // List<S7Value> s7Values = new List<S7Value>(); - foreach (var item in readmodels) - { - //瑙f瀽鏁版嵁 - string value = ""; - switch (item.type) - { - case "Int": - value = GetInt(bytes, item.addr, VarType.Int).ToString(); - break; - case "DInt": - value = GetInt(bytes, item.addr, VarType.DInt).ToString(); - break; - case "Real": - value = GetInt(bytes, item.addr, VarType.Real).ToString(); - break; - case "String": - value = GetString(bytes, item.addr, VarType.String, item.length).ToString(); - break; - //case "Byte": - // value = S7Help.GetInt(bytes, item.addr, VarType.Byte,item.length).ToString(); - // break; - } - item.value = value; - // s7Values.Add(new S7Value { addr = item.addr, type = item.type, value = value }); - } - //鏁版嵁瀛樺叆瀛楀吀 - if (Dictvalues.Keys.Contains(plcInfo.address)) - { - Dictvalues[plcInfo.address] = readmodels; - } - else - { - Dictvalues.Add(plcInfo.address, readmodels); - - } - } - - } - /// <summary> - /// S7鍐欏叆byte鏁扮粍 - /// </summary> - /// <param name="plcInfo">閰嶇疆鏂囦欢</param> - /// <param name="db">DB鍧�/param> - /// <param name="bytes"></param> - /// <returns></returns> - public static bool PLCWrite(Settings.LinePlcInfo plcInfo, int db, byte[] bytes) - { - bool result = false; - var plc = new Plc(CpuType.S71500, plcInfo.address, 0, 1); - Link(plc); - - try - { - result = plc.WriteBytes(DataType.DataBlock, Convert.ToInt16(db), Convert.ToInt16(plcInfo.writeAddr), bytes) == ErrorCode.NoError; - return result; - } - catch (Exception ex) - { - - throw ex; - } - } - - /// <summary> - /// S7璇诲彇byte鏁扮粍 - /// </summary> - /// <param name="plcInfo">閰嶇疆鏂囦欢</param> - /// <param name="db">DB鍧�/param> - /// <param name="addr">璇诲彇璧峰鍋忕Щ閲�/param> - /// <param name="bytes">杈撳嚭byte</param> - /// <returns></returns> - public static bool PLCRead(Settings.LinePlcInfo plcInfo, int db, int addr, int len, out byte[] bytes) - { - - bool result = false; - var plc = new Plc(CpuType.S71500, plcInfo.address, 0, 1); - Link(plc); - - string res = string.Empty; - bytes = new byte[len]; - try - { - if (plcInfo != null) - { - - bytes = plc.ReadBytes(DataType.DataBlock, Convert.ToInt16(db), Convert.ToInt16(plcInfo.readAddr + addr), len); - var r1 = "new byte[] {" + string.Join(",", bytes) + " }"; - res = $" B{db} A{addr} L{len} A{r1}"; - - } - else - { - res = " 娌¤澶囥�"; - } - } - catch (Exception ex) - { - res = "Err" + ex.Message + ex.StackTrace; - } - - // result = plc.WriteBytes(DataType.DataBlock, Convert.ToInt16(1000), Convert.ToInt16(linePlcInfo.writeAddr + 6), bytes) == ErrorCode.NoError; - return result; - } - - /// <summary> - /// 瑙f瀽鍫嗗灈鏈篵yte鏁扮粍int绫诲瀷 - /// </summary> - /// <param name="adr">鍋忕Щ閲�/param> - /// <param name="varType">绫诲瀷</param> - /// <param name="action">瑙f瀽澶辫触璋冨彇鏂规硶鍗曚釜璇诲彇</param> - /// <returns></returns> - public static int GetInt(byte[] bytes, int adr, VarType varType, Func<int> action = null) - { - var b = -1; - byte[] by = new byte[0]; - - by = bytes; - - if (by.Count() > 0) - { - b = GetInt(adr, varType, by); - } - if (b == -1 && action != null) - { - b = action(); - } - - - return b; - } - - public static int GetInt(int adr, VarType varType, byte[] d, int length = 1) - { - //璁$畻绫诲瀷闀垮害锛宻tring绫诲瀷涓哄彲鍙橀暱搴︾敤閰嶇疆鏂囦欢瀹氫箟鐨勯暱搴�- var vlen = VarTypeToByteLength(varType); - if (varType == VarType.String) - { - vlen = length; - } - - if (adr + vlen > d.Length) - { - return -1; - } - - var adrbyte = d.Skip(adr).Take(vlen).ToArray(); - var obj = ParseBytes(varType, adrbyte, 1, 0); - return Convert.ToInt32(obj); - } - /// <summary> - /// 瑙f瀽string绫诲瀷 - /// </summary> - /// <param name="bytes"></param> - /// <param name="adr"></param> - /// <param name="varType"></param> - /// <param name="count"></param> - /// <param name="action"></param> - /// <returns></returns> - public static string GetString(byte[] bytes, int adr, VarType varType, int count, Func<int> action = null) - { - string b = null; - byte[] by = new byte[0]; - - by = bytes; - - if (by.Count() > 0) - { - b = GetString(adr, varType, by, count); - } - if (string.IsNullOrEmpty(b) && action != null) - { - b = action().ToString(); - } - - - return b; - } - public static string GetString(int adr, VarType varType, byte[] d, int length = 1) - { - //璁$畻绫诲瀷闀垮害锛宻tring绫诲瀷涓哄彲鍙橀暱搴︾敤閰嶇疆鏂囦欢瀹氫箟鐨勯暱搴�- var vlen = VarTypeToByteLength(varType); - if (varType == VarType.String) - { - vlen = length; - } - - if (adr + vlen > d.Length) - { - return ""; - } - - var adrbyte = d.Skip(adr).Take(vlen).ToArray(); - adrbyte = adrbyte.Skip(adrbyte.ToList().FindIndex(x => x > 0)).ToArray(); - var obj = ParseBytes(varType, adrbyte, 1, 0); - return obj.ToString(); - } - - private static int VarTypeToByteLength(VarType varType, int varCount = 1) - { - switch (varType) - { - case VarType.Bit: - return varCount; - case VarType.Byte: - if (varCount >= 1) - { - return varCount; - } - - return 1; - case VarType.String: - return varCount; - case VarType.StringEx: - return varCount + 2; - case VarType.Word: - case VarType.Int: - case VarType.Timer: - case VarType.Counter: - return varCount * 2; - case VarType.DWord: - case VarType.DInt: - case VarType.Real: - return varCount * 4; - default: - return 0; - } - } - private static object ParseBytes(VarType varType, byte[] bytes, int varCount, byte bitAdr = 0) - { - if (bytes == null) - { - return null; - } - - switch (varType) - { - case VarType.Byte: - if (varCount == 1) - { - return bytes[0]; - } - - return bytes; - case VarType.Word: - if (varCount == 1) - { - return Word.FromByteArray(bytes); - } - - return Word.ToArray(bytes); - case VarType.Int: - if (varCount == 1) - { - return Int.FromByteArray(bytes); - } - - return Int.ToArray(bytes); - case VarType.DWord: - if (varCount == 1) - { - return DWord.FromByteArray(bytes); - } - - return DWord.ToArray(bytes); - case VarType.DInt: - if (varCount == 1) - { - return DInt.FromByteArray(bytes); - } - - return DInt.ToArray(bytes); - case VarType.Real: - if (varCount == 1) - { - return S7.Net.Types.Double.FromByteArray(bytes); - } - - return S7.Net.Types.Double.ToArray(bytes); - case VarType.String: - return S7.Net.Types.String.FromByteArray(bytes); - case VarType.StringEx: - return StringEx.FromByteArray(bytes); - case VarType.Timer: - if (varCount == 1) - { - return S7.Net.Types.Timer.FromByteArray(bytes); - } - - return S7.Net.Types.Timer.ToArray(bytes); - case VarType.Counter: - if (varCount == 1) - { - return Counter.FromByteArray(bytes); - } - - return Counter.ToArray(bytes); - case VarType.Bit: - if (varCount == 1) - { - if (bitAdr > 7) - { - return null; - } - - return Bit.FromByte(bytes[0], bitAdr); - } - - return Bit.ToBitArray(bytes); - default: - return null; - } - } - #endregion - - #region 鐢ㄤ簬妯℃嫙娴嬭瘯 - /// <summary> - /// short绫诲瀷锛屼竴涓崰2涓猙yte - /// </summary> - public class DBWModel - { - public int db { get; set; } - public int byteAddr { get; set; } - /// <summary> - /// int绫诲瀷闇�鐢ㄩ�鍙峰垎寮�紝string涓嶉渶瑕�- /// </summary> - public string value { get; set; } - } - /// <summary> - /// 瀛楃涓茬被鍨嬶紝涓�釜鍗�涓猙yte - /// </summary> - public class DBBModel - { - public int db { get; set; } - public int byteAddr { get; set; } - public string value { get; set; } - } - public class DBXModel - { - public int db { get; set; } - public int byteAddr { get; set; } - public int bitAddr { get; set; } - /// <summary> - /// 1:true 0:false - /// </summary> - public int value { get; set; } - } - public static void s7SetInt(DBWModel model) - { - var data = model.value.Replace(",", ""); - var s7Key = $"int_{model.db}_{model.byteAddr}_{data.Length}"; - if (s7TestData.ContainsKey(s7Key)) - { - s7TestData[s7Key] = model.value; - } - else - { - s7TestData.Add(s7Key, model.value); - } - } - - internal static void s7SetBit(DBXModel model) - { - var s7Key = $"bit_{model.db}_{model.byteAddr}_{model.bitAddr}"; - var value = model.value == 1 ? "1" : "0"; - if (s7TestData.ContainsKey(s7Key)) - { - s7TestData[s7Key] = value; - } - else - { - s7TestData.Add(s7Key, value); - } - } - - internal static void s7SetStr(DBBModel model) - { - var s7Key = $"str_{model.db}_{model.byteAddr}_{model.value.Length}"; - if (s7TestData.ContainsKey(s7Key)) - { - s7TestData[s7Key] = model.value; - } - else - { - s7TestData.Add(s7Key, model.value); - } - } - } - #endregion -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/TcpClient.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/TcpClient.cs deleted file mode 100644 index 6529f6b..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/TcpClient.cs +++ /dev/null @@ -1,85 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT; -using HH.WCS.Mobox3.FJJT.device; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.device { - internal class TcpClient - { - /// <summary> - /// - /// </summary> - /// <param name="ip">127.0.0.1</param> - /// <param name="port">8888</param> - /// <param name="hex">01 02 00 00 00 0C 78 0F</param> - /// <returns></returns> - public static string SendHexOnce(string ip, int port, string hex) { - var res = string.Empty; - Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - client.Connect(ip, port); - client.ReceiveTimeout = 2000; - if (client.Connected) { - client.Send(PlcHelper.Hex2Bytes(hex)); - byte[] buffer = new byte[1024]; - try { - var length = client.Receive(buffer, SocketFlags.None); - byte[] data = new byte[length]; - Array.Copy(buffer, data, length); - res = BitConverter.ToString(data).Replace("-", ""); - } - catch (Exception ex) { - LogHelper.Error(ex.Message, ex); - } - client.Disconnect(true); - client.Dispose(); - } - client = null; - return res; - } - - /// <summary> - /// 璇讳繚鎸佸瘎瀛樺櫒锛宮odbus rtu鐨勫皝瑁�- /// </summary> - /// <param name="address"></param> - /// <param name="qty"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - /// <returns></returns> - internal int[] ReadInputRegistersRtu(int address, int qty, string ip, int port = 502) { - List<int> res = new List<int>(); - var hex = $"0103{address.ToString("X4")}{qty.ToString("X4")}"; - hex = hex + BitConverter.ToString(PlcHelper.CRC16LH(PlcHelper.Hex2Bytes(hex))).Replace("-", "").Replace(" ", ""); - var data = SendHexOnce(ip, port, hex); - if (!string.IsNullOrEmpty(data)) { - if (PlcHelper.CheckCRC(data)) { - var lenght = Convert.ToInt16(data.Substring(4, 2), 16) / 2; - for (int i = 0; i < lenght; i++) { - res[i] = Convert.ToInt16(data.Substring(6 + 4 * 1, 4), 16); - } - } - } - return res.ToArray(); - } - /// <summary> - /// 鍐欏崟涓瘎瀛樺櫒 - /// </summary> - /// <param name="address"></param> - /// <param name="value"></param> - /// <param name="ip"></param> - /// <param name="port"></param> - internal bool WriteSingleRegisterRtu(int address, int value, string ip, int port = 502) { - var res = false; - var hex = $"0106{address.ToString("X4")}{value.ToString("X4")}"; - hex = hex + BitConverter.ToString(PlcHelper.CRC16LH(PlcHelper.Hex2Bytes(hex))).Replace("-", "").Replace(" ", ""); - var data = SendHexOnce(ip, port, hex); - if (!string.IsNullOrEmpty(data)) { - res = true; - } - return res; - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/TcpServer.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/TcpServer.cs deleted file mode 100644 index d547de8..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/device/TcpServer.cs +++ /dev/null @@ -1,143 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Sockets; - -namespace HH.WCS.Mobox3.FJJT.device -{ - public class TcpServer - { - public TcpServer(string ip) { - Init(ip); - } - private void Init(string ip) { - //鍒涘缓涓�釜鏂扮殑Socket,杩欓噷鎴戜滑浣跨敤鏈�父鐢ㄧ殑鍩轰簬TCP鐨凷tream Socket锛堟祦寮忓鎺ュ瓧锛�- var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - try { - //灏嗚socket缁戝畾鍒颁富鏈轰笂闈㈢殑鏌愪釜绔彛锛岀鍙e簲璇ユ斁鍒伴厤缃枃浠朵腑 - socket.Bind(new IPEndPoint(IPAddress.Parse(ip), 2023)); - Console.WriteLine(2023); - //鍚姩鐩戝惉锛屽苟涓旇缃竴涓渶澶х殑闃熷垪闀垮害 - socket.Listen(30); - //寮�鎺ュ彈瀹㈡埛绔繛鎺ヨ姹�- socket.BeginAccept(new AsyncCallback(ClientAccepted), socket); - } - catch (Exception e) { - Console.WriteLine(e.Message); - } - } - public static Dictionary<string, Socket> clients = new Dictionary<string, Socket>(); - public static Dictionary<string, byte[]> buffers = new Dictionary<string, byte[]>(); - public static void ClientAccepted(IAsyncResult ar) { - - var socket = ar.AsyncState as Socket; - var client = socket.EndAccept(ar); - string remote_ip = ((System.Net.IPEndPoint)client.RemoteEndPoint).Address.ToString(); - if (clients.Keys.Contains(remote_ip)) { - clients[remote_ip] = client; - } - else { - clients.Add(remote_ip, client); - } - if (!buffers.Keys.Contains(remote_ip)) { - buffers.Add(remote_ip, new byte[1024]); - } - //缁欏鎴风鍙戦�涓�釜娆㈣繋娑堟伅 - //client.Send(Encoding.Unicode.GetBytes("Hi there, I accept you request at " + DateTime.Now.ToString())); - Console.WriteLine(remote_ip); - - try { - client.BeginReceive(buffers[remote_ip], 0, buffers[remote_ip].Length, SocketFlags.None, new AsyncCallback(ReceiveMessage), client); - } - catch (Exception ex) { - Console.WriteLine($"銆愭帴鏀跺鎴风鐨勬秷鎭紓甯搞�锛� + ex.Message); - } - //鍑嗗鎺ュ彈涓嬩竴涓鎴风璇锋眰 - socket.BeginAccept(new AsyncCallback(ClientAccepted), socket); - } - - - public static void ReceiveMessage(IAsyncResult ar) { - try { - var socket = ar.AsyncState as Socket; - string remote_ip = ((System.Net.IPEndPoint)socket.RemoteEndPoint).Address.ToString(); - var length = socket.EndReceive(ar); - if (length == 0) { - clients.Remove(remote_ip); - buffers.Remove(remote_ip); - return; - } - else { - if (!clients.Keys.Contains(remote_ip)) { - clients.Add(remote_ip, socket); - } - if (!buffers.Keys.Contains(remote_ip)) { - buffers.Add(remote_ip, new byte[1024]); - } - } - try { - if (buffers.Keys.Contains(remote_ip)) { - //璇诲彇鍑烘潵娑堟伅鍐呭 - var message = GetHexString(buffers[remote_ip], length);//16 10 - Console.WriteLine(message); - if (message.Substring(0, 4) == "3f00" && message.Substring(message.Length - 4) == "0d0a") { - //鏄剧ず娑堟伅 - string msg = message.Replace(@"0d", "").Replace(@"0a", "").Replace(@"0d0a", "").Trim(); - PlcHelper.Receive(remote_ip, msg); - Array.Clear(buffers[remote_ip], 0, buffers[remote_ip].Length);//娓呯┖褰撳墠IP Buffer - } - else { - Console.WriteLine($"銆怲CP淇℃伅鍗忚寮傚父銆戯細IP锛歿remote_ip},MSG锛歿message}"); - } - - } - else { - if (!buffers.Keys.Contains(remote_ip)) { - buffers.Add(remote_ip, new byte[1024]); - } - } - } - catch (Exception ex) { - Console.WriteLine($"銆愬鐞嗗鎴风鐨勬秷鎭紓甯搞�锛� + ex.Message); - } - //鎺ユ敹涓嬩竴涓秷鎭�鍥犱负杩欐槸涓�釜閫掑綊鐨勮皟鐢紝鎵�互杩欐牱灏卞彲浠ヤ竴鐩存帴鏀舵秷鎭簡锛�- socket.BeginReceive(buffers[remote_ip], 0, buffers[remote_ip].Length, SocketFlags.None, new AsyncCallback(ReceiveMessage), socket); - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - } - } - - private static string GetHexString(byte[] buffer, int lenght) { - return BitConverter.ToString(buffer, 0, lenght).Replace("-", string.Empty).ToLower(); - } - - public static bool TcpServerSend(string ip, byte[] msg) { - if (clients.Keys.Contains(ip)) { - var client = clients[ip]; - if (client.Connected) { - try { - client.Send(msg); - return true; - } - catch (SocketException ex) { - Console.WriteLine(ex.Message); - clients[ip].Close(); - clients.Remove(ip); - } - } - else { - clients[ip].Close(); - clients.Remove(ip); - } - } - else { - Console.WriteLine("鏈壘鍒拌澶囩殑閾炬帴锛� + ip); - } - return false; - - } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/GZRobot.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/GZRobot.cs deleted file mode 100644 index 12c1f24..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/GZRobot.cs +++ /dev/null @@ -1,259 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.util; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace HH.WCS.Mobox3.FJJT.dispatch -{ - /// <summary> - /// 鍥借嚜璋冨害杈呭姪绫�- /// </summary> - public class GZRobot - { - private static readonly HttpHelper apiHelper = new HttpHelper(); - private static readonly string baseUrl = "http://192.168.1.99:2000/"; - //private static readonly string logName = "guozi"; - public static List<IOState> GetIO() { - var result = apiHelper.Get(baseUrl + "api/engine/view/iostates/"); - var data = JsonConvert.DeserializeObject<gzResult<IOState>>(result); - return data.data; - } - public static void UpdateIOState() { - var data = new { data = new List<IOSateInfo>() }; - var result = apiHelper.Post(baseUrl + "api/engine/tasks/iostates/", JsonConvert.SerializeObject(data)); - var dataResult = JsonConvert.DeserializeObject<gzResult<IOStatesInfoResult>>(result); - } - - public static int CreateOrder(string taskNo, int priority, string param, string ts = "榛樿") { - var msg = ""; - var orderId = 0; - var data = new OrderInfo() { order_name = taskNo, priority = priority, dead_line = DateTime.Now, ts_name = ts, parameters = param }; - var request = JsonConvert.SerializeObject(data); - var response = apiHelper.Post(baseUrl + "api/om/order/", request); - msg = $"[guozi-CreateOrder] request={request} response={response}"; - Console.WriteLine(msg); - if (response != "") { - try { - var dataResult = JsonConvert.DeserializeObject<gzResult<OrderInfoResult>>(response); - if (dataResult.code == 0) { - orderId = dataResult.data[0].in_order_id; - } - } - catch (Exception ex) { - } - } - else { - msg = "[guozi-CreateOrder]鍒涘缓璁㈠崟澶辫触"; - Console.WriteLine(msg); - } - - - return orderId; - } - public static bool CancelOrder(int orderId) { - bool result = false; - string msg = ""; - var request = new CancelOrderInfo() { order_list = new List<int>(orderId) }; - var response = apiHelper.Post(baseUrl + "api/om/order/cancel/", JsonConvert.SerializeObject(request)); - msg = $"[guozi-CancelOrder] request={request};response={response}"; - Console.WriteLine(msg); - if (response != "") { - var dataResult = JsonConvert.DeserializeObject<gzResult<CancelOrderInfoResult>>(response); - if (dataResult.code == 0) { - result = true; - } - } - else { - msg = "[guozi-CancelOrder]鍙栨秷璁㈠崟澶辫触"; - Console.WriteLine(msg); - } - return result; - } - public static QueryOrderResult QueryOrder(int id) { - // - var result = new QueryOrderResult() { agv_list = new List<int> { 0 } }; - string msg = ""; - var response = apiHelper.Get(baseUrl + $"/api/om/order/{id}/"); - msg = $"[guozi-QueryOrderResult] request={id};response={response}"; - Console.WriteLine(msg); - if (response != "") { - var data = JsonConvert.DeserializeObject<gzResult<QueryOrderResult>>(response); - result = data.data[0]; - } - else { - msg = "[guozi-QueryOrderResult]鏌ヨ璁㈠崟淇℃伅澶辫触"; - Console.WriteLine(msg); - } - return result; - } - /// <summary> - /// 鑾峰彇浜や簰淇℃伅 - /// </summary> - /// <param name="typeId">1浠诲姟鐘舵� 2寮�棬鎴栦氦绠� 3鐩殑鐐�/param> - /// <param name="status"></param> - /// <returns></returns> - public static List<InteractInfoResult> QueryInteractInfo(int typeId, string status = "active") { - - //string aaa = "{\"app_name\": \"Gouzi client\", \"version\": \"1.0.0\", \"code\": 0, \"msg\": \"success\", \"data\": [{\"interaction_info_id\": 233, \"interaction_info_name\": \"TN2012030001\", \"interaction_info_desp\": null, \"interaction_info_type_id\": 3, \"value_json\": {\"state\": \"4\"}, \"info_status\": \"active\", \"return_value\": null}]}"; - //var data = JsonConvert.DeserializeObject<gzResult<InteractInfoResult>>(aaa); - var list = new List<InteractInfoResult>(); - string msg = ""; - var result = apiHelper.Get(baseUrl + $"api/om/interaction_info/find_by_type/?type_id={typeId}&info_status={status}"); - if (!string.IsNullOrEmpty(result)) { - Console.WriteLine(result); - // {"app_name": "Gouzi client", "version": "1.0.0", "code": 0, "msg": "success", "data": [{"interaction_info_id": 230, "interaction_info_name": "2", "interaction_info_desp": null, "interaction_info_type_id": 3, "value_json": {"state": "4"}, "info_status": "active", "return_value": null}, {"interaction_info_id": 231, "interaction_info_name": "2", "interaction_info_desp": null, "interaction_info_type_id": 3, "value_json": {"state": "6"}, "info_status": "active", "return_value": null}, {"interaction_info_id": 232, "interaction_info_name": "2", "interaction_info_desp": null, "interaction_info_type_id": 3, "value_json": {"state": "2"}, "info_status": "active", "return_value": null}, {"interaction_info_id": 233, "interaction_info_name": "TN2012030001", "interaction_info_desp": null, "interaction_info_type_id": 3, "value_json": {"state": "4"}, "info_status": "active", "return_value": null}]} - try { - var data = JsonConvert.DeserializeObject<gzResult<InteractInfoResult>>(result); - if (data.data != null) { - list = data.data; - } - - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - } - - } - else { - msg = "[guozi-QueryInteractInfo]璇诲彇浜や簰淇℃伅澶辫触"; - Console.WriteLine(msg); - } - return list; - } - public static bool UpdateInteractInfo(UpdateInteractInfo interactInfo) { - string msg = ""; - var result = false; - var request = JsonConvert.SerializeObject(interactInfo); - var response = apiHelper.Post(baseUrl + "api/om/interaction_info/update/", request); - msg = $"[mes-UpdateInteractInfo] request={request};response={response}"; - if (response != "") { - var dataResult = JsonConvert.DeserializeObject<gzResult<object>>(response); - result = dataResult.code == 0; - } - else { - msg = "[guozi-UpdateInteractInfo]鏇存柊浜や簰淇℃伅澶辫触"; - Console.WriteLine(msg); - } - return result; - } - - } - public class gzResult<T> - { - public string app_name { get; set; } - public string version { get; set; } - public int code { get; set; } - public string msg { get; set; } - public List<T> data { get; set; } - } - public class IOState - { - public int io_id { get; set; } - public string io_name { get; set; } - public string io_type_id { get; set; } - public string io_type { get; set; } - public int io_status_id { get; set; } - public string io_status_type { get; set; } - public string parameter_definition_int4_1 { get; set; } - public int io_value_int4_1 { get; set; } - public string parameter_definition_int4_2 { get; set; } - public int io_value_int4_2 { get; set; } - public string parameter_definition_int4_3 { get; set; } - public int io_value_int4_3 { get; set; } - public string parameter_definition_int4_4 { get; set; } - public int io_value_int4_4 { get; set; } - public string parameter_definition_json { get; set; } - public string io_value_json { get; set; } - } - public class IOSateInfo - { - public int io_id { get; set; } - public int io_status_id { get; set; } - public int io_value_int4_1 { get; set; } - public int io_value_int4_2 { get; set; } - public int io_value_int4_3 { get; set; } - public int io_value_int4_4 { get; set; } - public string io_value_json { get; set; } - } - public class IOStatesInfoResult - { - public List<ResultInfo> success_list { get; set; } - public List<ResultInfo> error_list { get; set; } - public class ResultInfo { public int io_id { get; set; } } - } - public class OrderInfo - { - public string order_name { get; set; } - public int priority { get; set; } - public DateTime dead_line { get; set; } - public string ts_name { get; set; } - public string parameters { get; set; }//{\"dock\":1} - } - public class OrderInfoResult - { - public int in_order_id { get; set; } - } - public class CancelOrderInfo - { - public List<int> order_list { get; set; } - } - public class CancelOrderInfoResult - { - public List<ResultInfo> success_list { get; set; } - public List<ResultInfo> error_list { get; set; } - public class ResultInfo { public int order_id { get; set; } } - } - public class QueryOrderResult - { - public int order_id { get; set; } - public string order_name { get; set; } - public int priority { get; set; } - public DateTime dead_line { get; set; } - public string ts_id { get; set; } - public string parameters { get; set; }//{"TN_LocationName":"3-2-B", "PalletType":1}", - public string trigger { get; set; } - public string command { get; set; } - public string status { get; set; } - public List<int> agv_list { get; set; } - public string current_task { get; set; } - public string current_dest { get; set; } - public string current_opt { get; set; } - public string current_omi { get; set; } - public DateTime create_time { get; set; } - public DateTime? active_time { get; set; } - public DateTime? finished_time { get; set; } - public DateTime? cancel_time { get; set; } - public string response_timespan { get; set; } - public string execute_timespa { get; set; } - public string total_timespan { get; set; } - } - public class InteractInfoResult - { - public int interaction_info_id { get; set; } - public string interaction_info_name { get; set; } - public string interaction_info_desp { get; set; } - public int interaction_info_type_id { get; set; } - public object value_json { get; set; }//{"dock": 1}, - public string info_status { get; set; } - public string return_value { get; set; } - } - public class UpdateInteractInfo - { - public int interaction_info_id { get; set; } - public string info_status { get; set; } - public string return_value { get; set; } - } - public class interaction_state - { - public string state { get; set; } - } - public class interaction_door - { - public string door { get; set; } - } - public class interaction_bit - { - public string order { get; set; } - } -} - diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HanAo.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HanAo.cs deleted file mode 100644 index 62db83c..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HanAo.cs +++ /dev/null @@ -1,161 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.util; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Web.Services.Description; - -namespace HH.WCS.Mobox3.FJJT.dispatch { - /// <summary> - /// 鍥借嚜璋冨害杈呭姪绫�- /// </summary> - public class HanAo { - private static readonly HttpHelper apiHelper = new HttpHelper(); - private static readonly string baseUrl = Settings.HASeverUrl; - //private static readonly string logName = "hanao"; - - - public static bool CreateOrder(TaskInfoModel model) { - var msg = ""; - var result = true; - var request = JsonConvert.SerializeObject(model); - var response = apiHelper.Post(baseUrl + ":9001/wcs-admin/api/receive", request); - msg = $"[hanao-CreateOrder] request={request} response={response}"; - Console.WriteLine(msg); - if (response != "") { - try { - var dataResult = JsonConvert.DeserializeObject<HAResult>(response); - if (dataResult.code == "0") { - result = true; - } - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - } - } - else { - msg = "[hanao-CreateOrder]鍒涘缓璁㈠崟澶辫触"; - Console.WriteLine(msg); - } - - LogHelper.Info(msg,"鏉ゥ"); - return result; - } - public static bool CancelOrder(CancelModel model) { - bool result = false; - string msg = ""; - var request = JsonConvert.SerializeObject(model); - var response = apiHelper.Post(baseUrl + ":9002/wcs-admin/api/cancel", request); - msg = $"[hanao-CancelOrder] request={request};response={response}"; - Console.WriteLine(msg); - if (response != "") { - var dataResult = JsonConvert.DeserializeObject<HAResult>(response); - if (dataResult.code == "0") { - result = true; - } - } - else { - msg = "[hanao-CancelOrder]鍙栨秷璁㈠崟澶辫触"; - Console.WriteLine(msg); - } - LogHelper.Info(msg, "鏉ゥ"); - return result; - } - public static bool QueryDevice(DeviceInfoModel model) { - bool result = false; - string msg = ""; - var request = JsonConvert.SerializeObject(model); - var response = apiHelper.Get(baseUrl + ":9003//wcs-admin/api/dvc-state/", request); - msg = $"[hanao-QueryDeviceResult] request={request};response={response}"; - Console.WriteLine(msg); - if (response != "") { - var dataResult = JsonConvert.DeserializeObject<HAResult>(response); - if (dataResult.code == "0") { - result = true; - } - } - else { - msg = "[hanao-QueryOrderResult]鏌ヨ璁㈠崟淇℃伅澶辫触"; - Console.WriteLine(msg); - } - LogHelper.Info(msg, "鏉ゥ"); - return result; - } - - - public class TaskInfoModel { - /// <summary> - /// 璇锋眰pk - /// </summary> - public string requestPk { get; set; } - /// <summary> - /// 鎵樼洏鏉$爜 - /// </summary> - public string contNo { get; set; } - /// <summary> - /// 鎵樼洏绫诲瀷 - /// </summary> - public string contType { get; set; } = ""; - /// <summary> - /// 浠诲姟绫诲瀷 1-鍏ュ簱 2-鍑哄簱 3-绉诲簱 - /// </summary> - public string trkType { get; set; } - /// <summary> - /// 1-999锛堝�瓒婂ぇ浼樺厛绾ц秺楂橈級 - /// </summary> - public string trkPrty { get; set; } = "1"; - public string frmPos { get; set; } - public string toPos { get; set; } - public string noticeInfo { get; set; } = ""; - /// <summary> - /// 0-绌烘墭鐩�1-瀹炵墿 - /// </summary> - public string isFull { get; set; } = "0"; - public string groupNo { get; set; } = ""; - public string clientCode { get; set; } = "WMS"; - /// <summary> - /// 鏍煎紡锛�022-11-11 11:32:08 - /// </summary> - public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - - } - public class HAResult { - public string code { get; set; } - public string msg { get; set; } - public string requestPk { get; set; } - } - public class CancelModel { - public string requestPk { get; set; } - public string contNo { get; set; } - public string clientCode { get; set; } - public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - } - public class DeviceInfoModel { - public string requestPk { get; set; } - public string dvcNo { get; set; } - public string clientCode { get; set; } - public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - } - public class TaskStateInfoModel { - public string requestPk { get; set; } - public string contNo { get; set; } - /// <summary> - /// 鍙屾柟绯荤粺鍏卞悓瀹氫箟 1-鍏ュ簱 2-鍑哄簱 3-绉诲簱 锛堝悗缁鏈夊鍔犲啀鍗忓畾锛�- /// </summary> - public string noticeType { get; set; } - public string curPos { get; set; } - public string noticeInfo { get; set; } - /// <summary> - /// 0-鎴愬姛 锛堝叆搴撲笂鏋跺畬鎴�鍑哄簱涓嬫灦瀹屾垚/搴撳唴绉诲簱瀹屾垚锛氱Щ搴撳彧涓婃姤鏈�粓绉诲簱涓婃灦锛�鎴�鍏朵粬-寮傚父鐮�鍙嶉鐩稿叧缁撴灉鍘熷洜锛學MS鏍规嵁鎯呭喌澶勭悊 - /// 1-鍏ュ簱鏈夎揣 2-鍏ヨ繙杩戞湁璐�3-鍑哄簱鏃犺揣 4-鍑鸿繙杩戞湁璐� - /// </summary> - public string code { get; set; } - public string result { get; set; } - public string clientCode { get; set; } - public string reqTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - } - - } - - -} - diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HostToAGV.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HostToAGV.cs deleted file mode 100644 index 1583115..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/HostToAGV.cs +++ /dev/null @@ -1,550 +0,0 @@ -锘�/------------------------------------------------------------------------------ -// <auto-generated> -// 姝や唬鐮佺敱宸ュ叿鐢熸垚銆�-// 杩愯鏃剁増鏈�4.0.30319.42000 -// -// 瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�-// 閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便� -// </auto-generated> -//------------------------------------------------------------------------------ - -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.Web.Services; -using System.Web.Services.Protocols; -using System.Xml.Serialization; - -// -// 姝ゆ簮浠g爜鐢�wsdl 鑷姩鐢熸垚, Version=4.6.1055.0銆�-// - - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -[System.Web.Services.WebServiceBindingAttribute(Name="HostToAGV", Namespace="http://127.0.0.1:9988/HostToAGV.wsdl")] -public class HostToAGV : System.Web.Services.Protocols.SoapHttpClientProtocol { - - private System.Threading.SendOrPostCallback StartNewOrderWithQCmdOperationCompleted; - - private System.Threading.SendOrPostCallback AddNewOrderOperationCompleted; - - private System.Threading.SendOrPostCallback CancelOrderOperationCompleted; - - private System.Threading.SendOrPostCallback ChangeOrderOperationCompleted; - - private System.Threading.SendOrPostCallback QueryOrderOperationCompleted; - - private System.Threading.SendOrPostCallback OrderAddOperationCompleted; - - private System.Threading.SendOrPostCallback OrderChangeParamOperationCompleted; - - /// <remarks/> - public HostToAGV() { - this.Url = "http://127.0.0.1:9988/HostToAGV.cgi"; - } - - /// <remarks/> - public event StartNewOrderWithQCmdCompletedEventHandler StartNewOrderWithQCmdCompleted; - - /// <remarks/> - public event AddNewOrderCompletedEventHandler AddNewOrderCompleted; - - /// <remarks/> - public event CancelOrderCompletedEventHandler CancelOrderCompleted; - - /// <remarks/> - public event ChangeOrderCompletedEventHandler ChangeOrderCompleted; - - /// <remarks/> - public event QueryOrderCompletedEventHandler QueryOrderCompleted; - - /// <remarks/> - public event OrderAddCompletedEventHandler OrderAddCompleted; - - /// <remarks/> - public event OrderChangeParamCompletedEventHandler OrderChangeParamCompleted; - - /// <remarks/> - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string StartNewOrderWithQCmd([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { - object[] results = this.Invoke("StartNewOrderWithQCmd", new object[] { - bufin}); - return ((string)(results[0])); - } - - /// <remarks/> - public System.IAsyncResult BeginStartNewOrderWithQCmd(string bufin, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("StartNewOrderWithQCmd", new object[] { - bufin}, callback, asyncState); - } - - /// <remarks/> - public string EndStartNewOrderWithQCmd(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((string)(results[0])); - } - - /// <remarks/> - public void StartNewOrderWithQCmdAsync(string bufin) { - this.StartNewOrderWithQCmdAsync(bufin, null); - } - - /// <remarks/> - public void StartNewOrderWithQCmdAsync(string bufin, object userState) { - if ((this.StartNewOrderWithQCmdOperationCompleted == null)) { - this.StartNewOrderWithQCmdOperationCompleted = new System.Threading.SendOrPostCallback(this.OnStartNewOrderWithQCmdOperationCompleted); - } - this.InvokeAsync("StartNewOrderWithQCmd", new object[] { - bufin}, this.StartNewOrderWithQCmdOperationCompleted, userState); - } - - private void OnStartNewOrderWithQCmdOperationCompleted(object arg) { - if ((this.StartNewOrderWithQCmdCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.StartNewOrderWithQCmdCompleted(this, new StartNewOrderWithQCmdCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// <remarks/> - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string AddNewOrder([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { - object[] results = this.Invoke("AddNewOrder", new object[] { - bufin}); - return ((string)(results[0])); - } - - /// <remarks/> - public System.IAsyncResult BeginAddNewOrder(string bufin, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("AddNewOrder", new object[] { - bufin}, callback, asyncState); - } - - /// <remarks/> - public string EndAddNewOrder(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((string)(results[0])); - } - - /// <remarks/> - public void AddNewOrderAsync(string bufin) { - this.AddNewOrderAsync(bufin, null); - } - - /// <remarks/> - public void AddNewOrderAsync(string bufin, object userState) { - if ((this.AddNewOrderOperationCompleted == null)) { - this.AddNewOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddNewOrderOperationCompleted); - } - this.InvokeAsync("AddNewOrder", new object[] { - bufin}, this.AddNewOrderOperationCompleted, userState); - } - - private void OnAddNewOrderOperationCompleted(object arg) { - if ((this.AddNewOrderCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.AddNewOrderCompleted(this, new AddNewOrderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// <remarks/> - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string CancelOrder([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { - object[] results = this.Invoke("CancelOrder", new object[] { - bufin}); - return ((string)(results[0])); - } - - /// <remarks/> - public System.IAsyncResult BeginCancelOrder(string bufin, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("CancelOrder", new object[] { - bufin}, callback, asyncState); - } - - /// <remarks/> - public string EndCancelOrder(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((string)(results[0])); - } - - /// <remarks/> - public void CancelOrderAsync(string bufin) { - this.CancelOrderAsync(bufin, null); - } - - /// <remarks/> - public void CancelOrderAsync(string bufin, object userState) { - if ((this.CancelOrderOperationCompleted == null)) { - this.CancelOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCancelOrderOperationCompleted); - } - this.InvokeAsync("CancelOrder", new object[] { - bufin}, this.CancelOrderOperationCompleted, userState); - } - - private void OnCancelOrderOperationCompleted(object arg) { - if ((this.CancelOrderCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.CancelOrderCompleted(this, new CancelOrderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// <remarks/> - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string ChangeOrder([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { - object[] results = this.Invoke("ChangeOrder", new object[] { - bufin}); - return ((string)(results[0])); - } - - /// <remarks/> - public System.IAsyncResult BeginChangeOrder(string bufin, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("ChangeOrder", new object[] { - bufin}, callback, asyncState); - } - - /// <remarks/> - public string EndChangeOrder(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((string)(results[0])); - } - - /// <remarks/> - public void ChangeOrderAsync(string bufin) { - this.ChangeOrderAsync(bufin, null); - } - - /// <remarks/> - public void ChangeOrderAsync(string bufin, object userState) { - if ((this.ChangeOrderOperationCompleted == null)) { - this.ChangeOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnChangeOrderOperationCompleted); - } - this.InvokeAsync("ChangeOrder", new object[] { - bufin}, this.ChangeOrderOperationCompleted, userState); - } - - private void OnChangeOrderOperationCompleted(object arg) { - if ((this.ChangeOrderCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.ChangeOrderCompleted(this, new ChangeOrderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// <remarks/> - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="urn:HostToAGV", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - [return: System.Xml.Serialization.XmlElementAttribute("bufout", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string QueryOrder([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string bufin) { - object[] results = this.Invoke("QueryOrder", new object[] { - bufin}); - return ((string)(results[0])); - } - - /// <remarks/> - public System.IAsyncResult BeginQueryOrder(string bufin, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("QueryOrder", new object[] { - bufin}, callback, asyncState); - } - - /// <remarks/> - public string EndQueryOrder(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((string)(results[0])); - } - - /// <remarks/> - public void QueryOrderAsync(string bufin) { - this.QueryOrderAsync(bufin, null); - } - - /// <remarks/> - public void QueryOrderAsync(string bufin, object userState) { - if ((this.QueryOrderOperationCompleted == null)) { - this.QueryOrderOperationCompleted = new System.Threading.SendOrPostCallback(this.OnQueryOrderOperationCompleted); - } - this.InvokeAsync("QueryOrder", new object[] { - bufin}, this.QueryOrderOperationCompleted, userState); - } - - private void OnQueryOrderOperationCompleted(object arg) { - if ((this.QueryOrderCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.QueryOrderCompleted(this, new QueryOrderCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// <remarks/> - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestElementName="Order-Add", RequestNamespace="urn:HostToAGV", ResponseElementName="Order-AddResponse", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - [return: System.Xml.Serialization.XmlElementAttribute("pszResponse", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string OrderAdd([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string pszRequest) { - object[] results = this.Invoke("OrderAdd", new object[] { - pszRequest}); - return ((string)(results[0])); - } - - /// <remarks/> - public System.IAsyncResult BeginOrderAdd(string pszRequest, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("OrderAdd", new object[] { - pszRequest}, callback, asyncState); - } - - /// <remarks/> - public string EndOrderAdd(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((string)(results[0])); - } - - /// <remarks/> - public void OrderAddAsync(string pszRequest) { - this.OrderAddAsync(pszRequest, null); - } - - /// <remarks/> - public void OrderAddAsync(string pszRequest, object userState) { - if ((this.OrderAddOperationCompleted == null)) { - this.OrderAddOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOrderAddOperationCompleted); - } - this.InvokeAsync("OrderAdd", new object[] { - pszRequest}, this.OrderAddOperationCompleted, userState); - } - - private void OnOrderAddOperationCompleted(object arg) { - if ((this.OrderAddCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.OrderAddCompleted(this, new OrderAddCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// <remarks/> - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestElementName="Order-ChangeParam", RequestNamespace="urn:HostToAGV", ResponseElementName="Order-ChangeParamResponse", ResponseNamespace="urn:HostToAGV", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - [return: System.Xml.Serialization.XmlElementAttribute("pszResponse", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string OrderChangeParam([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string pszRequest) { - object[] results = this.Invoke("OrderChangeParam", new object[] { - pszRequest}); - return ((string)(results[0])); - } - - /// <remarks/> - public System.IAsyncResult BeginOrderChangeParam(string pszRequest, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("OrderChangeParam", new object[] { - pszRequest}, callback, asyncState); - } - - /// <remarks/> - public string EndOrderChangeParam(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((string)(results[0])); - } - - /// <remarks/> - public void OrderChangeParamAsync(string pszRequest) { - this.OrderChangeParamAsync(pszRequest, null); - } - - /// <remarks/> - public void OrderChangeParamAsync(string pszRequest, object userState) { - if ((this.OrderChangeParamOperationCompleted == null)) { - this.OrderChangeParamOperationCompleted = new System.Threading.SendOrPostCallback(this.OnOrderChangeParamOperationCompleted); - } - this.InvokeAsync("OrderChangeParam", new object[] { - pszRequest}, this.OrderChangeParamOperationCompleted, userState); - } - - private void OnOrderChangeParamOperationCompleted(object arg) { - if ((this.OrderChangeParamCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.OrderChangeParamCompleted(this, new OrderChangeParamCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// <remarks/> - public new void CancelAsync(object userState) { - base.CancelAsync(userState); - } -} - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -public delegate void StartNewOrderWithQCmdCompletedEventHandler(object sender, StartNewOrderWithQCmdCompletedEventArgs e); - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public class StartNewOrderWithQCmdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal StartNewOrderWithQCmdCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// <remarks/> - public string Result { - get { - this.RaiseExceptionIfNecessary(); - return ((string)(this.results[0])); - } - } -} - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -public delegate void AddNewOrderCompletedEventHandler(object sender, AddNewOrderCompletedEventArgs e); - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public class AddNewOrderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal AddNewOrderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// <remarks/> - public string Result { - get { - this.RaiseExceptionIfNecessary(); - return ((string)(this.results[0])); - } - } -} - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -public delegate void CancelOrderCompletedEventHandler(object sender, CancelOrderCompletedEventArgs e); - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public class CancelOrderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal CancelOrderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// <remarks/> - public string Result { - get { - this.RaiseExceptionIfNecessary(); - return ((string)(this.results[0])); - } - } -} - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -public delegate void ChangeOrderCompletedEventHandler(object sender, ChangeOrderCompletedEventArgs e); - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public class ChangeOrderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal ChangeOrderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// <remarks/> - public string Result { - get { - this.RaiseExceptionIfNecessary(); - return ((string)(this.results[0])); - } - } -} - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -public delegate void QueryOrderCompletedEventHandler(object sender, QueryOrderCompletedEventArgs e); - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public class QueryOrderCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal QueryOrderCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// <remarks/> - public string Result { - get { - this.RaiseExceptionIfNecessary(); - return ((string)(this.results[0])); - } - } -} - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -public delegate void OrderAddCompletedEventHandler(object sender, OrderAddCompletedEventArgs e); - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public class OrderAddCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal OrderAddCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// <remarks/> - public string Result { - get { - this.RaiseExceptionIfNecessary(); - return ((string)(this.results[0])); - } - } -} - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -public delegate void OrderChangeParamCompletedEventHandler(object sender, OrderChangeParamCompletedEventArgs e); - -/// <remarks/> -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.6.1055.0")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public class OrderChangeParamCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal OrderChangeParamCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// <remarks/> - public string Result { - get { - this.RaiseExceptionIfNecessary(); - return ((string)(this.results[0])); - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDC.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDC.cs deleted file mode 100644 index a2cf1f9..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDC.cs +++ /dev/null @@ -1,164 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.util; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; - -namespace HH.WCS.Mobox3.FJJT.dispatch -{ - public class NDC - { - private static HostToAGV callClient = null; - static NDC() { - callClient = new HostToAGV(); - //callClient.Url = "http://192.168.1.146:9988/HostToAGV.cgi"; - callClient.Url = Settings.HostToAgvServerUrl; - } - private static string GetReqStrNew(int ts, int pri, string taskNo, Dictionary<string, string> param) { - /*<Req> - <Order TS='5' Pri='80' No='666' NoCallback='0' Ext1='' Ext2='' Ext3=''> - <Param Name='From' Value='10' /> - <Param Name='To' Value='20' /> - <Param Name='Func' Value='1' /> - <Param Name='Data' Value='7' /> - <Param Name='ItemHeight' Value='1' /> - <Param Name='CntrType' Value='12' /> - <Param Name='FromCol' Value='2' /> - <Param Name='ToCol' Value='111' /> - </Order> - </Req>*/ - var sb = new StringBuilder(); - sb.Append($"<Req><Order TS='{ts}' Pri='{pri}' No='{taskNo}'>"); - - foreach (var kv in param) { - sb.Append($"<Param Name='{kv.Key}' Value='{kv.Value}'/>"); - } - sb.Append("</Order></Req>"); - return sb.ToString(); - } - public AGVResult AddNewOrderNew(int ts, int pri, string taskNo, Dictionary<string, string> param) { - //< Req >< Order TS = '1' Pri = '1' No = 'TN2302020001' Ext1 = '' Ext2 = '' N_CNTR_COUNT = '' >< Param Name = 'From' Value = '2' />< Param Name = 'To' Value = '1' /></ Order ></ Req > - - var bufin = GetReqStrNew(ts, pri, taskNo, param); - - try { - - var result = callClient.OrderAdd(bufin); - LogHelper.Info($"浠诲姟涓嬪彂缁撴灉 OrderAdd req={bufin} res={result}", "NDC"); - Console.WriteLine($"浠诲姟涓嬪彂缁撴灉 OrderAdd req={bufin} res={result}"); - //LogHelper.Info(result.bufout, "ts"); - return GetResult(result); - } - catch (Exception e) { - LogHelper.Info($"浠诲姟涓嬪彂澶辫触 OrderAdd req={bufin} res={e.Message}", "NDC"); - //Console.WriteLine($"浠诲姟涓嬪彂澶辫触 AddNewOrder req={bufin} res={e.Message}"); - return new AGVResult { Res = new Res { ErrCode = -1, ErrInfo = e.Message } }; - } - - } - private static string GetReqStr(int ts, Dictionary<string, string> param) { - //< Order TS = '60' Pri = '" + mst.CN_N_PRIORITY.ToString() + "' From = '" + start.CN_N_AGV_TN_Location + "' To = '" + end.CN_N_AGV_TN_Location + "' No = '" + mst.S_CODE + "_1' Ext1 = '1' Ext2 = '" + Constants.TN_MID_COMMANDEQ_CALLAGVOrderCommandType + "' N_CNTR_COUNT = '' FRow = '" + sFloor + "' TRow = '" + eFloor + "' /> - var sb = new StringBuilder(); - sb.Append($"<Req><Order "); - if (ts != 0) { - sb.Append($"TS='{ts}'"); - } - foreach (var kv in param) { - sb.Append($" {kv.Key}='{kv.Value}'"); - } - sb.Append("/></Req>"); - return sb.ToString(); - } - public static AGVResult AddNewOrder(int ts, Dictionary<string, string> param) { - //< Req >< Order TS = '1' Pri = '1' No = 'TN2302020001' Ext1 = '' Ext2 = '' N_CNTR_COUNT = '' >< Param Name = 'From' Value = '2' />< Param Name = 'To' Value = '1' /></ Order ></ Req > - - var bufin = GetReqStr(ts, param); - - try { - - var result = callClient.AddNewOrder(bufin); - LogHelper.Info($"AddNewOrder req={bufin} res={result}", "NDC"); - return GetResult(result); - } - catch (Exception e) { - LogHelper.Info($"AddNewOrder req={bufin} res={e.Message}", "NDC"); - return new AGVResult { Res = new Res { ErrCode = -1, ErrInfo = e.Message } }; - } - - } - public static AGVResult CancelOrder(int ts, Dictionary<string, string> param) { - //< Req >< Order No = 'TN2302020001' >< Param Name = 'IsForce' Value = '1' /></ Order ></ Req > - var bufin = GetReqStr(ts, param); - try { - var result = callClient.CancelOrder(bufin); - LogHelper.Info($"CancelOrder req={bufin} res={result}", "NDC"); - return GetResult(result); - } - catch (Exception e) { - LogHelper.Info($"CancelOrder req={bufin} res={e.Message}", "NDC"); - return new AGVResult { - Res = new Res { - ErrCode = -1, - ErrInfo = e.Message - } - }; - } - - } - public static AGVResult StartNewOrderWithQCmd(int ts, Dictionary<string, string> param) { - //lpn: <Order TS='41' Pri='' ExtDeviceNo='{0}' CtrlVal='{1}' DispInfo='{2}' No='{3}' Ext1='' Ext2='' N_CNTR_COUNT='' /> - //traccif: <Order TS='164' From='2' To='2' ExtDeviceNo='" + lockNo + "' No='" + DateTime.Now.Ticks.ToString() + "' /> - //lock: <Order TS='170' CtrlVal='" + CtrlVal + "' ExtDeviceNo='" + roadway + "' No='" + DateTime.Now.Ticks.ToString() + "' /> - var bufin = GetReqStr(ts, param); - try { - var r = callClient.StartNewOrderWithQCmd(bufin); - LogHelper.Info($"StartNewOrderWithQCmd req={bufin} res={r}", "NDC"); - return GetResult(r); - } - catch (Exception e) { - LogHelper.Info($"StartNewOrderWithQCmd req={bufin} res={e.Message}", "NDC"); - return new AGVResult { - Res = new Res { - ErrCode = -1, - ErrInfo = e.Message - } - }; - } - } - public static AGVResult ChangeOrder(Dictionary<string, string> param) { - //< Req >< Order No = 'TN2302020002' ParamNo = '18' Param1 = '12' /></ Req > - var bufin = GetReqStr(0, param); - try { - var r = callClient.ChangeOrder(bufin); - LogHelper.Info($"ChangeOrder req={bufin} res={r}", "NDC"); - return GetResult(r); - } - catch (Exception e) { - LogHelper.Info($"ChangeOrder req={bufin} res={e.Message}", "NDC"); - return new AGVResult { - Res = new Res { - ErrCode = -1, - ErrInfo = e.Message - } - }; - } - } - private static AGVResult GetResult(string bufout) { - //<Res><ErrCode>0</ErrCode><Result>11</Result></Res> - XmlDocument xml = new XmlDocument(); - xml.LoadXml(bufout); - var json = JsonConvert.SerializeXmlNode(xml); - return JsonConvert.DeserializeObject<AGVResult>(json); - } - public class AGVResult - { - public Res Res { get; set; } - } - public class Res - { - public int ErrCode { get; set; } - public string ErrInfo { get; set; } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDCApi.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDCApi.cs deleted file mode 100644 index d0bf5cb..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDCApi.cs +++ /dev/null @@ -1,253 +0,0 @@ -锘縰sing Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; -using HH.WCS.Mobox3.FJJT.util; - -namespace HH.WCS.Mobox3.FJJT.dispatch { - public class NDCApi - { - public static string NDCApiUrl { set; get; } - static NDCApi() { - - NDCApiUrl = Settings.NDCApiUrl; - } - - public static AgvApiResult AddOrderNew(int ts, int pri, string taskNo, List<param> param) - { - var httpH = new HttpHelper(); - var agvApiResult = new AgvApiResult(); - var model = new AddOrderNewModel(); - model.ts_no = ts; - model.pri = pri; - model.task_no = taskNo; - model.param = param; - try { - LogHelper.Info($"浠诲姟{taskNo}涓嬪彂锛寋JsonConvert.SerializeObject(model)}" , "NDC"); - var result = httpH.WebPost(NDCApiUrl + "Add",JsonConvert.SerializeObject(model)); - LogHelper.Info($"浠诲姟涓嬪彂缁撴灉res={result}", "NDC"); - agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); - return agvApiResult; - } - catch (Exception e) { - LogHelper.Info($"浠诲姟涓嬪彂澶辫触 res={e.Message}", "NDC"); - agvApiResult.err_code = -1; - agvApiResult.err_msg = e.Message; - return agvApiResult; - } - } - - public static AgvApiResult AddOrderNew(AddOrderNewModel model) - { - var httpH = new HttpHelper(); - var agvApiResult = new AgvApiResult(); - try - { - LogHelper.Info($"浠诲姟{model.task_no}涓嬪彂锛寋JsonConvert.SerializeObject(model)}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}涓嬪彂锛寋JsonConvert.SerializeObject(model)}", "NDC"); - var result = httpH.WebPost(NDCApiUrl + "Add", JsonConvert.SerializeObject(model)); - LogHelper.Info($"浠诲姟涓嬪彂缁撴灉res={result}", "NDC"); - Console.WriteLine($"浠诲姟涓嬪彂缁撴灉res={result}"); - agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); - return agvApiResult; - } - catch (Exception e) - { - LogHelper.Info($"浠诲姟涓嬪彂澶辫触 res={e.Message}", "NDC"); - agvApiResult.err_code = -1; - agvApiResult.err_msg = e.Message; - return agvApiResult; - } - } - - public static AgvApiResult CancelOrder(string tsNo, bool is_force) - { - var httpH = new HttpHelper(); - var agvApiResult = new AgvApiResult(); - var model = new CancelOrderModel(); - model.task_no = tsNo; - model.is_force = is_force; - try { - LogHelper.Info($"浠诲姟{model.task_no}鍙栨秷锛寋JsonConvert.SerializeObject(model)}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}鍙栨秷锛寋JsonConvert.SerializeObject(model)}", "NDC"); - var result = httpH.WebPost(NDCApiUrl + "Cancel", JsonConvert.SerializeObject(model)); - LogHelper.Info($"浠诲姟{model.task_no}鍙栨秷缁撴灉={result}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}鍙栨秷缁撴灉={result}", "NDC"); - agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); - return agvApiResult; - } - catch (Exception e) { - LogHelper.Info($"CancelOrder res={e.Message}", "NDC"); - agvApiResult.err_code = -1; - agvApiResult.err_msg = e.Message; - return agvApiResult; - } - } - - public static AgvApiResult CancelOrder(CancelOrderModel model) - { - var httpH = new HttpHelper(); - var agvApiResult = new AgvApiResult(); - try - { - LogHelper.Info($"浠诲姟{model.task_no}鍙栨秷锛寋JsonConvert.SerializeObject(model)}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}鍙栨秷锛寋JsonConvert.SerializeObject(model)}", "NDC"); - var result = httpH.WebPost(NDCApiUrl + "Cancel", JsonConvert.SerializeObject(model)); - LogHelper.Info($"浠诲姟{model.task_no}鍙栨秷缁撴灉={result}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}鍙栨秷缁撴灉={result}", "NDC"); - agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); - return agvApiResult; - } - catch (Exception e) - { - LogHelper.Info($"CancelOrder res={e.Message}", "NDC"); - agvApiResult.err_code = -1; - agvApiResult.err_msg = e.Message; - return agvApiResult; - } - - } - - public static AgvApiResult ChangeOrderPri(string taskNo, int newPri) - { - var httpH = new HttpHelper(); - var agvApiResult = new AgvApiResult(); - var model = new ChangePriModel(); - model.task_no = taskNo; - model.pri = newPri; - try - { - LogHelper.Info($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀癸紝{JsonConvert.SerializeObject(model)}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀癸紝{JsonConvert.SerializeObject(model)}", "NDC"); - var result = httpH.WebPost(NDCApiUrl + "ChangePri", JsonConvert.SerializeObject(model)); - LogHelper.Info($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀圭粨鏋�{result}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀圭粨鏋�{result}", "NDC"); - agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); - return agvApiResult; - } - catch (Exception e) - { - LogHelper.Info($"ChangeOrderPri res={e.Message}", "NDC"); - agvApiResult.err_code = -1; - agvApiResult.err_msg = e.Message; - return agvApiResult; - } - } - - public static AgvApiResult ChangeOrderPri(ChangePriModel model) - { - var httpH = new HttpHelper(); - var agvApiResult = new AgvApiResult(); - try - { - LogHelper.Info($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀癸紝{JsonConvert.SerializeObject(model)}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀癸紝{JsonConvert.SerializeObject(model)}", "NDC"); - var result = httpH.WebPost(NDCApiUrl + "ChangePri", JsonConvert.SerializeObject(model)); - LogHelper.Info($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀圭粨鏋�{result}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}浼樺厛绾ф洿鏀圭粨鏋�{result}", "NDC"); - agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); - return agvApiResult; - } - catch (Exception e) - { - LogHelper.Info($"ChangeOrderPri res={e.Message}", "NDC"); - agvApiResult.err_code = -1; - agvApiResult.err_msg = e.Message; - return agvApiResult; - } - } - - public static AgvApiResult ChangeOrderParam(string taskNo,int paramNo, string paramStr) - { - var httpH = new HttpHelper(); - var agvApiResult = new AgvApiResult(); - var model = new ChangeParamModel(); - model.task_no = taskNo; - model.param_no = paramNo; - model.param = paramStr; - try { - LogHelper.Info($"浠诲姟{model.task_no}鍙傛暟鏇存敼锛寋JsonConvert.SerializeObject(model)}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}鍙傛暟鏇存敼锛寋JsonConvert.SerializeObject(model)}", "NDC"); - var result = httpH.WebPost(NDCApiUrl + "ChangeParam", JsonConvert.SerializeObject(model)); - LogHelper.Info($"浠诲姟{model.task_no}鍙傛暟鏇存敼缁撴灉={result}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}鍙傛暟鏇存敼缁撴灉={result}", "NDC"); - agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); - return agvApiResult; - } - catch (Exception e) { - LogHelper.Info($"ChangeOrderParam res={e.Message}", "NDC"); - agvApiResult.err_code = -1; - agvApiResult.err_msg = e.Message; - return agvApiResult; - } - } - - public static AgvApiResult ChangeOrderParam(ChangeParamModel model) - { - var httpH = new HttpHelper(); - var agvApiResult = new AgvApiResult(); - try - { - LogHelper.Info($"浠诲姟{model.task_no}鍙傛暟鏇存敼锛寋JsonConvert.SerializeObject(model)}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}鍙傛暟鏇存敼锛寋JsonConvert.SerializeObject(model)}", "NDC"); - var result = httpH.WebPost(NDCApiUrl + "ChangeParam", JsonConvert.SerializeObject(model)); - LogHelper.Info($"浠诲姟{model.task_no}鍙傛暟鏇存敼缁撴灉={result}", "NDC"); - Console.WriteLine($"浠诲姟{model.task_no}鍙傛暟鏇存敼缁撴灉={result}", "NDC"); - agvApiResult = JsonConvert.DeserializeObject<AgvApiResult>(result); - return agvApiResult; - } - catch (Exception e) - { - LogHelper.Info($"ChangeOrderParam res={e.Message}", "NDC"); - agvApiResult.err_code = -1; - agvApiResult.err_msg = e.Message; - return agvApiResult; - } - } - } - - /// <summary> - /// 杩斿洖淇℃伅Model - /// </summary> - public class AgvApiResult - { - public int err_code { set; get; }//寮傚父鐮侊細0 - 姝e父锛屽叾瀹冨�涓哄紓甯搁敊璇爜 - public string err_msg { set; get; }//杩斿洖鐨勯敊璇弿杩帮紝鍦�err_code <> 0 鏃惰繑鍥�- public object result { set; get; }//姝g‘杩斿洖鐨勭粨鏋滃唴瀹癸紝鍦�err_code = 0 涓旀湁杩斿洖鍐呭鏃�- } - - public class AddOrderNewModel - { - public int ts_no { set; get; }//TS 鍙凤紝蹇呴』鏈夊� - public int pri { set; get; }//浼樺厛绾�- public string task_no { set; get; }//涓婃父浠诲姟缂栫爜锛屽鏋�no_feedback = 1 鏃讹紝鍙互涓虹┖ - public List<param> param { set; get; } = new List<param>();//鍙傛暟鍒楄〃 - } - - - public class param - { - public string name { set; get; }//鍙傛暟鍚�- public string value { set; get; }//鍙傛暟鍊�- } - - public class CancelOrderModel - { - public string task_no { set; get; }//涓婃父浠诲姟缂栫爜 - public bool is_force { set; get; }//鏄惁寮哄埗鍙栨秷锛� 鈥�寮哄埗 - } - - public class ChangeParamModel - { - public string task_no { set; get; }//涓婃父浠诲姟缂栫爜 - public int param_no { set; get; }//鍙傛暟鍙�- public string param { set; get; }//鍙傛暟鍐呭锛屽涓弬鏁颁互鑻辨枃鍒嗗彿(;)鍒嗛殧 - } - - public class ChangePriModel - { - public string task_no { set; get; }//涓婃父浠诲姟缂栫爜 - public int pri { set; get; }//鏂颁紭鍏堢骇 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDCHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDCHelper.cs deleted file mode 100644 index 58851f9..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/NDCHelper.cs +++ /dev/null @@ -1,81 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; - -namespace HH.WCS.Mobox3.FJJT.dispatch -{ - public class NDCHelper - { - public static void Test() { - //dic.Add("Ext1", ""); dic.Add("Ext2", ""); dic.Add("N_CNTR_COUNT", ""); - //var r = callClient.AddNewOrderAsync(new AddNewOrderRequest() { bufin = "<Req><Order Pri='1' TS='1' From='1' To='2' No='123471118_1' Ext1='1' Ext2='CALLADDAGV' N_CNTR_COUNT='' /></Req>" }); - //r.Wait(); - - var dic = new Dictionary<string, string>(); - dic.Add("Pri", "1"); dic.Add("From", "1"); dic.Add("To", "1"); dic.Add("No", "12311411718_2");// dic.Add("Ext1", "1"); dic.Add("Ext2", "CALLADDAGV"); dic.Add("N_CNTR_COUNT", ""); - var result = NDC.AddNewOrder(1, dic); - - var dic1 = new Dictionary<string, string>(); - var no = "3454566666"; - dic1.Add("From", "1"); dic1.Add("To", "0"); dic1.Add("No", no); - result = NDC.AddNewOrder(101, dic1); - - var dic2 = new Dictionary<string, string>(); - dic2.Add("ExtDeviceNo", "1"); dic2.Add("From", "2"); dic2.Add("To", "2"); dic2.Add("No", DateTime.Now.Ticks.ToString()); dic2.Add("CtrlVal", "1"); - result = NDC.AddNewOrder(39, dic2); - - var dic3 = new Dictionary<string, string>(); - dic3.Add("From", "1"); dic3.Add("To", "9"); dic3.Add("No", no); - result = NDC.CancelOrder(101, dic3); - - var dic4 = new Dictionary<string, string>(); - dic4.Add("ExtDeviceNo", "1"); dic4.Add("CtrlVal", "1"); dic4.Add("DispInfo", "AAAAAAAA"); dic4.Add("No", DateTime.Now.Ticks.ToString()); - result = NDC.StartNewOrderWithQCmd(41, dic4); - - var dic5 = new Dictionary<string, string>(); - dic5.Add("ExtDeviceNo", "1"); dic5.Add("CtrlVal", "1"); dic5.Add("No", DateTime.Now.Ticks.ToString()); - result = NDC.StartNewOrderWithQCmd(170, dic5); - - var dic6 = new Dictionary<string, string>(); - dic6.Add("ExtDeviceNo", "11"); dic6.Add("From", "2"); dic6.Add("To", "2"); dic6.Add("No", DateTime.Now.Ticks.ToString()); - result = NDC.StartNewOrderWithQCmd(164, dic6); - - var dic7 = new Dictionary<string, string>(); - dic7.Add("Param1", "50"); dic7.Add("No", DateTime.Now.Ticks.ToString()); - result = NDC.ChangeOrder(dic7); - } - - public static bool ChangeParam(string taskNo, int param1, int paramNo = 0) { - bool bResult = false; - var dic = new Dictionary<string, string>(); - dic.Add("No", taskNo); - if (paramNo >= 0) { - dic.Add("ParamNo", paramNo.ToString()); - } - dic.Add("Param1", param1.ToString()); - var result = NDC.ChangeOrder(dic); - return bResult; - } - - public static bool Traffic(string lockNo) { - bool bResult = false; - var dic = new Dictionary<string, string>(); - dic.Add("ExtDeviceNo", lockNo); - dic.Add("From", "2"); - dic.Add("To", "2"); dic.Add("No", DateTime.Now.Ticks.ToString()); - - var result = NDC.StartNewOrderWithQCmd(164, dic); - return bResult; - } - - public static bool Cancel(string taskNo) { - bool bResult = false; - var dic = new Dictionary<string, string>(); - dic.Add("No", taskNo); - dic.Add("IsForce", "1"); - - var result = NDC.CancelOrder(1, dic); - return bResult; - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AZInventory.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AZInventory.cs deleted file mode 100644 index 8d4a0f4..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AZInventory.cs +++ /dev/null @@ -1,27 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - [SugarTable("TN_AZ_Inventory")] - public class AZInventory : BaseModel - { - - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public float F_QTY { get; set; } - public string S_AREA_CODE { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string C_IS_LOGIC_AREA { get; set; } = "N"; - public string S_END_USER { get; set; } - public string S_ITEM_STATE { get; set; } = "合格"; - public string S_ITEM_ROUTE { get; set; } = ""; - public string S_ITEM_SPEC { get; set; } - public string S_STATE_PRE { get; set; } = ""; - public int N_REVIEW_RESULT { get; set; } - - public int N_ITEM_STATE { get; set; } - public float F_ALLOC_QTY { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AbnormalAreaConfig.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AbnormalAreaConfig.cs deleted file mode 100644 index 45832ae..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AbnormalAreaConfig.cs +++ /dev/null @@ -1,20 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models -{ - /// <summary> - /// 寮傚父搴撳尯閰嶇疆 - /// </summary> - [SugarTable("TN_Abnormal_Area_Config")] - internal class AbnormalAreaConfig : BaseModel - { - public string S_AREA_CODE { get; set; } // 寮傚父鍖虹紪鐮�- public string S_SUP_AREA { get; set; } // 浠庡睘搴撳尯缂栫爜 - public string C_ENABLE { get; set; } // 鏄惁绂佺敤 Y/N - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AlarmRecord.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AlarmRecord.cs deleted file mode 100644 index a1a2317..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/AlarmRecord.cs +++ /dev/null @@ -1,21 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models -{ - [SugarTable("TN_Alarm_Record")] - internal class AlarmRecord : BaseModel - { - public string S_ALARM_CODE { get; set; } // 鎶ヨ缂栫爜 - public string S_ALARM_TYPE { get; set; } // 鎶ヨ绫诲瀷 1.璁惧寮傚父 2.浜哄伐澶勭悊 3.娴佺▼寮傚父 4.绯荤粺閿欒 - public string S_ALARM_LEVEL { get; set; } // 鎶ヨ绾у埆 浣庛�涓�楂�- public string S_ALARM_MSG { get; set; } // 鎶ヨ淇℃伅 - public string S_FILE_NAME { get; set; } // 鏂囦欢鍚�- public int N_LINE_NUM { get; set; } // 琛屽彿 - public string S_PARAMS { get; set; } // 鍙傛暟 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Area.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Area.cs deleted file mode 100644 index 05ca397..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Area.cs +++ /dev/null @@ -1,32 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - [SugarTable("TN_Area")] - public class Area : BaseModel - { - - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_CODE { get; set; } - public string S_NOTE { get; set; } - public int N_FLOOR { get; set; } - public string S_EXT_DATA { get; set; } - public string S_LOC_TYPE { get; set; } - public string S_NAME { get; set; } - public int N_LOC_TYPE { get; set; } - public int N_TYPE { get; set; } - public string S_TYPE { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public int N_DEVICE_TYPE { get; set; } - public string S_DEVICE_TYPE { get; set; } - public string S_DEVICE_NO { get; set; } - public string C_VISUAL { get; set; } - public string S_GROUP { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/BaseModel.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/BaseModel.cs deleted file mode 100644 index d51c36a..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/BaseModel.cs +++ /dev/null @@ -1,24 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models -{ - public class BaseModel - { - [SugarColumn(IsPrimaryKey = true)] - public string S_ID { get; set; } = Guid.NewGuid().ToString("D").ToUpper(); - public string S_CREATOR_ID { get; set; } = "sa"; - public string S_CREATOR_NAME { get; set; } = "瓒呯骇鐢ㄦ埛"; - public DateTime T_CREATE { get; set; } = DateTime.Now; - public DateTime T_MODIFY { get; set; } = DateTime.Now; - /// <summary> - /// 缂栬緫銆佸畾鐗�- /// </summary> - public string S_STATE { get; set; } = "缂栬緫"; - //public string G_SOURCE_OBJ { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/CntrItemRel.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/CntrItemRel.cs deleted file mode 100644 index bb47706..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/CntrItemRel.cs +++ /dev/null @@ -1,43 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - //CntrItemRel - [SugarTable("TN_CG_Detail")] - public class CntrItemRel : BaseModel - { - - public string S_SERIAL_NO { get; set; } // 原材料批次号 - public string S_ITEM_CODE { get; set; } // 物料编码 - public string S_ITEM_NAME { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_ITEM_STATE { get; set; } = "0"; // 检验状态 0:未检验 1:合格,2:不合格 - /// <summary> - /// 1:合格 2:不合格 - /// </summary> - public int N_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } // 批次条码 - - public float F_QTY { get; set; } // 数量 - public string S_UOM { get; set; } = ""; // 规格 - public string S_CNTR_CODE { get; set; } - /// <summary> - /// 分配量,被其它 - /// </summary> - public float F_ALLOC_QTY { get; set; } - public DateTime T_INBOUND_TIME { get; set; } - public string D_PRD_DATE { get; set; } // 生产日期 - public string D_EXP_DATE { get; set; } // 最长停放日期 - public string D_EXP_DATE1 { get; set; } // 最小停放日期 - - /// <summary> - /// 反向映射 - /// </summary> - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToOne, nameof(S_CNTR_CODE), nameof(Container.S_CODE))] - public Container Cntr { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Container.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Container.cs deleted file mode 100644 index 1ff9840..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Container.cs +++ /dev/null @@ -1,67 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace HH.WCS.Mobox3.FJJT { - [SugarTable("TN_Container")] - public class Container : BaseModel { - - - public string S_CODE { get; set; } - public string S_TYPE { get; set; } // 1.胎面;2.胎侧;3.内衬;4.帘布;5.环带;6.冠带;7.钢包 - public string S_SPEC { get; set; } - public float F_WEIGHT { get; set; } - public int N_LENGTH { get; set; } - public int N_WIDTH { get; set; } - public int N_HEIGHT { get; set; } - public string C_IS_VIRTUAL { get; set; } = "N"; - public int N_TYPE { get; set; } - public string C_ENABLE { get; set; } = "Y"; - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public int N_DETAIL_COUNT { get; set; } - public int N_B_STATE { get; set; } - public string S_LOCK_OP_CODE { get; set; } - public string S_LOCK_STATE { get; set; } - public int N_LOCK_STATE { get; set; } - /// <summary> - /// 码盘时候标记 - /// </summary> - public string S_SRC { get; internal set; } - public string S_DEST { get; internal set; } - - // --------------------福建佳通----------------- - public int N_E_STATE { get; set; } = 0; // 托盘异常状态 0.默认 1.WCS读码异常 2.AGV读码器读码异常 3.未查询到RFID的MES任务 4.RFID与任务RFID不一致 5.托盘物料不合格 - public string S_ERR_DESC { get; internal set; } // 异常描述 - - - /// <summary> - /// 获取容器类型string - /// cntrType: 1.胎面;2.胎侧;3.内衬;4.帘布;5.环带;6.冠带;7.钢包 - /// </summary> - /// <param name="cntrType"></param> - /// <returns></returns> - internal static string GetCntrType(int cntrType) - { - var str = ""; - switch (cntrType) - { - case 1: str = "胎面"; break; - case 2: str = "胎侧"; break; - case 3: str = "内衬"; break; - case 4: str = "帘布"; break; - case 5: str = "环带"; break; - case 6: str = "冠带"; break; - case 7: str = "钢包"; break; - case 8: str = "异常托盘"; break; - } - return str; - } - - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToMany, nameof(CntrItemRel.S_CNTR_CODE), nameof(S_CODE))] - public List<CntrItemRel> CntrItemRels { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/FunctionArea.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/FunctionArea.cs deleted file mode 100644 index 0d2cc09..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/FunctionArea.cs +++ /dev/null @@ -1,30 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - [SugarTable("TN_Function_Area")] - public class FunctionArea : BaseModel { - - - /// <summary> - /// Area、Zone、Warehouse、Location - /// </summary> - public string S_MASTER_CLS { get; set; } - public string S_MASTER_CODE { get; set; } - /// <summary> - /// 0 – 无 1 – 收货 2 – 检验 3 – 理货 4 – 分拣 5 – 发货 - /// 6 – 不合格品 - /// 10 – 入库接驳 11 – 出库接驳 - /// </summary> - public int N_TYPE { get; set; } - public int N_PRIORITY { get; set; } - public string S_TYPE { get; set; } - /// <summary> - /// 0 – 库区 1 – 货位 2 – 逻辑库区 - /// </summary> - public int N_FA_TYPE { get; set; } - public string S_FA_CODE { get; set; } - public string S_FA_NAME { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjItem.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjItem.cs deleted file mode 100644 index 3e74990..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjItem.cs +++ /dev/null @@ -1,28 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - /// <summary> - /// 鍩虹鐗╂枡淇℃伅琛�- /// </summary> - [SugarTable("TN_LJ_ITEM")] - internal class LjItem : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string MATERIAL_CODE { get; set; } //鐗╂枡缂栫爜 - public string MATERIAL_NAME { get; set; } //鐗╂枡绠�О - public string SPEC { get; set; } //瑙勬牸 - public string MODEL { get; set; } //鍨嬪彿 - public string UNIT { get; set; } //鍗曚綅 - public string MEMO { get; set; } //澶囨敞 - public string CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - public string RECEIVE_FLAG { get; set; } //璁板綍鐘舵� PENDING锛氶粯璁�COMPLETE锛氳鍙�- public string RECEIVE_DATE { get; set; } //璇诲彇鏃ユ湡 璇诲彇鍚庢洿鏂�- } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjItemConfig.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjItemConfig.cs deleted file mode 100644 index b840031..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjItemConfig.cs +++ /dev/null @@ -1,28 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - /// <summary> - /// 鐗╂枡閰嶇疆琛�- /// </summary> - [SugarTable("TN_ITEM_CONFIG")] - internal class LjItemConfig : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string MATERIAL_CODE { get; set; } //鐗╂枡缂栫爜 - public string MATERIAL_NAME { get; set; } //鐗╂枡鍚嶇О - public string PALLET_TYPE { get; set; } //鎵樼洏绫诲瀷 - public string QTY { get; set; } //瀹夊叏搴撳瓨閲�宸ヨ鏁伴噺 - public string TRANSFER_FLAG { get; set; } //杞繍鏍囪 Y锛氫紭鍏堣浆杩�N: - public DateTime CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - public string RECEIVE_FLAG { get; set; } //璁板綍鐘舵� PENDING锛氶粯璁�COMPLETE锛氳鍙�- public DateTime RECEIVE_DATE { get; set; } //璇诲彇鏃ユ湡 - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotCarrier.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotCarrier.cs deleted file mode 100644 index e483aa3..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotCarrier.cs +++ /dev/null @@ -1,32 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - - /// <summary> - /// 鎵樼洏涓庣墿鏂欎俊鎭搴旇〃 - /// </summary> - [SugarTable("TN_LOT_CARRIER")] - internal class LjLotCarrier : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string PALLET_ID { get; set; } //鎵樼洏鍙�- public string LOT_NAME { get; set; } //鎵规鏉$爜 (鎵规琛ㄦ洿鏂� - public string YCL_BATCH { get; set; } //鍘熸潗鏂欐壒娆″彿 - public string MATERIALCODE { get; set; } //鐗╂枡缂栫爜 - public int QTY { get; set; } //鐗╂枡鏁伴噺 - public string PRODUCTION_DATE { get; set; } //鐢熶骇鏃ユ湡 - public string QC_STATUS { get; set; } //妫�獙鐘舵� - public string SHELFLIFE_DATE { get; set; } //鏈�暱鍋滄斁鏃ユ湡 - public string MINSHELFLIFE_DATE { get; set; } //鏈�皬鍋滄斁鏃ユ湡 - public string CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - public string RECEIVE_FLAG { get; set; } //璁板綍鐘舵� PENDING锛氶粯璁�COMPLETE锛氳鍙�- public string RECEIVE_DATE { get; set; } //璇诲彇鏃ユ湡 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotOnhand.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotOnhand.cs deleted file mode 100644 index 9f69fe0..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotOnhand.cs +++ /dev/null @@ -1,28 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - /// <summary> - /// 搴撳瓨琛�- /// </summary> - [SugarTable("TN_LJ_LOT_ONHAND")] - internal class LjLotOnhand : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string MATERIAL_CODE { get; set; } //鐗╂枡缂栫爜 - public string LOT_NAME { get; set; } //鎵规鏉$爜 - public string PALLET_ID { get; set; } //鎵樼洏鍙�- public string STORAGE_LOCATION { get; set; } //搴撲綅 - public string QC_STATUS { get; set; } //鐘舵� - public string UNIT { get; set; } //鍗曚綅 - public float QTY { get; set; } //鏁伴噺 - public DateTime IN_DATE { get; set; } //鍏ュ簱鏃堕棿 - public DateTime CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotOutTask.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotOutTask.cs deleted file mode 100644 index af7b3b3..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotOutTask.cs +++ /dev/null @@ -1,33 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - /// <summary> - /// WMS鍑哄簱浠诲姟璁板綍琛�- /// </summary> - /// - [SugarTable("TN_LOT_OUT_TASK")] - internal class LjLotOutTask : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string MATERIAL_CODE { get; set; } //鐗╂枡缂栫爜 - public string LOT_NAME { get; set; } //鎵规鏉$爜 - public string PALLET_ID { get; set; } //鎵樼洏鍙�- public string POSITION_ID { get; set; } //鐐逛綅缂栧彿 - public string QC_STATUS { get; set; } //鐘舵� - public string UNIT { get; set; } //鍗曚綅 - public int QTY { get; set; } //鏁伴噺 - public string OUT_DATE { get; set; } //鍑哄簱鏃堕棿 - public string CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - public string RECEIVE_FLAG { get; set; } //璁板綍鐘舵� PENDING锛氶粯璁�COMPLETE锛氳鍙�- public string RECEIVE_DATE { get; set; } //璇诲彇鏃ユ湡 - public string TASK_STATUS { get; set; } //浠诲姟鎵ц鐘舵� 1锛氭墽琛屼腑锛�锛氬畬鎴� 3锛氭満鍙板凡杩斿洖 - public string EQP { get; set; } //鏈哄彴缂栧彿 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotStatus.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotStatus.cs deleted file mode 100644 index 970d811..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjLotStatus.cs +++ /dev/null @@ -1,29 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - /// <summary> - /// 鎵规鐘舵�鏇存柊琛�- /// </summary> - [SugarTable("TN_LOT_STATUS")] - internal class LjLotStatus : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string MATERIAL_CODE { get; set; } //鐗╂枡缂栫爜 - public string LOT_NAME { get; set; } //鎵规鏉$爜 - public string QC_STATUS { get; set; } //鐘舵� - public string UNIT { get; set; } //鍗曚綅 - public string QTY { get; set; } //鏁伴噺 - public string SHELFLIFE_DATE { get; set; } //鏈�暱鍋滄斁鏃ユ湡 浼氬彉鏇�- public string MINSHELFLIFE_DATE { get; set; } //鏈�皬鍋滄斁鏃ユ湡 浼氬彉鏇�- public DateTime CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - public string RECEIVE_FLAG { get; set; } //璁板綍鐘舵� PENDING锛氶粯璁�COMPLETE锛氳鍙�- public DateTime RECEIVE_DATE { get; set; } //璇诲彇鏃ユ湡 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjMesTask.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjMesTask.cs deleted file mode 100644 index 8a4a876..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjMesTask.cs +++ /dev/null @@ -1,35 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - /// <summary> - /// MES涓嬪彂浠诲姟琛�- /// </summary> - [SugarTable("TN_MES_TASK")] - public class LjMesTask : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string POSITION_ID { get; set; } //鐐逛綅缂栧彿 - public string RETURN_CODE { get; set; } //鍙嶉鏍囪瘑(AGV绯荤粺鍐欏叆) 0:榛樿鍊�1锛氫换鍔″凡鐢熸垚 2锛氫换鍔¤繍琛屼腑 3锛氫换鍔″畬鎴�4锛氫换鍔″け璐�5锛氫换鍔″彇娑�6锛氬叾浠栭敊璇�- public string MSG_TYPE { get; set; } //娑堟伅绫诲瀷 0锛氳鏂� 1锛氳繑杞�- public string PALLET_TYPE { get; set; } //鎵樼洏绫诲瀷 1.鑳庨潰锛�.鑳庝晶锛�.鍐呰‖锛�.甯樺竷锛�.鐜甫锛�.鍐犲甫锛�.閽㈠寘 - public string MATERIAL_NAME { get; set; } //鐗╂枡鍚嶇О 瑕佹枡鏃剁粰 - public string MATERIAL_CODE { get; set; } //鐗╂枡缂栫爜 瑕佹枡鏃剁敤锛岃鏂欐椂锛屽鏋滅墿鏂欑紪鐮佷负绌猴紝浠h〃瑕佺┖宸ヨ - public int QTY { get; set; } //鏁伴噺 杩旇溅鏃剁敤锛屾暟閲忎负0浠h〃杩旂┖杞︼紝鏁伴噺涓�浠h〃杩旀弧鏂欙紝鏁伴噺涓�1浠h〃杩斾綑鏂欍� 鐗╂枡淇℃伅鍦ㄣ�鎵樼洏涓庝俊鎭搴旇〃銆戜腑 - public string YCL_BATCH { get; set; } //鍘熸潗鏂欐壒娆″彿 - public string PALLET_ID { get; set; } //鎵樼洏鍙�杩旇溅鏃剁敤锛屾牴鎹墭鐩樺彿鏌ユ壘銆愭墭鐩樹笌淇℃伅瀵瑰簲琛ㄣ�涓殑淇℃伅 - public string AGVORDER_ID { get; set; } //AGV浠诲姟鍙�MES涓嶇敤鍐欏叆锛孉GV浣跨敤 - public string CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - public string RECEIVE_FLAG { get; set; } //璁板綍鐘舵� PENDING锛氶粯璁�COMPLETE锛氳鍙�- public string RECEIVE_DATE { get; set; } //璇诲彇鏃ユ湡 璇诲彇鍚庢洿鏂�- public string EQP { get; set; } //鏈哄彴缂栧彿 - public string PLAN_ID { get; set; } //璁″垝鍙�- public string RECEIVE_MSG { get; set; } //閿欒淇℃伅 閿欒鏃讹紝AGV鍐欏叆璇︾粏閿欒淇℃伅 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjXcOutTask.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjXcOutTask.cs deleted file mode 100644 index 7fcaa3e..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjXcOutTask.cs +++ /dev/null @@ -1,33 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - /// <summary> - /// WMS鍑哄簱浠诲姟璁板綍琛�- /// </summary> - /// - [SugarTable("TN_LOOP_OUT_TASK")] - internal class LjXcOutTask : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string MATERIAL_CODE { get; set; } //鐗╂枡缂栫爜 - public string LOT_NAME { get; set; } //鎵规鏉$爜 - public string PALLET_ID { get; set; } //鎵樼洏鍙�- public string POSITION_ID { get; set; } //鐐逛綅缂栧彿 - public string QC_STATUS { get; set; } //鐘舵� - public string UNIT { get; set; } //鍗曚綅 - public int QTY { get; set; } //鏁伴噺 - public string OUT_DATE { get; set; } //鍑哄簱鏃堕棿 - public DateTime CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - public string RECEIVE_FLAG { get; set; } //璁板綍鐘舵� PENDING锛氶粯璁�COMPLETE锛氳鍙�- public DateTime RECEIVE_DATE { get; set; } //璇诲彇鏃ユ湡 - public string TASK_STATUS { get; set; } //浠诲姟鎵ц鐘舵� 1锛氭墽琛屼腑锛�锛氬畬鎴� 3锛氭満鍙板凡杩斿洖 - public string EQP { get; set; } //鏈哄彴缂栧彿 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjXcTask.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjXcTask.cs deleted file mode 100644 index 2a7f3b5..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LjXcTask.cs +++ /dev/null @@ -1,35 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJF.models -{ - /// <summary> - /// WMS涓嬪彂浠诲姟琛�- /// </summary> - [SugarTable("TN_AGV_TASK")] - internal class LjXcTask : BaseModel - { - public int ID { get; set; } //涓婚敭 - public string POSITION_ID { get; set; } //鐐逛綅缂栧彿 - public string RETURN_CODE { get; set; } //鍙嶉鏍囪瘑(AGV绯荤粺鍐欏叆) 0:榛樿鍊�1锛氫换鍔″凡鐢熸垚 2锛氫换鍔¤繍琛屼腑 3锛氫换鍔″畬鎴�4锛氫换鍔″け璐�5锛氫换鍔″彇娑�6锛氬叾浠栭敊璇�- public string MSG_TYPE { get; set; } //娑堟伅绫诲瀷 0锛氳鏂� 1锛氳繑杞�- public string PALLET_TYPE { get; set; } //鎵樼洏绫诲瀷 1.鑳庨潰锛�.鑳庝晶锛�.鍐呰‖锛�.甯樺竷锛�.鐜甫锛�.鍐犲甫锛�.閽㈠寘 - public string MATERIAL_NAME { get; set; } //鐗╂枡鍚嶇О 瑕佹枡鏃剁粰 - public string MATERIAL_CODE { get; set; } //鐗╂枡缂栫爜 瑕佹枡鏃剁敤锛岃鏂欐椂锛屽鏋滅墿鏂欑紪鐮佷负绌猴紝浠h〃瑕佺┖宸ヨ - public int QTY { get; set; } //鏁伴噺 杩旇溅鏃剁敤锛屾暟閲忎负0浠h〃杩旂┖杞︼紝鏁伴噺涓�浠h〃杩旀弧鏂欙紝鏁伴噺涓�1浠h〃杩斾綑鏂欍� 鐗╂枡淇℃伅鍦ㄣ�鎵樼洏涓庝俊鎭搴旇〃銆戜腑 - public string YCL_BATCH { get; set; } //鍘熸潗鏂欐壒娆″彿 - public string PALLET_ID { get; set; } //鎵樼洏鍙�杩旇溅鏃剁敤锛屾牴鎹墭鐩樺彿鏌ユ壘銆愭墭鐩樹笌淇℃伅瀵瑰簲琛ㄣ�涓殑淇℃伅 - public string AGVORDER_ID { get; set; } //AGV浠诲姟鍙�MES涓嶇敤鍐欏叆锛孉GV浣跨敤 - public string CREATION_DATE { get; set; } //鍒涘缓鏃ユ湡 - public string RECEIVE_FLAG { get; set; } //璁板綍鐘舵� PENDING锛氶粯璁�COMPLETE锛氳鍙�- public string RECEIVE_DATE { get; set; } //璇诲彇鏃ユ湡 璇诲彇鍚庢洿鏂�- public string EQP { get; set; } //鏈哄彴缂栧彿 - public string PLAN_ID { get; set; } //璁″垝鍙�- public string RECEIVE_MSG { get; set; } //閿欒淇℃伅 閿欒鏃讹紝AGV鍐欏叆璇︾粏閿欒淇℃伅 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LocCntrRel.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LocCntrRel.cs deleted file mode 100644 index 936c6d0..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LocCntrRel.cs +++ /dev/null @@ -1,33 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace HH.WCS.Mobox3.FJJT -{ - //TN_Loc_Container - //LocCntrRel - [SugarTable("TN_Loc_Container")] - public class LocCntrRel : BaseModel - { - - public string S_LOC_CODE { get; set; } - public string S_CNTR_CODE { get; set; } - public string S_ACTION_SRC { get; set; } - public string S_BINDING_METHOD { get; set; } - public int N_BINDING_METHOD { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public int N_BIND_ORDER { get; set; } - - - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToMany, nameof(S_CNTR_CODE))] - public List<CntrItemRel> CntrItemRels { get; set; } - - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToOne, nameof(S_CNTR_CODE))] - public Container Container { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Location.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Location.cs deleted file mode 100644 index 970a043..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Location.cs +++ /dev/null @@ -1,70 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - - [SugarTable("TN_Location")] - public class Location : BaseModel { - - - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_CODE { get; set; } - public string S_NAME { get; set; } - public string S_AREA_CODE { get; set; } - public int N_CAPACITY { get; set; } - public string S_AGV_SITE { get; set; } - public int N_CURRENT_NUM { get; set; } - public DateTime? T_EMPTY_TIME { get; set; } - public DateTime? T_FULL_TIME { get; set; } - public string S_NOTE { get; set; } - public int N_LENGTH { get; set; } - public int N_WIDTH { get; set; } - public int N_HEIGHT { get; set; } - public int N_AGV_SITE_LAYER { get; set; } - public int N_ROADWAY { get; set; } - public int N_ROW { get; set; } - public int N_COL { get; set; } - public int N_LAYER { get; set; } - public string S_TYPE { get; set; } - - /// <summary> - /// 0鏃�1鍏ュ簱閿�2鍑哄簱閿�3鍏跺畠閿�- /// </summary> - public string S_LOCK_STATE { get; set; } - public int N_TYPE { get; set; } - /// <summary> - /// 0鏃�1鍏ュ簱閿�2鍑哄簱閿�3鍏跺畠閿�- /// </summary> - public int N_LOCK_STATE { get; set; } - public int N_PURPOSE { get; set; } - public string S_PURPOSE { get; set; } - public string C_ENABLE { get; set; } - public string C_SAME_GOOD { get; set; } - public string C_SAME_BATCH { get; set; } - public string C_SPECIFY_ITEM { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_LOCK_OP { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public int N_POS { get; set; } - public string S_GROUP { get; set; } - - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToMany, nameof(S_CODE))] - public LocCntrRel LocCntrRel { get; set; } - - internal static string GetLockStateStr(int lockState) { - var str = ""; - switch (lockState) { - case 0: str = "鏃�; break; - case 1: str = "鍏ュ簱閿�; break; - case 2: str = "鍑哄簱閿�; break; - case 3: str = "鍏跺畠閿�; break; - } - return str; - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LogicConfig.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LogicConfig.cs deleted file mode 100644 index 0a94f5b..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/LogicConfig.cs +++ /dev/null @@ -1,25 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models -{ - [SugarTable("TN_WMS_Zone")] - public class LogicConfig : BaseModel - { - public string S_JT_CODE { get; set; } //鏈哄彴鍙�- public string S_MTJBLOC { get; set; } //婊℃鍏ュ簱鎺ラ┏浣�- public string S_JTBKLYLOC { get; set; } //鏈哄彴琛ョ┖鏉ユ簮浣�- public string S_LKBKHCLOC { get; set; } //琛ョ┖缂撳瓨浣�- public string S_LKKTJBLOC { get; set; } //琛ョ┖鎺ラ┏浣�- public string S_AREA_CODE { get; set; } //鍏宠仈绔嬪簱 - public string S_TASK_TYPE { get; set; } //浠诲姟绫诲瀷 1.鑳庝晶鐩磋繛绫诲瀷 2.甯樺竷鐩磋繛绫诲瀷 3.闈炵洿杩炵被鍨�- public string S_PRI { get; set; } //浼樺厛绾�- public string S_RG_LOC { get; set; } //鏄惁涓轰汉宸ヤ笅绾夸綅 - public string S_ENABLE { get; set; } //鏄惁鍚敤 - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_OP_DEF.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_OP_DEF.cs deleted file mode 100644 index 662092c..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_OP_DEF.cs +++ /dev/null @@ -1,33 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// 姝や唬鐮佹槸鏍规嵁妯℃澘鐢熸垚鐨勩� -// -// 鎵嬪姩鏇存敼姝ゆ枃浠跺彲鑳戒細瀵艰嚧搴旂敤绋嬪簭涓彂鐢熷紓甯歌涓恒� -// 濡傛灉閲嶆柊鐢熸垚浠g爜锛屽垯灏嗚鐩栧姝ゆ枃浠剁殑鎵嬪姩鏇存敼銆�-// </auto-generated> -//------------------------------------------------------------------------------ - -namespace ConsoleApp1 -{ - using System; - using System.Collections.Generic; - - public partial class OI_WMS_OP_DEF - { - public string G_ID { get; set; } - public string S_FACTORY { get; set; } - public string S_OP_CODE { get; set; } - public string S_OP_NAME { get; set; } - public string S_NOTE { get; set; } - public string S_START_WH { get; set; } - public string S_START_AREA { get; set; } - public string S_START_LOC { get; set; } - public string S_END_WH { get; set; } - public string S_END_AREA { get; set; } - public string S_END_LOC { get; set; } - public int N_PRIORITY { get; set; } - public short N_WORK_MODE { get; set; } - public short N_OP_TYPE { get; set; } - public string C_ENABLE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_SCHEDULE_TYPE.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_SCHEDULE_TYPE.cs deleted file mode 100644 index 4f8476e..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_SCHEDULE_TYPE.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// 姝や唬鐮佹槸鏍规嵁妯℃澘鐢熸垚鐨勩� -// -// 鎵嬪姩鏇存敼姝ゆ枃浠跺彲鑳戒細瀵艰嚧搴旂敤绋嬪簭涓彂鐢熷紓甯歌涓恒� -// 濡傛灉閲嶆柊鐢熸垚浠g爜锛屽垯灏嗚鐩栧姝ゆ枃浠剁殑鎵嬪姩鏇存敼銆�-// </auto-generated> -//------------------------------------------------------------------------------ - -namespace ConsoleApp1 -{ - using System; - using System.Collections.Generic; - - public partial class OI_WMS_SCHEDULE_TYPE - { - public string G_ID { get; set; } - public string S_FACTORY { get; set; } - public string S_SCHEDULE_TYPE { get; set; } - public short N_ORDER { get; set; } - public string S_IP { get; set; } - public Nullable<int> N_PORT { get; set; } - public short N_SCHEDULE_TYPE { get; set; } - public int N_INTERVAL { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_TASK_TYPE.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_TASK_TYPE.cs deleted file mode 100644 index 26b9c92..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/OI_WMS_TASK_TYPE.cs +++ /dev/null @@ -1,14 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - [SugarTable("OI_WMS_TASK_TYPE")] - public partial class TaskType { - public string G_ID { get; set; } = Guid.NewGuid().ToString("D"); - public string S_FACTORY { get; set; } - public string S_TASK_TYPE { get; set; } - public short N_ORDER { get; set; } - public short N_TASK_TYPE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ProcessInstance.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ProcessInstance.cs deleted file mode 100644 index 8844971..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ProcessInstance.cs +++ /dev/null @@ -1,24 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models -{ - [SugarTable("TN_Process_Instance")] - internal class ProcessInstance : BaseModel - { - public string S_CODE { get; set; } // 娴佺▼瀹炰緥缂栫爜 - public string S_PRO_DEF_CODE { get; set; } // 娴佺▼瀹氫箟缂栫爜 - public string S_PRO_DEF_NAME { get; set; } // 娴佺▼瀹氫箟鍚嶇О - public string S_B_STATUS { get; set; } // 瀹炰緥鐘舵� 鎵ц銆佸畬鎴愩�澶辫触 - public string S_OFF_LINE_LOC { get; set; } // 涓嬬嚎璐т綅 - public string S_OFF_CNTR_CODE { get; set; } // 涓嬬嚎瀹瑰櫒缂栫爜 - public string S_CALL_ITEM_LOC { get; set; } // 鍙枡璐т綅 - public string S_CALL_CNTR_CODE { get; set; } // 鍙枡瀹瑰櫒缂栫爜 - public DateTime T_START_TIME { get; set; } // 寮�鏃堕棿 - public DateTime T_END_TIME { get; set; } // 缁撴潫鏃堕棿 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/PutawayDetail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/PutawayDetail.cs deleted file mode 100644 index 8a58959..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/PutawayDetail.cs +++ /dev/null @@ -1,64 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - [SugarTable("TN_Putaway_Detail")] - public class PutawayDetail : BaseModel - { - - - public int N_ROW_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - /// <summary> - /// 0/1-合格/2-待检/3-丌合格 - /// </summary> - public string S_ITEM_STATE { get; set; } = "合格"; - public string S_BATCH_NO { get; set; } - public string S_ITEM_SPEC { get; set; } - /// <summary> - /// 唯一码 - /// </summary> - public string S_SERIAL_NO { get; set; } = ""; - public string D_PRD_DATE { get; set; } - public string D_EXP_DATE { get; set; } - public string S_NOTE { get; set; } - public float F_QTY { get; set; } - /// <summary> - /// 计量单位 - /// </summary> - public string S_UOM { get; set; } = ""; - /// <summary> - /// 累计关闭数量 - /// </summary> - public float F_ACC_C_QTY { get; set; } - public string S_PUTAWAY_NO { get; set; } - /// <summary> - /// 0/1-合格/2-待检/3-丌合格 - /// </summary> - public int N_ITEM_STATE { get; set; } = 1; - /// <summary> - /// 累计绑定数量 - /// </summary> - public float F_ACC_B_QTY { get; set; } - public int N_B_STATE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_BS_NO { get; set; } - public string S_BS_TYPE { get; set; } - public string S_ITEM_ROUTE { get; set; } = ""; - public float F_NET_WEIGHT { get; set; } - public float F_GROSS_WEIGHT { get; set; } - /// <summary> - /// 重量单位 - /// </summary> - public string S_WU { get; set; } = "kg"; - /// <summary> - /// 分配量 - /// </summary> - public float F_ALLOC_QTY { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/PutawayOrder.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/PutawayOrder.cs deleted file mode 100644 index f5694b9..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/PutawayOrder.cs +++ /dev/null @@ -1,39 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace HH.WCS.Mobox3.FJJT -{ - [SugarTable("TN_Putaway_Order")] - public class PutawayOrder : BaseModel - { - - - public string S_NO { get; set; } - public string S_SUPPLIER_NO { get; set; } - public string S_SUPPLIER_NAME { get; set; } - public string S_BATCH_NO { get; set; } - public string S_END_USER { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_NOTE { get; set; } - public string S_AUDIT_INFO { get; set; } - public string S_AUDIT_RESULT { get; set; } - public string S_RECEIPT_NO { get; set; } - public string S_AREA_CODE { get; set; } - public string S_BS_TYPE { get; set; } - public string S_BS_NO { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - /// <summary> - /// 当审核定版后,这个状态=1 表示执行 2 – 表示完成 默讣=0 - /// </summary> - public int N_B_STATE { get; set; } - - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToMany,nameof(PutawayDetail.S_PUTAWAY_NO), nameof(S_NO))] - public List<PutawayDetail> Details { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Safety_Inventory.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Safety_Inventory.cs deleted file mode 100644 index e6ba87e..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Safety_Inventory.cs +++ /dev/null @@ -1,21 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models -{ - [SugarTable("TN_Safety_Inventory")] - internal class Safety_Inventory : BaseModel - { - public string S_MATERIAL_CODE { get; set; } // 鐗╂枡缂栫爜 - public string S_MATERIAL_NAME { get; set; } // 鐗╂枡鍚嶇О - public string S_PALLET_TYPE { get; set; } // 鎵樼洏绫诲瀷 - public string S_AREA_CODE { get; set; } // 搴撳尯 - public float F_UPPER_LIMIT_QTY { get; set; } // 瀹夊叏搴撳瓨涓婇檺 - public float F_LOWER_LIMIT_QTY { get; set; } // 瀹夊叏搴撳瓨涓嬮檺 - public string S_TRANSFER_FLAG { get; set; } // 瑁呰繍鏍囪瘑 Y锛氫紭鍏堣浆杩�N: - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ShippingDetail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ShippingDetail.cs deleted file mode 100644 index 469f3e8..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ShippingDetail.cs +++ /dev/null @@ -1,49 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - [SugarTable("TN_Shipping_Detail")] - public class ShippingDetail : BaseModel - { - /// <summary> - /// 不要设置主键 - /// </summary> - public string S_SHIPPING_NO { get; set; } - public int N_ROW_NO { get; set; } - public string S_BATCH_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_STATE { get; set; } = "合格"; - public string S_ITEM_SPEC { get; set; } - public string S_SERIAL_NO { get; set; } = ""; - public float F_QTY { get; set; } - public float F_OOS_QTY { get; set; } - public string S_OOS_REASON { get; set; } = ""; - public string S_UOM { get; set; } = "kg"; - public string S_NOTE { get; set; } - public string S_STATE_PRE { get; set; } - public string S_ITEM_ROUTE { get; set; } = ""; - /// <summary> - /// 累计配货数量 - /// </summary> - public float F_ACC_D_QTY { get; set; } - /// <summary> - /// 用处不大(分拣结果生成下架单数量,根据项目而定,如果是分拣确定一次就回报一次那和累计分拣数量就没有区别) - /// </summary> - //public float F_ACC_O_QTY { get; set; } - - /// <summary> - /// 累计分拣数量(分拣结果累计) - /// </summary> - public float F_ACC_S_QTY { get; set; } - /// <summary> - /// 累计关闭数量 - /// </summary> - public float F_ACC_C_QTY { get; set; } - public float F_ACC_NC_QTY { get; set; } - - public int N_ITEM_STATE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ShippingOrder.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ShippingOrder.cs deleted file mode 100644 index 6624d25..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ShippingOrder.cs +++ /dev/null @@ -1,55 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Reflection.Emit; - -namespace HH.WCS.Mobox3.FJJT { - /// <summary> - ///发货单需要有定版后事件(S_STATE=定版),在这个事件中,系统会创建触发一个名为"创建分拣单"的发货单事件,由这个脚本来【分拣单/分拣单子表】,在创建分拣单时需要判断仓库里是否有足够数量的货品,如果没有足够数量的货品生成缺货单,并且 设置【发货单】的业务状态 N_B_STATE = 1(待分拣)。 这个状态说明分拣单、分拣单子表已经创建。等待生成分拣明细(分拣明细需要具体到某个容器) - ///在分拣单里已经明确了出货的仓库、库区,并且在仓库、库区加上分配量 - /// </summary> - [SugarTable("TN_Shipping_Order")] - public class ShippingOrder : BaseModel { - - public string S_NO { get; set; } - public string S_TYPE { get; set; } - public string S_NOTE { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string D_OP_DATE { get; set; } - public string D_PLAN_DATE { get; set; } - public string D_LATEST_DATE { get; set; } - public int N_PRIORITY { get; set; } - /// <summary> - /// 波次单,默认就用分拣单单号 - /// </summary> - public string S_WAVE_CODE { get; set; } = ""; - public string S_AUDIT_INFO { get; set; } = ""; - public string S_AUDIT_RESULT { get; set; } - public string S_BS_TYPE { get; set; } = ""; - public string S_BS_NO { get; set; } = ""; - public string S_STATE_PRE { get; set; } - - /// <summary> - ///0 – 未生成分拣单 - ///1 待分拣(分拣单及分拣单子表已经创建) 2- 分拣中(生成 - ///分拣单明细)– 3 -分拣完成 4 – 发货完成 (分拣结果)5 – 缺件 - /// </summary> - public int N_B_STATE { get; set; } - public string S_ERR { get; set; } - public string C_AUTO_SORTING { get; set; } = "N"; - public string C_SHIPPING_FIRST { get; set; } = ""; - public string S_END_USER { get; set; } = ""; - - //public string S_SORTING_AREA { get; set; } - //public string S_SORTING_LOC { get; set; } - /// <summary> - /// 反向映射,不要初始化,子表不要设置外键 - /// </summary> - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToMany,nameof(ShippingDetail.S_SHIPPING_NO),nameof(S_NO))] - public List<ShippingDetail> Details { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SideLocConfig.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SideLocConfig.cs deleted file mode 100644 index 83e66e7..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SideLocConfig.cs +++ /dev/null @@ -1,20 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models -{ - /// <summary> - /// 鎴愬瀷鏈虹嚎杈瑰彨鏂欒揣浣�- /// </summary> - - [SugarTable("TN_Side_Loc_Config")] - internal class SideLocConfig : BaseModel - { - public string S_LOC_CODE { get; set; } - public string S_RETURN_LOC_CODE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingCompose.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingCompose.cs deleted file mode 100644 index 62d74d2..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingCompose.cs +++ /dev/null @@ -1,37 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - [SugarTable("TN_Sorting_Compose")] - public class SortingCompose : BaseModel { - - - public string S_SORTING_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - /// <summary> - /// 0 未知/1-待检/2-合格/3-不合格 - /// </summary> - public string S_ITEM_STATE { get; set; } = "合格"; - public string S_BATCH_NO { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_SERIAL_NO { get; set; } = ""; - public float F_QTY { get; set; } - public string S_UOM { get; set; } = "kg"; - public string S_NOTE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - /// <summary> - /// 0 未知/1-待检/2-合格/3-不合格 - /// </summary> - public int N_ITEM_STATE { get; set; } = 2; - public int N_ROW_NO { get; set; } - /// <summary> - /// 分拣单明细数量汇总 - /// </summary> - public float F_ACC_S_QTY { get; set; } - - public string S_ITEM_ROUTE { get; set; } = ""; - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingDetail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingDetail.cs deleted file mode 100644 index e69df6c..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingDetail.cs +++ /dev/null @@ -1,38 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - [SugarTable("TN_Sorting_Detail")] - public class SortingDetail : BaseModel { - - - public string S_SORTING_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_STATE { get; set; } = ""; - public string S_BATCH_NO { get; set; } - public string S_SERIAL_NO { get; set; } = ""; - public string S_ITEM_SPEC { get; set; } - public string S_CNTR_CODE { get; set; } - public string S_GRID_NO { get; set; } = ""; - public float F_QTY { get; set; } - /// <summary> - /// 累计分拣数量(分拣结果的累计) - /// </summary> - //public float F_ACC_SR_QTY { get; set; } - public string S_UOM { get; set; } = "kg"; - public string S_NOTE { get; set; } = ""; - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_ITEM_ROUTE { get; set; } = ""; - public int N_ITEM_STATE { get; set; } - public int N_ROW_NO { get; set; } - /// <summary> - /// 0 – 待执行 1 – 执行 2 – 完成 3 – 错误 - /// </summary> - public int N_B_STATE { get; set; } - public string S_OP_CODE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingOrder.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingOrder.cs deleted file mode 100644 index 03baa3a..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingOrder.cs +++ /dev/null @@ -1,57 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace HH.WCS.Mobox3.FJJT -{ - [SugarTable("TN_Sorting_Order")] - public class SortingOrder : BaseModel - { - - - public string S_NO { get; set; } = ""; - public string S_SHIPPING_NO { get; set; } = ""; - /// <summary> - /// 生产出库/销售出库/退库/ - /// </summary> - public string S_TYPE { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_AREA_CODE { get; set; } - public string S_SORTING_AREA { get; set; } - public string S_SORTING_LOC { get; set; } - public string D_OP_DATE { get; set; } - public string S_NOTE { get; set; } - /// <summary> - /// 从发货单继承的属性 - /// </summary> - public string S_BS_TYPE { get; set; } - /// <summary> - /// 从发货单继承的属性 - /// </summary> - public string S_BS_NO { get; set; } - public string S_STATE_PRE { get; set; } = ""; - public int N_REVIEW_RESULT { get; set; } - - /// <summary> - /// 1 开始配货(自动开始配货或者人工按钮开始配合) 2- 配货完成 3 – 开始作业 4 – 作业已创建 10 –分拣完成 20 – 错误 21 – 暂停 - /// </summary> - public int N_B_STATE { get; set; } - public string S_END_USER { get; set; } - public string S_ERR { get; set; } - public DateTime? T_LAST_PROC { get; set; } - public int N_PROC_COUNT { get; set; } - public int N_LASTE_B_STATE { get; set; } - /// <summary> - /// Y = 配货完成后马上安排作业开始搬运 - /// </summary> - //public string C_AUTO_OP { get; set; } = "N"; - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToMany, nameof(SortingCompose.S_SORTING_NO), nameof(S_NO))] - public List<SortingCompose> Composes { get; set; } - - [Navigate(NavigateType.OneToMany, nameof(SortingDetail.S_SORTING_NO), nameof(S_NO))] - public List<SortingDetail> Details { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingResult.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingResult.cs deleted file mode 100644 index d301405..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/SortingResult.cs +++ /dev/null @@ -1,32 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - [SugarTable("TN_Sorting_Result")] - public class SortingResult : BaseModel - { - - - public string S_SORTING_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_STATE { get; set; } = ""; - public string S_BATCH_NO { get; set; } = ""; - public string S_ITEM_SPEC { get; set; } = ""; - public string S_SERIAL_NO { get; set; } = ""; - public string S_CNTR_CODE { get; set; } - public string S_LOC_CODE { get; set; } - public string S_GRID_NO { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } = "kg"; - public string S_NOTE { get; set; } = ""; - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_ITEM_ROUTE { get; set; } = ""; - public int N_ITEM_STATE { get; set; } = 2; - public int N_ROW_NO { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_ASN_Detail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_ASN_Detail.cs deleted file mode 100644 index 8ef36e2..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_ASN_Detail.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_ASN_Detail : BaseModel - { - - public string S_ASN_NO { get; set; } - public int N_ROW_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_STATE { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_NOTE { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } - public float F_ACC_C_QTY { get; set; } - public int N_ITEM_STATE { get; set; } - public float F_ACC_R_QTY { get; set; } - public float F_ACC_UNQ_QTY { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_ITEM_ROUTE { get; set; } - public string S_BS_TYPE { get; set; } - public string S_BS_NO { get; set; } - public string S_BS_ROW_NO { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_ASN_Order.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_ASN_Order.cs deleted file mode 100644 index d02b2b3..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_ASN_Order.cs +++ /dev/null @@ -1,25 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_ASN_Order : BaseModel - { - - public string S_NO { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string D_OP_DATE { get; set; } - public string D_PLAN_DATE { get; set; } - public string D_LATEST_DATE { get; set; } - public int N_PRIORITY { get; set; } - public string S_SUPPLIER_NO { get; set; } - public string S_SUPPLIER_NAME { get; set; } - public string S_END_USER { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public int N_B_STATE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Business_Source.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Business_Source.cs deleted file mode 100644 index 250c7a9..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Business_Source.cs +++ /dev/null @@ -1,20 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Business_Source : BaseModel - { - - - public string S_BS_TYPE { get; set; } - public int N_ID { get; set; } - public string C_UNINSPECTED { get; set; } - public string S_SOURCE { get; set; } - public string S_NOTE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_Detail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_Detail.cs deleted file mode 100644 index f26e432..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_Detail.cs +++ /dev/null @@ -1,37 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Check_Detail : BaseModel - { - - - public string S_CHECK_NO { get; set; } - public int N_ROW_NO { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_AREA_CODE { get; set; } - public string S_LOC_CODE { get; set; } - public int N_ROADWAY { get; set; } - public int N_ROW { get; set; } - public int N_COL { get; set; } - public int N_LAYER { get; set; } - public string S_CNTR_CODE { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } - public string S_END_USER { get; set; } - public string S_OWNER { get; set; } - public string S_SUPPLIER_NO { get; set; } - public string S_UOM { get; set; } - public float F_QTY { get; set; } - public int N_ITEM_STATE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_ITEM_ROUTE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_List.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_List.cs deleted file mode 100644 index 7f3b880..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_List.cs +++ /dev/null @@ -1,35 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Check_List : BaseModel - { - - - public string S_CHECK_NO { get; set; } - public int N_ROW_NO { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_AREA_CODE { get; set; } - public string S_LOC_CODE { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_ITEM_STATE { get; set; } - public int N_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } - public string S_END_USER { get; set; } - public string S_OWNER { get; set; } - public string S_SUPPLIER_NO { get; set; } - public string S_UOM { get; set; } - public string F_QTY { get; set; } - public float F_CHECK_QTY { get; set; } - public string C_EXCESS_STOCK { get; set; } - public string C_CHECKED { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_ITEM_ROUTE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_Order.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_Order.cs deleted file mode 100644 index 855cb09..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Check_Order.cs +++ /dev/null @@ -1,21 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Check_Order : BaseModel - { - - - public string S_NO { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_OPERATOR { get; set; } - public string S_OPERATOR_NAME { get; set; } - public string S_NOTE { get; set; } - public int N_TYPE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Container_Good.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Container_Good.cs deleted file mode 100644 index 39e5433..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Container_Good.cs +++ /dev/null @@ -1,25 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - public class TN_TN_Container_Good : BaseModel - { - - - public string S_CNTR_CODE { get; set; } - public string S_ITEM_STATE { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_END_USER { get; set; } - public float F_ALLOC_QTY { get; set; } - public string S_UOM { get; set; } - public int N_ITEM_STATE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public float F_QTY { get; set; } - public string S_ITEM_ROUTE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Equipment.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Equipment.cs deleted file mode 100644 index da104aa..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Equipment.cs +++ /dev/null @@ -1,26 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Equipment : BaseModel - { - - - public string S_CODE { get; set; } - public string S_NAME { get; set; } - public int N_TYPE { get; set; } - public string S_TYPE { get; set; } - public int N_B_STATE { get; set; } - public string S_B_STATE { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_IP { get; set; } - public int S_PORT1 { get; set; } - public int S_PORT2 { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_EXT_DATA { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Factory.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Factory.cs deleted file mode 100644 index 6e67a51..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Factory.cs +++ /dev/null @@ -1,17 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - public class TN_Factory : BaseModel - { - - - public string S_CODE { get; set; } - public string S_NAME { get; set; } - public string S_NOTE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Detail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Detail.cs deleted file mode 100644 index fc99d53..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Detail.cs +++ /dev/null @@ -1,36 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Inspect_Detail : BaseModel - { - - - public string S_INSPECT_NO { get; set; } - public int N_ROW_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_SERIAL_NO { get; set; } - public string D_PRD_DATE { get; set; } - public string D_EXP_DATE { get; set; } - public string S_NOTE { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } - public float F_ACC_INSPECT_QTY { get; set; } - public float F_ACC_Q_QTY { get; set; } - public float F_ACC_UNQ_QTY { get; set; } - public int N_ITEM_STATE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_ITEM_ROUTE { get; set; } - public float F_NET_WEIGHT { get; set; } - public float F_GROSS_WEIGHT { get; set; } - public string S_WU { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Order.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Order.cs deleted file mode 100644 index 3a21841..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Order.cs +++ /dev/null @@ -1,27 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Inspect_Order : BaseModel - { - - - public string S_NO { get; set; } - public int N_INSPECT_TYPE { get; set; } - public string S_INSPECT_TYPE { get; set; } - public string D_INSPECT { get; set; } - public string S_NOTE { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_WMS_OP_NO { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_AREA_CODE { get; set; } - public string S_NC_AREA_CODE { get; set; } - public string S_BS_TYPE { get; set; } - public string S_BS_NO { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Record.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Record.cs deleted file mode 100644 index ac6c4e0..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Inspect_Record.cs +++ /dev/null @@ -1,23 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Inspect_Record : BaseModel - { - - - public string S_INSPECT_NO { get; set; } - public int N_ROW_NO { get; set; } - public string S_INSPECTOR { get; set; } - public string S_INSPECTOR_NAME { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } - public float F_QUALIFIED_QTY { get; set; } - public float F_UN_QUALIFIED_QTY { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_LC_Log.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_LC_Log.cs deleted file mode 100644 index 4b061b9..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_LC_Log.cs +++ /dev/null @@ -1,23 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_LC_Log : BaseModel - { - - - public string S_LOC_CODE { get; set; } - public string S_CNTR_CODE { get; set; } - public string S_ACTION_SRC { get; set; } - public string S_BINDING_METHOD { get; set; } - public int N_BINDING_METHOD { get; set; } - public int N_ACTION_TYPE { get; set; } - public string S_ACTION_TYPE { get; set; } - public int N_DEEP { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Loc_EQ_Link.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Loc_EQ_Link.cs deleted file mode 100644 index d55c7cc..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Loc_EQ_Link.cs +++ /dev/null @@ -1,17 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Loc_EQ_Link : BaseModel - { - - - public string S_LOC_CODE { get; set; } - public string S_EQ_CODE { get; set; } - public string S_EQ_TYPE { get; set; } - public string S_SEG_CODE { get; set; } - public string S_ACTION { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Lock.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Lock.cs deleted file mode 100644 index 6f38761..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Lock.cs +++ /dev/null @@ -1,23 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - /// <summary> - /// 閿佺姸鎬佽〃锛岀洿鎺ョ湅璐т綅琛ㄥ氨鍙互锛岃繖閲屽彧鏄妸鎵�湁鐨勯攣鏀惧埌涓�捣浜嗭紝璐т綅瑙i攣浜嗭紝杩欒竟闇�鍒犻櫎 - /// </summary> - public class TN_Lock : BaseModel - { - - - public int N_OBJ_TYPE { get; set; } - public string S_OBJ_CODE { get; set; } - public int N_TYPE { get; set; } - public string S_TASK_CODE { get; set; } - public string S_OP_CODE { get; set; } - public string S_OP_NAME { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_AREA_CODE { get; set; } - public string S_OBJ_NAME { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_MQ_EQAction.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_MQ_EQAction.cs deleted file mode 100644 index 3976ec6..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_MQ_EQAction.cs +++ /dev/null @@ -1,25 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_MQ_EQAction : BaseModel - { - - - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_ACTION { get; set; } - public string S_EQ_CODE { get; set; } - public int N_EQ_TYPE { get; set; } - public string S_EQ_TYPE { get; set; } - public string S_DATA { get; set; } - public string S_TASK_CODE { get; set; } - public string N_B_STATE { get; set; } - public string S_ERR { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public int N_ACTION_CODE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_MQ_EQAction_Msg.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_MQ_EQAction_Msg.cs deleted file mode 100644 index ceffcfd..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_MQ_EQAction_Msg.cs +++ /dev/null @@ -1,25 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_MQ_EQAction_Msg : BaseModel - { - - - public string S_ACTION_CODE { get; set; } - public string S_ACTION { get; set; } - public string S_EQ_CODE { get; set; } - public string S_EQ_TYPE { get; set; } - public string S_DATA { get; set; } - public int N_ERR_CODE { get; set; } - public string S_MSG { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public int N_EQ_TYPE { get; set; } - public string S_TASK_CODE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Material.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Material.cs deleted file mode 100644 index 3fc186f..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Material.cs +++ /dev/null @@ -1,18 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Material : BaseModel - { - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - - // -------------------------------福建佳通属性--------------------------------- - public string S_SPEC { get; set; } // 规格 - public string S_MODEL { get; set; } // 型号 - public string S_UNIT { get; set; } // 单位 - public string S_MEMO { get; set; } // 备注 - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OOS_Detail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OOS_Detail.cs deleted file mode 100644 index 471d7dd..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OOS_Detail.cs +++ /dev/null @@ -1,25 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_OOS_Detail : BaseModel - { - - - public string S_OOS_NO { get; set; } - public string S_SERIAL_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public int N_ITEM_STATE { get; set; } - public string S_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_ITEM_ROUTE { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } - public string S_NOTE { get; set; } - public int N_ROW_NO { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OOS_Order.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OOS_Order.cs deleted file mode 100644 index 5fdd724..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OOS_Order.cs +++ /dev/null @@ -1,19 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_OOS_Order : BaseModel - { - - - public string S_NO { get; set; } - public string S_SHIPPING_NO { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string D_OP_DATE { get; set; } - public string S_BS_TYPE { get; set; } - public string S_BS_NO { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OnOff_Shelves.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OnOff_Shelves.cs deleted file mode 100644 index e91f9d0..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_OnOff_Shelves.cs +++ /dev/null @@ -1,39 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_OnOff_Shelves : BaseModel - { - - - public int N_ACTION { get; set; } - public string S_ACTION { get; set; } - public string S_LOC_CODE { get; set; } - public string S_CNTR_CODE { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_AREA_CODE { get; set; } - public string S_GRID_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_SERIAL_NO { get; set; } - public string D_PRD_DATE { get; set; } - public string D_EXP_DATE { get; set; } - public string S_NOTE { get; set; } - public string S_PACK_TYPE { get; set; } - public float F_PACK_QTY { get; set; } - public string S_OP_TYPE { get; set; } - public string S_SOURCE_TYPE { get; set; } - public string S_SOURCE_NO { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_ITEM_ROUTE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Outbound_Detail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Outbound_Detail.cs deleted file mode 100644 index 9797a29..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Outbound_Detail.cs +++ /dev/null @@ -1,29 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - using System.Collections.Generic; - - public class TN_Outbound_Detail : BaseModel - { - - - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_SERIAL_NO { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } - public string S_NOTE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_ITEM_ROUTE { get; set; } - public int N_ITEM_STATE { get; set; } - public string S_OUT_NO { get; set; } - public int N_ROW_NO { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Outbound_Order.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Outbound_Order.cs deleted file mode 100644 index b8d5397..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Outbound_Order.cs +++ /dev/null @@ -1,22 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - public class TN_Outbound_Order : BaseModel - { - - - public string S_NO { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_SHIPPING_TYPE { get; set; } - public string D_OP_DATE { get; set; } - public string S_BS_TYPE { get; set; } - public string S_BS_NO { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_SHIPPING_NO { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Purchase_Detail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Purchase_Detail.cs deleted file mode 100644 index 4f2d0e3..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Purchase_Detail.cs +++ /dev/null @@ -1,21 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - public class TN_Purchase_Detail : BaseModel - { - - - public string S_PO_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_UOM { get; set; } - public float F_QTY { get; set; } - public int N_ROW_NO { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Purchase_Order.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Purchase_Order.cs deleted file mode 100644 index d256f86..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Purchase_Order.cs +++ /dev/null @@ -1,18 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - public class TN_Purchase_Order : BaseModel - { - - - public string S_NO { get; set; } - public string D_ARRIVAL { get; set; } - public string S_SUPPLIER_NO { get; set; } - public string S_SUPPLIER_NAME { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Receipt_Detail.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Receipt_Detail.cs deleted file mode 100644 index 32d4fbc..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Receipt_Detail.cs +++ /dev/null @@ -1,36 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Receipt_Detail : BaseModel - { - - - public int N_ROW_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_SERIAL_NO { get; set; } - public string D_PRD_DATE { get; set; } - public string D_EXP_DATE { get; set; } - public string S_NOTE { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } - public int N_ITEM_STATE { get; set; } - public float F_ACC_PUT_QTY { get; set; } - public float F_ACC_UNQ_QTY { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public float F_ACC_C_QTY { get; set; } - public string S_RECEIPT_NO { get; set; } - public string S_ITEM_ROUTE { get; set; } - public string S_WU { get; set; } - public float F_NET_WEIGHT { get; set; } - public float F_GROSS_WEIGHT { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Receipt_Order.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Receipt_Order.cs deleted file mode 100644 index 0701bea..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Receipt_Order.cs +++ /dev/null @@ -1,32 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Receipt_Order : BaseModel - { - - - public string S_NO { get; set; } - public string S_ASN_NO { get; set; } - public string S_BATCH_NO { get; set; } - public string S_SUPPLIER_NO { get; set; } - public string S_SUPPLIER_NAME { get; set; } - public string S_END_USER { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public string S_DELIVERY_NO { get; set; } - public string S_NOTE { get; set; } - public string S_AUDIT_INFO { get; set; } - public string S_AUDIT_RESULT { get; set; } - public string S_AREA_CODE { get; set; } - public string S_BS_TYPE { get; set; } - public string S_BS_NO { get; set; } - public string C_INSPECTION { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public int N_B_STATE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Supplier.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Supplier.cs deleted file mode 100644 index 6a06d6f..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Supplier.cs +++ /dev/null @@ -1,28 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Supplier : BaseModel - { - - - public string S_NO { get; set; } - public string S_NAME { get; set; } - public string S_TYPE { get; set; } - public string C_UNINSPECTED { get; set; } - public string S_NOTE { get; set; } - public string S_CONTACT_PERSON { get; set; } - public string S_TEL { get; set; } - public string S_PHONE { get; set; } - public string S_EMAIL { get; set; } - public string S_PROVINCE { get; set; } - public string S_CITY { get; set; } - public string S_ZONE { get; set; } - public string S_ADDRESS { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_WMS_Const.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_WMS_Const.cs deleted file mode 100644 index 9ed4f7d..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_WMS_Const.cs +++ /dev/null @@ -1,19 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT { - - public class TN_WMS_Const : BaseModel - { - - - public string S_NAME { get; set; } - public string S_VALUE { get; set; } - public string S_GROUP { get; set; } - public string C_SYS { get; set; } - public string S_NOTE { get; set; } - public string S_STATE_PRE { get; set; } - - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Warehouse.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Warehouse.cs deleted file mode 100644 index 1980cdd..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TN_Warehouse.cs +++ /dev/null @@ -1,21 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class TN_Warehouse : BaseModel - { - - - public string S_CODE { get; set; } - public string S_NOTE { get; set; } - public string S_EXT_DATA { get; set; } - public string S_NAME { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string C_IN_INSPECTION { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TaskAction.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TaskAction.cs deleted file mode 100644 index d6091f6..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TaskAction.cs +++ /dev/null @@ -1,24 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT -{ - [SugarTable("TN_Task_Action")] - public class TaskAction : BaseModel - { - - - public string S_EQ_TYPE { get; set; } - public string S_DATA { get; set; } - public string S_ACTION { get; set; } - public string S_TASK_CODE { get; set; } - public string S_EQ_CODE { get; set; } - public string S_VALUE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - public int N_S_STATUS { get; set; } = 0; // 安全请求状态 0.发送安全请求 1.设备反馈信号 - - public int N_ACTION_CODE { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TransfeRelevance.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TransfeRelevance.cs deleted file mode 100644 index 401209c..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/TransfeRelevance.cs +++ /dev/null @@ -1,22 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models -{ - [SugarTable("TN_ConnectLoc_ReleArea")] - internal class TransfeRelevance :BaseModel - { - public string S_LOC_CODE { get; set; } // 绔嬪簱鎺ラ┏浣嶇紪鐮�- public string S_TYPE { get; set; } // 绫诲瀷 1.绔嬪簱鎺ラ┏浣�2.缂撳瓨浣�3.鏈哄彴涓嬬嚎浣�4.寮傚父搴撲綅 5.鎴愭柊鏈虹嚎杈逛綅 - public string S_PROPERTY { get; set; } // 璐т綅灞炴� (1.鐩磋繛 2.闈炵洿杩炪�3.浜哄伐 銆�.鍥哄畾绔欏彴) - public string S_ACT_TYPE { get; set; } // 鍔ㄤ綔绫诲瀷 0.榛樿 1.鍏ュ簱 2.鍑哄簱 - public string S_RELE_AREA { get; set; } // 鍏宠仈绔嬪簱搴撳尯缂栫爜 - public string S_DEVICE_NO { get; set; } // 璁惧鍙�- public int N_READ_LOC { get; set; } // 鏄惁璇荤爜浣�0銆佸惁 1.鏄�- - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WCSTask.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WCSTask.cs deleted file mode 100644 index 3048e5a..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WCSTask.cs +++ /dev/null @@ -1,65 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - [SugarTable("TN_Task")] - public class WCSTask : BaseModel { - - public string S_DATA { get; set; } - public int N_SORT_NO { get; set; } - public string S_START_AREA { get; set; } - public string S_END_AREA { get; set; } - public string S_START_LOC { get; set; } - public string S_END_LOC { get; set; } - public string S_NOTE { get; set; } - public DateTime? T_START_TIME { get; set; } - public DateTime? T_END_TIME { get; set; } - public string S_EQ_NO { get; set; } - public string S_TYPE { get; set; } - public string S_B_STATE { get; set; } = "绛夊緟"; - /// <summary> - /// 0绛夊緟 1宸叉帹閫� 2鎵ц 3瀹屾垚 4閿欒 - /// </summary> - public int N_B_STATE { get; set; } - public string S_START_WH { get; set; } - public string S_END_WH { get; set; } - public string S_START_SITE { get; set; } - public int S_START_SITE_LAYER { get; set; } - public string S_END_SITE { get; set; } - public int S_END_SITE_LAYER { get; set; } - /// <summary> - ///0鏃�1NDC 2澶╃洰 3鍥借嚜 4杈撻�鏈�5绔嬪簱 - /// </summary> - public int N_SCHEDULE_TYPE { get; set; } - public string S_SCHEDULE_TYPE { get; set; } - public int N_TYPE { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public int N_PRIORITY { get; set; } - public string S_ERR { get; set; } - public string S_OP_CODE { get; set; } - public string S_CODE { get; set; } - public int N_ERR { get; set; } - public string S_EQ_TASK_CODE { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public string S_CNTR_CODE { get; set; } - public string S_OP_NAME { get; set; } - - public int N_CNTR_COUNT { get; internal set; } - - internal static string GetStateStr(int state) { - //0绛夊緟 1宸叉帹閫� 2鎵ц 3瀹屾垚 4閿欒 - var status = ""; - switch (state) { - case 0: status = "绛夊緟"; break; - case 1: status = "宸叉帹閫�; break; - case 2: status = "鎵ц涓�; break; - case 3: status = "瀹屾垚"; break; - case 4: status = "閿欒"; break; - } - return status; - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WHInventory.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WHInventory.cs deleted file mode 100644 index c795838..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WHInventory.cs +++ /dev/null @@ -1,28 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - - [SugarTable("TN_WH_Inventory")] - public class WHInventory : BaseModel { - - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_WH_CODE { get; set; } = util.Settings.WHCode; - public float F_QTY { get; set; } - public string S_ITEM_SPEC { get; set; } - public string S_END_USER { get; set; } - public string S_ITEM_STATE { get; set; } = "合格"; - public string S_ITEM_ROUTE { get; set; } = ""; - /// <summary> - /// 分配量 - /// </summary> - public float F_ALLOC_QTY { get; set; } - public float F_ORDER_QTY { get; set; } - public int N_ITEM_STATE { get; set; } - public string S_STATE_PRE { get; set; } = ""; - - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WMSTask.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WMSTask.cs deleted file mode 100644 index 10f42f2..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/WMSTask.cs +++ /dev/null @@ -1,79 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - [SugarTable("TN_Operation")] - public class WMSTask : BaseModel { - - public string S_CODE { get; set; } - public string S_TYPE { get; set; } - public string S_NOTE { get; set; } - public DateTime? T_START_TIME { get; set; } - public DateTime? T_END_TIME { get; set; } - public string S_CNTR_CODE { get; set; } - /// <summary> - /// 0 等待/1 执行/2 完成/3 错误/4 启劢失败 /5 暂停启劢 - /// </summary> - public int N_B_STATE { get; set; } - public string S_ERR { get; set; } - public string S_EXT_DATA { get; set; } - /// <summary> - /// 需要根据常量自动转换 - /// </summary> - public string S_B_STATE { get; set; } = "等待"; - /// <summary> - /// 1入库 2出库 - /// </summary> - public int N_TYPE { get; set; } - public string S_OP_DEF_NAME { get; set; } - /// <summary> - /// 应该根据货位查找仓库对应的工厂 - /// </summary> - public string S_FACTORY { get; set; } = util.Settings.FacCode; - public int N_PRIORITY { get; set; } - public string S_OP_DEF_CODE { get; set; } - public string S_START_WH { get; set; } - public string S_START_AREA { get; set; } - public string S_START_LOC { get; set; } - public string S_END_WH { get; set; } - public string S_END_AREA { get; set; } - public string S_END_LOC { get; set; } - public string S_BS_TYPE { get; set; } - public string S_BS_NO { get; set; } - public string S_STATE_PRE { get; set; } - public int N_REVIEW_RESULT { get; set; } - - public int N_LASTE_B_STATE { get; set; } - public string C_NEED_SORTING { get; set; } = "N"; - public int N_FAIL_COUNT { get; set; } - public int N_FAIL_MAX { get; set; } - public DateTime? T_LAST_FAIL { get; set; } - - /// <summary> - /// 0 等待/1 执行/2 完成/3 错误/4 启劢失败 /5 暂停启劢 - /// </summary> - /// <returns></returns> - internal static string GetStateStr(int state) { - var status = ""; - switch (state) { - case 0: status = "等待"; break; - case 1: status = "执行"; break; - case 2: status = "完成"; break; - case 3: status = "错误"; break; - case 4: status = "启动失败"; break; - case 5: status = "暂停失败"; break; - } - return status; - } - - internal static string GetTypeStr(int v) { - var str = ""; - switch (v) { - case 1: str = "入库"; break; - case 2: str = "出库"; break; - } - return str; - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Zone.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Zone.cs deleted file mode 100644 index 8e8a0bf..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/Zone.cs +++ /dev/null @@ -1,48 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace HH.WCS.Mobox3.FJJT { - - [SugarTable("TN_Zone")] - public class Zone : BaseModel - { - - - public string S_NAME { get; set; } - public string S_NOTE { get; set; } - public string S_WH_CODE { get; set; }=util.Settings.WHCode; - public int N_EMPTY_MIN { get; set; } - public int N_EMPTY_MAX { get; set; } - - public string S_CODE { get; set; } - public string S_AREA_CODE { get; set; } - public string S_LOC_RULE { get; set; } - public string S_ZONE_CLS_CODE { get; set; } - public int N_AVAILABLE_IN { get; set; } - public int N_TYPE { get; set; } - public string S_TYPE { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } - public string S_BATCH_NO { get; set; } - public string S_ITEM_CATEGORY { get; set; } - public string S_OWNER_CODE { get; set; } - public string S_SUPPLIER_CODE { get; set; } - public int N_CONNECT_TYPE { get; set; } - public string S_CONNECT_TYPE { get; set; } - public int N_LOCK_STATE { get; set; } - public string S_LOCK_STATE { get; set; } - public string S_OWNER_NAME { get; set; } - public string S_SUPPLIER_NAME { get; set; } - public int N_STORE_MAX { get; set; } - public string S_STATE_PRE { get; set; } - - public string C_IS_AREA { get; set; } - public string S_GROUP { get; set; } - - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToMany, nameof(S_CODE), nameof(ZoneLoc.S_LOC_CODE))] - public List<ZoneLoc> ZoneLocs { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneCls.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneCls.cs deleted file mode 100644 index b028c1b..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneCls.cs +++ /dev/null @@ -1,19 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - - [SugarTable("TN_Zone_Cls")] - public class ZoneCls : BaseModel - { - - - public string S_CODE { get; set; } - public string S_NAME { get; set; } - public string S_FACTORY { get; set; }=util.Settings.FacCode; - public string S_STATE_PRE { get; set; } - - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneLink.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneLink.cs deleted file mode 100644 index 973c424..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneLink.cs +++ /dev/null @@ -1,21 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - - [SugarTable("TN_Zone_Link")] - public class ZoneLink : BaseModel - { - - - public string S_LINK_ZONE_CODE { get; set; } - public string S_LINK_TYPE { get; set; } - public int N_LINK_TYPE { get; set; } - public string S_ZONE_CODE { get; set; } - public int N_PRIORITY { get; set; } - public string S_STATE_PRE { get; set; } - - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneLoc.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneLoc.cs deleted file mode 100644 index 9a0dfeb..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/ZoneLoc.cs +++ /dev/null @@ -1,19 +0,0 @@ -using HH.WCS.Mobox3.FJJT.models; -using SqlSugar; -using System; - -namespace HH.WCS.Mobox3.FJJT { - - [SugarTable("TN_Zone_Loc")] - public class ZoneLoc : BaseModel - { - - public string S_LOC_CODE { get; set; } - public string S_ZONE_CODE { get; set; } - public string S_STATE_PRE { get; set; } - - [SugarColumn(IsIgnore = true)] - [Navigate(NavigateType.OneToOne, nameof(S_LOC_CODE), nameof(Location.S_CODE))] - public Location Loc { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/other/DayuanIn.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/other/DayuanIn.cs deleted file mode 100644 index 999daa3..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/other/DayuanIn.cs +++ /dev/null @@ -1,22 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models.other { - - [SugarTable("TN_InCompletion")] - internal class DayuanIn : BaseModel { - public string CN_S_GUID { get; set; } = Guid.NewGuid().ToString("D"); - public string CN_S_ARRIVAL_NO { get; set; } - public string CN_S_ITEM_CODE { get; set; } - public float CN_F_QUANTITY { get; set; } - public string CN_S_BATCH_NO { get; set; } - public DateTime CN_T_CREATE { get; set; } = DateTime.Now; - public string CN_S_ISREAD { get; set; } = "N"; - public string S_WH_TYPE { get; set; } = "绔嬪簱"; - public string S_ERP_INFO { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/other/DayuanOut.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/other/DayuanOut.cs deleted file mode 100644 index 18d0a0d..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/models/other/DayuanOut.cs +++ /dev/null @@ -1,21 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.models.other { - [SugarTable("TN_OutCompletion")] - internal class DayuanOut : BaseModel { - public string CN_S_GUID { get; set; } = Guid.NewGuid().ToString("D"); - public string CN_S_OUT_NO { get; set; } - public string CN_S_ITEM_CODE { get; set; } - public float CN_F_QUANTITY { get; set; } - public string CN_S_BATCH_NO { get; set; } - public DateTime CN_T_CREATE { get; set; } = DateTime.Now; - public string CN_S_ISREAD { get; set; } = "N"; - public string S_WH_TYPE { get; set; } = "绔嬪簱"; - public string S_ERP_INFO { get; set; } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/packages.config b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/packages.config deleted file mode 100644 index e766212..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/packages.config +++ /dev/null @@ -1,44 +0,0 @@ -锘�?xml version="1.0" encoding="utf-8"?> -<packages> - <package id="EasyModbusTCP" version="5.6.0" targetFramework="net461" /> - <package id="Microsoft.AspNet.WebApi.Client" version="5.2.9" targetFramework="net461" /> - <package id="Microsoft.AspNet.WebApi.Core" version="5.2.9" targetFramework="net461" /> - <package id="Microsoft.AspNet.WebApi.Owin" version="5.2.9" targetFramework="net461" /> - <package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.9" targetFramework="net461" /> - <package id="Microsoft.AspNet.WebApi.WebHost" version="4.0.30506.0" targetFramework="net461" /> - <package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net48" /> - <package id="Microsoft.Extensions.Configuration" version="7.0.0" targetFramework="net461" requireReinstallation="true" /> - <package id="Microsoft.Extensions.Configuration.Abstractions" version="7.0.0" targetFramework="net461" requireReinstallation="true" /> - <package id="Microsoft.Extensions.Configuration.FileExtensions" version="7.0.0" targetFramework="net461" requireReinstallation="true" /> - <package id="Microsoft.Extensions.Configuration.Json" version="7.0.0" targetFramework="net461" requireReinstallation="true" /> - <package id="Microsoft.Extensions.FileProviders.Abstractions" version="7.0.0" targetFramework="net461" requireReinstallation="true" /> - <package id="Microsoft.Extensions.FileProviders.Physical" version="7.0.0" targetFramework="net461" requireReinstallation="true" /> - <package id="Microsoft.Extensions.FileSystemGlobbing" version="7.0.0" targetFramework="net461" requireReinstallation="true" /> - <package id="Microsoft.Extensions.Primitives" version="7.0.0" targetFramework="net461" requireReinstallation="true" /> - <package id="Microsoft.Owin" version="4.2.2" targetFramework="net461" /> - <package id="Microsoft.Owin.Host.HttpListener" version="4.2.2" targetFramework="net461" /> - <package id="Microsoft.Owin.Hosting" version="4.2.2" targetFramework="net461" /> - <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" /> - <package id="Newtonsoft.Json" version="13.0.2" targetFramework="net461" /> - <package id="NLog" version="5.1.1" targetFramework="net452" requireReinstallation="true" /> - <package id="Oracle.ManagedDataAccess" version="23.7.0" targetFramework="net48" /> - <package id="Owin" version="1.0" targetFramework="net461" /> - <package id="S7netplus" version="0.1.9" targetFramework="net461" /> - <package id="SqlSugar" version="5.1.3.47" targetFramework="net461" /> - <package id="Swashbuckle" version="5.6.0" targetFramework="net461" /> - <package id="Swashbuckle.Core" version="5.6.0" targetFramework="net461" /> - <package id="System.Buffers" version="4.5.1" targetFramework="net461" /> - <package id="System.Diagnostics.DiagnosticSource" version="6.0.1" targetFramework="net48" /> - <package id="System.Formats.Asn1" version="8.0.1" targetFramework="net48" /> - <package id="System.Memory" version="4.5.5" targetFramework="net461" /> - <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" /> - <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net461" /> - <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net452" /> - <package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net48" /> - <package id="System.Text.Json" version="8.0.5" targetFramework="net48" /> - <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" /> - <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" /> - <package id="Topshelf" version="4.3.0" targetFramework="net452" /> - <package id="Topshelf.NLog" version="4.3.0" targetFramework="net452" /> - <package id="WebActivatorEx" version="2.0" targetFramework="net461" /> -</packages> \ No newline at end of file diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/process/DeviceProcess.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/process/DeviceProcess.cs deleted file mode 100644 index 69194d4..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/process/DeviceProcess.cs +++ /dev/null @@ -1,45 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.device; -using HH.WCS.Mobox3.FJJT.dispatch; -using HH.WCS.Mobox3.FJJT.util; -using HH.WCS.Mobox3.FJJT.wms; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; - -namespace HH.WCS.Mobox3.FJJT.process -{ - /// <summary> - /// 璁惧淇″彿澶勭悊锛屼富瑕佹槸tcp淇″彿锛屾垜浠仛server琚姩鎺ユ敹淇″彿鏉ュ鐞嗭紝鏍规嵁椤圭洰瀹氬埗鐨�- /// </summary> - internal class DeviceProcess - { - internal static void Analysis(string data, string ip) { - if (data.Length >= 6) { - //鍘绘帀娑堟伅澶�F 00 - data = data.Substring(4); - //Console.WriteLine($"{ip}-{data}"); - var plc = Settings.deviceInfos.Where(a => a.address == ip && a.enable == 1).FirstOrDefault(); - if (plc != null) { - if (plc.deviceType == 1) { - - } - else if (plc.deviceType == 2) { - //鍑哄簱缂撳瓨浣嶇殑鍏夌數淇℃伅 - //濡傛灉鏈夌紦瀛樹綅鏄┖鐨勭姸鎬侊紝鎴戜滑鍏堝垽鏂湁娌℃湁浠诲姟缁堢偣鍒嗛厤鍒拌繖閲岋紝濡傛灉娌℃湁锛屽氨鎵句竴鏉″嚭搴撲换鍔★紝缁堢偣鏄櫄鎷熺偣鐨勪换鍔★紝鍒嗛厤鍒拌繖涓┖浣�- //淇敼浠诲姟缁堢偣 - } - - - } - else { - Console.WriteLine($"TCP淇″彿澶勭悊锛氭湭鏌ヨ鍒癐P涓簕ip}鐨勬暟鎹紝璇锋鏌eviceInfo閰嶇疆涓績鏄惁瀛樺湪璇P鐨勬暟鎹紒"); - } - } - - } - - internal static void Traffic(string forkliftNo, string lockNo, bool v) { - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/process/TaskProcess.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/process/TaskProcess.cs deleted file mode 100644 index 15a03ed..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/process/TaskProcess.cs +++ /dev/null @@ -1,193 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.api; -using HH.WCS.Mobox3.FJJT.core; -using HH.WCS.Mobox3.FJJT.dispatch; -using HH.WCS.Mobox3.FJJT.util; -using HH.WCS.Mobox3.FJJT.wms; -using Newtonsoft.Json; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography; - -namespace HH.WCS.Mobox3.FJJT.process { - internal class TaskProcess { - #region 浠诲姟鐩稿叧 - //--------------------------------------------------浠诲姟鐩稿叧-------------------------------------------------- - /// <summary> - /// 鍙栬揣鍗歌揣瀹屾垚锛岀紦瀛樹綅鐘舵�鏇存柊 - /// </summary> - /// <param name="mst"></param> - /// <param name="load"></param> - internal static void CacheBitUpdate(WCSTask mst, bool load) { - var trayCarryCount = mst.N_CNTR_COUNT > 0 ? mst.N_CNTR_COUNT : 1; - if (load) { - Console.WriteLine($"浠诲姟{mst.S_CODE} 璐т綅{mst.S_START_LOC}鍙栬揣瀹屾垚锛岃捣鐐硅В缁戝鍣▄mst.S_CNTR_CODE}"); - LogHelper.Info($"浠诲姟{mst.S_CODE} 璐т綅{mst.S_START_LOC}鍙栬揣瀹屾垚锛岃捣鐐硅В缁戝鍣▄mst.S_CNTR_CODE}"); - LocationHelper.UnBindingLoc(mst.S_START_LOC, mst.S_CNTR_CODE.Split(',').ToList()); - } - else { - Console.WriteLine($"浠诲姟{mst.S_CODE} 璐т綅{mst.S_END_LOC}鍗歌揣瀹屾垚锛岀粓鐐圭粦瀹氬鍣▄mst.S_CNTR_CODE}"); - LogHelper.Info($"浠诲姟{mst.S_CODE} 璐т綅{mst.S_END_LOC}鍗歌揣瀹屾垚锛岃捣鐐硅В缁戝鍣▄mst.S_CNTR_CODE}"); - // 缁堢偣涓虹洿杩炵紦瀛樹綅锛屼笉缁戝畾 - var loc = WMSHelper.GetTransfeRelevance(mst.S_END_LOC); - if (loc != null && loc.S_PROPERTY == "1") - { - LocationHelper.UnLockLoc(mst.S_END_LOC); - return; - } - LocationHelper.BindingLoc(mst.S_END_LOC, mst.S_CNTR_CODE.Split(',').ToList()); - } - } - - /// <summary> - /// 浠诲姟鍙栨秷锛岀紦瀛樹綅鐘舵�鏇存柊 - /// </summary> - /// <param name="mst"></param> - internal static void CacheBitCancelUpdate(WCSTask mst) { - //浠诲姟鍙栨秷锛屽彇璐у畬鎴愬墠鐨勶紝璧风偣鐨刲oadingCount鍜岀粓鐐箄nLoadingCount閮芥竻闄わ紝鍙栬揣瀹屾垚鐨勫彧澶勭悊缁堢偣 - if (WCSHelper.CheckActionRecordExist(mst.S_CODE, 4)) { - //鏍规嵁瀹㈡埛鐜板満瑕佹眰锛屽鏋滃彇璐у畬鎴愪换鍔″け璐ヤ汉宸ユ媺鍒扮粓鐐癸紝鎴戜滑灏卞綋鍗歌揣瀹屾垚澶勭悊锛涘鏋滄槸浜哄伐鎷夎蛋鍒板叾瀹冨尯鍩燂紝鎴戜滑灏辫В閿佺粓鐐癸紝鍒犻櫎鎵樼洏銆�- //缁堢偣缁戝畾 - CacheBitUpdate(mst, false); - LocationHelper.UnLockLoc(mst.S_END_LOC); - } - else { - //璧风偣缁堢偣瑙i攣 - LocationHelper.UnLockLoc(mst.S_START_LOC); - LocationHelper.UnLockLoc(mst.S_END_LOC); - } - - } - - /// <summary> - /// 瀹夊叏璇锋眰 - /// </summary> - /// <param name="no"></param> - /// <param name="state"></param> - /// <param name="forkliftNo"></param> - /// <param name="extData"></param> - internal static void OperateReq(string no, int state, string forkliftNo, string extData) { - LogHelper.Info($"寮�瀹夊叏璇锋眰锛屼换鍔″彿:{no},璇锋眰鐮�{state}", "HosttoagvTask"); - var cst = WCSHelper.GetTask(no); - var taskAction = WCSHelper.getActionRecord(no, state); - if (taskAction != null) - { - LogHelper.Info($"鍐嶆瀹夊叏璇锋眰锛屾煡璇㈣澶囨槸鍚﹀弽棣�, "HosttoagvTask"); - if (taskAction.N_S_STATUS == 1) - { - LogHelper.Info($"鍐嶆瀹夊叏璇锋眰锛岃澶囧凡鍙嶉", "HosttoagvTask"); - NDCApi.ChangeOrderParam(no, 8, "1"); - } - } - else - { - LogHelper.Info($"棣栨杩涜瀹夊叏璇锋眰锛屼换鍔″彿:{no},璇锋眰鐮�{state}", "HosttoagvTask"); - bool result = false; - if (state == 1101) - { - result = WCSDispatch.safetyInteraction(cst.S_CODE ,cst.S_START_LOC, "1"); //璇锋眰鍙栬揣锛�- } - if (state == 1102) - { - result = WCSDispatch.safetyInteraction(cst.S_CODE, cst.S_START_LOC, "2"); //璇锋眰杩旇揣 - } - if (state == 1103) - { - result = WCSDispatch.safetyInteraction(cst.S_CODE, cst.S_START_LOC, "3"); //鍙栬揣瀹屾垚鍏佽绂诲紑 - } - if (state == 1104) - { - result = WCSDispatch.safetyInteraction(cst.S_CODE, cst.S_START_LOC, "4"); //鏀捐揣瀹屾垚鍏佽绂诲紑 - } - - // 瀹夊叏璇锋眰鍙戦�鎴愬姛锛屾坊鍔犱换鍔″姩浣滆褰�- if (result) - { - WCSHelper.AddActionRecord(no, state, forkliftNo, extData); - LogHelper.Info($"棣栨杩涜瀹夊叏璇锋眰鎴愬姛", "HosttoagvTask"); - } - } - } - - /// <summary> - /// 浠诲姟鎷︽埅 - /// </summary> - /// <param name="task"></param> - /// <returns></returns> - internal static bool Intercept(WCSTask mst) { - var result = false; - //鍑哄簱浠诲姟鏄壒閲忕敓鎴愮殑锛屽垵濮嬬粓鐐规垜浠厛缁欎竴涓櫄鎷熺偣锛屼笉鎺ㄩ�銆傛湁鍗曠嫭鐨勭幇鍦哄幓鍒ゆ柇鍑哄簱缂撳瓨鍖哄厜鐢碉紝绌轰簡鍐嶇粰鍑哄簱浠诲姟鍒嗛厤缁堢偣 - if (mst.S_END_LOC.Trim() == "鍑哄簱铏氭嫙鐐�) { - result = true; - } - return result; - } - - /// <summary> - /// 浠诲姟鐘舵�鏇存柊澶勭悊 - /// </summary> - /// <param name="mst"></param> - /// <param name="state"></param> - internal static void OperateStatus(WCSTask mst, int state) { - if (state == 4) { - CacheBitUpdate(mst, true); - } - if (state == 6)//鍗歌揣瀹屾垚 - { - CacheBitUpdate(mst, false); - } - if (state == 7) { - CacheBitCancelUpdate(mst); - } - } - - private static object locLocker = new object(); - - - /// <summary> - /// 鎺ㄩ�浠诲姟 - /// </summary> - /// <param name="mst"></param> - internal static bool SendTask(WCSTask mst) { - var result = false; - var start = "0"; var end = "0"; - if (mst.N_B_STATE == 0) { - if (mst.S_SCHEDULE_TYPE == "NDC") - { - start = LocationHelper.GetAgvSite(mst.S_START_LOC); - end = LocationHelper.GetAgvSite(mst.S_END_LOC); - - var dic = new List<param>(); - dic.Add( new param() { name = "No" , value = ""}); - dic.Add( new param() { name = "From", value = ""}); - dic.Add( new param() { name = "To", value = ""}); - dic.Add( new param() { name = "3" , value = "4"}); - dic.Add( new param() { name = "4" , value = "512"}); - dic.Add( new param() { name = "5" , value = "0"}); - var res = NDCApi.AddOrderNew(1,mst.N_PRIORITY,mst.S_CODE,dic); - if (res != null && res.err_code == 0 ) { - //鎺ㄩ�鎴愬姛锛屼慨鏀逛换鍔′紭鍏堢骇 - mst.N_B_STATE = 1; - WCSHelper.UpdateStatus(mst); - result = true; - } - } - else if (mst.S_SCHEDULE_TYPE == "WCS") { - - mst.N_B_STATE = 1; - WCSHelper.UpdateStatus(mst); - } - else if (mst.S_SCHEDULE_TYPE == "AGV") - { - mst.N_B_STATE = 1; - WCSHelper.UpdateStatus(mst); - } - - } - return result; - } - - #endregion - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/readme.txt b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/readme.txt deleted file mode 100644 index 107e07f..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/readme.txt +++ /dev/null @@ -1 +0,0 @@ -锘跨寤轰匠閫�鏉ㄥ墠閿�diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/swagger.js b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/swagger.js deleted file mode 100644 index aed0f8c..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/swagger.js +++ /dev/null @@ -1,110 +0,0 @@ -'use strict'; -window.SwaggerTranslator = { - _words: [], - - translate: function () - { - var $this = this; - $('[data-sw-translate]').each(function () - { - $(this).html($this._tryTranslate($(this).html())); - $(this).val($this._tryTranslate($(this).val())); - $(this).attr('title', $this._tryTranslate($(this).attr('title'))); - }); - }, - - setControllerSummary: function () - { - $.ajax({ - type: "get", - async: true, - url: $("#input_baseUrl").val(), - dataType: "json", - success: function (data) - { - var summaryDict = data.ControllerDesc; - var id, controllerName, strSummary; - $("#resources_container .resource").each(function (i, item) - { - id = $(item).attr("id"); - if (id) - { - controllerName = id.substring(9); - strSummary = summaryDict[controllerName]; - if (strSummary) - { - $(item).children(".heading").children(".options").first().prepend('<li class="controller-summary" title="' + strSummary + '">' + strSummary + '</li>'); - } - } - }); - } - }); - }, - _tryTranslate: function (word) - { - return this._words[$.trim(word)] !== undefined ? this._words[$.trim(word)] : word; - }, - - learn: function (wordsMap) - { - this._words = wordsMap; - } -}; - - -/* jshint quotmark: float */ -window.SwaggerTranslator.learn({ - "Warning: Deprecated": "警告:已过时", - "Implementation Notes": "实现备注", - "Response Class": "响应类", - "Status": "状态", - "Parameters": "参数", - "Parameter": "参数", - "Value": "值", - "Description": "描述", - "Parameter Type": "参数类型", - "Data Type": "数据类型", - "Response Messages": "响应消息", - "HTTP Status Code": "HTTP 状态码", - "Reason": "原因", - "Response Model": "响应模型", - "Request URL": "请求 URL", - "Response Body": "响应体", - "Response Code": "响应码", - "Response Headers": "响应头", - "Hide Response": "隐藏响应", - "Headers": "头", - "Try it out!": "试一下!", - "Show/Hide": "显示/隐藏", - "List Operations": "显示操作", - "Expand Operations": "展开操作", - "Raw": "原始", - "can't parse JSON. Raw result": "无法解析 JSON。原始结果", - "Model Schema": "模型架构", - "Model": "模型", - "apply": "应用", - "Username": "用户名", - "Password": "密码", - "Terms of service": "服务条款", - "Created by": "创建者", - "See more at": "查看更多:", - "Contact the developer": "联系开发者", - "api version": "api 版本", - "Response Content Type": "响应 Content Type", - "fetching resource": "正在获取资源", - "fetching resource list": "正在获取资源列表", - "Explore": "浏览", - "Show Swagger Petstore Example Apis": "显示 Swagger Petstore 示例 Apis", - "Can't read from server. It may not have the appropriate access-control-origin settings.": "无法从服务器读取。可能没有正确设置 access-control-origin。", - "Please specify the protocol for": "请指定协议:", - "Can't read swagger JSON from": "无法读取 swagger JSON于", - "Finished Loading Resource Information. Rendering Swagger UI": "已加载资源信息。正在渲染 Swagger UI", - "Unable to read api": "无法读取 api", - "from path": "从路径", - "server returned": "服务器返回" -}); -$(function () -{ - window.SwaggerTranslator.translate(); - window.SwaggerTranslator.setControllerSummary(); -}); \ No newline at end of file diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/HttpHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/HttpHelper.cs deleted file mode 100644 index ffc913f..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/HttpHelper.cs +++ /dev/null @@ -1,179 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; - -namespace HH.WCS.Mobox3.FJJT.util { - public class HttpHelper { - public string WebPost(string url, string postData, string cotentType = "application/json") { - Console.WriteLine(url); - WebRequest request = WebRequest.Create(url); - request.Method = "POST"; - //string postData = JsonConvert.SerializeObject(data); ; - byte[] byteArray = Encoding.UTF8.GetBytes(postData); - request.ContentType = cotentType; - request.ContentLength = byteArray.Length; - request.Timeout = 3000; - - try { - Stream dataStream = request.GetRequestStream(); - dataStream.Write(byteArray, 0, byteArray.Length); - dataStream.Close(); - WebResponse response = request.GetResponse(); - //Console.WriteLine(((HttpWebResponse)response).StatusDescription); - dataStream = response.GetResponseStream(); - StreamReader reader = new StreamReader(dataStream, Encoding.UTF8); - string responseFromServer = reader.ReadToEnd(); - reader.Close(); - dataStream.Close(); - response.Close(); - return responseFromServer; - } - catch (Exception e) { - Console.WriteLine(e.Message); - return ""; - } - } - - public string WebGet(string url) { - //using (var client = new HttpClient()) { - // //璇锋眰缁撴灉 - // string result = client.GetAsync(url).Result.Content.ReadAsStringAsync().Result; - - // Console.WriteLine(result); - // return result; - - //} - //Console.WriteLine(url); - WebRequest request = WebRequest.Create(url); - request.Timeout = 6000; - request.Method = "GET"; - - try { - WebResponse response = request.GetResponse(); - Stream dataStream = response.GetResponseStream(); - StreamReader reader = new StreamReader(dataStream); - string responseFromServer = reader.ReadToEnd(); - - reader.Close(); - dataStream.Close(); - response.Close(); - Console.WriteLine(responseFromServer); - return responseFromServer; - } - catch (Exception e) { - return ""; - } - } - - public string Get(string url, string contentType = "application/x-www-form-urlencoded") { - WebRequest request = WebRequest.Create(url); - request.Method = "Get"; - request.ContentType = contentType; - StreamReader reader = null; - Stream stream = null; - WebResponse rsp = null; - try { - - rsp = request.GetResponse(); - stream = rsp.GetResponseStream(); - reader = new StreamReader(stream); - return reader.ReadToEnd(); - } - catch { - return ""; - } - finally { - // 閲婃斁璧勬簮 - if (reader != null) reader.Close(); - if (stream != null) stream.Close(); - if (rsp != null) rsp.Close(); - } - - } - - public string Post(string url, string postData, string contentType = "application/json", string sessionId = "") { - Console.WriteLine(url); - WebRequest request = WebRequest.Create(url); - request.Method = "POST"; - byte[] byteArray = Encoding.UTF8.GetBytes(postData); - request.ContentType = contentType; - request.ContentLength = byteArray.Length; - request.Timeout = 3000; - if (sessionId != "") { - request.Headers.Set("ASP.NET_SessionId", sessionId); - } - StreamReader reader = null; - Stream stream = null; - WebResponse rsp = null; - try { - stream = request.GetRequestStream(); - stream.Write(byteArray, 0, byteArray.Length); - stream.Close(); - rsp = request.GetResponse(); - stream = rsp.GetResponseStream(); - reader = new StreamReader(stream); - return reader.ReadToEnd(); - } - catch (Exception ex) { - Console.WriteLine($"{url} err={ex.Message}"); - return ""; - } - finally { - // 閲婃斁璧勬簮 - if (reader != null) reader.Close(); - if (stream != null) stream.Close(); - if (rsp != null) rsp.Close(); - } - - } - - - public string Post(string url, Dictionary<string, string> dic) { - var param = dic.Select(a => { return string.Format("{0}={1}", a.Key, a.Value); }).ToList(); - return Post(url, string.Join("&", param), "application/x-www-form-urlencoded"); - - } - - public string PostWithCookie(string url, string sessinId) { - return PostWithCookie(url, "", "", sessinId); - } - public string PostWithCookie(string url, string postData, string contentType = "application/json", string sessionId = "") { - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.Method = "POST"; - byte[] byteArray = Encoding.UTF8.GetBytes(postData); - request.ContentType = contentType; - request.ContentLength = byteArray.Length; - if (sessionId != "") { - request.CookieContainer = new CookieContainer(); - request.CookieContainer.SetCookies(new Uri("http://" + request.RequestUri.Authority), "ASP.NET_SessionId=" + sessionId); - } - StreamReader reader = null; - Stream stream = null; - WebResponse rsp = null; - try { - stream = request.GetRequestStream(); - stream.Write(byteArray, 0, byteArray.Length); - stream.Close(); - rsp = request.GetResponse(); - stream = rsp.GetResponseStream(); - reader = new StreamReader(stream); - return reader.ReadToEnd(); - } - catch { - return ""; - } - finally { - // 閲婃斁璧勬簮 - if (reader != null) reader.Close(); - if (stream != null) stream.Close(); - if (rsp != null) rsp.Close(); - } - - } - - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/LogHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/LogHelper.cs deleted file mode 100644 index 81f60bd..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/LogHelper.cs +++ /dev/null @@ -1,146 +0,0 @@ -锘縰sing NLog; -using NLog.Common; -using NLog.Config; -using NLog.Targets; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT -{ - - public class LogHelper - { - public static Dictionary<string, ILogger> loggers = new Dictionary<string, ILogger>(); - - public static void Debug(string message, string name = "") { - ILogger logger = null; - if (loggers.Keys.Contains(name)) { - logger = loggers[name]; - } - else { - logger = LogFactory.CreateLogger(name); - if (logger != null) { - loggers.Add(name, logger); - } - else { - logger = LogFactory.CreateLogger("console"); - } - } - if (logger != null) { - logger.Debug(message); - } - } - - - - public static void Info(string message, string name = "") { - //logger.Info(message); - ILogger logger = null; - if (loggers.Keys.Contains(name)) { - logger = loggers[name]; - } - else { - logger = LogFactory.CreateLogger(name); - if (logger != null) { - loggers.Add(name, logger); - } - else { - logger = LogFactory.CreateLogger("infoFile"); - } - } - if (logger != null) { - logger.Info(message); - } - } - - public static void Error(string message, Exception ex, string name = "") { - //logger.Error(ex, message); - ILogger logger = null; - if (loggers.Keys.Contains(name)) { - logger = loggers[name]; - } - else { - logger = LogFactory.CreateLogger(name); - if (logger != null) { - loggers.Add(name, logger); - } - else { - logger = LogFactory.CreateLogger("errorFile"); - } - } - if (logger != null) { - logger.Error($"{message}{ex.StackTrace}"); - } - } - - - } - - internal class LogFactory - { - /// <summary> - /// 閫氳繃閰嶇疆鏂囦欢閰嶇疆鏃ュ織 - /// </summary> - static LogFactory() { - var loggerNames = new List<string>() { "HosttoagvTask", "HosttoagvCar", "AGV", "WMS" ,"Mobox" }; - LogManager.Configuration = DefaultConfig(loggerNames); - } - public static ILogger CreateLogger(string name) { - var logger = LogManager.GetLogger(name); - return logger; - } - - public static LoggingConfiguration DefaultConfig(List<string> loggerNames) { - var config = new LoggingConfiguration(); - loggerNames.ForEach(a => { - var target = new FileTarget(); - target.ArchiveAboveSize = 1024 * 1024 * 5;//姣忎釜鏂囦欢鏈�ぇ5M - target.ArchiveNumbering = ArchiveNumberingMode.DateAndSequence; - target.ArchiveFileName = @"${basedir}/Logs/" + a + "/{####}.txt"; - target.FileName = @"${basedir}/Logs/" + a + "/${shortdate}.txt";//褰撳墠鏂囦欢璺緞 - target.Layout = @"${longdate} | ${level:uppercase=false:padding=-5} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"; - - config.AddTarget(a, target); - config.AddRuleForOneLevel(LogLevel.Info, target, a); - }); - - - // 娣诲姞target-console - var consoleTarget = new ColoredConsoleTarget(); - consoleTarget.Layout = @"${longdate} | ${level:uppercase=false:padding=-5} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"; - - config.AddTarget("console", consoleTarget); - config.AddRule(LogLevel.Debug, LogLevel.Fatal, consoleTarget); - - //娣诲姞target-info - var infoFileTarget = new FileTarget(); - infoFileTarget.ArchiveAboveSize = 1024 * 1024 * 5;//姣忎釜鏂囦欢鏈�ぇ5M - infoFileTarget.ArchiveNumbering = ArchiveNumberingMode.DateAndSequence; - infoFileTarget.ArchiveFileName = @"${basedir}/Logs/Info/{####}.txt"; - infoFileTarget.FileName = @"${basedir}/Logs/Info/${shortdate}.txt";//褰撳墠鏂囦欢璺緞 - infoFileTarget.Layout = @"${longdate} | ${level:uppercase=false:padding=-5} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"; - - config.AddTarget("infoFile", infoFileTarget); - config.AddRuleForOneLevel(LogLevel.Info, infoFileTarget);//INFO鍐欏湪Info鏂囦欢 - - //娣诲姞target-err - var errorFileTarget = new FileTarget(); - errorFileTarget.ArchiveAboveSize = 1024 * 1024 * 5;//姣忎釜鏂囦欢鏈�ぇ5M - errorFileTarget.ArchiveNumbering = ArchiveNumberingMode.DateAndSequence; - errorFileTarget.ArchiveFileName = @"${basedir}/Logs/Error/{####}.txt"; - errorFileTarget.FileName = @"${basedir}/Logs/Error/${shortdate}.txt"; - errorFileTarget.Layout = @"${longdate} | ${level:uppercase=false:padding=-5} | ${message} ${onexception:${exception:format=tostring} ${newline} ${stacktrace} ${newline}"; - - config.AddTarget("errorFile", errorFileTarget); - config.AddRule(LogLevel.Error, LogLevel.Fatal, errorFileTarget); - - - return config; - } - - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/STAttribute.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/STAttribute.cs deleted file mode 100644 index 5fe038b..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/STAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -锘縰sing SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.util -{ - - [AttributeUsage(AttributeTargets.Class, Inherited = true)] - class STAttribute : SugarTable - { - public static Dictionary<string, string> attributes = new Dictionary<string, string>(); - public STAttribute(string tableName) : base(tableName) - { - string value = ""; - if (attributes.TryGetValue(TableName, out value)) - TableName = value.ToUpper(); - } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/Settings.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/Settings.cs deleted file mode 100644 index 9195aec..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/Settings.cs +++ /dev/null @@ -1,157 +0,0 @@ -锘縰sing Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using System; -using System.Collections.Generic; -using System.Linq; -using static HH.WCS.Mobox3.FJJT.util.Settings; - -namespace HH.WCS.Mobox3.FJJT.util { - public class Settings { - public static string HostToAgvServerUrl { get; set; } - public static string HASeverUrl { get; set; } - public static string SqlServer { get; set; } - public static string SqlServer1 { get; set; } - public static string OracleServer { get; set; } - public static List<deviceInfo> deviceInfos { get; set; } - public static List<LinePlcInfo> linePlcInfo { get; set; } - public static List<PlcValue> plcValue { get; set; } - public static List<AreaProperty> areaPropertyList { get; set; } - public static int port { get; set; } - public static string WHCode { get; set; } - public static string FacCode { get; set; } - public static string NDCApiUrl { get; set; } - - - - public static void Init() { - LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 寮�"); - try { - var jsonFile = System.AppDomain.CurrentDomain.BaseDirectory + "/config/config.json"; - using (System.IO.StreamReader file = System.IO.File.OpenText(jsonFile)) { - using (JsonTextReader reader = new JsonTextReader(file)) { - JObject o = (JObject)JToken.ReadFrom(reader); - foreach (Newtonsoft.Json.Linq.JProperty keyValue in o.Properties()) { - Console.WriteLine(keyValue.Name); - if (keyValue.Name == "HostToAgvServerUrl") { - HostToAgvServerUrl = keyValue.Value.ToString(); - } - if (keyValue.Name == "NDCApiUrl") { - NDCApiUrl = keyValue.Value.ToString(); - } - if (keyValue.Name == "HASeverUrl") { - HASeverUrl = keyValue.Value.ToString(); - } - if (keyValue.Name == "SqlServer") { - SqlServer = keyValue.Value.ToString(); - } - if (keyValue.Name == "SqlServer1") { - SqlServer1 = keyValue.Value.ToString(); - } - if (keyValue.Name == "OracleServer") - { - OracleServer = keyValue.Value.ToString(); - } - if (keyValue.Name == "WHCode") { - WHCode = keyValue.Value.ToString(); - } - if (keyValue.Name == "FacCode") { - FacCode = keyValue.Value.ToString(); - } - if (keyValue.Name == "ApiPort") { - port = int.Parse(keyValue.Value.ToString()); - } - if (keyValue.Name == "DeviceInfo") { - deviceInfos = JsonConvert.DeserializeObject<List<deviceInfo>>(keyValue.Value.ToString()); - } - if (keyValue.Name == "linePlcInfo") { - linePlcInfo = JsonConvert.DeserializeObject<List<LinePlcInfo>>(keyValue.Value.ToString()); - } - if (keyValue.Name == "PlcValue") { - plcValue = JsonConvert.DeserializeObject<List<PlcValue>>(keyValue.Value.ToString()); - } - if (keyValue.Name == "AreaProperty") - { - areaPropertyList = JsonConvert.DeserializeObject<List<AreaProperty>>(keyValue.Value.ToString()); - } - } - } - } - LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 瀹屾垚"); - } - catch (Exception ex) { - LogHelper.Error("鍔犺浇閰嶇疆鏂囦欢澶辫触锛� + ex.Message, ex); - } - } - - /// <summary> - /// 鏌ヨ涓嶅悓瀹瑰櫒鐨勫瓨鍌ㄥ簱鍖�- /// </summary> - /// <param name="cntrType"></param> - /// <returns></returns> - public static List<string> getCntrAreaList(int cntrType) { - return areaPropertyList.Where(a => a.cntrType.Contains(cntrType)).Select(a => a.areaCode).ToList(); - } - - public class AreaProperty - { - public string areaName { get; set; } - public string areaCode { get; set; } - public List<int> cntrType { get; set; } // 瀹瑰櫒绫诲瀷 1.鑳庨潰锛�.鑳庝晶锛�.鍐呰‖锛�.甯樺竷锛�.鐜甫锛�.鍐犲甫锛�.閽㈠寘 - } - - - - - - - public class deviceInfo { - public string address { get; set; } - public string deviceName { get; set; } - public string[] deviceNo { get; set; } - public string[] TN_Location { get; set; } - - public int deviceType { get; set; } - public int enable { get; set; } - } - public class TableName { - public string name { get; set; } - public string code { get; set; } - } - - public class LinePlcInfo { - public string code { get; set; } - public string location { get; set; } - public string deviceNo { get; set; } - public string address { get; set; } - public int writeAddr { get; set; } - public int readAddr { get; set; } - public string[] useAddrNo { get; set; } - public string inLoca { get; set; } - public string outLoca { get; set; } - public int enable { get; set; } - } - public class PlcValue { - public string address { get; set; } - public List<S7Model> read { get; set; } - public List<S7Model> write { get; set; } - } - public class S7Model { - /// <summary> - /// 鍋忕Щ閲�- /// </summary> - public int addr { get; set; } - /// <summary> - /// 绫诲瀷 - /// </summary> - public string type { get; set; } - /// <summary> - /// 闀垮害 - /// </summary> - public int length { get; set; } - /// <summary> - /// 鍊�- /// </summary> - public string value { get; set; } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/SqlHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/SqlHelper.cs deleted file mode 100644 index bc0eb0c..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/SqlHelper.cs +++ /dev/null @@ -1,288 +0,0 @@ -锘縰sing Newtonsoft.Json; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Linq; -using System.Linq.Expressions; - -namespace HH.WCS.Mobox3.FJJT.util -{ - //https://www.donet5.com/Home/Doc - public class SqlHelper<T> where T : class, new() - { - public bool ExecuteSql(string sql) { - try { - var code = GetInstance().Ado.ExecuteCommand(sql); - return code > 1; - } - catch (Exception ex) { - return false; - } - } - - public bool Update(T model, string[] cols) { - var db = GetInstance(); - return db.Updateable<T>(model).UpdateColumns(cols).ExecuteCommand() > 0; - } - public List<T> GetList(Expression<Func<T, bool>> where = null) { - var db = GetInstance(); - if (where == null) { - return db.Queryable<T>().ToList(); - } - else { - return db.Queryable<T>().Where(where).ToList(); - } - } - public T Get(Expression<Func<T, bool>> where, Expression<Func<T, object>> order, bool asc = false) { - SqlSugarClient db = GetInstance(); - if (order == null) { - return db.Queryable<T>().Where(where).Single(); - } - else { - return db.Queryable<T>().Where(where).OrderBy(order, asc ? OrderByType.Asc : OrderByType.Desc).First(); - } - } - public T Get(Expression<Func<T, bool>> where, Expression<Func<T, object>> orderBy = null) { - try { - var db = GetInstance(); - T model = null; - if (orderBy != null) { - model = db.Queryable<T>().Where(where).OrderBy(orderBy, OrderByType.Desc).First();//鏌ヨ琛ㄧ殑鎵�湁 - } - else { - model = db.Queryable<T>().Where(where).First(); - } - return model; - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - return default(T); - } - } - public bool Update(T model) { - var db = GetInstance(); - return db.Updateable<T>(model).ExecuteCommand() > 0; - } - public bool Insert(T model) { - try { - var db = GetInstance(); - return db.Insertable<T>(model).ExecuteCommand() > 0; - } - catch (Exception ex) { - return false; - } - } - - //鍒犻櫎鎸囧畾鏉′欢鏁版嵁 - public bool Deleteable(Expression<Func<T, bool>> where) { - try { - var db = GetInstance(); - return db.Deleteable<T>().Where(where).ExecuteCommand() > 0; - } - catch (Exception ex) { - return false; - } - } - - - //鍒涘缓SqlSugarClient - public SqlSugarClient GetInstance(string url = "") { - //鍒涘缓鏁版嵁搴撳璞�- SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { - ConnectionString = string.IsNullOrEmpty(url) ? Settings.OracleServer : url, - //ConnectionString = @"Data Source=192.168.1.198\sql2008;Initial Catalog=OIMobox;User ID=sa;Password=sa@2015", - /* DbType = DbType.SqlServer,*/ - //ConnectionString = @"localhost/OIMobox;User ID=system;Password=Am123123", - //ConnectionString = @"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=OIMobox)));User Id=system;Password=Am123123;", - DbType = DbType.Oracle, - IsAutoCloseConnection = true, - InitKeyType = InitKeyType.Attribute//浠庣壒鎬ц鍙栦富閿嚜澧炰俊鎭�- }); - // - //db.MappingTables.Add("",""); - - //鐩戞帶鎵�湁瓒呰繃1绉掔殑Sql - db.Aop.OnLogExecuted = (sql, p) => { - //鎵ц鏃堕棿瓒呰繃1绉�- if (db.Ado.SqlExecutionTime.TotalSeconds > 1) { - Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(p.ToDictionary(it => it.ParameterName, it => it.Value))); - //浠g爜CS鏂囦欢鍚�- var fileName = db.Ado.SqlStackTrace.FirstFileName; - //浠g爜琛屾暟 - var fileLine = db.Ado.SqlStackTrace.FirstLine; - //鏂规硶鍚�- var FirstMethodName = db.Ado.SqlStackTrace.FirstMethodName; - //db.Ado.SqlStackTrace.MyStackTraceList[1].xxx 鑾峰彇涓婂眰鏂规硶鐨勪俊鎭�- } - //鐩稿綋浜嶦F鐨�PrintToMiniProfiler - }; - db.Aop.DataExecuted = (value, entity) => { - entity.EntityColumnInfos.ToList().ForEach(a => { - var pvalue = entity.GetValue(a.PropertyName); - if (pvalue != null && pvalue.GetType() == typeof(String)) { - entity.SetValue(a.PropertyName, pvalue.ToString().Trim()); - } - }); - }; - - /* db.Aop.OnLogExecuting = (sql, pars) => - { - Console.WriteLine(sql); - foreach (var param in pars) - { - Console.WriteLine($"{param.ParameterName}: {param.Value}"); - } - };*/ - //鎹浆鎹�(ExecuteCommand鎵嶄細鎷︽埅锛屾煡璇笉琛� - //db.Aop.DataExecuting = (value, entity) => { - // //var val=entity.EntityColumnInfo - // Console.WriteLine(entity.EntityName); - //}; - - db.Aop.OnExecutingChangeSql = (sql, pars) => //鍙互淇敼SQL鍜屽弬鏁扮殑鍊�- { - if (db.CurrentConnectionConfig.DbType == DbType.Oracle && pars.Any()) - { - var input = sql; - Stack<int> stack = new Stack<int>(); - List<string> results = new List<string>(); - for (int i = 0; i < input.Length; i++) - { - if (input[i] == '(') - { - stack.Push(i); - } - else if (input[i] == ')') - { - if (stack.Count > 0) - { - int start = stack.Pop(); - string content = input.Substring(start + 1, i - start - 1); - results.Add(content); - } - } - } - foreach (var p in pars) - { - if (p.DbType == System.Data.DbType.String) - { - var result = results.Find(x => x.Contains(p.ParameterName) && x.Count(c => c == '=') == 1); - if (result != null && !result.Contains("trim(")) - { - string[] parts = result.Split('='); - if (parts.Length > 1) - { - string Field = parts[0]; - sql = sql.Replace(result, $"trim({Field}) = {p.ParameterName}"); - } - } - } - } - } - return new KeyValuePair<string, SugarParameter[]>(sql, pars); - }; - return db; - } - - - public SqlSugarClient GetOracleInstance(string url = "") - { - //鍒涘缓鏁版嵁搴撳璞�- SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() - { - //ConnectionString = string.IsNullOrEmpty(url) ? Settings.SqlServer : url, - //ConnectionString = @"Data Source=192.168.1.198\sql2008;Initial Catalog=OIMobox;User ID=sa;Password=sa@2015", - //DbType = DbType.SqlServer, - //ConnectionString = @"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=OIMobox)));User Id=system;Password=Am123123;", - /* ConnectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.3.18.224)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=db1.hec.prod)));User Id=WMS_X5;Password=WMS_X5_2617;",*/ - ConnectionString = @url, - DbType = DbType.Oracle, - IsAutoCloseConnection = true, - InitKeyType = InitKeyType.Attribute//浠庣壒鎬ц鍙栦富閿嚜澧炰俊鎭�- }); - // - //db.MappingTables.Add("",""); - - //鐩戞帶鎵�湁瓒呰繃1绉掔殑Sql - db.Aop.OnLogExecuted = (sql, p) => { - //鎵ц鏃堕棿瓒呰繃1绉�- if (db.Ado.SqlExecutionTime.TotalSeconds > 1) - { - Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(p.ToDictionary(it => it.ParameterName, it => it.Value))); - //浠g爜CS鏂囦欢鍚�- var fileName = db.Ado.SqlStackTrace.FirstFileName; - //浠g爜琛屾暟 - var fileLine = db.Ado.SqlStackTrace.FirstLine; - //鏂规硶鍚�- var FirstMethodName = db.Ado.SqlStackTrace.FirstMethodName; - //db.Ado.SqlStackTrace.MyStackTraceList[1].xxx 鑾峰彇涓婂眰鏂规硶鐨勪俊鎭�- } - //鐩稿綋浜嶦F鐨�PrintToMiniProfiler - }; - - db.Aop.DataExecuted = (value, entity) => { - entity.EntityColumnInfos.ToList().ForEach(a => { - var pvalue = entity.GetValue(a.PropertyName); - if (pvalue != null && pvalue.GetType() == typeof(String)) - { - entity.SetValue(a.PropertyName, pvalue.ToString().Trim()); - } - }); - }; - - //鎹浆鎹�(ExecuteCommand鎵嶄細鎷︽埅锛屾煡璇笉琛� - //db.Aop.DataExecuting = (value, entity) => { - // //var val=entity.EntityColumnInfo - // Console.WriteLine(entity.EntityName); - //}; - db.Aop.OnExecutingChangeSql = (sql, pars) => //鍙互淇敼SQL鍜屽弬鏁扮殑鍊�- { - if (pars.Any()) - { - int index = sql.IndexOf("WHERE") + 6; - var input = string.Join("", sql.Skip(index)); - // 浣跨敤鏍堟潵鍖归厤鎴愬鐨勬嫭鍙�- Stack<int> stack = new Stack<int>(); - List<string> results = new List<string>(); - for (int i = 0; i < input.Length; i++) - { - if (input[i] == '(') - { - stack.Push(i); - } - else if (input[i] == ')') - { - if (stack.Count > 0) - { - int start = stack.Pop(); - string content = input.Substring(start + 1, i - start - 1); - results.Add(content); - } - } - } - foreach (var p in pars) - { - if (p.DbType == System.Data.DbType.String) - { - Console.WriteLine(p.ParameterName); - var result = results.Find(x => x.Contains(p.ParameterName) && x.Count(c => c == '=') == 1); - if (result != null && !result.Contains("trim(")) - { - string[] parts = result.Split('"'); - if (parts.Length > 1) - { - string Field = parts[1]; - sql = sql.Replace(result, $"trim(\"{Field}\") = {p.ParameterName}"); - } - } - } - } - } - return new KeyValuePair<string, SugarParameter[]>(sql, pars); - }; - return db; - } - } - -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/StrHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/StrHelper.cs deleted file mode 100644 index f1a2c2b..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/StrHelper.cs +++ /dev/null @@ -1,31 +0,0 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.util -{ - internal class StrHelper - { - /// <summary> - /// 鑾峰彇闅忔満瀛楃涓�- /// </summary> - /// <param name="prefix"></param> - /// <param name="Length"></param> - /// <returns></returns> - public static string StrRandom(string prefix, int Length) { - byte[] b = new byte[32]; - RandomNumberGenerator.Create().GetBytes(b); - Random random = new Random(BitConverter.ToInt32(b, 0)); - string str = "0123456789"; //abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ - string returnStr = string.Empty; - for (int i = 0; i < Length; i++) { - returnStr += str.Substring(random.Next(0, str.Length - 1), 1); - } - var cntrCode = prefix + returnStr; - return cntrCode; - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/ContainerHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/ContainerHelper.cs deleted file mode 100644 index 7b5c805..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/ContainerHelper.cs +++ /dev/null @@ -1,381 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.models.other; -using HH.WCS.Mobox3.FJJT.util; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using static HH.WCS.Mobox3.FJJT.dispatch.NDC; -using static HH.WCS.Mobox3.FJJT.util.ExcetionHelper; - -namespace HH.WCS.Mobox3.FJJT.wms { - /// <summary> - /// 瀹瑰櫒甯姪绫�- /// </summary> - internal class ContainerHelper { - internal static string GenerateCntrNo() { - var id = SYSHelper.GetSerialNumber("鎵樼洏鍙�, "TP"); - var date = DateTime.Now.ToString("yyMMdd"); - return $"TP{date}{id.ToString().PadLeft(4, '0')}"; - } - /// <summary> - /// 鏍规嵁瀹瑰櫒绫诲瀷銆佺洰鐨勫湴銆佺姸鎬佹煡璇㈠鍣�- /// </summary> - /// <param name="dest"></param> - /// <param name="cntrType"></param> - /// <param name="state"></param> - /// <returns></returns> - internal static List<Container> GetCntrListByPurpose(string dest, string cntrType, int state) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Container>().Where(a => a.S_DEST == dest && a.S_TYPE == cntrType && a.N_B_STATE == state).ToList(); - return list; - - } - /// <summary> - /// TN_ContainerHelper.test("4L澶╃劧姘寸瑁�鍏�, 50, "335ml涓滄柟鏍戝彾15鍏�, 30); - /// </summary> - /// <param name="item1"></param> - /// <param name="qty1"></param> - /// <param name="item2"></param> - /// <param name="qty2"></param> - //internal static void test(string item1, int qty1, string item2, int qty2) { - // var db = new SqlHelper<object>().GetInstance(); - // var cntr = db.Queryable<TN_Container>().Includes(a => a.CntrItemRelList). - // Where(a => a.CntrItemRelList.Count(b => b.S_ITEM_CODE == item1 && int.Parse(b.F_QTY) > qty1) > 0 - // && a.CntrItemRelList.Count(b => b.S_ITEM_CODE == item2 && int.Parse(b.F_QTY) > qty2) > 0).First(); - //} - - /// <summary> - /// 鍒ゆ柇瀹瑰櫒鏄惁鏈夌墿鏂欎俊鎭�- /// </summary> - /// <param name="cntr"></param> - /// <returns></returns> - internal static bool CheckEmpty(string cntr) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<LocCntrRel>().Count(a => a.S_LOC_CODE.Trim() == cntr) == 0; - - } - - /*internal static bool AddCntr(string cntrCode, string itemCode) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var TN_Container = new Container { S_CODE = cntrCode }; - var cntrItemRel = new CntrItemRel { S_CNTR_CODE = cntrCode, S_ITEM_CODE = itemCode }; - try { - db.BeginTran(); - - db.Insertable<Container>(TN_Container).ExecuteCommand(); - db.Insertable<CntrItemRel>(cntrItemRel).ExecuteCommand(); - - db.CommitTran(); - res = true; - } - catch (Exception ex) { - db.RollbackTran(); - - } - return res; - }*/ - - internal static bool AddCntr(string cntrCode ,int detallCount = 1) - { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var TN_Container = new Container { S_CODE = cntrCode ,N_DETAIL_COUNT = detallCount }; - try - { - db.BeginTran(); - var container = db.Queryable<Container>().Where(a => a.S_CODE.Trim() == cntrCode).First(); - if (container == null) - { - db.Insertable<Container>(TN_Container).ExecuteCommand(); - } - else - { - container.N_DETAIL_COUNT = detallCount; - container.N_E_STATE = 0; - db.Updateable(container).ExecuteCommand(); - } - db.CommitTran(); - res = true; - } - catch (Exception ex) - { - db.RollbackTran(); - WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"娣诲姞瀹瑰櫒閿欒锛岄敊璇師鍥狅細{ex.Message}"); - throw new BusinessException($"娣诲姞瀹瑰櫒閿欒锛岄敊璇師鍥狅細{ex.Message}"); - } - return res; - } - - internal static bool AddContainer(string cntrCode,int cntrType ,int detallCount = 0) - { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var TN_Container = new Container { S_CODE = cntrCode, N_TYPE = cntrType,S_TYPE = Container.GetCntrType(cntrType),N_DETAIL_COUNT = detallCount }; - try - { - db.BeginTran(); - var container = db.Queryable<Container>().Where(a => a.S_CODE.Trim() == cntrCode).First(); - if (container == null) - { - db.Insertable<Container>(TN_Container).ExecuteCommand(); - } - else - { - container.N_DETAIL_COUNT = detallCount; - container.N_E_STATE = 0; - db.Updateable<Container>(container).ExecuteCommand(); - } - db.CommitTran(); - res = true; - } - catch (Exception ex) - { - db.RollbackTran(); - WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"娣诲姞瀹瑰櫒閿欒锛岄敊璇師鍥狅細{ex.Message}"); - throw new BusinessException($"娣诲姞瀹瑰櫒閿欒锛岄敊璇師鍥狅細{ex.Message}"); - } - return res; - } - - /// <summary> - /// 鏍规嵁瀹瑰櫒鍙疯幏鍙栧鍣ㄤ俊鎭�- /// </summary> - /// <param name="cntr"></param> - /// <param name="create"></param> - /// <returns></returns> - internal static Container GetCntr(string cntr, bool create = false) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var old = db.Queryable<Container>().Where(a => a.S_CODE.Trim() == cntr).First(); - if (old == null && create) { - var model = new Container { S_CODE = cntr }; - if (db.Insertable(model).ExecuteCommand() > 0) { - old = model; - } - } - return old; - } - - /// <summary> - /// 鏍规嵁瀹瑰櫒鑾峰彇鐗╂枡淇℃伅 - /// </summary> - /// <param name="cntr"></param> - /// <returns></returns> - internal static List<CntrItemRel> GetCntrItemRel(string cntr) { - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<CntrItemRel>().Where(a => a.S_CNTR_CODE == cntr).ToList(); - return list; - } - - /// <summary> - /// 鏇存柊瀹瑰櫒鐗╂枡淇℃伅 - /// </summary> - /// <param name="cntrItem"></param> - /// <returns></returns> - internal static bool updateCntrItemRel(CntrItemRel cntrItem) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Updateable(cntrItem).ExecuteCommand()>0; - } - - /// <summary> - /// 鐗╂枡淇℃伅缁戝畾鍒版弧瀹瑰櫒涓�- /// </summary> - /// <param name="cntrCode"></param> - /// <param name="itemCode"></param> - /// <param name="batchNo"></param> - /// <param name="qty"></param> - /// <returns></returns> - internal static bool BindCntrItem(Container cntr, string itemCode, string batchNo, float qty) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - try { - db.BeginTran(); - //1.鏌ョ湅鏄惁鏈夌浉鍚岀墿鏂欐壒娆$殑淇℃伅锛屽鏋滄湁瑕佺疮鍔狅紝涓嶅悓鎵规鐨勫彲浠ュ垎寮�- var cir = db.Queryable<CntrItemRel>().Where(a => a.S_CNTR_CODE == cntr.S_CODE && a.S_ITEM_CODE == itemCode && a.S_BATCH_NO == batchNo).First(); - if (cir != null) { - cir.F_QTY += qty; - db.Updateable(cir).UpdateColumns(it => new { it.F_QTY }).ExecuteCommand(); - } - else { - //2.鎻掑叆鏂扮殑瀹瑰櫒鐗╂枡淇℃伅锛堝鍣ㄥ彿涓嶅彉锛�- cir = new CntrItemRel { S_CNTR_CODE = cntr.S_CODE.Trim(), S_BATCH_NO = batchNo, F_QTY = qty, S_ITEM_CODE = itemCode }; - db.Insertable<CntrItemRel>(cir).ExecuteCommand(); - } - var count = db.Queryable<CntrItemRel>().Count(a => a.S_CNTR_CODE == cntr.S_CODE); - cntr.N_DETAIL_COUNT = count; - cntr.C_ENABLE = "N";//鐮佺洏鍚庡皢鎵樼洏璁剧疆涓轰笉鍙敤鐘舵�锛屽叆搴撳悗鍙樻垚鍙敤 - db.Updateable(cntr).UpdateColumns(it => new { it.N_DETAIL_COUNT, it.C_ENABLE, it.S_SRC }).ExecuteCommand(); - - db.CommitTran(); - res = true; - } - catch (Exception ex) { - db.RollbackTran(); - Console.WriteLine(ex.Message); - } - - return res; - } - - /// <summary> - /// 鐗╂枡淇℃伅缁戝畾鍒版弧瀹瑰櫒涓�- /// </summary> - /// <param name="cntrCode"></param> - /// <param name="itemCode"></param> - /// <param name="batchNo"></param> - /// <param name="qty"></param> - /// <param name="purpose">瀹瑰櫒鐢ㄩ�锛岀敤浜庡摢涓嚎杈硅繕鏄洰鐨勭偣</param> - /// <returns></returns> - internal static bool BindCntrItemSingle(Container cntr, string itemCode, string batchNo, float qty) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - try { - db.BeginTran(); - db.Updateable(cntr).UpdateColumns(it => new { it.S_DEST }).ExecuteCommand(); - //1.灏嗗師鏈夊鍣ㄧ墿鏂欎俊鎭垹闄�- db.Deleteable<CntrItemRel>().Where(it => it.S_CNTR_CODE == cntr.S_CODE.Trim()).ExecuteCommand(); - //2.鎻掑叆鏂扮殑瀹瑰櫒鐗╂枡淇℃伅锛堝鍣ㄥ彿涓嶅彉锛�- var cir = new CntrItemRel { S_CNTR_CODE = cntr.S_CODE.Trim(), S_BATCH_NO = batchNo, F_QTY = qty, S_ITEM_CODE = itemCode }; - db.Insertable<CntrItemRel>(cir).ExecuteCommand(); - - db.CommitTran(); - res = true; - } - catch (Exception ex) { - db.RollbackTran(); - } - - return res; - } - /// <summary> - /// 鏍规嵁瀹瑰櫒鏉ユ簮鍜岀姸鎬佽幏鍙栨墭鐩�- /// </summary> - /// <param name="src"></param> - /// <param name="state"></param> - /// <returns></returns> - internal static List<Container> GetCntr(string dest, int state, string cntrType = "") { - var db = new SqlHelper<object>().GetInstance(); - if (cntrType == "") { - return db.Queryable<Container>().Where(a => a.S_DEST == dest && a.N_B_STATE == state).ToList(); - } - else { - return db.Queryable<Container>().Where(a => a.S_DEST == dest && a.N_B_STATE == state && a.S_TYPE == cntrType).ToList(); - } - } - internal static bool UpdateCntr(List<string> cntrs, string dest, int state) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var models = db.Queryable<Container>().Where(a => cntrs.Contains(a.S_CODE)).ToList(); - if (models.Count > 0) { - models.ForEach(a => { - a.S_DEST = dest; a.N_B_STATE = state; - db.Updateable(a).UpdateColumns(it => new { it.S_DEST, it.N_B_STATE }).ExecuteCommand(); - }); - res = true; - } - return res; - } - - internal static bool UpdateCntr(Container container) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Updateable(container).ExecuteCommand()>0; - } - - internal static bool UpdateCntrDest(List<string> cntrs, string dest) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var models = db.Queryable<Container>().Where(a => cntrs.Contains(a.S_CODE)).ToList(); - if (models.Count > 0) { - models.ForEach(a => { - a.S_DEST = dest; - db.Updateable(a).UpdateColumns(it => new { it.S_DEST }).ExecuteCommand(); - }); - res = true; - } - return res; - } - /// <summary> - /// 鏇存柊鎵樼洏鏉ユ簮 - /// </summary> - /// <param name="cntr"></param> - /// <param name="src"></param> - /// <returns></returns> - internal static bool UpdateCntrSrc(string cntr, string src) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var model = db.Queryable<Container>().Where(a => a.S_CODE == cntr).First(); - if (model != null) { - model.S_SRC = src; - model.T_MODIFY = DateTime.Now; - res = db.Updateable(model).UpdateColumns(it => new { it.S_SRC, it.T_MODIFY }).ExecuteCommand() > 0; - } - return res; - } - - /// <summary> - /// - /// </summary> - /// <param name="cntrCode"></param> - /// <param name="state">鎵樼洏寮傚父鐘舵� 0.榛樿 1.WCS璇荤爜寮傚父 2.AGV璇荤爜鍣ㄨ鐮佸紓甯�/param> - /// <param name="errMsg">寮傚父淇℃伅</param> - /// <returns></returns> - internal static bool UpdateCntrState(string cntrCode, int state ,string errMsg) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var models = db.Queryable<Container>().Where(a => a.S_CODE.Trim() == cntrCode).ToList(); - if (models.Count > 0) { - models.ForEach(a => { - a.N_E_STATE = state; - a.S_ERR_DESC = errMsg; - db.Updateable(a).UpdateColumns(it => new { it.N_E_STATE,it.S_ERR_DESC }).ExecuteCommand(); - }); - res = true; - } - return res; - } - - internal static bool UpdateCntr(List<string> cntrs, string src, string dest, int state) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var models = db.Queryable<Container>().Where(a => cntrs.Contains(a.S_CODE)).ToList(); - if (models.Count > 0) { - models.ForEach(a => { - a.S_DEST = dest; a.N_B_STATE = state; - db.Updateable(a).UpdateColumns(it => new { it.S_DEST, it.N_B_STATE, it.S_SRC }).ExecuteCommand(); - }); - res = true; - } - return res; - } - public static bool ClearCntrInfo(string cntr) { - - var db = new SqlHelper<object>().GetInstance(); - var model = db.Queryable<Container>().Where(a => a.S_CODE == cntr).First(); - if (model != null) { - model.S_SRC = ""; - model.S_DEST = ""; - model.N_B_STATE = 0; - model.T_MODIFY = DateTime.Now; - - } - db.Updateable(model).UpdateColumns(it => new { it.S_SRC, it.S_DEST, it.N_B_STATE, it.T_MODIFY }).ExecuteCommand(); - return db.Deleteable<CntrItemRel>().Where(a => a.S_CNTR_CODE.Trim() == cntr.Trim()).ExecuteCommand() > 0; - } - internal static List<Container> GetCntrBySrc(string src, int state, string cntrType = "") { - var db = new SqlHelper<object>().GetInstance(); - if (cntrType == "") { - return db.Queryable<Container>().Where(a => a.S_SRC == src && a.N_B_STATE == state).ToList(); - } - else { - return db.Queryable<Container>().Where(a => a.S_SRC == src && a.N_B_STATE == state && a.S_TYPE == cntrType).ToList(); - } - } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/LocationHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/LocationHelper.cs deleted file mode 100644 index 5ad847a..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/LocationHelper.cs +++ /dev/null @@ -1,399 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.util; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.wms { - internal class LocationHelper { - public class LocationExt { - public string S_PICKUP_POINT { get; internal set; } - public string S_LOC_CODE { get; internal set; } - public string S_AGV_SITE { get; internal set; } - } - private static Dictionary<string, Location> Locations = null; - private static Dictionary<string, LocationExt> LocationExts = null; - - static LocationHelper() { - try { - //鍒濆鍖朙ocation鍔犲叆鍒板瓧鍏哥紦瀛�- Locations = new Dictionary<string, Location>(); - var list = GetAllLocList(); - if (list.Count > 0) { - list.ForEach(a => { - if (!Locations.ContainsKey(a.S_CODE)) { - Locations.Add(a.S_CODE, a); - } - }); - } - //鍒濆鍖朙ocationExt鍔犲叆鍒伴泦鍚堢紦瀛�- //LocationExts = new Dictionary<string, LocationExt>(); - //var exts = GetAllLocExtList(); - //if (exts.Count > 0) { - // exts.ForEach(a => { - // LocationExts.Add($"{a.S_LOC_CODE.Trim()}_{a.S_PICKUP_POINT.Trim()}", a); - // }); - //} - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - } - } - - internal static bool CheckExist(string loc) { - return Locations.Keys.Contains(loc); - } - internal static Location GetLocation(string loc) { - if (CheckExist(loc.Trim())) { - return Locations[loc.Trim()]; - } - return null; - } - internal static List<FunctionArea> GetFunctionAreas(string masterCls, string msterCode) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<FunctionArea>().Where(a => a.S_MASTER_CLS == masterCls && a.S_MASTER_CODE == msterCode).ToList(); - } - internal static List<FunctionArea> GetFunctionAreas(string masterCls, string msterCode, int nType) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<FunctionArea>().Where(a => a.S_MASTER_CLS == masterCls && a.S_MASTER_CODE == msterCode && a.N_TYPE == nType).ToList(); - } - internal static FunctionArea GetFunctionAreaByCode(string faCode, int faType, int nType) { - var db = new SqlHelper<object>().GetInstance(); - // && a.N_FA_TYPE == faType - return db.Queryable<FunctionArea>().Where(a => a.S_FA_CODE == faCode && a.N_TYPE == nType).First(); - } - /// <summary> - /// 鑾峰彇璐т綅绔欑偣淇℃伅 - /// </summary> - /// <param name="loc"></param> - /// <returns></returns> - internal static string GetAgvSite(string loc) { - var site = "0"; - if (Locations.Keys.Contains(loc.Trim())) { - var Location = Locations[loc.Trim()]; - site = Location.S_AGV_SITE; - } - else { - var Location = GetLoc(loc.Trim()); - if (Location != null) { - Locations.Add(loc.Trim(), Location); - site = Location.S_AGV_SITE; - } - } - return site; - } - - internal static int GetAgvSite(string loc, string actionType) { - var site = 0; - var key = $"{loc.Trim()}_{actionType.Trim()}"; - if (LocationExts.Keys.Contains(loc.Trim())) { - var Location = LocationExts[loc.Trim()]; - site = int.Parse(Location.S_AGV_SITE); - } - return site; - } - - /// <summary> - /// 鑾峰彇鎵�湁璐т綅淇℃伅 - /// </summary> - /// <returns></returns> - internal static List<Location> GetAllLocList() { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<Location>().ToList(); - } - internal static Location GetLoc(string code) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<Location>().Where(a => a.S_CODE.Trim() == code).First(); - } - internal static Location GetEmptyLoc(string areaCode) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == areaCode && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").First(); - } - - /// <summary> - ///鑾峰彇鎵�湁璐т綅鎵╁睍淇℃伅 - /// </summary> - /// <returns></returns> - internal static List<LocationExt> GetAllLocExtList() { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<LocationExt>().ToList(); - } - - /// <summary> - /// 鍒ゆ柇娌℃湁鍏ュ簱閿佸拰鍑哄簱閿�- /// </summary> - /// <param name="code"></param> - /// <returns></returns> - internal static bool CheckLocFree(string code) { - var result = false; - var loc = GetLoc(code); - if (loc != null) { - result = loc.N_LOCK_STATE == 0; - } - return result; - } - internal static List<LocCntrRel> GetLocCntr(string loc) { - var result = new List<LocCntrRel>(); - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc).OrderBy(a => a.T_CREATE).ToList(); - if (list.Count > 0) { - list.ForEach(a => { - //鑾峰彇瀹瑰櫒淇℃伅 - var cntr = db.Queryable<Container>().Where(b => b.S_CODE.Trim() == a.S_CNTR_CODE).First(); - if (cntr != null) { - a.Container = cntr; - result.Add(a); - } - }); - } - return result; - - } - internal static List<LocCntrRel> GetLocCntrRel(string loc) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var result = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE == loc.Trim()).ToList(); - return result; - - } - - /// <summary> - /// 鏍规嵁璐т綅闆嗗悎鑾峰彇鏈夊鍣ㄧ殑璐т綅 - /// </summary> - /// <param name="loc"></param> - /// <returns></returns> - internal static List<Location> GetLocList(List<string> loc) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => loc.Contains(a.S_CODE) && a.N_CURRENT_NUM > 0).ToList(); - return list; - - } - - /// <summary> - /// 鏍规嵁璐т綅缂栫爜鑾峰彇璐т綅淇℃伅锛屼笉绠℃湁娌℃湁瀹瑰櫒 - /// </summary> - /// <param name="loc"></param> - /// <returns></returns> - internal static List<Location> GetLocListAny(List<string> loc) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => loc.Contains(a.S_CODE)).ToList(); - return list; - - } - - /// <summary> - /// 鏍规嵁璐т綅闆嗗悎鑾峰彇鏈夊鍣�娌℃湁閿佺殑璐т綅 - /// </summary> - /// <param name="loc"></param> - /// <returns></returns> - internal static List<Location> GetLocListFree(List<string> loc) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => loc.Contains(a.S_CODE) && a.N_CURRENT_NUM > 0 && a.N_LOCK_STATE == 0).ToList(); - return list; - - } - - /// <summary> - /// 鑾峰彇鍥哄畾鏁伴噺瀹瑰櫒 娌℃湁閿佺殑璐т綅 - /// </summary> - /// <param name="loc"></param> - /// <param name="current"></param> - /// <returns></returns> - internal static List<Location> GetLocListFree(List<string> loc, int current) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => loc.Contains(a.S_CODE) && a.N_CURRENT_NUM == current && a.N_LOCK_STATE == 0).ToList(); - return list; - - } - - /// <summary> - /// 鑾峰彇鏁伴噺澶т簬绛変簬鍥哄畾鏁伴噺瀹瑰櫒 娌℃湁閿佺殑璐т綅 - /// </summary> - /// <param name="loc"></param> - /// <param name="current"></param> - /// <returns></returns> - internal static List<Location> GetLocList(List<string> loc, int current) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => loc.Contains(a.S_CODE) && a.N_CURRENT_NUM >= current && a.N_LOCK_STATE == 0).ToList(); - return list; - - } - - /// <summary> - /// 鏍规嵁璐т綅闆嗗悎鑾峰彇 娌℃湁瀹瑰櫒 娌℃湁閿佺殑璐т綅 - /// </summary> - /// <param name="loc"></param> - /// <returns></returns> - internal static List<Location> GetLocListEmptyFree(List<string> loc) { - //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => loc.Contains(a.S_CODE) && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0).ToList(); - return list; - - } - - /// <summary> - /// 鍏ュ簱閿佸畾缁堢偣锛屽嚭搴撻攣瀹氳捣鐐�- /// </summary> - /// <param name="loc"></param> - /// <param name="lockState">1:鍏ュ簱閿併�2:鍑哄簱閿併�2:鍏跺畠閿�/param> - /// <returns></returns> - public static bool LockLoc(string loc, int lockState) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var model = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); - if (model != null && model.N_LOCK_STATE == 0) { - model.N_LOCK_STATE = lockState; - model.S_LOCK_STATE = Location.GetLockStateStr(lockState); - res = db.Updateable(model).UpdateColumns(it => new { it.N_LOCK_STATE, it.S_LOCK_STATE }).ExecuteCommand() > 0; - } - return res; - } - - /// <summary> - /// 鍙栬揣瀹岃В閿佽捣鐐癸紝鍗歌揣瀹岃В閿佺粓鐐癸紝鍙楠岄攣鐨勬潵婧愶紝涔熷彲浠ヤ笉鏍¢獙 - /// </summary> - /// <param name="loc"></param> - /// <returns></returns> - public static bool UnLockLoc(string loc) { - LogHelper.Info("UnLockLoc:" + loc); - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var model = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); - if (model != null) { - model.N_LOCK_STATE = 0; - model.S_LOCK_STATE = Location.GetLockStateStr(model.N_LOCK_STATE); - res = db.Updateable(model).UpdateColumns(it => new { it.N_LOCK_STATE, it.S_LOCK_STATE }).ExecuteCommand() > 0; - LogHelper.Info("UnLockLoc:瑙i攣缁撴灉" + res); - } - else { - LogHelper.Info("UnLockLoc 澶辫触"); - } - return res; - } - - /// <summary> - /// 鍒犻櫎璐т綅瀹瑰櫒琛ㄨ褰�淇敼璐т綅瀹瑰櫒鏁伴噺 - /// </summary> - /// <param name="loc"></param> - /// <returns></returns> - public static bool UnBindingLoc(string loc) - { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var location = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); - try - { - db.BeginTran(); - var count = db.Deleteable<LocCntrRel>().Where(it => it.S_LOC_CODE.Trim() == loc).ExecuteCommand(); - location.N_CURRENT_NUM = 0; - location.N_LOCK_STATE = 0; - location.S_LOCK_STATE = Location.GetLockStateStr(location.N_LOCK_STATE); - db.Updateable(location).UpdateColumns(it => new { it.N_CURRENT_NUM, it.N_LOCK_STATE, it.S_LOCK_STATE }).ExecuteCommand(); - db.CommitTran(); - res = true; - } - catch (Exception ex) - { - db.RollbackTran(); - } - return res; - } - - /// <summary> - /// 鍒犻櫎璐т綅瀹瑰櫒琛ㄨ褰�淇敼璐т綅瀹瑰櫒鏁伴噺 - /// </summary> - /// <param name="loc"></param> - /// <param name="cntrs"></param> - /// <returns></returns> - public static bool UnBindingLoc(string loc, List<string> cntrs) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var location = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); - try { - db.BeginTran(); - var lcrList = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc).ToList(); - if (lcrList.Count > 0) { - var count = db.Deleteable<LocCntrRel>().Where(it => cntrs.Contains(it.S_CNTR_CODE.Trim()) && it.S_LOC_CODE.Trim() == loc).ExecuteCommand(); - location.N_CURRENT_NUM = lcrList.Count - count; - location.N_LOCK_STATE = 0; - location.S_LOCK_STATE = Location.GetLockStateStr(location.N_LOCK_STATE); - db.Updateable(location).UpdateColumns(it => new { it.N_CURRENT_NUM, it.N_LOCK_STATE, it.S_LOCK_STATE }).ExecuteCommand(); - } - db.CommitTran(); - res = true; - } - catch (Exception ex) { - db.RollbackTran(); - } - return res; - } - /// <summary> - /// 璐т綅缁戝畾瀹瑰櫒 - /// </summary> - /// <param name="loc"></param> - /// <param name="cntrs"></param> - /// <returns></returns> - public static bool BindingLoc(string loc, List<string> cntrs) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - var location = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); - try { - var lcrList = db.Queryable<LocCntrRel>().Includes(a => a.Container).Where(a => a.S_LOC_CODE.Trim() == loc).ToList(); - db.BeginTran(); - int count = 0; - cntrs.ForEach(a => { - if (lcrList.Count(b => b.S_CNTR_CODE.Trim() == a) == 0) { - db.Insertable<LocCntrRel>(new LocCntrRel { S_LOC_CODE = loc, S_CNTR_CODE = a }).ExecuteCommand(); - count++; - } - }); - location.N_CURRENT_NUM = lcrList.Count + count; - location.N_LOCK_STATE = 0; - location.S_LOCK_STATE = Location.GetLockStateStr(location.N_LOCK_STATE); - - res = db.Updateable(location).UpdateColumns(it => new { it.N_CURRENT_NUM, it.N_LOCK_STATE, it.S_LOCK_STATE }).ExecuteCommand() > 0; - db.CommitTran(); - res = true; - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - db.RollbackTran(); - } - return res; - } - - /// <summary> - /// 鍒ゆ柇閫昏緫搴撳尯鏄惁鏈夊彲鐢ㄨ揣浣�- /// </summary> - /// <param name="zone"></param> - /// <exception cref="NotImplementedException"></exception> - internal static bool CheckZoneFree(string zone) { - var db = new SqlHelper<object>().GetInstance(); - var count = db.Queryable<ZoneLoc>().Includes(a => a.Loc).Where(a => a.S_ZONE_CODE == zone && a.Loc.N_LOCK_STATE == 0).Count(); - return count > 0; - } - internal static ZoneLoc GetZoneLoc(string zone) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<ZoneLoc>().Includes(a => a.Loc).Where(a => a.S_ZONE_CODE == zone && a.Loc.N_LOCK_STATE == 0 && a.Loc.N_CURRENT_NUM == 0).First(); - - } - internal static List<ZoneLoc> GetZoneByLoc(string loc) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<ZoneLoc>().Where(a => a.S_LOC_CODE == loc).ToList(); - - } - - internal static object GetFunctionCodeByArea(string v1, int v2, int v3) { - throw new NotImplementedException(); - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/SYSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/SYSHelper.cs deleted file mode 100644 index 46fa3ee..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/SYSHelper.cs +++ /dev/null @@ -1,44 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.util; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.wms -{ - internal class SYSHelper - { - private static object locker = new object(); - internal static int GetSerialNumber(string snType, string prefix) { - int result = 0; - lock (locker) { - var db = new SqlHelper<object>().GetInstance(); - var sId = db.Queryable<OI_SYS_MAXID>().Where(a => a.CN_S_TYPE.Trim() == snType && a.CN_S_PRE.Trim() == prefix).First(); - if (sId != null) { - sId.CN_N_MAX++; - if (db.Ado.ExecuteCommand($"update OI_SYS_MAXID set CN_N_MAX={sId.CN_N_MAX} where CN_S_TYPE='{snType}' and CN_S_PRE='{prefix}' ") > 0) { - result = sId.CN_N_MAX; - } - } - else { - //鎻掑叆琛�- sId = new OI_SYS_MAXID { CN_S_TYPE = snType, CN_S_PRE = prefix, CN_N_MAX = 1 }; - result = db.Insertable<OI_SYS_MAXID>(sId).ExecuteCommand() > 0 ? 1 : 0; - - } - } - return result; - } - - [SugarTable("OI_SYS_MAXID")] - public class OI_SYS_MAXID - { - public string CN_S_APP_TYPE { get; set; } = "MOBOX"; - public string CN_S_TYPE { get; set; } - public string CN_S_PRE { get; set; } - public int CN_N_MAX { get; set; } - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/TEST.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/TEST.cs deleted file mode 100644 index 5c25b26..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/TEST.cs +++ /dev/null @@ -1,237 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.util; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography; - -namespace HH.WCS.Mobox3.FJJT.wms -{ - /// <summary> - /// 瀵嗛泦鍨嬪簱鍖�- /// </summary> - internal class TEST - { - static TEST() { - //InitRowLockTable(new List<string> { "PGKQ", "PGKTK" }); - } - - /// <summary> - /// 鏍规嵁搴撳尯鍜岀墿鏂欒幏鍙栧叆搴撶殑璐т綅锛堝爢鍙犲厛鑰冭檻鏍囧噯鐨勶紝瀹归噺閮芥槸涓�牱鐨勶紝渚嬪鍧囧窞閮芥槸3+3锛涗笉鑰冭檻宄ㄧ湁灞遍潪鏍�+2鍜�+1鍚屾椂瀛樺湪锛�- /// </summary> - /// <param name="area"></param> - /// <param name="itemCode">濡傛灉itemCode鏄┖琛ㄧず绌哄鍣�/param> - /// <param name="standardCarryQty">鏍囧噯鎼繍鏁伴噺</param> - /// <returns></returns> - public static Location GetTN_Location4In(string area, string itemCode, string itemBatch, int standardCarryQty = 1) { - Location result = null; - - try { - //1.0 鑾峰彇姣忎竴鎺掓渶澶х殑鍒�- //1.1 鍒ゆ柇褰撳墠鏁伴噺鏄笉鏄弧鐨勶紝濡傛灉鏄弧鐨勫苟涓旀槸鏈�ぇ鍒楋紝闇�鎺掗櫎 - var listMaxCol = new SqlHelper<Location>().GetInstance().Queryable<Location>().Where(a => a.S_AREA_CODE == area).OrderByDescending(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList(); - - //1.1 鏌ュ埌鎵�湁鏈夊鍣ㄧ殑鎺� - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM > 0 && a.S_AREA_CODE == area).Includes(a => a.LocCntrRel, a => a.CntrItemRels).OrderByDescending(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList(); - if (list.Count > 0) { - for (int i = list.Count - 1; i >= 0; i--) { - //鎺掗櫎宸茬粡閿佸畾鐨勮揣浣�鍜�鏀炬弧浜嗕笖鏄渶澶у垪鐨勮揣浣�- //鍏跺畠椤圭洰杩橀渶瑕佹煡璇㈡帓閿�- if (list[i].N_LOCK_STATE== 0 || (list[i].N_CURRENT_NUM == list[i].N_CAPACITY && listMaxCol.Count(a => a.S_CODE == list[i].S_CODE) > 0)) { - list.Remove(list[i]); - } - } - if (list.Count > 0) { - //1.21 鍔犺浇璐т綅鐨勫鍣ㄤ俊鎭�(mapper涔嬪墠鍙兘鏄煡璇㈠師濮嬫暟鎹紝濡傛灉鏈夊叾浠栨煡璇�mapper澶辨晥) - #region MyRegion - /* - Console.WriteLine("鍔犺浇璐т綅鐨勫鍣ㄤ俊鎭�); - db.ThenMapper(list, loc => { - loc.LocCntrRel = db.Queryable<LocCntrRel>().SetContext(x => x.S_LOC_CODE, () => loc.S_LOC_CODE, loc).FirstOrDefault(); - }); - - //1.22 鍔犺浇瀹瑰櫒鐨勭墿鏂欎俊鎭�- Console.WriteLine("鍔犺浇瀹瑰櫒鐨勭墿鏂欎俊鎭�); - db.ThenMapper(list.Select(loc => loc.LocCntrRel), lcr => { - lcr.CntrItemRel = db.Queryable<CntrItemRel>().SetContext(x => x.S_CNTR_CODE, () => lcr.S_CNTR_CODE, lcr).FirstOrDefault(); - }); - */ - #endregion - //1.3 閬嶅巻鍒ゆ柇鐗╂枡绫诲瀷鏄惁鐩稿悓 - for (int i = 0; i < list.Count; i++) { - - //todo 杩橀渶瑕佸垽鏂攣 - - #region 绌哄鍣ㄦ垨鑰呮弧瀹瑰櫒鍒ゆ柇 ,濡傛灉鏄┖瀹瑰櫒 瀹瑰櫒鐗╂枡淇℃伅涓虹┖ - if (list[i].LocCntrRel != null) { - //LogHelper.Info("itemCode=" + itemCode); - if ((itemCode != null && list[i].LocCntrRel.CntrItemRels != null && list[i].LocCntrRel.CntrItemRels[0].S_ITEM_CODE.Trim() == itemCode && list[i].LocCntrRel.CntrItemRels[0].S_BATCH_NO.Trim() == itemBatch.Trim()) || (itemCode == null && list[i].LocCntrRel.CntrItemRels == null)) { - if (list[i].N_CURRENT_NUM < list[i].N_CAPACITY) { - //1.31 濡傛灉鎼繍鏁伴噺=1 - //1.32 鎼繍澶氫釜瀹瑰櫒锛屼緥濡�+3妯″紡 锛屽繀椤诲綋鍓嶆暟閲�0鎴�;濡傛灉鏄�+3+锛屽繀椤诲綋鍓嶆暟閲�0鎴�鎴� - if (list[i].N_CURRENT_NUM % standardCarryQty == 0) { - result = list[i]; - } - else { - //1.33 涓嶆弧瓒冲垯閫夋嫨鍚庝竴鍒楋紝鍚庝竴鍒楄偗瀹氭槸绌鸿揣浣�- result = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL).OrderBy(a => a.N_COL).First(); - } - - } - else { - //褰撳墠璐т綅婊′簡锛屾瘮浠朿ol澶т竴浣嶇殑璐т綅锛屽悗涓�垪鑲畾鏄┖璐т綅 - result = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL).OrderBy(a => a.N_COL).First(); - } - - if (result != null) { - break; - } - } - } - else { - LogHelper.Info("璐т綅瀹瑰櫒鐗╂枡淇℃伅涓虹┖"); - } - - - #endregion - - } - } - } - if (result == null) { - //todo 杩橀渶瑕佸垽鏂攣 - #region 鏌ユ壘鎵�湁鏁伴噺鏄┖鐨勬帓 - //2.0 绠�寲鏌ヨ鍙煡姣忎竴鎺掔涓�垪 - list = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area).OrderBy(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList().Where(a => a.N_CURRENT_NUM == 0).ToList(); - //2.1 閫変竴涓┖鎺�- for (int i = 0; i < list.Count; i++) { - if (list[i].N_LOCK_STATE== 0) { - //浜屾鏍¢獙褰撳墠鎺掓墍鏈夎揣浣嶉兘鏄┖鐨勶紝闃叉绯荤粺鏁版嵁閿欎贡 - var rowSumInfo = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == list[i].N_ROW).Select(a => new { sum = SqlFunc.AggregateSum(a.N_CURRENT_NUM) }).First(); - if (rowSumInfo.sum == 0) { - result = list[i]; - break; - } - } - - } - #endregion - } - } - catch (Exception ex) { - - Console.WriteLine("GetTN_Location4In:" + ex.Message + ex.StackTrace); - LogHelper.Error("GetTN_Location4In:" + ex.Message, ex); - } - return result; - } - - /// <summary> - /// 鏍规嵁搴撳尯鍜岀墿鏂欒幏鍙栧嚭搴撶殑璐т綅锛堝爢鍙犲厛鑰冭檻鏍囧噯鐨勶紝瀹归噺閮芥槸涓�牱鐨勶紝渚嬪鍧囧窞閮芥槸3+3锛涗笉鑰冭檻宄ㄧ湁灞遍潪鏍�+2鍜�+1鍚屾椂瀛樺湪锛�- /// </summary> - /// <param name="area"></param> - /// <param name="itemCode">濡傛灉itemCode鏄┖琛ㄧず绌哄鍣�/param> - /// <param name="standardCarryQty">鏍囧噯鎼繍鏁伴噺</param> - /// <returns></returns> - /// <returns></returns> - public static Location GetTN_Location4Out(string area, string itemCode, string itemBatch, int standardCarryQty = 1) { - Console.WriteLine($"area={area}"); - Location result = null; - var db = new SqlHelper<Location>().GetInstance(); - - //1.0 鏌ュ埌鎵�湁鏈夊鍣ㄧ殑鎺�var list = db.Queryable<TN_Location>().Where(a => a.N_CURRENT_NUM>0).Includes(a => a.LocCntrRel, a => a.CntrItemRel).ToList(); - var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM > 0 && a.S_AREA_CODE == area).Includes(a => a.LocCntrRel, a => a.CntrItemRels).OrderByDescending(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList(); - //1.1 鍒ゆ柇褰撳墠鏁伴噺鏄笉鏄弧鐨勶紝濡傛灉鏄弧鐨勫苟涓旀槸鏈�ぇ鍒楋紝闇�鎺掗櫎 - if (list.Count > 0) { - //LogHelper.Info("GetTN_Location4Out:" + JsonConvert.SerializeObject(list)); - #region MyRegion - /* - //1.21 鍔犺浇璐т綅鐨勫鍣ㄤ俊鎭�- db.ThenMapper(list, loc => { - loc.LocCntrRel = db.Queryable<LocCntrRel>().SetContext(x => x.S_LOC_CODE, () => loc.S_LOC_CODE, loc).FirstOrDefault(); - }); - //1.22 鍔犺浇瀹瑰櫒鐨勭墿鏂欎俊鎭�- db.ThenMapper(list.Select(loc => loc.LocCntrRel), lcr => { - lcr.CntrItemRel = db.Queryable<CntrItemRel>().SetContext(x => x.S_CNTR_CODE, () => lcr.S_CNTR_CODE, lcr).FirstOrDefault(); - }); - */ - #endregion - //1.3 閬嶅巻鍒ゆ柇鐗╂枡绫诲瀷鏄惁鐩稿悓 - for (int i = 0; i < list.Count; i++) { - - //todo 杩橀渶瑕佸垽鏂攣 - - #region 绌哄鍣ㄦ垨鑰呮弧瀹瑰櫒鍒ゆ柇 ,濡傛灉鏄┖瀹瑰櫒 瀹瑰櫒鐗╂枡淇℃伅涓虹┖ - if (list[i].N_LOCK_STATE== 0 && list[i].LocCntrRel != null) { - if ((itemCode != null && list[i].LocCntrRel.CntrItemRels != null && list[i].LocCntrRel.CntrItemRels[0].S_ITEM_CODE.Trim() == itemCode && (itemBatch == null || list[i].LocCntrRel.CntrItemRels[0].S_BATCH_NO.Trim() == itemBatch.Trim())) || (itemCode == null && list[i].LocCntrRel.CntrItemRels == null)) { - //鎼繍閫夋嫨璐т綅 - //濡傛灉褰撳墠鍑哄簱浣嶅悗闈㈡湁绌轰綅锛屼笉鑳芥槸鍏ュ簱涓�- var after = new SqlHelper<Location>().Get(a => a.S_AREA_CODE == area && a.N_ROW == list[i].N_ROW && a.N_COL == list[i].N_COL + 1); - if (after == null || after.N_LOCK_STATE== 0) { - result = list[i]; - } - if (result != null) { - break; - } - } - } - - - #endregion - - } - } - - return result; - } - - - private static List<int> GetRowsByArea(string area) { - var list = new SqlHelper<Location>().GetInstance().Queryable<Location>().Where(a => a.S_AREA_CODE == area).Distinct().Select(a => a.N_ROW).ToList(); - return list; - } - internal static void Test() { - //UnLockLoc("PGKQ-02-02"); - //LockLoc("PGKQ-02-02", "鍏ュ簱閿�); - //Binding("PGKQ-02-03", "AAA", "", 3); - //UnBinding("PGKQ-02-03", 2); - - //var full = GetTN_Location4In("PGKQ", "AAA"); - //var empty = GetTN_Location4In("PGKQ", null); - //var fullOut = GetTN_Location4Out("PGKQ", "AAA"); - //var emptyOut = GetTN_Location4Out("PGKQ", null); - //var TN_Locations = new SqlHelper<TN_Location>().GetList(); - //var LocCntrRels = new SqlHelper<LocCntrRel>().GetList(); - //var CntrItemRels = new SqlHelper<CntrItemRel>().GetList(); - - //var list = new SqlHelper<TN_Location>().GetInstance().Queryable<TN_Location>().LeftJoin<LocCntrRel>((l, lc) => l.S_LOC_CODE == lc.S_LOC_CODE).ToList(); - //var results = context.Client.Queryable<Employee>().Mapper(t=>t.Person, p=>p.PersonId).ToList(); - var db = new SqlHelper<object>().GetInstance(); - - //var list = db.Queryable<TN_Location>().Mapper(l => l.LocCntrRel, lcr => lcr.S_LOC_CODE).Where(a=>a.S_LOC_CODE== "PGKQ-01-01").ToList(); - - //澶氱骇鏌ヨ浼氬祵濂�闇�鎸囧畾瀵艰埅灞炴�鍜屼富閿紝寰幆宓屽鏌ヨ涓嶅缓璁�- //[Navigate(NavigateType.OneToOne, nameof(S_LOC_CODE))]銆�[Navigate(NavigateType.OneToOne, nameof(S_CNTR_CODE))]銆乕SugarColumn(IsPrimaryKey = true)] - var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM > 0).Includes(a => a.LocCntrRel, a => a.CntrItemRels).ToList(); - - - - #region MyRegion - /* - // SetContext涓嶄細鐢熸垚寰幆鎿嶄綔锛岄珮鎬ц兘 鍜岀洿鎺here鎬ц兘鏄笉涓�牱鐨�- var list = db.Queryable<TN_Location>().Where(a => a.N_CURRENT_NUM > 0).ToList(); - //绗竴灞�- db.ThenMapper(list, loc => { - loc.LocCntrRel = db.Queryable<LocCntrRel>().SetContext(x => x.S_LOC_CODE, () => loc.S_LOC_CODE, loc).FirstOrDefault(); - }); - //绗簩灞�- db.ThenMapper(list.Select(loc => loc.LocCntrRel), lcr => { - lcr.CntrItemRel = db.Queryable<CntrItemRel>().SetContext(x => x.S_CNTR_CODE, () => lcr.S_CNTR_CODE, lcr).FirstOrDefault(); - }); - */ - #endregion - } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/WCSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/WCSHelper.cs deleted file mode 100644 index 4d19c85..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/WCSHelper.cs +++ /dev/null @@ -1,233 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJT.util; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HH.WCS.Mobox3.FJJT.wms -{ - internal class WCSHelper - { - internal static string GenerateTaskNo() { - var id = SYSHelper.GetSerialNumber("浠诲姟鍙�, "TN"); - var date = DateTime.Now.ToString("yyMMdd"); - return $"TN{date}{id.ToString().PadLeft(4, '0')}"; - } - internal static bool UpdateStatus(WCSTask task, string status) { - var res = false; - var db = new SqlHelper<WCSTask>().GetInstance(); - task.S_B_STATE = status; - db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE }).ExecuteCommand(); - return res; - } - internal static bool UpdateWcsTask(WCSTask task) - { - var res = false; - var db = new SqlHelper<WCSTask>().GetInstance(); - res = db.Updateable(task).ExecuteCommand() > 0; - return res; - } - internal static bool UpdateStatus(WCSTask task) { - var res = false; - var db = new SqlHelper<WCSTask>().GetInstance(); - task.S_B_STATE = WCSTask.GetStateStr(task.N_B_STATE); - task.T_MODIFY = DateTime.Now; - db.Updateable(task).UpdateColumns(it => new {it.N_B_STATE, it.S_B_STATE,it.T_MODIFY }).ExecuteCommand(); - return res; - } - internal static bool UpdateEndLoc(WCSTask task) - { - var res = false; - var db = new SqlHelper<WCSTask>().GetInstance(); - task.T_MODIFY = DateTime.Now; - db.Updateable(task).UpdateColumns(it => new { it.S_END_LOC,it.S_END_AREA,it.S_TYPE, it.T_MODIFY }).ExecuteCommand(); - return res; - } - - internal static bool CancelPreCreateTask(string wmsTaskNo) - { - var db = new SqlHelper<WCSTask>().GetInstance(); - return db.Updateable<WCSTask>().SetColumns(it => new WCSTask() { N_B_STATE = 4 ,S_B_STATE = "鍙栨秷"}).Where(a => a.S_OP_CODE.Trim() == wmsTaskNo && a.N_B_STATE == -1).ExecuteCommand() > 0; - } - - /// <summary> - /// 婵�椿棰勫垱寤轰换鍔�- /// </summary> - /// <param name="wmsTaskNo"></param> - /// <param name="anomaly"> 0.闈炲紓甯�1.寮傚父</param> - /// <returns></returns> - internal static bool ActivatePreCreateTask(string wmsTaskNo ,int anomaly = 0) - { - var db = new SqlHelper<WCSTask>().GetInstance(); - var updateable = db.Updateable<WCSTask>() - .SetColumns(it => new WCSTask() { N_B_STATE = 0, S_B_STATE = "绛夊緟" }). - Where(a => a.S_OP_CODE.Trim() == wmsTaskNo - && a.N_B_STATE == -1 - ); - if (anomaly == 1) - { - updateable = updateable.Where(a => a.S_TYPE.Contains("銆愬紓甯搞�")); - } - else - { - updateable = updateable.Where(a => !a.S_TYPE.Contains("銆愬紓甯搞�")); - } - return updateable.ExecuteCommand() > 0; - } - - - internal static bool UpdateInfo(WCSTask task, string sourceNo, string endBit, string status) { - var res = false; - var db = new SqlHelper<WCSTask>().GetInstance(); - task.S_B_STATE = status; - task.S_OP_CODE = sourceNo; - task.S_END_LOC = endBit; - db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE, it.S_OP_CODE, it.S_END_LOC }).ExecuteCommand(); - return res; - } - internal static WCSTask GetTask(string no) { - var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_CODE.Trim() == no).First(); - return task; - } - internal static WCSTask GetTaskBySrcNo(string no) { - var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_OP_CODE== no).First(); - return task; - } - internal static WCSTask GetPreCreatedTaskByCntr(string cntrCode) - { - var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_CNTR_CODE.Trim() == cntrCode && a.N_B_STATE == -1).OrderByDescending(a => a.T_CREATE).First(); - return task; - } - internal static List<WCSTask> GetTaskListBySrcNo(string no) - { - var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_OP_CODE.Trim() == no).ToList(); - return task; - } - internal static List<WCSTask> GetTaskByStart(string bit) { - var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_START_LOC == bit.Trim()).ToList(); - return task; - } - internal static List<WCSTask> GetTaskByEnd(string bit) { - var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_END_LOC.Trim() == bit.Trim()).ToList(); - return task; - } - internal static List<WCSTask> GetTaskByStartOrEnd(string bit) - { - var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => (a.S_START_LOC == bit.Trim() || a.S_END_LOC == bit.Trim()) && a.N_B_STATE < 3 ).ToList(); - return task; - } - internal static List<WCSTask> GetTaskByType(string taskType) { - var db = new SqlHelper<WCSTask>().GetInstance(); - return db.Queryable<WCSTask>().Where(a => a.S_TYPE.Trim() == taskType).ToList(); - } - internal static bool CheckExist(string no) { - return GetTask(no.Trim())!=null; - } - internal static bool UpdateStatus(string no, string status) { - var res = false; - var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_CODE.Trim() == no).First(); - if (task != null) { - task.S_B_STATE = status; - //闇�鍒ゆ柇浠诲姟鏄惁澶辫触鎴栬�宸插畬鎴愶紝涓嶅厑璁稿啀淇敼 - res = db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE }).ExecuteCommand() > 0; - } - return res; - } - internal static bool AddActionRecord(string no, int state, string forkliftNo, string extData) { - var db = new SqlHelper<TaskAction>().GetInstance(); - var action = new TaskAction() { - N_ACTION_CODE = state, - S_TASK_CODE = no, - S_EQ_CODE = forkliftNo, - S_EQ_TYPE = "agv", - S_DATA = extData - }; - return db.Insertable(action).ExecuteCommand() > 0; - } - internal static bool CheckActionRecordExist(string no, int code) { - var db = new SqlHelper<TaskAction>().GetInstance(); - return db.Queryable<TaskAction>().Count(a => a.S_TASK_CODE == no.Trim() && a.N_ACTION_CODE == code) > 0; - } - - internal static TaskAction getActionRecord(string no, int code) - { - var db = new SqlHelper<TaskAction>().GetInstance(); - return db.Queryable<TaskAction>().Where(a => a.S_TASK_CODE == no.Trim() && a.N_ACTION_CODE == code).First(); - } - - internal static bool updateActionRecord(TaskAction taskAction) - { - var db = new SqlHelper<TaskAction>().GetInstance(); - return db.Updateable(taskAction).ExecuteCommand()>0; - } - - internal static void Begin(WCSTask task) { - var db = new SqlHelper<WCSTask>().GetInstance(); - if (task != null) { - if (task.S_B_STATE.Trim() == "宸叉帹閫�) { - task.S_B_STATE = "鎵ц涓�; - task.N_B_STATE = 2; - task.T_START_TIME = DateTime.Now; - db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE,it.N_B_STATE, it.T_START_TIME }).ExecuteCommand(); - } - - } - } - internal static void End(WCSTask task) { - var db = new SqlHelper<WCSTask>().GetInstance(); - if (task != null) { - task.S_B_STATE = "瀹屾垚"; - task.N_B_STATE = 3; - task.T_END_TIME = DateTime.Now; - db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE, it.N_B_STATE ,it.T_END_TIME }).ExecuteCommand(); - } - } - internal static void Fail(WCSTask task) { - var db = new SqlHelper<WCSTask>().GetInstance(); - if (task != null) { - //鍒ゆ柇鏈夋病鏈夊彇璐у畬鎴愶紝娌℃湁灏卞彉鎴愬け璐ャ�鏈夊彇璐у畬鎴愰粯璁ゅ畬鎴愪簡锛堣窡鎹」鐩�瀹氾紝鏈変簺椤圭洰浜哄伐鎷夎蛋浜嗕篃娌℃湁鏀惧埌缁堢偣锛夈� - task.S_B_STATE = "澶辫触"; - db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE }).ExecuteCommand(); - } - } - internal static bool CreateTask(WCSTask TN_Task) { - try { - var db = new SqlHelper<WCSTask>().GetInstance(); - return db.Insertable(TN_Task).ExecuteCommand() > 0; - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - throw; - } - - } - - /// <summary> - /// 鏍规嵁浠诲姟鐘舵�鑾峰彇浠诲姟 - /// </summary> - /// <param name="state"></param> - /// <returns></returns> - internal static List<WCSTask> GetTaskListByState(string state) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WCSTask>().Where(a => a.S_B_STATE.Trim() == state).ToList(); - - } - internal static List<WCSTask> GetTaskListByState(int state) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WCSTask>().Where(a => a.N_B_STATE == state).ToList(); - } - internal static List<WCSTask> GetWaitingTaskList() { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WCSTask>().Where(a => a.N_B_STATE == 0).ToList(); - } - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/WMSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/WMSHelper.cs deleted file mode 100644 index 2f82ac0..0000000 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/wms/WMSHelper.cs +++ /dev/null @@ -1,941 +0,0 @@ -锘縰sing HH.WCS.Mobox3.FJJF.models; -using HH.WCS.Mobox3.FJJT.models; -using HH.WCS.Mobox3.FJJT.models.other; -using HH.WCS.Mobox3.FJJT.util; -using Newtonsoft.Json; -using NLog.Fluent; -using SqlSugar; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using System.Runtime.ConstrainedExecution; -using System.Threading.Tasks; -using System.Web.UI.WebControls; -using static HH.WCS.Mobox3.FJJT.api.ApiModel; -using static HH.WCS.Mobox3.FJJT.util.Settings; - -namespace HH.WCS.Mobox3.FJJT.wms { - /// <summary> - /// wms绠″埌浣滀笟 - /// </summary> - internal class WMSHelper { - internal static string GenerateTaskNo() { - var id = SYSHelper.GetSerialNumber("浣滀笟鍙�, "OP"); - var date = DateTime.Now.ToString("yyMMdd"); - return $"OP{date}{id.ToString().PadLeft(4, '0')}"; - } - internal static string GenerateSortingNo() { - var id = SYSHelper.GetSerialNumber("鍒嗘嫞鍗�, "SO"); - var date = DateTime.Now.ToString("yyMMdd"); - return $"SO{date}{id.ToString().PadLeft(4, '0')}"; - } - - internal static string GenerateAlarmNo() - { - var id = SYSHelper.GetSerialNumber("鎶ヨ璁板綍鍗�, "AL"); - var date = DateTime.Now.ToString("yyMMdd"); - return $"AL{date}{id.ToString().PadLeft(4, '0')}"; - } - internal static string GenerateTempCntrNo() - { - var id = SYSHelper.GetSerialNumber("涓存椂瀹瑰櫒鍙�, "CN"); - var date = DateTime.Now.ToString("yyMMdd"); - return $"CN{date}{id.ToString().PadLeft(4, '0')}"; - } - internal static List<WMSTask> GetOperationListByState(string state) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WMSTask>().Where(a => a.S_B_STATE == state && a.S_FACTORY == Settings.FacCode).ToList(); - } - internal static List<WMSTask> GetOperationListByState(int state) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WMSTask>().Where(a => a.N_B_STATE == state && a.S_FACTORY == Settings.FacCode).ToList(); - } - internal static List<WMSTask> GetWaitingOperationList() { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WMSTask>().Where(a => (a.N_B_STATE == 0 || a.N_B_STATE == 3) && a.S_FACTORY == Settings.FacCode).ToList(); - } - - internal static bool CreateWmsTask(WMSTask wmsTask) { - try { - var db = new SqlHelper<object>().GetInstance(); - return db.Insertable<WMSTask>(wmsTask).ExecuteCommand() > 0; - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - throw; - } - } - - internal static bool DeleteWmsTask(string code) - { - try - { - var db = new SqlHelper<object>().GetInstance(); - return db.Deleteable<WMSTask>().Where(a => a.S_CODE == code).ExecuteCommand() > 0; - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - throw; - } - } - - internal static WMSTask GetAwaitWmsTaskByMaterialCode(string materialCode) { - WMSTask wmsTask = null; - var db = new SqlHelper<object>().GetInstance(); - var wmsTaskList = db.Queryable<WMSTask>() - .LeftJoin<CntrItemRel>((a,b) => a.S_CNTR_CODE == b.S_CNTR_CODE) - .Where((a, b) => a.N_B_STATE == 1 && b.S_ITEM_CODE.Trim() == materialCode && a.S_TYPE.Trim() == "鍙枡鍑哄簱浠诲姟").ToList(); - foreach (var task in wmsTaskList) - { - var result = db.Queryable<WCSTask>().Where(a => a.S_OP_CODE == task.S_CODE && a.N_B_STATE > 0).Count() == 0; - if (result) - { - wmsTask = task; - return wmsTask; - } - } - return wmsTask; - } - - internal static WMSTask GetWmsTaskByCntr(string cntr, bool active = true) - { - WMSTask result = null; - var db = new SqlHelper<object>().GetInstance(); - if (active) - { - result = db.Queryable<WMSTask>().Where(a => a.S_CNTR_CODE.Contains(cntr) && a.N_B_STATE < 2).First(); - } - else - { - result = db.Queryable<WMSTask>().Where(a => a.S_CNTR_CODE.Contains(cntr)).First(); - } - return result; - } - - internal static Location GetEnd(WMSTask a) { - throw new NotImplementedException(); - } - - internal static Location GetStart(WMSTask a) { - throw new NotImplementedException(); - } - - internal static void UpdateTaskState(WMSTask task) { - var db = new SqlHelper<object>().GetInstance(); - task.T_MODIFY = DateTime.Now; - task.S_B_STATE = WMSTask.GetStateStr(task.N_B_STATE); - db.Updateable<WMSTask>(task).UpdateColumns(a => new { a.N_TYPE,a.N_B_STATE, a.S_B_STATE, a.T_MODIFY,a.T_END_TIME }).ExecuteCommand(); - } - - - internal static bool UpdateTaskEnd(WMSTask a) { - var db = new SqlHelper<object>().GetInstance(); - a.T_MODIFY = DateTime.Now; - return db.Updateable<WMSTask>(a).UpdateColumns(it => new { it.S_TYPE,it.S_END_LOC,it.S_END_AREA, it.T_MODIFY }).ExecuteCommand() > 0; - } - - internal static WMSTask GetWmsTask(string code) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WMSTask>().Where(a => a.S_CODE.Trim() == code).First(); - } - - internal static WMSTask GetWmsTaskByEnd(string endLoc) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WMSTask>().Where(a => a.S_END_LOC.Trim() == endLoc && a.N_B_STATE < 2).First(); - } - - internal static WMSTask GetWmsTaskByStart(string startLoc) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<WMSTask>().Where(a => a.S_START_LOC.Trim() == startLoc && a.N_B_STATE < 2).First(); - } - - internal static bool isFinishTask(string wmsTaskNo) - { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - result = db.Queryable<WCSTask>().Where(a => a.S_OP_CODE.Trim() == wmsTaskNo && a.N_B_STATE < 3).Count() == 0; - return result; - } - - /// <summary> - /// - /// </summary> - /// <param name="locCode"></param> - /// <returns></returns> - public static string getReturnMaterialLocCode(string locCode) - { - var db = new SqlHelper<object>().GetInstance(); - var returnMaterialLoc = db.Queryable<SideLocConfig>().Where(a => a.S_LOC_CODE.Trim() == locCode).First(); - if (returnMaterialLoc != null) { - return returnMaterialLoc.S_RETURN_LOC_CODE; - } - return null; - } - // --------------------------------------------------------绂忓缓浣抽�----------------------------------------- - - - /// <summary> - /// 鏌ヨ閫昏緫閰嶇疆琛�- /// </summary> - /// <param name="taskType">浠诲姟绫诲瀷</param> - /// <returns></returns> - internal static List<LogicConfig> getLogicConfigByTaskType(string taskType) - { - var db = new SqlHelper<object>().GetInstance(); - var logicConfigList = db.Queryable<LogicConfig>() - .Where(a => a.S_TASK_TYPE.Trim() == taskType && a.S_ENABLE.Trim() == "鏄�) - .OrderBy(a => a.S_PRI) - .ToList(); - return logicConfigList; - } - - /// <summary> - /// 鏌ヨ閫昏緫閰嶇疆琛�- /// </summary> - /// <param name="hcLocCode">琛ョ┖缂撳瓨浣�/param> - /// <returns></returns> - internal static LogicConfig getLogicConfigByHcLoc(string hcLocCode) - { - var db = new SqlHelper<object>().GetInstance(); - var logicConfig = db.Queryable<LogicConfig>() - .Where(a => a.S_LKBKHCLOC.Trim() == hcLocCode && a.S_ENABLE.Trim() == "鏄�) - .OrderBy(a => a.S_PRI) - .First(); - return logicConfig; - } - - /// <summary> - /// 鏌ヨ閫昏緫閰嶇疆琛�- /// </summary> - /// <param name="mtjbLoc">婊℃枡鎺ラ┏浣�/param> - /// <returns></returns> - internal static LogicConfig getLogicConfigByMtjbLoc(string mtjbLoc) - { - var db = new SqlHelper<object>().GetInstance(); - var logicConfig = db.Queryable<LogicConfig>() - .Where(a => a.S_MTJBLOC.Trim() == mtjbLoc && a.S_ENABLE.Trim() == "鏄�) - .OrderBy(a => a.S_PRI) - .First(); - return logicConfig; - } - - /// <summary> - /// 鏌ヨ閫昏緫閰嶇疆琛�- /// </summary> - /// <param name="jtCode"></param> - /// <returns></returns> - internal static LogicConfig getLogicConfigByJtCode(string jtCode) - { - var db = new SqlHelper<object>().GetInstance(); - var logicConfig = db.Queryable<LogicConfig>() - .Where(a => a.S_JT_CODE.Trim() == jtCode && a.S_ENABLE.Trim() == "鏄�) - .OrderBy(a => a.S_PRI) - .First(); - return logicConfig; - } - - /// <summary> - /// 鏌ヨ鍑哄簱寮�璧风偣 - /// 娉細闇�繃婊ゅ爢鍨涙満鏁呴殰鐨勫贩閬�- /// </summary> - /// <param name="areaCode"></param> - /// <param name="traySatus">0.榛樿銆�.寮傚父</param> - /// <param name="materialCode"></param> - /// <param name="trayCode"></param> - /// <returns></returns> - internal static Location getOutStockStartLoc(string areaCode ,string materialCode,int traySatus = 0, string trayCode = "") - { - Location loc = null; - var db = new SqlHelper<object>().GetInstance(); - - var queryable = db.Queryable<Location>() - .LeftJoin<LocCntrRel>((a, b) => a.S_CODE == b.S_LOC_CODE) - .LeftJoin<Container>((a, b, c) => b.S_CNTR_CODE == c.S_CODE) - .LeftJoin<CntrItemRel>((a, b, c, d) => c.S_CODE == d.S_CNTR_CODE) - .Where((a, b, c, d) => a.N_CURRENT_NUM > 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE.Trim() == "Y" ); - - if (areaCode != null && areaCode != "") - { - queryable = queryable.Where((a, b, c, d ) => a.S_AREA_CODE.Trim() == areaCode); - } - if (traySatus == 0) - { - queryable = queryable.Where((a, b, c, d) => c.N_E_STATE == 0); - } - else if (traySatus == 1) - { - queryable = queryable.Where((a, b, c, d) => c.N_E_STATE != 0); - } - if (materialCode != null && materialCode != "") - { - queryable = queryable.Where((a, b, c, d) => d.S_ITEM_CODE.Trim() == materialCode); - } - else - { - queryable = queryable.Where((a, b, c, d) => d.S_ITEM_CODE == null); - } - if (trayCode != null && trayCode != "") - { - queryable = queryable.Where((a, b, c, d) => b.S_CNTR_CODE.Trim() == trayCode); - } - - loc = queryable.OrderBy((a, b, c, d) => d.T_INBOUND_TIME).First(); - return loc; - } - - /// <summary> - /// 鏌ヨ鍏ュ簱缁堢偣璐т綅 - /// </summary> - /// <param name="areaCode"></param> - /// <param name="trayStatus">0.绌鸿溅 1.婊¤溅 </param> - /// <param name="trayType"></param> - /// <returns></returns> - internal static Location getInStockEndLoc(string areaCode,int trayStatus, int trayType = 0) - { - LogHelper.Info("寮�鏌ヨ绔嬪簱缁堢偣璐т綅", "WMS"); - Location location = null; - var db = new SqlHelper<object>().GetInstance(); - try - { - string S_ZONE_CLS_CODE = ""; - if (trayStatus == 0) - { - S_ZONE_CLS_CODE = "KGZ"; - } - else if (trayStatus == 1) - { - S_ZONE_CLS_CODE = "ML"; - } - - if (areaCode == null) - { - if (trayType != 0) - { - // 鏍规嵁鎵樼洏绫诲瀷鏌ヨ瀵瑰簲鐨勭珛搴撶紪鐮�- List<string> areaCodes = Settings.getCntrAreaList(trayType); - LogHelper.Info($"鎵樼洏绫诲瀷瀵瑰簲鐨勫簱鍖猴細{JsonConvert.SerializeObject(areaCodes)}", "WMS"); - - // 璁$畻绔嬪簱鐨勫绉巼锛屽彇瀹圭Н鐜囨渶澶х殑搴撳尯 - var areaList = db.Queryable<Location>() - .LeftJoin<ZoneLoc>((a, b) => a.S_CODE == b.S_LOC_CODE) - .LeftJoin<Zone>((a, b, c) => b.S_ZONE_CODE == c.S_CODE) - .Where((a, b, c) => areaCodes.Contains(a.S_AREA_CODE.Trim()) && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y" && c.S_ZONE_CLS_CODE.Trim() == S_ZONE_CLS_CODE) - .GroupBy((a, b, c) => a.S_AREA_CODE) - .Select((a, b, c) => new - { - S_AREA_CODE = a.S_AREA_CODE, - num = SqlFunc.AggregateCount(a.S_CODE) - }) - .MergeTable() - .OrderByDescending(s => s.num) - .ToList(); - LogHelper.Info($"鎸夊绉巼鎺掑簭鐨勫簱鍖猴細{JsonConvert.SerializeObject(areaList)}", "WMS"); - - foreach (var item in areaList) - { - location = db.Queryable<Location>() - .LeftJoin<ZoneLoc>((a, b) => a.S_CODE == b.S_LOC_CODE) - .LeftJoin<Zone>((a, b, c) => b.S_ZONE_CODE == c.S_CODE) - .Where((a, b, c) => a.S_AREA_CODE.Trim() == item.S_AREA_CODE.Trim() && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y" && c.S_ZONE_CLS_CODE.Trim() == S_ZONE_CLS_CODE) - .OrderBy((a, b, c) => a.N_LAYER) - .First(); - if (location != null) - { - return location; - } - } - } - - // 搴撳尯瀹夊叏搴撳瓨鐩戞祴锛屽苟鎶ヨ - /* var safety_Inventory = getSafetyInventory(areaCode,null, trayType.ToString()); - if (safety_Inventory != null) - { - - }*/ - } - else - { - location = db.Queryable<Location>() - .LeftJoin<ZoneLoc>((a, b) => a.S_CODE == b.S_LOC_CODE) - .LeftJoin<Zone>((a, b, c) => b.S_ZONE_CODE == c.S_CODE) - .Where((a, b, c) => a.S_AREA_CODE.Trim() == areaCode && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y" && c.S_ZONE_CLS_CODE == S_ZONE_CLS_CODE) - .OrderBy((a, b, c) => a.N_LAYER) - .First(); - } - LogHelper.Info($"鏌ヨ缁撴潫,绔嬪簱缁堢偣璐т綅:{location}","WMS"); - } - catch (Exception ex) - { - LogHelper.Info($"WMS鍐呴儴閿欒:鏌ヨ鍏ュ簱缁堢偣璐т綅(getInStockEndLoc)閿欒,閿欒鍘熷洜锛歿ex.Message}", "WMS"); - throw ex; - } - return location; - } - - public static bool addAlarmRecord(string alarmType , string alarmLevel ,string alarmMsg ,string logSite = "WMS") { - var db = new SqlHelper<object>().GetInstance(); - LogHelper.Info(alarmMsg, logSite); - AlarmRecord alarmRecord = new AlarmRecord() { - S_ALARM_CODE = GenerateAlarmNo(), - S_ALARM_TYPE = alarmType, - S_ALARM_LEVEL = alarmLevel, - S_ALARM_MSG = alarmMsg, - S_FILE_NAME = logSite, - }; - return db.Insertable<AlarmRecord>(alarmRecord).ExecuteCommand()>0; - } - - /// <summary> - /// 鏌ヨ鎴愬瀷鏈虹嚎杈�- /// </summary> - /// <param name="locCode"></param> - /// <returns></returns> - public static SideLocConfig GetLineSideLoc(string locCode) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<SideLocConfig>().Where(a => a.S_LOC_CODE.Trim() == locCode).First(); - } - - /// <summary> - /// 鑾峰彇寮傚父搴撹揣浣�- /// </summary> - /// <param name="areaCode"></param> - /// <returns></returns> - public static Location getAbnormalAreaLoc(string areaCode) - { - Location loc = null; - var db = new SqlHelper<object>().GetInstance(); - loc = db.Queryable<Location>() - .LeftJoin<AbnormalAreaConfig>((a, b) => a.S_AREA_CODE == b.S_SUP_AREA) - .Where((a, b) => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y" && b.S_AREA_CODE.Trim() == areaCode) - .First(); - return loc; - } - - /// <summary> - /// 鏌ヨ鎺ラ┏浣嶅叧鑱斿睘鎬�- /// </summary> - /// <param name="locCode"></param> - /// <returns></returns> - public static TransfeRelevance GetTransfeRelevance(string locCode) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<TransfeRelevance>().Where(a => a.S_LOC_CODE.Trim() == locCode).First(); - } - - /// <summary> - /// 鏌ヨ鎺ラ┏浣嶅叧鑱斿睘鎬�- /// 娉細 - /// 1.鏌ヨ寮傚父鍖鸿揣浣�- /// </summary> - /// <param name="areaCode">搴撳尯</param> - /// <param name="type">绫诲瀷 1.绔嬪簱鎺ラ┏浣�2.缂撳瓨浣�/param> - /// <param name="property">璐т綅灞炴�锛�.鐩磋繛 2.闈炵洿杩�3.浜哄伐 4.鍥哄畾绔欏彴锛�/param> - /// <param name="actType">鍔ㄤ綔绫诲瀷锛�.榛樿 1.鍏ュ簱 2.鍑哄簱锛�/param> - /// <returns></returns> - public static Location GetTransfeRelevanceLoc(string areaCode , string type ,string actType = "0" ,string property = "2" ) - { - Location loc = null; - var db = new SqlHelper<object>().GetInstance(); - loc = db.Queryable<Location>() - .LeftJoin<TransfeRelevance>((a,b)=> a.S_CODE == b.S_LOC_CODE) - .Where((a, b) => b.S_RELE_AREA.Trim() == areaCode && b.S_TYPE.Trim() == type && b.S_PROPERTY == property && b.S_ACT_TYPE == actType && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y") - .First(); - return loc; - } - - /// <summary> - /// 鏌ヨ鎺ラ┏浣嶅叧鑱斿睘鎬�- /// </summary> - /// <param name="locCode"></param> - /// <param name="property">璐т綅灞炴� (1.鐩磋繛 2.闈炵洿杩炪�3.浜哄伐 銆�.鍥哄畾绔欏彴)</param> - /// <returns></returns> - public static bool updateTransfeLocProperty(string locCode ,string property) - { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - result = db.Updateable<TransfeRelevance>().SetColumns(a => new TransfeRelevance() { S_PROPERTY = property } ).Where(a => a.S_LOC_CODE.Trim() == locCode).ExecuteCommand() > 0; - return result; - } - - /// <summary> - /// 鏌ヨ绔嬪簱鎺ラ┏浣�- /// 娉細鏌ヨ浠诲姟鏈�皯鐨勬帴椹充綅 - /// </summary> - /// <param name="areaCode">搴撳尯</param> - /// <param name="property">璐т綅灞炴� (1.鐩磋繛 2.闈炵洿杩炪�3.浜哄伐 銆�.鍥哄畾绔欏彴)</param> - /// <param name="type">绫诲瀷 1.绔嬪簱鎺ラ┏浣�2.缂撳瓨浣�3.鏈哄彴涓嬬嚎浣�4.寮傚父搴撲綅</param> - /// <param name="actType">鍔ㄤ綔绫诲瀷 1.鍏ュ簱 2.鍑哄簱</param> - /// <returns></returns> - public static Location GetMinTaskTransfeLoc(string areaCode , string type ,string actType, string property = "2") - { - var db = new SqlHelper<object>().GetInstance(); - var loc = db.Queryable<Location>() - .LeftJoin<TransfeRelevance>((a,b) => a.S_CODE == b.S_LOC_CODE) - .LeftJoin<WCSTask>((a,b,c) => a.S_CODE == c.S_END_LOC && c.N_B_STATE < 3) - .Where((a, b, c) => b.S_RELE_AREA.Trim() == areaCode && b.S_TYPE.Trim() == type && b.S_ACT_TYPE.Trim() == actType && b.S_PROPERTY.Trim() == property && a.N_LOCK_STATE < 3 && a.C_ENABLE == "Y") - .GroupBy((a, b, c) => a.S_CODE) - .Select((a, b, c) => new { - count = SqlFunc.AggregateCount(c.S_END_LOC), - code = a.S_CODE.Trim() - }) - .MergeTable() //闇�鍔燤ergeTable鎵嶈兘鎺掑簭缁熻杩囩殑鍒�- .OrderBy(it => it.count) - .First(); - if (loc != null) - { - return LocationHelper.GetLoc(loc.code); - } - return null; - } - - /// <summary> - /// 鏌ヨ鐗╂枡淇℃伅 - /// </summary> - /// <param name="materialCode"></param> - /// <returns></returns> - public static TN_Material GetMaterial(string materialCode) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<TN_Material>().Where(a => a.S_ITEM_CODE.Trim() == materialCode).First(); - } - - /// <summary> - /// 鏌ヨ瀹夊叏搴撳瓨 - /// </summary> - public static Safety_Inventory getSafetyInventory(string areaCode, string materialCode ,string trayType) - { - var db = new SqlHelper<object>().GetInstance(); - var query = db.Queryable<Safety_Inventory>().Where(a => a.S_AREA_CODE.Trim() == areaCode); - if (materialCode != null) - { - query = query.Where(a => a.S_MATERIAL_CODE == materialCode); - } - if (trayType != null) - { - query = query.Where(a => a.S_PALLET_TYPE == trayType); - } - return query.First(); - } - - //------------------------------------------------MES涓棿琛�---------------------------------------------- - - - /// <summary> - /// 璇诲彇MES涓嬫枡浠诲姟 - /// 1.澶囦唤瀹瑰櫒鐗╂枡淇℃伅 - /// 2.鏇存柊涓棿琛ㄧ姸鎬佷负宸茶 - /// </summary> - /// <param name="taskNo"></param> - /// <param name="id"></param> - /// <returns></returns> - internal static LjMesTask readLjMesOffItemTask(string taskNo , int id) - { - LogHelper.Info($"鏌ヨ鍒癕ES涓嬪彂WMS浠诲姟,mesTaskId:{id},浠诲姟鍙�{taskNo}" , "WMS"); - var db = new SqlHelper<object>().GetInstance(); - try - { - db.BeginTran(); - // 1.鏌ヨMES浠诲姟琛�- var mesTask = db.Queryable<LjMesTask>().Where(a => a.ID == id && a.RECEIVE_FLAG.Trim() == "PENDING" ).OrderByDescending(a => a.T_CREATE).First(); - if (mesTask != null) - { - // 閲嶇疆绌哄伐瑁呬俊鎭�- ContainerHelper.AddContainer(mesTask.PALLET_ID, int.Parse(mesTask.PALLET_TYPE),mesTask.QTY == 0 ? 0 : 1); - - mesTask.AGVORDER_ID = taskNo; - mesTask.RETURN_CODE = "1"; - mesTask.RECEIVE_FLAG = "COMPLETE"; - mesTask.RECEIVE_DATE = DateTime.Now.ToString("yyyy-MM-dd"); - db.Updateable(mesTask).ExecuteCommand(); - } - else - { - LogHelper.Info("鏈煡璇㈠埌MES涓嬪彂WMS浠诲姟", "WMS"); - } - db.CommitTran(); - return mesTask; - } - catch (Exception ex) - { - db.RollbackTran(); - LogHelper.Info($"璇诲彇MES涓嬪彂浠诲姟澶辫触锛岄敊璇師鍥�{ex.Message}" , "WMS"); - WMSHelper.addAlarmRecord("绯荤粺閿欒", "楂�, $"璇诲彇MES涓嬪彂浠诲姟澶辫触锛岄敊璇師鍥�{ex.Message}"); - } - return null; - } - - /// <summary> - /// 鏇存柊鎵樼洏鐗╂枡淇℃伅 - /// </summary> - public static void updatePalletAndMateral() - { - var db = new SqlHelper<object>().GetInstance(); - var lotCarrierList = db.Queryable<LjLotCarrier>().Where(a => a.RECEIVE_FLAG.Trim() == "PENDING").ToList(); - foreach (var lotCarrier in lotCarrierList) - { - CntrItemRel cntrItemRel = db.Queryable<CntrItemRel>().Where(a => a.S_CNTR_CODE == lotCarrier.PALLET_ID).First(); - - if (cntrItemRel != null) - { - cntrItemRel.S_CNTR_CODE = lotCarrier.PALLET_ID; - cntrItemRel.S_BATCH_NO = lotCarrier.LOT_NAME; - cntrItemRel.S_SERIAL_NO = lotCarrier.YCL_BATCH; - cntrItemRel.S_ITEM_CODE = lotCarrier.MATERIALCODE; - cntrItemRel.F_QTY = lotCarrier.QTY; - cntrItemRel.D_PRD_DATE = lotCarrier.PRODUCTION_DATE; - cntrItemRel.S_ITEM_STATE = lotCarrier.QC_STATUS; - cntrItemRel.D_EXP_DATE = lotCarrier.SHELFLIFE_DATE; - cntrItemRel.D_EXP_DATE1 = lotCarrier.MINSHELFLIFE_DATE; - db.Updateable(cntrItemRel).ExecuteCommand(); - } - else - { - cntrItemRel = new CntrItemRel() - { - S_CNTR_CODE = lotCarrier.PALLET_ID, - S_BATCH_NO = lotCarrier.LOT_NAME, - S_SERIAL_NO = lotCarrier.YCL_BATCH, - S_ITEM_CODE = lotCarrier.MATERIALCODE, - F_QTY = lotCarrier.QTY, - D_PRD_DATE = lotCarrier.PRODUCTION_DATE, - S_ITEM_STATE = lotCarrier.QC_STATUS, - D_EXP_DATE = lotCarrier.SHELFLIFE_DATE, - D_EXP_DATE1 = lotCarrier.MINSHELFLIFE_DATE, - }; - db.Insertable(cntrItemRel).ExecuteCommand(); - } - - lotCarrier.RECEIVE_FLAG = "COMPLETE"; - lotCarrier.RECEIVE_DATE = DateTime.Now.ToString("yyyy-MM-dd"); - db.Updateable(lotCarrier).UpdateColumns(a => new { a.RECEIVE_FLAG, a.RECEIVE_DATE }).ExecuteCommand(); - } - } - - /// <summary> - /// 鏇存柊鐗╂枡淇℃伅 - /// </summary> - public static void updateMateral() - { - var db = new SqlHelper<object>().GetInstance(); - var materialList = db.Queryable<LjItem>().Where(a => a.RECEIVE_FLAG.Trim() == "PENDING").ToList(); - foreach (var item in materialList) - { - TN_Material material = db.Queryable<TN_Material>().Where(a => a.S_ITEM_CODE == item.MATERIAL_CODE).First(); - - if (material != null) - { - material.S_ITEM_CODE = item.MATERIAL_CODE; - material.S_ITEM_NAME = item.MATERIAL_NAME; - material.S_SPEC = item.SPEC; - material.S_MODEL = item.MODEL; - material.S_UNIT = item.UNIT; - material.S_MEMO = item.MEMO; - db.Updateable(material).ExecuteCommand(); - } - else - { - material = new TN_Material() - { - S_ITEM_CODE = item.MATERIAL_CODE, - S_ITEM_NAME = item.MATERIAL_NAME, - S_SPEC = item.SPEC, - S_MODEL = item.MODEL, - S_UNIT = item.UNIT, - S_MEMO = item.MEMO, - }; - db.Insertable(material).ExecuteCommand(); - } - - item.RECEIVE_FLAG = "COMPLETE"; - item.RECEIVE_DATE = DateTime.Now.ToString("yyyy-MM-dd"); - db.Updateable(item).ExecuteCommand(); - } - } - - /// <summary> - /// 鏌ヨ鎵樼洏鐗╂枡淇℃伅 - /// </summary> - /// <param name="trayNo"></param> - /// <returns></returns> - internal static LjLotCarrier getLjCntrMaterial(string trayNo) - { - // 1.鏌ヨMES浠诲姟琛�- var db = new SqlHelper<object>().GetInstance(); - var lotCarrier = db.Queryable<LjLotCarrier>().Where(a => a.PALLET_ID.Trim() == trayNo).First(); - return lotCarrier; - } - - - /// <summary> - /// 鏌ヨMES鍙嶆枡浠诲姟 - /// </summary> - /// <param name="cntrCode"></param> - /// <returns></returns> - internal static LjMesTask getLjMesTaskByCntr(string cntrCode) - { - // 1.鏌ヨMES浠诲姟琛�- var db = new SqlHelper<object>().GetInstance(); - var mesTask = db.Queryable<LjMesTask>().Where(a => a.PALLET_ID.Trim() == cntrCode && a.RECEIVE_FLAG.Trim() == "PENDING").OrderByDescending(a => a.T_CREATE).First(); - return mesTask; - } - - /// <summary> - /// 鏌ヨMES鍙枡浠诲姟 - /// </summary> - /// <param name="positionId"></param> - /// <returns></returns> - internal static LjMesTask getLjMesTaskByLoc(string positionId) - { - // 1.鏌ヨMES浠诲姟琛�- var db = new SqlHelper<object>().GetInstance(); - var mesTask = db.Queryable<LjMesTask>().Where(a => a.POSITION_ID.Trim() == positionId && a.RECEIVE_FLAG.Trim() == "PENDING").OrderByDescending(a => a.T_CREATE).First(); - return mesTask; - } - - /// <summary> - /// 鏇存柊MES浠诲姟涓棿琛�- /// </summary> - /// <param name="mesTask"></param> - /// <returns></returns> - internal static bool updateLjMesTask(LjMesTask mesTask) - { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - mesTask.RECEIVE_FLAG = "COMPLETE"; - mesTask.RECEIVE_DATE = DateTime.Now.ToString("yyyy-MM-dd"); - result = db.Updateable(mesTask).ExecuteCommand() > 0; - return result; - } - - /// <summary> - /// 璇诲彇MES鍙枡浠诲姟 - /// 1.澶囦唤瀹瑰櫒鐗╂枡淇℃伅 - /// 2.鏇存柊涓棿琛ㄧ姸鎬佷负宸茶 - /// </summary> - /// <param name="taskNo"></param> - /// <param name="id"></param> - /// <returns></returns> - internal static bool readLjMesCallItemTask(string taskNo, int id) - { - LogHelper.Info( $"璇诲彇MES鍙枡浠诲姟,浠诲姟鍙�{taskNo},MES涓嬪彂浠诲姟ID锛歿id}", "WMS"); - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - try - { - db.BeginTran(); - var mesTask = db.Queryable<LjMesTask>().Where(a => a.ID == id ).OrderByDescending(a => a.T_CREATE).First(); - if (mesTask != null) - { - mesTask.AGVORDER_ID = taskNo; - mesTask.RETURN_CODE = "1"; - mesTask.RECEIVE_FLAG = "COMPLETE"; - mesTask.RECEIVE_DATE = DateTime.Now.ToString("yyyy-MM-dd"); - result = db.Updateable(mesTask).ExecuteCommand() > 0; - } - else - { - LogHelper.Info("鏈煡璇㈠埌MES涓嬪彂WMS浠诲姟", "WMS"); - } - db.CommitTran(); - } - catch (Exception ex) - { - db.RollbackTran(); - LogHelper.Error("璇诲彇MES鍙枡浠诲姟锛孍RROR_MSG:" + ex.Message, ex, "WMS"); - } - return result; - } - - /// <summary> - /// 鏌ヨMES浠诲姟琛�- /// </summary> - /// <param name="taskNo"></param> - /// <returns></returns> - public static LjMesTask GetLjMesTaskByAgvorderId(string taskNo) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<LjMesTask>().Where(a => a.AGVORDER_ID.Trim() == taskNo).First(); - } - - /// <summary> - /// 鏌ヨMES浠诲姟琛�- /// </summary> - /// <param name="mesTaskId"></param> - /// <returns></returns> - public static LjMesTask GetLjMesTaskById(int mesTaskId) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<LjMesTask>().Where(a => a.ID == mesTaskId).First(); - } - - /// <summary> - /// 鏌ヨMES浠诲姟琛�- /// </summary> - /// <param name="receiveFlag">宸茶鏍囪瘑</param> - /// <returns></returns> - public static List<LjMesTask> GetLjMesTaskList(string receiveFlag ) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<LjMesTask>().Where(a => a.RECEIVE_FLAG.Trim() == receiveFlag ).ToList(); - } - - /// <summary> - /// 鏇存柊MES浠诲姟鐘舵� - /// </summary> - /// <param name="taskNo"></param> - /// <param name="status">0:榛樿鍊�1锛氫换鍔″凡鐢熸垚 2锛氫换鍔¤繍琛屼腑 3锛氫换鍔″畬鎴�4锛氫换鍔″け璐�5锛氫换鍔″彇娑�6锛氬叾浠栭敊璇�绛�/param> - /// <param name="msg"></param> - /// <returns></returns> - public static bool updateMesTaskStatus(string taskNo, string status, string msg = "") - { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - result = db.Updateable<LjMesTask>().SetColumns(a => new LjMesTask() { RETURN_CODE = status , RECEIVE_MSG = msg}).Where(a => a.AGVORDER_ID.Trim() == taskNo).ExecuteCommand() > 0; - return result; - } - - /// <summary> - /// 鏇存柊鍑哄簱浠诲姟涓棿琛ㄧ姸鎬�- /// </summary> - /// <param name="taskNo"></param> - /// <param name="status">1锛氭墽琛屼腑锛�锛氬畬鎴�绛�/param> - /// <returns></returns> - public static bool updateMesOutTaskStatus(int taskNo, string status) - { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - result = db.Updateable<LjLotOutTask>().SetColumns(a => new LjLotOutTask() { TASK_STATUS = status }).Where(a => a.ID == taskNo).ExecuteCommand() > 0; - return result; - } - - /// <summary> - /// 娣诲姞搴撳瓨琛�- /// </summary> - /// <param name="ljLotOnhand"></param> - /// <returns></returns> - public static bool addLjLotOnhand(LjLotOnhand ljLotOnhand) { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - ljLotOnhand.CREATION_DATE = DateTime.Now; - result = db.Insertable<LjLotOnhand>(ljLotOnhand).ExecuteCommand()>0; - return result; - } - - /// <summary> - /// 娣诲姞鍑哄簱浠诲姟璁板綍 - /// </summary> - /// <param name="locCode"></param> - /// <returns></returns> - public static bool addLotOutTask(string locCode) { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - var locCntrs = LocationHelper.GetLocCntr(locCode); - if (locCntrs != null && locCntrs.Count > 0) - { - LjLotOutTask ljLotOutTask = new LjLotOutTask() - { - PALLET_ID = locCntrs[0].S_CNTR_CODE, - POSITION_ID = locCntrs[0].S_LOC_CODE, - CREATION_DATE = DateTime.Now.ToString("yyyy-MM-dd"), - TASK_STATUS = "1" // 1.鎵ц涓�- }; - - var cntrItems = ContainerHelper.GetCntrItemRel(locCntrs[0].S_CNTR_CODE); - if (cntrItems != null && cntrItems.Count > 0) - { - ljLotOutTask.MATERIAL_CODE = cntrItems[0].S_ITEM_CODE; - ljLotOutTask.LOT_NAME = cntrItems[0].S_BATCH_NO; - ljLotOutTask.QC_STATUS = cntrItems[0].S_ITEM_STATE; - ljLotOutTask.UNIT = cntrItems[0].S_UOM; - ljLotOutTask.QTY = (int)cntrItems[0].F_QTY; - } - result = db.Insertable<LjLotOutTask>(ljLotOutTask).ExecuteCommand() > 0; - } - return result; - } - - /// <summary> - /// 鏇存柊鍑哄簱浠诲姟璁板綍 - /// </summary> - /// <param name="cntrCode"></param> - /// <param name="status"></param> - /// <returns></returns> - public static bool updateLotOutTask(string cntrCode,string status) - { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - var ljLotOutTask = db.Queryable<LjLotOutTask>().Where(a => a.PALLET_ID == cntrCode && a.TASK_STATUS == "1").OrderByDescending(a => a.T_CREATE).First(); - if (ljLotOutTask != null) { - ljLotOutTask.TASK_STATUS = status; - result = db.Updateable<LjLotOutTask>(ljLotOutTask).ExecuteCommand()>0; - } - return result; - } - - // -----------------------------------------鏂滆涓棿琛�--------------------------------------------- - - - /// <summary> - /// 涓嬪彂XC浠诲姟 - /// </summary> - /// <param name="mesTaksId"></param> - /// <returns></returns> - public static bool addLjXcTask(int mesTaksId) - { - bool result = false; - var db = new SqlHelper<object>().GetInstance(); - var ljMesTask = GetLjMesTaskById(mesTaksId); - if (ljMesTask != null) { - LjXcTask ljXcTask = new LjXcTask() { - ID = ljMesTask.ID, - POSITION_ID = ljMesTask.POSITION_ID, - RETURN_CODE = ljMesTask.RETURN_CODE, - MSG_TYPE = ljMesTask.MSG_TYPE, - PALLET_TYPE = ljMesTask.PALLET_TYPE, - MATERIAL_NAME = ljMesTask.MATERIAL_NAME, - MATERIAL_CODE = ljMesTask.MATERIAL_CODE, - QTY = ljMesTask.QTY, - YCL_BATCH = ljMesTask.YCL_BATCH, - PALLET_ID = ljMesTask.PALLET_ID, - AGVORDER_ID = ljMesTask.AGVORDER_ID, - CREATION_DATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), - RECEIVE_FLAG = ljMesTask.RECEIVE_FLAG, - EQP = ljMesTask.EQP, - PLAN_ID = ljMesTask.PLAN_ID - }; - result = db.Insertable<LjXcTask>(ljXcTask).ExecuteCommand() > 0; - } - return result; - } - - - /// <summary> - /// 鏌ヨ鏂滆浠诲姟琛�- /// </summary> - /// <param name="mesTaskId"></param> - /// <returns></returns> - public static LjXcTask GetLjXcTaskById(int mesTaskId) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<LjXcTask>().Where(a => a.ID == mesTaskId).First(); - } - - /// <summary> - /// 鏌ヨ鏂滆鍑哄簱浠诲姟琛�- /// </summary> - /// <param name="taskStatus"></param> - /// <param name="receiveFlag"></param> - /// <returns></returns> - public static List<LjXcOutTask> getLjXcOutTask(string receiveFlag ,string taskStatus) - { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<LjXcOutTask>().Where(a => a.RECEIVE_FLAG == receiveFlag && a.TASK_STATUS == taskStatus).ToList(); - } - - } -} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/HH.WCS.Mobox3.YNJT_BZP.csproj b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/HH.WCS.Mobox3.YNJT_BZP.csproj index 4bd211f..9ca2d26 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/HH.WCS.Mobox3.YNJT_BZP.csproj +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/HH.WCS.Mobox3.YNJT_BZP.csproj @@ -252,6 +252,7 @@ <Compile Include="dispatch\NDC.cs" /> <Compile Include="core\Monitor.cs" /> <Compile Include="dispatch\NDCApi.cs" /> + <Compile Include="dispatch\WCSDispatch.cs" /> <Compile Include="models\BaseModel.cs" /> <Compile Include="models\Area.cs" /> <Compile Include="models\ItemBarcodeInfo.cs" /> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs index cb0e21e..3f325f8 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs @@ -49,6 +49,17 @@ { foreach (var item in itemInfos) { + // 灏哅ES鐨勭墿鏂欑姸鎬佽浆鍖栨垚WMS鍙瘑鍒殑鐗╂枡鐘舵� + if (item.jdge == "" || item.jdge == null) + { + item.jdge = "OK"; + } + else if(item.jdge != "OK") + { + item.jdge = "HOLD"; + } + + // 璁$畻鐢熸晥鏃堕棿銆佸け鏁堟椂闂� var overage = WMSHelper.getOverage(item.bc_entried); if (overage != null) { @@ -120,6 +131,7 @@ S_END_AREA = endLoc.S_AREA_CODE, S_TYPE = model.taskType, S_OP_DEF_CODE = model.taskNo, + S_OP_DEF_NAME = "鍗婂埗鍝�浣欐枡/绌烘墭涓嬪彂鍏ュ簱浠诲姟", N_PRIORITY = model.priority, T_START_TIME = DateTime.Now, }; @@ -231,6 +243,7 @@ S_END_AREA = endLoc.S_AREA_CODE, S_TYPE = "绌烘墭鍑哄簱浠诲姟", S_OP_DEF_CODE = model.taskNo, + S_OP_DEF_NAME = "绌烘墭鍑哄簱浠诲姟", N_PRIORITY = model.priority, T_START_TIME = DateTime.Now, }; @@ -323,7 +336,7 @@ else { result.ResultCode = 1; - result.ResultMsg = "搴撳唴娌℃湁鏌ュ埌姝ょ墿鏂�; + result.ResultMsg = "搴撳唴娌℃湁婊¤冻鏉′欢鐨勭墿鏂�; return result; } @@ -340,6 +353,7 @@ S_END_AREA = endLoc.S_AREA_CODE, S_TYPE = "鎴愬瀷鏈哄彨鏂欏嚭搴撲换鍔�, S_OP_DEF_CODE = model.taskNo, + S_OP_DEF_NAME = "鎴愬瀷鏈哄彨鏂欏嚭搴撲换鍔�, N_PRIORITY = model.priority, T_START_TIME = DateTime.Now, }; @@ -399,8 +413,18 @@ { foreach (var item in model.itemInfo) { + // 灏哅ES鐨勭墿鏂欑姸鎬佽浆鍖栨垚WMS鍙瘑鍒殑鐗╂枡鐘舵� + if (item.jdge == "" || item.jdge == null) + { + item.jdge = "OK"; + } + else if (item.jdge != "OK") + { + item.jdge = "HOLD"; + } + var overage = WMSHelper.getOverage(item.bc_entried); - if (overage != null) + if (overage != null && overage.OVERAGE != 0) { DateTime txndate = DateTime.Parse(item.txndate); DateTime minTime = txndate.AddHours(overage.MINHOUR); @@ -442,6 +466,7 @@ S_END_AREA = endLoc.S_AREA_CODE, S_TYPE = "浜哄伐鍏ュ簱浠诲姟", S_OP_DEF_CODE = model.taskNo, + S_OP_DEF_NAME = "浜哄伐鍏ュ簱浠诲姟", N_PRIORITY = model.priority, T_START_TIME = DateTime.Now, }; @@ -538,6 +563,7 @@ S_END_AREA = endLoc.S_AREA_CODE, S_TYPE = "浜哄伐鍑哄簱浠诲姟", S_OP_DEF_CODE = model.taskNo, + S_OP_DEF_NAME = "浜哄伐鍑哄簱浠诲姟", N_PRIORITY = model.priority, T_START_TIME = DateTime.Now, }; @@ -576,7 +602,7 @@ else { result.ResultCode = 1; - result.ResultMsg = "搴撳唴娌℃湁姝ょ墿鏂�; + result.ResultMsg = "搴撳唴娌℃湁婊¤冻鏉′欢鐨勭墿鏂�; } } catch (Exception ex) @@ -633,6 +659,7 @@ S_END_AREA = endLoc.S_AREA_CODE, S_TYPE = "姣嶆嫋鍏ュ簱浠诲姟", S_OP_DEF_CODE = taskNo, + S_OP_DEF_NAME = "姣嶆嫋鍏ュ簱浠诲姟", N_PRIORITY = 1, T_START_TIME = DateTime.Now, }; @@ -694,15 +721,15 @@ ReturnResult result = new ReturnResult(); try { - var mst = WMSHelper.GetWmsTask(wmsTaskNo); - if (mst != null && mst.N_B_STATE < 2) + var cst = WCSHelper.GetTaskByStart(loc); + if (cst == null) { Location startLoc = LocationHelper.GetLoc(loc); Location endLoc = LocationHelper.GetLoc(Settings.baseTrayInBufferLoc); - if (!(endLoc != null && endLoc.N_CURRENT_NUM == 0)) + if (!(endLoc != null && endLoc.N_CURRENT_NUM == 0)) { endLoc = WMSHelper.GetInstockEndLoc(0, loc, 2); - } + } if (endLoc != null && startLoc != null) { @@ -727,8 +754,7 @@ // 鍒涘缓涓�鍏ュ簱浠诲姟 WCSTask wcsTask = new WCSTask() { - S_OP_NAME = mst.S_OP_DEF_NAME, - S_OP_CODE = mst.S_CODE, + S_OP_CODE = wmsTaskNo, S_CODE = WCSHelper.GenerateTaskNo(), S_CNTR_CODE = trayCode, S_TYPE = "姣嶆嫋鍏ュ簱浠诲姟", @@ -771,13 +797,13 @@ /// <param name="loc"></param> /// <param name="taskNo"></param> /// <returns></returns> - public static ReturnResult baseTrayOutStock(string loc ,string taskNo) + public static ReturnResult baseTrayOutStock(string loc ,string taskNo ,int exclude = 1) { LogHelper.Info("銆愭瘝鎷栧嚭搴撲换鍔°�寮�涓嬪彂姣嶆嫋鍑哄簱浠诲姟", "WMS"); ReturnResult result = new ReturnResult(); try { - Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0, 1); + Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0, exclude); Location endLoc = LocationHelper.GetLoc(loc); var agvJBLoc = Settings.getAgvJBLoc(loc); @@ -801,6 +827,7 @@ S_END_AREA = endLoc.S_AREA_CODE, S_TYPE = "姣嶆嫋鍑哄簱浠诲姟", S_OP_DEF_CODE = taskNo, + S_OP_DEF_NAME = "姣嶆嫋鍑哄簱浠诲姟", N_PRIORITY = 1, T_START_TIME = DateTime.Now, }; @@ -864,10 +891,10 @@ ReturnResult result = new ReturnResult(); try { - var mst = WMSHelper.GetWmsTask(wmsTaskNo); - if (mst != null && mst.N_B_STATE < 2) + var cst = WCSHelper.GetTaskByEnd(loc); + if (cst == null) { - Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0,0); + Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0, 0); Location endLoc = LocationHelper.GetLoc(loc); if (startLoc != null) @@ -884,8 +911,7 @@ // 鍒涘缓鍏ュ簱浠诲姟 WCSTask wcsTask = new WCSTask() { - S_OP_NAME = mst.S_OP_DEF_NAME, - S_OP_CODE = mst.S_CODE, + S_OP_CODE = wmsTaskNo, S_CODE = WCSHelper.GenerateTaskNo(), S_CNTR_CODE = trayCode, S_TYPE = "姣嶆嫋鍑哄簱浠诲姟", @@ -1106,9 +1132,6 @@ BOM3 = matl.bom3, S_FOVRAGE = matl.fovrage, S_JDGE = matl.jdge, - S_WMS_JDGE = matl.WMS_jdge, - EFFECTIVE_TIME = matl.effective_time, - EXPIRATION_TIME = matl.expiration_time, LAST_MODIFY_TIME = matl.last_modify_time }; itemBarcodeInfos.Add(itemBarcodeInfo); @@ -1151,7 +1174,6 @@ if (overages != null && overages.Count > 0) { List<Overage> overageList = new List<Overage>(); - foreach (var item in overages) { Overage overage = new Overage @@ -1159,8 +1181,9 @@ MCNGRP = item.mcngrp, ITEMPATT = item.itempatt, OVERAGE = item.overage, - MINHOUR = int.Parse(item.minhour.ToString()) , + MINHOUR = float.Parse(item.minhour.ToString()), FLAG_STS = item.flag_sts, + RECID = item.recid, }; overageList.Add(overage); } @@ -1192,7 +1215,7 @@ if (!bo) { responseResult.ResultCode = 1; - responseResult.ResultMsg = "鍚屾鐗╂枡鐘舵�淇℃伅澶辫触"; + responseResult.ResultMsg = "璁板綍鏁版嵁鍚屾鏃堕棿澶辫触"; } return responseResult; } @@ -1207,7 +1230,13 @@ { ReturnResult responseResult = new ReturnResult(); var synDataTime = WMSHelper.getLastDataSynTime(recordTable); - responseResult.data = synDataTime; + if (synDataTime != null) + { + Dictionary<string, string> map = new Dictionary<string, string>(); + map.Add("S_SYN_TIME", synDataTime.S_SYN_TIME); + map.Add("RECORD_TABLE", synDataTime.RECORD_TABLE); + responseResult.data = map; + } return responseResult; } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiModel.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiModel.cs index b25383c..2b398de 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiModel.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiModel.cs @@ -18,9 +18,16 @@ { public int ResultCode { get; set; } = 0; public string ResultMsg { get; set; } - public object data { get; set; } } + + public class ResponseResult + { + public int code { get; set; } = 200; + public string msg { get; set; } + public object data { get; set; } + } + /// <summary> /// hosttoagv涓婃姤浠诲姟鐘舵� /// </summary> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/WmsController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/WmsController.cs index 17f4ab9..59b5f2c 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/WmsController.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/WmsController.cs @@ -255,7 +255,7 @@ public decimal minhour { get; set; } // 鏈�皬宸ヤ綔鏃堕棿鎴栨潯浠� public string flag_sts { get; set; } // 鐘舵�鏍囪 public int recid { get; set; } - public DateTime last_modify_time { get; set; } + public string last_modify_time { get; set; } } public class RecordDataSynTimeModel diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs index ff5032e..9ce32ea 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs @@ -33,7 +33,7 @@ var cst = WCSHelper.GetTaskByStartAndEnd(endLoc.S_CODE); if (cst == null) { - ApiHelper.baseTrayOutStockAgv(endLoc.S_CODE, null); + ApiHelper.baseTrayOutStock(endLoc.S_CODE, null , 0); } } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/WCSCore.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/WCSCore.cs index 895d834..41ea36e 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/WCSCore.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/WCSCore.cs @@ -21,6 +21,7 @@ namespace HH.WCS.Mobox3.YNJT_BZP.core { internal class WCSCore { public static void OperateAgvTaskStatus(AgvTaskState model) { + LogHelper.Info($"AGV浠诲姟鐘舵�鍙嶉锛屽叆鍙傦細{JsonConvert.SerializeObject(model)}", "AGV"); try { if (string.IsNullOrEmpty(model.No)) @@ -100,10 +101,54 @@ break; } } - else if (model.State == 2001) + else if (model.State == 1002) { - //鐢宠鏂扮粓鐐�- string endLoc = AGVApplyEndLoc(model.No); + //鏌ヨ褰撳墠缁堢偣鏄瓑寰呭尯锛屽垯鏌ヨ鍏ュ簱agv鎺ラ┏浣�+ var waitLoc = Settings.getAgvWaitLoc(TN_Task.S_END_LOC); + if (waitLoc != null) + { + string endLoc = AGVApplyEndLoc(model.No); + + + } + + //濡傛灉涓嶆槸绛夊緟鍖鸿揣浣嶏紝鍒欐煡璇㈢粓鐐硅揣浣嶆槸鍚︽槸鍏ュ簱鎺ラ┏浣�+ var agvJBLoc = Settings.getAgvJBLoc(TN_Task.S_END_LOC); + if (agvJBLoc != null && agvJBLoc.type == 1 && agvJBLoc.action == 1) + { + //鏄垯鏌ヨWCS鐨勪换鍔℃墽琛屾儏鍐�+ var wcsTask = WCSHelper.GetTaskBySrcNoAndScheduleType(TN_Task.S_OP_CODE ,"WCS"); + if (wcsTask != null) + { + bool existAction = WCSHelper.CheckActionRecordExist(wcsTask.S_CODE, 7); + if (existAction) + { + //濡傛灉WCS鍙嶉7鍙栨秷浠诲姟锛屽垯rfid鏍¢獙澶辫触锛岀敓鎴愭柊浠诲姟鍒板紓甯稿尯锛屽苟鍙樻洿agv浠诲姟鍙枫�璧风偣銆佺粓鐐�+ var mst = WMSHelper.GetWmsTask(TN_Task.S_OP_CODE); + var endLoc = WMSHelper.getErrorBufferAreaLoc(); + if (endLoc != null) + { + LocationHelper.UnLockLoc(mst.S_END_LOC); + mst.S_END_LOC = endLoc.S_CODE; + mst.S_END_AREA = endLoc.S_AREA_CODE; + + WMSHelper.UpdateTaskEnd(mst); + WCSCore.createLastTask(TN_Task.S_END_LOC, mst, 2); + } + else + { + LogHelper.Info("", "AGV"); + } + } + + existAction = WCSHelper.CheckActionRecordExist(wcsTask.S_CODE, 3); + if (existAction) + { + //WCS鍙嶉3宸插彇璐э紝鍒檃gv浠诲姟姝e父缁撴潫 + + } + } + } } else { @@ -213,100 +258,69 @@ /// <param name="taskNo"></param> public static string AGVApplyEndLoc(string taskNo) { - LogHelper.Info("銆恆gv鐢宠缁堢偣銆�, "AGV"); - string endLocCode = null; + LogHelper.Info($"浠诲姟鍙凤細{taskNo},AGV绛夊緟鍖虹敵璇风粓鐐�, "AGV"); var cst = WCSHelper.GetTask(taskNo); - if (cst != null && cst.N_B_STATE < 3) + if (cst != null && cst.N_B_STATE < 3) { var mst = WMSHelper.GetWmsTask(cst.S_OP_CODE); - if (mst != null && mst.N_B_STATE < 2 && mst.S_END_LOC == "铏氭嫙璐т綅") + if (mst != null && mst.N_B_STATE < 2 && mst.S_END_LOC == "铏氭嫙璐т綅") { var container = ContainerHelper.GetCntr(cst.S_CNTR_CODE); - if (container != null) + if (container != null) { var endLoc = WMSHelper.GetInstockEndLoc(container.N_TYPE); if (endLoc != null) { Location agvLoc = null; var locCodes = Settings.getAgvJBLocList(1, endLoc.N_ROADWAY, 1); - if (locCodes.Count > 0) + if (locCodes.Count > 0) { - agvLoc = LocationHelper.GetLoc(locCodes[0]); - } - - if (agvLoc != null && agvLoc.C_ENABLE == "Y") - { - var wcsTask = WCSHelper.GetTaskByStartAndEnd(agvLoc.S_CODE); - if (wcsTask == null && agvLoc.N_LOCK_STATE == 0) + foreach (var locCode in locCodes) { - // 鑳庡湀鍏ュ簱锛屼笅鍙戞瘝鎷栧嚭搴撲换鍔�\ 甯樺竷銆佸唴琛叆搴擄紝涓嬪彂鎵樼洏鍥炲簱浠诲姟 - if (mst.S_TYPE.Contains("鍏ュ簱")) + agvLoc = LocationHelper.GetLoc(locCode); + if (agvLoc != null && agvLoc.C_ENABLE == "Y") { - if (agvLoc.N_CURRENT_NUM == 1) - { - var locCntrRels = LocationHelper.GetLocCntr(agvLoc.S_CODE); - if (locCntrRels.Count > 0) - { - var container1 = ContainerHelper.GetCntr(locCntrRels[0].S_CNTR_CODE); - if (container1.N_TYPE == 0) - { - if (container.N_TYPE == 4 || container.N_TYPE == 5) - { - ApiHelper.baseTrayInStockAgv(agvLoc.S_CODE, mst.S_CODE); - } - } - else - { - LogHelper.Info($"鎺ラ┏浣�{agvLoc.S_CODE},瀛樺湪闈炴瘝鎷栧鍣�, "AGV"); - } - } - else - { - LogHelper.Info($"鎺ラ┏浣�{agvLoc.S_CODE}鐨勫綋鍓嶆暟閲忎笌瀹瑰櫒鏁伴噺涓嶅尮閰�, "AGV"); - } - } - else if (agvLoc.N_CURRENT_NUM == 0) - { - if (container.N_TYPE == 6) - { - ApiHelper.baseTrayOutStockAgv(agvLoc.S_CODE, mst.S_CODE); - } - } - else - { - return endLocCode; - } + cst.S_END_LOC = agvLoc.S_CODE; + cst.S_END_AREA = agvLoc.S_AREA_CODE; + WCSHelper.UpdateTaskEnd(cst); + + mst.S_END_LOC = endLoc.S_CODE; + mst.S_END_AREA = endLoc.S_AREA_CODE; + WMSHelper.UpdateTaskEnd(mst); + LocationHelper.LockLoc(endLoc.S_CODE, 1); + + LogHelper.Info($"浠诲姟鍙凤細{taskNo},AGV鐢宠鐨勭粓鐐癸細{agvLoc.S_CODE}", "AGV"); + return agvLoc.S_CODE; } - cst.S_END_LOC = agvLoc.S_CODE; - cst.S_END_AREA = agvLoc.S_AREA_CODE; - WCSHelper.UpdateTaskEnd(cst); - - mst.S_END_LOC = endLoc.S_CODE; - mst.S_END_AREA = endLoc.S_AREA_CODE; - WMSHelper.UpdateTaskEnd(mst); - - LocationHelper.LockLoc(agvLoc.S_CODE, 1); - LocationHelper.LockLoc(endLoc.S_CODE, 1); - endLocCode = agvLoc.S_CODE; } - else - { - LogHelper.Info("鎺ラ┏浣嶅綋鍓嶆湁浠诲姟鏈畬鎴愶紝璇风◢绛�, "AGV"); - } + + LogHelper.Info($"浠诲姟鍙凤細{taskNo},鍏ュ簱鎺ラ┏浣嶈揣浣嶉兘宸茬鐢�, "AGV"); } - else + else { - LogHelper.Info("娌℃湁鍙敤鐨勫叆搴撴帴椹充綅", "AGV"); + LogHelper.Info($"浠诲姟鍙凤細{taskNo},娌℃湁閰嶇疆绔嬪簱鎺ラ┏浣�, "AGV"); } } - else + else { - LogHelper.Info("娌℃湁绌轰綑鐨勮揣浣�, "AGV"); + LogHelper.Info($"浠诲姟鍙凤細{taskNo},绔嬪簱娌℃湁婊¤冻鏉′欢鐨勭┖璐т綅", "AGV"); } } + else + { + LogHelper.Info($"浠诲姟鍙凤細{taskNo},AGV浠诲姟鐨勫鍣細{cst.S_CNTR_CODE}涓嶅瓨鍦�, "AGV"); + } + } + else + { + LogHelper.Info($"浠诲姟鍙凤細{taskNo},AGV浠诲姟宸茬敵璇风粓鐐癸紝璇峰嬁閲嶅鐢宠", "AGV"); } } - return endLocCode; + else + { + LogHelper.Info($"浠诲姟鍙凤細{taskNo},AGV浠诲姟宸插畬鎴愭垨鍙栨秷", "AGV"); + } + return null; } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/WCSDispatch.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/dispatch/WCSDispatch.cs similarity index 66% rename from HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/WCSDispatch.cs rename to HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/dispatch/WCSDispatch.cs index e11f48e..fa09a94 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/dispatch/WCSDispatch.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/dispatch/WCSDispatch.cs @@ -3,13 +3,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using HH.WCS.Mobox3.FJJT.util; -using HH.WCS.Mobox3.FJJT.wms; +using HH.WCS.Mobox3.YNJT_BZP.util; +using HH.WCS.Mobox3.YNJT_BZP.wms; using Newtonsoft.Json; -using static HH.WCS.Mobox3.FJJT.api.ApiModel; -using static HH.WCS.Mobox3.FJJT.util.ExcetionHelper; +using static HH.WCS.Mobox3.YNJT_BZP.api.ApiModel; -namespace HH.WCS.Mobox3.FJJT.dispatch +namespace HH.WCS.Mobox3.YNJT_BZP.dispatch { internal class WCSDispatch { @@ -46,26 +45,15 @@ { result = true; } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"涓嬪彂WCS浠诲姟澶辫触锛學CS鍙嶉鍘熷洜锛歿dataResult.msg}"); - throw new BusinessException($"涓嬪彂WCS浠诲姟澶辫触锛學CS鍙嶉鍘熷洜锛歿dataResult.msg}"); - } } else { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"涓嬪彂WCS浠诲姟澶辫触锛學CS娌℃湁杩斿洖鏁版嵁"); - throw new BusinessException($"涓嬪彂WCS浠诲姟澶辫触锛學CS娌℃湁杩斿洖鏁版嵁"); + } - } - catch (BusinessException be) - { - throw be; } catch (Exception ex) { - WMSHelper.addAlarmRecord("绯荤粺寮傚父", "楂�, $"涓嬪彂WCS浠诲姟閿欒锛岄敊璇師鍥狅細{ex.Message}"); - throw new BusinessException($"涓嬪彂WCS浠诲姟閿欒锛岄敊璇師鍥狅細{ex.Message}"); + } return result; } @@ -93,26 +81,16 @@ { result = true; } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鍙栨秷WCS浠诲姟澶辫触锛學CS鍙嶉鍘熷洜锛歿dataResult.msg}"); - throw new BusinessException($"鍙栨秷WCS浠诲姟澶辫触锛學CS鍙嶉鍘熷洜锛歿dataResult.msg}"); - } + } else { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鍙栨秷WCS浠诲姟澶辫触锛學CS娌℃湁杩斿洖鏁版嵁"); - throw new BusinessException($"鍙栨秷WCS浠诲姟澶辫触锛學CS娌℃湁杩斿洖鏁版嵁"); + } - } - catch (BusinessException be) - { - throw be; } catch (Exception ex) { - WMSHelper.addAlarmRecord("绯荤粺寮傚父", "楂�, $"鍙栨秷WCS浠诲姟閿欒锛岄敊璇師鍥狅細{ex.Message}"); - throw new BusinessException($"鍙栨秷WCS浠诲姟閿欒锛岄敊璇師鍥狅細{ex.Message}"); + } return result; } @@ -146,26 +124,17 @@ { deviceStatusDatas = JsonConvert.DeserializeObject<List<DeviceStatusData>>(response); } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鑾峰彇璁惧鐘舵�澶辫触锛學CS鍙嶉鍘熷洜锛歿dataResult.msg}"); - throw new BusinessException($"鑾峰彇璁惧鐘舵�澶辫触锛學CS鍙嶉鍘熷洜锛歿dataResult.msg}"); - } + } else { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"鑾峰彇璁惧鐘舵�澶辫触锛學CS娌℃湁杩斿洖鏁版嵁"); - throw new BusinessException($"鑾峰彇璁惧鐘舵�澶辫触锛學CS娌℃湁杩斿洖鏁版嵁"); + } } - catch (BusinessException be) - { - throw be; - } + catch (Exception ex) { - WMSHelper.addAlarmRecord("绯荤粺寮傚父", "楂�, $"鑾峰彇璁惧鐘舵�閿欒锛岄敊璇師鍥狅細{ex.Message}"); - throw new BusinessException($"鑾峰彇璁惧鐘舵�閿欒锛岄敊璇師鍥狅細{ex.Message}"); + } return deviceStatusDatas; } @@ -193,26 +162,16 @@ { result = true; } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"淇敼浠诲姟浼樺厛绾уけ璐ワ紝WCS鍙嶉鍘熷洜锛歿dataResult.msg}"); - throw new BusinessException($"淇敼浠诲姟浼樺厛绾уけ璐ワ紝WCS鍙嶉鍘熷洜锛歿dataResult.msg}"); - } + } else { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"淇敼浠诲姟浼樺厛绾уけ璐ワ紝WCS娌℃湁杩斿洖鏁版嵁"); - throw new BusinessException($"淇敼浠诲姟浼樺厛绾уけ璐ワ紝WCS娌℃湁杩斿洖鏁版嵁"); + } - } - catch (BusinessException be) - { - throw be; } catch (Exception ex) { - WMSHelper.addAlarmRecord("绯荤粺寮傚父", "楂�, $"淇敼浠诲姟浼樺厛绾ч敊璇紝閿欒鍘熷洜锛歿ex.Message}"); - throw new BusinessException($"淇敼浠诲姟浼樺厛绾ч敊璇紝閿欒鍘熷洜锛歿ex.Message}"); + } return result; } @@ -247,26 +206,15 @@ { result = true; } - else - { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"AGV瀹夊叏浜や簰璇锋眰澶辫触锛學CS鍙嶉鍘熷洜锛歿dataResult.msg}"); - throw new BusinessException($"AGV瀹夊叏浜や簰璇锋眰澶辫触锛學CS鍙嶉鍘熷洜锛歿dataResult.msg}"); - } } else { - WMSHelper.addAlarmRecord("娴佺▼寮傚父", "楂�, $"AGV瀹夊叏浜や簰璇锋眰澶辫触锛學CS娌℃湁杩斿洖鏁版嵁"); - throw new BusinessException($"AGV瀹夊叏浜や簰璇锋眰澶辫触锛學CS娌℃湁杩斿洖鏁版嵁"); + LogHelper.Info("璋冪敤WCS瀹夊叏璇锋眰鎺ュ彛澶辫触", "AGV"); } - } - catch (BusinessException be) - { - throw be; } catch (Exception ex) { - WMSHelper.addAlarmRecord("绯荤粺寮傚父", "楂�, $"AGV瀹夊叏浜や簰璇锋眰閿欒锛岄敊璇師鍥狅細{ex.Message}"); - throw new BusinessException($"AGV瀹夊叏浜や簰璇锋眰閿欒锛岄敊璇師鍥狅細{ex.Message}"); + LogHelper.Info($"璋冪敤WCS瀹夊叏璇锋眰鎺ュ彛閿欒锛岄敊璇師鍥狅細{ex.Message}", "AGV"); } return result; } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/ItemBarcodeInfo.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/ItemBarcodeInfo.cs index 2716809..d864157 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/ItemBarcodeInfo.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/ItemBarcodeInfo.cs @@ -25,9 +25,6 @@ public string BOM3 { get; set; } public string S_FOVRAGE { get; set; } // 鏄惁杩囨湡 鏄惁杩囨湡锛坣ull 鎴�绌�榛樿 鍚︼級 Y/N public string S_JDGE { get; set; } // 璐ㄦ鐘舵� - public string S_WMS_JDGE { get; set; } // 鍙嶉wms璐ㄦ鐘舵� - public DateTime EFFECTIVE_TIME { get; set; } // 鐢熸晥鏃堕棿 - public DateTime EXPIRATION_TIME { get; set; } // 澶辨晥鏃堕棿 - public DateTime LAST_MODIFY_TIME { get; set; } // 鏈�悗淇敼鏃堕棿 + public string LAST_MODIFY_TIME { get; set; } // 鏈�悗淇敼鏃堕棿 } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/MatlInformation.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/MatlInformation.cs index a1372eb..3354fa2 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/MatlInformation.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/MatlInformation.cs @@ -27,9 +27,6 @@ public string bom3 { get; set; } public string fovrage { get; set; } // 鏄惁杩囨湡 鏄惁杩囨湡锛坣ull 鎴�绌�榛樿 鍚︼級 Y/N public string jdge { get; set; } // 璐ㄦ鐘舵� - public string WMS_jdge { get; set; } // 鍙嶉wms璐ㄦ鐘舵� - public DateTime effective_time { get; set; } // 鐢熸晥鏃堕棿 - public DateTime expiration_time { get; set; } // 澶辨晥鏃堕棿 - public DateTime last_modify_time { get; set; } // 鏈�悗淇敼鏃堕棿 + public string last_modify_time { get; set; } // 鏈�悗淇敼鏃堕棿 } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/Overage.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/Overage.cs index 9bd3798..88ccaae 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/Overage.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/Overage.cs @@ -8,12 +8,13 @@ namespace HH.WCS.Mobox3.YNJT_BZP.models { [SugarTable("TN_standard_overage")] - internal class Overage + internal class Overage : BaseModel { public string MCNGRP { get; set; } //鐢熶骇娴佺▼缁� public string ITEMPATT { get; set; } // 鐗╂枡鍓嶇紑 public int OVERAGE { get; set; } // 鏈�ぇ淇濆瓨鏃堕棿 - public int MINHOUR { get; set; } // 澶氫箙鍚庣敓鏁�+ public float MINHOUR { get; set; } // 澶氫箙鍚庣敓鏁� public string FLAG_STS { get; set; } // 鏍囪 + public int RECID { get; set; } // 鏍囪 } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/SynDataTimeRecord.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/SynDataTimeRecord.cs index 305bf33..132de80 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/SynDataTimeRecord.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/SynDataTimeRecord.cs @@ -12,7 +12,7 @@ { public string S_SYN_TIME { get; set; } // 鍚屾鏃堕棿 public int N_SYN_NUM { get; set; } // 鍚屾鏁伴噺 - public string RECORD_TABLE { get; set; } // 1.鐗╂枡鏉$爜璁板綍琛�2.鑳氳儙鏉$爜鐘舵�琛�+ public string RECORD_TABLE { get; set; } // 1.鐗╂枡鏉$爜璁板綍琛�2.鑳氳儙鏉$爜鐘舵�琛�3.杩囨湡鏃堕棿閰嶇疆琛� } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/TaskAction.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/TaskAction.cs index a962d1e..89ba394 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/TaskAction.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/models/TaskAction.cs @@ -17,7 +17,7 @@ public string S_VALUE { get; set; } public string S_STATE_PRE { get; set; } public int N_REVIEW_RESULT { get; set; } - + public int N_S_STATUS { get; set; } = 0; public int N_ACTION_CODE { get; set; } } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/process/TaskProcess.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/process/TaskProcess.cs index d3584ad..1afcf5a 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/process/TaskProcess.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/process/TaskProcess.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Reflection; using System.Security.Cryptography; +using static HH.WCS.Mobox3.YNJT_BZP.util.Settings; namespace HH.WCS.Mobox3.YNJT_BZP.process { internal class TaskProcess { @@ -67,22 +68,86 @@ /// <param name="forkliftNo"></param> /// <param name="extData"></param> internal static void OperateReq(string no, int state, string forkliftNo, string extData) { + LogHelper.Info($"寮�瀹夊叏璇锋眰锛屼换鍔″彿:{no},璇锋眰鐮�{state},灏忚溅鍙凤細{forkliftNo}", "AGV"); var cst = WCSHelper.GetTask(no); + var mst = WMSHelper.GetWmsTask(cst.S_OP_CODE); var endLoc = LocationHelper.GetLoc(cst.S_END_LOC); - if (state == 1101) { - //璇锋眰鍙栬揣锛�- - } - if (state == 1102) { - //璇锋眰鍗歌揣锛�- bool isCan = false; - - - if (endLoc != null) + var taskAction = WCSHelper.getActionRecord(no, state); + if (taskAction != null) + { + LogHelper.Info($"鍐嶆瀹夊叏璇锋眰锛屾煡璇㈣澶囨槸鍚﹀弽棣�, "AGV"); + if (taskAction.N_S_STATUS == 1) { - // 1.鏌ョ湅缁堢偣璐т綅鏀捐揣鏉′欢鏄惁婊¤冻 - var waitLoc = Settings.getAgvWaitLoc(endLoc.S_CODE); - if (waitLoc != null) + LogHelper.Info($"鍐嶆瀹夊叏璇锋眰锛岃澶囧凡鍙嶉", "AGV"); + NDCApi.ChangeOrderParam(no, 8, "1"); + } + } + else + { + LogHelper.Info($"棣栨杩涜瀹夊叏璇锋眰锛屼换鍔″彿:{no},璇锋眰鐮�{state},灏忚溅鍙凤細{forkliftNo}", "AGV"); + bool result = false; + if (state == 1101) + { + result = WCSDispatch.safetyInteraction(cst.S_CODE, cst.S_START_LOC, "1"); //璇锋眰鍙栬揣锛�+ } + if (state == 1102) + { + //璇锋眰鍗歌揣锛�+ var container = ContainerHelper.GetCntr(cst.S_CNTR_CODE); + // 鑳庡湀鍏ュ簱锛屼笅鍙戞瘝鎷栧嚭搴撲换鍔�\ 甯樺竷銆佸唴琛叆搴擄紝涓嬪彂鎵樼洏鍥炲簱浠诲姟 + if (cst.S_TYPE.Contains("鍏ュ簱") && endLoc.N_LOCK_STATE == 0) + { + if (container.N_TYPE != 6 ) + { + if (endLoc.N_CURRENT_NUM == 1) + { + var locCntrRels = LocationHelper.GetLocCntr(endLoc.S_CODE); + if (locCntrRels != null && locCntrRels.Count > 0) + { + var container1 = ContainerHelper.GetCntr(locCntrRels[0].S_CNTR_CODE); + if (container1.N_TYPE == 0) + { + LogHelper.Info("闈炶儙鍦堝叆搴擄紝鎺ラ┏浣嶅瓨鍦ㄦ瘝鎷栵紝涓嬪彂姣嶆嫋鍏ュ簱浠诲姟", "AGV"); + ApiHelper.baseTrayInStockAgv(endLoc.S_CODE, mst.S_CODE); + } + } + } + else + { + result = true; + } + } + + // 鑳庡湀鍏ュ簱 + if (container.N_TYPE == 6 ) + { + if (endLoc.N_CURRENT_NUM == 0) + { + LogHelper.Info("鑳庡湀鍏ュ簱锛屾帴椹充綅缂哄皯姣嶆嫋锛屼笅鍙戞瘝鎷栧嚭搴撲换鍔�, "AGV"); + ApiHelper.baseTrayOutStockAgv(endLoc.S_CODE, mst.S_CODE); + } + else if (endLoc.N_CURRENT_NUM == 1) + { + var locCntrRels = LocationHelper.GetLocCntr(endLoc.S_CODE); + if (locCntrRels != null && locCntrRels.Count > 0) + { + var container1 = ContainerHelper.GetCntr(locCntrRels[0].S_CNTR_CODE); + if (container1.N_TYPE == 0) + { + result = true; + } + } + } + } + } + + // 璇锋眰WCS鏄惁鍏佽鏀捐揣 + if (result) + { + result = WCSDispatch.safetyInteraction(cst.S_CODE, cst.S_START_LOC, "2"); // 璇锋眰鏀捐揣 + } + + if (result) { //鏍规嵁缁堢偣鍒ゆ柇锛屾槸cb02鐨勫叆鍙o紝鍒ゆ柇鍐呭瓨涓姸鎬侊紙瑕佺姸鎬佹椂闂达級锛屽厑璁稿嵏璐э紝閫氱煡agv鏀瑰弬鏁� var dic = new Dictionary<string, string>(); @@ -91,64 +156,24 @@ dic.Add("ParamNo", "8"); dic.Add("Param1", "1"); NDC.ChangeOrder(dic); + //鏀瑰畬鍙傛暟杞﹀瓙灏变細鑷繁鍗歌揣 } - else - { - var container = ContainerHelper.GetCntr(cst.S_CNTR_CODE); - if (container != null && container.N_TYPE == 6) - { - isCan = false; - var locCntrs = LocationHelper.GetLocCntr(endLoc.S_CODE); - if (endLoc.N_CURRENT_NUM == 1 && locCntrs.Count > 0) - { - var container1 = ContainerHelper.GetCntr(locCntrs[0].S_CNTR_CODE); - if (container1.N_TYPE == 0) - { - isCan = true; - } - } - if (!isCan) - { - LogHelper.Info("鑳庡湀璇锋眰鏀捐揣澶辫触锛屾瘝鎷栨病鏈夊埌浣�, "AGV"); - } - } - } - - // 2.鏌ヨ杈撻�绾�鏄惁鍏佽鏀捐揣 - } - - if (isCan) + if (state == 1103) { - //鏍规嵁缁堢偣鍒ゆ柇锛屾槸cb02鐨勫叆鍙o紝鍒ゆ柇鍐呭瓨涓姸鎬侊紙瑕佺姸鎬佹椂闂达級锛屽厑璁稿嵏璐э紝閫氱煡agv鏀瑰弬鏁�- var dic = new Dictionary<string, string>(); - //< Req >< Order No = 'TN2302020002' ParamNo = '18' Param1 = '12' /></ Req > - dic.Add("No", no); - dic.Add("ParamNo", "8"); - dic.Add("Param1", "1"); - NDC.ChangeOrder(dic); - //鏀瑰畬鍙傛暟杞﹀瓙灏变細鑷繁鍗歌揣 + result = WCSDispatch.safetyInteraction(cst.S_CODE, cst.S_START_LOC, "3"); //鍙栬揣瀹屾垚鍏佽绂诲紑 } - } - if (state == 1103) - { - // 鍙栬揣瀹屾垚璇锋眰绂诲紑 - // 瀹夊叏閫�嚭 - // 鑳庡湀鍑哄簱锛屼笅鍙戞瘝鎷栧洖搴撲换鍔�- var locCntrRels = LocationHelper.GetLocCntrRel(cst.S_START_LOC); - if (locCntrRels.Count > 0) + if (state == 1104) { - var container = ContainerHelper.GetCntr(locCntrRels[0].S_CNTR_CODE); - if (container != null && container.N_TYPE == 0) - { - ApiHelper.baseTrayInStockAgv(cst.S_START_LOC, cst.S_OP_CODE); - } + result = WCSDispatch.safetyInteraction(cst.S_CODE, cst.S_START_LOC, "4"); //鏀捐揣瀹屾垚鍏佽绂诲紑 } - } - if (state == 1104) - { - // 鏀捐揣瀹屾垚璇锋眰绂诲紑 + // 瀹夊叏璇锋眰鍙戦�鎴愬姛锛屾坊鍔犱换鍔″姩浣滆褰�+ if (result) + { + WCSHelper.AddActionRecord(no, state, forkliftNo, extData); + LogHelper.Info($"棣栨杩涜瀹夊叏璇锋眰鎴愬姛", "AGV"); + } } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WCSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WCSHelper.cs index 4228571..3e5b098 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WCSHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WCSHelper.cs @@ -58,6 +58,12 @@ var task = db.Queryable<WCSTask>().Where(a => a.S_OP_CODE== no).First(); return task; } + internal static WCSTask GetTaskBySrcNoAndScheduleType(string no ,string scheduleType) + { + var db = new SqlHelper<WCSTask>().GetInstance(); + var task = db.Queryable<WCSTask>().Where(a => a.S_OP_CODE == no && a.S_SCHEDULE_TYPE == scheduleType && a.N_B_STATE < 3).First(); + return task; + } internal static List<WCSTask> GetTaskListBySrcNo(string no) { var db = new SqlHelper<WCSTask>().GetInstance(); @@ -89,14 +95,14 @@ return task; } - internal static List<WCSTask> GetTaskByStart(string bit) { + internal static WCSTask GetTaskByStart(string bit) { var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_START_LOC == bit.Trim()).ToList(); + var task = db.Queryable<WCSTask>().Where(a => a.S_START_LOC == bit.Trim() && a.N_B_STATE < 3).First(); return task; } - internal static List<WCSTask> GetTaskByEnd(string bit) { + internal static WCSTask GetTaskByEnd(string bit) { var db = new SqlHelper<WCSTask>().GetInstance(); - var task = db.Queryable<WCSTask>().Where(a => a.S_END_LOC.Trim() == bit.Trim()).ToList(); + var task = db.Queryable<WCSTask>().Where(a => a.S_END_LOC.Trim() == bit.Trim() && a.N_B_STATE < 3).First(); return task; } @@ -153,6 +159,12 @@ var db = new SqlHelper<TaskAction>().GetInstance(); return db.Queryable<TaskAction>().Count(a => a.S_TASK_CODE == no.Trim() && a.N_ACTION_CODE == code) > 0; } + internal static TaskAction getActionRecord(string no, int code) + { + var db = new SqlHelper<TaskAction>().GetInstance(); + return db.Queryable<TaskAction>().Where(a => a.S_TASK_CODE == no.Trim() && a.N_ACTION_CODE == code).First(); + } + internal static void Begin(WCSTask task) { var db = new SqlHelper<WCSTask>().GetInstance(); if (task != null) { diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs index f3dcc70..e7e2009 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs @@ -753,12 +753,16 @@ try { db.BeginTran(); - itemBarcodeInfos.ForEach(a => { - var bo = db.Insertable<ItemBarcodeInfo>(a).ExecuteCommand() > 0; - if (!bo) + itemBarcodeInfos.ForEach(item => { + var itemBarcodeInfo = db.Queryable<ItemBarcodeInfo>().Where(a => a.S_BC_ENTRIED == item.S_BC_ENTRIED).First(); + if (itemBarcodeInfo == null) { - result = false; - LogHelper.Info($"娣诲姞鐗╂枡鏉$爜淇℃伅澶辫触锛岀墿鏂欐潯鐮佷俊鎭細{JsonConvert.SerializeObject(a)}", "GT"); + var bo = db.Insertable<ItemBarcodeInfo>(item).ExecuteCommand() > 0; + if (!bo) + { + result = false; + LogHelper.Info($"娣诲姞鐗╂枡鏉$爜淇℃伅澶辫触锛岀墿鏂欐潯鐮佷俊鎭細{JsonConvert.SerializeObject(item)}", "GT"); + } } }); if (result) @@ -790,26 +794,34 @@ { db.BeginTran(); updateMatlStatuses.ForEach(update => { - var bo = db.Updateable<CntrItemRel>().SetColumns(a => new CntrItemRel() { S_ITEM_STATE = update.jdge }).Where(a => a.S_CG_ID == update.bc_entried).ExecuteCommand() > 0; - if (!bo) + var itemBarcodeInfo = db.Queryable<ItemBarcodeInfo>().Where(a => a.S_BC_ENTRIED == update.bc_entried).First(); + if (itemBarcodeInfo != null) { - result = false; - LogHelper.Info($"鎵归噺鏇存柊鐗╂枡鐘舵�澶辫触锛岀墿鏂欐潯鐮佷俊鎭細{JsonConvert.SerializeObject(update)}", "GT"); + itemBarcodeInfo.S_JDGE = update.jdge; + db.Updateable(itemBarcodeInfo).ExecuteCommand(); + var cntrItemRel = db.Queryable<CntrItemRel>().Where(a => a.S_CG_ID == update.bc_entried).First(); + if (cntrItemRel != null) + { + // 灏哅ES鐨勭墿鏂欑姸鎬佽浆鍖栨垚WMS鍙瘑鍒殑鐗╂枡鐘舵� + if (update.jdge == "" || update.jdge == null) + { + update.jdge = "OK"; + } + else if (update.jdge != "OK") + { + update.jdge = "HOLD"; + } + db.Updateable<CntrItemRel>().SetColumns(a => new CntrItemRel() { S_ITEM_STATE = update.jdge }).Where(a => a.S_CG_ID == update.bc_entried).ExecuteCommand(); + } } }); - if (result) - { - db.CommitTran(); - } - else - { - db.RollbackTran(); - } + db.CommitTran(); } catch (Exception ex) { LogHelper.Info($"鎵归噺鏇存柊鐗╂枡鐘舵�閿欒锛岄敊璇俊鎭細{ex.Message}", "GT"); db.RollbackTran(); + result = false; } return result; } @@ -827,48 +839,28 @@ db.BeginTran(); foreach (Overage overage in overages) { - bool bo = false; - var overage1 = db.Queryable<Overage>().Where(a => a.MCNGRP == overage.MCNGRP && a.ITEMPATT == overage.ITEMPATT).First(); + var overage1 = db.Queryable<Overage>().Where(a => a.RECID == overage.RECID).First(); if (overage1 != null) { + overage1.MCNGRP = overage.MCNGRP; + overage1.ITEMPATT = overage.ITEMPATT; overage1.OVERAGE = overage.OVERAGE; overage1.MINHOUR = overage.MINHOUR; overage1.FLAG_STS = overage.FLAG_STS; - bo = db.Updateable(overage1).ExecuteCommand() > 0; + db.Updateable(overage1).ExecuteCommand(); } else { - overage1 = new Overage() - { - MCNGRP = overage.MCNGRP, - ITEMPATT = overage.ITEMPATT, - OVERAGE = overage.OVERAGE, - MINHOUR = overage.MINHOUR, - FLAG_STS = overage.FLAG_STS - }; - bo = db.Insertable(overage1).ExecuteCommand() > 0; - } - if (!bo) - { - result = false; - LogHelper.Info($"鎵归噺鏇存柊鐗╂枡瀛樻斁鏃堕棿閰嶇疆淇℃伅澶辫触锛岄厤缃俊鎭細{JsonConvert.SerializeObject(overage)}", "GT"); - break; + db.Insertable(overage).ExecuteCommand(); } } - - if (result) - { - db.CommitTran(); - } - else - { - db.RollbackTran(); - } + db.CommitTran(); } catch (Exception ex) { LogHelper.Info($"鎵归噺鏇存柊鐗╂枡瀛樻斁鏃堕棿閰嶇疆淇℃伅閿欒锛岄敊璇俊鎭細{ex.Message}", "GT"); db.RollbackTran(); + result = false; } return result; } @@ -879,22 +871,26 @@ /// <returns></returns> public static Overage getOverage(string bc_entried) { - Overage overage = null; + var db = new SqlHelper<object>().GetInstance(); - overage = db.Queryable<Overage>().Where(a => a.ITEMPATT == bc_entried && a.MCNGRP == "1").First(); - if (overage == null) - { - string sub = bc_entried.Substring(0, 3); - overage = db.Queryable<Overage>().Where(a => a.ITEMPATT.Contains(sub) && a.MCNGRP == "1").First(); - } + // 鐩存帴鎵ц SQL锛堝弬鏁板寲鏌ヨ锛�+ var sql = "SELECT get_ovg_bar(@barcode, @mcngrp) AS overage_value"; + var sql1 = "SELECT get_minhour_bar(@barcode, @mcngrp) AS overage_value"; - if (overage == null) + // 浣跨敤鍖垮悕瀵硅薄浼犻�鍙傛暟 + var ovg_bar = db.Ado.SqlQuery<int>(sql, new { barcode = bc_entried, mcngrp = "1"}); + var minhour_bar = db.Ado.SqlQuery<float>(sql1, new { barcode = bc_entried, mcngrp = "1"}); + if (ovg_bar.Count > 0 && minhour_bar.Count > 0) { - string sub = bc_entried.Substring(0, 7); - overage = db.Queryable<Overage>().Where(a => a.ITEMPATT.Contains(sub) && a.MCNGRP == "1").First(); + Overage overage = new Overage() + { + MINHOUR = minhour_bar[0], + OVERAGE = ovg_bar[0] + }; + return overage; } - return overage; + return null; } /// <summary> @@ -909,7 +905,18 @@ try { db.BeginTran(); - result = db.Insertable(record).ExecuteCommand()> 0; + var synDataTimeRecord = db.Queryable<SynDataTimeRecord>().Where(a => a.S_SYN_TIME == record.S_SYN_TIME && a.RECORD_TABLE == record.RECORD_TABLE).First(); + if (synDataTimeRecord == null) + { + result = db.Insertable(record).ExecuteCommand() > 0; + } + else + { + synDataTimeRecord.N_SYN_NUM = record.N_SYN_NUM; + synDataTimeRecord.S_SYN_TIME = record.S_SYN_TIME; + result = db.Updateable(synDataTimeRecord).ExecuteCommand() > 0; + } + if (result) { db.CommitTran(); @@ -921,7 +928,7 @@ } catch (Exception ex) { - LogHelper.Info($"娣诲姞鍚屾鏁版嵁鏃堕棿璁板綍閿欒锛岄敊璇俊鎭細{ex.Message}", "GT"); + LogHelper.Info($"娣诲姞鏁版嵁鍚屾鏃堕棿璁板綍閿欒锛岄敊璇俊鎭細{ex.Message}", "GT"); db.RollbackTran(); } return result; diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/Program.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/Program.cs index 7a68f1a..6dfe32e 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/Program.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/Program.cs @@ -77,10 +77,11 @@ tasks.Add(GetTask(Monitor.MonitorMatlBarcode)); tasks.Add(GetTask(Monitor.MonitorMatlStatus)); + tasks.Add(GetTask(Monitor.MonitorMatlTimeConfig)); Task.WaitAll(tasks.ToArray()); } public void Stop() { Console.WriteLine("work stopped"); } - private Task GetTask(Action action) { + private Task GetTask(Action action ,int time = 3000) { var task = Task.Run(() => { while (true) { try { @@ -89,7 +90,7 @@ catch (Exception ex) { LogHelper.Error(ex.Message, ex); } - Thread.Sleep(3000); + Thread.Sleep(time); } }); return task; diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/ApiModel.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/ApiModel.cs index c17fd59..6b0054f 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/ApiModel.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/ApiModel.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using static HH.WCS.Mobox3.YNJT_BZP_GT.dispatch.WMSDispatch; namespace HH.WCS.Mobox3.YNJT_BZP_GT.api { /// <summary> @@ -16,7 +17,7 @@ public class ReturnResult { public int ResultCode { get; set; } public string ResultMsg { get; set; } - public object data { get; set; } + public SynDataTimeRecord data { get; set; } } /// <summary> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/WmsController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/WmsController.cs index fa60e1e..14e85d4 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/WmsController.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/api/WmsController.cs @@ -17,6 +17,6 @@ [RoutePrefix("api")] public class WmsController : System.Web.Http.ApiController { - + } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/core/Monitor.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/core/Monitor.cs index 133a1e4..5946676 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/core/Monitor.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/core/Monitor.cs @@ -40,13 +40,13 @@ if (synDataTimeRecord != null) { /* CultureInfo enGB = new CultureInfo("en-GB");*/ - var maltInformations = WMSHelper.getMaltInfoList(DateTime.Parse(synDataTimeRecord.RECORD_TABLE)); + var maltInformations = WMSHelper.getMaltInfoList(synDataTimeRecord.S_SYN_TIME); if (maltInformations != null && maltInformations.Count > 0) { bool bo = WMSDispatch.synMatlInformation(new SynMatlInformationModel() { matlInformationList = maltInformations }); if (bo) { - WMSDispatch.recordDataSynTime(new RecordDataSynTimeModel() { sysTime = maltInformations[0].last_modify_time.ToString("yyyy-MM-dd HH:mm:ss:ff"), synNum = maltInformations.Count, recordTable = "1" }); + WMSDispatch.recordDataSynTime(new RecordDataSynTimeModel() { sysTime = maltInformations[0].last_modify_time, synNum = maltInformations.Count, recordTable = "1" }); } } } @@ -72,14 +72,17 @@ if (synDataTimeRecord != null) { /* CultureInfo enGB = new CultureInfo("en-GB");*/ - var barcodeStatuses = WMSHelper.getMaltStatusList(DateTime.Parse(synDataTimeRecord.RECORD_TABLE)); + var barcodeStatuses = WMSHelper.getMaltStatusList(synDataTimeRecord.S_SYN_TIME); if (barcodeStatuses != null && barcodeStatuses.Count > 0) { var updateMatlStatuses = barcodeStatuses.Select(a => new UpdateMatlStatus {bc_entried = a.bc_entried ,jdge = a.jdge }).ToList(); - bool bo = WMSDispatch.synUpdateMatlStatus(new SynUpdateMatlStatusModel() { updateMatlStatuses = updateMatlStatuses }); - if (bo) + if (updateMatlStatuses.Count > 0) { - WMSDispatch.recordDataSynTime(new RecordDataSynTimeModel() { sysTime = barcodeStatuses[0].last_modify_time.ToString("yyyy-MM-dd HH:mm:ss:ff"), synNum = barcodeStatuses.Count, recordTable = "2" }); + bool bo = WMSDispatch.synUpdateMatlStatus(new SynUpdateMatlStatusModel() { updateMatlStatuses = updateMatlStatuses }); + if (bo) + { + WMSDispatch.recordDataSynTime(new RecordDataSynTimeModel() { sysTime = barcodeStatuses[0].last_modify_time, synNum = barcodeStatuses.Count, recordTable = "2" }); + } } } } @@ -91,11 +94,7 @@ } /// <summary> - /// 鍚屾鍗婂埗鍝佺墿鏂欑姸鎬�- /// 1.鏌ヨ涓婃璁板綍鏃堕棿 - /// 2.鏍规嵁璁板綍鏃堕棿锛屾煡璇㈠ぇ浜庣瓑浜庤褰曟椂闂达紝涓旂鍚堟潯浠剁殑鐗╂枡鐘舵�淇℃伅 - /// 3.灏嗙墿鏂欐潯鐮佷俊鎭悓姝ュ埌wms - /// 4.鍚屾鎴愬姛锛岃褰曟渶鍚庝竴鏉℃暟鎹殑鏇存柊鏃堕棿 + /// 鍚屾鍗婂埗鍝佺墿鏂欐椂闂撮厤缃� /// </summary> internal static void MonitorMatlTimeConfig() { @@ -105,13 +104,13 @@ if (synDataTimeRecord != null) { /* CultureInfo enGB = new CultureInfo("en-GB");*/ - var overages = WMSHelper.getOverageList(DateTime.Parse(synDataTimeRecord.RECORD_TABLE)); + var overages = WMSHelper.getOverageList(synDataTimeRecord.S_SYN_TIME); if (overages != null && overages.Count > 0) { bool bo = WMSDispatch.synUpdateMatlTimeConfig(new MatlTimeConfigModel() { overages = overages }); if (bo) { - WMSDispatch.recordDataSynTime(new RecordDataSynTimeModel() { sysTime = overages[0].last_modify_time.ToString("yyyy-MM-dd HH:mm:ss:ff"), synNum = overages.Count, recordTable = "3" }); + WMSDispatch.recordDataSynTime(new RecordDataSynTimeModel() { sysTime = overages[0].last_modify_time, synNum = overages.Count, recordTable = "3" }); } } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/dispatch/WMSDispatch.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/dispatch/WMSDispatch.cs index e95fd32..3ccc293 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/dispatch/WMSDispatch.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/dispatch/WMSDispatch.cs @@ -10,7 +10,7 @@ namespace HH.WCS.Mobox3.YNJT_BZP_GT.dispatch { - internal class WMSDispatch + public class WMSDispatch { private static readonly HttpHelper apiHelper = new HttpHelper(); private static readonly string baseUrl = Settings.WMSSeverUrl; @@ -187,7 +187,7 @@ var msg = ""; bool bo = false; var request = JsonConvert.SerializeObject(model); - var response = apiHelper.Post(baseUrl + "/api/Wms/recordDataSynTime", request); + var response = apiHelper.Post(baseUrl + "/api/Wms/synUpdateMatlTimeConfig", request); msg = $"[synUpdateMatlTimeConfig] request={request} response={response}"; Console.WriteLine(msg); LogHelper.Info(msg, "WMS"); @@ -227,7 +227,6 @@ public class SynDataTimeRecord { public string S_SYN_TIME { get; set; } // 鍚屾鏃堕棿 - public int N_SYN_NUM { get; set; } // 鍚屾鏁伴噺 public string RECORD_TABLE { get; set; } // 1.鐗╂枡鏉$爜璁板綍琛�2.鑳氳儙鏉$爜鐘舵�琛� } @@ -252,7 +251,7 @@ public class SynMatlInformationModel { - public List<MaltInformation> matlInformationList { get; set; } + public List<MatlInformation> matlInformationList { get; set; } } } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/MatlInformation.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/MatlInformation.cs index 9f435b1..fc0e282 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/MatlInformation.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/MatlInformation.cs @@ -10,8 +10,8 @@ /// <summary> /// GT 涓棿琛� /// </summary> - [SugarTable("malt_information")] - public class MaltInformation + [SugarTable("matl_information")] + public class MatlInformation { public string item { get; set; } // 浜у搧鏉愭枡鐨勭墿鍝佷唬鐮侊紙浠庢潯褰㈢爜鏁板瓧宸︿晶璧锋埅鍙栧墠10浣嶏級 public string bc_entried { get; set; } // 浜у搧鏉愭枡鐨勬潯褰㈢爜缂栧彿 @@ -28,6 +28,6 @@ public string bom3 { get; set; } public string fovrage { get; set; } // 鏄惁杩囨湡 鏄惁杩囨湡锛坣ull 鎴�绌�榛樿 鍚︼級 Y/N public string jdge { get; set; } // 璐ㄦ鐘舵� - public DateTime last_modify_time { get; set; } // 鏈�悗淇敼鏃堕棿 + public string last_modify_time { get; set; } // 鏈�悗淇敼鏃堕棿 } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/Overage.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/Overage.cs index a3410d3..d67fe4c 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/Overage.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/Overage.cs @@ -11,7 +11,7 @@ /// GT 涓棿琛紙鐗╂枡瀛樻斁鏃堕棿閰嶇疆琛級 /// </summary> [SugarTable("overage")] - internal class Overage + public class Overage { public string mcngrp { get; set; } // 鏈哄櫒缁勪唬鐮� mcn瀛楁 浠�RTE 鍓嶇紑=mcngrp瀛楁=1锛涘崐鍒跺搧 / mcn瀛楁 浠�RTB 鍓嶇紑=mcngrp瀛楁=0锛涚~鍖栨満 public string itempatt { get; set; } // 鐗╁搧妯″紡锛堝鏉$爜鍖归厤瑙勫垯锛�@@ -19,6 +19,6 @@ public decimal minhour { get; set; } // 鏈�皬宸ヤ綔鏃堕棿鎴栨潯浠� public string flag_sts { get; set; } // 鐘舵�鏍囪 public int recid { get; set; } - public DateTime last_modify_time { get; set; } + public string last_modify_time { get; set; } } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/TableOfBarcodeStatus.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/TableOfBarcodeStatus.cs index 7420b2d..f8056ba 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/TableOfBarcodeStatus.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/models/TableOfBarcodeStatus.cs @@ -15,7 +15,7 @@ { public string bc_entried { get; set; } public string descr { get; set; } - public DateTime bld_date { get; set; } + public string bld_date { get; set; } public string bld_mcn01 { get; set; } public string bld_mcn02 { get; set; } public string bld_shift { get; set; } @@ -23,15 +23,15 @@ public string bld_opr02 { get; set; } public string bld_opr03 { get; set; } public string bld_opr04 { get; set; } - public DateTime cur_in { get; set; } - public DateTime cur_out { get; set; } + public string cur_in { get; set; } + public string cur_out { get; set; } public string cur_shift { get; set; } public string cur_mcn { get; set; } public string lr_mcn { get; set; } public string cur_opr01 { get; set; } - public DateTime jdge_date { get; set; } + public string jdge_date { get; set; } public string jdge { get; set; } public string probcode { get; set; } - public DateTime last_modify_time { get; set; } + public string last_modify_time { get; set; } } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/wms/WMSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/wms/WMSHelper.cs index cb3b979..f412066 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/wms/WMSHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP_GT/wms/WMSHelper.cs @@ -797,10 +797,10 @@ /// </summary> /// <param name="lastTime"></param> /// <returns></returns> - public static List<MaltInformation> getMaltInfoList(DateTime lastTime) + public static List<MatlInformation> getMaltInfoList(string lastTime) { var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<MaltInformation>().Where( a => a.last_modify_time >= lastTime).OrderByDescending( a => a.last_modify_time).ToList(); + return db.Queryable<MatlInformation>().Where( a => DateTime.Parse(a.last_modify_time) >= DateTime.Parse(lastTime)).OrderByDescending( a => a.last_modify_time).ToList(); } /// <summary> @@ -808,16 +808,16 @@ /// </summary> /// <param name="lastTime"></param> /// <returns></returns> - public static List<TableOfBarcodeStatus> getMaltStatusList(DateTime lastTime) + public static List<TableOfBarcodeStatus> getMaltStatusList(string lastTime) { var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<TableOfBarcodeStatus>().Where(a => a.last_modify_time >= lastTime && a.bld_date == null).OrderByDescending(a => a.last_modify_time).ToList(); + return db.Queryable<TableOfBarcodeStatus>().Where(a => DateTime.Parse(a.last_modify_time) >= DateTime.Parse(lastTime) && a.bld_date == null).OrderByDescending(a => a.last_modify_time).ToList(); } - public static List<Overage> getOverageList(DateTime lastTime) + public static List<Overage> getOverageList(string lastTime) { var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<Overage>().Where(a => a.last_modify_time >= lastTime ).OrderByDescending(a => a.last_modify_time).ToList(); + return db.Queryable<Overage>().Where(a => DateTime.Parse(a.last_modify_time) >= DateTime.Parse(lastTime) ).OrderByDescending(a => a.last_modify_time).ToList(); } /// <summary> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/HH.WCS.Mobox3.YNJT_PT.csproj b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/HH.WCS.Mobox3.YNJT_PT.csproj index 835c958..20d55e1 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/HH.WCS.Mobox3.YNJT_PT.csproj +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/HH.WCS.Mobox3.YNJT_PT.csproj @@ -154,11 +154,14 @@ <Compile Include="core\Monitor.cs" /> <Compile Include="models\BaseModel.cs" /> <Compile Include="models\Area.cs" /> + <Compile Include="models\GreenTireInformation.cs" /> + <Compile Include="models\OffLineRecord.cs" /> <Compile Include="models\OI_WMS_OP_DEF.cs" /> <Compile Include="models\OI_WMS_SCHEDULE_TYPE.cs" /> <Compile Include="models\OI_WMS_TASK_TYPE.cs" /> <Compile Include="models\other\DayuanIn.cs" /> <Compile Include="models\other\DayuanOut.cs" /> + <Compile Include="models\Overage.cs" /> <Compile Include="models\PutawayDetail.cs" /> <Compile Include="models\PutawayOrder.cs" /> <Compile Include="models\TN_ASN_Detail.cs" /> @@ -220,6 +223,7 @@ <Compile Include="api\ApiHelper.cs" /> <Compile Include="dispatch\HostToAGV.cs" /> <Compile Include="process\TaskProcess.cs" /> + <Compile Include="util\ExcetionHelper.cs" /> <Compile Include="util\LogHelper.cs" /> <Compile Include="util\StrHelper.cs" /> <Compile Include="util\STAttribute.cs" /> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/Program.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/Program.cs index 5653862..86b5c90 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/Program.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/Program.cs @@ -59,15 +59,17 @@ }); } private static void StartTcp() { - Console.WriteLine("寮�惎tcp:" + Settings.listenAddress); - new TcpServer(Settings.listenAddress); - /*var host = Dns.GetHostEntry(Dns.GetHostName()); - foreach (var ip in host.AddressList) { - if (ip.AddressFamily == AddressFamily.InterNetwork) { + /* Console.WriteLine("寮�惎tcp:" + Settings.listenAddress); + new TcpServer(Settings.listenAddress);*/ + var host = Dns.GetHostEntry(Dns.GetHostName()); + foreach (var ip in host.AddressList) + { + if (ip.AddressFamily == AddressFamily.InterNetwork) + { Console.WriteLine($"ip= {ip.ToString()}"); new TcpServer(ip.ToString()); } - }*/ + } } public class WorkThread diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs index 03a5549..98b534f 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiHelper.cs @@ -1,10 +1,12 @@ 锘縰sing HH.WCS.Mobox3.YNJT_PT.device; +using HH.WCS.Mobox3.YNJT_PT.models; using HH.WCS.Mobox3.YNJT_PT.process; using HH.WCS.Mobox3.YNJT_PT.util; using HH.WCS.Mobox3.YNJT_PT.wms; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SqlSugar; +using Swashbuckle.Swagger; using System; using System.Collections.Generic; using System.Linq; @@ -12,6 +14,8 @@ using System.Threading; using static HH.WCS.Mobox3.YNJT_PT.api.ApiModel; using static HH.WCS.Mobox3.YNJT_PT.api.OtherModel; +using static HH.WCS.Mobox3.YNJT_PT.api.WmsController; +using static System.Net.Mime.MediaTypeNames; namespace HH.WCS.Mobox3.YNJT_PT.api { /// <summary> @@ -21,6 +25,404 @@ static ApiHelper() { } + + /// <summary> + /// 鎴愬瀷鏈轰笅绾胯褰�+ /// </summary> + /// <param name="model"></param> + public static ResponseResult cxjOffLineRecord(OffLineModel model) + { + ResponseResult response = new ResponseResult(); + var container = ContainerHelper.GetCntr(model.rfid); + var location = LocationHelper.GetLoc(model.loc); + if (location != null) + { + if (container == null) + { + ContainerHelper.AddCntr(model.rfid); + } + + try + { + OffLineRecord record = new OffLineRecord() + { + S_RFID = model.rfid, + S_LOC = model.loc, + N_IS_URGENT = model.isUrgent, + T_OFF_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + N_IS_FULL = model.isFull, + + }; + WMSHelper.addOffLineRecord(record); + } + catch (Exception ex) + { + LogHelper.Info($"娣诲姞鎴愬瀷鏈轰笅绾胯褰曢敊璇紝閿欒鍘熷洜锛歿ex.Message}", "WMS"); + response.code = 500; + response.msg = "WMS绯荤粺鍐呴儴閿欒锛岃鑱旂郴寮�彂浜哄憳鎺掓煡闂"; + } + } + else + { + response.code = 1; + response.msg = $"璐т綅锛歿model.loc}涓嶅瓨鍦�; + } + return response; + } + + /// <summary> + /// 涓嬬嚎璇锋眰 + /// </summary> + /// <returns></returns> + public static ResponseResult offLineRequest(NotifyDeviceSignalModel model) + { + ResponseResult response = new ResponseResult(); + var startLoc = LocationHelper.GetLoc(model.loc); + if (startLoc != null) + { + List<BarcodeModel> extData = model.extData; + int dataCount = extData.Count; + if (dataCount > 0) + { + var rfidExistNull = extData.Where(a => string.IsNullOrEmpty(a.rfid)).Count()>0; + if (rfidExistNull) + { + response.code = 1; + response.msg = "rfid涓嶈兘涓虹┖"; + } + else + { + Dictionary<BarcodeModel, bool> rfidDic = new Dictionary<BarcodeModel, bool>(); + foreach (var ext in extData) + { + string rfid = ext.rfid; + if (rfid.Contains("ET")) + { + rfidDic.Add(ext, false); + } + else + { + // 1.鏌ヨ鎴愬瀷鏈轰腑闂磋〃锛宺fid 鏄惁瀛樺湪 + var offLineRecord = WMSHelper.getOffLineRecord(rfid); + if (offLineRecord != null) + { + // 2.鏌ヨ鐗╂枡鏉$爜淇℃伅琛紝鏉$爜淇℃伅鏄惁瀛樺湪 + var itemBarcodeInfo = WMSHelper.GetGreenTireInformation(ext.barcode); + if (itemBarcodeInfo == null) + { + rfidDic.Add(ext, false); + } + else + { + rfidDic.Add(ext, true); + } + } + else + { + rfidDic.Add(ext, false); + } + } + } + + // 鍒ゆ柇鏄惁鏈夊紓甯告墭鐩�+ bool isNormal = rfidDic.Where(a => a.Value == false).Count() == 0; + if (isNormal && extData.Count == 2) + { + // 鍙屾墭姝e父鏂欏叆搴�+ Location endLoc = null; + var itemBarcodeInfo = WMSHelper.GetGreenTireInformation(extData[0].barcode); + string groupNo = WMSHelper.GenerateTaskGroupNo(); + var endLocList = WMSHelper.getInStockEndLoc(itemBarcodeInfo.ITEMCODE, 2); + if (endLocList.Count == 2) + { + var rfidList = rfidDic.Keys.ToList(); + for (int i = 0; i < rfidList.Count; i++) + { + endLoc = endLocList[i]; + var wmsTask = new WMSTask() + { + S_CNTR_CODE = rfidList[i].rfid, + S_CODE = WMSHelper.GenerateTaskNo(), + S_START_LOC = startLoc.S_CODE, + S_START_AREA = startLoc.S_AREA_CODE, + S_END_LOC = endLoc.S_CODE, + S_END_AREA = endLoc.S_AREA_CODE, + S_TYPE = "婊℃枡涓嬬嚎鍏ュ簱浠诲姟", + S_OP_DEF_CODE = model.reqId, + S_OP_DEF_NAME = "鎴愬瀷鏈烘弧鏂欎笅绾垮叆搴�, + N_PRIORITY = 1, + T_START_TIME = DateTime.Now, + S_GROUP_NO = groupNo, + }; + if (WMSHelper.CreateWmsTask(wmsTask)) + { + // 鍒涘缓涓�鍏ュ簱浠诲姟 + WCSTask wcsTask = new WCSTask() + { + S_OP_NAME = wmsTask.S_OP_DEF_NAME, + S_OP_CODE = wmsTask.S_CODE, + S_CODE = WCSHelper.GenerateTaskNo(), + S_CNTR_CODE = wmsTask.S_CNTR_CODE, + S_TYPE = wmsTask.S_TYPE, + S_START_LOC = startLoc.S_CODE, + S_START_AREA = startLoc.S_AREA_CODE, + S_END_LOC = endLoc.S_CODE, + S_END_AREA = endLoc.S_AREA_CODE, + S_SCHEDULE_TYPE = "WCS", + N_PRIORITY = 1, + T_START_TIME = DateTime.Now, + }; + + if (WCSHelper.CreateTask(wcsTask)) + { + // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�+ LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); + LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); + + // 鏇存柊浣滀笟浠诲姟鐘舵� + wmsTask.N_B_STATE = 1; + WMSHelper.UpdateTaskState(wmsTask); + + // 缁戝畾瀹瑰櫒鐗╂枡淇℃伅 + WMSHelper.bindBarcodeItemInfo(wmsTask.S_CNTR_CODE,itemBarcodeInfo); + } + } + } + } + else + { + response.code = 1; + response.msg = "搴撳尯娌℃湁鍙叆鐨勭┖璐т綅"; + } + } + else + { + // 寮傚父鏂欏嚭搴撴淇�鎴�鍗曟嫋鐗╂枡鍏ュ簱 + foreach (var dic in rfidDic) + { + Location middleLoc = null; + Location endLoc = null; + if (dic.Value) + { + var itemBarcodeInfo = WMSHelper.GetGreenTireInformation(dic.Key.barcode); + var endLocList = WMSHelper.getInStockEndLoc(itemBarcodeInfo.ITEMCODE, 1); + if (endLocList.Count == 1) + { + endLoc = endLocList[0]; + var wmsTask = new WMSTask() + { + S_CNTR_CODE = dic.Key.rfid, + S_CODE = WMSHelper.GenerateTaskNo(), + S_START_LOC = startLoc.S_CODE, + S_START_AREA = startLoc.S_AREA_CODE, + S_END_LOC = endLoc.S_CODE, + S_END_AREA = endLoc.S_AREA_CODE, + S_TYPE = "婊℃枡涓嬬嚎鍏ュ簱浠诲姟", + S_OP_DEF_CODE = model.reqId, + S_OP_DEF_NAME = "鎴愬瀷鏈烘弧鏂欎笅绾垮叆搴�, + N_PRIORITY = 1, + T_START_TIME = DateTime.Now, + }; + if (WMSHelper.CreateWmsTask(wmsTask)) + { + // 鍒涘缓涓�鍏ュ簱浠诲姟 + WCSTask wcsTask = new WCSTask() + { + S_OP_NAME = wmsTask.S_OP_DEF_NAME, + S_OP_CODE = wmsTask.S_CODE, + S_CODE = WCSHelper.GenerateTaskNo(), + S_CNTR_CODE = wmsTask.S_CNTR_CODE, + S_TYPE = wmsTask.S_TYPE, + S_START_LOC = startLoc.S_CODE, + S_START_AREA = startLoc.S_AREA_CODE, + S_END_LOC = endLoc.S_CODE, + S_END_AREA = endLoc.S_AREA_CODE, + S_SCHEDULE_TYPE = "WCS", + N_PRIORITY = 1, + T_START_TIME = DateTime.Now, + }; + + if (WCSHelper.CreateTask(wcsTask)) + { + // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�+ LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); + LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); + + // 鏇存柊浣滀笟浠诲姟鐘舵� + wmsTask.N_B_STATE = 1; + WMSHelper.UpdateTaskState(wmsTask); + + // 缁戝畾瀹瑰櫒鐗╂枡淇℃伅 + WMSHelper.bindBarcodeItemInfo(wmsTask.S_CNTR_CODE, itemBarcodeInfo); + } + } + } + else + { + response.code = 1; + response.msg = "搴撳尯娌℃湁鍙叆鐨勭┖璐т綅"; + } + } + else + { + middleLoc = WMSHelper.getMinTaskMiddleLoc(1); // 1.寮傚父鎺掑嚭浣�+ endLoc = WMSHelper.getAbnormalAreaEmptyLoc(Settings.abnormalArea); + var wmsTask = new WMSTask() + { + S_CNTR_CODE = dic.Key.rfid, + S_CODE = WMSHelper.GenerateTaskNo(), + S_START_LOC = startLoc.S_CODE, + S_START_AREA = startLoc.S_AREA_CODE, + S_END_LOC = endLoc.S_CODE, + S_END_AREA = endLoc.S_AREA_CODE, + S_TYPE = "寮傚父鎵樼洏鍑哄簱浠诲姟", + S_OP_DEF_CODE = model.reqId, + S_OP_DEF_NAME = "寮傚父鎵樼洏鍑哄簱妫�慨", + N_PRIORITY = 1, + T_START_TIME = DateTime.Now, + }; + if (WMSHelper.CreateWmsTask(wmsTask)) + { + // 鍒涘缓涓�鍏ュ簱浠诲姟 + WCSTask wcsTask = new WCSTask() + { + S_OP_NAME = wmsTask.S_OP_DEF_NAME, + S_OP_CODE = wmsTask.S_CODE, + S_CODE = WCSHelper.GenerateTaskNo(), + S_CNTR_CODE = wmsTask.S_CNTR_CODE, + S_TYPE = wmsTask.S_TYPE, + S_START_LOC = startLoc.S_CODE, + S_START_AREA = startLoc.S_AREA_CODE, + S_END_LOC = middleLoc.S_CODE, + S_END_AREA = middleLoc.S_AREA_CODE, + S_SCHEDULE_TYPE = "WCS", + N_PRIORITY = 1, + T_START_TIME = DateTime.Now, + }; + + if (WCSHelper.CreateTask(wcsTask)) + { + // 璧风偣銆佹帴椹崇偣銆佺粓鐐瑰姞閿�+ LocationHelper.LockLoc(wcsTask.S_START_LOC, 2); + LocationHelper.LockLoc(wcsTask.S_END_LOC, 1); + + // 鏇存柊浣滀笟浠诲姟鐘舵� + wmsTask.N_B_STATE = 1; + WMSHelper.UpdateTaskState(wmsTask); + } + } + } + } + } + } + } + else + { + response.code = 1; + response.msg = "鍏ュ弬缂哄皯鎵樼洏鍜屾潯鐮佷俊鎭�; + } + } + else + { + response.code = 1; + response.msg = "璧风偣璐т綅涓嶅瓨鍦�; + } + return response; + } + + /// <summary> + /// 璇荤爜璇锋眰 + /// </summary> + public static ResponseResult readCodeRequest(NotifyDeviceSignalModel model) + { + ResponseResult response = new ResponseResult(); + readCodeFeedbackResponse readCodeFeedbackResponse = new readCodeFeedbackResponse() + { + verifyResult = true + }; + var wmsTask = WMSHelper.GetWmsTask(model.taskNo); + if (wmsTask != null) + { + if (wmsTask.S_TYPE != "寮傚父鎵樼洏鍑哄簱浠诲姟") + { + Location endLoc = null; + Location middleLoc = null; + // 鍒ゆ柇rfid鏄惁寮傚父 + if (model.cntrNo != wmsTask.S_CNTR_CODE) + { + middleLoc = WMSHelper.getMinTaskMiddleLoc(1); // 1.寮傚父鎺掑嚭浣�+ endLoc = WMSHelper.getAbnormalAreaEmptyLoc(Settings.abnormalArea); + wmsTask.S_END_LOC = endLoc.S_CODE; + wmsTask.S_END_AREA = endLoc.S_AREA_CODE; + WMSHelper.UpdateTaskEnd(wmsTask); + + var wcsTask = WCSHelper.GetTaskBySrcNo(wmsTask.S_CODE); + if (wcsTask != null) + { + wcsTask.S_END_LOC = middleLoc.S_CODE; + wcsTask.S_END_AREA = middleLoc.S_AREA_CODE; + WCSHelper.updateTaskEnd(wcsTask); + } + + readCodeFeedbackResponse.verifyResult = false; + readCodeFeedbackResponse.endLoc = middleLoc.S_CODE; + response.data = readCodeFeedbackResponse; + } + else + { + var cntrItemRels = ContainerHelper.GetCntrItemRel(wmsTask.S_CNTR_CODE); + if (cntrItemRels.Count > 0) + { + if (cntrItemRels[0].S_ITEM_STATE != "OK") + { + middleLoc = WMSHelper.getMinTaskMiddleLoc(1); // 1.寮傚父鎺掑嚭浣�+ endLoc = WMSHelper.getAbnormalAreaEmptyLoc(Settings.abnormalArea); + wmsTask.S_END_LOC = endLoc.S_CODE; + wmsTask.S_END_AREA = endLoc.S_AREA_CODE; + WMSHelper.UpdateTaskEnd(wmsTask); + + var wcsTask = WCSHelper.GetTaskBySrcNo(wmsTask.S_CODE); + if (wcsTask != null) + { + wcsTask.S_END_LOC = middleLoc.S_CODE; + wcsTask.S_END_AREA = middleLoc.S_AREA_CODE; + WCSHelper.updateTaskEnd(wcsTask); + } + + readCodeFeedbackResponse.verifyResult = false; + readCodeFeedbackResponse.endLoc = middleLoc.S_CODE; + response.data = readCodeFeedbackResponse; + } + } + } + } + } + else + { + response.code = 1; + response.msg = $"浠诲姟鍙凤細{model.taskNo},鏈煡璇㈠埌鎵ц涓殑浠诲姟"; + } + response.data = readCodeFeedbackResponse; + return response; + } + + /// <summary> + /// 纭寲鏈哄懠鍙儦鑳庡嚭搴�+ /// </summary> + /// <param name="model"></param> + public static ResponseResult callItemOutStock(CallItemModel model) + { + ResponseResult response = new ResponseResult(); + + return response; + } + + public class readCodeFeedbackResponse + { + public bool verifyResult { get; set; } + public string endLoc { get; set; } + } + /// <summary> /// 鍒涘缓浠诲姟 /// </summary> @@ -118,117 +520,6 @@ cacheInstockInfos.Add(pair); } } - - - internal static object in_lock = new object(); - - /// <summary> - /// pad鍏ュ簱 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - internal static SimpleResult Instock(InstockInfo model) { - var result = new SimpleResult(); - //pda鍏ュ簱 - //1 鍒ゆ柇璧风偣鏈夋病鏈変换鍔★紝鏈夋病鏈夊叆搴撻攣 - lock (in_lock) { - var loc = LocationHelper.GetLoc(model.start); - if (loc != null && loc.N_LOCK_STATE == 0) - { - //2 鏍规嵁缁堢偣搴撳尯璁$畻缁堢偣 - var end = WMSHelper.GetInstockEnd(model.item, model.endArea); - LogHelper.Info("缁堢偣璐т綅锛� + JsonConvert.SerializeObject(end), "TSSG"); - if (end != null) - { - var cntrCode = ContainerHelper.GenerateCntrNo(); - var wcsTask = new WCSTask - { - S_OP_NAME = "鍏ュ簱", - S_CODE = WCSHelper.GenerateTaskNo(), - S_TYPE = "涓嬬嚎鍏ュ簱", - S_START_LOC = model.start, - S_END_LOC = end.S_CODE, - S_SCHEDULE_TYPE = "NDC", - N_CNTR_COUNT = 1, - S_CNTR_CODE = cntrCode, - N_START_LAYER = 1, - N_END_LAYER = end.N_CURRENT_NUM + 1 - }; - if (ContainerHelper.BindNewCntrItem(model.start, cntrCode, model.item) && WCSHelper.CreateTask(wcsTask)) - { - LocationHelper.LockLoc(model.start, 2); - LocationHelper.LockLoc(end.S_CODE, 1); - result.resultCode = 0; - result.resultMsg = $"浠诲姟鍒涘缓鎴愬姛,浠诲姟鍙蜂负{wcsTask.S_CODE},缁堢偣涓簕end.S_CODE}"; - } - } - else - { - addKeyValuePair(model.ip, model); - LogHelper.Info("缂撳瓨鍏ュ簱淇℃伅锛� + JsonConvert.SerializeObject(model), "TSSG"); - result.resultCode = 2; - result.resultMsg = "鏈幏鍙栧埌鍏ュ簱缁堢偣"; - } - } - else - { - result.resultCode = 1; - result.resultMsg = "璧风偣鏈変换鍔℃湭瀹屾垚"; - } - } - return result; - } - - /// <summary> - /// 绉诲簱 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - internal static SimpleResult shiftStock(ShiftStockInfo model) - { - var result = new SimpleResult(); - //1 鏍规嵁璧风偣搴撳尯銆佹帓 纭畾璧峰璐т綅 - var startLoc = WMSHelper.GetShiftStockStart(model.startArea, model.startRow); - if (startLoc != null && startLoc.N_LOCK_STATE == 0) - { - //2 鏍规嵁缁堢偣搴撳尯璁$畻缁堢偣 - var end = WMSHelper.GetShiftStockEnd( model.endArea, model.endRow); - if (end != null && end.N_LOCK_STATE == 0) - { - var wcsTask = new WCSTask - { - S_OP_NAME = "绉诲簱", - S_CODE = WCSHelper.GenerateTaskNo(), - S_TYPE = "绉诲簱", - S_START_LOC = startLoc.S_CODE, - S_END_LOC = end.S_CODE, - S_SCHEDULE_TYPE = "NDC", - N_CNTR_COUNT = 1, - S_CNTR_CODE = startLoc.LocCntrRel.S_CNTR_CODE, - N_START_LAYER = startLoc.N_CURRENT_NUM, - N_END_LAYER = end.N_CURRENT_NUM + 1 - }; - if (WCSHelper.CreateTask(wcsTask)) - { - LocationHelper.LockLoc(startLoc.S_CODE, 2); - LocationHelper.LockLoc(end.S_CODE, 1); - result.resultCode = 0; - result.resultMsg = $"浠诲姟鍒涘缓鎴愬姛,浠诲姟鍙蜂负{wcsTask.S_CODE},缁堢偣涓簕end.S_CODE}"; - } - } - else - { - result.resultCode = 2; - result.resultMsg = "缁堢偣搴撳尯娌℃湁鍙叆鐨勮揣浣�; - } - } - else - { - result.resultCode = 1; - result.resultMsg = "鏈壘鍒版寚瀹氱墿鏂�; - } - return result; - } internal static CodeInfo GetCodeInfo(string code, string org) { //return new CodeInfo { Fitemid_XK=code, FSourceNo="123456"}; @@ -258,43 +549,16 @@ public static void agvCarAlarm(string forkliftNo, string errCode , string errCode2 , string failCode) { bool turnLight = false; - var errCodeList = Settings.agvAlarmNoList.Where(a => a.type == 1).Select(a => a.dex).ToList(); - var errCode2List = Settings.agvAlarmNoList.Where(a => a.type == 2).Select(a => a.dex).ToList(); - var failCodeList = Settings.agvAlarmNoList.Where(a => a.type == 3).Select(a => a.dex).ToList(); - - if (errCodeList.Contains(int.Parse(errCode))) - { - turnLight = true; - LogHelper.Info("StopWord 閿欒鐮侊細" + errCode, "HosttoagvCar"); - } - if (errCode2List.Contains(int.Parse(errCode2))) - { - turnLight = true; - LogHelper.Info("StopWord2 閿欒鐮侊細" + errCode2, "HosttoagvCar"); - } - if (failCodeList.Contains(int.Parse(failCode))) - { - turnLight = true; - LogHelper.Info("failCode 閿欒鐮侊細" + failCode, "HosttoagvCar"); - } - - var alertorDevices = Settings.alertorLightInfos.Where(a => a.deviceNo == 5 || a.deviceNo == 6).ToList(); - foreach (var alertorDevice in alertorDevices) - { - if (turnLight) - { - var result = HH.WCS.Mobox3.YNJT_PT.device.PlcHelper.SendHex(alertorDevice.address, alertorDevice.turnLight); - LogHelper.Info("寮�伅锛宮odbus 杩斿洖淇″彿锛� + result, "HosttoagvCar"); - } - /*else - { - var result = HH.WCS.Mobox3.YNJT_PT.device.PlcHelper.SendHex(alertorDevice.address, alertorDevice.offLight); - LogHelper.Info("鍏崇伅锛宮odbus 杩斿洖淇″彿锛� + result, "HosttoagvCar"); - }*/ - } + } - + public class OffLineModel + { + public string rfid { get; set; } // 鎵樼洏鍙�+ public string loc { get; set; } // 涓嬬嚎璐т綅 + public int isUrgent { get; set; } // N_IS_URGENT 鏄惁鍔犳�锛�.鍚�1.鏄級 + public int isFull { get; set; } // 鏄惁婊℃嫋 0.鍚�1.鏄�+ } public class AddTaskModel { public string From { get; set; } public string To { get; set; } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiModel.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiModel.cs index b970b4e..66bd3f1 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiModel.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/ApiModel.cs @@ -18,6 +18,13 @@ public string ResultMsg { get; set; } } + + public class ResponseResult { + public int code { get; set; } = 0; + public string msg { get; set; } + public object data { get; set; } + } + /// <summary> /// hosttoagv涓婃姤浠诲姟鐘舵� /// </summary> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/MoboxController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/MoboxController.cs index ae356b5..8823cb0 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/MoboxController.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/MoboxController.cs @@ -130,53 +130,9 @@ } - /// <summary> - /// 鏁存帓瑙g粦 - /// </summary> - /// <returns></returns> - public SimpleResult RowUnbind(RowUnbindInfo model) { - LogHelper.Info("RowUnbind Request锛� + JsonConvert.SerializeObject(model), "TSSG"); - SimpleResult result = new SimpleResult(); - List<Location> locations = WMSHelper.GetLocationList(model.area, model.row); - foreach (var item in locations) - { - //璐т綅瑙i攣 - LocationHelper.UnLockLoc(item.S_CODE); + - //璐т綅瀹瑰櫒瑙g粦 - var db = new SqlHelper<object>().GetInstance(); - var lcrList = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE == item.S_CODE).Select(s => s.S_CNTR_CODE).ToList(); - LocationHelper.UnBindingLoc(item.S_CODE, lcrList); - - } - LogHelper.Info("RowUnbind response锛� + JsonConvert.SerializeObject(model), "TSSG"); - return result; - } - - /// <summary> - /// pda鍏ュ簱鐢宠 - /// </summary> - /// <param name="model"></param> - /// <returns></returns> - public SimpleResult Instock(InstockInfo model) { - var result = new SimpleResult(); - LogHelper.Info("Instock Request锛� + JsonConvert.SerializeObject(model), "TSSG"); - result = ApiHelper.Instock(model); - LogHelper.Info("Instock response锛� + JsonConvert.SerializeObject(result), "TSSG"); - return result; - } - - /// <summary> - /// pda绉诲簱鐢宠 - /// </summary> - /// <returns></returns> - public SimpleResult shiftStock(ShiftStockInfo model) { - var result = new SimpleResult(); - LogHelper.Info("shiftStock Request锛� + JsonConvert.SerializeObject(model), "TSSG"); - result = ApiHelper.shiftStock(model); - LogHelper.Info("shiftStock response锛� + JsonConvert.SerializeObject(result), "TSSG"); - return result; - } + } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/WmsController.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/WmsController.cs index 622c185..3075273 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/WmsController.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/api/WmsController.cs @@ -2,11 +2,12 @@ using HH.WCS.Mobox3.YNJT_PT.dispatch; using HH.WCS.Mobox3.YNJT_PT.wms; using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Web.Http; using static HH.WCS.Mobox3.YNJT_PT.api.ApiHelper; using static HH.WCS.Mobox3.YNJT_PT.api.ApiModel; -using static HH.WCS.Mobox3.YNJT_PT.api.OtherModel; +using static HH.WCS.Mobox3.YNJT_PT.util.ExcetionHelper; namespace HH.WCS.Mobox3.YNJT_PT.api { @@ -17,6 +18,132 @@ public class WmsController : System.Web.Http.ApiController { - + /// <summary> + /// 1.鎴愬瀷鏈轰笅绾胯褰�+ /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public ResponseResult cxjOffLineRecord(OffLineModel model) + { + LogHelper.Info("銆�.鎴愬瀷鏈轰笅绾胯褰曘�Request锛� + JsonConvert.SerializeObject(model), "WMS"); + var result = ApiHelper.cxjOffLineRecord(model); + LogHelper.Info("銆�.鎴愬瀷鏈轰笅绾胯褰曘�response锛� + JsonConvert.SerializeObject(result), "WMS"); + return result; + } + + /// <summary> + /// 2.璁惧淇″彿鍙嶉 + /// 涓氬姟鍦烘櫙锛歐CS鍙嶉鎴愬瀷鏈鸿儦鑳庝笅绾垮叆搴撲俊鍙凤紙娉細蹇呴』涓ゆ墭涓�捣涓婃姤锛屾病鏈変袱鎵橈紝鍒欒ˉ鍏呬竴涓┖鎵橈級 + /// 閫昏緫锛�+ /// 1.鏌ヨ鎴愬瀷鏈轰笅绾胯褰曡〃锛屽垽鏂璕FID鏄惁瀛樺湪锛岀姸鎬佹槸鍚K锛屼笉瀛樺湪鎴朜G寮傚父鎺掑嚭 + /// 2.鏌ヨ鐗╂枡鏉$爜淇℃伅琛紙green_tire_information锛夛紝淇濆瓨鑳氳儙淇℃伅 + /// 3.寮�璁$畻缁堢偣锛岀敓鎴愪换鍔�+ /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public ResponseResult notifyDeviceSignal(NotifyDeviceSignalModel model) + { + LogHelper.Info("銆�.璁惧淇″彿鍙嶉銆憂otifyDeviceSignal 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); + ResponseResult responseResult = new ResponseResult(); + try + { + if (model.signalType == 1) + { + responseResult = ApiHelper.offLineRequest(model); + } + else if(model.signalType == 3) + { + responseResult = ApiHelper.readCodeRequest(model); + } + } + catch (BusinessException be) + { + responseResult.code = 501; + responseResult.msg = be.Message; + } + catch (Exception ex) + { + LogHelper.Info($"WMS鍐呴儴閿欒,閿欒鍘熷洜锛歿ex.Message}", "WMS"); + responseResult.code = 500; + responseResult.msg = $"WMS鍐呴儴閿欒锛岃鑱旂郴寮�彂浜哄憳澶勭悊"; + } + LogHelper.Info("銆�.璁惧淇″彿鍙嶉銆憂otifyDeviceSignal 鍑哄弬锛� + JsonConvert.SerializeObject(responseResult), "WMS"); + return responseResult; + } + + /// <summary> + /// 3.纭寲鏈哄懠鍙儦鑳庡嚭搴�+ /// 閫昏緫锛�+ /// 1.鏍规嵁鏈哄彴鍙锋煡璇€�纭寲鏈哄伐鍗曡〃銆戙�銆愯儦鑳庡凡瀹屾垚鐨勬潯鐮佷腑闂磋〃銆戠瓫閫夊綋鍓嶇彮娆$殑鐢熶骇璁″垝鏁伴噺鏄惁婊¤冻锛屽綋棰勮鐢熶骇鏁伴噺 = 瀹為檯鏁�鍦ㄩ�鏁伴噺 锛屽垯鍋滄鍙枡 + /// 2.鏌ヨ鏈哄彴鍙峰湪銆愮~鍖栨満宸ュ崟琛ㄣ�瀵瑰簲鐨勭墿鏂欑紪鐮侊紝 + /// 寮�璁$畻锛�.宸烽亾涓嶆姤璀︺�2.鐗╂枡鐘舵�OK銆�.灏忎簬澶辨晥鏃堕棿 澶т簬绛変簬鐢熸晥鏃堕棿 4.鍔犳�鏂欏厛鍑恒�5.鍏堝叆鍏堝嚭锛堢敓浜ф椂闂达級锛夊嚭搴撶墿鏂欙紝鐢熸垚浠诲姟 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + public ResponseResult callItemOutStock(CallItemModel model ) + { + LogHelper.Info("銆�.纭寲鏈哄懠鍙儦鑳庡嚭搴撱�callItemOutStock 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); + ResponseResult responseResult = new ResponseResult(); + responseResult = ApiHelper.callItemOutStock(model); + LogHelper.Info("銆�.纭寲鏈哄懠鍙儦鑳庡嚭搴撱�callItemOutStock 鍑哄弬锛� + JsonConvert.SerializeObject(responseResult), "WMS"); + return responseResult; + } + + public class CallItemModel + { + public string mcn { get; set; } + public List<string> locCodes { get; set; } + } + + public class NotifyDeviceSignalModel + { + public string reqId { get; set; } + public string reqTime { get; set; } + public string loc { get; set; } + public string taskNo { get; set; } + public string cntrNo { get; set; } + public int signalType { get; set; } + public List<BarcodeModel> extData { get; set; } + public string deviceNo { get; set; } + } + + public class BarcodeModel + { + public string rfid { get; set; } + public string barcode { get; set; } + } + + /* /// <summary> + /// 3.浠诲姟鐘舵�鍙嶉 + /// 涓氬姟鍦烘櫙锛歐CS鍦ㄦ墽琛屼换鍔℃椂锛屽洖鎶ヤ换鍔$姸鎬�+ /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + *//*[Route("notifyTaskStatus")]*//* + public ResponseResult notifyTaskStatus(TaskStatusFeedbackModel model) + { + LogHelper.Info("notifyTaskStatus 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); + var result = ApiHelper.taskStatusFeedback(model); + LogHelper.Info("notifyTaskStatus 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); + return result; + } + + /// <summary> + /// 3.鐢宠缁堢偣 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + *//* [Route("applyDest")]*//* + public ResponseResult applyDest(ApplyDestinationModel model) + { + LogHelper.Info("applyDest 鍏ュ弬锛� + JsonConvert.SerializeObject(model), "WMS"); + var result = ApiHelper.applyDest(model); + LogHelper.Info("applyDest 鍑哄弬锛� + JsonConvert.SerializeObject(result), "WMS"); + return result; + }*/ } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/config/config.json b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/config/config.json index ee64a7d..87c9767 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/config/config.json +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/config/config.json @@ -6,221 +6,20 @@ "ApiPort": 8901, "FacCode": "1122", "WHCode": "TSCK", - "DeviceInfo": [ - { - "address": "192.168.1.160", - "deviceName": "1鍙蜂笅绾垮彛", - "deviceNo": [], - "location": [ "TSSG-XXK-1" ], - "deviceType": 1, - "enable": 1 - }, - { - "address": "192.168.1.161", - "deviceName": "2鍙蜂笅绾垮彛", - "deviceNo": [], - "location": [ "TSSG-XXK-2" ], - "deviceType": 1, - "enable": 1 - } - ], - "ListenAddress": "127.0.0.1", - "AlertorLightDevice": [ - { - "deviceNo": 1, - "address": "192.168.1.50", - "turnLight": "01 06 00 10 01 03 C9 9E", - "offLight": "01 06 00 10 04 00 8A CF" - }, - { - "deviceNo": 2, - "address": "192.168.1.51", - "turnLight": "02 06 00 10 01 03 C9 AD", - "offLight": "02 06 00 10 04 00 8A FC" + "StockArea": "area2", + "AbnormalArea": "area1", // 寮傚父鍖� + // 鎺ラ┏浣�type 1.鎺掑嚭鍙�+ "ConnectLoc": [ + { + "locCode": "loc1", + "roadway": 1, + "type": 1 }, { - "deviceNo": 3, - "address": "192.168.1.52", - "turnLight": "03 06 00 10 01 03 C8 7C", - "offLight": "03 06 00 10 04 00 8B 2D" - }, - { - "deviceNo": 4, - "address": "192.168.1.53", - "turnLight": "04 06 00 10 01 03 C9 CB", - "offLight": "04 06 00 10 04 00 8A 9A" - }, - { - "deviceNo": 5, - "address": "192.168.1.160", - "turnLight": "3F 00 50 0D 0A", - "offLight": "3F 00 12 22 0D 0A" - }, - { - "deviceNo": 6, - "address": "192.168.1.161", - "turnLight": "3F 00 50 0D 0A", - "offLight": "3F 00 12 22 0D 0A" + "locCode": "loc1", + "roadway": 2, + "type": 1 } - ], - // type 1銆乻topWord 2銆乻topWord2 3銆乫ailCode - "AgvAlarmNo": [ - { - "type": 1, - "dex": 16, - "code": "StopStartDelay", - "name": "鎬ュ仠澶嶄綅" - }, - { - "type": 1, - "dex": 32, - "code": "StopBumper", - "name": "瑙﹁竟瑙﹀彂" - }, - { - "type": 1, - "dex": 512, - "code": "StopRear", - "name": "鍙夊皷鍏夌數瑙﹀彂" - }, - { - "type": 1, - "dex": 2048, - "code": "StopAdjustHeightErro", - "name": "瑙嗚璋冩暣楂樺害鏁版嵁寮傚父" - }, - { - "type": 2, - "dex": 2, - "code": "StopNoOpCode", - "name": "娌℃湁浣滀笟浠g爜" - }, - { - "type": 2, - "dex": 4, - "code": "StopFailCode", - "name": "浣滀笟澶辫触" - }, - { - "type": 2, - "dex": 8, - "code": "StopLoadDroppedWhileUnloading", - "name": "璐х墿鎺夎惤" - }, - { - "type": 2, - "dex": 16, - "code": "StopLoadOp", - "name": "鍙栬揣澶辫触" - }, - { - "type": 2, - "dex": 256, - "code": "StopEstopButton", - "name": "鎬ュ仠鎸夐挳瑙﹀彂" - }, - { - "type": 2, - "dex": 8192, - "code": "StopDelay", - "name": "浣滀笟绛夊緟" - }, - { - "type": 2, - "dex": 32768, - "code": "StopACS5_OT", - "name": "琛岃蛋鐢垫満杩囨俯" - }, - { - "type": 2, - "dex": 65536, - "code": "StopACS7_OT", - "name": "娌规车鐢垫満杩囨俯" - }, - { - "type": 2, - "dex": 131072, - "code": "StopACS5_OC", - "name": "琛岃蛋鐢垫満杩囨祦" - }, - { - "type": 2, - "dex": 262144, - "code": "StopACS7_FwOC", - "name": "娌规车鐢垫満涓婂崌杩囨祦" - }, - { - "type": 2, - "dex": 524288, - "code": "StopACS7_UpOC", - "name": "娌规车鐢垫満涓嬮檷杩囨祦" - }, - { - "type": 2, - "dex": 1048576, - "code": "StopACD6_OT", - "name": "杞悜鐢垫満杩囨俯" - }, - { - "type": 2, - "dex": 2097152, - "code": "StopCyclePower", - "name": "寰幆鐢垫簮" - }, - { - "type": 2, - "dex": 16777216, - "code": "StopCameraError", - "name": "鐩告満鎷嶇収澶辫触" - }, - { - "type": 3, - "dex": 32, - "code": "FailCode_STNIsEmpty ", - "name": "鍙栬揣鏃舵湭妫�祴鍒拌揣鐗� - }, - { - "type": 3, - "dex": 256, - "code": "FailCode_ForkError ", - "name": "璐у弶楂樺害寮傚父" - }, - { - "type": 3, - "dex": 1024, - "code": "FailCode_NoOpCode ", - "name": "娌℃湁浣滀笟浠g爜" - }, - { - "type": 3, - "dex": 2048, - "code": "FailCode_LoadForkOrderError ", - "name": "璐у弶娌℃湁鑾峰彇浣滀笟浠g爜" - }, - { - "type": 3, - "dex": 4096, - "code": "FailCode_ChargeError ", - "name": "鍏呯數澶辫触" - }, - { - "type": 3, - "dex": 8192, - "code": "FailCode_Goods_OverWide ", - "name": "鍘嬪姏浼犳劅鍣ㄥ紓甯� - }, - { - "type": 3, - "dex": 16384, - "code": "FailCode_VisualIdentity_Err ", - "name": "瑙嗚鏁版嵁瓒呮椂浣滀笟澶辫触" - } - ], - - // 瀛樺偍淇″彿绛夊緟鏃堕棿锛堝崟浣�鍒嗛挓锛�- "WaitTime": 5, - // 缂撳瓨搴撳尯 - "BufferArea": "" - + ] } \ No newline at end of file diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/Monitor.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/Monitor.cs index 15e3d1d..63a691a 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/Monitor.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/Monitor.cs @@ -31,177 +31,8 @@ } - internal static void CheckOutWork() { - //璇昏嚜宸辩殑涓棿琛紝鎴戜滑鑷繁鐨勮〃鏈夎〃鏈変釜瀛楁璁℃暟锛岃鏁板皬浜庢渶澶у�锛岀户缁嚭搴擄紝涓�鐢熸垚涓�潯浠诲姟 - } - - - /// <summary> - /// 寰呭畾锛屾椤圭洰plc鎬庝箞瀵规帴杩樹笉纭畾 - /// </summary> - internal static void CheckDevice() { - //妫�祴杈撻�绾跨姸鎬�- - S7Helper.ReadStr("plc1", 100, 1, 8); - S7Helper.ReadBit("plc1", 101, 1, 2); - S7Helper.ReadInt("plc1", 102, 1, 6); - //1 璁惧plc鐨刬p deviceNo 鑷姩寤虹珛杩炴帴 - //2 璁惧瀵瑰簲鐨勯�璁」鍜岀嚎浣撶被鍨嬶紙杈撻�绾垮叆鍙c�杈撻�绾垮嚭鍙c�鎻愬崌鏈虹殑鍏ュ彛銆傘�銆傘�锛夎捣濮嬭鐨勫亸绉诲湴鍧�紝鍐欑殑鍋忕Щ鍦板潃 - //{ "deviceNo":"5","code":"9001","location":"F1CJ-SSX1-01","writeAddr900":0,"writeAddr905":-1,"writeAddr710":0,"readAddr901":2,"readAddr902":0,"lineType":1}, - //3 閫氳椤硅嚜鍔ㄨplc锛岃鍒扮殑鏁版嵁鏍规嵁lineType鍋氬鐞嗭紝鑷姩鍒涘缓浠诲姟鎴栬�鏇存柊浠诲姟鐘舵�锛堝垱寤轰竴涓澶囧姩浣滄垨浠诲姟鍔ㄤ綔锛屽鏋滄槸浠诲姟鍔ㄤ綔鏈変釜绾跨▼鍘昏锛�- } - - // 瀹氭椂鍣�鍗曚綅锛氬垎閽� - private static System.Timers.Timer aTimer = new System.Timers.Timer(Settings.WaitTime * 60000); - private static System.Timers.Timer bTimer = new System.Timers.Timer(Settings.WaitTime * 60000); - - private static string flag1 = null; - private static string flag2 = null; - - internal static void CheckEndLoc() { - - foreach (var item in ApiHelper.cacheInstockInfos) - { - var instockInfo = item.Value; - var end = WMSHelper.GetInstockEnd(instockInfo.item, instockInfo.endArea); - LogHelper.Info("缁堢偣璐т綅锛� + JsonConvert.SerializeObject(end), "TSSG"); - if (end != null) - { - ApiHelper.Instock(instockInfo); - ApiHelper.cacheInstockInfos.Remove(item); - LogHelper.Info("缂撳瓨淇℃伅鐢熸垚鍏ュ簱浠诲姟锛屽苟鍒犻櫎缂撳瓨淇℃伅锛� + JsonConvert.SerializeObject(item), "TSSG"); - return; - } - - if (item.Key == "192.168.1.160" && instockInfo.UDID != flag1) - { - flag1 = instockInfo.UDID; - - // 鎸傞挬Elapsed浜嬩欢浠ユ彁渚涘畾鏃跺櫒淇″彿 - aTimer.Elapsed -= OnTimedEvent1; - aTimer.Elapsed += OnTimedEvent1; - - // 璁剧疆鑷姩閲嶇疆涓簍rue锛堟剰鍛崇潃瀹氭椂鍣ㄤ細閲嶅瑙﹀彂锛�- aTimer.AutoReset = false; - - aTimer.Stop(); // 纭繚瀹氭椂鍣ㄥ仠姝�- aTimer.Enabled = true; // 鍚姩瀹氭椂鍣�- } - - if (item.Key == "192.168.1.161" && instockInfo.UDID != flag2) - { - flag2 = instockInfo.UDID; - - // 鎸傞挬Elapsed浜嬩欢浠ユ彁渚涘畾鏃跺櫒淇″彿 - aTimer.Elapsed -= OnTimedEvent2; - aTimer.Elapsed += OnTimedEvent2; - - // 璁剧疆鑷姩閲嶇疆涓簍rue锛堟剰鍛崇潃瀹氭椂鍣ㄤ細閲嶅瑙﹀彂锛�- aTimer.AutoReset = true; - - aTimer.Stop(); // 纭繚瀹氭椂鍣ㄥ仠姝�- aTimer.Enabled = true; // 鍚姩瀹氭椂鍣�- - } - } - } - - private static void OnTimedEvent1(Object source, ElapsedEventArgs e) - { - foreach (var item in ApiHelper.cacheInstockInfos) - { - var instockInfo = item.Value; - if (instockInfo.UDID == flag1) { - if (Settings.BufferArea != null && Settings.BufferArea != "") { - item.Value.endArea = Settings.BufferArea; - LogHelper.Info("ip:" + item.Key + "淇″彿绛夊緟鏃堕棿瓒呮椂锛屽彉鏇寸粓鐐瑰簱鍖轰负缂撳瓨鍖�, "TSSG"); - } - } - } - } - - private static void OnTimedEvent2(Object source, ElapsedEventArgs e) - { - foreach (var item in ApiHelper.cacheInstockInfos) - { - var instockInfo = item.Value; - if (instockInfo.UDID == flag2) - { - if (Settings.BufferArea != null && Settings.BufferArea != "") - { - item.Value.endArea = Settings.BufferArea; - LogHelper.Info("ip:" + item.Key + "淇″彿绛夊緟鏃堕棿瓒呮椂锛屽彉鏇寸粓鐐瑰簱鍖轰负缂撳瓨鍖�, "TSSG"); - } - } - } - } - - - // 鑷姩绉诲簱 - internal static void AutoShiftStock() - { - var startLoc = WMSHelper.GetShiftStockStart(Settings.BufferArea); - if (startLoc != null) { - var end = WMSHelper.GetInstockEnd(startLoc.LocCntrRel.CntrItemRel.S_ITEM_CODE); - if (end != null) { - var wcsTask = new WCSTask - { - S_OP_NAME = "鍏ュ簱", - S_CODE = WCSHelper.GenerateTaskNo(), - S_TYPE = "涓嬬嚎鍏ュ簱", - S_START_LOC = startLoc.S_CODE, - S_END_LOC = end.S_CODE, - S_SCHEDULE_TYPE = "NDC", - N_CNTR_COUNT = 1, - S_CNTR_CODE = startLoc.LocCntrRel.S_CNTR_CODE, - N_START_LAYER = startLoc.N_CURRENT_NUM, - N_END_LAYER = end.N_CURRENT_NUM + 1 - }; - if (WCSHelper.CreateTask(wcsTask)) - { - LocationHelper.LockLoc(startLoc.S_CODE, 2); - LocationHelper.LockLoc(end.S_CODE, 1); - } - } - } - } - - /// <summary> - /// 绉诲簱鍗曠Щ搴�- /// </summary> - public static void ShiftStockOrder() { - List<TN_YiKuDetail> tN_YiKuDetails = WMSHelper.getShiftOrderDetail(); - foreach (var item in tN_YiKuDetails) - { - if (item.N_QTY > item.N_COMPLETE_NUM) { - Location startLoc = WMSHelper.GetShiftStockStart(item.S_START_AREA, item.S_START_ROW); - Location endLoc = WMSHelper.GetShiftStockEnd(item.S_END_AREA, item.S_END_ROW); - if (startLoc != null && endLoc != null && !WMSHelper.isRowLock(endLoc)) - { - var wcsTask = new WCSTask - { - S_OP_CODE = item.S_NO, - S_OP_NAME = "绉诲簱鍗曠Щ搴�, - S_CODE = WCSHelper.GenerateTaskNo(), - S_TYPE = "绉诲簱", - S_START_LOC = startLoc.S_CODE, - S_END_LOC = endLoc.S_CODE, - S_SCHEDULE_TYPE = "NDC", - N_CNTR_COUNT = 1, - S_CNTR_CODE = startLoc.LocCntrRel.S_CNTR_CODE, - N_START_LAYER = startLoc.N_CURRENT_NUM, - N_END_LAYER = endLoc.N_CURRENT_NUM + 1 - }; - if (WCSHelper.CreateTask(wcsTask)) - { - LocationHelper.LockLoc(startLoc.S_CODE, 2); - LocationHelper.LockLoc(endLoc.S_CODE, 1); - } - } - } - } - } + } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/WCSCore.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/WCSCore.cs index b6ad33a..7b37b13 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/WCSCore.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/core/WCSCore.cs @@ -16,18 +16,6 @@ internal class WCSCore { public static void OperateAgvTaskStatus(AgvTaskState model) { if (string.IsNullOrEmpty(model.No)) { - var alertorDevice = Settings.alertorLightInfos.Where(a => a.deviceNo == int.Parse(model.LockNo)).FirstOrDefault(); - if (model.State == 1023) - { - var result = HH.WCS.Mobox3.YNJT_PT.device.TcpClient.SendHexOnce(alertorDevice.address, 502, alertorDevice.turnLight); - LogHelper.Info("modbus 杩斿洖淇″彿锛� + result, "TSSG"); - } - - if (model.State == 1025) - { - var result = HH.WCS.Mobox3.YNJT_PT.device.TcpClient.SendHexOnce(alertorDevice.address, 502, alertorDevice.offLight); - LogHelper.Info("modbus 杩斿洖淇″彿锛� + result, "TSSG"); - } } else { var TN_Task = WCSHelper.GetTask(model.No); @@ -56,31 +44,14 @@ break; case 5: WCSHelper.UpdateStatus(TN_Task, "寮�鍗歌揣"); - WCSHelper.UpdateStatus(TN_Task, "鍗歌揣瀹屾垚"); - TaskProcess.OperateStatus(TN_Task, 6); - if (TN_Task.S_OP_NAME == "绉诲簱鍗曠Щ搴�) - { - var startLoc = LocationHelper.GetLoc(TN_Task.S_START_LOC); - var endLoc = LocationHelper.GetLoc(TN_Task.S_END_LOC); - - TN_YiKuDetail detail = new TN_YiKuDetail() - { - S_NO = TN_Task.S_OP_CODE, - S_START_AREA = startLoc.S_AREA_CODE, - S_START_ROW = startLoc.N_ROW, - S_END_AREA = endLoc.S_AREA_CODE, - S_END_ROW = endLoc.N_ROW - }; - WMSHelper.updateShiftOrderDetail(detail); - } - WCSHelper.End(TN_Task); break; case 6: + WCSHelper.UpdateStatus(TN_Task, "鍗歌揣瀹屾垚"); + TaskProcess.OperateStatus(TN_Task, 6); break; #endregion case 2: - // 淇敼宸ュ崟鐘舵� - /* WCSHelper.UpdateWorkOrderStatus(TN_Task.S_OP_CODE, "宸插畬鎴�);*/ + WCSHelper.End(TN_Task); break; case 7: //鍒ゆ柇鏄惁鏀跺埌杩囧己鍒跺彇娑堬紝鏈夊氨涓嶅仛浠讳綍澶勭悊 @@ -137,7 +108,7 @@ //缁堢偣鎵樼洏缁戝畾 if (LocationHelper.BindingLoc(wcsTask.S_END_LOC, new List<string> { wcsTask.S_CNTR_CODE })) { //淇敼鎵樼洏鐘舵�涓哄彲鐢紝澧炲姞搴撳瓨閲忚〃锛屽悗闈㈠垎鎷e嚭鍙互璁$畻鍒�- ContainerHelper.Enable(wcsTask.S_CNTR_CODE, wcsTask.S_END_LOC); + /* ContainerHelper.Enable(wcsTask.S_CNTR_CODE, wcsTask.S_END_LOC);*/ } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/CntrItemRel.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/CntrItemRel.cs index 40b90e9..cef18d2 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/CntrItemRel.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/CntrItemRel.cs @@ -9,48 +9,22 @@ [SugarTable("TN_CG_Detail")] public class CntrItemRel : BaseModel { - - - public string S_CG_ID { get; set; } - public string S_GRID_NO { get; set; } - public string S_SERIAL_NO { get; set; } - public string S_ITEM_CODE { get; set; } - public string S_ITEM_NAME { get; set; } = ""; - public string S_ITEM_SPEC { get; set; } - public string S_ITEM_STATE { get; set; } = "合格"; - /// <summary> - /// 1:合格 2:不合格 - /// </summary> - public int N_ITEM_STATE { get; set; } - public string S_BATCH_NO { get; set; } = ""; - public string S_END_USER { get; set; } = ""; - public string S_OWNER { get; set; } - public string S_SUPPLIER_NO { get; set; } - public string S_PACK_TYPE { get; set; } - public float F_PACK_QTY { get; set; } - public float F_QTY { get; set; } - public string S_UOM { get; set; } = "kg"; + public string S_CG_ID { get; set; } // 条形码 [SugarColumn(IsPrimaryKey = true)] - public string S_CNTR_CODE { get; set; } - public string S_BS_TYPE { get; set; } = ""; - public string S_BS_NO { get; set; } = ""; - - public string S_ITEM_ROUTE { get; set; } = ""; - public float F_NET_WEIGHT { get; set; } - public float F_GROSS_WEIGHT { get; set; } - public string S_WU { get; set; } = ""; - /// <summary> - /// 分配量,被其它 - /// </summary> - public float F_ALLOC_QTY { get; set; } - public string C_ITEM_MERGE { get; set; } = "N"; - public string S_PUTAWAY_NO { get; set; } - - ///// <summary> - ///// 反向映射 - ///// </summary> - //[SugarColumn(IsIgnore = true)] - //[Navigate(NavigateType.OneToOne, nameof(S_CNTR_CODE), nameof(Container.S_CODE))] - //public Container Cntr { get; set; } + public string S_CNTR_CODE { get; set; } // 容器编码 + public string S_ITEM_CODE { get; set; } // 物料编码 + public string S_CELL_NO { get; set; } // 商品编码 + public string S_ITEM_STATE { get; set; } = "OK"; // 质检状态 + public float F_QTY { get; set; } // 数量 + public string S_MCN { get; set; } // 机器代码 + public string S_OPR { get; set; } // 操作员id1 + public string S_OPR02 { get; set; } // 操作员id2 + public string S_OPR03 { get; set; } // 操作员id3 + public string S_OPR04 { get; set; } // 操作员id4 + public string S_WINDUP { get; set; } // windup + public string S_TXNDATE { get; set; } // 生产时间 + public string S_DATE_SHIFT { get; set; } // 转班日期 + public string S_EFFECTIVE_TIME { get; set; } // 生效时间 + public string S_EXPIRATION_TIME { get; set; } // 失效时间 } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/GreenTireInformation.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/GreenTireInformation.cs new file mode 100644 index 0000000..16aa6c8 --- /dev/null +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/GreenTireInformation.cs @@ -0,0 +1,26 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.YNJT_PT.models +{ + [SugarTable("TN_green_tire_information")] + public class GreenTireInformation : BaseModel + { + public string ITEMCODE { get; set; } // 鐗╂枡缂栫爜 + public string BARCODE { get; set; } // 鏉″舰鐮�+ public string TIRECODE { get; set; } // 鍟嗗搧浠g爜 + public string MCN { get; set; } // 鏈哄櫒浠g爜 + public string OPR { get; set; } // 鎿嶄綔鍛榠d1 + public string OPR02 { get; set; } // 鎿嶄綔鍛榠d2 + public string OPR03 { get; set; } // 鎿嶄綔鍛榠d3 + public string OPR04 { get; set; } // 鎿嶄綔鍛榠d4 + public string WINDUP { get; set; } // windup + public int QTY { get; set; } // 鏁伴噺 + public string TXNDATE { get; set; } // 鐢熶骇鏃堕棿 + public string DATE_SHIFT { get; set; } // 杞彮鏃ユ湡 + } +} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/OffLineRecord.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/OffLineRecord.cs new file mode 100644 index 0000000..b43969b --- /dev/null +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/OffLineRecord.cs @@ -0,0 +1,23 @@ +锘縰sing SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.YNJT_PT.models +{ + /// <summary> + /// 鎴愬瀷鏈轰笅绾胯褰曡〃 + /// </summary> + [SugarTable("TN_CXJ_OFF_LINE_RECORD")] + public class OffLineRecord : BaseModel + { + public string S_RFID { get; set; } // 鎵樼洏鍙�+ public string S_LOC { get; set; } // 涓嬬嚎璐т綅 + public int N_IS_URGENT { get; set; } // N_IS_URGENT 鏄惁鍔犳�锛�.鍚�1.鏄級 + public string T_OFF_TIME { get; set; } // 涓嬬嚎鏃堕棿 + public int N_IS_FULL { get; set; } // 鏄惁婊℃嫋 0.鍚�1.鏄�+ + } +} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/Overage.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/Overage.cs new file mode 100644 index 0000000..200e750 --- /dev/null +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/Overage.cs @@ -0,0 +1,21 @@ +锘縰sing HH.WCS.Mobox3.YNJT_PT.models; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HH.WCS.Mobox3.YNJT_BZP_PT.models +{ + [SugarTable("TN_standard_overage")] + internal class Overage : BaseModel + { + public string MCNGRP { get; set; } //鐢熶骇娴佺▼缁�+ public string ITEMPATT { get; set; } // 鐗╂枡鍓嶇紑 + public int OVERAGE { get; set; } // 鏈�ぇ淇濆瓨鏃堕棿 + public float MINHOUR { get; set; } // 澶氫箙鍚庣敓鏁�+ public string FLAG_STS { get; set; } // 鏍囪 + public int RECID { get; set; } // 鏍囪 + } +} diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/WMSTask.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/WMSTask.cs index 267e844..db5e8a8 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/WMSTask.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/models/WMSTask.cs @@ -50,6 +50,10 @@ public int N_FAIL_MAX { get; set; } public DateTime? T_LAST_FAIL { get; set; } + // ----------------- 印尼佳通-硫化---------------- + public string S_GROUP_NO { get; set; } + + /// <summary> /// 0 等待/1 执行/2 完成/3 错误/4 启劢失败 /5 暂停启劢 /// </summary> diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/process/DeviceProcess.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/process/DeviceProcess.cs index baa8f00..fa7d2e0 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/process/DeviceProcess.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/process/DeviceProcess.cs @@ -26,38 +26,9 @@ //鍘绘帀娑堟伅澶�F 00 data = data.Substring(4); Console.WriteLine($"{ip}-{data}"); - var plc = Settings.deviceInfos.Where(a => a.address == ip && a.enable == 1).FirstOrDefault(); - Console.WriteLine("plc:" + JsonConvert.SerializeObject(plc)); - if (plc != null) { - if (plc.deviceType == 1) { - - var db = new SqlHelper<object>().GetInstance(); - var workOrder = db.Queryable<WorkOrder>().Where(a => a.S_STATUS.Equals("鎵ц涓�) && a.S_PROD_LINE.Equals(plc.deviceName)).First(); - Console.WriteLine("宸ュ崟:" + JsonConvert.SerializeObject(workOrder)); - if (workOrder != null) { - string endArea = LocationHelper.getAreaByAreaName(workOrder.S_END_AREA).S_CODE; - - InstockInfo instockInfo = new InstockInfo() - { - start = plc.location[0], - item = workOrder.S_ITEM_CODE, - endArea = endArea, - ip = ip, - UDID = GenerateTaskNo() - }; - LogHelper.Info("鎺ユ敹淇″彿澶勭悊:"+ JsonConvert.SerializeObject(instockInfo),"TSSG"); - ApiHelper.Instock(instockInfo); - } - } - else if (plc.deviceType == 2) { - //鍑哄簱缂撳瓨浣嶇殑鍏夌數淇℃伅 - //濡傛灉鏈夌紦瀛樹綅鏄┖鐨勭姸鎬侊紝鎴戜滑鍏堝垽鏂湁娌℃湁浠诲姟缁堢偣鍒嗛厤鍒拌繖閲岋紝濡傛灉娌℃湁锛屽氨鎵句竴鏉″嚭搴撲换鍔★紝缁堢偣鏄櫄鎷熺偣鐨勪换鍔★紝鍒嗛厤鍒拌繖涓┖浣�- //淇敼浠诲姟缁堢偣 - } - } - else { - Console.WriteLine($"TCP淇″彿澶勭悊锛氭湭鏌ヨ鍒癐P涓簕ip}鐨勬暟鎹紝璇锋鏌eviceInfo閰嶇疆涓績鏄惁瀛樺湪璇P鐨勬暟鎹紒"); - } + + + } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/ExcetionHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/ExcetionHelper.cs similarity index 89% rename from HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/ExcetionHelper.cs rename to HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/ExcetionHelper.cs index eb341da..28266b9 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.FJJT/util/ExcetionHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/ExcetionHelper.cs @@ -4,11 +4,10 @@ using System.Text; using System.Threading.Tasks; -namespace HH.WCS.Mobox3.FJJT.util +namespace HH.WCS.Mobox3.YNJT_PT.util { public class ExcetionHelper { - public class BusinessException : Exception { public BusinessException(string message) : base(message) { } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/Settings.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/Settings.cs index 9ec7f9c..1926b76 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/Settings.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/util/Settings.cs @@ -15,15 +15,13 @@ public static string HASeverUrl { get; set; } public static string SqlServer { get; set; } public static string SqlServer1 { get; set; } - public static List<deviceInfo> deviceInfos { get; set; } + public static List<ConnectLoc> connectLocList { get; set; } public static int port { get; set; } public static string WHCode { get; set; } public static string FacCode { get; set; } - public static string listenAddress { get; set; } - public static int WaitTime { get; set; } - public static string BufferArea { get; set; } - public static List<AgvAlarmNo> agvAlarmNoList { get; set; } - public static List<AlertorDeviceInfo> alertorLightInfos { get; set; } + public static string abnormalArea { get; set; } + public static string stockArea { get; set; } + public static void Init() { LogHelper.Info("鍔犺浇閰嶇疆鏂囦欢淇℃伅 寮�"); @@ -55,29 +53,18 @@ if (keyValue.Name == "ApiPort") { port = int.Parse(keyValue.Value.ToString()); } - if (keyValue.Name == "DeviceInfo") { - deviceInfos = JsonConvert.DeserializeObject<List<deviceInfo>>(keyValue.Value.ToString()); + if (keyValue.Name == "ConnectLoc") { + connectLocList = JsonConvert.DeserializeObject<List<ConnectLoc>>(keyValue.Value.ToString()); } - if (keyValue.Name == "ListenAddress") + if (keyValue.Name == "AbnormalArea") { - listenAddress = keyValue.Value.ToString(); + abnormalArea = keyValue.Value.ToString(); } - if (keyValue.Name == "WaitTime") + if (keyValue.Name == "StockArea") { - WaitTime = JsonConvert.DeserializeObject<int>(keyValue.Value.ToString()); + stockArea = keyValue.Value.ToString(); } - if (keyValue.Name == "BufferArea") - { - BufferArea = keyValue.Value.ToString(); - } - if (keyValue.Name == "AlertorLightDevice") - { - alertorLightInfos = JsonConvert.DeserializeObject<List<AlertorDeviceInfo>>(keyValue.Value.ToString()); - } - if (keyValue.Name == "AgvAlarmNo") - { - agvAlarmNoList = JsonConvert.DeserializeObject<List<AgvAlarmNo>>(keyValue.Value.ToString()); - } + } } } @@ -89,43 +76,13 @@ } - /* public static AlertorDeviceInfo getAlertorAdress(int deviceNo) - { - var alertorDeviceInfo = alertorLightInfos.Where(a => a.deviceNo == deviceNo).FirstOrDefault(); - return alertorDeviceInfo; - }*/ - public class AgvAlarmNo + public class ConnectLoc { + public string locCode { get; set; } + public int roadway { get; set; } public int type { get; set; } - public int dex { get; set; } - public string code { get; set; } - public string name { get; set; } } - - public class AlertorDeviceInfo - { - public int deviceNo { get; set; } - public string address { get; set; } - public string turnLight { get; set; } - public string offLight { get; set; } - } - - public class deviceInfo - { - public string address { get; set; } - public string deviceName { get; set; } - public string[] deviceNo { get; set; } - public string[] location { get; set; } - - public int deviceType { get; set; } - public int enable { get; set; } - } - public class TableName - { - public string name { get; set; } - public string code { get; set; } - } - + } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/ContainerHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/ContainerHelper.cs index f365ca7..7dcf1d1 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/ContainerHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/ContainerHelper.cs @@ -57,6 +57,22 @@ } + internal static bool AddCntr(string cntrCode) + { + var res = false; + var db = new SqlHelper<object>().GetInstance(); + var TN_Container = new Container { S_CODE = cntrCode }; + try + { + res = db.Insertable<Container>(TN_Container).ExecuteCommand() > 0; + } + catch (Exception ex) + { + LogHelper.Info($"娣诲姞瀹瑰櫒閿欒锛岄敊璇師鍥狅細{ex.Message}", "WMS"); + } + return res; + } + internal static bool AddCntr(string cntrCode, string itemCode) { var res = false; var db = new SqlHelper<object>().GetInstance(); @@ -107,99 +123,7 @@ var list = db.Queryable<CntrItemRel>().Where(a => a.S_CNTR_CODE == cntr).ToList(); return list; } - internal static bool BindNewCntrItem(string loc,string cntrCode, string itemCode) { - var res = false; - var itemName = ItemHelper.GetItemInfo(itemCode).S_ITEM_NAME; - var db = new SqlHelper<object>().GetInstance(); - try { - db.BeginTran(); - var cntr = new Container { S_CODE = cntrCode, N_DETAIL_COUNT = 1 }; - db.Insertable(cntr).ExecuteCommand(); - //鑾峰彇鐗╂枡淇℃伅锛屽~鍏呭埌瀹瑰櫒璐у搧鏄庣粏锛屾柟渚夸汉宸ユ煡鐪�- var cir = new CntrItemRel { S_CNTR_CODE = cntr.S_CODE.Trim(), F_QTY = 1, S_ITEM_CODE = itemCode, S_ITEM_NAME = itemName }; - db.Insertable<CntrItemRel>(cir).ExecuteCommand(); - var lcr = new LocCntrRel { S_CNTR_CODE = cntrCode, S_LOC_CODE = loc }; - db.Insertable<LocCntrRel>(lcr).ExecuteCommand(); - db.CommitTran(); - res = true; - } - catch (Exception ex) { - db.RollbackTran(); - Console.WriteLine(ex.Message); - } - - return res; - } - /// <summary> - /// 鐗╂枡淇℃伅缁戝畾鍒版弧瀹瑰櫒涓�- /// </summary> - /// <param name="cntrCode"></param> - /// <param name="itemCode"></param> - /// <param name="batchNo"></param> - /// <param name="qty"></param> - /// <returns></returns> - internal static bool BindCntrItem(Container cntr, string itemCode, string batchNo, float qty, string putawayNo) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - try { - db.BeginTran(); - //1.鏌ョ湅鏄惁鏈夌浉鍚岀墿鏂欐壒娆$殑淇℃伅锛屽鏋滄湁瑕佺疮鍔狅紝涓嶅悓鎵规鐨勫彲浠ュ垎寮�- var cir = db.Queryable<CntrItemRel>().Where(a => a.S_CNTR_CODE == cntr.S_CODE && a.S_ITEM_CODE == itemCode && a.S_BATCH_NO == batchNo).First(); - if (cir != null) { - cir.F_QTY += qty; - db.Updateable(cir).UpdateColumns(it => new { it.F_QTY }).ExecuteCommand(); - } - else { - //2.鎻掑叆鏂扮殑瀹瑰櫒鐗╂枡淇℃伅锛堝鍣ㄥ彿涓嶅彉锛�- cir = new CntrItemRel { S_CNTR_CODE = cntr.S_CODE.Trim(), S_BATCH_NO = batchNo, F_QTY = qty, S_ITEM_CODE = itemCode, S_PUTAWAY_NO = putawayNo }; - db.Insertable<CntrItemRel>(cir).ExecuteCommand(); - } - var count = db.Queryable<CntrItemRel>().Count(a => a.S_CNTR_CODE == cntr.S_CODE); - cntr.N_DETAIL_COUNT = count; - cntr.C_ENABLE = "N";//鐮佺洏鍚庡皢鎵樼洏璁剧疆涓轰笉鍙敤鐘舵�锛屽叆搴撳悗鍙樻垚鍙敤 - db.Updateable(cntr).UpdateColumns(it => new { it.N_DETAIL_COUNT, it.C_ENABLE, it.S_SRC }).ExecuteCommand(); - - db.CommitTran(); - res = true; - } - catch (Exception ex) { - db.RollbackTran(); - Console.WriteLine(ex.Message); - } - - return res; - } - - /// <summary> - /// 鐗╂枡淇℃伅缁戝畾鍒版弧瀹瑰櫒涓�- /// </summary> - /// <param name="cntrCode"></param> - /// <param name="itemCode"></param> - /// <param name="batchNo"></param> - /// <param name="qty"></param> - /// <param name="purpose">瀹瑰櫒鐢ㄩ�锛岀敤浜庡摢涓嚎杈硅繕鏄洰鐨勭偣</param> - /// <returns></returns> - internal static bool BindCntrItemSingle(Container cntr, string itemCode, string batchNo, float qty) { - var res = false; - var db = new SqlHelper<object>().GetInstance(); - try { - db.BeginTran(); - db.Updateable(cntr).UpdateColumns(it => new { it.S_DEST }).ExecuteCommand(); - //1.灏嗗師鏈夊鍣ㄧ墿鏂欎俊鎭垹闄�- db.Deleteable<CntrItemRel>().Where(it => it.S_CNTR_CODE == cntr.S_CODE.Trim()).ExecuteCommand(); - //2.鎻掑叆鏂扮殑瀹瑰櫒鐗╂枡淇℃伅锛堝鍣ㄥ彿涓嶅彉锛�- var cir = new CntrItemRel { S_CNTR_CODE = cntr.S_CODE.Trim(), S_BATCH_NO = batchNo, F_QTY = qty, S_ITEM_CODE = itemCode }; - db.Insertable<CntrItemRel>(cir).ExecuteCommand(); - - db.CommitTran(); - res = true; - } - catch (Exception ex) { - db.RollbackTran(); - } - - return res; - } + /// <summary> /// 鏍规嵁瀹瑰櫒鏉ユ簮鍜岀姸鎬佽幏鍙栨墭鐩� /// </summary> @@ -308,98 +232,6 @@ return db.Queryable<Container>().Where(a => a.S_SRC == src && a.N_B_STATE == state && a.S_TYPE == cntrType).ToList(); } } - /// <summary> - /// enable 璁╂墭鐩樺厑璁歌鍑哄簱璁$畻鍒帮紝鍚屾椂澧炲姞閲忚〃鏁版嵁 - /// </summary> - /// <param name="cntr"></param> - internal static void Enable(string cntr, string loc) { - var db = new SqlHelper<object>().GetInstance(); - var cntrInfo = db.Queryable<Container>().Where(a => a.S_CODE == cntr).First(); - //鑾峰彇浠撳簱閲忚〃 - //鑾峰彇鐗╃悊搴撳尯 - //鑾峰彇閫昏緫搴撳尯 - if (cntrInfo != null) { - try { - db.BeginTran(); - //闃叉鎺ュ彛閲嶅璋冪敤锛岄噺琛ㄩ噸澶嶅鍔�- if (cntrInfo.C_ENABLE == "N") { - cntrInfo.C_ENABLE = "Y"; - db.Updateable(cntrInfo).UpdateColumns(a => new { a.C_ENABLE, a.T_MODIFY }).ExecuteCommand(); - var cirList = db.Queryable<CntrItemRel>().Where(a => a.S_CNTR_CODE == cntr).ToList(); - if (cirList.Count > 0) { - cirList.ForEach(a => { - var wh = db.Queryable<WHInventory>().Where(b => b.S_ITEM_CODE == a.S_ITEM_CODE).First(); - if (wh != null) { - //鏇存柊浠撳簱閲忚〃 - wh.F_QTY += a.F_QTY; - wh.T_MODIFY = DateTime.Now; - db.Updateable(wh).UpdateColumns(it => new { it.F_QTY, it.T_MODIFY }).ExecuteCommand(); - } - else { - //鏂板浠撳簱閲忚〃 - wh = new WHInventory { F_QTY = a.F_QTY, S_ITEM_CODE = a.S_ITEM_CODE }; - db.Insertable(wh).ExecuteCommand(); - } - //鍐欏叆绗笁鏂逛腑闂磋〃 - var di = new DayuanIn - { - CN_S_ARRIVAL_NO = a.S_PUTAWAY_NO, - CN_F_QUANTITY = a.F_QTY, - CN_S_BATCH_NO = a.S_BATCH_NO, - CN_S_ITEM_CODE = a.S_ITEM_CODE, - }; - db.Insertable(di).ExecuteCommand(); - //濡傛灉瑕佺粺璁″垎鎷d腑锛屽垎鎷e洖鐨勯噺锛屾棤娉曡窡韪墭鐩橈紝闄ら潪瀵规墭鐩樺姞鏍囪瘑锛屽睘浜庡摢涓簱鍖恒� - //鍙﹀鍒嗘嫞鍥炲彲鑳藉幓鍒殑宸烽亾锛屽埆鐨勯�杈戝簱鍖猴紝閫昏緫搴撳尯鐨勯噺鎺у埗鏇村鏉傦紝涓嶈兘璁$畻鍒嗘嫞涓拰鍒嗘嫞鍥炪�鎵�互搴撳尯閲忚〃鏈」鐩殏涓嶈�铏�- /* - //鑾峰彇璐т綅鐨勭墿鐞嗗簱鍖哄拰鎵�湁閫昏緫搴撳尯 - var location = db.Queryable<Location>().Where(l => l.S_CODE == loc).First(); - if (location != null) { - var az = db.Queryable<AZInventory>().Where(b => b.S_ITEM_CODE == a.S_ITEM_CODE && b.S_AREA_CODE == location.S_AREA_CODE).First(); - if (az != null) { - //鏇存柊搴撳尯閲忚〃 - az.F_QTY += a.F_QTY; - az.T_MODIFY = DateTime.Now; - db.Updateable(az).UpdateColumns(it => new { it.F_QTY, it.T_MODIFY }).ExecuteCommand(); - } - else { - //鏂板搴撳尯閲忚〃 - az = new AZInventory { F_QTY = a.F_QTY, S_ITEM_CODE = a.S_ITEM_CODE, S_AREA_CODE = location.S_AREA_CODE }; - db.Insertable(az).ExecuteCommand(); - } - - } - //閫昏緫搴撳尯鐨勯噺琛�- var zoneList = db.Queryable<ZoneLoc>().Where(l => l.S_LOC_CODE == loc).ToList(); - if (zoneList.Count > 0) { - zoneList.ForEach(z => { - var az = db.Queryable<AZInventory>().Where(b => b.S_ITEM_CODE == a.S_ITEM_CODE && b.S_AREA_CODE == z.S_ZONE_CODE).First(); - if (az != null) { - //鏇存柊搴撳尯閲忚〃 - az.F_QTY += a.F_QTY; - az.T_MODIFY = DateTime.Now; - db.Updateable(az).UpdateColumns(it => new { it.F_QTY, it.T_MODIFY }).ExecuteCommand(); - } - else { - //鏂板搴撳尯閲忚〃 - az = new AZInventory { F_QTY = a.F_QTY, S_ITEM_CODE = a.S_ITEM_CODE, S_AREA_CODE = z.S_ZONE_CODE, C_IS_LOGIC_AREA = "Y" }; - db.Insertable(az).ExecuteCommand(); - } - }); - } - */ - - }); - } - } - db.CommitTran(); - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - db.RollbackTran(); - - } - } - } + } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WCSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WCSHelper.cs index b321ef3..2e0c2f2 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WCSHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WCSHelper.cs @@ -30,6 +30,15 @@ db.Updateable(task).UpdateColumns(it => new {it.N_B_STATE, it.S_B_STATE,it.T_MODIFY ,it.S_EQ_NO }).ExecuteCommand(); return res; } + + public static bool updateTaskEnd(WCSTask task) + { + var res = false; + var db = new SqlHelper<WCSTask>().GetInstance(); + res = db.Updateable(task).UpdateColumns(it => new { it.S_END_LOC, it.S_END_AREA, it.T_MODIFY}).ExecuteCommand() > 0; + return res; + } + internal static bool UpdateInfo(WCSTask task, string sourceNo, string endBit, string status) { var res = false; var db = new SqlHelper<WCSTask>().GetInstance(); diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WMSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WMSHelper.cs index f4dc478..e2d0f97 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WMSHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_PT/wms/WMSHelper.cs @@ -1,9 +1,11 @@ -锘縰sing HH.WCS.Mobox3.YNJT_PT.api; +锘縰sing HH.WCS.Mobox3.YNJT_BZP_PT.models; +using HH.WCS.Mobox3.YNJT_PT.api; using HH.WCS.Mobox3.YNJT_PT.models; using HH.WCS.Mobox3.YNJT_PT.models.other; using HH.WCS.Mobox3.YNJT_PT.util; using Newtonsoft.Json; using NLog.Fluent; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; @@ -23,10 +25,10 @@ var date = DateTime.Now.ToString("yyMMdd"); return $"OP{date}{id.ToString().PadLeft(4, '0')}"; } - internal static string GenerateSortingNo() { - var id = SYSHelper.GetSerialNumber("鍒嗘嫞鍗�, "SO"); + internal static string GenerateTaskGroupNo() { + var id = SYSHelper.GetSerialNumber("浠诲姟缁�, "GP"); var date = DateTime.Now.ToString("yyMMdd"); - return $"SO{date}{id.ToString().PadLeft(4, '0')}"; + return $"GP{date}{id.ToString().PadLeft(4, '0')}"; } internal static List<WMSTask> GetOperationListByState(string state) { var db = new SqlHelper<object>().GetInstance(); @@ -77,130 +79,9 @@ return result; } - internal static bool CreateSortingOrder(List<string> list) { - var res = false; - //閬嶅巻鑾峰彇鍙戣揣鍗曪紝鐒跺悗鍒ゆ柇搴撳瓨锛屽鏋滃叏閮芥病搴撳瓨锛屽垯涓嶇敓鎴愬垎鎷e崟锛屽鏋滄湁鐢熸垚鍒嗘嫞鍗�- //鏇存柊娉㈡鍗曪紝鍗充娇鍙湁涓�釜鍙戣揣鍗曚篃鏇存柊娉㈡鍗�- var db = new SqlHelper<object>().GetInstance(); - var sortingOrderNo = ""; - SortingOrder sortingOrder = null; - try { - db.BeginTran(); - list.ForEach(a => { - var so = db.Queryable<ShippingOrder>().Includes(s => s.Details).Where(s => s.S_NO == a).First(); - //鍒ゆ柇搴撳瓨锛屽彧鏈夊凡缁忓叆搴撶殑鎵嶅彲浠ヨ绠楋紝鐮佺洏鐨勪笉绠楋紝鍏ュ簱鍚庡嚭搴撻�涓殑涔熻璁$畻锛岀爜鐩樺悗榛樿鍙緟鍏ュ簱锛屽叆搴撳悗鍙甯�- //鐢熸垚鍑哄簱浠诲姟锛屽彧鏈夋墭鐩樹綅缃湪绔嬪簱鎵嶉渶瑕佸垱寤哄嚭搴撲换鍔★紙鍏堝啓姝荤珛搴擄級 - //鍙湁鍏ㄩ儴鍒嗘嫞瀹屾垚鎵嶅厑璁稿洖搴擄紙涓�釜鎵樼洏鍙兘瀵瑰簲澶氫釜鍒嗘嫞鏄庣粏锛�+ - //鏌ユ壘浠撳簱閲忚〃鍜屽簱鍖洪噺琛紝鍑哄簱鍗曢渶瑕佸畾浣嶄粨搴撳拰搴撳尯浜嗭紝鍑哄簱瀹氫綅鐗╃悊搴撳尯灏辫锛屽叆搴撳彲鑳界墿鏂欏簱鍖鸿繕瑕佸尯鍒嗛�杈戝簱鍖�- - //鏆傛椂鍙煡浠撳簱閲忚〃锛堥噺琛ㄥ浣曢噸缃紝鏌ユ壘鎵�湁鏌ユ壘C_ENABLE=N鐨勶紝鍒ゆ柇濡傛灉鍦ㄤ粨搴撲腑锛屾敼鎴怸锛岀劧鍚庣粺璁★級 - - //鐢熸垚鍒嗘嫞鍗曟椂鍊欏鍔犱粨搴撻噺琛ㄥ垎閰嶉噺锛岀敓鎴愬垎鎷e崟鏄庣粏鏃跺�锛屽鍔犲簱鍖洪噺琛ㄥ垎閰嶉噺 - if (so != null && so.Details.Count > 0) { - var fail = true; - for (int i = 0; i < so.Details.Count; i++) { - var whi = db.Queryable<WHInventory>().Where(w => w.S_ITEM_CODE == so.Details[i].S_ITEM_CODE).First(); - if (whi != null && whi.F_QTY - whi.F_ALLOC_QTY > 0) { - //鏈夎揣灏卞嚭 - float qty = whi.F_QTY - whi.F_ALLOC_QTY > so.Details[i].F_QTY ? so.Details[i].F_QTY : whi.F_QTY - whi.F_ALLOC_QTY; - fail = false; - //鏈夊彲鐢ㄥ簱瀛橈紝鐢熸垚鍒嗘嫞鍗�- if (sortingOrderNo == "") { - sortingOrderNo = GenerateSortingNo(); - sortingOrder = new SortingOrder - { - S_NO = sortingOrderNo, - S_SHIPPING_NO = so.S_NO, - Composes = new List<SortingCompose>() - }; - //鍒涘缓鍒嗘嫞鍗�- db.Insertable(sortingOrder).ExecuteCommand(); - } - else { - //鑾峰彇鏈�柊鍒嗘嫞鍗�- sortingOrder = db.Queryable<SortingOrder>().Includes(s => s.Composes).Where(s => s.S_NO == sortingOrderNo).First(); - //鏇存柊鍒嗘嫞鍗曚腑鐨勫彂璐у崟鍗曞彿 - sortingOrder.S_SHIPPING_NO = sortingOrder.S_SHIPPING_NO + ";" + so.S_NO; - sortingOrder.T_MODIFY = DateTime.Now; - db.Updateable(sortingOrder).UpdateColumns(it => new { it.S_SHIPPING_NO, it.T_MODIFY }).ExecuteCommand(); - } - //鏌ヨ鍒嗘嫞鍗曞瓙琛紙姝e父鎯呭喌杩橀渶瑕佸鍔犳壒娆″垽鏂級 - var soc = db.Queryable<SortingCompose>().Where(s => s.S_ITEM_CODE == so.Details[i].S_ITEM_CODE && s.S_SORTING_NO == sortingOrder.S_NO).First(); - if (soc == null) { - soc = new SortingCompose - { - S_ITEM_CODE = so.Details[i].S_ITEM_CODE, - S_SORTING_NO = sortingOrder.S_NO, - F_QTY = qty, - N_ROW_NO = sortingOrder.Composes.Count() + 1, - S_BATCH_NO = so.Details[i].S_BATCH_NO - }; - - //鍒涘缓鍒嗘嫞鍗曞瓙琛�- db.Insertable(soc).ExecuteCommand(); - } - else { - soc.F_QTY += qty; - soc.T_MODIFY = DateTime.Now; - //鏇存柊鍒嗘嫞鍗曞瓙琛�- db.Updateable(soc).UpdateColumns(it => new { it.F_QTY, it.T_MODIFY }).ExecuteCommand(); - } - //鏇存柊浠撳簱閲忚〃鍒嗛厤閲�- whi.F_ALLOC_QTY += qty; - whi.T_MODIFY = DateTime.Now; - db.Updateable(whi).UpdateColumns(it => new { it.F_ALLOC_QTY, it.T_MODIFY }).ExecuteCommand(); - //璺熸柊鍙戣揣鍗曞瓙琛ㄩ厤璐ф暟閲�- so.Details[i].F_ACC_D_QTY += qty; - so.Details[i].T_MODIFY = DateTime.Now; - db.Updateable(so.Details[i]).UpdateColumns(it => new { it.F_ACC_D_QTY, it.T_MODIFY }).ExecuteCommand(); - } - - } - //鏇存柊鍙戣揣鍗曠姸鎬�- so.N_B_STATE = fail ? 5 : 1; - if (fail) { - so.S_NOTE = "娌℃湁搴撳瓨"; - } - so.S_WAVE_CODE = sortingOrderNo; - so.T_MODIFY = DateTime.Now; - db.Updateable(so).UpdateColumns(it => new { it.N_B_STATE, it.T_MODIFY, it.S_WAVE_CODE, it.S_NOTE }).ExecuteCommand(); - - } - - - //鏌ユ壘搴撳尯鍐呮墭鐩樼敓鎴愭墭鐩樻槑缁嗭紙鍖呮嫭鍒嗘嫞涓級鎬庝箞鍒ゆ柇搴撳唴锛熸煡鎵捐揣浣嶇粦瀹氾紵杩樻槸鎵樼洏涓婂姞鏍囪瘑姣旇緝濂斤紝濡傛灉鏄暣鎵樺嚭鐨勶紝鍒嗘嫞纭鍚庡幓鎺夊垎鎷f爣璇嗐� - //1銆佸彧鏈夌爜鐩樺叆搴撳悗鐨勬墠闇�鍔犳爣璇嗭紝鍒嗘嫞鍥炵殑涓嶇敤锛屽垎鎷e洖鐨勬爣璇嗚繕鍦紝娌℃湁鍙樸�鍐欐鐮佺洏鍏ョ殑瀹屾垚鍚庡姞鏍囪瘑锛屾暣鎵樺垎鎷g殑鍘绘帀鏍囪瘑锛岄槻姝㈠悗闈㈤噸鏂扮爜鐩樿剰鏁版嵁 - //2銆佹垨鑰呭叧鑱旀煡璇㈠簱鍐呯殑锛屽彧缁欏垎鎷e嚭鐨勫姞鏍囪瘑锛屾瘡娆″垎鎷e洖鍐嶆妸鏍囪瘑娓呴櫎浜嗭紙濡傛灉涓嶆竻闄ゅ甫鏍囪瘑鐨勪細寰堝锛岃繕涓嶅鍏ㄩ儴鍔犳爣璇嗭級锛屾暣鎵樼殑娓呴櫎銆�- //缁煎悎閫夋嫨杩樻槸鏂规1锛岃繖鏍峰垱寤哄垎鎷f槑缁嗭紝鍙渶瑕佹墭鐩樼墿鏂欎袱琛ㄦ煡璇㈠氨鑳藉畾浣嶆墭鐩橈紙濡傛灉淇℃伅涓嶅噯锛屽彲浠ラ噸缃級锛屾柟妗�闇�璐т綅銆佹墭鐩樸�鐗╂枡涓夎〃鑱旀煡 - - //鏆傛椂涓嶈搴撳尯锛屾爣璇嗙敤瀹瑰櫒琛�C_ENABLE 鏉ュ垽鏂紝琛ㄧず鑳戒笉鑳藉嚭搴�- - //鎵ц鍒嗘嫞鍒涘缓浠诲姟锛岄亶鍘嗗垎鎷f槑缁嗕腑鐨勬墭鐩橈紝濡傛灉鍦ㄤ粨搴撳氨鍑哄簱锛屽鏋滀笉鍦ㄥ氨涓嶇敤鍑哄簱 - - - }); - //鍏ㄩ儴鍒嗘嫞鍗曠敓鎴愪箣鍚庡皢鍒嗘嫞鍗曠姸鎬佽缃负寮�閰嶈揣,娉㈡鍙蜂负鍙戣揣鍗�- sortingOrder = db.Queryable<SortingOrder>().Where(s => s.S_NO == sortingOrderNo).First(); - sortingOrder.N_B_STATE = 1; - sortingOrder.T_MODIFY = DateTime.Now; - db.Updateable(sortingOrder).UpdateColumns(it => new { it.N_B_STATE, it.T_MODIFY }).ExecuteCommand(); - db.CommitTran(); - res = true; - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - db.RollbackTran(); - } - return res; - - } - - internal static List<SortingDetail> GetSortingDetailByCntr(string cntr) { - var db = new SqlHelper<object>().GetInstance(); - var result = db.Queryable<SortingDetail>().Where(a => a.S_CNTR_CODE == cntr && a.N_B_STATE != 2).ToList(); - return result; - } + internal static bool CreateWmsTask(WMSTask wmsTask) { try { @@ -250,74 +131,7 @@ var db = new SqlHelper<object>().GetInstance(); return db.Queryable<WMSTask>().Where(a => a.S_CODE == code).First(); } - /* - internal static void CreateSortingOrderDetail(string so_no) { - //鍒嗘嫞鍗曢厤璐�- var db = new SqlHelper<object>().GetInstance(); - var so = db.Queryable<SortingOrder>().Includes(a => a.Composes).Where(a => a.S_NO == so_no && (a.N_B_STATE == 1 || a.N_B_STATE == 20)).First();// - if (so != null && so.Composes.Count > 0) { - db.BeginTran(); - try { - int rowNo = 1; - so.Composes.ForEach(a => { - //鎸夊垎鎷e崟瀛愯〃鍘婚厤璐э紝鏌ユ壘鍙敤鎵樼洏(鍏堟煡鎵�湁绗﹀悎鐨勶紝鍚庨潰鍐嶄紭鍖� - var cirList = db.Queryable<CntrItemRel>().Includes(c => c.Cntr).Where(c => c.Cntr.C_ENABLE == "Y" && c.S_ITEM_CODE == a.S_ITEM_CODE && (c.F_QTY - c.F_ALLOC_QTY) > 0).OrderBy(c => c.T_CREATE).ToList(); - for (int i = 0; i < cirList.Count; i++) { - var cir = cirList[i]; - var sd = new SortingDetail - { - N_ROW_NO = rowNo, - S_BATCH_NO = a.S_BATCH_NO, - S_ITEM_CODE = a.S_ITEM_CODE, - S_CNTR_CODE = cir.S_CNTR_CODE, - S_SORTING_NO = a.S_SORTING_NO - }; - bool needBreak = false; - if (cir.F_QTY - cir.F_ALLOC_QTY >= (a.F_QTY - a.F_ACC_S_QTY)) { - //瀹瑰櫒鍙敤鏁伴噺澶т簬鍒嗘嫞鍗曞瓙琛ㄨ姹傜殑鏁伴噺锛岀敓鎴愬垎鎷f槑缁嗭紝鐒跺悗璺冲嚭寰幆 - sd.F_QTY = a.F_QTY - a.F_ACC_S_QTY; - needBreak = true; - } - else { - //鐢熸垚鍒嗘嫞鏄庣粏锛岀户缁垱寤�- sd.F_QTY = cir.F_QTY - cir.F_ALLOC_QTY; - } - db.Insertable(sd).ExecuteCommand(); - rowNo++; - //鏇存柊瀹瑰櫒璐у搧琛ㄥ垎閰嶉噺 - cir.F_ALLOC_QTY += sd.F_QTY; - cir.T_MODIFY = DateTime.Now; - db.Updateable(cir).UpdateColumns(it => new { it.F_ALLOC_QTY, it.T_MODIFY }).ExecuteCommand(); - //鏇存柊鍒嗘嫞鍗曞瓙琛ㄧ殑閲�- a.F_ACC_S_QTY += sd.F_QTY; - a.T_MODIFY = DateTime.Now; - db.Updateable(cir).UpdateColumns(it => new { it.F_ALLOC_QTY, it.T_MODIFY }).ExecuteCommand(); - if (needBreak) { - break; - } - } - }); - //鍏ㄩ儴鍒嗘嫞鍗曞瓙琛ㄧ敓鎴愬垎鎷f槑缁嗭紝淇敼鍒嗘嫞鍗曠姸鎬佷负閰嶈揣瀹屾垚(鍙嶆浠撳簱鐨勮揣鑳介厤鐨勯兘閰嶅畬浜嗭紝闄ら潪鏁版嵁鏈夊紓甯� - so.N_B_STATE = 2; - so.T_MODIFY = DateTime.Now; - db.Updateable(so).UpdateColumns(it => new { it.N_B_STATE, it.T_MODIFY }).ExecuteCommand(); - db.CommitTran(); - } - catch (Exception ex) { - Console.WriteLine(ex.Message); - db.RollbackTran(); - } - } - } - */ - /// <summary> - /// 鑾峰彇寮�閰嶈揣鐨勫垎鎷e崟锛屼竴娆℃�鐢熸垚鍒嗘嫞鏄庣粏锛岄伩鍏嶇敓鎴愪竴鍗婂啀鐢熸垚锛屾墍浠ュ垱寤哄垎鎷f槑缁嗙殑鏃跺�鍔犱笂浜嬪姟 - /// </summary> - /// <returns></returns> - internal static List<SortingOrder> GetWaitingSortingOrderList() { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<SortingOrder>().Includes(a => a.Composes).Where(a => a.N_B_STATE == 1 || a.N_B_STATE == 20).ToList(); - } + /// <summary> /// 鑾峰彇閰嶈揣瀹屾垚鐨勫垎鎷e崟锛屾瘡涓垎鎷e崟鍗曠嫭鍒涘缓鍒嗘嫞浣滀笟 /// </summary> @@ -509,288 +323,335 @@ return result; } - public static Location GetLocation4InEmptyRow() + + // ----------------------------------------------- 鍗板凹浣抽� - 纭寲-------------------------------------------- + + /// <summary> + /// 娣诲姞鎴愬瀷鏈轰笅绾胯褰�+ /// </summary> + /// <param name="record"></param> + /// <returns></returns> + public static bool addOffLineRecord(OffLineRecord record) { - Location result = null; - try - { - var db = new SqlHelper<object>().GetInstance(); - - #region 鏌ユ壘鎵�湁鏁伴噺鏄┖鐨勬帓 - //Console.WriteLine("鏌ユ壘鎵�湁鏁伴噺鏄┖鐨勬帓"); - //2.0 绠�寲鏌ヨ鍙煡姣忎竴鎺掔涓�垪 - var list = db.Queryable<Location>().OrderBy(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList().Where(a => a.N_CURRENT_NUM == 0).ToList(); - //2.1 閫変竴涓┖鎺�- for (int i = 0; i < list.Count; i++) - { - var other = db.Queryable<Location>().Where(a => a.S_AREA_CODE == list[i].S_AREA_CODE && a.N_ROW == list[i].N_ROW && a.S_LOCK_STATE != "鏃�).First(); - if (list[i].N_LOCK_STATE == 0 && other == null) - { - //浜屾鏍¢獙褰撳墠鎺掓墍鏈夎揣浣嶉兘鏄┖鐨勶紝闃叉绯荤粺鏁版嵁閿欎贡 - var rowSumInfo = db.Queryable<Location>().Where(l => l.S_AREA_CODE == list[i].S_AREA_CODE && l.N_ROW == list[i].N_ROW && l.N_CURRENT_NUM != 0).Count(); - if (rowSumInfo == 0) - { - result = list[i]; - break; - } - } - } - #endregion - - if (result != null && (!string.IsNullOrEmpty(result.C_ENABLE) && (result.C_ENABLE == "绂佺敤" || result.C_ENABLE == "N"))) - { - //绂佺敤浜嗛�鎷╁悗闈竴涓揣浣�- Console.WriteLine("绂佺敤浜嗛�鎷╁悗闈竴涓揣浣�); - result = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE == result.S_AREA_CODE && a.N_ROW == result.N_ROW && (string.IsNullOrEmpty(a.C_ENABLE) || (a.C_ENABLE != "绂佺敤" && a.C_ENABLE != "N")) && a.N_COL > result.N_COL).First(); - } - } - catch (Exception ex) - { - - LogHelper.Error("GetLocation4InEmptyRow:" + ex.Message, ex); - } - return result; - } - - internal static Location GetInstockEnd(string item) - { - var db = new SqlHelper<object>().GetInstance(); - Location end = null; - // 鏌ヨ鐩稿悓鐗╂枡鐨勬帓鏄惁鏈夊彲鏀捐揣鐨勫簱浣�- var listMaxCol = db.Queryable<Location>() - .LeftJoin<LocCntrRel>((l, lc) => l.S_CODE == lc.S_LOC_CODE) - .LeftJoin<CntrItemRel>((l, lc, ci) => lc.S_CNTR_CODE == ci.S_CNTR_CODE) - .Where((l, lc, ci) => l.N_CURRENT_NUM > 0 && ci.S_ITEM_CODE == item && l.S_AREA_CODE != Settings.BufferArea) - .OrderByDescending((l, lc, ci) => l.N_COL).Take(1).PartitionBy((l, lc, ci) => l.N_ROW).ToList(); - - foreach (var loc in listMaxCol) - { - //鎺掓湁閿佷篃鎺掗櫎 - var other = db.Queryable<Location>().Where(a => a.S_AREA_CODE == loc.S_AREA_CODE && a.N_ROW == loc.N_ROW && a.S_LOCK_STATE != "鏃� && a.N_LOCK_STATE != 0).First(); - if (other != null) - { - continue; - } - - end = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE == loc.S_AREA_CODE && a.N_ROW == loc.N_ROW && a.N_CURRENT_NUM < a.N_CAPACITY && (string.IsNullOrEmpty(a.C_ENABLE) || (a.C_ENABLE != "绂佺敤" && a.C_ENABLE != "N")) && a.N_COL >= loc.N_COL).First(); - if (end != null) { - return end; - } - } - // 濡傛灉娌℃湁锛屽垯闅忔満鏀剧┖鐨勬帓 - if (end == null) { - end = GetLocation4InEmptyRow(); - } - return end; - } - - public static Location GetShiftStockStart(string area ,int row) - { - Location result = null; - try - { - // 1銆佹煡璇㈠綋鍓嶅簱鍖�鎺�鐗╂枡 鏈夋墭鐩樼殑璐т綅 - var db = new SqlHelper<object>().GetInstance(); - result = db.Queryable<Location>() - .Where(l => l.N_CURRENT_NUM > 0 && l.S_AREA_CODE == area && l.N_ROW == row && l.N_LOCK_STATE == 0 && (l.C_ENABLE != "绂佺敤" && l.C_ENABLE != "N")) - .Includes(l => l.LocCntrRel, l => l.CntrItemRel) - .OrderByDescending(l => l.N_COL) - .First(); - } - catch (Exception ex) - { - LogHelper.Error("GetShiftStockStart:" + ex.Message, ex); - } - return result; - } - - public static Location GetShiftStockStart(string area) - { - Location result = null; - try - { - // 1銆佹煡璇㈠綋鍓嶅簱鍖�鎺�鐗╂枡 鏈夋墭鐩樼殑璐т綅 - var db = new SqlHelper<object>().GetInstance(); - var listMaxCol = db.Queryable<Location>() - .Where(l => l.N_CURRENT_NUM > 0 && l.S_AREA_CODE == area) - .Includes(l => l.LocCntrRel, l => l.CntrItemRel) - .OrderByDescending(l => l.N_COL) - .Take(1) - .PartitionBy(l => l.N_ROW) - .ToList(); - - foreach (var loc in listMaxCol) - { - //鎺掓湁閿佷篃鎺掗櫎 - var other = db.Queryable<Location>().Where(a => a.S_AREA_CODE == loc.S_AREA_CODE && a.N_ROW == loc.N_ROW && a.S_LOCK_STATE != "鏃� && a.N_LOCK_STATE != 0).First(); - if (other != null) - { - continue; - } - return loc; - } - } - catch (Exception ex) - { - LogHelper.Error("GetShiftStockStart:" + ex.Message, ex); - } - return result; - } - - public static bool isRowLock(Location location) { - var db = new SqlHelper<object>().GetInstance(); - return db.Queryable<Location>().Where(a => a.S_AREA_CODE == location.S_AREA_CODE && a.N_ROW == location.N_ROW && a.S_LOCK_STATE != "鏃� && a.N_LOCK_STATE != 0).Count() > 0; - } - - public static Location GetShiftStockEnd(string area, int row) - { - Location result = null; - - try - { - //1.0 鑾峰彇姣忎竴鎺掓渶澶х殑鍒�- //1.1 鍒ゆ柇褰撳墠鏁伴噺鏄笉鏄弧鐨勶紝濡傛灉鏄弧鐨勫苟涓旀槸鏈�ぇ鍒楋紝闇�鎺掗櫎 - var listMaxCol = new SqlHelper<Location>().GetInstance().Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == row).OrderByDescending(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList(); - //1.1 鏌ュ埌鎵�湁鏈夋墭鐩樼殑鎺� - Console.WriteLine("鏌ュ埌鎵�湁鏈夋墭鐩樼殑鎺�"); - var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => a.N_CURRENT_NUM > 0 && a.S_AREA_CODE == area && a.N_ROW == row).Includes(a => a.LocCntrRel, a => a.CntrItemRel).OrderByDescending(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList(); - if (list.Count > 0) - { - //1.2 鏌ユ壘鍏跺畠灏哄鏈夋墭鐩樻垨鑰呴攣瀹氱殑鎺�- for (int i = list.Count - 1; i >= 0; i--) - { - //鎺掗櫎宸茬粡閿佸畾鐨勮揣浣�鍜�鏀炬弧浜嗕笖鏄渶澶у垪鐨勮揣浣�- if (list[i].N_LOCK_STATE != 0 || (list[i].N_CURRENT_NUM == list[i].N_CAPACITY && listMaxCol.Count(a => a.S_CODE == list[i].S_CODE) > 0)) - { - Console.WriteLine($"鎺掗櫎宸茬粡閿佸畾鐨勮揣浣�鍜�鏀炬弧浜嗕笖鏄渶澶у垪鐨勮揣浣�鎺抺list[i].N_ROW}"); - list.Remove(list[i]); - } - else - { - //鎺掓湁閿佷篃鎺掗櫎 - var other = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == list[i].N_ROW && a.S_LOCK_STATE != "鏃� && a.N_LOCK_STATE != 0).First(); - if (other != null) - { - Console.WriteLine($"鎺掗櫎鏈夐攣鐨勬帓{list[i].N_ROW}"); - list.Remove(list[i]); - } - } - } - Console.WriteLine($"鏈夋墭鐩樻帓鏁颁负{list.Count}"); - if (list.Count > 0) - { - - //1.3 閬嶅巻鍒ゆ柇鐗╂枡绫诲瀷鏄惁鐩稿悓 - Console.WriteLine("閬嶅巻鍒ゆ柇鐗╂枡绫诲瀷鏄惁鐩稿悓"); - for (int i = 0; i < list.Count; i++) - { - //todo 杩橀渶瑕佸垽鏂攣 - if (list[i].LocCntrRel != null && list[i].LocCntrRel.CntrItemRel != null) - { - if (list[i].N_CURRENT_NUM < list[i].N_CAPACITY) - { - result = list[i]; - } - else - { - Console.WriteLine("閫夋嫨鍚庨潰绌轰綅"); - result = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == list[i].N_ROW && a.N_COL > list[i].N_COL && a.C_ENABLE == "Y").OrderBy(a => a.N_COL).First(); - } - - if (result != null) - { - break; - } - } - - } - } - } - - if (result == null) - { - #region 鏌ユ壘鎵�湁鏁伴噺鏄┖鐨勬帓 - //Console.WriteLine("鏌ユ壘鎵�湁鏁伴噺鏄┖鐨勬帓"); - //2.0 绠�寲鏌ヨ鍙煡姣忎竴鎺掔涓�垪 - list = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == row).OrderBy(a => a.N_COL).Take(1).PartitionBy(a => a.N_ROW).ToList().Where(a => a.N_CURRENT_NUM == 0).ToList(); - //2.1 閫変竴涓┖鎺�- for (int i = 0; i < list.Count; i++) - { - var other = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == list[i].N_ROW && a.S_LOCK_STATE != "鏃�).First(); - if (list[i].N_LOCK_STATE == 0 && other == null) - { - //浜屾鏍¢獙褰撳墠鎺掓墍鏈夎揣浣嶉兘鏄┖鐨勶紝闃叉绯荤粺鏁版嵁閿欎贡 - var rowSumInfo = db.Queryable<Location>().Where(l => l.S_AREA_CODE == area && l.N_ROW == list[i].N_ROW && l.N_CURRENT_NUM != 0).Count(); - if (rowSumInfo == 0) - { - result = list[i]; - break; - } - } - } - #endregion - } - - if (result != null && (!string.IsNullOrEmpty(result.C_ENABLE) && (result.C_ENABLE == "绂佺敤" || result.C_ENABLE == "N"))) - { - //绂佺敤浜嗛�鎷╁悗闈竴涓揣浣�- //Console.WriteLine("绂佺敤浜嗛�鎷╁悗闈竴涓揣浣�); - result = db.Queryable<Location>().OrderBy(a => a.N_COL).Where(a => a.S_AREA_CODE == area && a.N_ROW == result.N_ROW && (string.IsNullOrEmpty(a.C_ENABLE) || (a.C_ENABLE != "绂佺敤" && a.C_ENABLE != "N")) && a.N_COL > result.N_COL).First(); - } - } - catch (Exception ex) - { - LogHelper.Error("GetLocation4InFinish:" + ex.Message, ex); - } - return result; - } - - - public static List<Location> GetLocationList(string area , int row) { - List<Location> result = new List<Location> (); - try { - var db = new SqlHelper<object>().GetInstance(); - result = db.Queryable<Location>().Where(a => a.S_AREA_CODE == area && a.N_ROW == row).Includes(a => a.LocCntrRel, a => a.CntrItemRel).ToList(); - } - catch (Exception ex) { - LogHelper.Error("GetLocationList:" + ex.Message, ex); - } - return result; - } - - public static List<TN_YiKuDetail> getShiftOrderDetail(string orderNo = null) { - var db = new SqlHelper<object>().GetInstance(); - List<TN_YiKuDetail> details = new List<TN_YiKuDetail>(); - var orderList = db.Queryable<TN_YiKuOrder>().Where(a => a.S_B_STATE == "鎵ц").ToList(); - foreach (var order in orderList) - { - var detail = db.Queryable<TN_YiKuDetail>().Where(a => order.S_NO == a.S_NO).First(); - if (detail != null) - { - details.Add(detail); - } - } - return details; - } - - public static bool updateShiftOrderDetail(TN_YiKuDetail detail) { bool result = false; var db = new SqlHelper<object>().GetInstance(); - LogHelper.Info("绉诲簱瀹屾垚鏁伴噺鍙樻洿鍙傛暟锛� + JsonConvert.SerializeObject(detail), "TSSG"); - result = db.Updateable<TN_YiKuDetail>() - .SetColumns(a => new TN_YiKuDetail() { N_COMPLETE_NUM = a.N_COMPLETE_NUM + 1 }) - .Where(a => a.S_NO == detail.S_NO - && a.S_START_AREA == detail.S_START_AREA - && a.S_START_ROW == detail.S_START_ROW - && a.S_END_AREA == detail.S_END_AREA - && a.S_END_ROW == detail.S_END_ROW - ) - .ExecuteCommand() > 0; + var offLineRecord = db.Queryable<OffLineRecord>().Where(a => a.S_RFID == record.S_RFID).First(); + if (offLineRecord != null) + { + offLineRecord.S_LOC = record.S_LOC; + offLineRecord.N_IS_URGENT = record.N_IS_URGENT; + offLineRecord.T_OFF_TIME = record.T_OFF_TIME; + offLineRecord.N_IS_FULL = record.N_IS_FULL; + result = db.Updateable(offLineRecord).ExecuteCommand() > 0; + } + else + { + result = db.Insertable(record).ExecuteCommand() > 0; + } + return result; + } - var completeResult = db.Queryable<TN_YiKuDetail>().Where(a => a.S_NO == detail.S_NO && a.N_QTY > a.N_COMPLETE_NUM).Count() == 0; - if(completeResult) { - result = db.Updateable<TN_YiKuOrder>().SetColumns(a => new TN_YiKuOrder() { S_B_STATE = "瀹屾垚" }).Where(a => a.S_NO == detail.S_NO).ExecuteCommand() > 0; + /// <summary> + /// 鏌ヨ鎴愬瀷鏈轰笅绾胯褰�+ /// </summary> + /// <param name="rfid"></param> + /// <returns></returns> + public static OffLineRecord getOffLineRecord(string rfid) + { + OffLineRecord offLineRecord = null; + var db = new SqlHelper<object>().GetInstance(); + if (rfid != null) + { + offLineRecord = db.Queryable<OffLineRecord>().Where(a => a.S_RFID == rfid).First(); + } + return offLineRecord; + } + + /// <summary> + /// 鏌ヨ鐗╂枡鏉$爜淇℃伅 + /// </summary> + /// <param name="barcode"></param> + /// <returns></returns> + public static GreenTireInformation GetGreenTireInformation(string barcode) + { + GreenTireInformation greenTireInformation = null; + var db = new SqlHelper<object>().GetInstance(); + if (barcode != null) + { + greenTireInformation = db.Queryable<GreenTireInformation>().Where(a => a.BARCODE == barcode).First(); + } + return greenTireInformation; + } + + /// <summary> + /// 鏌ヨ鍏ュ簱缁堢偣璐т綅 + /// </summary> + /// <param name="itemCode"></param> + /// <param name="locNum">1.鍗曡揣浣�2.鍙岃揣浣�/param> + /// <returns></returns> + public static List<Location> getInStockEndLoc(string itemCode, int locNum) + { + var db = new SqlHelper<object>().GetInstance(); + List<Location> locations = new List<Location>(); + // 1.鎸夊绉巼浠庡ぇ鍒板皬锛屽宸烽亾杩涜鎺掑簭 + var roadwayOrderList = db.Queryable<Location>().Where(a => a.S_AREA_CODE == Settings.stockArea && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y") + .GroupBy(a => a.N_ROADWAY) + .Select(a => new { roadway = a.N_ROADWAY , num = SqlFunc.AggregateCount(a.S_CODE)}) + .OrderByDescending(a => a.num) + .ToList(); + + // 鏌ヨ鍗曡揣浣�+ if (locNum == 1) + { + foreach (var order in roadwayOrderList) + { + // 1. 鏌ヨ1鍙疯揣浣嶆槸鍚︽湁鐩稿悓鐗╂枡,鏈夛紝鍒欐煡璇㈠搴旂殑2鍙疯揣浣嶆槸鍚︿负绌�+ var oneLocList = db.Queryable<Location>() + .LeftJoin<LocCntrRel>((a,b) => a.S_CODE == b.S_LOC_CODE) + .LeftJoin<CntrItemRel>((a,b,c) => b.S_CNTR_CODE == c.S_CNTR_CODE) + .Where((a, b, c) => a.S_AREA_CODE == Settings.stockArea + && a.N_ROADWAY == order.roadway + && a.N_COL % 2 == 1 + && a.N_CURRENT_NUM == 1 + && a.N_LOCK_STATE == 0 + && a.C_ENABLE == "Y" + && c.S_ITEM_CODE == itemCode + ) + .OrderBy(a => a.N_LAYER).OrderBy(a => a.N_COL) + .ToList(); + if (oneLocList.Count > 0) + { + foreach (var loc in oneLocList) + { + var twoLoc = db.Queryable<Location>().Where(a => a.S_AREA_CODE == Settings.stockArea && a.N_ROADWAY == order.roadway && a.N_ROW == loc.N_ROW && a.N_COL == loc.N_COL + 1 && a.N_LAYER == loc.N_LAYER && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").First(); + if (twoLoc != null) + { + locations.Add(twoLoc); + return locations; + } + } + } + + // 2.鏌ヨ2鍙疯揣浣嶆槸鍚︽湁鐩稿悓鐗╂枡锛屾湁锛屽垯鏌ヨ瀵瑰簲鐨�鍙蜂綅鏄惁涓虹┖ + if (locations.Count == 0) + { + var twoLocList = db.Queryable<Location>() + .LeftJoin<LocCntrRel>((a, b) => a.S_CODE == b.S_LOC_CODE) + .LeftJoin<CntrItemRel>((a, b, c) => b.S_CNTR_CODE == c.S_CNTR_CODE) + .Where((a, b, c) => a.S_AREA_CODE == Settings.stockArea + && a.N_ROADWAY == order.roadway + && a.N_COL % 2 == 0 + && a.N_CURRENT_NUM == 1 + && a.N_LOCK_STATE == 0 + && a.C_ENABLE == "Y" + && c.S_ITEM_CODE == itemCode + ) + .OrderBy(a => a.N_LAYER).OrderBy(a => a.N_COL) + .ToList(); + + if (twoLocList.Count > 0) + { + foreach (var loc in twoLocList) + { + var oneLoc = db.Queryable<Location>().Where(a => a.S_AREA_CODE == Settings.stockArea && a.N_ROADWAY == order.roadway && a.N_ROW == loc.N_ROW && a.N_COL == loc.N_COL - 1 && a.N_LAYER == loc.N_LAYER && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").First(); + if (oneLoc != null) + { + locations.Add(oneLoc); + return locations; + } + } + } + } + + // 3.娌℃湁鐩稿悓鐗╂枡鐨�浼樺厛鏀剧鐢ㄨ揣浣嶆梺杈癸紙鍗曚竴璐т綅锛�+ if (locations.Count == 0) + { + var disableLocList= db.Queryable<Location>().Where(a => a.S_AREA_CODE == Settings.stockArea && a.N_ROADWAY == order.roadway && a.C_ENABLE == "N").OrderBy(a => a.N_LAYER).ToList(); + foreach (var loc in disableLocList) + { + // 璐т綅涓�鍙蜂綅锛屽垯鏌ヨ瀵瑰簲浜屽彿浣嶆槸鍚︿负绌�+ if (loc.N_LAYER % 2 == 1) + { + var twoLoc = db.Queryable<Location>().Where(a => a.S_AREA_CODE == Settings.stockArea && a.N_ROADWAY == order.roadway && a.N_ROW == loc.N_ROW && a.N_COL == loc.N_COL + 1 && a.N_LAYER == loc.N_LAYER && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").First(); + if (twoLoc != null) + { + locations.Add(twoLoc); + return locations; + } + } + + // 璐т綅涓�鍙蜂綅锛屽垯鏌ヨ瀵瑰簲涓�彿浣嶆槸鍚︿负绌�+ if (loc.N_LAYER % 2 == 0) + { + var oneLoc = db.Queryable<Location>().Where(a => a.S_AREA_CODE == Settings.stockArea && a.N_ROADWAY == order.roadway && a.N_ROW == loc.N_ROW && a.N_COL == loc.N_COL - 1 && a.N_LAYER == loc.N_LAYER && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").First(); + if (oneLoc != null) + { + locations.Add(oneLoc); + return locations; + } + } + } + } + + // 4.娌℃湁鐩稿悓鐗╂枡鐨勶紝涓旂鐢ㄨ揣浣嶆梺杈规病鏈夌┖璐т綅锛屽垯浼樺厛鏀�鍙蜂綅 + if (locations.Count == 0) + { + oneLocList = db.Queryable<Location>().Where(a => a.S_AREA_CODE == Settings.stockArea && a.N_ROADWAY == order.roadway && a.N_COL % 2 == 1 && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").OrderBy(a => a.N_LAYER).OrderByDescending(a => a.N_COL).ToList(); + if (oneLocList.Count > 0) + { + locations.Add(oneLocList[0]); + return locations; + } + } + } + } + + // 鏌ヨ鍙岃揣浣�+ if (locNum == 2) + { + foreach (var order in roadwayOrderList) + { + var oneLocList = db.Queryable<Location>().Where( a => a.S_AREA_CODE == Settings.stockArea && a.N_ROADWAY == order.roadway && a.N_COL % 2 == 1 && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").OrderBy(a => a.N_LAYER).OrderBy(a => a.N_COL).ToList(); + foreach (var loc in oneLocList) + { + var twoLoc = db.Queryable<Location>().Where(a => a.S_AREA_CODE == Settings.stockArea && a.N_ROADWAY == order.roadway && a.N_ROW == loc.N_ROW && a.N_COL == loc.N_COL + 1 && a.N_LAYER == loc.N_LAYER && a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0 && a.C_ENABLE == "Y").First(); + if (twoLoc != null) + { + locations.Add(loc); + locations.Add(twoLoc); + return locations; + } + } + } + } + return locations; + } + + /// <summary> + /// 鏌ヨ寮傚父鍖虹┖璐т綅 + /// </summary> + /// <param name="areaCode"></param> + public static Location getAbnormalAreaEmptyLoc(string areaCode) + { + Location location = new Location(); + var db = new SqlHelper<object>().GetInstance(); + location = db.Queryable<Location>().Where(a => a.S_AREA_CODE == areaCode && a.N_CURRENT_NUM == 0 && a.C_ENABLE == "Y" && a.N_LOCK_STATE == 0).First(); + return location; + } + + /// <summary> + /// 鏌ヨ宸烽亾浠诲姟鏈�皯鐨勬帴椹充綅 + /// </summary> + /// <returns></returns> + public static Location getMinTaskMiddleLoc(int type) + { + Location location = new Location(); + var db = new SqlHelper<object>().GetInstance(); + var roadwayGroup = db.Queryable<Location>() + .LeftJoin<WCSTask>((a,b) => a.S_CODE == b.S_END_LOC && b.N_B_STATE < 3) + .Where((a, b) => a.S_AREA_CODE == Settings.stockArea && b.S_CODE != null ) + .GroupBy((a, b) => a.N_ROADWAY) + .Select( (a, b) => new { roadway = a.N_ROADWAY , num = SqlFunc.AggregateDistinctCount(a.S_CODE)}) + .OrderBy(a => a.num) + .ToList(); + + foreach (var item in roadwayGroup) + { + // 1.鏌ヨ宸烽亾鍐呯殑鍫嗗灈鏈虹姸鎬佹槸鍚︽甯�+ + // 2.鏌ヨ鎺ラ┏浣�+ var connectLoc = Settings.connectLocList.Where(a => a.type == type && a.roadway == item.roadway).FirstOrDefault(); + if (connectLoc != null) + { + location = LocationHelper.GetLoc(connectLoc.locCode); + break; + } + } + return location; + } + + /// <summary> + /// 鏌ヨ鐗╂枡瀛樻斁鏃堕棿閰嶇疆淇℃伅 + /// </summary> + /// <param name="bc_entried"></param> + /// <returns></returns> + public static Overage getOverage(string bc_entried) + { + + var db = new SqlHelper<object>().GetInstance(); + + // 鐩存帴鎵ц SQL锛堝弬鏁板寲鏌ヨ锛�+ var sql = "SELECT get_ovg_bar(@barcode, @mcngrp) AS overage_value"; + var sql1 = "SELECT get_minhour_bar(@barcode, @mcngrp) AS overage_value"; + + // 浣跨敤鍖垮悕瀵硅薄浼犻�鍙傛暟 + var ovg_bar = db.Ado.SqlQuery<int>(sql, new { barcode = bc_entried, mcngrp = "0" }); + var minhour_bar = db.Ado.SqlQuery<float>(sql1, new { barcode = bc_entried, mcngrp = "0" }); + if (ovg_bar.Count > 0 && minhour_bar.Count > 0) + { + Overage overage = new Overage() + { + MINHOUR = minhour_bar[0], + OVERAGE = ovg_bar[0] + }; + return overage; + } + return null; + } + + public static bool bindBarcodeItemInfo( string cntrCode,GreenTireInformation greenTireInformation) + { + bool result = false; + var db = new SqlHelper<object>().GetInstance(); + var cntrItemRel = db.Queryable<CntrItemRel>().Where(a => a.S_CNTR_CODE == cntrCode).First(); + if (cntrItemRel == null) + { + var overage = getOverage(greenTireInformation.BARCODE); + DateTime txndate = DateTime.Parse(greenTireInformation.TXNDATE); + DateTime minTime = txndate.AddHours(overage.MINHOUR); + DateTime maxTime = txndate.AddDays(overage.OVERAGE); + cntrItemRel = new CntrItemRel() + { + S_CG_ID = greenTireInformation.BARCODE, + S_ITEM_CODE = greenTireInformation.ITEMCODE, + S_CNTR_CODE = cntrCode, + S_CELL_NO = greenTireInformation.TIRECODE, + F_QTY = greenTireInformation.QTY, + S_MCN = greenTireInformation.MCN, + S_OPR = greenTireInformation.OPR, + S_OPR02 = greenTireInformation.OPR02, + S_OPR03 = greenTireInformation.OPR03, + S_OPR04 = greenTireInformation.OPR04, + S_WINDUP = greenTireInformation.WINDUP, + S_TXNDATE = greenTireInformation.TXNDATE, + S_DATE_SHIFT = greenTireInformation.DATE_SHIFT, + S_EFFECTIVE_TIME = minTime.ToString("yyyy-MM-dd HH:mm:ss"), + S_EXPIRATION_TIME = maxTime.ToString("yyyy-MM-dd HH:mm:ss"), + }; + result = db.Insertable(cntrItemRel).ExecuteCommand() > 0; + } + else + { + var overage = getOverage(greenTireInformation.BARCODE); + DateTime txndate = DateTime.Parse(greenTireInformation.TXNDATE); + DateTime minTime = txndate.AddHours(overage.MINHOUR); + DateTime maxTime = txndate.AddDays(overage.OVERAGE); + cntrItemRel.S_CG_ID = greenTireInformation.BARCODE; + cntrItemRel.S_ITEM_CODE = greenTireInformation.ITEMCODE; + cntrItemRel.S_CNTR_CODE = cntrCode; + cntrItemRel.S_CELL_NO = greenTireInformation.TIRECODE; + cntrItemRel.F_QTY = greenTireInformation.QTY; + cntrItemRel.S_MCN = greenTireInformation.MCN; + cntrItemRel.S_OPR = greenTireInformation.OPR; + cntrItemRel.S_OPR02 = greenTireInformation.OPR02; + cntrItemRel.S_OPR03 = greenTireInformation.OPR03; + cntrItemRel.S_OPR04 = greenTireInformation.OPR04; + cntrItemRel.S_WINDUP = greenTireInformation.WINDUP; + cntrItemRel.S_TXNDATE = greenTireInformation.TXNDATE; + cntrItemRel.S_DATE_SHIFT = greenTireInformation.DATE_SHIFT; + cntrItemRel.S_EFFECTIVE_TIME = minTime.ToString("yyyy-MM-dd HH:mm:ss"); + cntrItemRel.S_EXPIRATION_TIME = maxTime.ToString("yyyy-MM-dd HH:mm:ss"); + result = db.Updateable(cntrItemRel).ExecuteCommand() > 0; } return result; } -- Gitblit v1.9.1