From 7563cdc2d0cd2fe79e5a78f3dbcbc4405fb4d852 Mon Sep 17 00:00:00 2001
From: cnf <3200815559@qq.com>
Date: 星期四, 11 九月 2025 14:18:57 +0800
Subject: [PATCH] 七喜代码
---
service/Wom/WomdaaManager.cs | 700 +++
entity/Base/ItemDetailModel.cs | 1
service/Warehouse/MesCgthSqManager.cs | 226 +
service/QC/IpqcService.cs | 185
Controllers/Warehouse/MesCgthSqController.cs | 55
Controllers/Warehouse/MesItemBlController.cs | 38
service/Warehouse/KwbgManager.cs | 219 +
Dto/service/OaToMesRecord.cs | 51
Controllers/Warehouse/MesKwcxController.cs | 132
NewPdaSqlServer.csproj | 17
Dto/Warehouse/DefineTask001Dto.cs | 50
entity/Womdaa.cs | 6
Controllers/Warehouse/MesItemQtController.cs | 71
Dto/Xky/XkyBarcodeDataDto.cs | 2
service/JJGZ/OaToMesRecordManager.cs | 215 +
entity/DeliveryNotice.cs | 12
util/LogUtil.cs | 5
entity/LLJView.cs | 2
service/base/MesPrintMangeer.cs | 23
Controllers/LoginController.cs | 28
service/Warehouse/MesItemBlManager.cs | 923 ----
entity/MesItemQtDatall.cs | 6
service/Warehouse/MesInvItemInCDetailsManager.cs | 1835 ++++-----
Controllers/AGV/app.config | 15
Controllers/QC/IpqcController.cs | 21
service/Warehouse/MesItemQtrkManager.cs | 182
appsettings.json | 13
service/Warehouse/MesKwcxManager.cs | 99
.gitignore | 190
service/Warehouse/MesCprkManager.cs | 2
Controllers/JJGZ/OaToMesRecordController.cs | 72
entity/Inventory.cs | 8
service/ErpKcManager.cs | 133
service/Warehouse/MesItemTblManager.cs | 667 ---
service/Wom/WwGdManager.cs | 2
Config/appsettings.Development.json | 8
service/Warehouse/MesBarCFManager.cs | 51
Controllers/AGV/AgvApiController.cs | 424 ++
Controllers/AGV/MesClient.cs | 402 ++
Dto/service/WarehouseQuery.cs | 3
Controllers/Warehouse/MesItemTblController.cs | 10
Dto/ErpKc.cs | 17
Controllers/BaseController.cs | 21
Controllers/Kingdee/ErpKcController.cs | 43
Dto/service/ScanWorkResult.cs | 7
Properties/launchSettings.json | 28
Controllers/Warehouse/KwbgController.cs | 89
Controllers/Wom/WomdaaController.cs | 238 +
Dto/Warehouse/DefineTask006Dto.cs | 50
Controllers/Warehouse/MesXsthController.cs | 6
service/base/LoginService.cs | 75
service/Warehouse/MesItemQtManager.cs | 290 +
Config/appsettings.json | 30
Controllers/Warehouse/MesInvItemInCDetailsController.cs | 48
service/Warehouse/MesXkyService.cs | 12
Dto/service/ScanWorkRequest.cs | 7
Startup.cs | 6
Controllers/Wom/MesWorkProdController.cs | 54
entity/Base/RequestInfo.cs | 63
Dto/Warehouse/DefineTask002Dto.cs | 21
service/Warehouse/MesXkyShdManager.cs | 14
service/Warehouse/MesXsckManager.cs | 95
service/QC/OaApi.cs | 50
service/Wom/MesWorkProdManager.cs | 736 +--
service/Warehouse/MesXsthManager.cs | 99
util/XkyApiHelper.cs | 15
Controllers/Warehouse/MesItemQtrkController.cs | 8
entity/ErpMesKc.cs | 50
/dev/null | 1121 ------
util/BillNo.cs | 24
Controllers/Warehouse/MesXsckController.cs | 6
Dto/service/ProductionPickDto.cs | 4
Controllers/Warehouse/MesBarCFController.cs | 58
Dto/Warehouse/DefineTask005Dto.cs | 16
74 files changed, 5,737 insertions(+), 4,768 deletions(-)
diff --git a/.gitignore b/.gitignore
index a3787ab..55165ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,26 +1,26 @@
### TortoiseGit template
# Project-level settings
/.tgitconfig
-
+
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
-
+
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
-
+
.idea
-
+
# AWS User-specific
.idea/**/aws.xml
-
+
# Generated files
.idea/**/contentModel.xml
-
+
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
@@ -29,11 +29,11 @@
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
-
+
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
-
+
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
@@ -46,48 +46,48 @@
# .idea/modules
# *.iml
# *.ipr
-
+
# CMake
cmake-build-*/
-
+
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
-
+
# File-based project format
*.iws
-
+
# IntelliJ
out/
-
+
# mpeltonen/sbt-idea plugin
.idea_modules/
-
+
# JIRA plugin
atlassian-ide-plugin.xml
-
+
# Cursive Clojure plugin
.idea/replstate.xml
-
+
# SonarLint plugin
.idea/sonarlint/
-
+
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
-
+
# Editor-based Rest Client
.idea/httpRequests
-
+
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
-
+
### Git template
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
-
+
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
@@ -97,29 +97,29 @@
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
-
+
### SVN template
.svn/
-
+
### vs template
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
-
+
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
-
+
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
-
+
# Mono auto generated files
mono_crash.*
-
+
# Build results
[Dd]ebug/
[Dd]ebugPublic/
@@ -134,40 +134,40 @@
[Oo]bj/
[Ll]og/
[Ll]ogs/
-
+
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
-
+
# Visual Studio 2017 auto generated files
Generated\ Files/
-
+
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
-
+
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
-
+
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
-
+
# Benchmark Results
BenchmarkDotNet.Artifacts/
-
+
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
-
+
# StyleCop
StyleCopReport.xml
-
+
# Files built by Visual Studio
*_i.c
*_p.c
@@ -196,10 +196,10 @@
*.pidb
*.svclog
*.scc
-
+
# Chutzpah Test files
_Chutzpah*
-
+
# Visual C++ cache files
ipch/
*.aps
@@ -210,59 +210,59 @@
*.cachefile
*.VC.db
*.VC.VC.opendb
-
+
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
-
+
# Visual Studio Trace Files
*.e2e
-
+
# TFS 2012 Local Workspace
$tf/
-
+
# Guidance Automation Toolkit
*.gpState
-
+
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
-
+
# TeamCity is a build add-in
_TeamCity*
-
+
# DotCover is a Code Coverage Tool
*.dotCover
-
+
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
-
+
# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
-
+
# Visual Studio code coverage results
*.coverage
*.coveragexml
-
+
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
-
+
# MightyMoose
*.mm.*
AutoTest.Net/
-
+
# Web workbench (sass)
.sass-cache/
-
+
# Installshield output folder
[Ee]xpress/
-
+
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
@@ -272,10 +272,10 @@
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
-
+
# Click-Once directory
publish/
-
+
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
@@ -283,12 +283,12 @@
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
-
+
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
-
+
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
@@ -302,15 +302,15 @@
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
-
+
# Microsoft Azure Build Output
csx/
*.build.csdef
-
+
# Microsoft Azure Emulator
ecf/
rcf/
-
+
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
@@ -319,13 +319,13 @@
*.appx
*.appxbundle
*.appxupload
-
+
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
-
+
# Others
ClientBin/
~$*
@@ -336,18 +336,18 @@
*.pfx
*.publishsettings
orleans.codegen.cs
-
+
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
-
+
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
-
+
# RIA/Silverlight projects
Generated_Code/
-
+
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
@@ -357,12 +357,12 @@
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
-
+
# SQL Server files
*.mdf
*.ldf
*.ndf
-
+
# Business Intelligence projects
*.rdl.data
*.bim.layout
@@ -371,26 +371,26 @@
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
-
+
# Microsoft Fakes
FakesAssemblies/
-
+
# GhostDoc plugin setting file
*.GhostDoc.xml
-
+
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
-
+
# Visual Studio 6 build log
*.plg
-
+
# Visual Studio 6 workspace options file
*.opt
-
+
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
-
+
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
@@ -398,60 +398,64 @@
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
-
+
# Paket dependency manager
.paket/paket.exe
paket-files/
-
+
# FAKE - F# Make
.fake/
-
+
# CodeRush personal settings
.cr/personal
-
+
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
-
+
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
-
+
# Tabs Studio
*.tss
-
+
# Telerik's JustMock configuration file
*.jmconfig
-
+
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
-
+
# OpenCover UI analysis results
OpenCover/
-
+
# Azure Stream Analytics local run output
ASALocalRun/
-
+
# MSBuild Binary and Structured Log
*.binlog
-
+
# NVidia Nsight GPU debugger configuration file
*.nvuser
-
+
# MFractors (Xamarin productivity tool) working folder
.mfractor/
-
+
# Local History for Visual Studio
.localhistory/
-
+
# BeatPulse healthcheck temp database
healthchecksdb
-
+
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
-
+
# Ionide (cross platform F# VS Code tools) working folder
-.ionide/
\ No newline at end of file
+.ionide/
+
+.vscode/launch.json
+.gitignore
+.vscode/tasks.json
diff --git a/Config/appsettings.Development.json b/Config/appsettings.Development.json
new file mode 100644
index 0000000..0c208ae
--- /dev/null
+++ b/Config/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/Config/appsettings.json b/Config/appsettings.json
new file mode 100644
index 0000000..b921a8d
--- /dev/null
+++ b/Config/appsettings.json
@@ -0,0 +1,30 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*",
+ "AppSettings": {
+ "TestErpUrl": "http://192.168.1.149:8066/WebService1.asmx/MesToErpinfoTest",
+ "ProductionErpUrl": "http://192.168.1.149:8066/WebService1.asmx/MesToErpinfoTest"
+ //"DataBaseConn": "Data Source=192.168.1.146;Initial Catalog=TEST_MES;User ID=sa;Password =qixi123;Encrypt=True;TrustServerCertificate=True;"
+ //"DataBaseConn": "Data Source=192.168.1.146;Initial Catalog=GS_MES;User ID=mesUser;Password =qixi1qaz@WSXmes;Encrypt=True;TrustServerCertificate=True;"
+ },
+ //"Version": "1.0.0",
+ //"X-KDApi-AcctID": "683e92c7f92688",
+ //"X-KDApi-UserName": "MES",
+ //"X-KDApi-AppID": "315464_W58Nw/DtRIpUxewFR6WpRZzN5qT62BPK",
+ //"X-KDApi-AppSec": "f853011716de43589aade7b9dbbbe9e6",
+ //"X-KDApi-LCID": "2052",
+ //"X-KDApi-ServerUrl": "http://192.168.1.141/k3cloud/",
+
+ "Version": "1.0.0",
+ "X-KDApi-AcctID": "6704a3360dafca",
+ "X-KDApi-UserName": "GS_MES",
+ "X-KDApi-AppID": "322643_SYeD28kvynn+4V9tX4XKSb1HRM66QpnI",
+ "X-KDApi-AppSec": "aac3bd55e1f542bd85ca69c7419d9d8f",
+ "X-KDApi-LCID": "2052",
+ "X-KDApi-ServerUrl": "http://192.168.1.141/K3Cloud/"
+}
diff --git a/Controllers/AGV/AgvApiController.cs b/Controllers/AGV/AgvApiController.cs
new file mode 100644
index 0000000..e0e813b
--- /dev/null
+++ b/Controllers/AGV/AgvApiController.cs
@@ -0,0 +1,424 @@
+using System.Dynamic;
+using Azure;
+using Microsoft.AspNetCore.Mvc;
+using NewPdaSqlServer.Dto.service;
+using NewPdaSqlServer.entity;
+using NewPdaSqlServer.util;
+using Newtonsoft.Json.Linq;
+using System.ServiceModel;
+using System.IO;
+using NewPdaSqlServer.Dto.Warehouse;
+using NewPdaSqlServer.DB;
+using Newtonsoft.Json;
+
+namespace NewPdaSqlServer.Controllers.AGV;
+
+[Route("api/[controller]")]
+[ApiController]
+public class AgvApiController : ControllerBase
+{
+ OaApiService m = new OaApiService();
+
+ //鍦ㄧ被鍐呮坊鍔犳棩蹇楁柟娉�
+ // private void LogToFile(string methodName, object request, string response)
+ //{
+ // string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs", $"AgvLog_{DateTime.Now:yyyyMMdd}.log");
+ // Directory.CreateDirectory(Path.GetDirectoryName(logPath));
+
+ // string logContent = $"[{DateTime.Now:HH:mm:ss}] 鏂规硶锛歿methodName}\n" +
+ // $"璇锋眰鍙傛暟锛歿JObject.FromObject(request)}\n" +
+ // $"鍝嶅簲缁撴灉锛歿response}\n\n";
+
+ // File.AppendAllText(logPath, logContent);
+ //}
+
+ // 淇敼鐜版湁鏂规硶锛堜互AgvTest涓轰緥锛�
+ [HttpPost("AgvTest")]
+ public ResponseResult AgvTest(dynamic queryObj)
+ {
+ try
+ {
+ var binding = new BasicHttpBinding { /* 鍘熸湁閰嶇疆 */ };
+ var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet");
+ var factory = new ChannelFactory<IImesInterface>(binding, endpoint);
+
+ var channel = factory.CreateChannel();
+ string result = channel.PrintHello();
+ ((IClientChannel)channel).Close();
+
+ // 璁板綍鏃ュ織
+ //LogToFile(nameof(AgvTest), new { queryObj }, result);
+
+ return new ResponseResult { status = 0, message = "OK", data = result };
+ }
+ catch (Exception ex)
+ {
+ //LogToFile(nameof(AgvTest), new { queryObj }, $"寮傚父锛歿ex}");
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ //绔嬪簱閫佹
+ [HttpPost("DefineTask_001")]
+ public ResponseResult DefineTask_001(DefineTask001Dto dto)
+ {
+ string _requestJson = string.Empty;
+ dynamic _responseData = new System.Dynamic.ExpandoObject();
+ string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ int sendStatus = 0;
+ string _logMessage = "銆怉GV銆戠珛搴撻�佹";
+
+ try
+ {
+ var binding = new BasicHttpBinding
+ {
+ MaxReceivedMessageSize = 10485760, // 10MB
+ TextEncoding = System.Text.Encoding.UTF8
+ };
+
+ var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet");
+ //var endpoint = new EndpointAddress("http://192.168.32.17:8000/MesGet");
+ var factory = new ChannelFactory<IImesInterface>(binding, endpoint);
+
+ var channel = factory.CreateChannel();
+ //string result = channel.DefineTask_001("GS2025070700001","TEST.01","AGV娴嬭瘯鐗╂枡鍚嶇О", "AGV娴嬭瘯鐗╂枡瑙勬牸",100,"鍙�",1);
+ string result = channel.DefineTask_001(
+ dto.MesId,
+ dto.MatId,
+ dto.MatName,
+ dto.MatStandard,
+ dto.MatNumber,
+ dto.MatUnit,
+ dto.Postition);
+
+ ((IClientChannel)channel).Close();
+
+ // 璁板綍璇锋眰鎶ユ枃
+ _requestJson = JsonConvert.SerializeObject(dto);
+
+ _responseData = result;
+ sendStatus = 1;
+
+ var logService = new LogService();
+ logService.CreateLogI(
+ db: null,
+ edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"),
+ abtGuid: null,
+ abtTable: "AGV_TASK",
+ detail: _logMessage,
+ orderNo: dto.MesId,
+ sendJson: _requestJson,
+ rtnJson: JsonConvert.SerializeObject(_responseData),
+ xkyBeginTime: null,
+ xkyEndTime: null,
+ sendStatus: sendStatus,
+ executeTime: _executeTimestamp
+ );
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = result
+ };
+ }
+ catch (Exception ex)
+ {
+ var logService = new LogService();
+ logService.CreateLogI(
+ db: null,
+ edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"),
+ abtGuid: null,
+ abtTable: "AGV_TASK",
+ detail: _logMessage + $"绯荤粺寮傚父锛歿ex.Message}",
+ orderNo: dto.MesId,
+ sendJson: _requestJson,
+ rtnJson: JsonConvert.SerializeObject(_responseData),
+ xkyBeginTime: null,
+ xkyEndTime: null,
+ sendStatus: 0,
+ executeTime: _executeTimestamp
+ );
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ //绔嬪簱妫�楠�
+ [HttpPost("DefineTask_002")]
+ public ResponseResult DefineTask_002(DefineTask002Dto dto)
+ {
+ string _requestJson = string.Empty;
+ dynamic _responseData = new System.Dynamic.ExpandoObject();
+ string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ int sendStatus = 0;
+ string _logMessage = "銆怉GV銆戠珛搴撴楠�";
+
+ try
+ {
+ var binding = new BasicHttpBinding
+ {
+ MaxReceivedMessageSize = 10485760, // 10MB
+ TextEncoding = System.Text.Encoding.UTF8
+ };
+
+ var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet");
+ //var endpoint = new EndpointAddress("http://192.168.32.17:8000/MesGet");
+ var factory = new ChannelFactory<IImesInterface>(binding, endpoint);
+
+ var channel = factory.CreateChannel();
+ //string result = channel.DefineTask_002("GS2025070900010", "鍚堟牸");
+ string result = channel.DefineTask_002(
+ dto.MesId,
+ dto.MatStatus);
+
+ ((IClientChannel)channel).Close();
+
+ // 璁板綍璇锋眰鎶ユ枃
+ _requestJson = JsonConvert.SerializeObject(dto);
+
+ _responseData = result;
+ sendStatus = 1;
+
+ var logService = new LogService();
+ logService.CreateLogI(
+ db: null,
+ edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"),
+ abtGuid: null,
+ abtTable: "AGV_TASK",
+ detail: _logMessage,
+ orderNo: dto.MesId,
+ sendJson: _requestJson,
+ rtnJson: JsonConvert.SerializeObject(_responseData),
+ xkyBeginTime: null,
+ xkyEndTime: null,
+ sendStatus: sendStatus,
+ executeTime: _executeTimestamp
+ );
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = result
+ };
+ }
+ catch (Exception ex)
+ {
+ var logService = new LogService();
+ logService.CreateLogI(
+ db: null,
+ edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"),
+ abtGuid: null,
+ abtTable: "AGV_TASK",
+ detail: _logMessage + $"绯荤粺寮傚父锛歿ex.Message}",
+ orderNo: dto.MesId,
+ sendJson: _requestJson,
+ rtnJson: JsonConvert.SerializeObject(_responseData),
+ xkyBeginTime: null,
+ xkyEndTime: null,
+ sendStatus: 0,
+ executeTime: _executeTimestamp
+ );
+
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ //绔嬪簱鍛煎彨
+ [HttpPost("DefineTask_005")]
+ public ResponseResult DefineTask_005(DefineTask005Dto dto)
+ {
+ string _requestJson = string.Empty;
+ dynamic _responseData = new System.Dynamic.ExpandoObject();
+ string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ int sendStatus = 0;
+ string _logMessage = "銆怉GV銆戠珛搴撳懠鍙�";
+ try
+ {
+ var binding = new BasicHttpBinding
+ {
+ MaxReceivedMessageSize = 10485760, // 10MB
+ TextEncoding = System.Text.Encoding.UTF8
+ };
+
+ var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet");
+ //var endpoint = new EndpointAddress("http://192.168.32.17:8000/MesGet");
+ var factory = new ChannelFactory<IImesInterface>(binding, endpoint);
+
+ var channel = factory.CreateChannel();
+ //string result = channel.DefineTask_005(2);
+ string result = channel.DefineTask_005(
+ dto.Postition);
+ ((IClientChannel)channel).Close();
+
+ // 璁板綍璇锋眰鎶ユ枃
+ _requestJson = JsonConvert.SerializeObject(dto);
+
+ _responseData = result;
+ sendStatus = 1;
+
+ var logService = new LogService();
+ logService.CreateLogI(
+ db: null,
+ edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"),
+ abtGuid: null,
+ abtTable: "AGV_TASK",
+ detail: _logMessage,
+ orderNo: "",
+ sendJson: _requestJson,
+ rtnJson: JsonConvert.SerializeObject(_responseData),
+ xkyBeginTime: null,
+ xkyEndTime: null,
+ sendStatus: sendStatus,
+ executeTime: _executeTimestamp
+ );
+
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = result
+ };
+ }
+ catch (Exception ex)
+ {
+ var logService = new LogService();
+ logService.CreateLogI(
+ db: null,
+ edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"),
+ abtGuid: null,
+ abtTable: "AGV_TASK",
+ detail: _logMessage + $"绯荤粺寮傚父锛歿ex.Message}",
+ orderNo: "",
+ sendJson: _requestJson,
+ rtnJson: JsonConvert.SerializeObject(_responseData),
+ xkyBeginTime: null,
+ xkyEndTime: null,
+ sendStatus: 0,
+ executeTime: _executeTimestamp
+ );
+
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+
+ //绔嬪簱鍏ュ簱
+ [HttpPost("DefineTask_006")]
+ public ResponseResult DefineTask_006(DefineTask006Dto dto)
+ {
+ string _requestJson = string.Empty;
+ dynamic _responseData = new System.Dynamic.ExpandoObject();
+ string _executeTimestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ int sendStatus = 0;
+ string _logMessage = "銆怉GV銆戠珛搴撳叆搴�";
+
+ try
+ {
+ var binding = new BasicHttpBinding
+ {
+ MaxReceivedMessageSize = 10485760, // 10MB
+ TextEncoding = System.Text.Encoding.UTF8
+ };
+
+ var endpoint = new EndpointAddress("http://192.168.35.251:8000/MesGet");
+ //var endpoint = new EndpointAddress("http://192.168.32.17:8000/MesGet");
+ var factory = new ChannelFactory<IImesInterface>(binding, endpoint);
+
+ var channel = factory.CreateChannel();
+ //string result = channel.DefineTask_006("C2025070400040", "2.02.51.463", "绠$嚎楗按鏈�", "C638-1HA(涓囧拰VGX-SR-1A-XM鐧�)", 48, "鍙�", 4);
+ string result = channel.DefineTask_006(
+ dto.MesId,
+ dto.MatId,
+ dto.MatName,
+ dto.MatStandard,
+ dto.MatNumber,
+ dto.MatUnit,
+ dto.Postition);
+ ((IClientChannel)channel).Close();
+
+ // 璁板綍璇锋眰鎶ユ枃
+ _requestJson = JsonConvert.SerializeObject(dto);
+
+ _responseData = result;
+ sendStatus = 1;
+
+ var logService = new LogService();
+ logService.CreateLogI(
+ db: null,
+ edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"),
+ abtGuid: null,
+ abtTable: "AGV_TASK",
+ detail: _logMessage,
+ orderNo: dto.MesId,
+ sendJson: _requestJson,
+ rtnJson: JsonConvert.SerializeObject(_responseData),
+ xkyBeginTime: null,
+ xkyEndTime: null,
+ sendStatus: sendStatus,
+ executeTime: _executeTimestamp
+ );
+
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = result
+ };
+ }
+ catch (Exception ex)
+ {
+
+ var logService = new LogService();
+ logService.CreateLogI(
+ db: null,
+ edtUserGuid: Guid.Parse("11111111-1111-1111-1111-111111111111"),
+ abtGuid: null,
+ abtTable: "AGV_TASK",
+ detail: _logMessage + $"绯荤粺寮傚父锛歿ex.Message}",
+ orderNo: dto.MesId,
+ sendJson: _requestJson,
+ rtnJson: JsonConvert.SerializeObject(_responseData),
+ xkyBeginTime: null,
+ xkyEndTime: null,
+ sendStatus: 0,
+ executeTime: _executeTimestamp
+ );
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+
+
+}
+
+// 鍦ㄧ被澶栭儴娣诲姞鏈嶅姟濂戠害鎺ュ彛
+[ServiceContract(Namespace = "http://tempuri.org/")]
+public interface IImesInterface
+{
+ [OperationContract(Action = "http://tempuri.org/ImesInterface/PrintHello",
+ ReplyAction = "http://tempuri.org/ImesInterface/PrintHelloResponse")]
+ string PrintHello();
+
+ //绔嬪簱閫佹
+ [OperationContract(Action = "http://tempuri.org/ImesInterface/DefineTask_001",
+ ReplyAction = "http://tempuri.org/ImesInterface/DefineTask_001Response")]
+ string DefineTask_001(string MesId, string MatId, string MatName, string MatStandard, int MatNumber, string MatUnit, int Postition);
+
+ //绔嬪簱妫�楠�
+ [OperationContract(Action = "http://tempuri.org/ImesInterface/DefineTask_002",
+ ReplyAction = "http://tempuri.org/ImesInterface/DefineTask_002Response")]
+ string DefineTask_002(string MesId, string MatStatus);
+
+ //绔嬪簱鍛煎彨
+ [OperationContract(Action = "http://tempuri.org/ImesInterface/DefineTask_005",
+ ReplyAction = "http://tempuri.org/ImesInterface/DefineTask_005Response")]
+ string DefineTask_005(int Postition);
+
+ //绔嬪簱鍏ュ簱
+ [OperationContract(Action = "http://tempuri.org/ImesInterface/DefineTask_006",
+ ReplyAction = "http://tempuri.org/ImesInterface/DefineTask_006Response")]
+ string DefineTask_006(string MesId,string MatId,string MatName,string MatStandard,int MatNumber,string MatUnit,int Postition);
+}
diff --git a/Controllers/AGV/MesClient.cs b/Controllers/AGV/MesClient.cs
new file mode 100644
index 0000000..be5c50f
--- /dev/null
+++ b/Controllers/AGV/MesClient.cs
@@ -0,0 +1,402 @@
+锘�//------------------------------------------------------------------------------
+// <auto-generated>
+// 姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
+// 杩愯鏃剁増鏈�:4.0.30319.42000
+//
+// 瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
+// 閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便��
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+
+
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ServiceModel.ServiceContractAttribute(ConfigurationName="ImesInterface")]
+public interface ImesInterface
+{
+
+ // CODEGEN: 鍛藉悕绌洪棿 鐨勫厓绱犲悕绉� PrintHelloResult 浠ュ悗鐢熸垚鐨勬秷鎭崗瀹氭湭鏍囪涓� nillable
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/PrintHello", ReplyAction="http://tempuri.org/ImesInterface/PrintHelloResponse")]
+ PrintHelloResponse PrintHello(PrintHelloRequest request);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/PrintHello", ReplyAction="http://tempuri.org/ImesInterface/PrintHelloResponse")]
+ System.Threading.Tasks.Task<PrintHelloResponse> PrintHelloAsync(PrintHelloRequest request);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/DefineTask_001", ReplyAction="http://tempuri.org/ImesInterface/DefineTask_001Response")]
+ DefineTask_001Response DefineTask_001(DefineTask_001Request request);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/DefineTask_001", ReplyAction="http://tempuri.org/ImesInterface/DefineTask_001Response")]
+ System.Threading.Tasks.Task<DefineTask_001Response> DefineTask_001Async(DefineTask_001Request request);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/DefineTask_006", ReplyAction="http://tempuri.org/ImesInterface/DefineTask_006Response")]
+ DefineTask_006Response DefineTask_006(DefineTask_006Request request);
+
+ [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ImesInterface/DefineTask_006", ReplyAction="http://tempuri.org/ImesInterface/DefineTask_006Response")]
+ System.Threading.Tasks.Task<DefineTask_006Response> DefineTask_006Async(DefineTask_006Request request);
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
+public partial class PrintHelloRequest
+{
+
+ [System.ServiceModel.MessageBodyMemberAttribute(Name="PrintHello", Namespace="http://tempuri.org/", Order=0)]
+ public PrintHelloRequestBody Body;
+
+ public PrintHelloRequest()
+ {
+ }
+
+ public PrintHelloRequest(PrintHelloRequestBody Body)
+ {
+ this.Body = Body;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+[System.Runtime.Serialization.DataContractAttribute()]
+public partial class PrintHelloRequestBody
+{
+
+ public PrintHelloRequestBody()
+ {
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
+public partial class PrintHelloResponse
+{
+
+ [System.ServiceModel.MessageBodyMemberAttribute(Name="PrintHelloResponse", Namespace="http://tempuri.org/", Order=0)]
+ public PrintHelloResponseBody Body;
+
+ public PrintHelloResponse()
+ {
+ }
+
+ public PrintHelloResponse(PrintHelloResponseBody Body)
+ {
+ this.Body = Body;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+[System.Runtime.Serialization.DataContractAttribute(Namespace="")]
+public partial class PrintHelloResponseBody
+{
+
+ [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
+ public string PrintHelloResult;
+
+ public PrintHelloResponseBody()
+ {
+ }
+
+ public PrintHelloResponseBody(string PrintHelloResult)
+ {
+ this.PrintHelloResult = PrintHelloResult;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
+public partial class DefineTask_001Request
+{
+
+ [System.ServiceModel.MessageBodyMemberAttribute(Name="DefineTask_001", Namespace="http://tempuri.org/", Order=0)]
+ public DefineTask_001RequestBody Body;
+
+ public DefineTask_001Request()
+ {
+ }
+
+ public DefineTask_001Request(DefineTask_001RequestBody Body)
+ {
+ this.Body = Body;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.Runtime.Serialization.DataContractAttribute(Namespace="")]
+public partial class DefineTask_001RequestBody
+{
+
+ [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
+ public string taskName;
+
+ [System.Runtime.Serialization.DataMemberAttribute(Order=1)]
+ public int taskId;
+
+ public DefineTask_001RequestBody()
+ {
+ }
+
+ public DefineTask_001RequestBody(string taskName, int taskId)
+ {
+ this.taskName = taskName;
+ this.taskId = taskId;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
+public partial class DefineTask_001Response
+{
+
+ [System.ServiceModel.MessageBodyMemberAttribute(Name="DefineTask_001Response", Namespace="http://tempuri.org/", Order=0)]
+ public DefineTask_001ResponseBody Body;
+
+ public DefineTask_001Response()
+ {
+ }
+
+ public DefineTask_001Response(DefineTask_001ResponseBody Body)
+ {
+ this.Body = Body;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.Runtime.Serialization.DataContractAttribute(Namespace="")]
+public partial class DefineTask_001ResponseBody
+{
+
+ [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
+ public string DefineTaskResult;
+
+ [System.Runtime.Serialization.DataMemberAttribute(Order=1)]
+ public int taskStatusCode;
+
+ public DefineTask_001ResponseBody()
+ {
+ }
+
+ public DefineTask_001ResponseBody(string DefineTaskResult, int taskStatusCode)
+ {
+ this.DefineTaskResult = DefineTaskResult;
+ this.taskStatusCode = taskStatusCode;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
+public partial class DefineTask_006Request
+{
+
+ [System.ServiceModel.MessageBodyMemberAttribute(Name="DefineTask_006", Namespace="http://tempuri.org/", Order=0)]
+ public DefineTask_006RequestBody Body;
+
+ public DefineTask_006Request()
+ {
+ }
+
+ public DefineTask_006Request(DefineTask_006RequestBody Body)
+ {
+ this.Body = Body;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.Runtime.Serialization.DataContractAttribute(Namespace="")]
+public partial class DefineTask_006RequestBody
+{
+
+ [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
+ public string taskName;
+
+ [System.Runtime.Serialization.DataMemberAttribute(Order=1)]
+ public int taskId;
+
+ public DefineTask_006RequestBody()
+ {
+ }
+
+ public DefineTask_006RequestBody(string taskName, int taskId)
+ {
+ this.taskName = taskName;
+ this.taskId = taskId;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
+public partial class DefineTask_006Response
+{
+
+ [System.ServiceModel.MessageBodyMemberAttribute(Name="DefineTask_006Response", Namespace="http://tempuri.org/", Order=0)]
+ public DefineTask_006ResponseBody Body;
+
+ public DefineTask_006Response()
+ {
+ }
+
+ public DefineTask_006Response(DefineTask_006ResponseBody Body)
+ {
+ this.Body = Body;
+ }
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+[System.Runtime.Serialization.DataContractAttribute(Namespace="")]
+public partial class DefineTask_006ResponseBody
+{
+
+ [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=0)]
+ public string DefineTaskResult;
+
+ [System.Runtime.Serialization.DataMemberAttribute(Order=1)]
+ public int taskStatusCode;
+
+ public DefineTask_006ResponseBody()
+ {
+ }
+
+ public DefineTask_006ResponseBody(string DefineTaskResult, int taskStatusCode)
+ {
+ this.DefineTaskResult = DefineTaskResult;
+ this.taskStatusCode = taskStatusCode;
+ }
+}
+
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+public interface ImesInterfaceChannel : ImesInterface, System.ServiceModel.IClientChannel
+{
+}
+
+[System.Diagnostics.DebuggerStepThroughAttribute()]
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+public partial class ImesInterfaceClient : System.ServiceModel.ClientBase<ImesInterface>, ImesInterface
+{
+
+ public ImesInterfaceClient()
+ {
+ }
+
+ //public ImesInterfaceClient(string endpointConfigurationName) :
+ // base(endpointConfigurationName)
+ //{
+ //}
+
+ //public ImesInterfaceClient(string endpointConfigurationName, string remoteAddress) :
+ // base(endpointConfigurationName, remoteAddress)
+ //{
+ //}
+
+ //public ImesInterfaceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
+ // base(endpointConfigurationName, remoteAddress)
+ //{
+ //}
+
+ public ImesInterfaceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
+ base(binding, remoteAddress)
+ {
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ PrintHelloResponse ImesInterface.PrintHello(PrintHelloRequest request)
+ {
+ return base.Channel.PrintHello(request);
+ }
+
+ public string PrintHello()
+ {
+ PrintHelloRequest inValue = new PrintHelloRequest();
+ inValue.Body = new PrintHelloRequestBody();
+ PrintHelloResponse retVal = ((ImesInterface)(this)).PrintHello(inValue);
+ return retVal.Body.PrintHelloResult;
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ System.Threading.Tasks.Task<PrintHelloResponse> ImesInterface.PrintHelloAsync(PrintHelloRequest request)
+ {
+ return base.Channel.PrintHelloAsync(request);
+ }
+
+ public System.Threading.Tasks.Task<PrintHelloResponse> PrintHelloAsync()
+ {
+ PrintHelloRequest inValue = new PrintHelloRequest();
+ inValue.Body = new PrintHelloRequestBody();
+ return ((ImesInterface)(this)).PrintHelloAsync(inValue);
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ DefineTask_001Response ImesInterface.DefineTask_001(DefineTask_001Request request)
+ {
+ return base.Channel.DefineTask_001(request);
+ }
+
+ public string DefineTask_001(string taskName, int taskId, out int taskStatusCode)
+ {
+ DefineTask_001Request inValue = new DefineTask_001Request();
+ inValue.Body = new DefineTask_001RequestBody();
+ inValue.Body.taskName = taskName;
+ inValue.Body.taskId = taskId;
+ DefineTask_001Response retVal = ((ImesInterface)(this)).DefineTask_001(inValue);
+ taskStatusCode = retVal.Body.taskStatusCode;
+ return retVal.Body.DefineTaskResult;
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ System.Threading.Tasks.Task<DefineTask_001Response> ImesInterface.DefineTask_001Async(DefineTask_001Request request)
+ {
+ return base.Channel.DefineTask_001Async(request);
+ }
+
+ public System.Threading.Tasks.Task<DefineTask_001Response> DefineTask_001Async(string taskName, int taskId)
+ {
+ DefineTask_001Request inValue = new DefineTask_001Request();
+ inValue.Body = new DefineTask_001RequestBody();
+ inValue.Body.taskName = taskName;
+ inValue.Body.taskId = taskId;
+ return ((ImesInterface)(this)).DefineTask_001Async(inValue);
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ DefineTask_006Response ImesInterface.DefineTask_006(DefineTask_006Request request)
+ {
+ return base.Channel.DefineTask_006(request);
+ }
+
+ public string DefineTask_006(string taskName, int taskId, out int taskStatusCode)
+ {
+ DefineTask_006Request inValue = new DefineTask_006Request();
+ inValue.Body = new DefineTask_006RequestBody();
+ inValue.Body.taskName = taskName;
+ inValue.Body.taskId = taskId;
+ DefineTask_006Response retVal = ((ImesInterface)(this)).DefineTask_006(inValue);
+ taskStatusCode = retVal.Body.taskStatusCode;
+ return retVal.Body.DefineTaskResult;
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ System.Threading.Tasks.Task<DefineTask_006Response> ImesInterface.DefineTask_006Async(DefineTask_006Request request)
+ {
+ return base.Channel.DefineTask_006Async(request);
+ }
+
+ public System.Threading.Tasks.Task<DefineTask_006Response> DefineTask_006Async(string taskName, int taskId)
+ {
+ DefineTask_006Request inValue = new DefineTask_006Request();
+ inValue.Body = new DefineTask_006RequestBody();
+ inValue.Body.taskName = taskName;
+ inValue.Body.taskId = taskId;
+ return ((ImesInterface)(this)).DefineTask_006Async(inValue);
+ }
+}
diff --git a/Controllers/AGV/app.config b/Controllers/AGV/app.config
new file mode 100644
index 0000000..7d4c988
--- /dev/null
+++ b/Controllers/AGV/app.config
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <system.serviceModel>
+ <bindings>
+ <basicHttpBinding>
+ <binding name="BasicHttpBinding_ImesInterface" />
+ </basicHttpBinding>
+ </bindings>
+ <client>
+ <endpoint address="http://192.168.35.251:8000/MesGet" binding="basicHttpBinding"
+ bindingConfiguration="BasicHttpBinding_ImesInterface" contract="ImesInterface"
+ name="BasicHttpBinding_ImesInterface" />
+ </client>
+ </system.serviceModel>
+</configuration>
\ No newline at end of file
diff --git a/Controllers/BaseController.cs b/Controllers/BaseController.cs
new file mode 100644
index 0000000..52ffce2
--- /dev/null
+++ b/Controllers/BaseController.cs
@@ -0,0 +1,21 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.DependencyInjection;
+
+public class BaseController : ControllerBase
+{
+ private RequestInfo _requestInfo;
+
+ protected RequestInfo RequestInfo
+ {
+ get
+ {
+ if (_requestInfo == null)
+ {
+ //蹇呭~椤�
+ //_requestInfo.ValidateRequired("OrgId");
+ _requestInfo = HttpContext.RequestServices.GetService<RequestInfo>();
+ }
+ return _requestInfo;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Controllers/JJGZ/OaToMesRecordController.cs b/Controllers/JJGZ/OaToMesRecordController.cs
new file mode 100644
index 0000000..f862059
--- /dev/null
+++ b/Controllers/JJGZ/OaToMesRecordController.cs
@@ -0,0 +1,72 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using NewPdaSqlServer.Dto.service;
+using NewPdaSqlServer.service.JJGZ;
+using NewPdaSqlServer.service.Warehouse;
+using NewPdaSqlServer.util;
+
+namespace NewPdaSqlServer.Controllers.JJGZ
+{
+ [Route("api/[controller]")]
+ [ApiController]
+ public class OaToMesRecordController : ControllerBase
+ {
+ OaToMesRecordManager m = new OaToMesRecordManager();
+
+ [HttpPost("ApproveRecord")]
+ public ResponseResult ApproveRecord(OaToMesRecord queryObj)
+ {
+ try
+ {
+ string rtnMsg = m.ApproveRecord(queryObj);
+ return new ResponseResult
+ {
+ status = 0,
+ message = rtnMsg,
+ data = null
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("ApproveUser")]
+ public ResponseResult ApproveUser(OaToMesUser queryObj)
+ {
+ try
+ {
+ string rtnMsg = m.ApproveUser(queryObj);
+ return new ResponseResult
+ {
+ status = 0,
+ message = rtnMsg,
+ data = null
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("ApproveDepartment")]
+ public ResponseResult ApproveDepartment(OaToMesDepartment queryObj)
+ {
+ try
+ {
+ string rtnMsg = m.ApproveDepartment(queryObj);
+ return new ResponseResult
+ {
+ status = 0,
+ message = rtnMsg,
+ data = null
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+ }
+}
diff --git a/Controllers/Kingdee/ErpKcController.cs b/Controllers/Kingdee/ErpKcController.cs
new file mode 100644
index 0000000..593b726
--- /dev/null
+++ b/Controllers/Kingdee/ErpKcController.cs
@@ -0,0 +1,43 @@
+锘縰sing System.Dynamic;
+using Microsoft.AspNetCore.Mvc;
+
+using NewPdaSqlServer.entity;
+using NewPdaSqlServer.util;
+using MES.Service.service.Kingdee;
+
+
+namespace NewPdaSqlServer.Controllers.Kingdee;
+
+
+[ApiController]
+[Route("api/[controller]")]
+public class ErpKcController : ControllerBase
+{
+ private readonly ErpKcManager kc = new();
+ private readonly string METHOD = "POST";
+ private readonly string TableName = "ERPKC";
+ private readonly string URL = "http://localhost:10054/api/ErpKc/";
+
+
+ //
+ [HttpPost("Save")]
+ public ResponseResult Save(Inventory inventory)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos = kc.QueryStocks(inventory);
+
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+}
diff --git a/Controllers/LoginController.cs b/Controllers/LoginController.cs
index 19ca7d3..4e76314 100644
--- a/Controllers/LoginController.cs
+++ b/Controllers/LoginController.cs
@@ -134,4 +134,32 @@
return ResponseResult.ResponseError(ex);
}
}
+
+
+ /// <summary>
+ /// 鍒囨崲缁勭粐
+ /// </summary>
+ /// <param name="model"></param>
+ /// <returns></returns>
+ [HttpPost("changeOrg")]
+ public ResponseResult changeOrg([FromBody] dynamic model)
+ {
+ //鐧诲綍
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ var tbBillList = new LoginService().changeOrg(model);
+ resultInfos.tbBillList = tbBillList;
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
}
\ No newline at end of file
diff --git a/Controllers/QC/IpqcController.cs b/Controllers/QC/IpqcController.cs
index 5d5eb0d..bad00b2 100644
--- a/Controllers/QC/IpqcController.cs
+++ b/Controllers/QC/IpqcController.cs
@@ -349,4 +349,25 @@
}
}
+ [HttpPost("selIpqcItemsByGw")]
+ public ResponseResult SelIpqcItemsByGw([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.SelIpqcItemsByGw(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+
}
\ No newline at end of file
diff --git a/Controllers/Warehouse/KwbgController.cs b/Controllers/Warehouse/KwbgController.cs
new file mode 100644
index 0000000..029b76d
--- /dev/null
+++ b/Controllers/Warehouse/KwbgController.cs
@@ -0,0 +1,89 @@
+锘縰sing System.Dynamic; // 寮曞叆鍔ㄦ�佺被鍨嬫敮鎸�
+using Masuit.Tools.Win32.AntiVirus; // 寮曞叆闃茬梾姣掑伐鍏峰簱锛堜絾鏈湪浠g爜涓娇鐢級
+using Microsoft.AspNetCore.Mvc; // 寮曞叆ASP.NET Core MVC鍔熻兘
+using NewPdaSqlServer.Dto.service; // 寮曞叆椤圭洰鐗瑰畾鐨凞TO鏈嶅姟
+using NewPdaSqlServer.entity; // 寮曞叆椤圭洰瀹炰綋绫�
+using NewPdaSqlServer.service.@base; // 寮曞叆鍩虹鏈嶅姟
+using NewPdaSqlServer.service.Warehouse; // 寮曞叆浠撳簱鏈嶅姟
+using NewPdaSqlServer.util; // 寮曞叆宸ュ叿绫�
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory; // 寮曞叆EF鏃ュ織绫诲埆锛堜絾鏈湪浠g爜涓娇鐢級
+
+namespace NewPdaSqlServer.Controllers.Warehouse; // 鎺у埗鍣ㄥ懡鍚嶇┖闂�
+
+/// <summary>
+/// 搴撲綅鍙樻洿鎺у埗鍣紝澶勭悊涓庡簱浣嶅彉鏇寸浉鍏崇殑API璇锋眰
+/// </summary>
+[ApiController] // 鏍囪璇ョ被涓篈PI鎺у埗鍣紝鑷姩杩涜妯″瀷楠岃瘉鍜岄敊璇鐞�
+[Route("api/[controller]")] // 瀹氫箟鎺у埗鍣ㄨ矾鐢辨ā鏉匡紝璺敱鍓嶇紑涓篴pi/鎺у埗鍣ㄥ悕锛圞wbg锛�
+public class KwbgController : ControllerBase // 鎺у埗鍣ㄧ被缁ф壙鑷狢ontrollerBase锛屾彁渚沇eb API鍔熻兘
+{
+ private readonly KwbgManager k = new(); // 鍒涘缓搴撲綅鍙樻洿绠$悊鍣ㄥ疄渚嬶紝鐢ㄤ簬澶勭悊涓氬姟閫昏緫
+ private readonly MesPrintMangeer _kBG = new(); // 鍒涘缓鎵撳嵃绠$悊鍣ㄥ疄渚嬶紝鐢ㄤ簬澶勭悊鎵撳嵃鐩稿叧涓氬姟
+
+ /// <summary>
+ /// 鑾峰彇鏉$爜淇℃伅鍜岀墿鏂欎俊鎭�
+ /// </summary>
+ /// <param name="unity">鍓嶇浼犻�掔殑WarehouseQuery瀵硅薄锛屽寘鍚煡璇㈠弬鏁�</param>
+ /// <returns>缁熶竴鐨勫搷搴旂粨鏋滐紝鍖呭惈鏉$爜淇℃伅鍜岀墿鏂欎俊鎭�</returns>
+ [HttpPost("GetBarInfo")] // 瀹氫箟HTTP POST鏂规硶鍙婂瓙璺敱锛岃闂矾寰勪负api/Kwbg/GetBarInfo
+ //public ResponseResult GetBarInfo(dynamic unity) // 鏃ф柟娉曠鍚嶏紝鍙傛暟涓篸ynamic绫诲瀷锛堝凡娉ㄩ噴锛�
+ public ResponseResult GetBarInfo(dynamic unity) // 鏂版柟娉曠鍚嶏紝鍙傛暟涓篧arehouseQuery绫诲瀷
+ {
+ try // 鎹曡幏寮傚父锛屼繚璇佹帴鍙gǔ瀹氭��
+ {
+ dynamic resultInfos = new ExpandoObject(); // 鍒涘缓鍔ㄦ�佸璞★紝鐢ㄤ簬瀛樺偍杩斿洖缁撴灉
+ resultInfos.tbBillList = k.GetBarInfo(unity); // 璋冪敤绠$悊鍣ㄦ柟娉曪紝鑾峰彇鏉$爜淇℃伅锛岃祴鍊肩粰鍔ㄦ�佸璞$殑tbBillList灞炴��
+ return new ResponseResult // 鏋勯�犵粺涓�鍝嶅簲缁撴灉瀵硅薄
+ {
+ status = 0, // 鐘舵�佺爜0琛ㄧず鎴愬姛
+ message = "OK", // 杩斿洖娑堟伅涓篛K
+ data = resultInfos // 杩斿洖鏁版嵁涓哄姩鎬佸璞★紝鍖呭惈鏉$爜鍜岀墿鏂欎俊鎭�
+ };
+ }
+ catch (Exception ex) // 鎹曡幏鎵�鏈夊紓甯�
+ {
+ return ResponseResult.ResponseError(ex); // 璋冪敤缁熶竴閿欒澶勭悊鏂规硶锛岃繑鍥為敊璇搷搴�
+ }
+ }
+
+ /// <summary>
+ /// 搴撲綅鍙樻洿鎺ュ彛銆�
+ /// 鎺ユ敹鍓嶇浼犻�掔殑WarehouseQuery鍙傛暟锛屽畬鎴愭潯鐮佸彉鏇村強鐩稿叧淇℃伅鐨勬煡璇㈠拰杩斿洖銆�
+ /// </summary>
+ /// <param name="unity">
+ /// WarehouseQuery瀵硅薄锛屽寘鍚潯鐮併�佹媶鍒嗘暟閲忋�佺敤鎴峰悕绛夊簱浣嶅彉鏇存墍闇�鍙傛暟銆�
+ /// </param>
+ /// <returns>
+ /// 杩斿洖ResponseResult缁熶竴鍝嶅簲瀵硅薄锛宻tatus涓�0琛ㄧず鎴愬姛锛宒ata鍖呭惈鍙樻洿鍚庣殑鏉$爜鍙婃墦鍗颁俊鎭��
+ /// </returns>
+ [HttpPost("ChangeDepotSection")]
+ public ResponseResult ChangeDepotSection(dynamic unity)
+ {
+ try
+ {
+ // 鍒涘缓鍔ㄦ�佸璞esultInfos锛岀敤浜庡瓨鍌ㄨ繑鍥炵粨鏋�
+ dynamic resultInfos = new ExpandoObject();
+ // 鍒濆鍖杢bBillList灞炴�т负鍔ㄦ�佸璞★紝鐢ㄤ簬瀛樺偍鏉$爜鐩稿叧淇℃伅
+ resultInfos.tbBillList = new ExpandoObject();
+
+ //resultInfos.tbBillList.printInfo = _kBG.getPrintInfo(unity);// 鑾峰彇鎵撳嵃淇℃伅锛岃皟鐢ㄦ墦鍗扮鐞嗗櫒鐨刧etPrintInfo鏂规硶锛岀粨鏋滆祴鍊肩粰tbBillList.printInfo
+
+ // 璋冪敤搴撲綅鍙樻洿绠$悊鍣ㄧ殑ChangeDepotSection鏂规硶锛屾墽琛屾潯鐮佸彉鏇存搷浣滐紝杩斿洖鎷嗗垎缁撴灉scanResult
+ var scanResult = k.ChangeDepotSection(unity);
+
+ //resultInfos.tbBillList.cfBarInfo = _kBG.getCfInfo(scanResult);// 鑾峰彇鎷嗗垎鍚庢潯鐮佺殑璇︾粏淇℃伅锛岃皟鐢ㄦ墦鍗扮鐞嗗櫒鐨刧etCfInfo鏂规硶锛岀粨鏋滆祴鍊肩粰tbBillList.cfBarInfo
+ // 鏋勯�犲苟杩斿洖缁熶竴鍝嶅簲瀵硅薄锛宻tatus涓�0琛ㄧず鎴愬姛锛宮essage涓�"OK"锛宒ata涓簉esultInfos
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ // 鎹曡幏寮傚父锛岃皟鐢ㄧ粺涓�閿欒澶勭悊鏂规硶ResponseError锛岃繑鍥為敊璇搷搴�
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Controllers/Warehouse/MesBarCFController.cs b/Controllers/Warehouse/MesBarCFController.cs
index 9c2938b..3199bfb 100644
--- a/Controllers/Warehouse/MesBarCFController.cs
+++ b/Controllers/Warehouse/MesBarCFController.cs
@@ -47,33 +47,6 @@
/// 鑾峰彇鏉$爜淇℃伅鍜岀墿鏂欎俊鎭�
/// </summary>
/// <returns></returns>
- [HttpPost("BarCF")]
- public ResponseResult BarCF(WarehouseQuery unity)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = new ExpandoObject();
- //resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(unity);
- var scanResult = m.BarCF(unity);
- resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 鑾峰彇鏉$爜淇℃伅鍜岀墿鏂欎俊鎭紙鍏ュ簱鍓嶆媶鍒嗭級
- /// </summary>
- /// <returns></returns>
[HttpPost("GetBarInfoBefore")]
public ResponseResult GetBarInfoBefore(WarehouseQuery unity)
{
@@ -96,7 +69,35 @@
}
/// <summary>
- /// 鑾峰彇鏉$爜淇℃伅鍜岀墿鏂欎俊鎭� 锛堝叆搴撳墠鎷嗗垎锛�
+ /// 鑾峰彇鏉$爜淇℃伅鍜岀墿鏂欎俊鎭�
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("BarCF")]
+ public ResponseResult BarCF(WarehouseQuery unity)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = new ExpandoObject();
+ resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(unity);
+ var scanResult = m.BarCF(unity);
+ resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇鏉$爜淇℃伅鍜岀墿鏂欎俊鎭�
/// </summary>
/// <returns></returns>
[HttpPost("BarCfBefore")]
@@ -121,5 +122,4 @@
return ResponseResult.ResponseError(ex);
}
}
-
}
\ No newline at end of file
diff --git a/Controllers/Warehouse/MesCgthSqController.cs b/Controllers/Warehouse/MesCgthSqController.cs
index f8f491d..cc451a7 100644
--- a/Controllers/Warehouse/MesCgthSqController.cs
+++ b/Controllers/Warehouse/MesCgthSqController.cs
@@ -66,7 +66,7 @@
//ScanCode
/// <summary>
- /// 鑾峰彇鎵�鏈夊凡缁忓鏍哥殑鐢宠鍗�
+ /// 閲囪喘閫�璐�
/// </summary>
/// <returns></returns>
[HttpPost("ScanCode")]
@@ -98,6 +98,59 @@
}
}
+ //ScanCode
+ /// <summary>
+ /// 閲囪喘楠岄��
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("ScanCgyt")]
+ public ResponseResult ScanCgyt(dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.ScanCgyt(query);
+ resultInfos.YtItem = m.getYtItem(resultInfos.tbBillList.ytdh);
+ resultInfos.YtBarInfo = m.getYtBarInfo(resultInfos.tbBillList.ytdh);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+
+ //ScanCode
+ /// <summary>
+ /// 閲囪喘閫�璐у垹闄�
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("deleteCgyt")]
+ public ResponseResult deleteCgyt(dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.deleteCgyt(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
[HttpPost("ScanCodeCF")]
public ResponseResult ScanCodeCF(WarehouseQuery query)
{
diff --git a/Controllers/Warehouse/MesInvItemInCDetailsController.cs b/Controllers/Warehouse/MesInvItemInCDetailsController.cs
index cd8533d..026df77 100644
--- a/Controllers/Warehouse/MesInvItemInCDetailsController.cs
+++ b/Controllers/Warehouse/MesInvItemInCDetailsController.cs
@@ -98,65 +98,27 @@
}
}
- /* //SaveBarCodes
- [HttpPost("SaveBarCodes")]
- public ResponseResult SaveBarCodes(WarehouseQuery entity)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.SaveBarCodes(entity);
- return new ResponseResult
- {
- status = 0,
- message = resultInfos.tbBillList.Message,
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }*/
+ //SaveBarCodes
[HttpPost("SaveBarCodes")]
public ResponseResult SaveBarCodes(WarehouseQuery entity)
{
try
{
dynamic resultInfos = new ExpandoObject();
- var itemInBaseModel = m.SaveBarCodes(entity);
- resultInfos.tbBillList = itemInBaseModel;
-
- // 鍒ゆ柇鏄惁涓哄け璐ョ姸鎬侊紙result <= 0锛�
- if (itemInBaseModel.SumQuantity == null || itemInBaseModel.SumQuantity <= 0)
- {
- return new ResponseResult
- {
- status = 1, // 澶辫触鐘舵��
- message = itemInBaseModel.Message,
- data = resultInfos
- };
- }
-
- // 鎴愬姛鐘舵��
+ resultInfos.tbBillList = m.SaveBarCodes(entity);
return new ResponseResult
{
status = 0,
- message = itemInBaseModel.Message,
+ message = resultInfos.tbBillList.Message,
data = resultInfos
};
}
catch (Exception ex)
{
- // 寮傚父鏃惰繑鍥瀞tatus = 1
- return new ResponseResult
- {
- status = 1,
- message = $"鎿嶄綔澶辫触: {ex.Message}",
- data = null
- };
+ return ResponseResult.ResponseError(ex);
}
}
+
//MesToErp
[HttpPost("SaveMessageCenter")]
public ResponseResult SaveMessageCenter(WarehouseQuery entity)
diff --git a/Controllers/Warehouse/MesItemBlController.cs b/Controllers/Warehouse/MesItemBlController.cs
index ee7123a..5505fed 100644
--- a/Controllers/Warehouse/MesItemBlController.cs
+++ b/Controllers/Warehouse/MesItemBlController.cs
@@ -1,7 +1,9 @@
锘縰sing System.Dynamic;
+using Masuit.Tools.Win32.AntiVirus;
using Microsoft.AspNetCore.Mvc;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
+using NewPdaSqlServer.service.@base;
using NewPdaSqlServer.service.Warehouse;
using NewPdaSqlServer.util;
@@ -12,9 +14,10 @@
/// </summary>
[Route("api/[controller]")]
[ApiController]
-public class MesItemBlController : ControllerBase
+public class MesItemBlController : BaseController
{
private readonly MesItemBlManager _manager = new();
+ private readonly MesPrintMangeer _mCf = new();
/***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/
@@ -201,9 +204,12 @@
try
{
dynamic resultInfos = new ExpandoObject();
- var (success, pendingList) = _manager.SplitBarcode(query);
- resultInfos.success = success;
- resultInfos.pendingList = pendingList;
+ resultInfos.tbBillList = new ExpandoObject();
+ resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
+ var scanResult = _manager.SplitBarcode(query);
+ resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
+ //resultInfos.success = success;
+ //resultInfos.pendingList = pendingList;
return new ResponseResult
{
status = 0,
@@ -226,12 +232,12 @@
/// <response code="200">鎴愬姛鑾峰彇琛ユ枡鍗曞彿鍒楄〃</response>
/// <response code="400">鑾峰彇澶辫触</response>
[HttpPost("GetSCBLBillNo")]
- public ResponseResult GetSCBLBillNo(WarehouseQuery query)
+ public ResponseResult GetSCBLBillNo([FromBody] dynamic query)
{
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetSCBLBillNo(query);
+ resultInfos.tbBillList = _manager.GetSCBLBillNo(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -280,6 +286,26 @@
}
}
+ [HttpPost("GetLineInfo")]
+ public ResponseResult GetLineInfo([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbLineInfo = _manager.GetLineInfo(query, RequestInfo);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
/// <summary>
/// 鎵弿鏉$爜
/// </summary>
diff --git a/Controllers/Warehouse/MesItemQtController.cs b/Controllers/Warehouse/MesItemQtController.cs
index 7daac28..3a80f9e 100644
--- a/Controllers/Warehouse/MesItemQtController.cs
+++ b/Controllers/Warehouse/MesItemQtController.cs
@@ -1,6 +1,7 @@
锘縰sing System.Dynamic;
using Microsoft.AspNetCore.Mvc;
using NewPdaSqlServer.Dto.service;
+using NewPdaSqlServer.service.@base;
using NewPdaSqlServer.service.Warehouse;
using NewPdaSqlServer.util;
@@ -11,9 +12,11 @@
/// </summary>
[Route("api/[controller]")]
[ApiController]
-public class MesItemQtController : ControllerBase
+public class MesItemQtController : BaseController
{
private readonly MesItemQtManager _manager = new();
+
+ private readonly MesPrintMangeer _mCf = new();
#region 鍩虹CRUD
@@ -60,7 +63,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetPendingQtList();
+ resultInfos.tbBillList = _manager.GetPendingQtList(RequestInfo);
return new ResponseResult
{
status = 0,
@@ -81,7 +84,7 @@
/// <returns>寰呭鐞嗙殑閫�鏂欏崟鏄庣粏鍒楄〃</returns>
/// <remarks>
/// 璇锋眰绀轰緥:
- /// POST /api/MesItemQt/GetPendingQtList
+ /// POST /api/MesItemQt/GetPendingQtDetailList
/// {
/// "userName": "admin", // 鐢ㄦ埛鍚�(蹇呭~)
/// "billNo": "QT20240101001" // 閫�鏂欏崟鍙�(蹇呭~)
@@ -91,13 +94,12 @@
/// <response code="200">鎴愬姛鑾峰彇閫�鏂欏崟鏄庣粏</response>
/// <response code="400">鑾峰彇澶辫触锛岃繑鍥炲叿浣撻敊璇俊鎭�</response>
[HttpPost("GetPendingQtDetailList")]
- public ResponseResult GetPendingQtDetailList(
- [FromBody] WarehouseQuery query)
+ public ResponseResult GetPendingQtDetailList([FromBody] WarehouseQuery query)
{
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetPendingQtList(query);
+ resultInfos.tbBillList = _manager.GetPendingQtDetailList(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -134,13 +136,38 @@
[HttpPost("OutScanBarcode")]
public ResponseResult OutScanBarcode([FromBody] WarehouseQuery query)
{
+ //try
+ //{
+ // dynamic resultInfos = new ExpandoObject();
+ // var (form, items, message) = _manager.OutScanBarcode(query);
+ // resultInfos.form = form;
+ // resultInfos.items = items;
+ // resultInfos.message = message;
+ // return new ResponseResult
+ // {
+ // status = 0,
+ // message = "OK",
+ // data = resultInfos
+ // };
+ //}
+ //catch (Exception ex)
+ //{
+ // return ResponseResult.ResponseError(ex);
+ //}
+
try
{
dynamic resultInfos = new ExpandoObject();
- var (form, items, message) = _manager.OutScanBarcode(query);
- resultInfos.form = form;
- resultInfos.items = items;
- resultInfos.message = message;
+ resultInfos.tbBillList = _manager.ScanCode(query);
+ if (resultInfos.tbBillList.result == "2")
+ {
+ return new ResponseResult
+ {
+ status = Convert.ToInt32(resultInfos.tbBillList.result),
+ message = resultInfos.tbBillList.strMsg,
+ data = resultInfos
+ };
+ }
return new ResponseResult
{
status = 0,
@@ -198,5 +225,29 @@
}
}
+
+ [HttpPost("ScanCodeCF")]
+ public ResponseResult ScanCodeCF(WarehouseQuery query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = new ExpandoObject();
+ resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
+ var scanResult = _manager.ScanCodeCF(query);
+ resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
#endregion
}
\ No newline at end of file
diff --git a/Controllers/Warehouse/MesItemQtrkController.cs b/Controllers/Warehouse/MesItemQtrkController.cs
index d881817..bef03d4 100644
--- a/Controllers/Warehouse/MesItemQtrkController.cs
+++ b/Controllers/Warehouse/MesItemQtrkController.cs
@@ -11,7 +11,7 @@
/// </summary>
[Route("api/[controller]")]
[ApiController]
-public class MesItemQtrkController : ControllerBase
+public class MesItemQtrkController : BaseController
{
private readonly MesItemQtrkManager _manager = new();
@@ -84,7 +84,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetQtckList();
+ resultInfos.tbBillList = _manager.GetQtckList(RequestInfo);
return new ResponseResult
{
status = 0,
@@ -134,7 +134,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetQtckDetailList(query);
+ resultInfos.tbBillList = _manager.GetQtckDetailList(query, RequestInfo);
//if(resultInfos.tbBillList.Count < 1)
//{
@@ -181,7 +181,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.message = _manager.ScanInDepotsQT(query);
+ resultInfos = _manager.ScanInDepotsQT(query);
return new ResponseResult
{
status = 0,
diff --git a/Controllers/Warehouse/MesItemTblController.cs b/Controllers/Warehouse/MesItemTblController.cs
index 09be511..8fa0035 100644
--- a/Controllers/Warehouse/MesItemTblController.cs
+++ b/Controllers/Warehouse/MesItemTblController.cs
@@ -12,7 +12,7 @@
/// </summary>
[Route("api/[controller]")]
[ApiController]
-public class MesItemTblController : ControllerBase
+public class MesItemTblController : BaseController
{
private readonly MesItemTblManager m = new();
@@ -174,7 +174,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetSCTLBillNo(query);
+ resultInfos.tbBillList = m.GetSCTLBillNo(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -200,7 +200,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetMesItemTblDetailByBillNo(query);
+ resultInfos.tbBillList = m.GetMesItemTblDetailByBillNo(query, RequestInfo);
//if(resultInfos.tbBillList.Count < 1)
//{
@@ -261,7 +261,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.SctlScanBarcode(query);
+ resultInfos.tbBillList = m.SctlScanBarcode(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -286,7 +286,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.SctlScanBarcode(query);
+ resultInfos.tbBillList = m.SctlScanBarcode(query, RequestInfo);
return new ResponseResult
{
status = 0,
diff --git a/Controllers/Warehouse/MesKwcxController.cs b/Controllers/Warehouse/MesKwcxController.cs
new file mode 100644
index 0000000..308f38e
--- /dev/null
+++ b/Controllers/Warehouse/MesKwcxController.cs
@@ -0,0 +1,132 @@
+锘縰sing System.Dynamic;
+using Microsoft.AspNetCore.Mvc;
+using NewPdaSqlServer.Dto.service;
+using NewPdaSqlServer.entity;
+using NewPdaSqlServer.service.Warehouse;
+using NewPdaSqlServer.util;
+
+namespace NewPdaSqlServer.Controllers.Warehouse;
+
+[ApiController]
+[Route("api/[controller]")]
+public class MesKwcxController : BaseController
+{
+ private readonly MesKwcxManager m = new();
+
+ /// <summary>
+ /// 鑾峰彇鏉$爜淇℃伅鍜岀墿鏂欎俊鎭�
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("GetBarInfoList")]
+ public ResponseResult GetBarInfoList([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBarInfoList = m.GetBarInfoList(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇鏉$爜淇℃伅鍜岀墿鏂欎俊鎭�
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("GetBarInfo")]
+ public ResponseResult GetBarInfo([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBarInfo = m.GetBarInfo(query);
+ if(resultInfos.tbBarInfo == null)
+ {
+ return new ResponseResult
+ {
+ status = -1,
+ message = "姝ゆ潯鐮佷笉瀛樺湪锛侊紒锛�",
+ data = resultInfos
+ };
+ }
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("GetKWList")]
+ public ResponseResult GetKWList([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbKWList = m.GetKWList(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("GetKWInfo")]
+ public ResponseResult GetKWInfo([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbKWInfo = m.GetKWInfo(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ [HttpPost("GetItemInfoList")]
+ public ResponseResult GetItemInfoList([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbItemInfo = m.GetItemInfoList(query,RequestInfo);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Controllers/Warehouse/MesXsckController.cs b/Controllers/Warehouse/MesXsckController.cs
index bd252cf..8ea3e24 100644
--- a/Controllers/Warehouse/MesXsckController.cs
+++ b/Controllers/Warehouse/MesXsckController.cs
@@ -12,7 +12,7 @@
/// </summary>
[Route("api/[controller]")]
[ApiController]
-public class MesXsckController : ControllerBase
+public class MesXsckController : BaseController
{
private readonly MesXsckManager _manager = new();
@@ -231,7 +231,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetFHTZBillNo(query);
+ resultInfos.tbBillList = _manager.GetFHTZBillNo(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -266,7 +266,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetMesItemFHTZetailByBillNo(query);
+ resultInfos.tbBillList = _manager.GetMesItemFHTZetailByBillNo(query, RequestInfo);
return new ResponseResult
{
status = 0,
diff --git a/Controllers/Warehouse/MesXsthController.cs b/Controllers/Warehouse/MesXsthController.cs
index 3241ac0..6b6e66f 100644
--- a/Controllers/Warehouse/MesXsthController.cs
+++ b/Controllers/Warehouse/MesXsthController.cs
@@ -12,7 +12,7 @@
/// </summary>
[Route("api/[controller]")]
[ApiController]
-public class MesXsthController : ControllerBase
+public class MesXsthController : BaseController
{
private readonly MesXsthManager _manager = new();
@@ -176,7 +176,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetXsthBillNo(query);
+ resultInfos.tbBillList = _manager.GetXsthBillNo(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -202,7 +202,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = _manager.GetMesItemDetailByBillNo(query);
+ resultInfos.tbBillList = _manager.GetMesItemDetailByBillNo(query, RequestInfo);
if (resultInfos.tbBillList.Count < 1)
{
diff --git a/Controllers/Wom/MesWorkProdController.cs b/Controllers/Wom/MesWorkProdController.cs
index 15bc4ae..92b1a8e 100644
--- a/Controllers/Wom/MesWorkProdController.cs
+++ b/Controllers/Wom/MesWorkProdController.cs
@@ -214,59 +214,5 @@
}
}
- /// <summary>
- /// PDA鎵弿鐢熶骇鎶ュ伐
- /// </summary>
- /// <param name="request">鎶ュ伐璇锋眰鍙傛暟</param>
- /// <returns>鎶ュ伐缁撴灉</returns>
- /// <remarks>
- /// 璇锋眰绀轰緥:
- /// POST /api/MesWorkProd/GetRksqList
- /// {
- /// "sjBillNO": "rksq001",
- /// }
- /// </remarks>
- /// <response code="200">鎵弿鎴愬姛</response>
- /// <response code="400">鎵弿澶辫触锛岃繑鍥炲叿浣撻敊璇俊鎭�</response>
- [HttpPost("GetRksqList")]
- public ResponseResult GetRksqList([FromBody] ScanWorkRequest request)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.result = _manager.GetRksqList(request);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- [HttpPost("GetRksqSelect")]
- public ResponseResult GetRksqSelect([FromBody] ScanWorkRequest request)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.result = _manager.GetRksqSelect(request);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
#endregion
}
\ No newline at end of file
diff --git a/Controllers/Wom/WomdaaController.cs b/Controllers/Wom/WomdaaController.cs
index 779ca5a..f5dee1c 100644
--- a/Controllers/Wom/WomdaaController.cs
+++ b/Controllers/Wom/WomdaaController.cs
@@ -1,5 +1,6 @@
锘縰sing System.Dynamic;
using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.service.@base;
@@ -10,7 +11,7 @@
[ApiController]
[Route("api/[controller]")]
-public class WomdaaController : ControllerBase
+public class WomdaaController : BaseController
{
private readonly WomdaaManager m = new();
private readonly MesPrintMangeer _mCf = new();
@@ -28,7 +29,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetProductionPickDaa001(query);
+ resultInfos.tbBillList = m.GetProductionPickDaa001(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -50,10 +51,13 @@
[HttpPost("GetItemsByDaa001")]
public ResponseResult GetItemsByDaa001(WarehouseQuery query)
{
+ // 浠� HttpContext.Items 鑾峰彇 orgId
+ var orgId = HttpContext.Request.Headers["OrgId"].ToString();
+
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetItemsByDaa001(query);
+ resultInfos.tbBillList = m.GetItemsByDaa001(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -105,9 +109,34 @@
{
dynamic resultInfos = new ExpandoObject();
resultInfos.tbBillList = new ExpandoObject();
- //resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
+ resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
var scanResult = m.ScanCodeCF(query);
resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+
+ /// <summary>
+ /// 鐢熶骇棰嗘枡鐐瑰嚮鐗╂枡鏄庣粏鑾峰彇鐩稿叧鏉$爜淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("GetBarKwByItem")]
+ public ResponseResult GetBarKwByItem(dynamic unity)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.GetBarKwByItem(unity);
return new ResponseResult
{
status = 0,
@@ -518,7 +547,7 @@
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetXcslDaa(query);
+ resultInfos.tbBillList = m.GetXcslDaa(query, RequestInfo);
return new ResponseResult
{
status = 0,
@@ -583,5 +612,204 @@
}
}
+ /// <summary>
+ /// 鍐呯鏍稿 锛� 鎵弿鍚庣洊鐮佽幏鍙栦俊鎭�
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("getHgBarInfo")]
+ public ResponseResult getHgBarInfo([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ // 鍏堝垵濮嬪寲tbBillList灞炴��
+ resultInfos.tbBillList = new ExpandoObject();
+ resultInfos.tbBillList.ZsBarInfo = m.getHgBarInfo(query);
+ resultInfos.tbBillList.Traceability = m.getTraceabilityByLsBar(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 鍐呯鏍稿锛岃拷婧爜鍜屾祦姘寸爜缁戝畾
+ /// </summary>
+ /// <returns></returns>
+ [HttpPost("ScanNxhd")]
+ public ResponseResult ScanNxhd([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ // 鍏堝垵濮嬪寲tbBillList灞炴��
+ resultInfos.tbBillList = new ExpandoObject();
+ resultInfos.tbBillList = m.ScanNxhd(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// 杩斿伐缁戝畾
+ /// </summary>
+ [HttpPost("ScanFgbd")]
+ public ResponseResult ScanFgbd([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.ScanFgbd(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+
+ /// <summary>
+ /// AGV鍛煎彨绾夸綋鍒楄〃
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ [HttpPost("GetAgvXt")]
+ public ResponseResult GetAgvXt([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.GetAgvXt(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ #endregion
+
+
+
+ #region pda璋冪敤AGV鐩稿叧
+ /// <summary>
+ /// AGV閫佹
+ /// </summary>
+ [HttpPost("handleAGVInspection")]
+ public ResponseResult HandleAGVInspection([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.HandleAGVInspection(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// AGV鍛煎彨
+ /// </summary>
+ [HttpPost("handleAGVCall")]
+ public ResponseResult HandleAGVCall([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.HandleAGVCall(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// AGV妫�楠屽鐞�
+ /// </summary>
+ [HttpPost("handleAgvJy")]
+ public ResponseResult HandleAgvJy([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.HandleAgvJy(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// AGV鍏ョ珛搴�
+ /// </summary>
+ [HttpPost("handleAgvRk")]
+ public ResponseResult HandleAgvRk([FromBody] dynamic query)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.tbBillList = m.HandleAgvRk(query);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
#endregion
}
\ No newline at end of file
diff --git a/Controllers/Wom/WomdaahbController.cs b/Controllers/Wom/WomdaahbController.cs
deleted file mode 100644
index c2489bf..0000000
--- a/Controllers/Wom/WomdaahbController.cs
+++ /dev/null
@@ -1,587 +0,0 @@
-锘縰sing System.Dynamic;
-using Microsoft.AspNetCore.Mvc;
-using NewPdaSqlServer.Dto.service;
-using NewPdaSqlServer.entity;
-using NewPdaSqlServer.service.@base;
-using NewPdaSqlServer.service.Wom;
-using NewPdaSqlServer.util;
-
-namespace NewPdaSqlServer.Controllers.Wom;
-
-[ApiController]
-[Route("api/[controller]")]
-public class WomdaahbController : ControllerBase
-{
- private readonly WomdaahbManager m = new();
- private readonly MesPrintMangeer _mCf = new();
-
- #region 鐢熶骇棰嗘枡鍚堝苟
-
- //GetProductionPickDaa001
- /// <summary>
- /// 妯$硦鏌ヨ宸ュ崟鍙峰苟杩斿洖
- /// </summary>
- /// <returns></returns>
- [HttpPost("GetProductionPickDaa001")]
- public ResponseResult GetProductionPickDaa001(WarehouseQuery query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetProductionPickDaa001(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- //GetItemsByDaa001
- /// <summary>
- /// 鏍规嵁宸ュ崟鍙疯幏鍙栦唬棰嗙墿鏂欐槑缁�
- /// </summary>
- /// <returns></returns>
- [HttpPost("GetItemsByDaa001")]
- public ResponseResult GetItemsByDaa001(WarehouseQuery query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetItemsByDaa001(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- //ScanCode
- [HttpPost("ScanCode")]
- public ResponseResult ScanCode(WarehouseQuery query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.ScanCode(query);
- if(resultInfos.tbBillList.result == "2")
- {
- return new ResponseResult
- {
- status = Convert.ToInt32(resultInfos.tbBillList.result),
- message = resultInfos.tbBillList.strMsg,
- data = resultInfos
- };
- }
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- //ScanCodeCF
- [HttpPost("ScanCodeCF")]
- public ResponseResult ScanCodeCF(WarehouseQuery query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = new ExpandoObject();
- //resultInfos.tbBillList.printInfo = _mCf.getPrintInfo(query);
- var scanResult = m.ScanCodeCF(query);
- resultInfos.tbBillList.cfBarInfo = _mCf.getCfInfo(scanResult);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 鑾峰彇鎵�鏈�
- /// </summary>
- /// <returns></returns>
- [HttpPost("GetList")]
- public ResponseResult GetList()
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetList();
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
-
- /// <summary>
- /// 鏍规嵁涓婚敭鑾峰彇
- /// </summary>
- /// <returns></returns>
- [HttpPost("GetById")]
- public ResponseResult GetById(int id)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetById(id);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 鏍规嵁涓婚敭鍒犻櫎
- /// </summary>
- /// <returns></returns>
- [HttpPost("DeleteByIds")]
- public ResponseResult DeleteByIds([FromBody] object[] ids)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.DeleteByIds(ids);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 娣诲姞
- /// </summary>
- /// <returns></returns>
- [HttpPost("Insert")]
- public ResponseResult Add([FromBody] Womdaa data)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.Insert(data);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 娣诲姞杩斿洖鑷
- /// </summary>
- /// <returns></returns>
- [HttpPost("InsertReturnIdentity")]
- public ResponseResult InsertReturnIdentity([FromBody] Womdaa data)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.InsertReturnIdentity(data);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
-
- /// <summary>
- /// 淇敼
- /// </summary>
- /// <returns></returns>
- [HttpPost("Update")]
- public ResponseResult Update([FromBody] Womdaa data)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.Update(data);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
- #endregion
-
- #region 鐜板満绠$悊
-
-
- /// <summary>
- /// 鎵弿娉ㄥ鐮侊紝鑾峰彇宸ュ崟鍜屾潯鐮佷俊鎭�
- /// </summary>
- /// <returns></returns>
- [HttpPost("getZsBarInfo")]
- public ResponseResult getZsBarInfo([FromBody] dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- // 鍏堝垵濮嬪寲tbBillList灞炴��
- resultInfos.tbBillList = new ExpandoObject();
- resultInfos.tbBillList.ZsBarInfo = m.getZsBarInfo(query);
- resultInfos.tbBillList.Traceability = m.getTraceability(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
-
- /// <summary>
- /// 浜у搧缁戝畾锛岃拷婧爜鍜屾祦姘寸爜缁戝畾
- /// </summary>
- /// <returns></returns>
- [HttpPost("ProductBinding")]
- public ResponseResult ProductBinding([FromBody] dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- // 鍏堝垵濮嬪寲tbBillList灞炴��
- resultInfos.tbBillList = new ExpandoObject();
- resultInfos.tbBillList = m.ProductBinding(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 鑾峰彇鍗℃澘淇℃伅
- /// </summary>
- /// <returns></returns>
- [HttpPost("getKbBarInfo")]
- public ResponseResult getKbBarInfo([FromBody] dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- // 鍏堝垵濮嬪寲tbBillList灞炴��
- resultInfos.tbBillList = new ExpandoObject();
- resultInfos.tbBillList.KbBarInfo = m.getKbBarInfo(query);
- resultInfos.tbBillList.KbBarMxInfo = m.getKbBarMxInfo(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 鑾峰彇绠辩爜淇℃伅
- /// </summary>
- /// <returns></returns>
- [HttpPost("getXBarInfo")]
- public ResponseResult getXBarInfo([FromBody] dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- // 鍏堝垵濮嬪寲tbBillList灞炴��
- resultInfos.tbBillList = new ExpandoObject();
- resultInfos.tbBillList.XBarInfo = m.getXBarInfo(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 缁戝畾绠辩爜涓庢墭鏉跨爜
- /// </summary>
- /// <returns></returns>
- [HttpPost("submitAllChecked")]
- public ResponseResult submitAllChecked([FromBody] dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- // 鍏堝垵濮嬪寲tbBillList灞炴��
- resultInfos.tbBillList = new ExpandoObject();
- resultInfos.tbBillList = m.submitAllChecked(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 鏍稿閫佹
- /// </summary>
- /// <returns></returns>
- [HttpPost("submitInspection")]
- public ResponseResult submitInspection([FromBody] dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- // 鍏堝垵濮嬪寲tbBillList灞炴��
- resultInfos.tbBillList = new ExpandoObject();
- resultInfos.tbBillList = m.SubmitKbInspection(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- //GetItemsXcsl
- /// <summary>
- /// 鏍规嵁宸ュ崟鍙疯幏鍙栧緟鏀舵枡鐗╂枡鏄庣粏
- /// </summary>
- /// <returns></returns>
- [HttpPost("GetItemsXcsl")]
- public ResponseResult GetItemsXcsl(WarehouseQuery query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetItemsXcsl(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
-
- //GetItemsXcsl
- /// <summary>
- /// 鐗╂枡鏉$爜鏀舵枡
- /// </summary>
- /// <returns></returns>
- [HttpPost("ScanXcsl")]
- public ResponseResult ScanXcsl(dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.ScanXcsl(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- //GetItemsXcsl
- /// <summary>
- /// 鏍规嵁绾夸綋鑾峰彇浠櫒閲嶉噺
- /// </summary>
- /// <returns></returns>
- [HttpPost("GetWeightByXt")]
- public ResponseResult GetWeightByXt(dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetWeightByXt(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
-
- /// <summary>
- /// 鐜板満鏀舵枡鑾峰彇鍙�夊伐鍗曚俊鎭�
- /// </summary>
- /// <param name="query"></param>
- /// <returns></returns>
- [HttpPost("GetXcslDaa")]
- public ResponseResult GetXcslDaa([FromBody] dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetXcslDaa(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
-
- //GetItemsXctl
- /// <summary>
- /// 鏍规嵁宸ュ崟鍙疯幏鍙栧緟鎶曟枡鐗╂枡鏄庣粏
- /// </summary>
- /// <returns></returns>
- [HttpPost("GetItemsXctl")]
- public ResponseResult GetItemsXctl(WarehouseQuery query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetItemsXctl(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- //GetItemsXcsl
- /// <summary>
- /// 鐗╂枡鏉$爜鎶曟枡
- /// </summary>
- /// <returns></returns>
- [HttpPost("ScanXctl")]
- public ResponseResult ScanXctl(dynamic query)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.ScanXctl(query);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- #endregion
-}
\ No newline at end of file
diff --git a/Dto/ErpKc.cs b/Dto/ErpKc.cs
new file mode 100644
index 0000000..a6845de
--- /dev/null
+++ b/Dto/ErpKc.cs
@@ -0,0 +1,17 @@
+锘縩amespace NewPdaSqlServer.Dto
+{
+ public class ErpKc
+ {
+ public string? FMaterialId { get; set; }
+ public string? FStockId { get; set; }
+ public string? FMtoNo { get; set; }
+ public string? FLot { get; set; }
+ public string? FStockUnitId { get; set; }
+ public string? FBaseUnitId { get; set; }
+ public string? FStockStatusId { get; set; }
+ public string? FBASEQTY { get; set; }
+ public string? FSTOREURNOM { get; set; }
+ public string? FSTOREURNUM { get; set; }
+ public string? FStockOrgId { get; set; }
+ }
+}
diff --git a/Dto/Warehouse/DefineTask001Dto.cs b/Dto/Warehouse/DefineTask001Dto.cs
new file mode 100644
index 0000000..a98d722
--- /dev/null
+++ b/Dto/Warehouse/DefineTask001Dto.cs
@@ -0,0 +1,50 @@
+namespace NewPdaSqlServer.Dto.Warehouse;
+using System.ComponentModel.DataAnnotations;
+/// <summary>
+/// 绔嬪簱閫佹鏁版嵁浼犺緭瀵硅薄
+/// </summary>
+public class DefineTask001Dto
+{
+ /// <summary>
+ /// MES浠诲姟鏍囪瘑
+ /// </summary>
+ [Required(ErrorMessage = "MES浠诲姟鏍囪瘑蹇呭~")]
+ public string MesId { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栫爜
+ /// </summary>
+ [Required(ErrorMessage = "鐗╂枡缂栫爜蹇呭~")]
+ public string MatId { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public string MatName { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡瑙勬牸
+ /// </summary>
+ public string MatStandard { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鏁伴噺
+ /// </summary>
+ [Range(1, int.MaxValue, ErrorMessage = "鐗╂枡鏁伴噺蹇呴』澶т簬0涓斾负鏁存暟")]
+ public int MatNumber { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鍗曚綅
+ /// </summary>
+ [Required(ErrorMessage = "鐗╂枡鍗曚綅蹇呭~")]
+ public string MatUnit { get; set; }
+
+ /// <summary>
+ /// 涓婃枡浣嶇疆
+ /// </summary>
+ [Range(1, int.MaxValue, ErrorMessage = "鏈夋晥浣嶇疆缂栧彿蹇呭~")]
+ public int Postition { get; set; }
+}
+
+
+
diff --git a/Dto/Warehouse/DefineTask002Dto.cs b/Dto/Warehouse/DefineTask002Dto.cs
new file mode 100644
index 0000000..160c258
--- /dev/null
+++ b/Dto/Warehouse/DefineTask002Dto.cs
@@ -0,0 +1,21 @@
+using System.ComponentModel.DataAnnotations;
+namespace NewPdaSqlServer.Dto.Warehouse{
+
+ public class DefineTask002Dto
+ {
+ /// <summary>
+ /// 鏉$爜缂栧彿
+ /// </summary>
+ [Required(ErrorMessage = "MES浠诲姟鏍囪瘑蹇呭~")]
+ public string MesId { get; set; }
+ /// <summary>
+ /// 妫�楠岀姸鎬�
+ /// </summary>
+ [Required(ErrorMessage = "妫�楠岀姸鎬佸繀濉�")]
+ public string MatStatus { get; set; }
+ }
+
+}
+
+
+
diff --git a/Dto/Warehouse/DefineTask005Dto.cs b/Dto/Warehouse/DefineTask005Dto.cs
new file mode 100644
index 0000000..b738781
--- /dev/null
+++ b/Dto/Warehouse/DefineTask005Dto.cs
@@ -0,0 +1,16 @@
+using System.ComponentModel.DataAnnotations;
+namespace NewPdaSqlServer.Dto.Warehouse{
+
+ public class DefineTask005Dto
+ {
+ /// <summary>
+ /// 鍛煎彨鐐逛綅
+ /// </summary>
+ [Range(1, int.MaxValue, ErrorMessage = "鏈夋晥浣嶇疆缂栧彿蹇呭~")]
+ public int Postition { get; set; }
+ }
+
+}
+
+
+
diff --git a/Dto/Warehouse/DefineTask006Dto.cs b/Dto/Warehouse/DefineTask006Dto.cs
new file mode 100644
index 0000000..16c623c
--- /dev/null
+++ b/Dto/Warehouse/DefineTask006Dto.cs
@@ -0,0 +1,50 @@
+namespace NewPdaSqlServer.Dto.Warehouse;
+using System.ComponentModel.DataAnnotations;
+
+/// <summary>
+/// 绔嬪簱鍏ュ簱鏁版嵁浼犺緭瀵硅薄
+/// </summary>
+public class DefineTask006Dto
+{
+ /// <summary>
+ /// MES浠诲姟鏍囪瘑
+ /// </summary>
+ [Required(ErrorMessage = "MES浠诲姟鏍囪瘑蹇呭~")]
+ public string MesId { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栫爜
+ /// </summary>
+ [Required(ErrorMessage = "鐗╂枡缂栫爜蹇呭~")]
+ public string MatId { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鍚嶇О
+ /// </summary>
+ public string MatName { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡瑙勬牸
+ /// </summary>
+ public string MatStandard { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鏁伴噺
+ /// </summary>
+ [Range(1, int.MaxValue, ErrorMessage = "鐗╂枡鏁伴噺蹇呴』澶т簬0涓斾负鏁存暟")]
+ public int MatNumber { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡鍗曚綅
+ /// </summary>
+ public string MatUnit { get; set; }
+
+ /// <summary>
+ /// 鎵�鍦ㄦゼ灞�
+ /// </summary>
+ [Range(1, int.MaxValue, ErrorMessage = "鎵�鍦ㄦゼ灞傚繀濉�")]
+ public int Postition { get; set; }
+}
+
+
+
diff --git a/Dto/Xky/XkyBarcodeDataDto.cs b/Dto/Xky/XkyBarcodeDataDto.cs
index 3759eb8..d713ae0 100644
--- a/Dto/Xky/XkyBarcodeDataDto.cs
+++ b/Dto/Xky/XkyBarcodeDataDto.cs
@@ -29,7 +29,7 @@
public string OuterBarcode { get; set; }
[JsonProperty("includeQty")]
- public int IncludeQty { get; set; }
+ public decimal IncludeQty { get; set; }
[JsonProperty("smallPackageLength")]
public int? SmallPackageLength { get; set; }
diff --git a/Dto/service/OaToMesRecord.cs b/Dto/service/OaToMesRecord.cs
new file mode 100644
index 0000000..b6906d5
--- /dev/null
+++ b/Dto/service/OaToMesRecord.cs
@@ -0,0 +1,51 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System.ComponentModel.DataAnnotations;
+
+namespace NewPdaSqlServer.Dto.service
+{
+ public class OaToMesRecord
+ {
+ public List<Record> dataJson { get; set; }
+ }
+
+ public class Record
+ {
+ public string StaffId { get; set; }
+ public string StaffNo { get; set; }
+
+ public string StaffName { get; set; }
+ public string LineNo { get; set; }
+ public string LineName { get; set; }
+ public DateTime? CheckTime { get; set; }
+ public string Classes { get; set; }
+ public string OrgId { get; set; }
+ }
+
+ public class OaToMesUser
+ {
+ public List<User> dataJson { get; set; }
+ }
+
+ public class User
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+
+ public string Jobnumber { get; set; }
+ public string Department { get; set; }
+ }
+
+ public class OaToMesDepartment
+ {
+ public List<Department> dataJson { get; set; }
+ }
+
+ public class Department
+ {
+ public string Id { get; set; }
+ public string Parentid { get; set; }
+
+ public string Name { get; set; }
+ public string OrgId { get; set; }
+ }
+}
diff --git a/Dto/service/ProductionPickDto.cs b/Dto/service/ProductionPickDto.cs
index 518aaaf..e24eee0 100644
--- a/Dto/service/ProductionPickDto.cs
+++ b/Dto/service/ProductionPickDto.cs
@@ -6,6 +6,7 @@
public class ProductionPickDto
{
public string? ItemModel { get; set; }
+
public string? itemNo { get; set; }
public string? PlanNo { get; set; }
public string? daa001 { get; set; }
@@ -18,11 +19,14 @@
//鎷嗗垎鍚庢潯鐮�
public string? cfBarcode { get; set; }
+ public string? startTime { get; set; }
+
//杩斿洖淇℃伅
public string? strMsg { get; set; }
//杩斿洖鍙傛暟绫诲瀷 -1锛氬け璐� 1锛氭垚鍔�
public string? result { get; set; }
+ public dynamic? daaInfo { get; set; }
//寰呮壂
public List<ItemDetailModel>? items { get; set; }
//宸叉壂
diff --git a/Dto/service/ScanWorkRequest.cs b/Dto/service/ScanWorkRequest.cs
index aea0007..ff70aef 100644
--- a/Dto/service/ScanWorkRequest.cs
+++ b/Dto/service/ScanWorkRequest.cs
@@ -1,13 +1,10 @@
-锘縰sing NewPdaSqlServer.entity;
-
-namespace NewPdaSqlServer.Dto.service;
+锘縩amespace NewPdaSqlServer.Dto.service;
public class ScanWorkRequest
{
public string? UserNo { get; set; }
public string? ItemBarcode { get; set; }
public string? StaffNo { get; set; }
- public string? sjBillNo { get; set; }
+
public decimal? Quantity { get; set; }
-
}
\ No newline at end of file
diff --git a/Dto/service/ScanWorkResult.cs b/Dto/service/ScanWorkResult.cs
index b50ff5b..ff8bb47 100644
--- a/Dto/service/ScanWorkResult.cs
+++ b/Dto/service/ScanWorkResult.cs
@@ -1,6 +1,4 @@
-锘縰sing NewPdaSqlServer.entity;
-
-namespace NewPdaSqlServer.Dto.service;
+锘縩amespace NewPdaSqlServer.Dto.service;
/// <summary>
/// 鐢熶骇鎶ュ伐鎵弿缁撴灉
@@ -16,7 +14,4 @@
public string ItemName { get; set; }
public string ItemModel { get; set; }
public string Message { get; set; }
- public string sjBillNo { get; set; }
- public List<MesInvItemInRksqDetails> BarcodesDetail { get; set; }
- public List<MesInvItemIns> rksqOrderList { get; set; }
}
\ No newline at end of file
diff --git a/Dto/service/WarehouseQuery.cs b/Dto/service/WarehouseQuery.cs
index 03dc403..ac13440 100644
--- a/Dto/service/WarehouseQuery.cs
+++ b/Dto/service/WarehouseQuery.cs
@@ -35,7 +35,4 @@
public string? itemNo { get; set; }
public string? message { get; set; }
- public string? cgrkType { get; set; }
- public string? hbNo { get; set; } //鍚堝苟鍗曞彿
-
}
\ No newline at end of file
diff --git a/NewPdaSqlServer.csproj b/NewPdaSqlServer.csproj
index 37df97b..64dfbc8 100644
--- a/NewPdaSqlServer.csproj
+++ b/NewPdaSqlServer.csproj
@@ -10,12 +10,29 @@
<PackageReference Include="Masuit.Tools.Core" Version="2024.5.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
+ <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.6" />
+ <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.6" />
+ <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.6" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.169" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="9.0.4" />
+ <PackageReference Include="System.ServiceModel.Http" Version="8.1.2" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Reference Include="Kingdee.CDP.WebApi.SDK">
+ <HintPath>bin\Debug\net8.0\Kingdee.CDP.WebApi.SDK.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Content Update="appsettings.json">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
</Project>
diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json
index 68716f8..9fbf054 100644
--- a/Properties/launchSettings.json
+++ b/Properties/launchSettings.json
@@ -1,23 +1,14 @@
-锘縶
- "$schema": "http://json.schemastore.org/launchsettings.json",
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:55640",
- "sslPort": 0
- }
- },
+{
"profiles": {
"http": {
"commandName": "Project",
- "dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
- "applicationUrl": "http://localhost:5204",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- }
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "http://localhost:5204"
},
"IIS Express": {
"commandName": "IISExpress",
@@ -27,5 +18,14 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
+ },
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:5204",
+ "sslPort": 0
+ }
}
-}
+}
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index b642478..0000000
--- a/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-## LW_PdaService
-
-榫欏穽PDA鍚庣
-
diff --git a/Startup.cs b/Startup.cs
index caf1a01..1f040a6 100644
--- a/Startup.cs
+++ b/Startup.cs
@@ -30,6 +30,10 @@
services.Configure<AppSettings>(
Configuration.GetSection("AppSettings"));
+ // 娣诲姞鏈嶅姟娉ㄥ唽锛岃姹傚ご淇℃伅浼犻�掋��
+ services.AddHttpContextAccessor();
+ services.AddScoped<RequestInfo>();
+
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1",
@@ -38,7 +42,7 @@
var xmlFile =
$"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
- //c.IncludeXmlComments(xmlPath, true);
+ c.IncludeXmlComments(xmlPath, true);
});
//閰嶇疆JSON.NET
diff --git a/appsettings.json b/appsettings.json
index 2ba0f34..13b877d 100644
--- a/appsettings.json
+++ b/appsettings.json
@@ -9,7 +9,14 @@
"AppSettings": {
"TestErpUrl": "http://192.168.1.149:8066/WebService1.asmx/MesToErpinfoTest",
"ProductionErpUrl": "http://192.168.1.149:8066/WebService1.asmx/MesToErpinfoTest",
- //"DataBaseConn": "Data Source=192.168.1.146;Initial Catalog=TEST_MES;User ID=sa;Password =qixi123;Encrypt=True;TrustServerCertificate=True;"
- "DataBaseConn": "Data Source=192.168.8.8;Initial Catalog=TEST_MES;User ID=sa;Password =JianHui@2025;Encrypt=True;TrustServerCertificate=True;"
- }
+ //"DataBaseConn": "Data Source=192.168.1.146,12468;Initial Catalog=TEST_MES;User ID=testUser;Password =qixi1qaz@WSXtest;Encrypt=True;TrustServerCertificate=True;"
+ "DataBaseConn": "Data Source=192.168.8.8;Initial Catalog=YS_MES;User ID=sa;Password =JianHui@2025;Encrypt=True;TrustServerCertificate=True;"
+ },
+ "Version": "1.0.0",
+ "X-KDApi-AcctID": "6244701c616bff",
+ "X-KDApi-UserName": "demo",
+ "X-KDApi-AppID": "225649_7ZbM6dDO0qrVXXUKX/Xs09wH2u5d4rLE",
+ "X-KDApi-AppSec": "2bb1d972f3574a46aebee03cdc80aeae",
+ "X-KDApi-LCID": "2052",
+ "X-KDApi-ServerUrl": "http://172.17.55.175/k3cloud/"
}
diff --git a/entity/Base/ItemDetailModel.cs b/entity/Base/ItemDetailModel.cs
index 423cbb1..ab5de75 100644
--- a/entity/Base/ItemDetailModel.cs
+++ b/entity/Base/ItemDetailModel.cs
@@ -5,6 +5,7 @@
//璋冩嫧鍑哄叆搴撳崟閫氱敤绫�
public class ItemDetailModel
{
+ public string ItemId { get; set; } // 鐗╁搧Id
public string ItemNo { get; set; } // 鐗╁搧缂栧彿
public string ItemName { get; set; } // 鐗╁搧鍚嶇О
public string ItemModel { get; set; } // 鐗╁搧鍨嬪彿
diff --git a/entity/Base/RequestInfo.cs b/entity/Base/RequestInfo.cs
new file mode 100644
index 0000000..08a12ba
--- /dev/null
+++ b/entity/Base/RequestInfo.cs
@@ -0,0 +1,63 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System.Dynamic;
+
+public class RequestInfo : DynamicObject
+{
+ private readonly IHttpContextAccessor _httpContextAccessor;
+ private readonly ExpandoObject _data = new ExpandoObject();
+
+ public RequestInfo(IHttpContextAccessor httpContextAccessor)
+ {
+ _httpContextAccessor = httpContextAccessor;
+ InitializeData();
+ }
+
+ private void InitializeData()
+ {
+ // 鍒濆鍖栨墍鏈夐渶瑕佺殑璇锋眰澶村弬鏁�
+ SetValue("OrgId", GetHeaderValue("OrgId"));
+ //// 鍙互缁х画娣诲姞鍏朵粬鍙傛暟
+ //SetValue("UserId", GetHeaderValue("UserId"));
+ //SetValue("Language", GetHeaderValue("Language"));
+ }
+
+ public override bool TryGetMember(GetMemberBinder binder, out object result)
+ {
+ string name = binder.Name;
+ return ((IDictionary<string, object>)_data).TryGetValue(name, out result);
+ }
+
+ public override bool TrySetMember(SetMemberBinder binder, object value)
+ {
+ ((IDictionary<string, object>)_data)[binder.Name] = value;
+ return true;
+ }
+
+ public string GetHeaderValue(string key)
+ {
+ var httpContext = _httpContextAccessor.HttpContext;
+ if (httpContext?.Request.Headers.TryGetValue(key, out var value) == true)
+ {
+ return value.ToString();
+ }
+ return null;
+ }
+
+ private void SetValue(string key, object value)
+ {
+ ((IDictionary<string, object>)_data)[key] = value;
+ }
+
+ // 娣诲姞涓�涓柟娉曟潵妫�鏌ュ繀闇�鍙傛暟鏄惁瀛樺湪
+ public void ValidateRequired(params string[] requiredFields)
+ {
+ foreach (var field in requiredFields)
+ {
+ if (!((IDictionary<string, object>)_data).ContainsKey(field) ||
+ ((IDictionary<string, object>)_data)[field] == null)
+ {
+ throw new ArgumentException($"璇锋眰澶翠腑缂哄皯蹇呴渶鐨� {field} 鍙傛暟");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/entity/DeliveryNotice.cs b/entity/DeliveryNotice.cs
index 8fc7a8d..e738109 100644
--- a/entity/DeliveryNotice.cs
+++ b/entity/DeliveryNotice.cs
@@ -34,6 +34,12 @@
public string InnerVendorName { get; set; }
/// <summary>
+ /// 閲囪喘绫诲瀷锛�1锛氫竴鑸噰璐紱2锛氬澶栭噰璐紱3锛氬瑙掗噰璐紱4锛氳垂鐢ㄩ噰璐紱5锛氬浐璧勯噰璐紱6锛氬澶栫洿閫侊紱7锛氬澶栭噰璐紱8锛氬钩鍙伴噰璐紱9锛歏MI閲囪喘锛�10锛氭牱鍝侀噰璐紱11锛氭姌璁╄鍗曪紱12:閫�璐ц鍗曪紱13:浠i�佽鍗�
+ /// </summary>
+ [SugarColumn(ColumnName = "purchase_type")]
+ public string PurchaseType { get; set; }
+
+ /// <summary>
/// 閫佽揣绫诲瀷锛�1-鏅�� 2-琛ヨ揣 3-澶囧搧 4-鏍峰搧 5-VMI
/// </summary>
[SugarColumn(ColumnName = "delivery_type")]
@@ -272,4 +278,10 @@
/// </summary>
[SugarColumn(ColumnName = "last_operate_time")]
public string LastOperateTime { get; set; }
+
+ /// <summary>
+ /// 鏈�鍚庢搷浣滄椂闂达紙鏃堕棿鎴筹級
+ /// </summary>
+ [SugarColumn(ColumnName = "org_id")]
+ public string orgId { get; set; }
}
\ No newline at end of file
diff --git a/entity/ErpMesKc.cs b/entity/ErpMesKc.cs
new file mode 100644
index 0000000..93af660
--- /dev/null
+++ b/entity/ErpMesKc.cs
@@ -0,0 +1,50 @@
+锘縰sing SqlSugar;
+
+namespace NewPdaSqlServer.entity;
+
+[SugarTable("ERP_MES_KC")]
+public class ErpMesKc
+{
+ /// <summary>
+ /// 榛樿鍊�: (newid())
+ /// </summary>
+ [SugarColumn(ColumnName = "ID", IsPrimaryKey = true)]
+ public Guid ID { get; set; }
+
+ [SugarColumn(ColumnName = "FNUMBER")]
+ public string? FNumber { get; set; }
+
+ [SugarColumn(ColumnName = "FQTY")]
+ public decimal? FQty { get; set; }
+
+ [SugarColumn(ColumnName = "FBASEUNIT")]
+ public string? FBaseUnit { get; set; }
+
+ [SugarColumn(ColumnName = "FSTOCKUNIT")]
+ public string? FStockUnit { get; set; }
+
+ [SugarColumn(ColumnName = "FSTOCKID")]
+ public string? FStockId { get; set; }
+
+ [SugarColumn(ColumnName = "CREATE_DATE")]
+ public DateTime? CreateDate { get; set; }
+
+ [SugarColumn(ColumnName = "FBATCHNO")]
+ public string? FBatchno { get; set; }
+
+ [SugarColumn(ColumnName = "FMTONO")]
+ public string? FMtono { get; set; }
+
+ [SugarColumn(ColumnName = "FSTOCKSTATUS")]
+ public string? FStockStatus { get; set; }
+
+ [SugarColumn(ColumnName = "FSTOREURNOM")]
+ public decimal? FStoreUrnom { get; set; }
+
+ [SugarColumn(ColumnName = "FSTOREURNUM")]
+ public decimal? FStoreUrnum { get; set; }
+
+ [SugarColumn(ColumnName = "FSTOCKORGID")]
+ public decimal? FStockOrgId { get; set; }
+
+}
diff --git a/entity/Inventory.cs b/entity/Inventory.cs
new file mode 100644
index 0000000..d818b72
--- /dev/null
+++ b/entity/Inventory.cs
@@ -0,0 +1,8 @@
+锘縩amespace NewPdaSqlServer.entity
+{
+ public class Inventory
+ {
+ public string? ItemNo { get; set; } // 鏂欏彿
+ public string? DepotCode { get; set; } // 浠撳簱
+ }
+}
diff --git a/entity/LLJView.cs b/entity/LLJView.cs
index eb7e7ad..ceae628 100644
--- a/entity/LLJView.cs
+++ b/entity/LLJView.cs
@@ -109,7 +109,7 @@
/// 鏄惁鎬ユ枡
/// </summary>
[SugarColumn(ColumnName = "URGENT_FLAG")]
- public short? UrgentFlag { get; set; }
+ public int? UrgentFlag { get; set; }
/// <summary>
/// 鐗╂枡鍚嶇О
diff --git a/entity/MesInvItemInRksqDetails.cs b/entity/MesInvItemInRksqDetails.cs
deleted file mode 100644
index 350af80..0000000
--- a/entity/MesInvItemInRksqDetails.cs
+++ /dev/null
@@ -1,400 +0,0 @@
-锘縰sing SqlSugar;
-
-namespace NewPdaSqlServer.entity
-{
-
- /// <summary>
- /// 鐗╂枡鍏ュ簱鏉$爜鏄庣粏
- /// </summary>
- [SugarTable("MES_INV_ITEM_IN_RKSQ_DETAILS")]
- public class MesInvItemInRksqDetails
- {
- /// <summary>
- /// 榛樿鍊�: (newid())
- /// </summary>
- [SugarColumn(ColumnName = "guid", IsPrimaryKey = true)]
- public Guid Guid { get; set; }
-
- /// <summary>
- /// 鍏ュ簱鍗昳d
- /// </summary>
- [SugarColumn(ColumnName = "ITEM_IN_ID")]
- public Guid? ItemInId { get; set; }
-
- /// <summary>
- /// 鐗╂枡鏉$爜PSN
- /// </summary>
- [SugarColumn(ColumnName = "ITEM_BARCODE")]
- public string? ItemBarcode { get; set; }
-
- /// <summary>
- /// 瀹㈡埛鐗╂枡缂栫爜锛堟棤鏉$爜鎵嬪伐褰曞叆锛屾湁鏉$爜涓哄啑浣欏瓧娈碉級
- /// </summary>
- [SugarColumn(ColumnName = "C_ITEM_CODE")]
- public string? CItemCode { get; set; }
-
- /// <summary>
- /// 瀹㈡埛鐗╂枡鏉$爜
- /// </summary>
- [SugarColumn(ColumnName = "C_ITEM_BARCODE")]
- public string? CItemBarcode { get; set; }
-
- /// <summary>
- /// 楠屾敹鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "QUANTITY")]
- public decimal? Quantity { get; set; }
-
- /// <summary>
- /// 鍏ュ簱鏂瑰紡(1:鏈夋潯鐮�,0:鏃犳潯鐮�)
- /// 榛樿鍊�: ((1))
- /// </summary>
- [SugarColumn(ColumnName = "BARCODE_FLAG")]
- public bool? BarcodeFlag { get; set; }
-
- /// <summary>
- /// 鐜繚鏍囧織锛�0-闈炵幆淇�,1-鐜繚.鏃犳潯鐮佹墜宸ュ綍鍏ワ紝鏈夋潯鐮佷负鍐椾綑瀛楁锛�
- /// 榛樿鍊�: ((1))
- /// </summary>
- [SugarColumn(ColumnName = "EP_FLAG")]
- public bool? EpFlag { get; set; }
-
- /// <summary>
- /// 鍒涘缓浜�
- /// </summary>
- [SugarColumn(ColumnName = "CREATE_BY")]
- public string? CreateBy { get; set; }
-
- /// <summary>
- /// 鍒涘缓鏃堕棿
- /// </summary>
- [SugarColumn(ColumnName = "CREATE_DATE")]
- public DateTime? CreateDate { get; set; }
-
- /// <summary>
- /// 鏈�鍚庢洿鏂颁汉
- /// </summary>
- [SugarColumn(ColumnName = "LASTUPDATE_BY")]
- public string? LastupdateBy { get; set; }
-
- /// <summary>
- /// 鏈�鍚庢洿鏂版椂闂�
- /// </summary>
- [SugarColumn(ColumnName = "LASTUPDATE_DATE")]
- public DateTime? LastupdateDate { get; set; }
-
- /// <summary>
- /// 浣滀笟鏂瑰紡0-鏈夌嚎鏉$爜鏋�1-鏃犵嚎鏉$爜鏋�
- /// </summary>
- [SugarColumn(ColumnName = "WORK_TYPE")]
- public long? WorkType { get; set; }
-
- /// <summary>
- /// 鏈徃鐗╂枡缂栫爜锛堟棤鏉$爜鎵嬪伐褰曞叆锛屾湁鏉$爜涓哄啑浣欏瓧娈碉級
- /// </summary>
- [SugarColumn(ColumnName = "ITEM_NO")]
- public string? ItemNo { get; set; }
-
- /// <summary>
- /// 鍘傚鎵规
- /// </summary>
- [SugarColumn(ColumnName = "LOT_NO")]
- public string? LotNo { get; set; }
-
- /// <summary>
- /// 鏄惁鍏辩鐗╂枡(0:鍚︼紝1:鏄�)
- /// 榛樿鍊�: ((0))
- /// </summary>
- [SugarColumn(ColumnName = "COMANAGEMENT_FLAG")]
- public bool? ComanagementFlag { get; set; }
-
- /// <summary>
- /// 瀹㈡埛缂栫爜
- /// </summary>
- [SugarColumn(ColumnName = "CUST_NO")]
- public string? CustNo { get; set; }
-
- /// <summary>
- /// 妫�楠岀粨鏋�
- /// </summary>
- [SugarColumn(ColumnName = "CHECK_RES")]
- public string? CheckRes { get; set; }
-
- /// <summary>
- /// 杩涜揣鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "CHECK_QTY")]
- public decimal? CheckQty { get; set; }
-
- /// <summary>
- /// 妫�楠岀姸鎬�
- /// </summary>
- [SugarColumn(ColumnName = "CHECK_STATES")]
- public string? CheckStates { get; set; }
-
- /// <summary>
- /// 寮哄埗鍏ュ簱鏍囪0鏃狅紝1-寮哄埗鍏ュ簱 閫�鏂欏崟浣跨敤
- /// 榛樿鍊�: ((0))
- /// </summary>
- [SugarColumn(ColumnName = "FORCE_IN_FLAG")]
- public bool? ForceInFlag { get; set; }
-
- /// <summary>
- /// 浠撳簱缂栫爜
- /// </summary>
- [SugarColumn(ColumnName = "DEPOT_CODE")]
- public string? DepotCode { get; set; }
-
- /// <summary>
- /// 璐т綅缂栫爜
- /// </summary>
- [SugarColumn(ColumnName = "DEPOT_SECTION_CODE")]
- public string? DepotSectionCode { get; set; }
-
- /// <summary>
- /// 鐗硅浜嬮」
- /// </summary>
- [SugarColumn(ColumnName = "REMARK")]
- public string? Remark { get; set; }
-
- /// <summary>
- /// 鐗╂枡鏉$爜
- /// </summary>
- [SugarColumn(ColumnName = "ITEM_BARCODE2")]
- public string? ItemBarcode2 { get; set; }
-
- /// <summary>
- /// 鏂版潯鐮�
- /// </summary>
- [SugarColumn(ColumnName = "ITEM_BARCODE3")]
- public string? ItemBarcode3 { get; set; }
-
- /// <summary>
- /// 宸蹭娇鐢ㄦ暟閲�
- /// </summary>
- [SugarColumn(ColumnName = "USE_QTY")]
- public decimal? UseQty { get; set; }
-
- /// <summary>
- /// 鍑哄簱鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "OUT_QTY")]
- public decimal? OutQty { get; set; }
-
- /// <summary>
- /// 鐗╂枡鍚嶇О
- /// </summary>
- [SugarColumn(ColumnName = "ITEM_SNAME")]
- public string? ItemSname { get; set; }
-
- /// <summary>
- /// 璧峰浣嶇疆
- /// </summary>
- [SugarColumn(ColumnName = "SPOSTION")]
- public int? Spostion { get; set; }
-
- /// <summary>
- /// 缁撴潫浣嶇疆
- /// </summary>
- [SugarColumn(ColumnName = "EPOSTION")]
- public int? Epostion { get; set; }
-
- /// <summary>
- /// 妫�楠屾棩鏈�
- /// </summary>
- [SugarColumn(ColumnName = "CHECK_DATE")]
- public DateTime? CheckDate { get; set; }
-
- /// <summary>
- /// 鍗曚綅
- /// </summary>
- [SugarColumn(ColumnName = "UNIT")]
- public string? Unit { get; set; }
-
- /// <summary>
- /// 鏄惁妫�楠�
- /// 榛樿鍊�: ((0))
- /// </summary>
- [SugarColumn(ColumnName = "ISCHECK")]
- public bool? Ischeck { get; set; }
-
- /// <summary>
- /// 閲囪喘鍗曞彿
- /// </summary>
- [SugarColumn(ColumnName = "EBELN")]
- public string? Ebeln { get; set; }
-
- /// <summary>
- /// 鎵规鏃ユ湡
- /// </summary>
- [SugarColumn(ColumnName = "LOT_DATE")]
- public string? LotDate { get; set; }
-
- /// <summary>
- /// 鍙戠エ鍙�
- /// </summary>
- [SugarColumn(ColumnName = "BILL_NO")]
- public string? BillNo { get; set; }
-
- /// <summary>
- /// 鏄惁鍏ュ簱鎴愬姛
- /// 榛樿鍊�: ((0))
- /// </summary>
- [SugarColumn(ColumnName = "STOCK_OK")]
- public bool? StockOk { get; set; }
-
- /// <summary>
- /// 宸ュ巶
- /// </summary>
- [SugarColumn(ColumnName = "FACTORY")]
- public string? Factory { get; set; }
-
- /// <summary>
- /// 鍏徃
- /// </summary>
- [SugarColumn(ColumnName = "COMPANY")]
- public string? Company { get; set; }
-
- /// <summary>
- /// CB鍗曞彿
- /// </summary>
- [SugarColumn(ColumnName = "CB_NO")]
- public string? CbNo { get; set; }
-
- /// <summary>
- /// 绠卞彿
- /// </summary>
- [SugarColumn(ColumnName = "BOX_NO")]
- public string? BoxNo { get; set; }
-
- /// <summary>
- /// 浠撳簱ID
- /// </summary>
- [SugarColumn(ColumnName = "DEPOT_ID")]
- public long? DepotId { get; set; }
-
- /// <summary>
- /// 璐т綅ID
- /// </summary>
- [SugarColumn(ColumnName = "DEPOT_SECTION_ID")]
- public long? DepotSectionId { get; set; }
-
- /// <summary>
- /// 琛屽彿
- /// </summary>
- [SugarColumn(ColumnName = "LINE_NUM")]
- public string? LineNum { get; set; }
-
- /// <summary>
- /// 鎵弿鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "SM_QTY")]
- public decimal? SmQty { get; set; }
-
- /// <summary>
- /// 鍙戣揣鍗曞彿
- /// </summary>
- [SugarColumn(ColumnName = "VGBEL")]
- public string? Vgbel { get; set; }
-
- /// <summary>
- /// 琛屽彿
- /// </summary>
- [SugarColumn(ColumnName = "KDPOS")]
- public long? Kdpos { get; set; }
-
- /// <summary>
- /// 浣滀笟鍗曞彿
- /// </summary>
- [SugarColumn(ColumnName = "WORK_NO")]
- public string? WorkNo { get; set; }
-
- /// <summary>
- /// 琛屽彿
- /// </summary>
- [SugarColumn(ColumnName = "EBELN_LINE_NO")]
- public long? EbelnLineNo { get; set; }
-
- /// <summary>
- /// CB鍗曞彿
- /// </summary>
- [SugarColumn(ColumnName = "CBILL_NO")]
- public string? CbillNo { get; set; }
-
- /// <summary>
- /// 绱ф�ユ爣璁�
- /// </summary>
- [SugarColumn(ColumnName = "URGENT_FLAG")]
- public bool? UrgentFlag { get; set; }
-
- /// <summary>
- /// 鏉垮瀷
- /// </summary>
- [SugarColumn(ColumnName = "BOARD_STYLE")]
- public string? BoardStyle { get; set; }
-
- /// <summary>
- /// 宸ヤ綔琛屽彿
- /// </summary>
- [SugarColumn(ColumnName = "WORK_LINE")]
- public int? WorkLine { get; set; }
-
- /// <summary>
- /// 浠诲姟鍙�
- /// </summary>
- [SugarColumn(ColumnName = "TASK_NO")]
- public string? TaskNo { get; set; }
-
- /// <summary>
- /// 渚涘簲鍟嗙紪鐮�
- /// </summary>
- [SugarColumn(ColumnName = "SUPP_NO")]
- public string? SuppNo { get; set; }
-
- /// <summary>
- /// 鏀惰揣鍗曞彿
- /// </summary>
- [SugarColumn(ColumnName = "RBILL_NO")]
- public string? RbillNo { get; set; }
-
- /// <summary>
- /// K3 閲囪喘鍗曞彿
- /// </summary>
- [SugarColumn(ColumnName = "EBELN_K3ID")]
- public long? EbelnK3id { get; set; }
-
- /// <summary>
- /// K3 琛屽彿
- /// </summary>
- [SugarColumn(ColumnName = "LINE_K3ID")]
- public long? LineK3id { get; set; }
-
- /// <summary>
- /// 鐗╂枡ID
- /// </summary>
- [SugarColumn(ColumnName = "ITEM_ID")]
- public long? ItemId { get; set; }
-
- /// <summary>
- /// </summary>
- [SugarColumn(ColumnName = "SUPP_ID")]
- public string? SuppId { get; set; }
-
- /// <summary>
- /// 鏀舵枡缁勭粐
- /// </summary>
- [SugarColumn(ColumnName = "ReceiveOrgId")]
- public string? ReceiveOrgId { get; set; }
-
-
- // 娣诲姞鐨勫瓧娈碉紝骞朵笖瀹冧滑涓嶅睘浜庢暟鎹簱琛�
- [SugarColumn(IsIgnore = true)] public string? ItemName { get; set; }
-
- [SugarColumn(IsIgnore = true)] public string? ItemModel { get; set; }
-
- [SugarColumn(IsIgnore = true)] public string? ItemUnit { get; set; }
-
- [SugarColumn(IsIgnore = true)] public decimal? BgQuantity { get; set; }
-
-}
-}
diff --git a/entity/MesItemQtDatall.cs b/entity/MesItemQtDatall.cs
index 57fe40f..174a795 100644
--- a/entity/MesItemQtDatall.cs
+++ b/entity/MesItemQtDatall.cs
@@ -101,4 +101,10 @@
/// </summary>
[SugarColumn(IsIgnore = true)]
public string? Qt011 { get; set; }
+
+ /// <summary>
+ /// 浠撳簱id
+ /// </summary>
+ [SugarColumn(ColumnName = "depotId")]
+ public int? DepotId { get; set; }
}
\ No newline at end of file
diff --git a/entity/Womdaa.cs b/entity/Womdaa.cs
index 8552f13..16dbc5a 100644
--- a/entity/Womdaa.cs
+++ b/entity/Womdaa.cs
@@ -421,8 +421,8 @@
public string? SjXt { get; set; }
/// <summary>
- /// 鐢熶骇缁勭粐
+ /// 瀹為檯绾夸綋缂栫爜
/// </summary>
- [SugarColumn(ColumnName = "erp_sczz")]
- public string? ErpSczz { get; set; }
+ [SugarColumn(ColumnName = "mes_start_prod")]
+ public string? mesStartProd { get; set; }
}
\ No newline at end of file
diff --git a/entity/Womdaahb.cs b/entity/Womdaahb.cs
deleted file mode 100644
index 5bc498f..0000000
--- a/entity/Womdaahb.cs
+++ /dev/null
@@ -1,164 +0,0 @@
-锘縰sing SqlSugar;
-
-namespace NewPdaSqlServer.entity;
-
-/// <summary>
-/// 鍚堝苟宸ュ崟琛�
-/// </summary>
-[SugarTable("womdaahb")]
-public class Womdaahb
-{
- /// <summary>
- /// 涓婚敭
- /// </summary>
- [SugarColumn(ColumnName = "GUID", IsPrimaryKey = true)]
- public Guid Guid { get; set; }
-
- /// <summary>
- /// 澶囩敤涓婚敭
- /// </summary>
- [SugarColumn(ColumnName = "ID")]
- public int? Id { get; set; }
-
- /// <summary>
- /// 鍚堝苟宸ュ崟鍙�
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB001")]
- public string? Daahb001 { get; set; }
-
- /// <summary>
- /// 浜у搧ID
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB002")]
- public string? Daahb002 { get; set; }
-
- /// <summary>
- /// 浜у搧鍚嶇О
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB003")]
- public string? Daahb003 { get; set; }
-
- /// <summary>
- /// 浜у搧瑙勬牸
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB004")]
- public string? Daahb004 { get; set; }
-
- /// <summary>
- /// 鍗曚綅
- /// </summary>
- [SugarColumn(ColumnName = "DABHB005")]
- public string? Dabhb005 { get; set; }
-
- /// <summary>
- /// 鍒涘缓鏃堕棿
- /// </summary>
- [SugarColumn(ColumnName = "CREATE_DATE")]
- public DateTime? CreateDate { get; set; }
-
- /// <summary>
- /// 鏈�鍚庢洿鏂版椂闂�
- /// </summary>
- [SugarColumn(ColumnName = "DABHB007")]
- public DateTime? Dabhb007 { get; set; }
-
- /// <summary>
- /// 宸ュ崟鏁伴噺
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB008")]
- public long? Daahb008 { get; set; }
-
- /// <summary>
- /// 澶囨敞
- /// </summary>
- [SugarColumn(ColumnName = "DAAH009")]
- public string? Daah009 { get; set; }
-
- /// <summary>
- /// 宸ヤ綔杞﹂棿
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB013")]
- public string? Daahb013 { get; set; }
-
- /// <summary>
- /// 鐢熶骇绾垮埆
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB015")]
- public string? Daahb015 { get; set; }
-
- /// <summary>
- /// 瀹℃牳鏍囪瘑
- /// 榛樿鍊�: 0
- /// </summary>
- [SugarColumn(ColumnName = "FSTATUS")]
- public int? Fstatus { get; set; }
-
- /// <summary>
- /// 瀹℃牳鏃ユ湡
- /// </summary>
- [SugarColumn(ColumnName = "CHECK_DATE")]
- public DateTime? CheckDate { get; set; }
-
- /// <summary>
- /// 瀹℃牳浜�
- /// </summary>
- [SugarColumn(ColumnName = "CHECK_USER")]
- public string? CheckUser { get; set; }
-
- /// <summary>
- /// 绾垮埆缂栫爜
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB020")]
- public string? Daahb020 { get; set; }
-
- /// <summary>
- /// 浠诲姟鍗曞崟鍙�
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB021")]
- public string? Daahb021 { get; set; }
-
- /// <summary>
- /// 鍒涘缓浜�
- /// </summary>
- [SugarColumn(ColumnName = "CREATE_BY")]
- public string? CreateBy { get; set; }
-
- /// <summary>
- /// 瀹屾垚鏍囪瘑
- /// 榛樿鍊�: 0
- /// </summary>
- [SugarColumn(ColumnName = "COMPLETE_STATUS")]
- public int? CompleteStatus { get; set; }
-
- /// <summary>
- /// 宸ヤ綔杞﹂棿鍚嶇О
- /// </summary>
- [SugarColumn(ColumnName = "DAAHB013_NAME")]
- public string? Daahb013Name { get; set; }
-
- /// <summary>
- /// 鍐荤粨鏍囪瘑
- /// 榛樿鍊�: 0
- /// </summary>
- [SugarColumn(ColumnName = "FREEZE_FLAG")]
- public int? FreezeFlag { get; set; }
-
- /// <summary>
- /// 濮斿鏍囪瘑
- /// 榛樿鍊�: 0
- /// </summary>
- [SugarColumn(ColumnName = "F_TYPE")]
- public int? FType { get; set; }
-
- /// <summary>
- /// 閿�鍞鍗�
- /// </summary>
- [SugarColumn(ColumnName = "SALES_ORDER")]
- public string? SalesOrder { get; set; }
-
- /// <summary>
- /// 缁勭粐id
- /// </summary>
- [SugarColumn(ColumnName = "org_id")]
- public int? OrgId { get; set; }
-}
\ No newline at end of file
diff --git a/service/ErpKcManager.cs b/service/ErpKcManager.cs
new file mode 100644
index 0000000..92f7e32
--- /dev/null
+++ b/service/ErpKcManager.cs
@@ -0,0 +1,133 @@
+锘�
+using Kingdee.CDP.WebApi.SDK;
+using NewPdaSqlServer.entity;
+using NewPdaSqlServer.util;
+using SqlSugar;
+using NewPdaSqlServer.DB;
+using System.Text;
+using NewPdaSqlServer.Dto;
+using Microsoft.AspNetCore.Mvc;
+using MES.Service.Models;
+
+namespace MES.Service.service.Kingdee;
+
+public class ErpKcManager : Repository<ErpMesKc>
+{
+ public bool QueryStocks(Inventory inventory)
+ {
+ List<ErpKc> erpKc = GetErpInventory(inventory);
+
+ // 妫�鏌ヨ繑鍥炵粨鏋滄槸鍚︿负绌�
+ if (erpKc == null || erpKc.Count == 0)
+ {
+ throw new NotImplementedException("杩斿洖缁撴灉涓虹┖");
+ }
+ else
+ {
+ var baseObjects = MapErpCABtoWomcab(erpKc);
+
+ return UseTransaction(db =>
+ {
+ return SaveData(db, baseObjects) ? 1 : 0;
+ }) > 0;
+ }
+ }
+
+ #region 1.鑾峰彇鍗虫椂搴撳瓨
+ public List<ErpKc> GetErpInventory(Inventory inventory)
+ {
+ //娉ㄦ剰 1锛氭澶勪笉鍐嶄娇鐢ㄥ弬鏁板舰寮忎紶鍏ョ敤鎴峰悕鍙婂瘑鐮佺瓑鏁忔劅淇℃伅锛屾敼涓哄湪鐧诲綍閰嶇疆鏂囦欢涓缃��
+ //娉ㄦ剰 2锛氬繀椤诲厛閰嶇疆绗笁鏂圭郴缁熺櫥褰曟巿鏉冧俊鎭悗锛屽啀杩涜涓氬姟鎿嶄綔锛岃鎯呭弬鑰冨悇璇█鐗堟湰SDK浠嬬粛涓殑鐧诲綍閰嶇疆鏂囦欢璇存槑銆�
+ //璇诲彇閰嶇疆锛屽垵濮嬪寲SDK
+ K3CloudApi client = new K3CloudApi();
+ //鐢ㄤ簬璁板綍缁撴灉
+ StringBuilder Info = new StringBuilder();
+ //涓氬姟瀵硅薄鏍囪瘑
+ string formId = "STK_Inventory";
+ DateTime dt = DateTime.Now;
+ //鏌ヨ瀛楁闆嗗悎锛屽嵆杩斿洖鍝簺鏁版嵁锛屼笉鑳戒负绌猴紝鏍规嵁涓嶅悓涓氬姟鍗曟嵁濉啓涓嶅悓鐨勫瓧娈靛悕锛屼互涓嬩粎涓虹ず渚�
+ //string fieldKeys = "FCod,FFileId,FRelevantObject";
+ //string FilterString = "FID='-2146304'";
+ string fieldKeys = "FMaterialId.FNumber,FMtoNo,FStockId,FLot.FNumber,FStockUnitId.FNumber,FBaseUnitId.FNumber,FStockStatusId.FName,FBASEQTY,FMaterialid.FSTOREURNOM,FMaterialid.FSTOREURNUM,FStockOrgId";
+ string FilterString = string.Format(@"FMaterialId.FNumber like '%{0}%' and FStockId.FNumber like '%{1}%' and FBaseQty>0", inventory.ItemNo,inventory.DepotCode);
+ string OrderString = "";
+ int TopRowCount = 0;
+ int StartRow = 0;
+ int Limit = 0;
+
+ var param = new QueryParam()
+ {
+ FormId = formId,
+ FieldKeys = fieldKeys,
+ FilterString = FilterString,
+ OrderString = OrderString,
+ TopRowCount = TopRowCount,
+ StartRow = StartRow,
+ Limit = Limit
+ };
+ //璋冪敤鎺ュ彛
+ var result = client.ExecuteBillQuery(param.ToJson());
+
+ return result.Select(s =>
+ {
+ var entity = new ErpKc
+ {
+ FMaterialId = s[0]?.ToString(),
+ FMtoNo = s[1]?.ToString(),
+ FStockId = s[2]?.ToString(),
+ FLot = s[3]?.ToString(),
+ FStockUnitId = s[4]?.ToString(),
+ FBaseUnitId = s[5]?.ToString(),
+ FStockStatusId = s[6]?.ToString(),
+ FBASEQTY = s[7]?.ToString() ,
+ FSTOREURNOM = s[8]?.ToString(),
+ FSTOREURNUM = s[9]?.ToString(),
+ FStockOrgId = s[10]?.ToString()
+ };
+ return entity;
+ }).ToList();
+ }
+ #endregion
+
+
+ private List<ErpMesKc> MapErpCABtoWomcab(List<ErpKc> dtoList)
+ {
+ var ErpMesKcList = new List<ErpMesKc>();
+
+ foreach (var dto in dtoList)
+ {
+ var kc = new ErpMesKc
+ {
+ FNumber = dto.FMaterialId,
+ FQty = Convert.ToDecimal(dto.FBASEQTY),
+ FBaseUnit=dto.FBaseUnitId,
+ FStockUnit=dto.FStockUnitId,
+ FStockId=dto.FStockId,
+ CreateDate=DateTime.Now,
+ FBatchno=dto.FLot,
+ FMtono=dto.FMtoNo,
+ FStockStatus=dto.FStockStatusId,
+ FStoreUrnom= Convert.ToDecimal(dto.FSTOREURNOM),
+ FStoreUrnum= Convert.ToDecimal(dto.FSTOREURNUM),
+ FStockOrgId = Convert.ToDecimal(dto.FStockOrgId)
+
+ };
+
+ ErpMesKcList.Add(kc);
+ }
+
+ return ErpMesKcList;
+ }
+
+ // 鎻掑叆鎴栨洿鏂版暟鎹殑鏂规硶
+ private bool SaveData(SqlSugarScope db, List<ErpMesKc> kcc)
+ {
+ Db.Deleteable<ErpMesKc>()
+ .ExecuteCommand();
+
+ var save = base.InsertRange(kcc);
+ if (save) return true;
+ throw new NotImplementedException("鎻掑叆澶辫触");
+ }
+
+}
diff --git a/service/JJGZ/OaToMesRecordManager.cs b/service/JJGZ/OaToMesRecordManager.cs
new file mode 100644
index 0000000..8ddc4fa
--- /dev/null
+++ b/service/JJGZ/OaToMesRecordManager.cs
@@ -0,0 +1,215 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Microsoft.Data.SqlClient;
+using NewPdaSqlServer.DB;
+using NewPdaSqlServer.Dto.service;
+using System.Data;
+
+namespace NewPdaSqlServer.service.JJGZ
+{
+ public class OaToMesRecordManager : Repository<OaToMesRecord>
+ {
+ public string ApproveRecord(OaToMesRecord record)
+ {
+ var _strMsg = "";
+ if (record == null || record.dataJson == null || record.dataJson.Count == 0)
+ throw new Exception("dataJson涓嶈兘涓虹┖涓斿繀椤诲寘鍚嚦灏戜竴鏉¤褰�");
+
+ int successCount = 0;
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ conn.Open();
+ using (var tran = conn.BeginTransaction())
+ {
+ try
+ {
+ foreach (var item in record.dataJson)
+ {
+ // 鍙傛暟鏍¢獙澧炲己
+ if (string.IsNullOrEmpty(item.StaffId)) throw new Exception("鍛樺伐缂栧彿涓嶈兘涓虹┖");
+ if (string.IsNullOrEmpty(item.LineNo)) throw new Exception("浜х嚎涓嶈兘涓虹┖");
+ if (string.IsNullOrEmpty(item.Classes)) throw new Exception("鐝涓嶈兘涓虹┖");
+ if (item.CheckTime == null) throw new Exception("鎵撳崱鏃ユ湡涓嶈兘涓虹┖");
+
+ var sql = @"INSERT INTO MES_JJGZ_RECORD (GUID, Staff_Id, Staff_No, Staff_Name, Line_No, Line_Name, CheckTime, ScheNo,RecordDate,OrgId) VALUES (NEWID(), @StaffId, @StaffNo, @StaffName, @LineNo, @LineName, @CheckTime, @Classes, getdate(),@OrgId)";
+ using (var cmd = new SqlCommand(sql, conn, tran))
+ {
+ cmd.Parameters.AddWithValue("@StaffId", item.StaffId ?? (object)DBNull.Value);
+ cmd.Parameters.AddWithValue("@StaffNo", item.StaffNo ?? (object)DBNull.Value);
+ cmd.Parameters.AddWithValue("@StaffName", item.StaffName ?? (object)DBNull.Value);
+ cmd.Parameters.AddWithValue("@LineNo", item.LineNo ?? (object)DBNull.Value);
+ cmd.Parameters.AddWithValue("@LineName", item.LineName ?? (object)DBNull.Value);
+ cmd.Parameters.AddWithValue("@CheckTime", item.CheckTime ?? (object)DBNull.Value);
+ cmd.Parameters.AddWithValue("@Classes", item.Classes ?? (object)DBNull.Value);
+ cmd.Parameters.AddWithValue("@OrgId", item.OrgId ?? (object)DBNull.Value);
+ int rows = cmd.ExecuteNonQuery();
+ if (rows > 0) successCount++;
+ }
+ }
+ tran.Commit();
+ return $"鎵归噺鎻掑叆MES_JJGZ_RECORD鎴愬姛锛佸叡鎻掑叆{successCount}鏉¤褰曘��";
+ }
+ catch (Exception ex)
+ {
+ tran.Rollback();
+ _strMsg = $"鎵归噺鎻掑叆MES_JJGZ_RECORD寮傚父锛歿ex.Message}";
+ throw new Exception(_strMsg);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
+
+ public string ApproveUser(OaToMesUser user)
+ {
+ var _strMsg = "";
+ if (user == null || user.dataJson == null || user.dataJson.Count == 0)
+ throw new Exception("dataJson涓嶈兘涓虹┖涓斿繀椤诲寘鍚嚦灏戜竴鏉¤褰�");
+
+ int insertCount = 0;
+ int updateCount = 0;
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ conn.Open();
+ using (var tran = conn.BeginTransaction())
+ {
+ try
+ {
+ foreach (var item in user.dataJson)
+ {
+ // 鍙傛暟鏍¢獙澧炲己
+ if (string.IsNullOrEmpty(item.Id)) throw new Exception("鐢ㄦ埛ID涓嶈兘涓虹┖");
+ if (string.IsNullOrEmpty(item.Name)) throw new Exception("鐢ㄦ埛濮撳悕涓嶈兘涓虹┖");
+
+ // 妫�鏌ユ槸鍚﹀瓨鍦�
+ var checkSql = @"SELECT COUNT(1) FROM OA_USER WHERE Id = @Id";
+ using (var checkCmd = new SqlCommand(checkSql, conn, tran))
+ {
+ checkCmd.Parameters.AddWithValue("@Id", item.Id);
+ var exists = (int)checkCmd.ExecuteScalar() > 0;
+
+ if (exists)
+ {
+ // 鏇存柊
+ var updateSql = @"UPDATE OA_USER SET NAME = @Name, JOBNUMBER = @Jobnumber, DEPARTMENT = @Department WHERE Id = @Id";
+ using (var updateCmd = new SqlCommand(updateSql, conn, tran))
+ {
+ updateCmd.Parameters.AddWithValue("@Id", item.Id);
+ updateCmd.Parameters.AddWithValue("@Name", item.Name ?? (object)DBNull.Value);
+ updateCmd.Parameters.AddWithValue("@Jobnumber", item.Jobnumber ?? (object)DBNull.Value);
+ updateCmd.Parameters.AddWithValue("@Department", item.Department ?? (object)DBNull.Value);
+ int rows = updateCmd.ExecuteNonQuery();
+ if (rows > 0) updateCount++;
+ }
+ }
+ else
+ {
+ // 鎻掑叆
+ var insertSql = @"INSERT INTO OA_USER (Id, NAME, JOBNUMBER, DEPARTMENT) VALUES (@Id, @Name, @Jobnumber, @Department)";
+ using (var insertCmd = new SqlCommand(insertSql, conn, tran))
+ {
+ insertCmd.Parameters.AddWithValue("@Id", item.Id);
+ insertCmd.Parameters.AddWithValue("@Name", item.Name ?? (object)DBNull.Value);
+ insertCmd.Parameters.AddWithValue("@Jobnumber", item.Jobnumber ?? (object)DBNull.Value);
+ insertCmd.Parameters.AddWithValue("@Department", item.Department ?? (object)DBNull.Value);
+ int rows = insertCmd.ExecuteNonQuery();
+ if (rows > 0) insertCount++;
+ }
+ }
+ }
+ }
+ tran.Commit();
+ return $"鐢ㄦ埛鏁版嵁鍚屾鎴愬姛锛佹彃鍏insertCount}鏉★紝鏇存柊{updateCount}鏉¤褰曘��";
+ }
+ catch (Exception ex)
+ {
+ tran.Rollback();
+ _strMsg = $"鐢ㄦ埛鏁版嵁鍚屾寮傚父锛歿ex.Message}";
+ throw new Exception(_strMsg);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
+
+ public string ApproveDepartment(OaToMesDepartment department)
+ {
+ var _strMsg = "";
+ if (department == null || department.dataJson == null || department.dataJson.Count == 0)
+ throw new Exception("dataJson涓嶈兘涓虹┖涓斿繀椤诲寘鍚嚦灏戜竴鏉¤褰�");
+
+ int insertCount = 0;
+ int updateCount = 0;
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ conn.Open();
+ using (var tran = conn.BeginTransaction())
+ {
+ try
+ {
+ foreach (var item in department.dataJson)
+ {
+ // 鍙傛暟鏍¢獙澧炲己
+ if (string.IsNullOrEmpty(item.Id)) throw new Exception("閮ㄩ棬ID涓嶈兘涓虹┖");
+ if (string.IsNullOrEmpty(item.Name)) throw new Exception("閮ㄩ棬鍚嶇О涓嶈兘涓虹┖");
+
+ // 妫�鏌ユ槸鍚﹀瓨鍦�
+ var checkSql = @"SELECT COUNT(1) FROM OA_DEPARTMENT WHERE id = @Id";
+ using (var checkCmd = new SqlCommand(checkSql, conn, tran))
+ {
+ checkCmd.Parameters.AddWithValue("@Id", item.Id);
+ var exists = (int)checkCmd.ExecuteScalar() > 0;
+
+ if (exists)
+ {
+ // 鏇存柊
+ var updateSql = @"UPDATE OA_DEPARTMENT SET name = @Name, Parentid = @Parentid, OrgId = @OrgId WHERE Id = @Id";
+ using (var updateCmd = new SqlCommand(updateSql, conn, tran))
+ {
+ updateCmd.Parameters.AddWithValue("@Id", item.Id);
+ updateCmd.Parameters.AddWithValue("@Name", item.Name ?? (object)DBNull.Value);
+ updateCmd.Parameters.AddWithValue("@Parentid", item.Parentid ?? (object)DBNull.Value);
+ updateCmd.Parameters.AddWithValue("@OrgId", item.OrgId ?? (object)DBNull.Value);
+ int rows = updateCmd.ExecuteNonQuery();
+ if (rows > 0) updateCount++;
+ }
+ }
+ else
+ {
+ // 鎻掑叆
+ var insertSql = @"INSERT INTO OA_DEPARTMENT (id, name, Parentid, OrgId) VALUES (@Id, @Name, @Parentid, @OrgId)";
+ using (var insertCmd = new SqlCommand(insertSql, conn, tran))
+ {
+ insertCmd.Parameters.AddWithValue("@Id", item.Id);
+ insertCmd.Parameters.AddWithValue("@Name", item.Name ?? (object)DBNull.Value);
+ insertCmd.Parameters.AddWithValue("@Parentid", item.Parentid ?? (object)DBNull.Value);
+ insertCmd.Parameters.AddWithValue("@OrgId", item.OrgId ?? (object)DBNull.Value);
+ int rows = insertCmd.ExecuteNonQuery();
+ if (rows > 0) insertCount++;
+ }
+ }
+ }
+ }
+ tran.Commit();
+ return $"閮ㄩ棬鏁版嵁鍚屾鎴愬姛锛佹彃鍏insertCount}鏉★紝鏇存柊{updateCount}鏉¤褰曘��";
+ }
+ catch (Exception ex)
+ {
+ tran.Rollback();
+ _strMsg = $"閮ㄩ棬鏁版嵁鍚屾寮傚父锛歿ex.Message}";
+ throw new Exception(_strMsg);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/service/QC/IpqcService.cs b/service/QC/IpqcService.cs
index d6c87f0..73a62e1 100644
--- a/service/QC/IpqcService.cs
+++ b/service/QC/IpqcService.cs
@@ -46,89 +46,57 @@
return (pageList, totalCount);
}
- public List<MesQaItemsDetectDetail5> GetItems(string? releaseNo,
+ public List<dynamic> GetItems(string? releaseNo,
string? id)
{
var parsedGuid = Guid.Empty;
- if (id != null)
- {
- var isValid = Guid.TryParse(id, out parsedGuid);
- if (!isValid)
- throw new ApplicationException("GUID杞崲閿欒");
- }
+ var sql = string.Format(@"SELECT [a].[guid] AS [Guid],
+ [a].[parent_guid] AS [ParentGuid],
+ [a].[release_no] AS [ReleaseNo],
+ [a].[check_qyt] AS [CheckQyt],
+ [a].[fac_level] AS [FacLevel],
+ [a].[fcheck_item] AS [FcheckItem],
+ [a].[fcheck_tool] AS [FcheckTool],
+ [a].[fdown_allow] AS [FdownAllow],
+ [a].[fcheck_level] AS [FcheckLevel],
+ [a].[fstand] AS [Fstand],
+ [a].[fup_allow] AS [FupAllow],
+ [a].[sample_size_no] AS [SampleSizeNo],
+ [a].[fspec_requ] AS [FspecRequ],
+ [a].[fre_qty] AS [FreQty],
+ N'1000' AS [Factory],
+ N'1000' AS [Company],
+ COUNT([b].[guid]) AS [FenterQty],
+ [a].[fcheck_resu] AS [FcheckResu],
+ [a].[forder] AS [Order],
+ [a].[ybsl] AS [Ybsl],
+ [a].stationName,
+ [a].IS_GWSCAN,
+ ISNULL((SELECT COUNT(1)
+ FROM MES_QA_ITEMS_DETECT_DETAIL13 C
+ WHERE C.parent_guid = A.guid), 0) AS [YbslIn]
+FROM [MES_QA_ITEMS_DETECT_DETAIL5] [a]
+ Left JOIN [MES_QA_ITEMS_DETECT_DETAIL12] [b] ON ([a].[guid] = [b].[parent_guid])
+WHERE ([a].[release_no] = N'{0}' AND IS_GWSCAN = 1)
+GROUP BY [a].[guid], [a].[parent_guid], [a].[release_no], [a].[fac_level], [a].[fcheck_item], [a].[fcheck_tool],
+ [a].[fdown_allow], [a].[fcheck_level], [a].[fstand], [a].[fup_allow], [a].[sample_size_no], [a].[fspec_requ],
+ [a].[fre_qty], [a].[check_qyt], [a].[fcheck_resu], [a].[forder], [a].[ybsl], [a].stationName,
+ [a].IS_GWSCAN
+ORDER BY [a].[forder] ASC", releaseNo);
- var Ybsl_In = Db.Queryable<MesQaItemsDetectDetail5>()
- .Where(a => a.ParentGuid == parsedGuid)
- .Count();
+ var Ybsl_In = Db.Ado.SqlQuery<dynamic>(sql).ToList();
- return Db.Queryable<MesQaItemsDetectDetail5, MesQaItemsDetectDetail12>(
- (a, b) =>
- new JoinQueryInfos(JoinType.Left, a.Guid == b.ParentGuid))
- .Where((a, b) => a.ReleaseNo == releaseNo)
- .WhereIF(UtilityHelper.CheckGuid(parsedGuid),
- (a, b) => a.Guid == parsedGuid)
- .GroupBy((a, b) => new
- {
- a.Guid,
- a.ParentGuid,
- a.ReleaseNo,
- a.FacLevel,
- a.FcheckItem,
- a.FcheckTool,
- a.FdownAllow,
- a.FcheckLevel,
- a.Fstand,
- a.FupAllow,
- a.SampleSizeNo,
- a.FspecRequ,
- a.FreQty,
- a.CheckQyt,
- a.FcheckResu,
- a.Order,
- a.Ybsl,
- a.ISRZXX,
- a.IPQCRZXX,
- a.IPQCRZXXDate,
- a.IPQCRZXXNum,
- a.IPQCpscs,
- a.FcheckType,
- }).Select((a, b) => new MesQaItemsDetectDetail5
- {
- Guid = a.Guid,
- ParentGuid = a.ParentGuid,
- ReleaseNo = a.ReleaseNo,
- CheckQyt = a.CheckQyt,
- FacLevel = a.FacLevel,
- FcheckItem = a.FcheckItem,
- FcheckTool = a.FcheckTool,
- FdownAllow = a.FdownAllow,
- FcheckLevel = a.FcheckLevel,
- Fstand = a.Fstand,
- FupAllow = a.FupAllow,
- SampleSizeNo = a.SampleSizeNo,
- FspecRequ = a.FspecRequ,
- FreQty = a.FreQty,
- Factory = "1000",
- Company = "1000",
- FenterQty = SqlFunc.AggregateCount(b.Guid),
- FcheckResu = a.FcheckResu,
- Order = a.Order,
- Ybsl = a.Ybsl,
- YbslIn = Ybsl_In,
- ISRZXX = a.ISRZXX,
- IPQCRZXX = a.IPQCRZXX,
- IPQCRZXXDate = a.IPQCRZXXDate.ToString(),
- IPQCRZXXNum = a.IPQCRZXXNum,
- IPQCpscs = a.IPQCpscs,
- FcheckType =a.FcheckType,
- }).OrderBy(a => a.Order)
- .ToList();
+ return Ybsl_In;
}
public (List<VIpqcXj> item, int TotalCount) getPageXj(XJPageResult queryObj)
{
+
+
+
+ var totalCount = 0;
var parsedGuid = Guid.Empty;
if (!queryObj.id.IsNullOrEmpty())
{
@@ -137,24 +105,9 @@
throw new ApplicationException("GUID杞崲閿欒");
}
+ var sql = string.Format(@"EXEC prc_pda_ipqc_GetXjList '{0}'", parsedGuid);
- var totalCount = 0;
-
- var pageList = Db.Queryable<VIpqcXj>()
- .WhereIF(!string.IsNullOrWhiteSpace(queryObj.keyword), a =>
- a.ItemNo.Contains(queryObj.keyword) ||
- a.ItemName.Contains(queryObj.keyword) ||
- a.Daa001.Contains(queryObj.keyword) ||
- a.ReleaseNo.Contains(queryObj.keyword) ||
- a.DepartmentName.Contains(queryObj.keyword) ||
- a.xtName.Contains(queryObj.keyword)
- )
- .WhereIF(UtilityHelper.CheckGuid(parsedGuid),
- a => a.Guid == parsedGuid.ToString())
- .Where(a => (a.FSubmit ?? 0) == 0)
- .OrderByDescending(a => a.CreateDate)
- .OrderBy(a => a.checkTimeSlot)
- .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount);
+ var pageList = Db.Ado.SqlQuery<VIpqcXj>(sql).ToList();
return (pageList, totalCount);
}
@@ -369,4 +322,58 @@
return XcslItem;
}
+
+
+ public dynamic SelIpqcItemsByGw(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query));
+
+ if (string.IsNullOrEmpty(query.userAccount?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userAccount));
+
+ if (string.IsNullOrEmpty(query.inOrderGuid1?.ToString()))
+ throw new ArgumentException("妫�楠屽崟涓昏〃GUID涓嶅厑璁镐负绌�", nameof(query.inOrderGuid1));
+
+ var _strMsg = "";
+ var _status = -1;
+
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ using (var cmd = new SqlCommand("prc_selIpqcItemsByGw", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+
+ SqlParameter[] parameters =
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
+ new("@pi_gw", SqlDbType.NVarChar, 100) { Value = query.gw },
+ new("@pi_QaGuid1", SqlDbType.NVarChar, 100) { Value = query.inOrderGuid1 },
+ new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
+ new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
+ };
+
+ cmd.Parameters.AddRange(parameters);
+ cmd.ExecuteNonQuery();
+
+ _strMsg = parameters[3].Value?.ToString() ?? "";
+ _status = Convert.ToInt32(parameters[4].Value ?? -1);
+
+ if (_status <= 0) throw new Exception(_strMsg);
+
+ return new
+ {
+ message = _strMsg,
+ status = _status,
+ qaGuid = query.inOrderGuid1,
+ gw = query.gw
+ };
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"宸ヤ綅鎵弿澶辫触锛歿ex.Message}");
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/service/QC/OaApi.cs b/service/QC/OaApi.cs
index 98bba9c..632f099 100644
--- a/service/QC/OaApi.cs
+++ b/service/QC/OaApi.cs
@@ -23,9 +23,13 @@
public class OaApiService : Repository<dynamic>
{
private readonly HttpClient _httpClient;
- private const string AppId = "303233EF-AC39-40C1-8364-AC989C6258A5";
- private const string BaseUrl = "http://192.168.1.149:8099/api/ec/dev/auth/";
- private const string WorkflowUrl = "http://192.168.1.149:8099/api/workflow/paService/doCreateRequest";
+ //private const string AppId = "303233EF-AC39-40C1-8364-AC989C6258A5";
+ //private const string BaseUrl = "http://192.168.1.149:8099/api/ec/dev/auth/";
+ //private const string WorkflowUrl = "http://192.168.1.149:8099/api/workflow/paService/doCreateRequest";
+
+ private const string AppId = "AB7F0461-89C3-4EAD-B5B5-B7D540617921";
+ private const string BaseUrl = "http://192.168.1.20:80/api/ec/dev/auth/";
+ private const string WorkflowUrl = "http://192.168.1.20:80/api/workflow/paService/doCreateRequest";
public OaApiService()
{
@@ -54,15 +58,47 @@
// 2. 鑾峰彇璁块棶浠ょ墝
var tokenResult = ApplyTokenAsync(secret, spk);
var token = tokenResult["token"].ToString();
+ string oaUserId = "";
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("select_oa_userid", conn))
+ {
+
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ cmd.Parameters.Add(new SqlParameter("@guid", SqlDbType.VarChar, 100) { Value = queryObj.qcczdGuid.ToString() });
+
+ using (var reader = cmd.ExecuteReader())
+ {
+ if (reader.Read())
+ {
+ oaUserId = reader["result"]?.ToString();
+ }
+ }
+ }
+ catch (Exception logEx)
+ {
+ Console.WriteLine($"鑾峰彇OA鐢ㄦ埛ID澶辫触: {logEx.Message}");
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
// 3. 鍑嗗璇锋眰澶达紙绉婚櫎Content-Type璁剧疆锛�
_httpClient.DefaultRequestHeaders.Clear();
_httpClient.DefaultRequestHeaders.Add("token", token);
_httpClient.DefaultRequestHeaders.Add("appid", AppId);
- _httpClient.DefaultRequestHeaders.Add("userid", RSAEncrypt("1268", spk));
+ _httpClient.DefaultRequestHeaders.Add("userid", RSAEncrypt(oaUserId, spk));
// 4. 鏋勫缓璇锋眰浣�
var requestData = BuildRequestData(queryObj);
+
+ //var A = JObject.FromObject(requestData).ToString();
// 5. 鍙戦�佽姹�
var response = PostForm(WorkflowUrl, requestData);
@@ -160,7 +196,7 @@
{
{"mainData", BuildMainData(queryObj)},
{"requestName", $"IQC寮傚父澶勭疆鍗曟祦绋�-{DateTime.Now:yyyyMMddHHmmss}"},
- {"workflowId", "379"},
+ {"workflowId", "602"},//娴嬭瘯锛�379 姝e紡锛�600->602
//{"otherParams", BuildOtherParams()},
{"detailData", BuildDetailData(queryObj)}
};
@@ -243,7 +279,7 @@
WHERE pGuid = @guid";
var fileData = Db.Ado.SqlQuery<dynamic>(fileSql, new { guid = queryObj.qcczdGuid });
- var files = CreateFileData(fileData);
+ var files = fileData.Count > 0 ? CreateFileData(fileData) : null; // 鏂板
// 娣诲姞鏂囦欢瀛楁
result.Add(new JObject
@@ -419,7 +455,7 @@
{
new JObject
{
- ["tableDBName"] = "formtable_main_33_dt1",
+ ["tableDBName"] = "formtable_main_321_dt1",//娴嬭瘯锛歠ormtable_main_33_dt1
["workflowRequestTableRecords"] = tableRecords
}
};
diff --git a/service/Warehouse/KwbgManager.cs b/service/Warehouse/KwbgManager.cs
new file mode 100644
index 0000000..93f22ef
--- /dev/null
+++ b/service/Warehouse/KwbgManager.cs
@@ -0,0 +1,219 @@
+锘縰sing System.Data;
+using System.Data.SqlClient;
+using Masuit.Tools;
+using Masuit.Tools.Hardware;
+using NewPdaSqlServer.DB;
+using NewPdaSqlServer.Dto.service;
+using NewPdaSqlServer.entity;
+using SqlSugar;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
+
+namespace NewPdaSqlServer.service.Warehouse;
+
+/// <summary>
+/// 搴撲綅鍙樻洿绠$悊绫伙紝缁ф壙鑷�氱敤浠撳偍绫籖epository锛屾搷浣滈噰璐��璐х敵璇疯〃锛圡esCgthSq锛�
+/// </summary>
+public class KwbgManager : Repository<MesCgthSq>
+{
+ /// <summary>
+ /// 鏍规嵁浼犲叆鐨刉arehouseQuery瀵硅薄锛堝寘鍚潯鐮佷俊鎭級锛屾煡璇㈢墿鏂欏簱瀛樿〃MES_INV_ITEM_STOCKS锛岃幏鍙栧搴旂殑搴撳瓨淇℃伅
+ /// </summary>
+ /// <param name="unity">WarehouseQuery瀵硅薄锛屽寘鍚潯鐮佺紪鍙风瓑鏌ヨ鏉′欢</param>
+ /// <returns>
+ /// 杩斿洖MES_INV_ITEM_STOCKS琛ㄤ腑涓庢潯鐮佸尮閰嶇殑绗竴鏉″簱瀛樹俊鎭紙MesInvItemStocks绫诲瀷锛夈��
+ /// 濡傛灉鏈壘鍒帮紝鍒欐姏鍑哄紓甯告彁绀衡�滆鏉$爜搴撳瓨涓嶅瓨鍦紒鈥�
+ /// resultInfos.tbBillList = m.GetBarInfo(unity);
+ /// </returns>
+ ///public MesInvItemStocks GetBarInfo(WarehouseQuery unity)
+ public dynamic GetBarInfo(dynamic query)
+ {
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
+
+ if (string.IsNullOrEmpty(query.barcode?.ToString()))
+ throw new ArgumentException("鐗╂枡鏉$爜涓嶈兘涓虹┖", nameof(query.barcode));
+
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_barcode", query.barcode),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+
+ try
+ {
+ List<dynamic>? ZsBarInfo = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_kwbg_selKwInfoByBarcode @pi_barcode,@inP1,@inP2,@inP3,@inP4", parameters);
+
+ return ZsBarInfo;
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
+ }
+
+ /// <summary>
+ /// 鏍规嵁鐗╂枡ID鏌ヨ鐗╂枡琛∕ES_ITEMS锛岃幏鍙栫墿鏂欒缁嗕俊鎭�
+ /// </summary>
+ /// <param name="strItemId">鐗╂枡ID锛坉ecimal绫诲瀷锛�</param>
+ /// <returns>
+ /// 杩斿洖MES_ITEMS琛ㄤ腑涓嶪D鍖归厤涓旀湭绂佺敤锛團forbidstatus涓�"A"锛夌殑绗竴鏉$墿鏂欎俊鎭紙MesItems绫诲瀷锛夈��
+ /// 濡傛灉鏈壘鍒帮紝鍒欐姏鍑哄紓甯告彁绀衡�滆鏉$爜瀵瑰簲鐗╂枡淇℃伅涓嶅瓨鍦ㄦ垨宸茬鐢紒鈥�
+ /// resultInfos.tbMesItems = m.GetItemNo(resultInfos.tbBillList.ItemId);
+ /// </returns>
+ public MesItems GetItemNo(decimal strItemId)
+ {
+ // 浣跨敤SqlSugar鐨凲ueryable鏂规硶锛屾煡璇ES_ITEMS琛�
+ // 鏉′欢锛欼d瀛楁绛変簬strItemId锛屼笖Fforbidstatus瀛楁涓�"A"锛堣〃绀烘湭绂佺敤锛�
+ var itemInfo = Db.Queryable<MesItems>()
+ .Where(s => s.Id == strItemId && s.Fforbidstatus == "A")
+ .First(); // 鑾峰彇绗竴鏉″尮閰嶈褰�
+
+ // 濡傛灉鏈煡璇㈠埌缁撴灉锛坕temInfo涓簄ull锛夛紝鍒欐姏鍑哄紓甯革紝鎻愮ず鐗╂枡淇℃伅涓嶅瓨鍦ㄦ垨宸茬鐢�
+ if (itemInfo is null) throw new Exception("璇ユ潯鐮佸搴旂墿鏂欎俊鎭笉瀛樺湪鎴栧凡绂佺敤锛�");
+
+ // 杩斿洖鏌ヨ鍒扮殑鐗╂枡淇℃伅瀵硅薄
+ return itemInfo;
+ }
+ /// <summary>
+ /// 浠撳簱淇℃伅琛�
+ /// </summary>
+ /// <param name="depot_id"></param>
+ /// <returns></returns>
+ public MesDepots GetDepot(decimal depot_id)
+ {
+ var depotInfo = Db.Queryable< MesDepots >()
+ .Where(s => s.DepotId == depot_id)
+ .First(); // 鑾峰彇绗竴鏉″尮閰嶈褰�
+ // 濡傛灉鏈煡璇㈠埌缁撴灉锛坕temInfo涓簄ull锛夛紝鍒欐姏鍑哄紓甯革紝鎻愮ず鐗╂枡淇℃伅涓嶅瓨鍦ㄦ垨宸茬鐢�
+ if (depotInfo is null) throw new Exception("璇ユ潯鐮佸簱瀛樹笉瀛樺湪浠撳簱锛�");
+ return depotInfo;
+ }
+
+
+
+ /// <summary>
+ /// 鍙樻洿搴撲綅
+ /// </summary>
+ /// <param name="unity"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public dynamic ChangeDepotSection(dynamic unity)
+ {
+ // 瀛樺偍杩囩▼杈撳嚭淇℃伅
+ var _strMsg = "";
+ // 瀛樺偍杩囩▼杈撳嚭鐨勬暟閲忥紙鐢ㄤ簬鍒ゆ柇鍙樻洿鏄惁鎴愬姛锛�
+ var _intSum = "";
+ // 瀛樺偍杩囩▼杈撳嚭鐨勬柊搴撲綅浠g爜
+ var _NewDepotSectionCode = ""; // 鏂板簱浣嶄唬鐮�
+
+ // 鍒涘缓SQL杩炴帴锛屼娇鐢ㄩ厤缃殑杩炴帴瀛楃涓�
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ //if (string.IsNullOrEmpty(query.barcode?.ToString()))
+ //throw new ArgumentException("鐗╂枡鏉$爜涓嶈兘涓虹┖", nameof(query.barcode));
+
+ if (string.IsNullOrEmpty(unity.userName?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(unity.userName));
+ if (string.IsNullOrEmpty(unity.OldDepotSectionCode?.ToString()))
+ throw new ArgumentException("鍘熷簱浣嶄笉鍏佽涓虹┖", nameof(unity.OldDepotSectionCode));
+ if (string.IsNullOrEmpty(unity.NewDepotSectionCode?.ToString()))
+ throw new ArgumentException("鏂板簱浣嶄笉鍏佽涓虹┖", nameof(unity.NewDepotSectionCode));
+ if (string.IsNullOrEmpty(unity.barcode?.ToString()))
+ throw new ArgumentException("鐗╂枡鏉$爜涓嶅厑璁镐负绌�", nameof(unity.barcode));
+
+ //if (unity.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
+ //if (unity.OldDepotSectionCode.IsNullOrEmpty()) throw new Exception("鍘熷簱浣嶄笉鍏佽涓虹┖");
+ //if (unity.NewDepotSectionCode.IsNullOrEmpty()) throw new Exception("鏂板簱浣嶄笉鍏佽涓虹┖");
+ //if (unity.barcode.IsNullOrEmpty()) throw new Exception("鐗╂枡鏉$爜涓嶅厑璁镐负绌�");
+
+ // 鍒涘缓SQL鍛戒护锛屾寚瀹氳鎵ц鐨勫瓨鍌ㄨ繃绋�
+ using (var cmd = new SqlCommand("[prc_pda_change_depot]", conn))
+ {
+ try
+ {
+ // 鎵撳紑鏁版嵁搴撹繛鎺�
+ conn.Open();
+ // 璁剧疆鍛戒护绫诲瀷涓哄瓨鍌ㄨ繃绋�
+ cmd.CommandType = CommandType.StoredProcedure;
+
+ // 鏋勯�犲瓨鍌ㄨ繃绋嬪弬鏁版暟缁�
+ SqlParameter[] parameters =
+ {
+ // 杈撳嚭鍙傛暟锛氳繑鍥炰俊鎭�
+ new("@outMsg", SqlDbType.NVarChar, 2000),
+ // 杈撳嚭鍙傛暟锛氳繑鍥炴暟閲�
+ new("@outSum", SqlDbType.Int),
+ // 杈撳嚭鍙傛暟锛氳繑鍥炴柊搴撲綅浠g爜
+ new("@new_depotSectionsCode", SqlDbType.NVarChar, 300),
+ // 杈撳叆鍙傛暟锛氭搷浣滅敤鎴�
+ new SqlParameter("@c_user", unity.userName?.ToString() ?? ""),
+ // 杈撳叆鍙傛暟锛氬師鏉$爜
+ new SqlParameter("@p_barcode", unity.barcode?.ToString() ?? ""),
+ // 杈撳叆鍙傛暟锛氬師搴撲綅浠g爜
+ new("@old_depotSectionsCode", unity.OldDepotSectionCode?.ToString() ??""),
+ // 杈撳叆鍙傛暟锛氭柊搴撲綅浠g爜
+ new("@new_depotSectionsCode_input", unity.NewDepotSectionCode?.ToString() ??""),
+ // 杈撳叆鍙傛暟锛氫粨搴撲唬鐮�
+ new("@DepotCode", unity.DepotCode) { Value = unity.DepotCode ?? "" },
+ // 杈撳叆鍙傛暟锛氫粨搴搃d
+ new SqlParameter("@DepotId", (int?)unity.DepotId ?? (object)DBNull.Value)
+ };
+ // 璁剧疆杈撳嚭鍙傛暟鏂瑰悜
+ parameters[0].Direction = ParameterDirection.Output;
+ parameters[1].Direction = ParameterDirection.Output;
+ parameters[2].Direction = ParameterDirection.Output;
+
+ // 娣诲姞鎵�鏈夊弬鏁板埌鍛戒护瀵硅薄
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+
+ // 鎵ц瀛樺偍杩囩▼
+ cmd.ExecuteNonQuery();
+
+ // 鑾峰彇瀛樺偍杩囩▼杈撳嚭鍙傛暟鐨勫��
+ _strMsg = parameters[0].Value.ToString(); // 杩斿洖淇℃伅
+ _intSum = parameters[1].Value.ToString(); // 杩斿洖鏁伴噺
+ _NewDepotSectionCode = parameters[2].Value.ToString(); // 鏂板簱浣嶄唬鐮�
+
+ // 鍒ゆ柇鍙樻洿缁撴灉锛屽鏋滄暟閲忓皬浜庣瓑浜�0锛屽垯琛ㄧず鍙樻洿澶辫触锛屾姏鍑哄紓甯稿苟杩斿洖閿欒淇℃伅
+ var result = Convert.ToInt32(_intSum);
+ if (result <= 0) throw new Exception(_strMsg);
+
+ // 浣跨敤鍖垮悕瀵硅薄鑰屼笉鏄� dynamic? 鏇村悎閫�
+ var dto = new
+ {
+ barcode = unity.barcode,
+ OldDepotSectionCode = unity.OldDepotSectionCode,
+ NewDepotSectionCode = _NewDepotSectionCode
+ };
+
+ return dto;
+ }
+ catch (Exception ex)
+ {
+ // 鎹曡幏寮傚父骞舵姏鍑猴紝淇濈暀鍘熷寮傚父淇℃伅
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ // 鍏抽棴鏁版嵁搴撹繛鎺�
+ conn.Close();
+ }
+ }
+ }
+ }
+ /*ProductionPickDto銆乄arehouseQuery鏈夎繃娣诲姞
+ public string? OldDepotSectionCode { get; set; } //鏃у簱浣嶇紪鐮�
+ public string? NewDepotSectionCode { get; set; } //鏂板簱浣嶇紪鐮�
+
+ ProductionPickDto鏈夎繃娣诲姞
+ public int? DepotId { get; set; } //浠撳簱id
+ */
+
+
+}
\ No newline at end of file
diff --git a/service/Warehouse/MesBarCFManager.cs b/service/Warehouse/MesBarCFManager.cs
index 2efe965..7a5da90 100644
--- a/service/Warehouse/MesBarCFManager.cs
+++ b/service/Warehouse/MesBarCFManager.cs
@@ -22,6 +22,34 @@
return barInfo; // 杩斿洖绗竴琛屾暟鎹紝濡傛灉娌℃湁鍒欒繑鍥� null
}
+ public dynamic GetBarInfoBefore(WarehouseQuery unity)
+ {
+
+ // 浣跨敤鍙傛暟鍖栨煡璇㈤槻姝QL娉ㄥ叆
+ var sqlParams = new List<SugarParameter> { new("@barcode", unity.barcode) };
+
+ var sql1 = @"SELECT 1 FROM MES_INV_ITEM_STOCKS WHERE ITEM_BARCODE =@barcode ";
+
+ var KcInfo = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams);
+
+ if(KcInfo.Count > 0) throw new Exception("璇ユ潯鐮佸凡鍏ュ簱涓嶈兘杩涜鍏ュ簱鍓嶆媶鍒嗭紒");
+
+
+ //var sql3 = @"SELECT 1 FROM MES_INV_ITEM_CGYT_C_DETAILS WHERE ITEM_BARCODE =@barcode";
+
+ //var YtInfo = Db.Ado.SqlQuery<dynamic>(sql3, sqlParams);
+
+ //if (YtInfo.Count > 0) throw new Exception("璇ユ潯鐮佸凡鎵弿閫�鏂欎笉鑳借繘琛屽叆搴撳墠鎷嗗垎锛�");
+
+ var sql2 = @"SELECT ITEM_ID,QUANTITY FROM MES_INV_ITEM_BARCODES WHERE ITEM_BARCODE =@barcode ";
+
+ var barInfo = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams).FirstOrDefault();
+
+ if (barInfo is null) throw new Exception("璇ユ潯鐮佷俊鎭笉瀛樺湪锛�");
+
+ return barInfo;
+ }
+
public MesItems GetItemNo(decimal strItemId)
{
var itemInfo = Db.Queryable<MesItems>()
@@ -101,28 +129,6 @@
}
}
- //鍏ュ簱鍓嶆媶鍒�
- public dynamic GetBarInfoBefore(WarehouseQuery unity)
- {
-
- // 浣跨敤鍙傛暟鍖栨煡璇㈤槻姝QL娉ㄥ叆
- var sqlParams = new List<SugarParameter> { new("@barcode", unity.barcode) };
-
- var sql1 = @"SELECT 1 FROM MES_INV_ITEM_STOCKS WHERE ITEM_BARCODE =@barcode ";
-
- var KcInfo = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams);
-
- if (KcInfo.Count > 0) throw new Exception("璇ユ潯鐮佸凡鍏ュ簱涓嶈兘杩涜鍏ュ簱鍓嶆媶鍒嗭紒");
-
- var sql2 = @"SELECT ITEM_ID,QUANTITY FROM MES_INV_ITEM_BARCODES WHERE ITEM_BARCODE =@barcode ";
-
- var barInfo = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams).FirstOrDefault();
-
- if (barInfo is null) throw new Exception("璇ユ潯鐮佷俊鎭笉瀛樺湪锛�");
-
- return barInfo;
- }
- //鍏ュ簱鍓嶆媶鍒�
public ProductionPickDto BarCfBefore(WarehouseQuery unity)
{
var _strMsg = "";
@@ -191,5 +197,4 @@
}
}
}
-
}
\ No newline at end of file
diff --git a/service/Warehouse/MesCgthSqManager.cs b/service/Warehouse/MesCgthSqManager.cs
index 782b894..4c92478 100644
--- a/service/Warehouse/MesCgthSqManager.cs
+++ b/service/Warehouse/MesCgthSqManager.cs
@@ -6,6 +6,7 @@
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using SqlSugar;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace NewPdaSqlServer.service.Warehouse;
@@ -14,72 +15,48 @@
public List<MesCgthSq> GetMesCgthSq()
{
return Db.Queryable<MesCgthSq>()
- // .Where(s => s.Status == true)
- .Where(s => s.Status == false)
+ .Where(s => s.Status == true)
.OrderByDescending(s => s.CreateDate)
.ToList();
}
public ProductionPickDto GetSumItem(WarehouseQuery query)
{
- // 楠岃瘉鐢宠鍗曞彿鏄惁涓虹┖
- if (string.IsNullOrEmpty(query.billNo))
- throw new Exception("鐢宠鍗曞彿涓虹┖");
+ if (string.IsNullOrEmpty(query.billNo)) throw new Exception("鐢宠鍗曞彿涓虹┖");
- // 娉ㄩ噴锛氬師鏌ヨ閫昏緫锛堝凡瀹℃牳鐘舵�侊級
- // var mesInvItemOuts = base.GetSingle(it => it.BillNo == query.billNo && it.Status == true);
- // if (mesInvItemOuts == null) throw new Exception("閲囪喘閫�璐х敵璇峰崟涓嶅瓨鍦ㄦ垨鏈鏍�");
+ var mesInvItemOuts = base.GetSingle(it => it.BillNo == query.billNo && it.Status == true);
+ if (mesInvItemOuts == null) throw new Exception("閲囪喘閫�璐х敵璇峰崟涓嶅瓨鍦ㄦ垨鏈鏍�");
- // 鏌ヨ鏈鏍哥姸鎬佺殑閲囪喘閫�璐х敵璇峰崟
- var mesInvItemOuts = base.GetSingle(it => it.BillNo == query.billNo && it.Status == false);
- if (mesInvItemOuts == null)
- throw new Exception("閲囪喘閫�璐х敵璇峰崟涓嶅瓨鍦ㄦ垨宸插鏍�");
+ var sql = string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,A.SQ_NUM FQty,A.YS_NUM SQty,A.SQ_NUM - A.YS_NUM DSQty,
+ dbo.F_QX_GETRECODEPOTSE(A.ITEM_ID,A.depot_id,'','') as RecoKw
+fROM MES_CGTH_SQ_DETAIL A
+ LEFT JOIN MES_CGTH_SQ B ON A.MID = B.ID
+ LEFT JOIN MES_ITEMS C ON A.ITEM_ID = C.item_id
+WHERE B.BILL_NO = '{0}'", query.billNo);
- // 鏋勫缓鏌ヨ鏄庣粏鏁版嵁鐨凷QL璇彞
- var sql = string.Format(@"
- SELECT
- c.item_no ItemNo,
- c.item_name ItemName,
- c.item_model ItemModel,
- ISNULL(A.SQ_NUM, 0) FQty,
- ISNULL(A.YS_NUM, 0) SQty,
- ISNULL(A.SQ_NUM, 0) - ISNULL(A.YS_NUM, 0) DSQty,
- dbo.F_QX_GETRECODEPOTSE(A.ITEM_ID, '', '', '') as RecoKw
- FROM
- MES_CGTH_SQ_DETAIL A
- LEFT JOIN MES_CGTH_SQ B ON A.MID = B.ID
- LEFT JOIN MES_ITEMS C ON A.ITEM_ID = C.item_id
- WHERE
- B.BILL_NO = '{0}'", query.billNo);
-
- // 鎵цSQL鏌ヨ鑾峰彇鏄庣粏鍒楄〃
var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql);
- // 楠岃瘉鏄庣粏鏁版嵁鏄惁瀛樺湪
- if (womdabs.Count < 1)
+ if(womdabs.Count < 1)
{
throw new Exception("璇ラ噰璐��璐х敵璇峰崟鏄庣粏涓嶅瓨鍦�");
}
- // 绛涢�夊緟澶勭悊鏄庣粏锛圖SQty > 0锛�
+
var DS_list = womdabs.Where(s => s.DSQty > 0).ToList();
- // 绛涢�夊凡澶勭悊鏄庣粏锛圫Qty > 0锛�
var YS_list = womdabs.Where(s => s.SQty > 0).ToList();
- // 鏋勫缓骞惰繑鍥濪TO瀵硅薄
var dto = new ProductionPickDto
{
- // 娉ㄩ噴锛氬師璁″垝鍙风浉鍏虫槧灏勶紙褰撳墠鏈娇鐢級
- // daa001 = womdaa.Daa001,
- // PlanNo = womcaa.Caa020,
-
+ //daa001 = womdaa.Daa001,
+ //PlanNo = womcaa.Caa020,
items = DS_list,
Ysitems = YS_list
};
return dto;
}
+
public List<MesCgthSqDetail> GetItems(WarehouseQuery query)
{
// 灏濊瘯灏唓uery.id杞崲涓篏uid绫诲瀷锛屽鏋滆浆鎹㈠け璐ワ紝鍒欐姏鍑哄紓甯�
@@ -127,8 +104,7 @@
using (var conn = new SqlConnection(DbHelperSQL.strConn))
{
if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
- if (query.billNo.IsNullOrEmpty()) throw new Exception("棰嗘枡鍗曞彿涓嶅厑璁镐负绌�");
- if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
+ if (query.billNo.IsNullOrEmpty()) throw new Exception("鐢宠鍗曞彿涓嶅厑璁镐负绌�"); if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
using (var cmd = new SqlCommand("[prc_pda_CGTH]", conn))
{
@@ -164,7 +140,7 @@
var dto = new ProductionPickDto
{
- daa001 = query.daa001,
+ daa001 = query.billNo,
barcodeNum = barcodeNum,
splitNum = splitNum,
barcode = query.barcode,
@@ -189,11 +165,10 @@
public ProductionPickDto ScanCodeCF(WarehouseQuery query)
{
if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
- // if (query.daa001.IsNullOrEmpty()) throw new Exception("棰嗘枡鍗曞彿涓嶅厑璁镐负绌�");
+ if (query.billNo.IsNullOrEmpty()) throw new Exception("鐢宠鍗曞彿涓嶅厑璁镐负绌�");
if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
if (query.Num is null or 0) throw new Exception("鏉$爜鎷嗗垎鏁颁笉鍏佽涓虹┖鎴栬�呬负0");
- if (query.billNo.IsNullOrEmpty()) throw new Exception("鐢宠鍗曞彿涓嶅厑璁镐负绌�");
var _strMsg = "";
var _intSum = "";
@@ -212,7 +187,6 @@
new("@outSum", SqlDbType.NVarChar, 300),
new("@outCfBar", SqlDbType.NVarChar, 300),
new("@c_User", query.userName),
- // new("@p_biLL_no", query.daa001),
new("@p_biLL_no", query.billNo),
new("@p_item_barcode", query.barcode),
new("@num", query.Num)
@@ -233,7 +207,7 @@
var dto = new ProductionPickDto
{
- daa001 = query.daa001,
+ daa001 = query.billNo,
barcode = query.barcode,//鍘熸潯鐮�
cfBarcode = _cfBar//鎷嗗垎鍚庢潯鐮�
};
@@ -251,4 +225,164 @@
}
}
}
+
+
+ /// <summary>
+ /// 閲囪喘鎵爜楠岄��
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ /// <exception cref="ArgumentNullException"></exception>
+ /// <exception cref="ArgumentException"></exception>
+ /// <exception cref="Exception"></exception>
+ public dynamic ScanCgyt(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
+
+ // 2. 浣跨敤 string.IsNullOrEmpty 鐩存帴鍒ゆ柇瀛楃涓插睘鎬э紙閬垮厤 NullReferenceException锛�
+ if (string.IsNullOrEmpty(query.userName?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
+
+ if (string.IsNullOrEmpty(query.barcode?.ToString()))
+ throw new ArgumentException("閲囪喘鐗╂枡鏉$爜涓嶅厑璁镐负绌�", nameof(query.barcode));
+
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("prc_pda_scan_CGYT", conn))
+ {
+ cmd.CommandType = CommandType.StoredProcedure;
+ var parameters = new SqlParameter[]
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
+ new("@pi_barcode", SqlDbType.NVarChar, 100) { Value = query.barcode },
+ new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
+ new("@po_outSum", SqlDbType.Int) { Direction = ParameterDirection.Output },
+ new("@po_ygdh", SqlDbType.NVarChar, 200) { Direction = ParameterDirection.Output }
+ };
+
+ cmd.Parameters.AddRange(parameters);
+ conn.Open();
+ cmd.ExecuteNonQuery();
+
+ var result = new
+ {
+ result = parameters[3].Value.ToString(),
+ barcode = query.barcode,
+ ytdh = parameters[4].Value.ToString(),
+ msg = parameters[2].Value.ToString()
+ };
+
+ if (result.result == "-1")
+ throw new Exception(parameters[2].Value.ToString());
+
+ return result;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鍒犻櫎楠岄��鍗�
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ /// <exception cref="ArgumentNullException"></exception>
+ /// <exception cref="ArgumentException"></exception>
+ /// <exception cref="Exception"></exception>
+ public dynamic deleteCgyt(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
+
+ // 2. 浣跨敤 string.IsNullOrEmpty 鐩存帴鍒ゆ柇瀛楃涓插睘鎬э紙閬垮厤 NullReferenceException锛�
+ if (string.IsNullOrEmpty(query.userName?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
+
+ if (string.IsNullOrEmpty(query.ytdh?.ToString()))
+ throw new ArgumentException("杩芥函鐮佷笉鍏佽涓虹┖", nameof(query.ytdh));
+
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("prc_pda_delete_CGYT", conn))
+ {
+ cmd.CommandType = CommandType.StoredProcedure;
+ var parameters = new SqlParameter[]
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
+ new("@pi_ytdh", SqlDbType.NVarChar, 100) { Value = query.ytdh },
+ new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
+ new("@po_outSum", SqlDbType.Int) { Direction = ParameterDirection.Output }
+ };
+
+ cmd.Parameters.AddRange(parameters);
+ conn.Open();
+ cmd.ExecuteNonQuery();
+
+ var result = new
+ {
+ result = parameters[3].Value.ToString(),
+ msg = parameters[2].Value.ToString(),
+ };
+
+ if (result.result == "-1")
+ throw new Exception(parameters[2].Value.ToString());
+
+ return result;
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇楠岄��鍗曞凡鎵墿鏂欎俊鎭�
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ public dynamic getYtItem(string ytdh)
+ {
+ if (string.IsNullOrEmpty(ytdh?.ToString()))
+ throw new ArgumentException("楠岄��鍗曞彿涓嶅厑璁镐负绌�", nameof(ytdh));
+
+ var sqlParams = new List<SugarParameter> { new("@ytdh", ytdh) };
+
+ var sql1 = @"SELECT C.item_id,C.item_no,C.item_name,C.item_model,A.quantity
+FROM MES_INV_ITEM_CGYT_ITEMS A
+ LEFT JOIN MES_INV_ITEM_CGYT B ON A.item_cgyt_id = B.GUID
+ LEFT JOIN MES_ITEMS C ON A.item_id = C.item_id
+WHERE B.item_cgyt_no = @ytdh";
+
+ var YtItem = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams);
+
+ //if (YtItem.Count < 1)
+ //{
+ // throw new Exception($"璇ラ獙閫�鍗曞彿{ytdh}鐗╂枡鏄庣粏涓嶅瓨鍦紒");
+ //}
+
+ return YtItem;
+ }
+
+ /// <summary>
+ /// 鑾峰彇楠岄��鍗曞凡鎵潯鐮佷俊鎭�
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ public dynamic getYtBarInfo(string ytdh)
+ {
+ if (string.IsNullOrEmpty(ytdh?.ToString()))
+ throw new ArgumentException("楠岄��鍗曞彿涓嶅厑璁镐负绌�", nameof(ytdh));
+
+ var sqlParams = new List<SugarParameter> { new("@ytdh", ytdh) };
+
+ var sql1 = @"SELECT C.item_id,C.item_no,C.item_name,C.item_model,A.quantity,A.ITEM_BARCODE
+FROM MES_INV_ITEM_CGYT_C_DETAILS A
+ LEFT JOIN MES_INV_ITEM_CGYT B ON A.item_cgyt_id = B.GUID
+ LEFT JOIN MES_ITEMS C ON A.item_id = C.item_id
+WHERE B.item_cgyt_no = @ytdh";
+
+ var YtBarInfo = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams);
+
+ //if (YtBarInfo.Count < 1)
+ //{
+ // throw new Exception($"璇ラ獙閫�鍗曞彿{ytdh}浠栦滑涓嶅瓨鍦紒");
+ //}
+
+ return YtBarInfo;
+ }
}
\ No newline at end of file
diff --git a/service/Warehouse/MesCprkManager.cs b/service/Warehouse/MesCprkManager.cs
index 1288be0..f6b7b34 100644
--- a/service/Warehouse/MesCprkManager.cs
+++ b/service/Warehouse/MesCprkManager.cs
@@ -80,6 +80,4 @@
}
}
}
-
-
}
\ No newline at end of file
diff --git a/service/Warehouse/MesInvItemInCDetailsManager.cs b/service/Warehouse/MesInvItemInCDetailsManager.cs
index c09294b..8dfc5d4 100644
--- a/service/Warehouse/MesInvItemInCDetailsManager.cs
+++ b/service/Warehouse/MesInvItemInCDetailsManager.cs
@@ -1,5 +1,4 @@
-锘縰sing Masuit.Tools;
-using Masuit.Tools.Models;
+锘縰sing Masuit.Tools.Models;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
@@ -8,9 +7,6 @@
using NewPdaSqlServer.util;
using Newtonsoft.Json;
using SqlSugar;
-using System.Data;
-using System.Data.SqlClient;
-using System.Security.Cryptography;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace NewPdaSqlServer.service.Warehouse;
@@ -19,986 +15,869 @@
{
//褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉�
-
public ItemInBaseModel SaveBarCodes(WarehouseQuery entity)
{
- ItemInBaseModel res = new ItemInBaseModel();
- string connectionString = DbHelperSQL.strConn;
+ string functionName = "閲囪喘鍏ュ簱", fieldName = null, inFieldVal = null;
+ string user = entity.userName,
+ sectionCode = entity.sectionCode,
+ itemBarcode = entity.barcode;
+ var transactionNo = "101";
+ int? billTypeId = 100, num = 0, num2 = 0;
+ var freeze = 0;
+ decimal cSyQty = 0;
- // 鍙傛暟楠岃瘉
- if (string.IsNullOrEmpty(entity.userName)) throw new ArgumentNullException(nameof(entity.userName), "鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
- if (string.IsNullOrEmpty(entity.sectionCode)) throw new ArgumentNullException(nameof(entity.sectionCode), "搴撲綅缂栧彿涓嶅厑璁镐负绌�");
- if (string.IsNullOrEmpty(entity.barcode)) throw new ArgumentNullException(nameof(entity.barcode), "鏉$爜涓嶅厑璁镐负绌�");
- if (string.IsNullOrEmpty(entity.cgrkType)) throw new ArgumentNullException(nameof(entity.cgrkType), "閲囪喘鍏ュ簱绫诲瀷涓嶅厑璁镐负绌�");
+ if (string.IsNullOrEmpty(sectionCode))
+ throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
- using (var conn = new SqlConnection(connectionString))
+ var itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
+ .Where(it => it.ItemBarcode == itemBarcode)
+ .First();
+
+ if (itemBarcodeDetails == null)
+ throw new Exception("鏉$爜涓嶅瓨鍦紝璇锋牳瀵癸紒");
+
+ if (string.IsNullOrEmpty(itemBarcodeDetails.Memo) || itemBarcodeDetails.Memo != "閲囪喘鍏ュ簱")
+ throw new Exception("姝ゆ潯鐮佷笉灞炰簬鍒拌揣鏉$爜锛屾棤娉曠敤閲囪喘鍏ュ簱锛�");
+
+ var inventory = Db.Queryable<MesInvItemArn>()
+ .Where(it => it.BillNo == itemBarcodeDetails.BillNo && it.Fstatus == true )
+ .First();
+
+ if (inventory == null)
+ throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟垨鏈鏍革紒");
+
+ // var inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
+ // .Where(it => it.ParentGuid == inventory.Guid
+ // && it.ItemId == itemBarcodeDetails.ItemId
+ // && it.EbelnLine == itemBarcodeDetails.WorkLine
+ // && it.Ebeln == itemBarcodeDetails.WorkNo)
+ // .First();
+
+ var inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
+ .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
+ .First();
+
+ var cgddDetails = Db.Queryable<MesRohInData>()
+ .Where(it => it.EbelnK3id == inventoryDetails.LineK3id)
+ .First();
+
+ if (cgddDetails == null)
+ throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲閲囪喘璁㈠崟鏄庣粏锛�");
+
+ if (inventoryDetails == null)
+ throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟槑缁嗭紒");
+
+ //鑾峰彇鍒拌揣妫�楠屾槑缁�
+ var sqlParams = new List<SugarParameter> { new("@dhmxGuid", itemBarcodeDetails.AboutGuid) };
+ var sql1 = @"SELECT *FROM v_dhmx WHERE dhmxGuid = @dhmxGuid ";
+ var dhjymx = Db.Ado.SqlQuery<vDhmx>(sql1, sqlParams).First();
+ //鍒ゅ畾妫�楠岃兘鍚﹀叆搴�
+ if (dhjymx.CanStore!= 1)
{
- using (var cmd = new SqlCommand("[prc_pda_inv_cgrk]", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
-
- // 璁剧疆瀛樺偍杩囩▼鍙傛暟
- SqlParameter[] parameters =
- {
- new SqlParameter("@pi_user", SqlDbType.NVarChar, 100) { Value = entity.userName },
- new SqlParameter("@pi_barcode", SqlDbType.NVarChar, 100) { Value = entity.barcode.Trim().ToLower() },
- new SqlParameter("@pi_sectionCode", SqlDbType.NVarChar, 30) { Value = entity.sectionCode },
- new SqlParameter("@pi_cgrkType", SqlDbType.NVarChar, 30) { Value = entity.cgrkType },
- new SqlParameter("@po_outMsg", SqlDbType.NVarChar, 300) { Direction = ParameterDirection.Output },
- new SqlParameter("@po_outSum", SqlDbType.NVarChar, 300) { Direction = ParameterDirection.Output }
- };
-
- cmd.Parameters.AddRange(parameters);
- cmd.ExecuteNonQuery();
-
- // 鑾峰彇杈撳嚭鍙傛暟
- string? outMessage = parameters[4].Value?.ToString();
- string? outSum = parameters[5].Value?.ToString();
-
- if (string.IsNullOrEmpty(outMessage) || string.IsNullOrEmpty(outSum))
- throw new InvalidOperationException("瀛樺偍杩囩▼杩斿洖鍙傛暟寮傚父");
-
- // 楠岃瘉缁撴灉
- if (!int.TryParse(outSum, out int result) || result <= 0)
- throw new InvalidOperationException(outMessage);
-
- // 璋冭瘯杈撳嚭
- Console.WriteLine($"鏌ヨ鐨勬潯鐮佸��: '{entity.barcode}' (闀垮害: {entity.barcode.Length})");
-
- // 浣跨敤鍙傛暟鍖栨煡璇㈠苟蹇界暐澶у皬鍐欙紙閫傜敤浜庢敮鎸佺殑鏁版嵁搴擄級
- var itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
- .Where(it => it.ItemBarcode.Trim().ToLower() == entity.barcode.Trim().ToLower())
- .First() ?? throw new InvalidOperationException($"鏈壘鍒版潯鐮� '{entity.barcode}' 鐨勫尮閰嶄俊鎭�");
-
- // 璋冭瘯杈撳嚭锛堟鏌ュ�煎拰闀垮害锛�
- Console.WriteLine($"鏌ヨ鐨勬潯鐮佸��: '{entity.barcode}' (闀垮害: {entity.barcode.Length})");
-
- // 浼樺寲鏌ヨ锛堝幓闄ょ┖鏍煎苟蹇界暐澶у皬鍐欙級
- var MesInvItemInCDetails = Db.Queryable<MesInvItemInCDetails>()
- .Where(it => it.ItemBarcode.Trim().ToLower() == entity.barcode.Trim().ToLower())
- .First() ?? throw new InvalidOperationException($"鏈壘鍒版潯鐮� '{entity.barcode}' 鐨勫尮閰嶇殑鍏ュ簱淇℃伅");
-
- // 浠庡叆搴撴潯鐮佷腑鑾峰彇鏈夋晥鐨処temInId
- var cId = MesInvItemInCDetails.ItemInId; // 鍋囪瀛樺湪ItemInId灞炴��
-
- // 鏌ヨ鐗╂枡姹囨�绘槑缁�
- var sql = string.Format(@"
- SELECT
- b.Item_No AS ItemNo,
- b.Item_Name AS ItemName,
- b.Item_Model AS ItemModel,
- a.Quantity AS FQty,
- b.Item_Id AS FMaterialId,
- CONVERT(VARCHAR(36), b.Guid) AS Id
- FROM MES_INV_ITEM_IN_C_ITEMS a
- LEFT JOIN Mes_Items b ON a.Item_Id = b.Item_Id
- WHERE a.Item_In_Id = '{0}' AND a.Item_Id = '{1}'", cId, itemBarcodeDetails.ItemId);
-
- res.ItemInDetails = Db.Ado.SqlQuery<dynamic>(sql);
-
- // 鏌ヨ鍏ュ簱鏉$爜鏄庣粏
- var sql2 = string.Format(@"
- SELECT
- b.Item_No AS ItemNo,
- b.Item_Name AS ItemName,
- b.Item_Model AS ItemModel,
- a.Quantity AS FQty,
- b.Item_Id AS FMaterialId,
- CONVERT(VARCHAR(36), a.Guid) AS Id,
- a.Depot_Section_Code AS kw,
- a.Item_Barcode AS barcode
- FROM Mes_Inv_Item_In_C_Details a
- LEFT JOIN Mes_Items b ON a.Item_Id = b.Item_Id
- WHERE a.Item_In_Id = '{0}' AND a.Item_Id = '{1}'",cId, itemBarcodeDetails.ItemId);
-
- res.ItemBarCDetails = Db.Ado.SqlQuery<dynamic>(sql2);
-
- // 璁剧疆杩斿洖淇℃伅
- res.Message = outMessage;
- res.SumQuantity = result;
-
- return res;
- }
- catch (Exception ex)
- {
-
-
- // 璁板綍寮傚父鏃ュ織锛堝缓璁坊鍔犳棩蹇楄褰曪級
- res.Message = $"鎿嶄綔澶辫触: {ex.Message}";
- res.SumQuantity = -1;
- return res;
- }
- }
+ throw new Exception($"璇ユ潯鐮佸搴旂殑鏀舵枡鍗曟楠岀粨鏋�:銆恵dhjymx.InspectionResult}銆�,鍒ゅ畾缁撴灉锛氥�恵dhjymx.JudgmentResult}銆戯紝澶勭悊鎰忚锛氥�恵dhjymx.HandlingSuggestion}銆�,鏃犳硶鍏ュ簱");
}
+
+ var depotCode = Db.Queryable<MesDepotSections>()
+ .Where(it => it.DepotSectionCode == sectionCode)
+ .Select(it => it.DepotGuid)
+ .First();
+
+ var depotCode2 = Db.Queryable<MesInvItemArn>()
+ .Where(it => it.BillNo == itemBarcodeDetails.BillNo)
+ .Select(it => it.DepotsId)
+ .First();
+
+ MesDepots mesDepost = null;
+
+ var checkGuid = UtilityHelper.CheckGuid(depotCode);
+ if (checkGuid && depotCode != null)
+ {
+ mesDepost = Db.Queryable<MesDepots>()
+ .Where(s => s.DepotId.ToString() == depotCode).First();
+
+ // if (depotCode != mesDepost.Guid)
+ // throw new Exception("鎵弿搴撲綅涓庨噰璐叆搴撳簱浣嶄笉涓�鑷达紒");
+ }
+ else
+ {
+ throw new Exception("搴撲綅缂栫爜 " + sectionCode + " 涓嶅瓨鍦紝璇风‘璁わ紒");
+ }
+
+
+ //num = Db.Queryable<MesInvItemInCDetails>()
+ // .Where(it => it.ItemBarcode == itemBarcode)
+ // .Count();
+
+ //if (num > 0)
+ // throw new Exception("姝ゆ潯鐮佸凡鎵爜鍏ュ簱瀹屾垚锛岃鏍稿锛�");
+
+ //num = Db.Queryable<MesInvItemStocks>()
+ // .Where(it => it.ItemBarcode == itemBarcode)
+ // .Count();
+
+ //if (num > 0)
+ // throw new Exception("姝ゆ潯鐮佸凡鎵爜鍏ュ簱锛岃鏍稿锛�");
+
+ var wmsManager = new WmsBaseMangeer();
+ // 鏂板鍏ュ簱鏍¢獙锛堣皟鐢ㄥ瓨鍌ㄨ繃绋嬶級
+ var checkResult = wmsManager.pdaInvJY(
+ db: Db,
+ edtUserNo: entity.userName,
+ barcode: entity.barcode,
+ sectionCode: sectionCode,
+ stockId: mesDepost.DepotId.ToString(),
+ stockOrgId: mesDepost.FSubsidiary,
+ billNo: "", // 鏍规嵁瀹為檯鍗曟嵁鍙蜂紶鍊�
+ transactionNo: "101" // 浜嬪姟绫诲瀷涓庡瓨鍌ㄨ繃绋嬪尮閰�
+ );
+
+ if (Convert.ToInt32(checkResult.result) < 1)
+ throw new Exception($"鍏ュ簱鏍¢獙澶辫触锛歿checkResult.strMsg}");
+
+
+
+ //num = Db.Queryable<MesInvItemArn>()
+ // .Where(a => a.BillNo == itemBarcodeDetails.BillNo)
+ // .InnerJoin<MesInvItemArnDetail>((a, b) =>
+ // b.ParentGuid == a.Guid &&
+ // b.ItemId == itemBarcodeDetails.ItemId && b.Ischeck == 1)
+ // .Count();
+
+ //num2 = Db.Queryable<MesInvItemArn>()
+ // .Where(a => a.BillNo == itemBarcodeDetails.BillNo)
+ // .InnerJoin<MesInvItemArnDetail>((a, b) => b.ParentGuid == a.Guid
+ // && b.ItemId == itemBarcodeDetails.ItemId
+ // && (b.CheckRes == "鍚堟牸" || b.CheckStates == "鐗归噰鐩存帴浣跨敤"))
+ // .Count();
+
+ //switch (num)
+ //{
+ // case 0 when num2 == 0:
+ // case > 0 when num2 == 0:
+ // freeze = 1;
+ // break;
+ // case 0 when num2 > 0:
+ // throw new Exception("鍏ュ簱澶辫触,鍒拌揣鍗曟嵁鏈夐棶棰橈紒");
+ //}
+
+
+ // 鍒ゆ柇璐т富绫诲瀷
+ var owner_type = wmsManager.GetOwnerType(cgddDetails.DemandOrg);
+ // if (Db.Queryable<SysOrganization>().Any(x => x.Fid == cgddDetails.DemandOrg))
+ // {
+ // owner_type = "BD_OwnerOrg";
+ // }
+ // else
+ // {
+ // // 绗簩灞傚垽鏂細妫�鏌� MES_CUSTOMER
+ // if (Db.Queryable<MesCustomer>().Any(x => x.Id == Convert.ToInt32(cgddDetails.DemandOrg)))
+ // {
+ // owner_type = "BD_Customer";
+ // }
+ // else
+ // {
+ // // 绗笁灞傚垽鏂細妫�鏌� MES_SUPPLIER
+ // if (Db.Queryable<MesSupplier>().Any(x => x.Id == Convert.ToInt32(cgddDetails.DemandOrg)))
+ // {
+ // owner_type = "BD_Supplier";
+ // }
+ // else
+ // {
+
+ // // 绗洓灞傚垽鏂細鍐嶆妫�鏌� SYS_ORGANIZATION
+ // if (Db.Queryable<SysOrganization>().Any(x => x.Fid == cgddDetails.ReceivingOrg))
+ // {
+ // owner_type = "BD_OwnerOrg";
+ // }
+ // else
+ // {
+ // throw new Exception("鍏ュ簱澶辫触,鍒拌揣鍗曟嵁瀵瑰簲鐨勯渶姹傜粍缁囨湁闂锛�");
+ // }
+ // }
+ // }
+ //}
+
+ var result = new ItemInBaseModel();
+
+ UseTransaction(db =>
+ {
+ var existingRecord = db.Queryable<MesInvItemIns>()
+ .Where(it => it.InsDate.Value.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")
+ && it.TaskNo == itemBarcodeDetails.BillNo
+ && it.Status == 0
+ && it.TransctionNo == transactionNo
+ && it.CreateBy == entity.userName
+ && it.BillTypeId == billTypeId
+ && it.DepotsId == mesDepost.DepotId)
+ .Select(it => new
+ {
+ it.Guid,
+ it.BillNo
+ })
+ .First();
+
+ var cId = Guid.Empty;
+ string cBillNo = null;
+
+ if (existingRecord != null)
+ {
+ // If record exists, assign values
+ cId = existingRecord.Guid;
+ cBillNo = existingRecord.BillNo;
+ }
+ else
+ {
+ cId = Guid.NewGuid();
+ cBillNo = BillNo.GetBillNo("CGRK(閲囪喘鍏ュ簱)");
+
+ var suppNo = db.Queryable<MesSupplier>()
+ .Where(s => s.Id.ToString() == inventory.SuppId).First();
+
+ db.Insertable(new MesInvItemIns
+ {
+ Guid = cId,
+ BillNo = cBillNo,
+ BillTypeId = billTypeId,
+ InsDate = DateTime.Now,
+ DepotsId = mesDepost.DepotId,
+ DepotsCode = mesDepost.DepotCode,
+ TransctionNo = transactionNo,
+ SuppId = suppNo.Id.ToString(),
+ SuppNo = suppNo.SuppNo,
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ LastupdateBy = user,
+ LastupdateDate = DateTime.Now,
+ UrgentFlag = itemBarcodeDetails.UrgentFlag.GetValueOrDefault() ? "1" : "0",
+ CbillNo = itemBarcodeDetails.BillNo,
+ Fstatus = 0,
+ Status = 0,
+ ReceiveOrgId = inventory.ReceiveOrgId,
+ InType = "閲囪喘鍏ュ簱",
+ TaskNo = itemBarcodeDetails.BillNo
+ //WorkNo = itemBarcodeDetails.WorkNo
+ }).IgnoreColumns(true).ExecuteCommand();
+ }
+
+ cSyQty = itemBarcodeDetails.Quantity.Value;
+
+ entity.id = cId.ToString();
+ entity.PageIndex = 1;
+ entity.Limit = 1;
+
+ itemBarcodeDetails.Hbdy ??= 0;
+ if (itemBarcodeDetails.Hbdy == 1)
+ {
+ var details = db.Queryable<MesInvItemArnDetail>()
+ .Where(d =>
+ d.CbillNo == itemBarcodeDetails.BillNo &&
+ d.Quantity != d.OkRkqty &&
+ d.ItemId == itemBarcodeDetails.ItemId)
+ .ToList();
+
+
+ foreach (var detail in details)
+ {
+ if (cSyQty == 0) break;
+
+ var remainingQty = detail.Quantity - (detail.OkRkqty ?? 0);
+ if (remainingQty <= cSyQty)
+ {
+ // Update detail
+ db.Updateable<MesInvItemArnDetail>()
+ .SetColumns(d => new MesInvItemArnDetail
+ {
+ OkRkqty = (int)d.Quantity,
+ IsdepsIn = true
+ })
+ .Where(d => d.Guid == detail.Guid)
+ .IgnoreColumns(true)
+ .ExecuteCommand();
+
+ // Check if already inserted
+ var count = db.Queryable<MesInvItemInCItems>()
+ .Where(it =>
+ it.ItemInId == cId &&
+ it.ItemId == detail.ItemId &&
+ it.DepotId == mesDepost.DepotId.ToString() &&
+ it.EbelnK3id == detail.EbelnK3id &&
+ it.LineK3id == detail.LineK3id)
+ .Count();
+
+ cSyQty -= remainingQty.Value;
+
+ if (count == 0)
+ // Insert new item into MES_INV_ITEM_IN_C_ITEMS
+ db.Insertable(new MesInvItemInCItems
+ {
+ ItemInId = cId,
+ Quantity = remainingQty,
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ ItemId = detail.ItemId,
+ DepotCode = mesDepost.DepotCode,
+ ItemSname = itemBarcodeDetails.ItemSname,
+ Unit = itemBarcodeDetails.Unit,
+ Ebeln = detail.Ebeln,
+ BillNo = cBillNo,
+ WorkNo = detail.WorkNo,
+ CbillNo = detail.CbillNo,
+ WorkLine = detail.WorkLine,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ Remark = itemBarcodeDetails.Memo,
+ EbelnK3id = detail.EbelnK3id,
+ LineK3id = detail.LineK3id,
+ DepotId = mesDepost.DepotId.ToString(),
+ itemDabid = itemBarcodeDetails.AboutGuid.ToString()
+ }).IgnoreColumns(true).ExecuteCommand();
+ else
+ db.Updateable<MesInvItemInCItems>()
+ .SetColumns(it =>
+ it.Quantity == it.Quantity + remainingQty)
+ .Where(it =>
+ it.ItemInId == cId &&
+ it.ItemId == detail.ItemId &&
+ it.DepotId == mesDepost.DepotId.ToString() &&
+ it.EbelnK3id == detail.EbelnK3id &&
+ it.LineK3id == detail.LineK3id)
+ .IgnoreColumns(true)
+ .ExecuteCommand();
+
+ // Insert new detail into MES_INV_ITEM_IN_C_DETAILS
+ db.Insertable(new MesInvItemInCDetails
+ {
+ ItemInId = cId,
+ BillNo = cBillNo,
+ ItemBarcode = itemBarcode,
+ Quantity = remainingQty,
+ BarcodeFlag = true,
+ EpFlag = true,
+ WorkType = 1,
+ ItemNo = detail.ItemNo,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ DepotCode = mesDepost.DepotCode,
+ DepotSectionCode = sectionCode,
+ ItemSname = itemBarcodeDetails.ItemSname,
+ Unit = itemBarcodeDetails.Unit,
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ LastupdateBy = user,
+ LastupdateDate = DateTime.Now,
+ Remark = itemBarcodeDetails.Memo,
+ Ebeln = detail.WorkNo,
+ WorkNo = detail.WorkNo,
+ WorkLine = detail.WorkLine,
+ CbillNo = itemBarcodeDetails.BillNo,
+ UrgentFlag = detail.UrgentFlag,
+ BoardStyle = detail.BoardStyle,
+ TaskNo = detail.WorkNo,
+ EbelnK3id = detail.EbelnK3id,
+ LineK3id = detail.LineK3id,
+ ItemId = detail.ItemId,
+ ReceiveOrgId = inventory.ReceiveOrgId,
+ LotNo = cgddDetails.BatchNumber
+ }).IgnoreColumns(true).ExecuteCommand();
+ }
+ else
+ {
+ // Partially fulfill remaining quantity
+ db.Updateable<MesInvItemArnDetail>()
+ .SetColumns(d => new MesInvItemArnDetail
+ {
+ OkRkqty = (int)((d.OkRkqty ?? 0) + cSyQty)
+ })
+ .Where(d => d.Guid == detail.Guid)
+ .IgnoreColumns(true)
+ .ExecuteCommand();
+
+ var count = db.Queryable<MesInvItemInCItems>()
+ .Where(it =>
+ it.ItemInId == cId &&
+ it.ItemId == detail.ItemId &&
+ it.DepotId == mesDepost.DepotId.ToString() &&
+ it.EbelnK3id == detail.EbelnK3id &&
+ it.LineK3id == detail.LineK3id)
+ .Count();
+
+ if (count == 0)
+ db.Insertable(new MesInvItemInCItems
+ {
+ ItemInId = cId,
+ Quantity = cSyQty,
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ ItemNo = detail.ItemNo,
+ DepotCode = mesDepost.DepotCode,
+ ItemSname = itemBarcodeDetails.ItemSname,
+ Unit = itemBarcodeDetails.Unit,
+ Ebeln = detail.WorkNo,
+ BillNo = cBillNo,
+ WorkNo = detail.WorkNo,
+ EbelnLineNo = detail.EbelnLine,
+ CbillNo = detail.CbillNo,
+ WorkLine = detail.WorkLine,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ Remark = itemBarcodeDetails.Memo,
+ EbelnK3id = detail.EbelnK3id,
+ LineK3id = detail.LineK3id,
+ ItemId = detail.ItemId,
+ DepotId = mesDepost.DepotId.ToString()
+ }).IgnoreColumns(true).ExecuteCommand();
+ else
+ db.Updateable<MesInvItemInCItems>()
+ .SetColumns(it =>
+ it.Quantity == it.Quantity + cSyQty)
+ .Where(it =>
+ it.ItemInId == cId &&
+ it.ItemId == detail.ItemId &&
+ it.DepotId == mesDepost.DepotId.ToString() &&
+ it.EbelnK3id == detail.EbelnK3id &&
+ it.LineK3id == detail.LineK3id)
+ .IgnoreColumns(true)
+ .ExecuteCommand();
+
+ db.Insertable(new MesInvItemInCDetails
+ {
+ ItemInId = cId,
+ BillNo = cBillNo,
+ ItemBarcode = itemBarcode,
+ Quantity = cSyQty,
+ BarcodeFlag = true,
+ EpFlag = true,
+ WorkType = 1,
+ ItemNo = detail.ItemNo,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ DepotCode = mesDepost.DepotCode,
+ DepotSectionCode = sectionCode,
+ ItemSname = itemBarcodeDetails.ItemSname,
+ Unit = itemBarcodeDetails.Unit,
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ LastupdateBy = user,
+ LastupdateDate = DateTime.Now,
+ Remark = itemBarcodeDetails.Memo,
+ Ebeln = detail.WorkNo,
+ EbelnLineNo = detail.EbelnLine,
+ WorkNo = detail.WorkNo,
+ WorkLine = detail.WorkLine,
+ CbillNo = itemBarcodeDetails.BillNo,
+ UrgentFlag = detail.UrgentFlag,
+ BoardStyle = detail.BoardStyle,
+ TaskNo = detail.WorkNo,
+ EbelnK3id = detail.EbelnK3id,
+ LineK3id = detail.LineK3id,
+ ItemId = detail.ItemId,
+ ReceiveOrgId = inventory.ReceiveOrgId,
+ LotNo = cgddDetails.BatchNumber
+ }).IgnoreColumns(true).ExecuteCommand();
+
+ cSyQty = 0; // Remaining quantity fulfilled
+ }
+ }
+
+ db.Insertable(new MesInvBusiness2
+ {
+ Status = 1,
+ BillTypeId = billTypeId,
+ TransactionCode = transactionNo,
+ BusinessType = 1,
+ ItemBarcode = itemBarcode,
+ ItemNo = itemBarcodeDetails.ItemNo,
+ LotNo = cgddDetails.BatchNumber,
+ EpFlag = true,
+ Quantity = itemBarcodeDetails.Quantity,
+ ToInvDepotsCode = mesDepost.DepotCode,
+ ToInvDepotSectionsCode = sectionCode,
+ Description = "閲囪喘鍏ュ簱",
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ LastupdateBy = user,
+ LastupdateDate = DateTime.Now,
+ TaskNo = itemBarcodeDetails.BillNo,
+ BillNo = cBillNo,
+ WorkNo = itemBarcodeDetails.WorkNo,
+ WorkLine = itemBarcodeDetails.WorkLine,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ EbelnK3id = itemBarcodeDetails.EbelnK3id,
+ LineK3id = itemBarcodeDetails.LineK3id,
+ ItemId = itemBarcodeDetails.ItemId
+ }).IgnoreColumns(true).ExecuteCommand();
+
+ // Insert into mes_inv_item_stocks
+ }
+ else
+ {
+ var detailone = db.Queryable<MesInvItemArnDetail>()
+ .Where(d =>
+ d.Guid == itemBarcodeDetails.AboutGuid)
+ .First();
+
+ // 妫�鏌ユ槸鍚﹀瓨鍦ㄤ簬 MES_INV_ITEM_IN_C_ITEMS 琛�
+ var existingCount = db.Queryable<MesInvItemInCItems>()
+ .Where(it =>
+ it.ItemInId == cId &&
+ it.ItemId == detailone.ItemId &&
+ it.DepotId == mesDepost.DepotId.ToString() &&
+ it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
+ .Count();
+
+ if (existingCount == 0)
+ // 涓嶅瓨鍦ㄦ椂鎻掑叆鏂拌褰�
+ db.Insertable(new MesInvItemInCItems
+ {
+ ItemInId = cId,
+ Quantity = itemBarcodeDetails.Quantity,
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ ItemNo = itemBarcodeDetails.ItemNo,
+ DepotCode = mesDepost.DepotCode,
+ ItemSname = itemBarcodeDetails.ItemSname,
+ Unit = itemBarcodeDetails.Unit,
+ Ebeln = itemBarcodeDetails.WorkNo,
+ BillNo = cBillNo,
+ WorkNo = itemBarcodeDetails.WorkNo,
+ EbelnLineNo = itemBarcodeDetails.WorkLine,
+ CbillNo = itemBarcodeDetails.BillNo,
+ WorkLine = itemBarcodeDetails.WorkLine,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ Remark = itemBarcodeDetails.Memo,
+ EbelnK3id = itemBarcodeDetails.EbelnK3id,
+ LineK3id = itemBarcodeDetails.LineK3id,
+ ItemId = itemBarcodeDetails.ItemId,
+ DepotId = mesDepost.DepotId.ToString(),
+ itemDabid = itemBarcodeDetails.AboutGuid.ToString()
+ }).IgnoreColumns(true).ExecuteCommand();
+ else
+ // 瀛樺湪鏃舵洿鏂版暟閲�
+ db.Updateable<MesInvItemInCItems>()
+ .SetColumns(it => new MesInvItemInCItems
+ {
+ Quantity = SqlFunc.IsNull(it.Quantity, 0) + itemBarcodeDetails.Quantity // 纭繚 Quantity 涓嶄负 null
+ })
+ .Where(it =>
+ it.ItemInId == cId &&
+ it.ItemId == detailone.ItemId &&
+ it.DepotId == mesDepost.DepotId.ToString() &&
+ it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
+ //.IgnoreColumns(true) // 淇濈暀 IgnoreColumns
+ .ExecuteCommand();
+
+ // 鎻掑叆 mes_inv_item_in_c_details 琛�
+ db.Insertable(new MesInvItemInCDetails
+ {
+ ItemInId = cId,
+ BillNo = cBillNo,
+ ItemBarcode = itemBarcode,
+ Quantity = itemBarcodeDetails.Quantity,
+ BarcodeFlag = true,
+ EpFlag = true,
+ WorkType = 1,
+ ItemNo = itemBarcodeDetails.ItemNo,
+ LotNo = cgddDetails.BatchNumber,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ DepotCode = mesDepost.DepotCode,
+ DepotSectionCode = sectionCode,
+ ItemSname = itemBarcodeDetails.ItemSname,
+ Unit = itemBarcodeDetails.Unit,
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ LastupdateBy = user,
+ LastupdateDate = DateTime.Now,
+ Remark = itemBarcodeDetails.Memo,
+ Ebeln = itemBarcodeDetails.Mblnr,
+ EbelnLineNo = itemBarcodeDetails.Zeile,
+ WorkNo = itemBarcodeDetails.WorkNo,
+ WorkLine = itemBarcodeDetails.WorkLine,
+ CbillNo = itemBarcodeDetails.BillNo,
+ UrgentFlag = itemBarcodeDetails.UrgentFlag,
+ BoardStyle = itemBarcodeDetails.BoardStyle,
+ TaskNo = itemBarcodeDetails.TaskNo,
+ EbelnK3id = itemBarcodeDetails.EbelnK3id,
+ LineK3id = itemBarcodeDetails.LineK3id,
+ ItemId = itemBarcodeDetails.ItemId,
+ Ischeck = true,
+ CheckDate = inventoryDetails.CheckDate,
+ CheckRes = inventoryDetails.CheckRes,
+ CheckStates = inventoryDetails.CheckStates,
+ ReceiveOrgId = inventory.ReceiveOrgId,
+ DepotId = Convert.ToInt64(mesDepost.DepotId.ToString())
+ }).IgnoreColumns(true).ExecuteCommand();
+
+ // 鎻掑叆 mes_inv_business2 琛�
+ db.Insertable(new MesInvBusiness2
+ {
+ Status = 1,
+ BillTypeId = billTypeId,
+ TransactionCode = transactionNo,
+ BusinessType = 1,
+ ItemBarcode = itemBarcode,
+ ItemNo = itemBarcodeDetails.ItemNo,
+ LotNo = itemBarcodeDetails.LotNo,
+ EpFlag = true,
+ Quantity = itemBarcodeDetails.Quantity,
+ FromInvDepotsCode = null,
+ FromInvDepotSectionsCode = null,
+ ToInvDepotsCode = mesDepost.DepotCode,
+ ToInvDepotSectionsCode = sectionCode,
+ Description = "閲囪喘鍏ュ簱",
+ CreateBy = user,
+ CreateDate = DateTime.Now,
+ LastupdateBy = user,
+ LastupdateDate = DateTime.Now,
+ TaskNo = itemBarcodeDetails.TaskNo,
+ BillNo = cBillNo,
+ WorkNo = itemBarcodeDetails.WorkNo,
+ WorkLine = itemBarcodeDetails.WorkLine,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ EbelnK3id = itemBarcodeDetails.EbelnK3id,
+ LineK3id = itemBarcodeDetails.LineK3id,
+ ItemId = itemBarcodeDetails.ItemId
+ }).IgnoreColumns(true).ExecuteCommand();
+
+ // 鎻掑叆 mes_inv_item_stocks 琛�
+ }
+
+
+
+ db.Insertable(new MesInvItemStocks
+ {
+ TaskNo = itemBarcodeDetails.TaskNo,
+ ItemBarcode = itemBarcode,
+ ItemNo = cgddDetails.BatchNumber,
+ LotNo = itemBarcodeDetails.LotNo,
+ Quantity = itemBarcodeDetails.Quantity,
+ DepotsCode = mesDepost.DepotCode,
+ DepotSectionsCode = sectionCode,
+ CheckDate = inventoryDetails.CheckDate,
+ IndepDate = DateTime.Now,
+ IqcStatus = inventoryDetails.CheckStates,
+ BoardStyle = itemBarcodeDetails.BoardStyle,
+ WorkNo = itemBarcodeDetails.WorkNo,
+ WorkLine = itemBarcodeDetails.WorkLine,
+ SuppId = itemBarcodeDetails.SuppId,
+ SuppNo = itemBarcodeDetails.SuppNo,
+ EbelnK3id = itemBarcodeDetails.EbelnK3id,
+ LineK3id = itemBarcodeDetails.LineK3id,
+ ItemId = itemBarcodeDetails.ItemId,
+ BillNo = itemBarcodeDetails.BillNo,
+ DepotId = Convert.ToInt32(mesDepost.DepotId),
+ OwnerId = cgddDetails.DemandOrg,
+ OwnerType = owner_type,
+ StockOrgId = mesDepost.FSubsidiary,
+ IndepUserCode = user
+ }).IgnoreColumns(true).ExecuteCommand();
+
+ itemBarcodeDetails.Hbdy ??= 0;
+
+ if (itemBarcodeDetails.Hbdy != 1)
+ {
+ //鏇存柊鏀舵枡鍗曟槑缁�
+ db.Updateable<MesInvItemArnDetail>()
+ .SetColumns(d => new MesInvItemArnDetail
+ {
+ OkRkqty = (int)((d.OkRkqty ?? 0) + cSyQty)
+ })
+ .Where(d => d.Guid == itemBarcodeDetails.AboutGuid)
+ .ExecuteCommand();
+
+ var first = db
+ .Queryable<MesInvItemArnDetail>()
+ .Where(b =>
+ b.Guid == itemBarcodeDetails.AboutGuid)
+ .Select(b => new
+ {
+ TotalQuantity =
+ SqlFunc.AggregateSum(b.Quantity),
+ TotalOkRkQty = SqlFunc.AggregateSum(b.OkRkqty)
+ })
+ .First();
+
+ var TotalQuantity = first.TotalQuantity ?? 0;
+ var TotalOkRkQty = first.TotalOkRkQty ?? 0;
+
+ if (TotalQuantity == TotalOkRkQty)
+ db.Updateable<MesInvItemArnDetail>()
+ .SetColumns(s => s.IsdepsIn == true)
+ .Where(s => s.Guid == itemBarcodeDetails.AboutGuid)
+ .ExecuteCommand();
+
+
+ var totalSummary = db.Queryable<MesInvItemArnDetail>()
+ .InnerJoin<MesInvItemArn>((b, a) => a.Guid == b.ParentGuid)
+ .Where((b, a) =>
+ a.BillNo == inventory.BillNo && b.ReturnFlag == 0)
+ .Select((b, a) => new
+ {
+ TotalQuantity = SqlFunc.AggregateSum(b.Quantity),
+ TotalOkRkQty = SqlFunc.AggregateSum(b.OkRkqty)
+ })
+ .First();
+
+ if ((totalSummary.TotalQuantity ?? 0) ==
+ (totalSummary.TotalOkRkQty ?? 0))
+ db.Updateable<MesInvItemArn>()
+ .SetColumns(it => it.Status == 1)
+ .Where(it => it.BillNo == itemBarcodeDetails.BillNo)
+ .ExecuteCommand();
+
+ var totalCDetailsQuantity = db.Queryable<MesInvItemInCDetails>()
+ .Where(it => it.ItemId == itemBarcodeDetails.ItemId &&
+ it.WorkNo == itemBarcodeDetails.WorkNo &&
+ it.ItemInId == cId)
+ .Sum(it => it.Quantity);
+
+ var detailSummary = db.Queryable<MesInvItemArnDetail>()
+ .Where(it => it.Guid == inventoryDetails.Guid)
+ .Select(it => new
+ {
+ TotalComeQty = SqlFunc.AggregateSum(it.Quantity),
+ TotalInvQty = SqlFunc.AggregateSum(it.OkRkqty)
+ })
+ .First();
+
+ var comeQty = detailSummary.TotalComeQty ?? 0;
+ var invQty = detailSummary.TotalInvQty ?? 0;
+ var diffQty = comeQty - invQty;
+
+ if (detailSummary == null)
+ throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟槑缁嗭紒");
+
+ var mesItems = db.Queryable<MesItems>()
+ .Where(s => s.Id == itemBarcodeDetails.ItemId).First();
+
+ //result.Message =
+ // $"鏉$爜鏁伴噺 {itemBarcodeDetails.Quantity},閲囪喘璁㈠崟 {itemBarcodeDetails.WorkNo} 椤规 {itemBarcodeDetails.WorkLine} 鐗╂枡 {mesItems.ItemNo} 鏈鍏ュ簱鎬绘暟锛歿totalCDetailsQuantity} 鎬诲埌 {comeQty} 宸插叆 {invQty} 娆� {diffQty}";
+ result.Message = $"鐗╂枡{mesItems.ItemNo}鍏ュ簱鎴愬姛鏁伴噺{itemBarcodeDetails.Quantity.ToString()}";
+
+ result.itemDetail = mesItems;
+
+ result.ItemInDetails = db.Queryable<MesInvItemInCItems,MesItems>(
+ (a, b) => new JoinQueryInfos(
+ JoinType.Left,
+ a.ItemId == b.ItemId)
+ )
+ .Where(a => a.ItemInId == cId && a.ItemId == itemBarcodeDetails.ItemId)
+ .Select<dynamic>((a, b) => new
+ {
+ ItemNo = b.ItemNo,
+ ItemName = b.ItemName,
+ ItemModel = b.ItemModel,
+ FQty = a.Quantity, // 鐢宠鏁伴噺
+ FMaterialId = b.ItemId,
+ Id = b.Guid.ToString()
+ })
+ .ToList();
+
+ result.ItemBarCDetails = db.Queryable<MesInvItemInCDetails, MesItems>(
+ (a, b) => new JoinQueryInfos(
+ JoinType.Left,
+ a.ItemId == b.ItemId)
+ )
+ .Where(a => a.ItemInId == cId && a.ItemId == itemBarcodeDetails.ItemId)
+ .Select<dynamic>((a, b) => new
+ {
+ ItemNo = b.ItemNo,
+ ItemName = b.ItemName,
+ ItemModel = b.ItemModel,
+ FQty = a.Quantity, // 鐢宠鏁伴噺
+ FMaterialId = b.ItemId,
+ Id = a.Guid.ToString(),
+ kw = a.DepotSectionCode,
+ barcode = a.ItemBarcode
+ })
+ .ToList();
+
+
+ //result.ItemNo = mesItems.ItemNo;
+ result.SumQuantity = Convert.ToDecimal(invQty);
+
+ return 1;
+ }
+ else
+ {
+ // Step 1: Check if bill needs to be closed (status update)
+ var totalSummary = db.Queryable<MesInvItemArnDetail>()
+ .LeftJoin<MesInvItemArn>((b, a) => a.Guid == b.ParentGuid)
+ .Where((b, a) =>
+ a.BillNo == inventory.BillNo && b.ReturnFlag == 0)
+ .Select((b, a) => new
+ {
+ TotalQuantity = SqlFunc.AggregateSum(b.Quantity),
+ TotalOkRkQty = SqlFunc.AggregateSum(b.OkRkqty)
+ })
+ .First();
+
+ if ((totalSummary.TotalQuantity ?? 0) ==
+ (totalSummary.TotalOkRkQty ?? 0))
+ db.Updateable<MesInvItemArn>()
+ .SetColumns(it => it.Status == 1)
+ .Where(it => it.BillNo == itemBarcodeDetails.BillNo)
+ .ExecuteCommand();
+
+ // Step 2: Calculate total sum from `mes_inv_item_in_c_details`
+ var totalCDetailsQuantity = db.Queryable<MesInvItemInCDetails>()
+ .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
+ .Sum(it => it.Quantity);
+
+ // Step 3: Calculate comeQty and invQty from `mes_inv_item_arn_detail`
+ var detailSummary = db.Queryable<MesInvItemArnDetail>()
+ .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
+ .Select(it => new
+ {
+ TotalComeQty = SqlFunc.AggregateSum(it.Quantity),
+ TotalInvQty = SqlFunc.AggregateSum(it.OkRkqty)
+ })
+ .First();
+
+ if (detailSummary == null)
+ throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟槑缁嗭紒");
+
+ var comeQty = detailSummary.TotalComeQty ?? 0;
+ var invQty = detailSummary.TotalInvQty ?? 0;
+ var diffQty = comeQty - invQty;
+
+ var mesItems = db.Queryable<MesItems>()
+ .Where(s => s.Id == itemBarcodeDetails.ItemId).First();
+
+ // Step 5: Combine final result
+ result.Message =
+ $" 鏉$爜鏁伴噺:{itemBarcodeDetails.Quantity},鐗╂枡 {mesItems.ItemNo} 鏈鍏ュ簱鎬绘暟锛歿totalCDetailsQuantity} 鎬诲埌 {comeQty} 宸插叆 {invQty} 娆� {diffQty}";
+
+
+ //result.ItemNo = mesItems.ItemNo;
+ result.SumQuantity = Convert.ToDecimal(totalCDetailsQuantity);
+ }
+
+ var mesInvItemInCDetails =
+ base.GetSingle(it => it.ItemBarcode == entity.barcode);
+
+ if (mesInvItemInCDetails == null)
+ throw new Exception("鐗╂枡鍏ュ簱鏉$爜鏄庣粏涓嶅瓨鍦�"); // 鎶涘嚭寮傚父浠ヤ緵鍓嶅彴澶勭悊
+
+ // 鍒涘缓 鎻掑叆鏃ュ織
+ var logService = new LogService();
+ var LogMsg = "銆怭DA銆戦噰璐叆搴撱�傛潯鐮併��" + entity.barcode + "銆� 鍏ュ簱鍗曞彿銆�" + cBillNo + "銆�";
+ logService.CreateLog(db, entity.userName, inventory.Guid.ToString(), "MES_INV_ITEM_ARN", LogMsg, inventory.BillNo);
+
+ return 1;
+ });
+
+ var purchaseInventory = getPurchaseInventory(entity);
+
+
+ //result.ItemInDetails = purchaseInventory.ItemInDetails;
+ //result.InvItemInCDetails = purchaseInventory.InvItemInCDetails;
+
+ return result;
}
-
-
-
- //public ItemInBaseModel SaveBarCodes(WarehouseQuery entity)
- //{
- // string functionName = "閲囪喘鍏ュ簱", fieldName = null, inFieldVal = null;
- // string user = entity.userName,
- // sectionCode = entity.sectionCode,
- // itemBarcode = entity.barcode;
- // var transactionNo = "101";
- // int? billTypeId = 100, num = 0, num2 = 0;
- // var freeze = 0;
- // decimal cSyQty = 0;
-
- // if (string.IsNullOrEmpty(sectionCode))
- // throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
-
- // var itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
- // .Where(it => it.ItemBarcode == itemBarcode)
- // .First();
-
- // if (itemBarcodeDetails == null)
- // throw new Exception("鏉$爜涓嶅瓨鍦紝璇锋牳瀵癸紒");
-
- // if (string.IsNullOrEmpty(itemBarcodeDetails.Memo) || itemBarcodeDetails.Memo != "閲囪喘鍏ュ簱")
- // throw new Exception("姝ゆ潯鐮佷笉灞炰簬鍒拌揣鏉$爜锛屾棤娉曠敤閲囪喘鍏ュ簱锛�");
-
- // var inventory = Db.Queryable<MesInvItemArn>()
- // .Where(it => it.BillNo == itemBarcodeDetails.BillNo && it.Fstatus == true)
- // .First();
-
- // if (inventory == null)
- // throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟垨鏈鏍革紒");
-
- // // var inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
- // // .Where(it => it.ParentGuid == inventory.Guid
- // // && it.ItemId == itemBarcodeDetails.ItemId
- // // && it.EbelnLine == itemBarcodeDetails.WorkLine
- // // && it.Ebeln == itemBarcodeDetails.WorkNo)
- // // .First();
-
- // var inventoryDetails = Db.Queryable<MesInvItemArnDetail>()
- // .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
- // .First();
-
- // var cgddDetails = Db.Queryable<MesRohInData>()
- // .Where(it => it.EbelnK3id == inventoryDetails.LineK3id)
- // .First();
-
- // if (inventoryDetails == null)
- // throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟槑缁嗭紒");
-
- // //鑾峰彇鍒拌揣妫�楠屾槑缁�
- // var sqlParams = new List<SugarParameter> { new("@dhmxGuid", itemBarcodeDetails.AboutGuid) };
- // var sql1 = @"SELECT *FROM v_dhmx WHERE dhmxGuid = @dhmxGuid ";
- // var dhjymx = Db.Ado.SqlQuery<vDhmx>(sql1, sqlParams).First();
- // //鍒ゅ畾妫�楠岃兘鍚﹀叆搴�
- // if (dhjymx.CanStore != 1)
- // {
- // throw new Exception($"璇ユ潯鐮佸搴旂殑鏀舵枡鍗曟楠岀粨鏋�:銆恵dhjymx.InspectionResult}銆�,鍒ゅ畾缁撴灉锛氥�恵dhjymx.JudgmentResult}銆戯紝澶勭悊鎰忚锛氥�恵dhjymx.HandlingSuggestion}銆�,鏃犳硶鍏ュ簱");
- // }
-
- // var depotCode = Db.Queryable<MesDepotSections>()
- // .Where(it => it.DepotSectionCode == sectionCode)
- // .Select(it => it.DepotGuid)
- // .First();
-
- // var depotCode2 = Db.Queryable<MesInvItemArn>()
- // .Where(it => it.BillNo == itemBarcodeDetails.BillNo)
- // .Select(it => it.DepotsId)
- // .First();
-
- // MesDepots mesDepost = null;
-
- // var checkGuid = UtilityHelper.CheckGuid(depotCode);
- // if (checkGuid && depotCode != null)
- // {
- // mesDepost = Db.Queryable<MesDepots>()
- // .Where(s => s.DepotId.ToString() == depotCode).First();
-
- // // if (depotCode != mesDepost.Guid)
- // // throw new Exception("鎵弿搴撲綅涓庨噰璐叆搴撳簱浣嶄笉涓�鑷达紒");
- // }
- // else
- // {
- // throw new Exception("搴撲綅缂栫爜 " + sectionCode + " 涓嶅瓨鍦紝璇风‘璁わ紒");
- // }
-
-
- // //num = Db.Queryable<MesInvItemInCDetails>()
- // // .Where(it => it.ItemBarcode == itemBarcode)
- // // .Count();
-
- // //if (num > 0)
- // // throw new Exception("姝ゆ潯鐮佸凡鎵爜鍏ュ簱瀹屾垚锛岃鏍稿锛�");
-
- // //num = Db.Queryable<MesInvItemStocks>()
- // // .Where(it => it.ItemBarcode == itemBarcode)
- // // .Count();
-
- // //if (num > 0)
- // // throw new Exception("姝ゆ潯鐮佸凡鎵爜鍏ュ簱锛岃鏍稿锛�");
-
- // var wmsManager = new WmsBaseMangeer();
- // // 鏂板鍏ュ簱鏍¢獙锛堣皟鐢ㄥ瓨鍌ㄨ繃绋嬶級
- // var checkResult = wmsManager.pdaInvJY(
- // db: Db,
- // edtUserNo: entity.userName,
- // barcode: entity.barcode,
- // sectionCode: sectionCode,
- // stockId: mesDepost.DepotId.ToString(),
- // stockOrgId: mesDepost.FSubsidiary,
- // billNo: "", // 鏍规嵁瀹為檯鍗曟嵁鍙蜂紶鍊�
- // transactionNo: "101" // 浜嬪姟绫诲瀷涓庡瓨鍌ㄨ繃绋嬪尮閰�
- // );
-
- // if (Convert.ToInt32(checkResult.result) < 1)
- // throw new Exception($"鍏ュ簱鏍¢獙澶辫触锛歿checkResult.strMsg}");
-
-
-
- // //num = Db.Queryable<MesInvItemArn>()
- // // .Where(a => a.BillNo == itemBarcodeDetails.BillNo)
- // // .InnerJoin<MesInvItemArnDetail>((a, b) =>
- // // b.ParentGuid == a.Guid &&
- // // b.ItemId == itemBarcodeDetails.ItemId && b.Ischeck == 1)
- // // .Count();
-
- // //num2 = Db.Queryable<MesInvItemArn>()
- // // .Where(a => a.BillNo == itemBarcodeDetails.BillNo)
- // // .InnerJoin<MesInvItemArnDetail>((a, b) => b.ParentGuid == a.Guid
- // // && b.ItemId == itemBarcodeDetails.ItemId
- // // && (b.CheckRes == "鍚堟牸" || b.CheckStates == "鐗归噰鐩存帴浣跨敤"))
- // // .Count();
-
- // //switch (num)
- // //{
- // // case 0 when num2 == 0:
- // // case > 0 when num2 == 0:
- // // freeze = 1;
- // // break;
- // // case 0 when num2 > 0:
- // // throw new Exception("鍏ュ簱澶辫触,鍒拌揣鍗曟嵁鏈夐棶棰橈紒");
- // //}
-
-
- // // 鍒ゆ柇璐т富绫诲瀷
- // var owner_type = wmsManager.GetOwnerType(cgddDetails.DemandOrg);
- // // if (Db.Queryable<SysOrganization>().Any(x => x.Fid == cgddDetails.DemandOrg))
- // // {
- // // owner_type = "BD_OwnerOrg";
- // // }
- // // else
- // // {
- // // // 绗簩灞傚垽鏂細妫�鏌� MES_CUSTOMER
- // // if (Db.Queryable<MesCustomer>().Any(x => x.Id == Convert.ToInt32(cgddDetails.DemandOrg)))
- // // {
- // // owner_type = "BD_Customer";
- // // }
- // // else
- // // {
- // // // 绗笁灞傚垽鏂細妫�鏌� MES_SUPPLIER
- // // if (Db.Queryable<MesSupplier>().Any(x => x.Id == Convert.ToInt32(cgddDetails.DemandOrg)))
- // // {
- // // owner_type = "BD_Supplier";
- // // }
- // // else
- // // {
-
- // // // 绗洓灞傚垽鏂細鍐嶆妫�鏌� SYS_ORGANIZATION
- // // if (Db.Queryable<SysOrganization>().Any(x => x.Fid == cgddDetails.ReceivingOrg))
- // // {
- // // owner_type = "BD_OwnerOrg";
- // // }
- // // else
- // // {
- // // throw new Exception("鍏ュ簱澶辫触,鍒拌揣鍗曟嵁瀵瑰簲鐨勯渶姹傜粍缁囨湁闂锛�");
- // // }
- // // }
- // // }
- // //}
-
- // var result = new ItemInBaseModel();
-
- // UseTransaction(db =>
- // {
- // var existingRecord = db.Queryable<MesInvItemIns>()
- // .Where(it => it.InsDate.Value.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")
- // && it.TaskNo == itemBarcodeDetails.BillNo
- // && it.Status == 0
- // && it.TransctionNo == transactionNo
- // && it.CreateBy == entity.userName
- // && it.BillTypeId == billTypeId
- // && it.DepotsId == mesDepost.DepotId)
- // .Select(it => new
- // {
- // it.Guid,
- // it.BillNo
- // })
- // .First();
-
- // var cId = Guid.Empty;
- // string cBillNo = null;
-
- // if (existingRecord != null)
- // {
- // // If record exists, assign values
- // cId = existingRecord.Guid;
- // cBillNo = existingRecord.BillNo;
- // }
- // else
- // {
- // cId = Guid.NewGuid();
- // cBillNo = BillNo.GetBillNo("CGRK(閲囪喘鍏ュ簱)");
-
- // var suppNo = db.Queryable<MesSupplier>()
- // .Where(s => s.Id.ToString() == inventory.SuppId).First();
-
- // db.Insertable(new MesInvItemIns
- // {
- // Guid = cId,
- // BillNo = cBillNo,
- // BillTypeId = billTypeId,
- // InsDate = DateTime.Now,
- // DepotsId = mesDepost.DepotId,
- // DepotsCode = mesDepost.DepotCode,
- // TransctionNo = transactionNo,
- // SuppId = suppNo.Id.ToString(),
- // SuppNo = suppNo.SuppNo,
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = user,
- // LastupdateDate = DateTime.Now,
- // UrgentFlag = itemBarcodeDetails.UrgentFlag.Value
- // ? "1"
- // : "0",
- // CbillNo = itemBarcodeDetails.BillNo,
- // Fstatus = 0,
- // Status = 0,
- // ReceiveOrgId = inventory.ReceiveOrgId,
- // InType = "閲囪喘鍏ュ簱",
- // TaskNo = itemBarcodeDetails.BillNo
- // //WorkNo = itemBarcodeDetails.WorkNo
- // }).IgnoreColumns(true).ExecuteCommand();
- // }
-
- // cSyQty = itemBarcodeDetails.Quantity.Value;
-
- // entity.id = cId.ToString();
- // entity.PageIndex = 1;
- // entity.Limit = 1;
-
- // itemBarcodeDetails.Hbdy ??= 0;
- // if (itemBarcodeDetails.Hbdy == 1)
- // {
- // var details = db.Queryable<MesInvItemArnDetail>()
- // .Where(d =>
- // d.CbillNo == itemBarcodeDetails.BillNo &&
- // d.Quantity != d.OkRkqty &&
- // d.ItemId == itemBarcodeDetails.ItemId)
- // .ToList();
-
-
- // foreach (var detail in details)
- // {
- // if (cSyQty == 0) break;
-
- // var remainingQty = detail.Quantity - (detail.OkRkqty ?? 0);
- // if (remainingQty <= cSyQty)
- // {
- // // Update detail
- // db.Updateable<MesInvItemArnDetail>()
- // .SetColumns(d => new MesInvItemArnDetail
- // {
- // OkRkqty = (int)d.Quantity,
- // IsdepsIn = true
- // })
- // .Where(d => d.Guid == detail.Guid)
- // .IgnoreColumns(true)
- // .ExecuteCommand();
-
- // // Check if already inserted
- // var count = db.Queryable<MesInvItemInCItems>()
- // .Where(it =>
- // it.ItemInId == cId &&
- // it.ItemId == detail.ItemId &&
- // it.DepotId == depotCode2 &&
- // it.EbelnK3id == detail.EbelnK3id &&
- // it.LineK3id == detail.LineK3id)
- // .Count();
-
- // cSyQty -= remainingQty.Value;
-
- // if (count == 0)
- // // Insert new item into MES_INV_ITEM_IN_C_ITEMS
- // db.Insertable(new MesInvItemInCItems
- // {
- // ItemInId = cId,
- // Quantity = remainingQty,
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // ItemId = detail.ItemId,
- // DepotCode = mesDepost.DepotCode,
- // ItemSname = itemBarcodeDetails.ItemSname,
- // Unit = itemBarcodeDetails.Unit,
- // Ebeln = detail.Ebeln,
- // BillNo = cBillNo,
- // WorkNo = detail.WorkNo,
- // CbillNo = detail.CbillNo,
- // WorkLine = detail.WorkLine,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // Remark = itemBarcodeDetails.Memo,
- // EbelnK3id = detail.EbelnK3id,
- // LineK3id = detail.LineK3id,
- // DepotId = depotCode2,
- // itemDabid = itemBarcodeDetails.AboutGuid.ToString()
- // }).IgnoreColumns(true).ExecuteCommand();
- // else
- // db.Updateable<MesInvItemInCItems>()
- // .SetColumns(it =>
- // it.Quantity == it.Quantity + remainingQty)
- // .Where(it =>
- // it.ItemInId == cId &&
- // it.ItemId == detail.ItemId &&
- // it.DepotId == depotCode2 &&
- // it.EbelnK3id == detail.EbelnK3id &&
- // it.LineK3id == detail.LineK3id)
- // .IgnoreColumns(true)
- // .ExecuteCommand();
-
- // // Insert new detail into MES_INV_ITEM_IN_C_DETAILS
- // db.Insertable(new MesInvItemInCDetails
- // {
- // ItemInId = cId,
- // BillNo = cBillNo,
- // ItemBarcode = itemBarcode,
- // Quantity = remainingQty,
- // BarcodeFlag = true,
- // EpFlag = true,
- // WorkType = 1,
- // ItemNo = detail.ItemNo,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // DepotCode = mesDepost.DepotCode,
- // DepotSectionCode = sectionCode,
- // ItemSname = itemBarcodeDetails.ItemSname,
- // Unit = itemBarcodeDetails.Unit,
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = user,
- // LastupdateDate = DateTime.Now,
- // Remark = itemBarcodeDetails.Memo,
- // Ebeln = detail.WorkNo,
- // WorkNo = detail.WorkNo,
- // WorkLine = detail.WorkLine,
- // CbillNo = itemBarcodeDetails.BillNo,
- // UrgentFlag = detail.UrgentFlag,
- // BoardStyle = detail.BoardStyle,
- // TaskNo = detail.WorkNo,
- // EbelnK3id = detail.EbelnK3id,
- // LineK3id = detail.LineK3id,
- // ItemId = detail.ItemId,
- // ReceiveOrgId = inventory.ReceiveOrgId,
- // LotNo = cgddDetails.BatchNumber
- // }).IgnoreColumns(true).ExecuteCommand();
- // }
- // else
- // {
- // // Partially fulfill remaining quantity
- // db.Updateable<MesInvItemArnDetail>()
- // .SetColumns(d => new MesInvItemArnDetail
- // {
- // OkRkqty = (int)((d.OkRkqty ?? 0) + cSyQty)
- // })
- // .Where(d => d.Guid == detail.Guid)
- // .IgnoreColumns(true)
- // .ExecuteCommand();
-
- // var count = db.Queryable<MesInvItemInCItems>()
- // .Where(it =>
- // it.ItemInId == cId &&
- // it.ItemId == detail.ItemId &&
- // it.DepotId == depotCode2 &&
- // it.EbelnK3id == detail.EbelnK3id &&
- // it.LineK3id == detail.LineK3id)
- // .Count();
-
- // if (count == 0)
- // db.Insertable(new MesInvItemInCItems
- // {
- // ItemInId = cId,
- // Quantity = cSyQty,
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // ItemNo = detail.ItemNo,
- // DepotCode = mesDepost.DepotCode,
- // ItemSname = itemBarcodeDetails.ItemSname,
- // Unit = itemBarcodeDetails.Unit,
- // Ebeln = detail.WorkNo,
- // BillNo = cBillNo,
- // WorkNo = detail.WorkNo,
- // EbelnLineNo = detail.EbelnLine,
- // CbillNo = detail.CbillNo,
- // WorkLine = detail.WorkLine,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // Remark = itemBarcodeDetails.Memo,
- // EbelnK3id = detail.EbelnK3id,
- // LineK3id = detail.LineK3id,
- // ItemId = detail.ItemId,
- // DepotId = depotCode2
- // }).IgnoreColumns(true).ExecuteCommand();
- // else
- // db.Updateable<MesInvItemInCItems>()
- // .SetColumns(it =>
- // it.Quantity == it.Quantity + cSyQty)
- // .Where(it =>
- // it.ItemInId == cId &&
- // it.ItemId == detail.ItemId &&
- // it.DepotId == depotCode2 &&
- // it.EbelnK3id == detail.EbelnK3id &&
- // it.LineK3id == detail.LineK3id)
- // .IgnoreColumns(true)
- // .ExecuteCommand();
-
- // db.Insertable(new MesInvItemInCDetails
- // {
- // ItemInId = cId,
- // BillNo = cBillNo,
- // ItemBarcode = itemBarcode,
- // Quantity = cSyQty,
- // BarcodeFlag = true,
- // EpFlag = true,
- // WorkType = 1,
- // ItemNo = detail.ItemNo,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // DepotCode = mesDepost.DepotCode,
- // DepotSectionCode = sectionCode,
- // ItemSname = itemBarcodeDetails.ItemSname,
- // Unit = itemBarcodeDetails.Unit,
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = user,
- // LastupdateDate = DateTime.Now,
- // Remark = itemBarcodeDetails.Memo,
- // Ebeln = detail.WorkNo,
- // EbelnLineNo = detail.EbelnLine,
- // WorkNo = detail.WorkNo,
- // WorkLine = detail.WorkLine,
- // CbillNo = itemBarcodeDetails.BillNo,
- // UrgentFlag = detail.UrgentFlag,
- // BoardStyle = detail.BoardStyle,
- // TaskNo = detail.WorkNo,
- // EbelnK3id = detail.EbelnK3id,
- // LineK3id = detail.LineK3id,
- // ItemId = detail.ItemId,
- // ReceiveOrgId = inventory.ReceiveOrgId,
- // LotNo = cgddDetails.BatchNumber
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // cSyQty = 0; // Remaining quantity fulfilled
- // }
- // }
-
- // db.Insertable(new MesInvBusiness2
- // {
- // Status = 1,
- // BillTypeId = billTypeId,
- // TransactionCode = transactionNo,
- // BusinessType = 1,
- // ItemBarcode = itemBarcode,
- // ItemNo = itemBarcodeDetails.ItemNo,
- // LotNo = cgddDetails.BatchNumber,
- // EpFlag = true,
- // Quantity = itemBarcodeDetails.Quantity,
- // ToInvDepotsCode = mesDepost.DepotCode,
- // ToInvDepotSectionsCode = sectionCode,
- // Description = "閲囪喘鍏ュ簱",
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = user,
- // LastupdateDate = DateTime.Now,
- // TaskNo = itemBarcodeDetails.BillNo,
- // BillNo = cBillNo,
- // WorkNo = itemBarcodeDetails.WorkNo,
- // WorkLine = itemBarcodeDetails.WorkLine,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // EbelnK3id = itemBarcodeDetails.EbelnK3id,
- // LineK3id = itemBarcodeDetails.LineK3id,
- // ItemId = itemBarcodeDetails.ItemId
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // Insert into mes_inv_item_stocks
- // }
- // else
- // {
- // var detailone = db.Queryable<MesInvItemArnDetail>()
- // .Where(d =>
- // d.Guid == itemBarcodeDetails.AboutGuid)
- // .First();
-
- // // 妫�鏌ユ槸鍚﹀瓨鍦ㄤ簬 MES_INV_ITEM_IN_C_ITEMS 琛�
- // var existingCount = db.Queryable<MesInvItemInCItems>()
- // .Where(it =>
- // it.ItemInId == cId &&
- // it.ItemId == detailone.ItemId &&
- // it.DepotId == depotCode2 &&
- // it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
- // .Count();
-
- // if (existingCount == 0)
- // // 涓嶅瓨鍦ㄦ椂鎻掑叆鏂拌褰�
- // db.Insertable(new MesInvItemInCItems
- // {
- // ItemInId = cId,
- // Quantity = itemBarcodeDetails.Quantity,
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // ItemNo = itemBarcodeDetails.ItemNo,
- // DepotCode = mesDepost.DepotCode,
- // ItemSname = itemBarcodeDetails.ItemSname,
- // Unit = itemBarcodeDetails.Unit,
- // Ebeln = itemBarcodeDetails.WorkNo,
- // BillNo = cBillNo,
- // WorkNo = itemBarcodeDetails.WorkNo,
- // EbelnLineNo = itemBarcodeDetails.WorkLine,
- // CbillNo = itemBarcodeDetails.BillNo,
- // WorkLine = itemBarcodeDetails.WorkLine,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // Remark = itemBarcodeDetails.Memo,
- // EbelnK3id = itemBarcodeDetails.EbelnK3id,
- // LineK3id = itemBarcodeDetails.LineK3id,
- // ItemId = itemBarcodeDetails.ItemId,
- // DepotId = depotCode2,
- // itemDabid = itemBarcodeDetails.AboutGuid.ToString()
- // }).IgnoreColumns(true).ExecuteCommand();
- // else
- // // 瀛樺湪鏃舵洿鏂版暟閲�
- // db.Updateable<MesInvItemInCItems>()
- // .SetColumns(it => new MesInvItemInCItems
- // {
- // Quantity = SqlFunc.IsNull(it.Quantity, 0) + itemBarcodeDetails.Quantity // 纭繚 Quantity 涓嶄负 null
- // })
- // .Where(it =>
- // it.ItemInId == cId &&
- // it.ItemId == detailone.ItemId &&
- // it.DepotId == depotCode2 &&
- // it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
- // //.IgnoreColumns(true) // 淇濈暀 IgnoreColumns
- // .ExecuteCommand();
-
- // // 鎻掑叆 mes_inv_item_in_c_details 琛�
- // db.Insertable(new MesInvItemInCDetails
- // {
- // ItemInId = cId,
- // BillNo = cBillNo,
- // ItemBarcode = itemBarcode,
- // Quantity = itemBarcodeDetails.Quantity,
- // BarcodeFlag = true,
- // EpFlag = true,
- // WorkType = 1,
- // ItemNo = itemBarcodeDetails.ItemNo,
- // LotNo = cgddDetails.BatchNumber,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // DepotCode = mesDepost.DepotCode,
- // DepotSectionCode = sectionCode,
- // ItemSname = itemBarcodeDetails.ItemSname,
- // Unit = itemBarcodeDetails.Unit,
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = user,
- // LastupdateDate = DateTime.Now,
- // Remark = itemBarcodeDetails.Memo,
- // Ebeln = itemBarcodeDetails.Mblnr,
- // EbelnLineNo = itemBarcodeDetails.Zeile,
- // WorkNo = itemBarcodeDetails.WorkNo,
- // WorkLine = itemBarcodeDetails.WorkLine,
- // CbillNo = itemBarcodeDetails.BillNo,
- // UrgentFlag = itemBarcodeDetails.UrgentFlag,
- // BoardStyle = itemBarcodeDetails.BoardStyle,
- // TaskNo = itemBarcodeDetails.TaskNo,
- // EbelnK3id = itemBarcodeDetails.EbelnK3id,
- // LineK3id = itemBarcodeDetails.LineK3id,
- // ItemId = itemBarcodeDetails.ItemId,
- // Ischeck = true,
- // CheckDate = inventoryDetails.CheckDate,
- // CheckRes = inventoryDetails.CheckRes,
- // CheckStates = inventoryDetails.CheckStates,
- // ReceiveOrgId = inventory.ReceiveOrgId,
- // DepotId = Convert.ToInt64(depotCode2)
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆 mes_inv_business2 琛�
- // db.Insertable(new MesInvBusiness2
- // {
- // Status = 1,
- // BillTypeId = billTypeId,
- // TransactionCode = transactionNo,
- // BusinessType = 1,
- // ItemBarcode = itemBarcode,
- // ItemNo = itemBarcodeDetails.ItemNo,
- // LotNo = itemBarcodeDetails.LotNo,
- // EpFlag = true,
- // Quantity = itemBarcodeDetails.Quantity,
- // FromInvDepotsCode = null,
- // FromInvDepotSectionsCode = null,
- // ToInvDepotsCode = mesDepost.DepotCode,
- // ToInvDepotSectionsCode = sectionCode,
- // Description = "閲囪喘鍏ュ簱",
- // CreateBy = user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = user,
- // LastupdateDate = DateTime.Now,
- // TaskNo = itemBarcodeDetails.TaskNo,
- // BillNo = cBillNo,
- // WorkNo = itemBarcodeDetails.WorkNo,
- // WorkLine = itemBarcodeDetails.WorkLine,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // EbelnK3id = itemBarcodeDetails.EbelnK3id,
- // LineK3id = itemBarcodeDetails.LineK3id,
- // ItemId = itemBarcodeDetails.ItemId
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆 mes_inv_item_stocks 琛�
- // }
-
-
-
- // db.Insertable(new MesInvItemStocks
- // {
- // TaskNo = itemBarcodeDetails.TaskNo,
- // ItemBarcode = itemBarcode,
- // ItemNo = cgddDetails.BatchNumber,
- // LotNo = itemBarcodeDetails.LotNo,
- // Quantity = itemBarcodeDetails.Quantity,
- // DepotsCode = mesDepost.DepotCode,
- // DepotSectionsCode = sectionCode,
- // CheckDate = inventoryDetails.CheckDate,
- // IndepDate = DateTime.Now,
- // IqcStatus = inventoryDetails.CheckStates,
- // BoardStyle = itemBarcodeDetails.BoardStyle,
- // WorkNo = itemBarcodeDetails.WorkNo,
- // WorkLine = itemBarcodeDetails.WorkLine,
- // SuppId = itemBarcodeDetails.SuppId,
- // SuppNo = itemBarcodeDetails.SuppNo,
- // EbelnK3id = itemBarcodeDetails.EbelnK3id,
- // LineK3id = itemBarcodeDetails.LineK3id,
- // ItemId = itemBarcodeDetails.ItemId,
- // BillNo = itemBarcodeDetails.BillNo,
- // DepotId = Convert.ToInt32(depotCode2),
- // OwnerId = cgddDetails.DemandOrg,
- // OwnerType = owner_type,
- // StockOrgId = mesDepost.FSubsidiary,
- // IndepUserCode = user
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // itemBarcodeDetails.Hbdy ??= 0;
-
- // if (itemBarcodeDetails.Hbdy != 1)
- // {
- // //鏇存柊鏀舵枡鍗曟槑缁�
- // db.Updateable<MesInvItemArnDetail>()
- // .SetColumns(d => new MesInvItemArnDetail
- // {
- // OkRkqty = (int)((d.OkRkqty ?? 0) + cSyQty)
- // })
- // .Where(d => d.Guid == itemBarcodeDetails.AboutGuid)
- // .ExecuteCommand();
-
- // var first = db
- // .Queryable<MesInvItemArnDetail>()
- // .Where(b =>
- // b.Guid == itemBarcodeDetails.AboutGuid)
- // .Select(b => new
- // {
- // TotalQuantity =
- // SqlFunc.AggregateSum(b.Quantity),
- // TotalOkRkQty = SqlFunc.AggregateSum(b.OkRkqty)
- // })
- // .First();
-
- // var TotalQuantity = first.TotalQuantity ?? 0;
- // var TotalOkRkQty = first.TotalOkRkQty ?? 0;
-
- // if (TotalQuantity == TotalOkRkQty)
- // db.Updateable<MesInvItemArnDetail>()
- // .SetColumns(s => s.IsdepsIn == true)
- // .Where(s => s.Guid == itemBarcodeDetails.AboutGuid)
- // .ExecuteCommand();
-
-
- // var totalSummary = db.Queryable<MesInvItemArnDetail>()
- // .InnerJoin<MesInvItemArn>((b, a) => a.Guid == b.ParentGuid)
- // .Where((b, a) =>
- // a.BillNo == inventory.BillNo && b.ReturnFlag == 0)
- // .Select((b, a) => new
- // {
- // TotalQuantity = SqlFunc.AggregateSum(b.Quantity),
- // TotalOkRkQty = SqlFunc.AggregateSum(b.OkRkqty)
- // })
- // .First();
-
- // if ((totalSummary.TotalQuantity ?? 0) ==
- // (totalSummary.TotalOkRkQty ?? 0))
- // db.Updateable<MesInvItemArn>()
- // .SetColumns(it => it.Status == 1)
- // .Where(it => it.BillNo == itemBarcodeDetails.BillNo)
- // .ExecuteCommand();
-
- // var totalCDetailsQuantity = db.Queryable<MesInvItemInCDetails>()
- // .Where(it => it.ItemId == itemBarcodeDetails.ItemId &&
- // it.WorkNo == itemBarcodeDetails.WorkNo &&
- // it.ItemInId == cId)
- // .Sum(it => it.Quantity);
-
- // var detailSummary = db.Queryable<MesInvItemArnDetail>()
- // .Where(it => it.Guid == inventoryDetails.Guid)
- // .Select(it => new
- // {
- // TotalComeQty = SqlFunc.AggregateSum(it.Quantity),
- // TotalInvQty = SqlFunc.AggregateSum(it.OkRkqty)
- // })
- // .First();
-
- // var comeQty = detailSummary.TotalComeQty ?? 0;
- // var invQty = detailSummary.TotalInvQty ?? 0;
- // var diffQty = comeQty - invQty;
-
- // if (detailSummary == null)
- // throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟槑缁嗭紒");
-
- // var mesItems = db.Queryable<MesItems>()
- // .Where(s => s.Id == itemBarcodeDetails.ItemId).First();
-
- // //result.Message =
- // // $"鏉$爜鏁伴噺 {itemBarcodeDetails.Quantity},閲囪喘璁㈠崟 {itemBarcodeDetails.WorkNo} 椤规 {itemBarcodeDetails.WorkLine} 鐗╂枡 {mesItems.ItemNo} 鏈鍏ュ簱鎬绘暟锛歿totalCDetailsQuantity} 鎬诲埌 {comeQty} 宸插叆 {invQty} 娆� {diffQty}";
- // result.Message = $"鐗╂枡{mesItems.ItemNo}鍏ュ簱鎴愬姛鏁伴噺{itemBarcodeDetails.Quantity.ToString()}";
-
- // result.itemDetail = mesItems;
-
- // result.ItemInDetails = db.Queryable<MesInvItemInCItems, MesItems>(
- // (a, b) => new JoinQueryInfos(
- // JoinType.Left,
- // a.ItemId == b.ItemId)
- // )
- // .Where(a => a.ItemInId == cId && a.ItemId == itemBarcodeDetails.ItemId)
- // .Select<dynamic>((a, b) => new
- // {
- // ItemNo = b.ItemNo,
- // ItemName = b.ItemName,
- // ItemModel = b.ItemModel,
- // FQty = a.Quantity, // 鐢宠鏁伴噺
- // FMaterialId = b.ItemId,
- // Id = b.Guid.ToString()
- // })
- // .ToList();
-
- // result.ItemBarCDetails = db.Queryable<MesInvItemInCDetails, MesItems>(
- // (a, b) => new JoinQueryInfos(
- // JoinType.Left,
- // a.ItemId == b.ItemId)
- // )
- // .Where(a => a.ItemInId == cId && a.ItemId == itemBarcodeDetails.ItemId)
- // .Select<dynamic>((a, b) => new
- // {
- // ItemNo = b.ItemNo,
- // ItemName = b.ItemName,
- // ItemModel = b.ItemModel,
- // FQty = a.Quantity, // 鐢宠鏁伴噺
- // FMaterialId = b.ItemId,
- // Id = a.Guid.ToString(),
- // kw = a.DepotSectionCode,
- // barcode = a.ItemBarcode
- // })
- // .ToList();
-
-
- // //result.ItemNo = mesItems.ItemNo;
- // result.SumQuantity = Convert.ToDecimal(invQty);
-
- // return 1;
- // }
- // else
- // {
- // // Step 1: Check if bill needs to be closed (status update)
- // var totalSummary = db.Queryable<MesInvItemArnDetail>()
- // .LeftJoin<MesInvItemArn>((b, a) => a.Guid == b.ParentGuid)
- // .Where((b, a) =>
- // a.BillNo == inventory.BillNo && b.ReturnFlag == 0)
- // .Select((b, a) => new
- // {
- // TotalQuantity = SqlFunc.AggregateSum(b.Quantity),
- // TotalOkRkQty = SqlFunc.AggregateSum(b.OkRkqty)
- // })
- // .First();
-
- // if ((totalSummary.TotalQuantity ?? 0) ==
- // (totalSummary.TotalOkRkQty ?? 0))
- // db.Updateable<MesInvItemArn>()
- // .SetColumns(it => it.Status == 1)
- // .Where(it => it.BillNo == itemBarcodeDetails.BillNo)
- // .ExecuteCommand();
-
- // // Step 2: Calculate total sum from `mes_inv_item_in_c_details`
- // var totalCDetailsQuantity = db.Queryable<MesInvItemInCDetails>()
- // .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
- // .Sum(it => it.Quantity);
-
- // // Step 3: Calculate comeQty and invQty from `mes_inv_item_arn_detail`
- // var detailSummary = db.Queryable<MesInvItemArnDetail>()
- // .Where(it => it.Guid == itemBarcodeDetails.AboutGuid)
- // .Select(it => new
- // {
- // TotalComeQty = SqlFunc.AggregateSum(it.Quantity),
- // TotalInvQty = SqlFunc.AggregateSum(it.OkRkqty)
- // })
- // .First();
-
- // if (detailSummary == null)
- // throw new Exception("姝ゆ潯鐮佹壘涓嶅埌瀵瑰簲鏀惰揣鍗曟槑缁嗭紒");
-
- // var comeQty = detailSummary.TotalComeQty ?? 0;
- // var invQty = detailSummary.TotalInvQty ?? 0;
- // var diffQty = comeQty - invQty;
-
- // var mesItems = db.Queryable<MesItems>()
- // .Where(s => s.Id == itemBarcodeDetails.ItemId).First();
-
- // // Step 5: Combine final result
- // result.Message =
- // $" 鏉$爜鏁伴噺:{itemBarcodeDetails.Quantity},鐗╂枡 {mesItems.ItemNo} 鏈鍏ュ簱鎬绘暟锛歿totalCDetailsQuantity} 鎬诲埌 {comeQty} 宸插叆 {invQty} 娆� {diffQty}";
-
-
- // //result.ItemNo = mesItems.ItemNo;
- // result.SumQuantity = Convert.ToDecimal(totalCDetailsQuantity);
- // }
-
- // var mesInvItemInCDetails =
- // base.GetSingle(it => it.ItemBarcode == entity.barcode);
-
- // if (mesInvItemInCDetails == null)
- // throw new Exception("鐗╂枡鍏ュ簱鏉$爜鏄庣粏涓嶅瓨鍦�"); // 鎶涘嚭寮傚父浠ヤ緵鍓嶅彴澶勭悊
-
- // // 鍒涘缓 鎻掑叆鏃ュ織
- // var logService = new LogService();
- // var LogMsg = "銆怭DA銆戦噰璐叆搴撱�傛潯鐮併��" + entity.barcode + "銆� 鍏ュ簱鍗曞彿銆�" + cBillNo + "銆�";
- // logService.CreateLog(db, entity.userName, inventory.Guid.ToString(), "MES_INV_ITEM_ARN", LogMsg, inventory.BillNo);
-
- // return 1;
- // });
-
- // var purchaseInventory = getPurchaseInventory(entity);
-
-
- // //result.ItemInDetails = purchaseInventory.ItemInDetails;
- // //result.InvItemInCDetails = purchaseInventory.InvItemInCDetails;
-
- // return result;
- //}
public ItemInBaseModel getPurchaseInventory(WarehouseQuery query)
{
diff --git a/service/Warehouse/MesItemBlManager.cs b/service/Warehouse/MesItemBlManager.cs
index 93e4d24..5d749cb 100644
--- a/service/Warehouse/MesItemBlManager.cs
+++ b/service/Warehouse/MesItemBlManager.cs
@@ -6,6 +6,7 @@
using NewPdaSqlServer.util;
using SqlSugar;
using System.Data;
+using System.Text;
using System.Data.SqlClient;
namespace NewPdaSqlServer.service.Warehouse;
@@ -18,15 +19,22 @@
/// 鑾峰彇鐢熶骇琛ユ枡鍗曞彿鍒楄〃
/// </summary>
/// <returns>琛ユ枡鍗曞彿鍒楄〃</returns>
- public List<string> GetSCBLBillNo(WarehouseQuery query)
+ public List<string> GetSCBLBillNo(dynamic query, dynamic RequestInfo)
{
- var list = Db.Queryable<MesItemBl>()
- .Where(s => (s.Bl018 ?? false) == true
- //&& (s.Bl019 ?? false) == false
- && s.Bl008 == query.Type)
- .OrderByDescending(s => s.Bl006)
- .Select(s => s.BlNo)
- .ToList();
+ var orgId = RequestInfo.OrgId;
+ var sqlParams = new List<SugarParameter>
+ {
+ new("@orgId", orgId),
+ new("@type", query.type),
+ new("@dateTime", query.dateTime == "" ? null : query.dateTime),
+ new("@lineNo", query.lineNo)
+
+ };
+ var sql2 = new StringBuilder("exec prc_pda_itemBl_billNoList @type,@orgId,@dateTime,@lineNo");
+
+ var LineInfo = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ var list = LineInfo.Select(s => (string)s.bl_no).ToList();
return list;
}
@@ -70,7 +78,7 @@
// .ToList();
//return (mesItemBl.Bl001, blDetails);
- var sql = string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,A.BLD007 FQty,A.BLD008 SQty,A.BLD007 - A.BLD008 DSQty,
+ var sql = string.Format(@"SELECT c.id as ItemId,c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,A.BLD007 FQty,A.BLD008 SQty,A.BLD007 - A.BLD008 DSQty,
dbo.F_QX_GETRECODEPOTSE(A.bld012,'','','') as RecoKw,D.daa001
fROM MES_ITEM_BL_DETAIL A
LEFT JOIN MES_ITEM_BL B ON A.MID = B.ID
@@ -113,7 +121,6 @@
ScblScanBarcode(
WarehouseQuery query)
{
-
if (string.IsNullOrEmpty(query.barcode))
throw new Exception("璇锋壂鎻忔潯鐮侊紒");
@@ -224,368 +231,6 @@
{
throw new Exception($"璋冪敤瀛樺偍杩囩▼PRC_PDA_SCBLCL澶辫触: {ex.Message}");
}
-
- //if (string.IsNullOrEmpty(query.billNo))
- // throw new Exception("璇烽�夊彇鍗曟嵁鍙凤紒");
-
- //if (string.IsNullOrEmpty(query.barcode))
- // throw new Exception("璇锋壂鎻忔潯鐮侊紒");
-
- //if (string.IsNullOrEmpty(query.userName))
- // throw new Exception("鐢ㄦ埛鍚嶄笉鑳戒负绌猴紒");
-
- //if (string.IsNullOrEmpty(query.blNo))
- // throw new Exception("鐢宠鍗曞彿涓嶈兘涓虹┖锛�");
-
-
- //// 妫�楠屾槸鍚﹂噸澶嶆壂鎻�
- //var exists = Db.Queryable<MesInvItemOutCDetails>()
- // .Where(b => b.ItemBarcode == query.barcode)
- // .Any();
-
- //if (exists)
- // throw new Exception("姝ゆ潯鐮佸凡鎵弿,鍕块噸澶嶆壂鐮侊紒");
-
- //// 鏌ヨ鏉$爜搴撳瓨淇℃伅
- //var stockBarcode = Db.Queryable<MesInvItemStocks>()
- // .Where(t => t.ItemBarcode == query.barcode && t.Quantity > 0)
- // .First();
-
- //if (stockBarcode == null)
- // throw new Exception($"搴撳瓨涓棤姝ゆ潯鐮�,璇锋牳瀵癸紒{query.barcode}");
-
- //var depots = Db.Queryable<MesDepots>()
- // .Where(t => t.DepotId == stockBarcode.DepotId)
- // .First();
-
- //// 妫�鏌ヨˉ鏂欏崟鐘舵��
- //var mesItemBl = Db.Queryable<MesItemBl>()
- // .Where(a => a.BlNo == query.blNo)
- // .First();
-
- //if (mesItemBl == null)
- // throw new Exception($"鐢宠鍗� {query.blNo} 宸叉挙鍥烇紒");
-
- //if (mesItemBl.Bl018 != true)
- // throw new Exception($"鐢宠鍗� {query.blNo} 鏈鏍革紒");
-
- //if (mesItemBl.Bl019 == true)
- // throw new Exception($"鐢宠鍗� {query.blNo} 宸插畬缁擄紒");
-
- //// 鑾峰彇琛ユ枡鍗曟槑缁嗗苟鏍¢獙
- //var blDetail = Db.Queryable<MesItemBlDetail>()
- // .Where(b =>
- // b.Mid == mesItemBl.Id && b.Bld012 == stockBarcode.ItemId)
- // .First();
-
- //if (blDetail == null)
- // throw new Exception($"鐢宠鍗曚笉瀛樺湪姝ょ墿鏂� {stockBarcode.ItemNo} 璇风‘璁わ紒");
-
- //// 妫�鏌ュ緟琛ユ暟閲�
- //var quantity = (blDetail.Bld007 ?? 0) - (blDetail.Bld008 ?? 0);
- //if (quantity == 0)
- // throw new Exception("鐗╂枡宸叉壂鐮佸畬鎴愶紝璇锋牳瀵癸紒");
-
-
- //if(stockBarcode.Quantity > quantity)
- //{
- // query.status = 2;
- // query.message = "鏉$爜搴撳瓨澶т簬闇�棰嗭紝璇锋媶鍒嗭紒";
- // query.CfNum = quantity;
- // query.Num = stockBarcode.Quantity;
- // return (query, []);
- //}
-
- //// 妫�鏌ュ伐鍗曚俊鎭�
- //var womdaa = Db.Queryable<Womdaa>()
- // .Where(a => a.Daa001 == query.billNo)
- // .First();
-
- //if (womdaa == null)
- // throw new Exception($"宸ュ崟 {query.billNo} 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- //// 妫�鏌ュ鏂欐槑缁�
- //var womdab = Db.Queryable<Womdab>()
- // .Where(b => b.Dab001 == query.billNo && b.Erpid == blDetail.Bld014)
- // .First();
-
- //if (womdab == null)
- // throw new Exception($"澶囨枡鏄庣粏涓嶅瓨鍦ㄦ鐗╂枡 {stockBarcode.ItemNo} 璇风‘璁わ紒");
-
- //if (stockBarcode.Quantity > quantity)
- //{
- // // 鑾峰彇寰呭彂鏂欐槑缁嗗垪琛�
- // var pendingList = Db.Queryable<MesItemBl, MesItemBlDetail>((a, b) =>
- // new JoinQueryInfos(JoinType.Left, a.Id == b.Mid))
- // .Where((a, b) => a.BlNo == query.blNo
- // && (b.Bld007 ?? 0) - (b.Bld008 ?? 0) > 0)
- // .Select((a, b) => new MesItemBlDetail
- // {
- // Bld012 = b.Bld012,
- // Bld002 = b.Bld002,
- // Bld003 = b.Bld003,
- // Bld004 = b.Bld004,
- // Bld007 = b.Bld007,
- // Bld008 = b.Bld008
- // })
- // .ToList();
-
-
- // query.Num = stockBarcode.Quantity;
- // query.Fum = quantity;
-
- // return (query, pendingList);
- //}
-
- //// 寮�鍚簨鍔″鐞�
- //var success = UseTransaction(db =>
- //{
- // var outNoType = "";
- // if(query.Type == "鐢熶骇琛ユ枡")
- // {
- // outNoType = "SCBL(鐢熶骇琛ユ枡)";
- // }else
- // {
- // outNoType = "SCCL(鐢熶骇瓒呴)";
- // }
- // // 鑾峰彇鎴栧垱寤哄嚭搴撳崟
- // var outId = Guid.NewGuid();
- // var outNo = BillNo.GetBillNo(outNoType);
-
- // var existingOut = db.Queryable<MesInvItemOuts>()
- // .Where(a => a.TaskNo == query.blNo
- // && a.DepotId == stockBarcode.DepotId
- // && a.OutDate.Value.Date.ToString("yyyy-MM-dd") ==
- // DateTime.Now.Date.ToString("yyyy-MM-dd")
- // && a.BillTypeId == 200
- // && a.TransactionNo == 209
- // && a.Status == 0)
- // .First();
-
- // if (existingOut != null)
- // {
- // outId = existingOut.Guid;
- // outNo = existingOut.ItemOutNo;
- // }
- // else
- // {
- // // 鎻掑叆鍑哄簱鍗曚富琛�
- // db.Insertable(new MesInvItemOuts
- // {
- // Guid = outId,
- // ItemOutNo = outNo,
- // TaskNo = query.blNo,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // BillTypeId = 200,
- // TransactionNo = 209,
- // Remark = mesItemBl.Bl007,
- // DepotCode = depots.DepotCode,
- // OutPart = womdaa.Daa013,
- // OutType = query.Type,
- // FType = 0,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // WorkNo = womdaa.Daa021,
- // BoardItem = womdaa.Daa002,
- // PbillNo = womdaa.Daa001,
- // OutDate = DateTime.Now,
- // Status = 0,
- // DepotId = stockBarcode.DepotId,
- // THORGID = stockBarcode.StockOrgId,
- // //BbillNo = query.billNo
- // }).IgnoreColumns(true).ExecuteCommand();
- // }
-
- // // 妫�鏌ュ苟鏇存柊鍑哄簱鍗曠墿鏂欐槑缁�
- // var itemCount = db.Queryable<MesInvItemOutItems>()
- // .Where(i =>
- // i.ItemOutId == outId && i.ItemId == stockBarcode.ItemId && i.ItemOutId == outId && i.DepotId == stockBarcode.DepotsId.ToString())
- // .Count();
-
- // if (itemCount > 0)
- // // 鏇存柊宸插瓨鍦ㄧ殑鐗╂枡鏄庣粏鏁伴噺
- // db.Updateable<MesInvItemOutItems>()
- // .SetColumns(i =>
- // i.TlQty == i.TlQty + stockBarcode.Quantity)
- // .Where(i =>
- // i.ItemOutId == outId && i.ItemId == stockBarcode.ItemId && i.ItemOutId == outId && i.DepotId == stockBarcode.DepotsId.ToString())
- // .ExecuteCommand();
- // else
- // // 鎻掑叆鏂扮殑鐗╂枡鏄庣粏璁板綍
- // db.Insertable(new MesInvItemOutItems
- // {
- // Guid = Guid.NewGuid(),
- // ItemOutId = outId,
- // ItemNo = blDetail.Bld002,
- // Quantity = stockBarcode.Quantity,
- // TlQty = stockBarcode.Quantity,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // DepotCode = depots.DepotCode,
- // TaskNo = query.blNo,
- // WorkNo = womdaa.Daa021,
- // WorkLine = blDetail.Bld013,
- // ErpItemNo = womdab.Dab003,
- // ErpId = womdab.Eid,
- // ErpAutoid = womdab.Erpid,
- // PbillNo = query.billNo,
- // ItemId = blDetail.Bld012,
- // DepotId = stockBarcode.DepotId.ToString(),
- // ItemDabid = blDetail.Id,
- // // Unit = blDetail.Bld009,
- // // DepotId = (int)stockBarcode.DepotsId
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆鍑哄簱鍗曟潯鐮佹槑缁�
- // db.Insertable(new MesInvItemOutCDetails
- // {
- // Guid = Guid.NewGuid(),
- // ItemOutId = outId,
- // ItemBarcode = stockBarcode.ItemBarcode,
- // ItemNo = stockBarcode.ItemNo,
- // LotNo = stockBarcode.LotNo,
- // Quantity = stockBarcode.Quantity,
- // ForceOutFlag = 0,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // DepotCode = depots.DepotCode,
- // DepotSectionCode = stockBarcode.DepotSectionsCode,
- // Remark = blDetail.Bld010,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // TaskNoy = mesItemBl.Bl013,
- // BoardStyle = mesItemBl.Bl002,
- // TaskNo = query.blNo,
- // WorkNo = blDetail.Bld001,
- // WorkLine = blDetail.Bld013,
- // SuppNo = stockBarcode.SuppNo,
- // PbillNo = query.billNo,
- // ItemId = blDetail.Bld012,
- // Unit = blDetail.Bld009,
- // DepotId = (int)stockBarcode.DepotId,
- // EbelnK3id = womdab.Eid,
- // LineK3id = womdab.Erpid
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆涓氬姟浜ゆ槗璁板綍
- // db.Insertable(new MesInvBusiness2
- // {
- // Guid = Guid.NewGuid(),
- // Status = 1,
- // BillTypeId = 200, // p_bill_type_id
- // TransactionCode = "209", // p_transaction_no
- // BusinessType = -1,
- // ItemBarcode = stockBarcode.ItemBarcode,
- // ItemNo = stockBarcode.ItemNo,
- // LotNo = stockBarcode.LotNo,
- // EpFlag = true,
- // Quantity = stockBarcode.Quantity,
- // FromInvDepotsCode = stockBarcode.DepotsCode,
- // FromInvDepotSectionsCode = stockBarcode.DepotSectionsCode,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // TaskNo = mesItemBl.Bl012, // Matches C_QTCK.Bl012
- // BillNo = query.blNo,
- // WorkNo = blDetail.Bld001, // Matches C_QTCK_D.Bld001
- // WorkLine = blDetail.Bld013, // Matches C_QTCK_D.Bld013
- // SuppNo = stockBarcode.SuppNo,
- // ItemId = stockBarcode.ItemId
- // // CkDepot = stockBarcode.DepotsId
- // }).IgnoreColumns(true).ExecuteCommand();
-
-
- // // 鏇存柊宸ュ崟琛ㄦ暟閲�
- // db.Updateable<Womdab>()
- // .SetColumns(it => new Womdab
- // {
- // Dab007 = (it.Dab007 ?? 0) + stockBarcode.Quantity,
- // Dab020 = (it.Dab020 ?? 0) + stockBarcode.Quantity,
- // Dab021 = (it.Dab021 ?? 0) + stockBarcode.Quantity
- // })
- // .Where(it => it.Guid == womdab.DaaGuid && it.Dab003 == womdab.Dab003)
- // .ExecuteCommand();
-
- // // 鏇存柊琛ユ枡鍗曟槑缁嗗凡琛ユ暟閲�
- // db.Updateable<MesItemBlDetail>()
- // .SetColumns(it => new MesItemBlDetail
- // {
- // Bld008 = (it.Bld008 ?? 0) + (int)stockBarcode.Quantity
- // })
- // .Where(it => it.Id == blDetail.Id)
- // .ExecuteCommand();
-
- // // 妫�鏌ヨˉ鏂欏崟鏄庣粏鏄惁瀹屾垚
- // var blDetail1 = db.Queryable<MesItemBlDetail>()
- // .Where(it => it.Id == blDetail.Id)
- // .First();
-
- // if ((blDetail1.Bld007 ?? 0) <= (blDetail1.Bld008 ?? 0))
- // // 鏇存柊鏄庣粏瀹屾垚鐘舵��
- // db.Updateable<MesItemBlDetail>()
- // .SetColumns(it => it.Bld011 == 1)
- // .Where(it => it.Id == blDetail1.Id)
- // .ExecuteCommand();
-
- // // 鏇存柊搴撳瓨鏁伴噺涓�0
- // db.Updateable<MesInvItemStocks>()
- // .SetColumns(it => it.Quantity == 0)
- // .Where(it => it.Guid == stockBarcode.Guid)
- // .ExecuteCommand();
-
-
- // // 妫�鏌ユ槸鍚︽墍鏈夋槑缁嗛兘宸插畬鎴�
- // var unfinishedDetail = db.Queryable<MesItemBlDetail>()
- // .LeftJoin<MesItemBl>((b, a) => a.Id == b.Mid)
- // .Where((b, a) => a.BlNo == query.blNo && (b.Bld011 ?? 0) == 0)
- // .Select((b, a) => b)
- // .First();
-
- // if (unfinishedDetail == null)
- // // 濡傛灉娌℃湁鏈畬鎴愮殑鏄庣粏锛屾洿鏂拌ˉ鏂欏崟鐘舵�佷负宸插畬鎴�
- // db.Updateable<MesItemBl>()
- // .SetColumns(it => new MesItemBl
- // {
- // Bl019 = true,
- // WcUser = query.userName,
- // WcTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
- // })
- // .Where(it => it.Id == mesItemBl.Id)
- // .ExecuteCommand();
-
- // return 1;
- //});
-
- //// 鑾峰彇鏈�缁堢殑寰呭彂鏂欐槑缁嗗垪琛�
- //var finalPendingList = Db.Queryable<MesItemBl, MesItemBlDetail>(
- // (a, b) =>
- // new JoinQueryInfos(JoinType.Left, a.Id == b.Mid))
- // .Where((a, b) => a.BlNo == query.blNo
- // && (b.Bld007 ?? 0) - (b.Bld008 ?? 0) > 0)
- // .Select((a, b) => new MesItemBlDetail
- // {
- // Bld012 = b.Bld012,
- // Bld002 = b.Bld002,
- // Bld003 = b.Bld003,
- // Bld004 = b.Bld004,
- // Bld007 = b.Bld007,
- // Bld008 = b.Bld008
- // })
- // .ToList();
-
- //return (query, finalPendingList);
}
/// <summary>
@@ -601,7 +246,7 @@
/// - Num: 鍙戞枡鏁伴噺(蹇呭~,蹇呴』澶т簬0)
/// - blNo: 琛ユ枡鍗曞彿(蹇呭~)
/// </remarks>
- public (bool success, List<MesItemBlDetail> pendingList) SplitBarcode(
+ public ProductionPickDto SplitBarcode(
WarehouseQuery query)
{
@@ -649,12 +294,6 @@
throw new Exception(outMsg ?? "鎿嶄綔澶辫触");
}
- if (outSum == 2)
- {
- // Handle case where barcode needs to be split
- // You might want to return the new barcode to the client
- }
-
// Get pending list for the supplement order
var pendingList = Db.Queryable<MesItemBl, MesItemBlDetail>((a, b) =>
new JoinQueryInfos(JoinType.Left, a.Id == b.Mid))
@@ -671,505 +310,31 @@
})
.ToList();
- return (outSum == 1, pendingList);
+ var dto = new ProductionPickDto
+ {
+ daa001 = query.billNo,
+ barcode = query.barcode,//鍘熸潯鐮�
+ cfBarcode = outCfBar//鎷嗗垎鍚庢潯鐮�
+ };
- //if (string.IsNullOrEmpty(query.userName))
- // throw new Exception("鐢ㄦ埛鍚嶄笉鑳戒负绌猴紒");
-
- //if (string.IsNullOrEmpty(query.billNo))
- // throw new Exception("璇烽�夊彇鍗曟嵁鍙凤紒");
-
- //if (string.IsNullOrEmpty(query.barcode))
- // throw new Exception("璇锋壂鎻忔潯鐮侊紒");
-
- //if ((query.Num ?? 0) <= 0)
- // throw new Exception("璇疯緭鍏ユ纭殑鍙戞枡鏁伴噺锛�");
-
- //if (string.IsNullOrEmpty(query.blNo))
- // throw new Exception("琛ユ枡鍗曞彿涓嶈兘涓虹┖锛�");
-
-
- //// 妫�楠屾槸鍚﹂噸澶嶆壂鎻�
- //var exists = Db.Queryable<MesInvItemOutCDetails>()
- // .Where(b => b.ItemBarcode == query.barcode)
- // .Any();
-
- //if (exists)
- // throw new Exception("姝ゆ潯鐮佸凡鎵弿,鍕块噸澶嶆壂鐮侊紒");
-
- //// 鏌ヨ鏉$爜搴撳瓨淇℃伅
- //var stockBarcode = Db.Queryable<MesInvItemStocks>()
- // .Where(t => t.ItemBarcode == query.barcode && t.Quantity > 0)
- // .First();
-
- //if (stockBarcode == null)
- // throw new Exception($"搴撳瓨涓棤姝ゆ潯鐮�,璇锋牳瀵癸紒{query.barcode}");
-
- //var totalQty = stockBarcode.Quantity;
- //string newBarcode = null;
-
- //var outNoType = "";
- //if (query.Type == "鐢熶骇琛ユ枡")
- //{
- // outNoType = "SCBL(鐢熶骇琛ユ枡)";
- //}
- //else
- //{
- // outNoType = "SCCL(鐢熶骇瓒呴)";
- //}
-
- //// 寮�鍚簨鍔″鐞�
- //var success = UseTransaction(db =>
- //{
- // var executeCommand = 0;
-
- // // 鎷嗗垎鏉$爜
- // if (totalQty > query.Num)
- // {
- // var mesItems = db.Queryable<MesItems>()
- // .Where(s => s.Id == stockBarcode.ItemId).First();
-
- // // 鐢熸垚鏂版潯鐮佸彿
- // newBarcode = BillNo.GetBillNo("TM(鏉$爜)", mesItems.ItemNo);
-
- // // 鍐欏叆鏂版潯鐮�
- // executeCommand += db.Insertable(new MesInvItemBarcodes
- // {
- // Guid = Guid.NewGuid(),
- // ItemBarcode = newBarcode,
- // CustNo = stockBarcode.CustomerNo,
- // // ProductCode = stockBarcode.ProductCode,
- // // ItemBarcode2 = stockBarcode.ItemBarcode2,
- // // ItemCode = stockBarcode.ItemCode,
- // ItemNo = stockBarcode.ItemNo,
- // LotNo = stockBarcode.LotNo,
- // Quantity = query.Num,
- // EpFlag = true,
- // TaskNo = stockBarcode.TaskNo,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // OldItemBarcode = query.barcode,
- // // Mblnr = stockBarcode.Mblnr,
- // // Zeile = stockBarcode.Zeile,
- // // RohInId = stockBarcode.RohInId,
- // Barcodestatus = false,
- // Oldqty = query.Num as long?,
- // // Unit = stockBarcode.Unit,
- // // WeightUnit = stockBarcode.WeightUnit,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // BillNo = stockBarcode.BillNo,
- // BoardStyle = stockBarcode.BoardStyle,
- // // ColorName = stockBarcode.ColorName,
- // WorkNo = stockBarcode.WorkNo,
- // WorkLine = stockBarcode.WorkLine,
- // // MemoBad = stockBarcode.MemoBad,
- // ComeFlg = 5,
- // // Memo = stockBarcode.Memo,
- // SuppId = stockBarcode.SuppId,
- // SuppNo = stockBarcode.SuppNo,
- // InsDate = stockBarcode.IndepDate, // Added InsDate
- // ItemId = stockBarcode.ItemId
- // // ItemUnit = stockBarcode.ItemUnit // Added ItemUnit
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鏇存柊鍘熸潯鐮佹暟閲�
- // executeCommand += db.Updateable<MesInvItemBarcodes>()
- // .SetColumns(it => it.Quantity == it.Quantity - query.Num)
- // .Where(it => it.ItemBarcode == query.barcode)
- // .ExecuteCommand();
-
- // // 鏇存柊鍘熸潯鐮佹暟閲�
- // executeCommand += db.Updateable<MesInvItemStocks>()
- // .SetColumns(it => it.Quantity == it.Quantity - query.Num)
- // .Where(it => it.ItemBarcode == query.barcode)
- // .ExecuteCommand();
-
- // //// 鍒犻櫎鍘熸潯鐮佸簱瀛樿褰�
- // //executeCommand += db.Deleteable<MesInvItemStocks>()
- // // .Where(it => it.ItemBarcode == query.barcode)
- // // .ExecuteCommand();
-
- // // 鎻掑叆鍓╀綑鏉$爜鏁伴噺鐨勬柊搴撳瓨璁板綍
- // executeCommand += db.Insertable(new MesInvItemStocks
- // {
- // Guid = Guid.NewGuid(),
- // TaskNo = stockBarcode.TaskNo,
- // ItemBarcode = newBarcode,
- // ItemNo = stockBarcode.ItemNo,
- // LotNo = stockBarcode.LotNo,
- // Quantity = query.Num,
- // EpFlag = stockBarcode.EpFlag,
- // CustomerNo = stockBarcode.CustomerNo,
- // ItemWt = stockBarcode.ItemWt,
- // DepotsCode = stockBarcode.DepotsCode,
- // DepotsId = stockBarcode.DepotsId,
- // DepotSectionsCode = stockBarcode.DepotSectionsCode,
- // CheckDate = stockBarcode.CheckDate,
- // ItemType = stockBarcode.ItemType,
- // IndepDate = stockBarcode.IndepDate,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // IqcStatus = stockBarcode.IqcStatus,
- // BoardStyle = stockBarcode.BoardStyle,
- // WorkNo = stockBarcode.WorkNo,
- // WorkLine = stockBarcode.WorkLine,
- // SuppNo = stockBarcode.SuppNo,
- // ItemId = stockBarcode.ItemId
- // // UnitId = stockBarcode.ItemUnit
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鍐欏叆鏂版潯鐮佺殑浜ゆ槗璁板綍
- // executeCommand += db.Insertable(new MesInvBusiness2
- // {
- // Guid = Guid.NewGuid(),
- // Status = 1,
- // BillTypeId = 200, // p_bill_type_id
- // TransactionCode = "209", // p_transaction_no
- // BusinessType = 0,
- // ItemBarcode = newBarcode,
- // ItemNo = stockBarcode.ItemNo,
- // LotNo = stockBarcode.LotNo,
- // EpFlag = true,
- // Quantity = query.Num,
- // FromInvDepotsCode = null,
- // FromInvDepotSectionsCode = null,
- // ToInvDepotsCode = stockBarcode.DepotsCode,
- // ToInvDepotSectionsCode = stockBarcode.DepotSectionsCode,
- // Description = query.Type + "鎷嗗垎鐢熸垚",
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // TaskNo = stockBarcode.TaskNo,
- // BillNo = stockBarcode.BillNo,
- // WorkNo = stockBarcode.WorkNo,
- // WorkLine = stockBarcode.WorkLine,
- // SuppNo = stockBarcode.SuppNo,
- // SuppId = stockBarcode.SuppId,
- // ItemId = stockBarcode.ItemId
- // // CkDepot = stockBarcode.DepotsId
- // }).IgnoreColumns(true).ExecuteCommand();
- // }
- // else if (totalQty < query.Num)
- // {
- // throw new Exception("鍙戞枡鏁伴噺澶т簬鏉$爜鏁�,璇锋牳瀵癸紒");
- // }
-
- // //if (string.IsNullOrEmpty(newBarcode)) newBarcode = query.barcode;
-
- // // 妫�鏌ヨˉ鏂欏崟鐘舵��
- // var mesItemBl = Db.Queryable<MesItemBl>()
- // .Where(a => a.BlNo == query.blNo && (a.Bl018 ?? false) == true)
- // .First();
-
- // if (mesItemBl == null)
- // throw new Exception($"鐢宠鍗� {query.blNo} 宸叉挙鍥烇紒");
-
- // if (mesItemBl.Bl018 != true)
- // throw new Exception($"鐢宠鍗� {query.blNo} 鏈鏍革紒");
-
- // if (mesItemBl.Bl019 == true)
- // throw new Exception($"鐢宠鍗� {query.blNo} 宸插畬缁擄紒");
-
- // // 鑾峰彇琛ユ枡鍗曟槑缁嗗苟鏍¢獙
- // var blDetail = Db.Queryable<MesItemBlDetail>()
- // .Where(b =>
- // b.Mid == mesItemBl.Id && b.Bld012 == stockBarcode.ItemId)
- // .First();
-
- // if (blDetail == null)
- // throw new Exception($"鐢宠鍗曚笉瀛樺湪姝ょ墿鏂� {stockBarcode.ItemNo} 璇风‘璁わ紒");
-
- // var remainingQty = (blDetail.Bld007 ?? 0) - (blDetail.Bld008 ?? 0);
- // if (remainingQty == 0)
- // throw new Exception("鐗╂枡宸叉壂鐮佸畬鎴愶紝璇锋牳瀵癸紒");
-
- // if (query.Num > remainingQty)
- // throw new Exception(
- // $"鎷嗗垎鏁伴噺锛歿query.Num} 澶т簬寰呭彂鏂欐暟閲忥細{remainingQty}锛岃鏍稿锛�");
-
- // // 妫�鏌ュ伐鍗曚俊鎭�
- // var womdaa = Db.Queryable<Womdaa>()
- // .Where(a => a.Daa001 == query.billNo)
- // .First();
-
- // if (womdaa == null)
- // throw new Exception($"宸ュ崟 {query.billNo} 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- // var womdab = Db.Queryable<Womdab>()
- // .Where(b =>
- // b.Dab001 == query.billNo && b.Erpid == blDetail.Bld014)
- // .First();
-
- // if (womdab == null)
- // throw new Exception($"澶囨枡鏄庣粏涓嶅瓨鍦ㄦ鐗╂枡 {stockBarcode.ItemNo} 璇风‘璁わ紒");
-
- // // 妫�鏌ュ凡鍙戞枡鏁伴噺鏄惁瓒呰繃寰呭彂鏂欐暟閲�
- // var sumQty = db.Queryable<MesInvItemOutCDetails>()
- // .Where(it =>
- // it.TaskNo == query.blNo && it.ItemId == stockBarcode.ItemId)
- // .Sum(it => it.Quantity);
-
- // //if (sumQty > remainingQty)
- // // throw new Exception(
- // // $"鎷嗗垎鏁伴噺锛歿sumQty} 澶т簬寰呭彂鏂欐暟閲忥細{remainingQty}锛岃鏍稿锛�");
-
-
- // var depots = Db.Queryable<MesDepots>()
- // .Where(t => t.DepotId == stockBarcode.DepotId)
- // .First();
-
- // // 鑾峰彇鎴栧垱寤哄嚭搴撳崟
- // var itemOut = db.Queryable<MesInvItemOuts>()
- // .Where(a => a.TaskNo == query.blNo
- // && a.DepotId == stockBarcode.DepotId
- // && a.OutDate.Value.Date.ToString("yyyy-MM-dd") ==
- // DateTime.Now.Date.ToString("yyyy-MM-dd")
- // && a.BillTypeId == 200
- // && a.TransactionNo == 209
- // && a.Status == 0)
- // .First();
-
- // var outId = new Guid();
- // var outNo = "";
- // if (itemOut == null)
- // {
- // // 鍒涘缓鏂扮殑鍑哄簱鍗�
- // outId = Guid.NewGuid();
- // outNo = BillNo.GetBillNo(outNoType);
-
- // // 鎻掑叆鍑哄簱鍗曚富琛�
- // executeCommand += db.Insertable(new MesInvItemOuts
- // {
- // Guid = outId,
- // ItemOutNo = outNo,
- // TaskNo = query.blNo,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // BillTypeId = 200,
- // TransactionNo = 209,
- // Remark = mesItemBl.Bl007,
- // DepotCode = depots.DepotCode,
- // OutPart = womdaa.Daa013,
- // FType = 0,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // WorkNo = womdaa.Daa021,
- // BoardItem = womdaa.Daa002,
- // PbillNo = womdaa.Daa001,
- // OutDate = DateTime.Now,
- // Status = 0,
- // DepotId = stockBarcode.DepotId,
- // THORGID = stockBarcode.StockOrgId,
- // OutType = query.Type,
- // //BbillNo = query.blNo
- // }).IgnoreColumns(true).ExecuteCommand();
- // }
- // else
- // {
- // outId = itemOut.Guid;
- // outNo = itemOut.ItemOutNo;
- // }
-
- // // 妫�鏌ユ槸鍚﹀凡瀛樺湪鍑哄簱鍗曟槑缁�
- // var itemOutItemCount = db.Queryable<MesInvItemOutItems>()
- // .Where(it =>
- // it.ItemOutId == outId &&
- // it.ItemId == stockBarcode.ItemId &&
- // it.DepotId == stockBarcode.DepotId.ToString())
- // .Count();
-
- // if (itemOutItemCount == 0)
- // // 鎻掑叆鏂扮殑鍑哄簱鍗曟槑缁�
- // executeCommand += db.Insertable(new MesInvItemOutItems
- // {
- // Guid = Guid.NewGuid(),
- // ItemOutId = outId,
- // ItemNo = blDetail.Bld002,
- // Quantity = query.Num,
- // TlQty = query.Num,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // DepotCode = depots.DepotCode,
- // TaskNo = query.blNo,
- // WorkNo = womdaa.Daa021,
- // WorkLine = blDetail.Bld013,
- // ErpItemNo = womdab.Dab003,
- // ErpId = womdab.Eid,
- // ErpAutoid = womdab.Erpid,
- // PbillNo = query.billNo,
- // ItemId = blDetail.Bld012,
- // DepotId = stockBarcode.DepotId.ToString(),
- // ItemDabid = blDetail.Id,
- // // Unit = blDetail.Bld009,
- // // DepotId = (int)stockBarcode.DepotsId
- // }).IgnoreColumns(true).ExecuteCommand();
- // else
- // // 鏇存柊宸叉湁鍑哄簱鍗曟槑缁嗘暟閲�
- // executeCommand += db.Updateable<MesInvItemOutItems>()
- // .SetColumns(it => it.TlQty == (it.TlQty ?? 0) + query.Num)
- // .Where(it =>
- // it.ItemOutId == outId &&
- // it.ItemId == stockBarcode.ItemId &&
- // it.DepotId == stockBarcode.DepotId.ToString())
- // .ExecuteCommand();
-
- // // 鎻掑叆鍑哄簱鏉$爜鏄庣粏
- // executeCommand += db.Insertable(new MesInvItemOutCDetails
- // {
- // Guid = Guid.NewGuid(),
- // ItemOutId = outId,
- // ItemBarcode = newBarcode ?? query.barcode,
- // ItemNo = stockBarcode.ItemNo,
- // LotNo = stockBarcode.LotNo,
- // Quantity = query.Num,
- // ForceOutFlag = 0,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // DepotCode = depots.DepotCode,
- // DepotSectionCode = stockBarcode.DepotSectionsCode,
- // Remark = blDetail.Bld010,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // TaskNoy = mesItemBl.Bl013,
- // BoardStyle = mesItemBl.Bl002,
- // TaskNo = query.blNo,
- // WorkNo = blDetail.Bld001,
- // WorkLine = blDetail.Bld013,
- // SuppNo = stockBarcode.SuppNo,
- // PbillNo = query.billNo,
- // ItemId = blDetail.Bld012,
- // Unit = blDetail.Bld009,
- // DepotId = (int)stockBarcode.DepotId,
- // Dabid = womdab.Guid,
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆涓氬姟娴佹按
- // executeCommand += db.Insertable(new MesInvBusiness2
- // {
- // Guid = Guid.NewGuid(),
- // Status = 1,
- // BillTypeId = 200, // p_bill_type_id
- // TransactionCode = "209", // p_transaction_no
- // BusinessType = 1,
- // ItemBarcode = newBarcode ?? query.barcode,
- // ItemNo = stockBarcode.ItemNo,
- // LotNo = stockBarcode.LotNo,
- // EpFlag = true,
- // Quantity = query.Num,
- // FromInvDepotsCode = stockBarcode.DepotsCode,
- // FromInvDepotSectionsCode = stockBarcode.DepotSectionsCode,
- // Description = query.Type,
- // CreateBy = query.userName,
- // CreateDate = DateTime.Now,
- // LastupdateBy = query.userName,
- // LastupdateDate = DateTime.Now,
- // Factory = stockBarcode.Factory,
- // Company = stockBarcode.Company,
- // TaskNo = mesItemBl.Bl012,
- // BillNo = query.blNo,
- // WorkNo = blDetail.Bld001,
- // WorkLine = blDetail.Bld013,
- // SuppNo = stockBarcode.SuppNo,
- // ItemId = stockBarcode.ItemId
- // // CkDepot = stockBarcode.DepotsId
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鏇存柊宸ュ崟琛ㄦ暟閲�
- // executeCommand += db.Updateable<Womdab>()
- // .SetColumns(it => new Womdab
- // {
- // Dab007 = (it.Dab007 ?? 0) + query.Num, // 宸ュ崟鏁伴噺
- // Dab020 = (it.Dab020 ?? 0) + query.Num, // 宸插彂鏂欐暟閲�
- // Dab021 = (it.Dab021 ?? 0) + query.Num // 宸插彂鏂欐暟閲�
- // })
- // .Where(it => it.Guid == womdab.DaaGuid && it.Dab003 == womdab.Dab003)
- // .ExecuteCommand();
-
- // // 鏇存柊琛ユ枡鍗曟槑缁嗗凡琛ユ暟閲�
- // executeCommand += db.Updateable<MesItemBlDetail>()
- // .SetColumns(it => new MesItemBlDetail
- // {
- // Bld008 = (it.Bld008 ?? 0) + (int)query.Num
- // })
- // .Where(it => it.Id == blDetail.Id)
- // .ExecuteCommand();
-
- // // 鑾峰彇鏇存柊鍚庣殑琛ユ枡鍗曟槑缁嗘暟閲�
- // var updatedDetail = db.Queryable<MesItemBlDetail>()
- // .Where(it => it.Id == blDetail.Id)
- // .Select(it => new { it.Bld007, it.Bld008 })
- // .First();
-
- // if ((updatedDetail.Bld007 ?? 0) <= (updatedDetail.Bld008 ?? 0))
- // // 鏇存柊鏄庣粏瀹屾垚鐘舵��
- // executeCommand += db.Updateable<MesItemBlDetail>()
- // .SetColumns(it => new MesItemBlDetail { Bld011 = 1 })
- // .Where(it => it.Id == blDetail.Id)
- // .ExecuteCommand();
-
- // // 妫�鏌ユ槸鍚﹁繕鏈夋湭瀹屾垚鐨勬槑缁�
-
- // var unfinishedDetail = db.Queryable<MesItemBlDetail>()
- // .Where(it => it.Mid == mesItemBl.Id && (it.Bld011 ?? 0) == 0)
- // .First();
-
- // if (unfinishedDetail == null)
- // // 濡傛灉娌℃湁鎵惧埌鏈畬鎴愭槑缁嗭紝鍒欐洿鏂拌ˉ鏂欏崟鐘舵�佷负宸插畬鎴�
- // executeCommand += db.Updateable<MesItemBl>()
- // .SetColumns(it => new MesItemBl
- // {
- // Bl019 = true,
- // WcUser = query.userName,
- // WcTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
- // })
- // .Where(it => it.Id == mesItemBl.Id)
- // .ExecuteCommand();
-
- // if (executeCommand <= 1) throw new Exception("鏇存柊澶辫触");
-
-
- // // 鍒涘缓 鎻掑叆鏃ュ織
- // var logService = new LogService();
- // var LogMsg = "[PDA]" + query.Type + "銆傛潯鐮併��" + query.barcode + "銆� 鍑哄簱鍗曞彿銆�" + outNo + "銆�";
- // logService.CreateLog(db, query.userName, womdaa.Guid.ToString(), "WOMDAA", LogMsg, womdaa.Daa001);
-
-
- // return executeCommand;
- //}) > 0;
-
- //// 鑾峰彇鏈�缁堢殑寰呭彂鏂欐槑缁嗗垪琛�
- //var pendingList = Db.Queryable<MesItemBl, MesItemBlDetail>((a, b) =>
- // new JoinQueryInfos(JoinType.Left, a.Id == b.Mid))
- // .Where((a, b) => a.BlNo == query.blNo
- // && (b.Bld007 ?? 0) - (b.Bld008 ?? 0) > 0)
- // .Select((a, b) => new MesItemBlDetail
- // {
- // Bld012 = b.Bld012,
- // Bld002 = b.Bld002,
- // Bld003 = b.Bld003,
- // Bld004 = b.Bld004,
- // Bld007 = b.Bld007,
- // Bld008 = b.Bld008
- // })
- // .ToList();
-
- //return (success, pendingList);
+ return dto;
}
+ // 鑾峰彇浜х嚎鍒楄〃
+ public dynamic GetLineInfo(dynamic unity, dynamic RequestInfo)
+ {
+ var orgId = RequestInfo.OrgId;
+ var sqlParams = new List<SugarParameter>
+ {
+ new("@orgId", orgId)
+ };
+
+ var sql2 = new StringBuilder("exec prc_pda_itemBl_lineInfo @orgId");
+
+ var LineInfo = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ return LineInfo;
+ }
#endregion
#region 鐢熶骇瓒呴
@@ -1492,7 +657,7 @@
PbillNo = query.billNo,
ItemId = blDetail.Bld012,
Unit = blDetail.Bld009,
- DepotId = (int)stockBarcode.DepotsId,
+ DepotId = (int)stockBarcode.DepotId,
Dabid = womdab.Guid,
}).IgnoreColumns(true).ExecuteCommand();
@@ -1683,7 +848,7 @@
EpFlag = stockBarcode.EpFlag,
CustomerNo = stockBarcode.CustomerNo,
DepotsCode = stockBarcode.DepotsCode,
- DepotsId = stockBarcode.DepotsId,
+ DepotsId = stockBarcode.DepotId,
DepotSectionsCode = stockBarcode.DepotSectionsCode,
CheckDate = stockBarcode.CheckDate,
ItemType = stockBarcode.ItemType,
@@ -1895,7 +1060,7 @@
PbillNo = query.billNo,
ItemId = blDetail.Bld012,
Unit = blDetail.Bld009,
- DepotId = (int)stockBarcode.DepotsId,
+ DepotId = (int)stockBarcode.DepotId,
LineK3id = workOrderDetail.Erpid,
EbelnK3id = workOrderDetail.Eid
}).IgnoreColumns(true).ExecuteCommand();
@@ -2044,7 +1209,7 @@
fROM MES_ITEM_BL_DETAIL A
LEFT JOIN MES_ITEM_BL B ON A.MID = B.ID
LEFT JOIN MES_ITEMS C ON A.bld012 = CAST(C.item_id AS VARCHAR(50))
- LEFT JOIN WOMDAA D ON B.about_guid = D.guid
+ LEFT JOIN WW_GD D ON B.about_guid = D.ID
WHERE B.bl_no = '{0}'", query.billNo);
var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql);
diff --git a/service/Warehouse/MesItemQtManager.cs b/service/Warehouse/MesItemQtManager.cs
index 50c0199..a254c1e 100644
--- a/service/Warehouse/MesItemQtManager.cs
+++ b/service/Warehouse/MesItemQtManager.cs
@@ -1,9 +1,13 @@
-锘縰sing NewPdaSqlServer.DB;
+锘縰sing Masuit.Tools;
+using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using SqlSugar;
+using System.Data;
+using System.Data.SqlClient;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace NewPdaSqlServer.service.Warehouse;
@@ -14,17 +18,33 @@
/// 鑾峰彇鏈畬鎴愮殑閫�鏂欏崟鍙峰垪琛�
/// </summary>
/// <returns>閫�鏂欏崟鍙峰垪琛�</returns>
- public List<string> GetPendingQtList()
- {
- const string sql = @"SELECT qtck
- FROM MES_ITEM_QT
- WHERE qt015 = 1
- AND qt026 = 1
- AND QT029 = 1
- AND qt032 = 1
- AND QT014 = 0 ";
+ public dynamic GetPendingQtList(dynamic RequestInfo)
+ {
+ var orgId = RequestInfo.OrgId;
- return Db.Ado.SqlQuery<string>(sql);
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鑾峰彇鏈畬鎴愮殑閫�鏂欏崟鍙峰垪琛�
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ // 杩斿洖鍗曞彿瀛楃涓插垪琛�
+ var blDetails = Db.Ado.SqlQuery<string>(
+ "EXEC prc_pda_qtck_list @pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ return blDetails;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
@@ -32,61 +52,48 @@
/// </summary>
/// <param name="query">浠撳簱鏌ヨ鍙傛暟锛屽寘鍚敤鎴峰悕鍜屽崟鎹彿</param>
/// <returns>寰呭鐞嗙殑閫�鏂欏崟鏄庣粏鍒楄〃</returns>
- public ProductionPickDto GetPendingQtList(WarehouseQuery query)
+ public dynamic GetPendingQtDetailList(dynamic query, dynamic RequestInfo)
{
- // 浠庢煡璇㈠弬鏁颁腑鑾峰彇鐢ㄦ埛鍚嶅拰鍗曟嵁鍙�
- var c_User = query.userName;
- var p_bill_no = query.billNo;
+ var orgId = RequestInfo.OrgId;
- // 鏍规嵁鍗曟嵁鍙锋煡璇㈤��鏂欏崟涓昏〃淇℃伅
- var mesItemQt = Db.Queryable<MesItemQt>()
- .Where(it => it.Qtck == p_bill_no)
- .First();
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
- // 濡傛灉鏈壘鍒伴��鏂欏崟锛屾姏鍑哄紓甯�
- if (mesItemQt == null) throw new Exception($"鏈煡璇㈠埌姝ゅ叾浠栧叆搴撶敵璇峰崟 {p_bill_no}");
-
- //// 妫�鏌ラ��鏂欏崟鐨勫鏍哥姸鎬�(Qt015)锛屾湭瀹℃牳鍒欐姏鍑哄紓甯�
- //if (mesItemQt.Qt015 == false)
- // throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 鏈鏍革紝璇风‘璁わ紒");
-
- // 妫�鏌ラ��鏂欏崟鐨勫畬缁撶姸鎬�(Qt014)锛屽凡瀹岀粨鍒欐姏鍑哄紓甯�
- if (mesItemQt.Qt014 == true)
- throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 宸插畬缁擄紝璇风‘璁わ紒");
-
- var sql = @"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,
- ISNULL(A.qd007,0) FQty,ISNULL(A.qd008,0) SQty,ISNULL(A.qd007,0) - ISNULL(A.qd008,0) DSQty,
- dbo.F_QX_GETRECODEPOTSE(A.itemId,'','','') as RecoKw
- FROM MES_ITEM_QT_DATALL A
- LEFT JOIN MES_ITEM_QT B ON A.qtGuid = B.guid
- LEFT JOIN MES_ITEMS C ON A.itemId = C.item_id
- WHERE B.qtck = @billNo AND (qt015 = 1 AND qt026 =1 AND QT029 = 1 AND qt032 = 1)";
-
- var sqlParams = new List<SugarParameter> {
- new("@billNo", query.billNo)
+ var parameters = new[]
+{
+ new SugarParameter("@billNo",query.billNo),
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
};
-
- var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql, sqlParams);
-
- // 妫�鏌ラ��鏂欏崟鐨勫畬缁撶姸鎬�(Qt014)锛屽凡瀹岀粨鍒欐姏鍑哄紓甯�
- if (womdabs.Count < 1)
- throw new Exception($"璇ュ叾浠栧嚭搴撶敵璇峰崟 {p_bill_no} 鏈叏閮ㄥ鏍革紝璇风‘璁わ紒");
-
- var DS_list = womdabs.Where(s => s.DSQty > 0).ToList();
-
- var YS_list = womdabs.Where(s => s.SQty > 0).ToList();
-
- var dto = new ProductionPickDto
+ try
{
- //daa001 = womdaa.Daa001,
- //PlanNo = womcaa.Caa020,
- items = DS_list,
- Ysitems = YS_list
- };
-
- return dto;
+ List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_qtck_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ var items = blDetails.Where(x => x.DSQty > 0).ToList(); // 寰呮壂鐗╂枡
+ var ysitems = blDetails.Where(x => x.SQty > 0).ToList(); // 宸叉壂鐗╂枡
+ return new
+ {
+ items = items,
+ ysitems = ysitems,
+ allList = blDetails,
+ };
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
}
+ /// <summary>
+ /// 鎵爜鍑哄簱
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
public (WarehouseQuery form, List<MesItemQtDatall> item, string message)
OutScanBarcode(
WarehouseQuery query)
@@ -115,6 +122,9 @@
if (barcode == null)
throw new Exception($"mes涓笉瀛樺湪姝ゆ潯鐮�,璇锋牳瀵癸紒{p_item_barcode}");
+
+
+
// 鑾峰彇搴撳瓨淇℃伅
var stock = Db.Queryable<MesInvItemStocks>()
@@ -149,11 +159,6 @@
if (mesItemQt == null)
throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 涓嶅瓨鍦紝璇风‘璁わ紒");
- // 妫�鏌ヤ粨搴撴槸鍚︿竴鑷�
- if (Convert.ToInt32(mesItemQt.Qt008) != stock.DepotId)
- throw new Exception(
- $"鎵爜鍑鸿揣浠撳簱id{mesItemQt.Qt008}涓庡叾浠栧嚭搴撶敵璇蜂粨搴搟stock.DepotId}涓嶄竴鑷达紝璇锋牳瀵癸紒");
-
// 鑾峰彇鍑哄簱鍗曟槑缁�
var qtDetail = Db.Queryable<MesItemQtDatall>()
.Where(it =>
@@ -162,6 +167,19 @@
.First();
if (qtDetail == null) throw new Exception("鎵爜鐗╂枡闈炴湰娆″嚭搴撶敵璇风墿鏂欙紝璇锋牳瀵癸紒");
+
+
+ if (mesItemQt.Qt014 == true)
+ throw new Exception($"鍏朵粬鍑哄簱鐢宠鍗� {p_bill_no} 宸插畬缁擄紝璇风‘璁わ紒");
+
+ // 妫�鏌ヤ粨搴撴槸鍚︿竴鑷�
+ if (qtDetail.DepotId != stock.DepotId)
+ throw new Exception(
+ $"鎵爜鍑鸿揣浠撳簱id{qtDetail.DepotId}涓庡叾浠栧嚭搴撶敵璇蜂粨搴搟stock.DepotId}涓嶄竴鑷达紝璇锋牳瀵癸紒");
+
+
+
+
// 妫�鏌ュ墿浣欐暟閲�
var remainingQty = (qtDetail.Qd007 ?? 0) - (qtDetail.Qd008 ?? 0);
@@ -191,6 +209,8 @@
var message =
$"璇风‘璁ゅ彂鏂欐暟閲忥紒锛佸凡甯﹀嚭婊¤冻鍏朵粬鍑哄簱鍗曠殑鍙戞枡鏁伴噺 {remainingQty} 纭鍚庤鐐瑰嚮鏉$爜鎷嗗垎";
+
+ throw new Exception($"鏉$爜鏁伴噺瓒呭嚭鍙戞枡鏁伴噺锛岃鎷嗗垎鍚庡啀鎵弿锛�");
query.itemNo = stock.ItemNo;
query.Num = stock.Quantity;
@@ -456,6 +476,12 @@
return (query, mesItemQtDatalls, mess);
}
+ /// <summary>
+ /// 鎷嗗垎鏉$爜骞跺嚭搴�
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
public (WarehouseQuery form, List<MesItemQtDatall> item, string message)
PrintQtckBarcode(
WarehouseQuery query)
@@ -859,4 +885,140 @@
});
return (query, mesItemQtDatalls, message);
}
+
+
+ /// <summary>
+ /// 鍏朵粬鍑哄簱锛堟柊锛夊瓨鍌ㄨ繃绋�
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public ProductionPickDto ScanCode(WarehouseQuery query)
+ {
+ var _strMsg = "";
+ var _intSum = "";
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
+ if (query.billNo.IsNullOrEmpty()) throw new Exception("鐢宠鍗曞彿涓嶅厑璁镐负绌�"); if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
+
+ using (var cmd = new SqlCommand("[prc_pda_QTCK]", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@outMsg", SqlDbType.NVarChar, 300),
+ new("@outSum", SqlDbType.NVarChar, 300),
+ new("@barcode_num", SqlDbType.NVarChar, 300),
+ new("@split_num", SqlDbType.NVarChar, 300),
+ new("@c_User", query.userName),
+ new("@p_biLL_no", query.billNo),
+ new("@p_item_barcode", query.barcode)
+ };
+ parameters[0].Direction = ParameterDirection.Output;
+ parameters[1].Direction = ParameterDirection.Output;
+ parameters[2].Direction = ParameterDirection.Output;
+ parameters[3].Direction = ParameterDirection.Output;
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+ cmd.ExecuteNonQuery();
+ _strMsg = parameters[0].Value.ToString();
+ _intSum = parameters[1].Value.ToString();
+
+ var barcodeNum = parameters[2].Value.ToString();
+ var splitNum = parameters[3].Value.ToString();
+
+ var result = Convert.ToInt32(_intSum);
+ if (result <= 0) throw new Exception(_strMsg);
+
+ var dto = new ProductionPickDto
+ {
+ daa001 = query.billNo,
+ barcodeNum = barcodeNum,
+ splitNum = splitNum,
+ barcode = query.barcode,
+ result = result.ToString()
+ };
+
+ return dto;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
+
+
+ public ProductionPickDto ScanCodeCF(WarehouseQuery query)
+ {
+ if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
+ if (query.billNo.IsNullOrEmpty()) throw new Exception("鐢宠鍗曞彿涓嶅厑璁镐负绌�");
+ if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
+
+ if (query.Num is null or 0) throw new Exception("鏉$爜鎷嗗垎鏁颁笉鍏佽涓虹┖鎴栬�呬负0");
+
+ var _strMsg = "";
+ var _intSum = "";
+ var _cfBar = "";//鎷嗗垎鍚庢潯鐮�
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("[prc_pda_QTCK_CF]", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@outMsg", SqlDbType.NVarChar, 2000),
+ new("@outSum", SqlDbType.NVarChar, 300),
+ new("@outCfBar", SqlDbType.NVarChar, 300),
+ new("@c_User", query.userName),
+ new("@p_biLL_no", query.billNo),
+ new("@p_item_barcode", query.barcode),
+ new("@num", query.Num)
+ };
+ parameters[0].Direction = ParameterDirection.Output;
+ parameters[1].Direction = ParameterDirection.Output;
+ parameters[2].Direction = ParameterDirection.Output;
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+ cmd.ExecuteNonQuery();
+ _strMsg = parameters[0].Value.ToString();
+ _intSum = parameters[1].Value.ToString();
+ _cfBar = parameters[2].Value.ToString();
+
+
+ var result = Convert.ToInt32(_intSum);
+ if (result <= 0) throw new Exception(_strMsg);
+
+ var dto = new ProductionPickDto
+ {
+ daa001 = query.billNo,
+ barcode = query.barcode,//鍘熸潯鐮�
+ cfBarcode = _cfBar//鎷嗗垎鍚庢潯鐮�
+ };
+
+ return dto;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/service/Warehouse/MesItemQtrkManager.cs b/service/Warehouse/MesItemQtrkManager.cs
index 9eb138c..9443399 100644
--- a/service/Warehouse/MesItemQtrkManager.cs
+++ b/service/Warehouse/MesItemQtrkManager.cs
@@ -10,61 +10,71 @@
public class MesItemQtrkManager : Repository<MesItemQtrk>
{
- public List<string> GetQtckList()
+ public dynamic GetQtckList(dynamic RequestInfo)
{
- //return Db.Queryable<MesItemQtrk>()
- // .Where(x => (x.Qt015 ?? 0) == 1 && (x.Qt014 ?? 0) == 0)
- // .Select(x => x.Qtck)
- // .ToList();
+ var orgId = RequestInfo.OrgId;
- const string sql = @"SELECT qtck
- FROM MES_ITEM_QTRK
- WHERE QT015 = 1 AND QT028 = 1 AND QT032 = 1
- AND QT014 = 0 ";
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
- return Db.Ado.SqlQuery<string>(sql);
- }
-
- public ProductionPickDto GetQtckDetailList(WarehouseQuery query)
- {
- // 鍏宠仈鏌ヨ鐗╂枡琛ㄣ�佺墿鏂欐槑缁嗚〃鍜岀墿鏂欏熀纭�淇℃伅琛�
- if (string.IsNullOrEmpty(query.billNo)) throw new Exception("鐢宠鍗曞彿涓虹┖");
-
- var mesInvItemOuts = base.GetSingle(it => it.Qtck == query.billNo);
- if (mesInvItemOuts == null) throw new Exception("鍏朵粬鍏ュ簱鐢宠鍗曚笉瀛樺湪");
-
- var sql = @"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,
- ISNULL(A.qd007,0) FQty,ISNULL(A.qd008,0) SQty,ISNULL(A.qd007,0) - ISNULL(A.qd008,0) DSQty
- FROM MES_ITEM_QTRR_DETAIL A
- LEFT JOIN MES_ITEM_QTRK B ON A.qtrkGuid = B.guid
- LEFT JOIN MES_ITEMS C ON A.itemId = C.item_id
- WHERE B.qtck = @billNo AND QT015 = 1 AND QT028 = 1 AND QT032 = 1 AND QT014 = 0 ";
-
- var sqlParams = new List<SugarParameter> {
- new("@billNo", query.billNo)
- };
-
- var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql, sqlParams);
-
- if (womdabs.Count < 1)
- throw new Exception($"璇ュ叾浠栧叆搴撶敵璇峰崟 {query.billNo} 鏈叏閮ㄥ鏍告垨宸插畬缁擄紝璇风‘璁わ紒");
-
- var DS_list = womdabs.Where(s => s.DSQty > 0).ToList();
-
- var YS_list = womdabs.Where(s => s.SQty > 0).ToList();
-
- var dto = new ProductionPickDto
+ // 鑾峰彇鏈畬鎴愮殑閫�鏂欏崟鍙峰垪琛�
+ var parameters = new[]
{
- //daa001 = womdaa.Daa001,
- //PlanNo = womcaa.Caa020,
- items = DS_list,
- Ysitems = YS_list
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
};
-
- return dto;
+ try
+ {
+ // 杩斿洖鍗曞彿瀛楃涓插垪琛�
+ var blDetails = Db.Ado.SqlQuery<string>(
+ "EXEC prc_pda_qtrk_list @pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ return blDetails;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
- public string ScanInDepotsQT(WarehouseQuery query)
+ public dynamic GetQtckDetailList(dynamic query, dynamic RequestInfo)
+ {
+ var orgId = RequestInfo.OrgId;
+
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ var parameters = new[]
+{
+ new SugarParameter("@billNo",query.billNo),
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_qtrk_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ var items = blDetails.Where(x => x.DSQty > 0).ToList(); // 寰呮壂鐗╂枡
+ var ysitems = blDetails.Where(x => x.SQty > 0).ToList(); // 宸叉壂鐗╂枡
+ return new
+ {
+ items = items,
+ ysitems = ysitems
+ };
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
+ }
+
+ public dynamic ScanInDepotsQT(WarehouseQuery query)
{
var sectionCode = query.sectionCode;
var billNo = query.billNo;
@@ -72,31 +82,24 @@
// 1. 楠岃瘉搴撲綅鏉$爜鏄惁涓虹┖
if (string.IsNullOrEmpty(sectionCode)) throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
- // 2. 鏌ヨ搴撲綅瀵瑰簲鐨勪粨搴撶紪鐮�
- var depotId = Db.Queryable<MesDepotSections, MesDepots>(
- (a, b) => new JoinQueryInfos(
- JoinType.Inner, a.DepotGuid == b.Guid))
- .Where((a, b) => a.DepotSectionCode == sectionCode)
- .Select((a, b) => b.DepotId)
- .First();
+ var sqlParams = new List<SugarParameter> { new("@sectionCode", sectionCode) };
- if (depotId == null)
+ var sql2 = @" SELECT TOP 1 b.depot_code,
+ b.depot_id,
+ B.FSubsidiary,
+ B.depot_name
+ FROM MES_DEPOT_SECTIONS a
+ INNER JOIN
+ MES_DEPOTS b ON a.depot_guid = b.Guid
+ WHERE a.depot_section_code = @sectionCode;";
+
+ var depotInfo = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams).First();
+
+ if (depotInfo is null)
throw new Exception($"搴撲綅缂栫爜 {sectionCode} 涓嶅瓨鍦紝璇风‘璁わ紒");
- // 3. 鏌ヨ鐢宠鍗曞搴旂殑浠撳簱
- var qtrk = Db.Queryable<MesItemQtrk>()
- .Where(x => x.Qtck == billNo)
- .Select(x => x.Qt008)
- .First();
-
- if (qtrk == null) throw new Exception($"搴撲綅缂栫爜 {sectionCode} 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- // 4. 楠岃瘉搴撲綅鏄惁灞炰簬鐢宠浠撳簱
- if (depotId != Convert.ToInt32(qtrk))
- throw new Exception($"鎵爜搴撲綅 {sectionCode} 涓嶅睘浜庣敵璇蜂粨搴�!");
-
// 5. 杩斿洖鎴愬姛淇℃伅
- return $"浠撳簱锛歿qtrk} 搴撲綅锛歿sectionCode}";
+ return depotInfo;
}
public (WarehouseQuery form, List<MesItemQtrrDetail> item)
@@ -127,6 +130,20 @@
var c_depot_code = depotInfo.DepotCode;
var c_depot_id = depotInfo.DepotId;
+
+ var sqlParams = new List<SugarParameter> { new("@barcode", p_item_barcode), new("@billNo", p_bill_no) };
+
+// var sql1 = @" SELECT TOP 1 A.rkCkId
+//FROM MES_QA_ITEMS_DETECT_01 A
+// LEFT JOIN MES_INV_ITEM_BARCODES B ON A.item_id = B.ITEM_ID
+//WHERE order_type = '鍏跺畠鍏ュ簱妫�'
+// AND A.lot_no = @billNo
+// AND ITEM_BARCODE = @barcode ";
+
+// var appDepotInfo = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams).First();
+
+
+
var mesDepost = Db.Queryable<MesDepots>()
.Where(s => s.DepotId == c_depot_id).First();
@@ -164,9 +181,30 @@
if (qtrk == null) throw new Exception("鍏朵粬鍏ュ簱鐢宠鍗曚笉瀛樺湪锛�");
- // 楠岃瘉搴撲綅鏄惁灞炰簬鐢宠浠撳簱
- if (c_depot_id != Convert.ToInt32(qtrk.Qt008))
- throw new Exception($"鎵爜搴撲綅 {p_section_code} 涓嶅睘浜庣敵璇蜂粨搴�!");
+
+ if (qtrk.Qt008 != c_depot_id.ToString())
+ throw new Exception($"璇� {p_section_code} 瀵瑰簲鐨勪粨搴� 涓� 妫�楠屽垽瀹氱殑鍏ュ簱浠撳簱涓嶄竴鑷达紝璇风‘璁わ紒");
+
+ var sql = @"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,
+ ISNULL(A.qd007,0) FQty,ISNULL(A.qd008,0) SQty,ISNULL(A.qd007,0) - ISNULL(A.qd008,0) DSQty
+ FROM MES_ITEM_QTRR_DETAIL A
+ LEFT JOIN MES_ITEM_QTRK B ON A.qtrkGuid = B.guid
+ LEFT JOIN MES_ITEMS C ON A.itemId = C.item_id
+ WHERE B.qtck = @billNo AND QT015 = 1 AND QT028 = 1 AND QT032 = 1 AND QT014 = 0 ";
+ //AND QT014 = 0
+
+ var sqlParams1 = new List<SugarParameter> {
+ new("@billNo", p_bill_no)
+ };
+
+ var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql, sqlParams1);
+
+ if (womdabs.Count < 1)
+ throw new Exception($"璇ュ叾浠栧叆搴撶敵璇峰崟 {query.billNo} 鏈叏閮ㄥ鏍告垨宸插畬缁擄紝璇风‘璁わ紒");
+
+ //// 楠岃瘉搴撲綅鏄惁灞炰簬鐢宠浠撳簱
+ //if (c_depot_id != Convert.ToInt32(qtrk.Qt008))
+ // throw new Exception($"鎵爜搴撲綅 {p_section_code} 涓嶅睘浜庣敵璇蜂粨搴�!");
// 6. 鏌ヨ鐢宠鍗曟槑缁�
var detail = Db.Queryable<MesItemQtrrDetail>()
diff --git a/service/Warehouse/MesItemTblManager.cs b/service/Warehouse/MesItemTblManager.cs
index b31d262..f3c05df 100644
--- a/service/Warehouse/MesItemTblManager.cs
+++ b/service/Warehouse/MesItemTblManager.cs
@@ -20,15 +20,34 @@
/// 鑾峰彇鐢熶骇閫�鏂欏崟鍙峰垪琛�
/// </summary>
/// <returns>閫�鏂欏崟鍙峰垪琛�</returns>
- public List<string> GetSCTLBillNo(WarehouseQuery query)
+ public dynamic GetSCTLBillNo(WarehouseQuery query, dynamic RequestInfo)
{
- var list = Db.Queryable<MesItemTbl>()
- .Where(s => (s.Tbl013 ?? 0) == 1 // 瀹℃牳閫氳繃
- && (s.Tbl020 ?? 0) == 0
- && s.Tbl008 == query.Type)
- .Select(s => s.BillNo).ToList();
+ var orgId = RequestInfo.OrgId;
- return list;
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鑾峰彇鏈畬鎴愮殑閫�鏂欏崟鍙峰垪琛�
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@type", query.Type),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ // 杩斿洖鍗曞彿瀛楃涓插垪琛�
+ var blDetails = Db.Ado.SqlQuery<string>(
+ "EXEC prc_pda_sctl_list @pi_orgId,@type,@inP1,@inP2,@inP3,@inP4", parameters);
+ return blDetails;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
@@ -36,45 +55,50 @@
/// </summary>
/// <param name="query">浠撳簱鏌ヨ鍙傛暟</param>
/// <returns>鐗╂枡鏄庣粏鍒楄〃</returns>
- public ProductionPickDto GetMesItemTblDetailByBillNo(
- WarehouseQuery query)
+ public dynamic GetMesItemTblDetailByBillNo(dynamic query, dynamic RequestInfo)
{
- // 鍏宠仈鏌ヨ鐗╂枡琛ㄣ�佺墿鏂欐槑缁嗚〃鍜岀墿鏂欏熀纭�淇℃伅琛�
- var mesItemTblDetails = Db
- .Queryable<MesItemTbl, MesItemTblDetail, MesItems>(
- (a, b, c) => new JoinQueryInfos(
- JoinType.Left,
- a.Id == b.Tlmid,
- JoinType.Left,
- b.Tld009 == c.Id)
- ).Where((a, b, c) => a.BillNo == query.billNo && (a.Tbl013 ?? 0) == 1)
- .Select<ItemDetailModel>((a, b, c) => new ItemDetailModel
- {
- FQty = b.Tld005 ?? 0, // 寰呴��鏁伴噺
- SQty = b.Tld006 ?? 0, // 宸查��鏁伴噺
- DSQty = (b.Tld005 ?? 0) - (b.Tld006 ?? 0),
- ItemNo = c.ItemNo, // 鐗╂枡缂栧彿
- ItemName = c.ItemName, // 鐗╂枡鍚嶇О
- ItemModel = c.ItemModel // 鐗╂枡鍨嬪彿
- }).ToList();
+ if (string.IsNullOrEmpty(query.billNo))
+ throw new Exception("璇烽�夊崟鎹彿锛�");
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
- if (mesItemTblDetails.Count<1)
- throw new Exception("璇ョ敵璇峰崟銆�" + query.billNo + "銆� 鏄庣粏涓嶅瓨鍦紝璇风‘璁わ紒");
+ if (string.IsNullOrEmpty(query.billNo?.ToString()))
+ throw new ArgumentException("鍗曟嵁鍙蜂笉鑳戒负绌�", nameof(query.billNo));
- var DS_list = mesItemTblDetails.Where(s => s.DSQty > 0).ToList();
+ var orgId = RequestInfo.OrgId;
- var YS_list = mesItemTblDetails.Where(s => s.SQty > 0).ToList();
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
- var itemTblDetails = new ProductionPickDto
+ // 鑾峰彇鏈畬鎴愮殑閿�鍞��璐ф槑缁�
+ var parameters = new[]
+{
+ new SugarParameter("@billNo", query.billNo),
+ new SugarParameter("@pi_orgId",orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
{
- items = DS_list,
- Ysitems = YS_list
- // yisao = mesInvItemOutCDetailsList
- };
-
-
- return itemTblDetails;
+ List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_sctl_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ var items = blDetails.Where(x => x.DSQty > 0).ToList(); // 寰呮壂鐗╂枡
+ var ysitems = blDetails.Where(x => x.SQty > 0).ToList(); // 宸叉壂鐗╂枡
+ return new
+ {
+ items = items,
+ ysitems = ysitems,
+ Count = items.Count + ysitems.Count
+ };
+ }
+ catch (Exception ex)
+ {
+ // 淇濆紓甯稿鐞嗛�昏緫
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
@@ -109,24 +133,23 @@
/// </summary>
/// <param name="query">浠撳簱鏌ヨ鍙傛暟</param>
/// <returns>澶勭悊缁撴灉</returns>
- public WarehouseQuery SctlScanBarcode(WarehouseQuery query)
+ public dynamic SctlScanBarcode(WarehouseQuery query,dynamic RequestInfo)
{
-
- // 2. 楠岃瘉鏉$爜淇℃伅
+ // 楠岃瘉鏉$爜淇℃伅
var barcode = Db.Queryable<MesInvItemBarcodes>()
.Where(x => x.ItemBarcode == query.barcode)
.First();
if (barcode == null)
throw new Exception($"鏃犳鏉$爜锛岃鏍稿锛亄query.barcode}");
- // 3. 楠岃瘉鐗╂枡淇℃伅
+ // 楠岃瘉鐗╂枡淇℃伅
var item = Db.Queryable<MesItems>()
.Where(x => x.Id == barcode.ItemId)
.First();
if (item == null)
throw new Exception($"鏃犳鐗╂枡锛岃鏍稿锛亄query.barcode}");
- // 4. 楠岃瘉閫�鏂欏崟淇℃伅
+ // 楠岃瘉閫�鏂欏崟淇℃伅
var returnOrder = Db.Queryable<MesItemTbl>()
.Where(x => x.BillNo == query.billNo && (x.Tbl013 ?? 0) == 1)
.First();
@@ -136,512 +159,64 @@
if (returnOrder.Tbl020 == 1)
throw new Exception("鎵爜瀹屾垚,鐢宠鍗曞凡瀹岀粨!");
- // 5. 浣跨敤瀛樺偍杩囩▼澶勭悊鐢熶骇閫�鏂�
- var parameters = new SqlParameter[]
+ // 楠岃瘉缁勭粐鏄惁瀛樺湪
+ var orgId = RequestInfo.OrgId;
+
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鐢熶骇閫�鏂�
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ using (var cmd = new SqlCommand("PRC_PDA_SCTL", conn))
{
- new SqlParameter("@pi_user", query.userName),
- new SqlParameter("@pi_barcode", query.barcode),
- new SqlParameter("@pi_bill_no", query.billNo),
- new SqlParameter("@pi_section_code", query.DepotCode),
- new SqlParameter("@PI_INP1", DBNull.Value), // 澶囩敤鍙傛暟1
- new SqlParameter("@PI_INP2", DBNull.Value), // 澶囩敤鍙傛暟2
- new SqlParameter("@PO_OUT_MSG", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new SqlParameter("@PO_OUT_SUM", SqlDbType.Int) { Direction = ParameterDirection.Output },
- new SqlParameter("@PO_ITEM_NO", SqlDbType.NVarChar, 100) { Direction = ParameterDirection.Output },
- new SqlParameter("@PO_QUANTITY", SqlDbType.Decimal) { Direction = ParameterDirection.Output }
- };
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
- string procedureName = "PRC_PDA_SCTL";
- int res = DbHelperSQL.RunProcedure_NonQuery(procedureName, parameters);
+ var parameters = new[]
+ {
+ new SqlParameter("@PI_USER", query.userName),
+ new SqlParameter("@PI_BARCODE", query.barcode),
+ new SqlParameter("@PI_BILL_NO", query.billNo),
+ new SqlParameter("@PI_SECTION_CODE", query.DepotCode),
+ new SqlParameter("@pi_orgId", orgId),
+ new SqlParameter("@PI_INP1", DBNull.Value),
+ new SqlParameter("@PI_INP2", DBNull.Value),
+ new SqlParameter("@PO_OUT_MSG", SqlDbType.NVarChar) { Direction = ParameterDirection.Output, Size = 2000 },
+ new SqlParameter("@PO_OUT_SUM", SqlDbType.Int) { Direction = ParameterDirection.Output },
+ new SqlParameter("@PO_ITEM_NO", SqlDbType.NVarChar) { Direction = ParameterDirection.Output, Size = 100 },
+ new SqlParameter("@PO_QUANTITY", SqlDbType.Decimal)
+ {
+ Direction = ParameterDirection.Output,
+ Precision = 18, // 鏍规嵁瀹為檯鏁版嵁搴撶簿搴﹁皟鏁�
+ Scale = 10 // 鏍规嵁瀹為檯鏁版嵁搴撳皬鏁颁綅璋冩暣
+ }
+ };
- // 鑾峰彇杈撳嚭鍙傛暟
- var outMsg = parameters[6].Value?.ToString() ?? string.Empty;
- var outSum = parameters[7].Value != DBNull.Value ? Convert.ToInt32(parameters[7].Value) : -1;
- var itemNo = parameters[8].Value?.ToString() ?? string.Empty;
- var quantity = parameters[9].Value != DBNull.Value ? Convert.ToDecimal(parameters[9].Value) : 0m;
+ cmd.Parameters.AddRange(parameters);
+ cmd.ExecuteNonQuery();
- // 妫�鏌ュ瓨鍌ㄨ繃绋嬫墽琛岀粨鏋�
- if (outSum == -1)
- {
- throw new Exception(outMsg);
+ var outMsg = parameters[7].Value?.ToString() ?? string.Empty;
+ var outSum = parameters[8].Value != DBNull.Value ? Convert.ToInt32(parameters[8].Value) : -1;
+ var itemNo = parameters[9].Value?.ToString() ?? string.Empty;
+ var quantity = parameters[10].Value != DBNull.Value ? Convert.ToDecimal(parameters[10].Value) : 0m;
+
+ if (outSum == -1) throw new Exception(outMsg);
+
+ query.itemNo = itemNo;
+ query.Num = quantity;
+ query.message = outMsg;
+ return query;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
}
-
- query.itemNo = itemNo;
- query.Num = quantity;
- return query;
-
-
- //var p_item_barcode = query.barcode; // 鐗╂枡鏉$爜
- //var p_bill_no = query.billNo; // 鍗曟嵁鍙�
- //var p_section_code = query.DepotCode; // 搴撲綅缂栫爜
- //var c_user = query.userName; // 鐢ㄦ埛鍚�
-
- //var p_bill_type_id = 100; // 鍗曟嵁绫诲瀷ID
- //var p_transction_no = 104; // 浜ゆ槗缂栧彿
-
- //// 楠岃瘉搴撲綅鏉$爜
- //if (p_section_code.IsNullOrEmpty()) throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
-
- //// 鑾峰彇搴撲綅淇℃伅
- //var c_depot_code = Db.Queryable<MesDepotSections, MesDepots>((a, b) =>
- // new JoinQueryInfos(JoinType.Inner, a.DepotGuid == b.Guid))
- // .Where((a, b) => a.DepotSectionCode == p_section_code)
- // .Select((a, b) => b.DepotId).First();
-
- //if (!c_depot_code.HasValue)
- // throw new Exception("搴撲綅缂栫爜" + p_section_code + " 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- //// 鑾峰彇搴撲綅鍒嗗尯淇℃伅
- //var mesDepotSections = Db.Queryable<MesDepotSections>()
- // .Where(a => a.DepotSectionCode == p_section_code).First();
-
- //if (mesDepotSections == null)
- // throw new Exception("搴撲綅缂栫爜" + p_section_code + " 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- //// 鑾峰彇搴撲綅鍩虹淇℃伅
- //var c_mes_depots = Db.Queryable<MesDepots>()
- // .Where(b => b.Guid == mesDepotSections.DepotGuid).First();
-
- //if (c_mes_depots == null)
- // throw new Exception("搴撲綅缂栫爜" + p_section_code + " 涓嶅瓨鍦紝璇风‘璁わ紒");
-
- //// 妫�鏌ユ潯鐮佹槸鍚﹀凡鍏ュ簱
- //var c_num = Db.Queryable<MesInvItemIns, MesInvItemInCDetails>((a, b) =>
- // new JoinQueryInfos(JoinType.Inner, a.Guid == b.ItemInId))
- // .Where((a, b) => b.ItemBarcode == p_item_barcode
- // && a.BillTypeId == p_bill_type_id &&
- // a.TransctionNo == p_transction_no.ToString())
- // .Count();
-
- //if (c_num > 0) throw new Exception("姝ゆ潯鐮佸凡鎵叆搴擄紝鍕块噸澶嶆壂鎻忥紒");
-
- //c_num = Db.Queryable<MesInvItemStocks>()
- // .Where(t => t.ItemBarcode == p_item_barcode).Count();
-
- //if (c_num > 0) throw new Exception("姝ゆ潯鐮佸凡鎵叆搴擄紝鍕块噸澶嶆壂鎻忥紒");
-
- //// 鑾峰彇鏉$爜淇℃伅
- //var c_mes_inv_item_barcodes = Db.Queryable<MesInvItemBarcodes>()
- // .Where(t => t.ItemBarcode == p_item_barcode).First();
-
- //if (c_mes_inv_item_barcodes == null)
- // throw new Exception("姝ゆ潯鐮佷笉灞炰簬璇ラ��鏂欏崟锛岃鏍稿锛�");
-
- //if (c_mes_inv_item_barcodes.Memo != "鐢熶骇閫�鏂�")
- // throw new Exception("姝ゆ潯鐮佷笉鏄敓浜ч��鏂欐潯鐮侊紝涓嶅彲浣跨敤鐢熶骇閫�鏂欐ā鍧楋紒");
-
- //// 浣跨敤 String.Equals 鏂规硶杩涜瀛楃涓叉瘮杈冿紝鎸囧畾姣旇緝瑙勫垯涓哄拷鐣ュぇ灏忓啓锛屾彁楂樻瘮杈冪殑鐏垫椿鎬�
- //if (!string.Equals(c_mes_inv_item_barcodes.BillNo, p_bill_no, StringComparison.OrdinalIgnoreCase))
- // throw new Exception($"璇ユ潯鐮佸搴旂殑鐢宠鍙枫�恵c_mes_inv_item_barcodes.BillNo}銆戜笌 褰撳墠鐢宠鍗曞彿銆恵p_bill_no}銆戜笉涓�鑷达紝璇锋牳瀵癸紒");
- //// 鑾峰彇閫�鏂欏崟淇℃伅
- //var C_MES_ITEM_TBL = Db.Queryable<MesItemTbl>()
- // .Where(a => a.BillNo == p_bill_no
- // && (a.Tbl013 ?? 0) == 1).First();
-
-
-
- //// 鑾峰彇閫�鏂欏崟淇℃伅
- //var tbWOMDAA = Db.Queryable<Womdaa>()
- // .Where(a => a.Guid.ToString() == C_MES_ITEM_TBL.Tbl002).First();
-
-
-
- //if (C_MES_ITEM_TBL == null) throw new Exception("鐢宠鍗曞凡鎾ゅ洖,鏃犳硶鎵爜!");
-
- //if (C_MES_ITEM_TBL.Tbl020 == 1) throw new Exception("鎵爜瀹屾垚,鐢宠鍗曞凡瀹岀粨!");
-
- //// 鑾峰彇閫�鏂欏崟鏄庣粏
- //var C_MES_ITEM_TBL_DETAIL = Db.Queryable<MesItemTblDetail>()
- // .Where(a => a.Tlid == c_mes_inv_item_barcodes.AboutGuid)
- // .First();
-
- //if (C_MES_ITEM_TBL_DETAIL == null)
- // throw new Exception("鏉$爜涓嶅睘浜庤鐢宠鍗曟槑缁�,鏃犳硶鎵爜!");
-
- //var CABerpid = Db.Queryable<Womdab>().Where(womdab => womdab.Guid.ToString() == C_MES_ITEM_TBL_DETAIL.Tld013).Select(womdab => womdab.Erpid).First();
-
- //var ownerId = Db.Queryable<Womcab>().Where(womcab => womcab.Erpid == CABerpid.Value).Select(womcab => womcab.OwnerId).First();
-
- //if (ownerId == null) throw new Exception("鐢ㄦ枡娓呭崟璐т富淇℃伅涓嶅瓨鍦�,鏃犳硶鎵爜锛岃鑱旂郴绠$悊鍛�!");
-
- //var owner_type = "";
- //if (Db.Queryable<SysOrganization>().Any(x => x.Fid == ownerId))
- //{
- // owner_type = "BD_OwnerOrg";
- //}
- //else
- //{
- // // 绗簩灞傚垽鏂細妫�鏌� MES_CUSTOMER
- // if (Db.Queryable<MesCustomer>().Any(x => x.Id == Convert.ToInt32(ownerId)))
- // {
- // owner_type = "BD_Customer";
- // }
- // else
- // {
- // // 绗笁灞傚垽鏂細妫�鏌� MES_SUPPLIER
- // if (Db.Queryable<MesSupplier>().Any(x => x.Id == Convert.ToInt32(ownerId)))
- // {
- // owner_type = "BD_Supplier";
- // }
- // else
- // {
- // throw new Exception("鍏ュ簱澶辫触,鐢ㄦ枡娓呭崟璐т富淇℃伅瀛樺湪闂锛岃鑱旂郴绠$悊鍛樿В鍐筹紒");
- // }
- // }
- //}
-
-
- //var c_quantity = c_mes_inv_item_barcodes.Quantity;
-
- //var c_bill_no = "";
- //var c_id = Guid.Empty;
-
- //// 浣跨敤浜嬪姟澶勭悊鏁版嵁鏇存柊
- //UseTransaction(db =>
- //{
- // // 鏌ヨ鍏ュ簱鍗�
- // var mesInvItemIns = db.Queryable<MesInvItemIns>()
- // .Where(d =>
- // d.Status == 0 && d.TransctionNo ==
- // p_transction_no.ToString()
- // && d.TaskNo == c_mes_inv_item_barcodes.BillNo
- // && d.DepotsId == c_depot_code
- // && d.InsDate.Value.ToString("yyyyMMdd") ==
- // DateTime.Now.ToString("yyyyMMdd")).First();
-
- // var totalResult = 0;
-
- // // 濡傛灉鍏ュ簱鍗曚笉瀛樺湪鍒欏垱寤烘柊鐨勫叆搴撳崟
- // if (mesInvItemIns == null)
- // {
- // c_bill_no = BillNo.GetBillNo("SCTL(鐢熶骇閫�鏂�)");
-
- // c_id = Guid.NewGuid();
-
- // totalResult += db.Insertable(new MesInvItemIns
- // {
- // Guid = c_id,
- // BillNo = c_bill_no,
- // BillTypeId = p_bill_type_id,
- // InsDate = DateTime.Now,
- // DepotsId = c_depot_code,
- // UserNoBack = c_user,
- // Reason = C_MES_ITEM_TBL.Tbl005,
- // Remark = C_MES_ITEM_TBL.Tbl006,
- // //InsDate = DateTime.Now,
- // DepotsCode = c_mes_depots.DepotCode,
- // TaskNo = c_mes_inv_item_barcodes.BillNo,
- // //DepotsId = c_depot_code,
- // TransctionNo = p_transction_no.ToString(),
- // CreateBy = c_user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = c_user,
- // LastupdateDate = DateTime.Now,
- // CbillNo = tbWOMDAA.Daa001,
- // InType = "鐢熶骇閫�鏂�",
- // ReceiveOrgId = c_mes_depots.FSubsidiary,
- // Fstatus = 0,
- // Status = 0,
- // WorkNo = tbWOMDAA.Daa021
- // }).IgnoreColumns(true).ExecuteCommand();
- // }
- // else
- // {
- // c_id = mesInvItemIns.Guid;
- // c_bill_no = mesInvItemIns.BillNo;
- // }
-
- // // 妫�鏌ユ槸鍚︿负鍚堝苟鎵撳嵃鏉$爜
- // var hbdy = c_mes_inv_item_barcodes.Hbdy ?? 0;
- // if (hbdy == 1) throw new Exception("涓嶆敮鎸佸悎骞舵墦鍗扮殑鏉$爜:" + p_item_barcode);
-
-
- // // 妫�鏌ユ槸鍚﹀瓨鍦ㄤ簬 MES_INV_ITEM_IN_C_ITEMS 琛�
- // var existingCount = db.Queryable<MesInvItemInCItems>()
- // .Where(it =>
- // it.ItemInId == c_id &&
- // it.ItemId == C_MES_ITEM_TBL_DETAIL.Tld009 &&
- // it.DepotId == c_depot_code.ToString())
- // .Count();
-
- // if (existingCount == 0)
- // // 涓嶅瓨鍦ㄦ椂鎻掑叆鏂拌褰�
- // db.Insertable(new MesInvItemInCItems
- // {
- // ItemInId = c_id,
- // Quantity = c_mes_inv_item_barcodes.Quantity,
- // CreateBy = c_user,
- // CreateDate = DateTime.Now,
- // ItemNo = c_mes_inv_item_barcodes.ItemNo,
- // //DepotCode = mesDepost.DepotCode,
- // ItemSname = c_mes_inv_item_barcodes.ItemSname,
- // Unit = c_mes_inv_item_barcodes.Unit,
- // Ebeln = c_mes_inv_item_barcodes.WorkNo,
- // BillNo = c_bill_no,
- // WorkNo = c_mes_inv_item_barcodes.WorkNo,
- // EbelnLineNo = c_mes_inv_item_barcodes.WorkLine,
- // CbillNo = c_mes_inv_item_barcodes.BillNo,
- // WorkLine = c_mes_inv_item_barcodes.WorkLine,
- // SuppId = c_mes_inv_item_barcodes.SuppId,
- // SuppNo = c_mes_inv_item_barcodes.SuppNo,
- // Remark = c_mes_inv_item_barcodes.Memo,
- // EbelnK3id = c_mes_inv_item_barcodes.EbelnK3id,
- // LineK3id = c_mes_inv_item_barcodes.LineK3id,
- // ItemId = c_mes_inv_item_barcodes.ItemId,
- // DepotCode = c_mes_depots.DepotCode,
- // DepotId = c_depot_code.ToString(),
- // itemDabid = C_MES_ITEM_TBL_DETAIL.Tlid.ToString()
- // }).IgnoreColumns(true).ExecuteCommand();
- // else
- // // 瀛樺湪鏃舵洿鏂版暟閲�
- // db.Updateable<MesInvItemInCItems>()
- // .SetColumns(it => new MesInvItemInCItems
- // {
- // Quantity = SqlFunc.IsNull(it.Quantity, 0) + c_mes_inv_item_barcodes.Quantity // 纭繚 Quantity 涓嶄负 null
- // })
- // .Where(it =>
- // it.ItemInId == c_id &&
- // it.ItemId == C_MES_ITEM_TBL_DETAIL.Tld009 &&
- // it.DepotId == c_depot_code.ToString())
- // //.IgnoreColumns(true) // 淇濈暀 IgnoreColumns
- // .ExecuteCommand();
-
-
- // // 鎻掑叆 mes_inv_item_in_c_details 琛�
- // totalResult += db.Insertable(new MesInvItemInCDetails
- // {
- // ItemInId = c_id,
- // BillNo = c_bill_no,
- // ItemBarcode = p_item_barcode,
- // Quantity = c_mes_inv_item_barcodes.Quantity,
- // BarcodeFlag = true,
- // EpFlag = true,
- // WorkType = 1,
- // ItemNo = c_mes_inv_item_barcodes.ItemNo,
- // //LotNo = cgddDetails.BatchNumber,--鎵瑰彿锛岄��鏂欎笉璁剧疆鎵瑰彿
- // SuppId = c_mes_inv_item_barcodes.SuppId,
- // SuppNo = c_mes_inv_item_barcodes.SuppNo,
- // //DepotCode = mesDepost.DepotCode,
- // DepotSectionCode = p_section_code,
- // ItemSname = c_mes_inv_item_barcodes.ItemSname,
- // Unit = c_mes_inv_item_barcodes.Unit,
- // CreateBy = c_user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = c_user,
- // LastupdateDate = DateTime.Now,
- // Remark = c_mes_inv_item_barcodes.Memo,
- // Ebeln = c_mes_inv_item_barcodes.Mblnr,
- // EbelnLineNo = c_mes_inv_item_barcodes.Zeile,
- // WorkNo = c_mes_inv_item_barcodes.WorkNo,
- // WorkLine = c_mes_inv_item_barcodes.WorkLine,
- // CbillNo = c_mes_inv_item_barcodes.BillNo,
- // UrgentFlag = c_mes_inv_item_barcodes.UrgentFlag,
- // BoardStyle = c_mes_inv_item_barcodes.BoardStyle,
- // TaskNo = c_mes_inv_item_barcodes.TaskNo,
- // EbelnK3id = c_mes_inv_item_barcodes.EbelnK3id,
- // LineK3id = c_mes_inv_item_barcodes.LineK3id,
- // ItemId = c_mes_inv_item_barcodes.ItemId,
- // Ischeck = true,
- // //CheckDate = C_MES_ITEM_TBL_DETAIL.CheckDate,
- // //CheckRes = C_MES_ITEM_TBL_DETAIL.CheckRes,
- // //CheckStates = C_MES_ITEM_TBL_DETAIL.CheckStates,--妫�楠屼俊鎭�
- // ReceiveOrgId = c_mes_depots.FSubsidiary,
- // DepotCode = c_mes_depots.DepotCode,
- // DepotId = Convert.ToInt64(c_depot_code)
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆涓氬姟璁板綍
- // totalResult += db.Insertable(new MesInvBusiness2
- // {
- // Guid = Guid.NewGuid(),
- // Status = 1,
- // BillTypeId = p_bill_type_id,
- // TransactionCode = p_transction_no.ToString(),
- // BusinessType = 1,
- // ItemBarcode = p_item_barcode,
- // ItemNo = c_mes_inv_item_barcodes.ItemNo,
- // LotNo = c_mes_inv_item_barcodes.LotNo,
- // EpFlag = true,
- // Quantity = c_mes_inv_item_barcodes.Quantity,
- // ToInvDepotsCode = c_mes_depots.DepotCode,
- // InvDepotId = c_depot_code,
- // ToInvDepotSectionsCode = p_section_code,
- // Description = "鐢熶骇閫�鏂�",
- // CreateBy = c_user,
- // CreateDate = DateTime.Now,
- // LastupdateBy = c_user,
- // LastupdateDate = DateTime.Now,
- // TaskNo = c_mes_inv_item_barcodes.TaskNo,
- // BillNo = c_bill_no,
- // WorkNo = c_mes_inv_item_barcodes.WorkNo,
- // WorkLine = c_mes_inv_item_barcodes.WorkLine,
- // SuppId = c_mes_inv_item_barcodes.SuppId,
- // SuppNo = c_mes_inv_item_barcodes.SuppNo,
- // ItemId = c_mes_inv_item_barcodes.ItemId
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鎻掑叆搴撳瓨璁板綍
- // totalResult += db.Insertable(new MesInvItemStocks
- // {
- // Guid = Guid.NewGuid(),
- // TaskNo = c_mes_inv_item_barcodes.TaskNo,
- // ItemBarcode = p_item_barcode,
- // ItemNo = c_mes_inv_item_barcodes.ItemNo,
- // LotNo = c_mes_inv_item_barcodes.LotNo,
- // Quantity = c_mes_inv_item_barcodes.Quantity,
- // //EpFlag = c_mes_inv_item_barcodes.EpFlag.Value
- // // ? (byte)1
- // // : (byte)0,
- // DepotId = c_mes_depots.DepotId,
- // DepotsCode = c_mes_depots.DepotCode,
- // DepotSectionsCode = p_section_code,
- // CheckDate = c_mes_inv_item_barcodes.CreateDate,
- // IndepDate = DateTime.Now,
- // BoardStyle = c_mes_inv_item_barcodes.BoardStyle,
- // WorkNo = c_mes_inv_item_barcodes.WorkNo,
- // WorkLine = c_mes_inv_item_barcodes.WorkLine,
- // SuppNo = c_mes_inv_item_barcodes.SuppNo,
- // ItemId = c_mes_inv_item_barcodes.ItemId,
- // BillNo = c_mes_inv_item_barcodes.BillNo,
- // //DepotId = Convert.ToInt32(c_depot_code),
- // OwnerId = ownerId,
- // OwnerType = owner_type,
- // StockOrgId = c_mes_depots.FSubsidiary,
- // IndepUserCode = c_user
- // }).IgnoreColumns(true).ExecuteCommand();
-
- // // 鏍规嵁閫�鏂欑被鍨�(鑹搧閫�鏂欍�佹潵鏂欎笉鑹��鏂欍�佷綔涓氫笉鑹��鏂�)鏇存柊鐩稿叧鏁版嵁
- // if (C_MES_ITEM_TBL.Tbl005 is "鑹搧閫�鏂�" or "鏉ユ枡涓嶈壇閫�鏂�")
- // {
- // // 鑹搧閫�鏂� - 鏇存柊宸ュ崟琛�(WOMDAB)鐩稿叧鏁伴噺
- // if (C_MES_ITEM_TBL.Tbl005 == "鑹搧閫�鏂�")
- // totalResult += Db.Updateable<Womdab>()
- // .SetColumns(it => new Womdab
- // {
- // Dab007 = it.Dab007 -
- // c_mes_inv_item_barcodes.Quantity, // 鍑忓皯宸ュ崟鏁伴噺
- // Dab022 = (it.Dab022 ?? 0) +
- // c_mes_inv_item_barcodes.Quantity, // 澧炲姞閫�鏂欐暟閲�
- // LpTl = (it.LpTl ?? 0) +
- // (int)c_mes_inv_item_barcodes
- // .Quantity, // 澧炲姞鑹搧閫�鏂欐暟閲�
- // Dab020 = (it.Dab020 ?? 0) -
- // c_mes_inv_item_barcodes.Quantity // 鍑忓皯宸插彂鏂欐暟閲�
- // })
- // .Where(it => it.Dab001 == c_mes_inv_item_barcodes.WorkNo
- // && it.Dab002 == c_mes_inv_item_barcodes
- // .WorkLine
- // && it.Dab003 == c_mes_inv_item_barcodes
- // .ItemId.ToString())
- // .ExecuteCommand();
- // // 鏉ユ枡涓嶈壇閫�鏂� - 鏇存柊宸ュ崟琛�(WOMDAB)鐩稿叧鏁伴噺
- // else if (C_MES_ITEM_TBL.Tbl005 == "鏉ユ枡涓嶈壇閫�鏂�")
- // totalResult += Db.Updateable<Womdab>()
- // .SetColumns(it => new Womdab
- // {
- // Dab007 = it.Dab007 -
- // c_mes_inv_item_barcodes.Quantity, // 鍑忓皯宸ュ崟鏁伴噺
- // Dab022 = (it.Dab022 ?? 0) +
- // c_mes_inv_item_barcodes.Quantity, // 澧炲姞閫�鏂欐暟閲�
- // LlBl = (it.LlBl ?? 0) +
- // (int)c_mes_inv_item_barcodes
- // .Quantity, // 澧炲姞鏉ユ枡涓嶈壇鏁伴噺
- // Dab020 = (it.Dab020 ?? 0) -
- // c_mes_inv_item_barcodes.Quantity // 鍑忓皯宸插彂鏂欐暟閲�
- // })
- // .Where(it => it.Dab001 == c_mes_inv_item_barcodes.WorkNo
- // && it.Dab002 == c_mes_inv_item_barcodes
- // .WorkLine
- // && it.Dab003 == c_mes_inv_item_barcodes
- // .ItemId.ToString())
- // .ExecuteCommand();
-
- // // 鏇存柊閫�鏂欏崟鏄庣粏琛ㄥ凡閫�鏁伴噺
- // totalResult += Db.Updateable<MesItemTblDetail>()
- // .SetColumns(it => new MesItemTblDetail
- // {
- // Tld006 = (it.Tld006 ?? 0) +
- // (int)c_mes_inv_item_barcodes.Quantity // 澧炲姞宸查��鏁伴噺
- // })
- // .Where(it => it.Tlmid == C_MES_ITEM_TBL.Id &&
- // it.Tlid == c_mes_inv_item_barcodes.AboutGuid)
- // .ExecuteCommand();
- // }
- // // 浣滀笟涓嶈壇閫�鏂� - 鏇存柊宸ュ崟琛ㄥ拰閫�鏂欏崟鏄庣粏琛�
- // else if (C_MES_ITEM_TBL.Tbl005 == "浣滀笟涓嶈壇閫�鏂�")
- // {
- // totalResult += Db.Updateable<Womdab>()
- // .SetColumns(it => new Womdab
- // {
- // Dab022 = (it.Dab022 ?? 0) +
- // c_mes_inv_item_barcodes.Quantity, // 澧炲姞閫�鏂欐暟閲�
- // ZyBl = (it.ZyBl ?? 0) +
- // (int)c_mes_inv_item_barcodes
- // .Quantity, // 澧炲姞浣滀笟涓嶈壇鏁伴噺
- // Dab020 = (it.Dab020 ?? 0) -
- // c_mes_inv_item_barcodes.Quantity // 鍑忓皯宸插彂鏂欐暟閲�
- // })
- // .Where(it => it.Dab001 == c_mes_inv_item_barcodes.WorkNo
- // && it.Dab002 ==
- // c_mes_inv_item_barcodes.WorkLine
- // && it.Dab003 == c_mes_inv_item_barcodes.ItemId
- // .ToString())
- // .ExecuteCommand();
-
- // // 鏇存柊閫�鏂欏崟鏄庣粏琛ㄥ凡閫�鏁伴噺
- // totalResult += Db.Updateable<MesItemTblDetail>()
- // .SetColumns(it => new MesItemTblDetail
- // {
- // Tld006 = (it.Tld006 ?? 0) +
- // (int)c_mes_inv_item_barcodes.Quantity // 澧炲姞宸查��鏁伴噺
- // })
- // .Where(it => it.Tlmid == C_MES_ITEM_TBL.Id &&
- // it.Tlid == c_mes_inv_item_barcodes.AboutGuid)
- // .ExecuteCommand();
- // }
-
- // // 濡傛灉寰呴��鏁伴噺绛変簬鏈閫�鏂欐暟閲忥紝鍒欐洿鏂版槑缁嗗畬鎴愮姸鎬�
- // if ((C_MES_ITEM_TBL_DETAIL.Tld005 ?? 0) -
- // (C_MES_ITEM_TBL_DETAIL.Tld006 ?? 0) ==
- // c_mes_inv_item_barcodes.Quantity)
- // totalResult += Db.Updateable<MesItemTblDetail>()
- // .SetColumns(it => new MesItemTblDetail
- // { Tld008 = 1 }) // 璁剧疆瀹屾垚鏍囧織
- // .Where(it => it.Tlid == C_MES_ITEM_TBL_DETAIL.Tlid)
- // .ExecuteCommand();
-
- // // 妫�鏌ラ��鏂欏崟鏄惁鎵�鏈夋槑缁嗛兘宸插畬鎴�
- // var remainingCount = Db.Queryable<MesItemTbl, MesItemTblDetail>(
- // (a, b) =>
- // new JoinQueryInfos(JoinType.Left, a.Id == b.Tlmid))
- // .Where((a, b) =>
- // a.BillNo == p_bill_no &&
- // (b.Tld005 ?? 0) - (b.Tld006 ?? 0) > 0)
- // .Count();
-
- // // 濡傛灉鎵�鏈夋槑缁嗛兘宸插畬鎴愶紝鍒欐洿鏂伴��鏂欏崟鐘舵�佷负宸插畬鎴�
- // if (remainingCount < 1)
- // totalResult += Db.Updateable<MesItemTbl>()
- // .SetColumns(it => it.Tbl020 == 1) // 璁剧疆瀹屾垚鏍囧織
- // .Where(it => it.BillNo == p_bill_no)
- // .ExecuteCommand();
-
- // // 妫�鏌ュ繀瑕佺殑鎻掑叆鎿嶄綔鏄惁閮芥垚鍔熸墽琛�
- // var minimumExpectedOperations = 3; // 鑷冲皯闇�瑕佹墽琛岀殑鎻掑叆鎿嶄綔鏁�
- // if (totalResult < minimumExpectedOperations)
- // throw new Exception(
- // $"鍏抽敭鏁版嵁鎻掑叆澶辫触锛岄鏈熻嚦灏憑minimumExpectedOperations}涓搷浣滐紝瀹為檯鎵ц{totalResult}涓搷浣�");
-
- // // 鍒涘缓 鎻掑叆鏃ュ織
- // var logService = new LogService();
- // var LogMsg = "[PDA]鐢熶骇閫�鏂欍�傛潯鐮併��" + query.barcode + "銆� 閫�鏂欏崟鍙枫��" + c_bill_no + "銆�";
- // logService.CreateLog(db, query.userName, tbWOMDAA.Guid.ToString(), "WOMDAA", LogMsg, tbWOMDAA.Daa001);
-
- // return totalResult;
- //});
-
- //query.itemNo = itemNo;
- //query.Num = quantity;
- //return query;
}
}
\ No newline at end of file
diff --git a/service/Warehouse/MesKwcxManager.cs b/service/Warehouse/MesKwcxManager.cs
new file mode 100644
index 0000000..74b7559
--- /dev/null
+++ b/service/Warehouse/MesKwcxManager.cs
@@ -0,0 +1,99 @@
+锘縰sing Masuit.Tools;
+using NewPdaSqlServer.DB;
+using NewPdaSqlServer.Dto.service;
+using NewPdaSqlServer.entity;
+using SqlSugar;
+using System.Data;
+using System.Data.SqlClient;
+using System.Text;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
+
+namespace NewPdaSqlServer.service.Warehouse;
+
+public class MesKwcxManager : Repository<MesInvItemInCDetails>
+{
+ public dynamic GetBarInfoList(dynamic unity)
+ {
+ var sqlParams = new List<SugarParameter>
+ {
+ new("@deptSectionCode", unity.deptSectionCode),
+ new("@rkDate", string.IsNullOrWhiteSpace(unity.rkDate?.ToString()) ? DBNull.Value : unity.rkDate),
+ new("@zkChecked", unity.zkChecked?.ToString() == "True" ? 1 : unity.zkChecked?.ToString() == "False" ? 0 : DBNull.Value)
+ };
+
+ var sql2 = new StringBuilder("exec prc_pda_kwcx_barInfoList @deptSectionCode, @rkDate, @zkChecked");
+
+ var list = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ if (list.Count < 1)
+ {
+ throw new Exception("璇ユ潯浠朵笅鏃犲搴斿簱浣嶄俊鎭紒");
+ }
+
+ return list;
+ }
+ public dynamic GetBarInfo(dynamic unity)
+ {
+ var sqlParams = new List<SugarParameter> { };
+
+ var sql2 = new StringBuilder(@"exec prc_pda_kwcx_barInfo @BARCODE");
+ sqlParams.Add(new("@BARCODE", unity.barcode));
+
+ var list = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ if (list.Count < 1)
+ {
+ throw new Exception("璇ユ潯浠朵笅鏃犲搴旀潯鐮佷俊鎭紒");
+ }
+
+ return list[0];
+ }
+
+ public dynamic GetKWList(dynamic unity)
+ {
+
+ var sqlParams = new List<SugarParameter> { };
+
+ var sql2 = new StringBuilder(@"
+ select depot_code as code, depot_name as name from MES_DEPOTS");
+
+
+ var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ return XcslItem;
+ }
+
+ public dynamic GetKWInfo(dynamic unity)
+ {
+ var sqlParams = new List<SugarParameter>
+ {
+ new("@depot_code", unity.code)
+ };
+
+ var sql2 = new StringBuilder("exec prc_pda_kwcx_kwInfo @depot_code");
+
+ var KWInfo = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ return KWInfo;
+ }
+
+ public dynamic GetItemInfoList(dynamic unity,dynamic RequestInfo)
+ {
+ var sqlParams = new List<SugarParameter> { };
+ var orgId = RequestInfo.OrgId;
+
+ var sql2 = new StringBuilder(@"exec prc_pda_kwcx_itemInfo @barCode,@itemNo,@orgId");
+ sqlParams.Add(new("@barCode", unity.barCode));
+ sqlParams.Add(new("@itemNo", unity.itemNo));
+ sqlParams.Add(new("@orgId", orgId));
+
+ var list = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ if (list.Count < 1)
+ {
+ throw new Exception("璇ユ潯浠朵笅鏃犲搴旀潯鐮佷俊鎭紒");
+ }
+
+ return list;
+ }
+}
\ No newline at end of file
diff --git a/service/Warehouse/MesXkyService.cs b/service/Warehouse/MesXkyService.cs
index 45ad039..b68574a 100644
--- a/service/Warehouse/MesXkyService.cs
+++ b/service/Warehouse/MesXkyService.cs
@@ -163,7 +163,8 @@
noticeList.ForEach(n => n.Id = Guid.NewGuid());
-
+ noticeList.ForEach(n => n.orgId = "104554");
+
var deliveryNos = noticeList.Select(n => n.DeliveryNo).Distinct().ToList();
//var noticeIds = noticeList.Select(n => n.Id).ToList(); // 淇濇寔GUID绫诲瀷
@@ -316,7 +317,14 @@
private int SaveDeliveryNoticeDetail(dynamic responseJson,string deliveryNo)
{
var result = 1;
- List<DeliveryNoticeDetail> noticeList = JsonConvert.DeserializeObject<List<DeliveryNoticeDetail>>(responseJson.data.lineList.ToString());
+ // 杞崲purchaseDesc瀵硅薄涓哄瓧绗︿覆
+ var jsonData = JArray.Parse(responseJson.data.lineList.ToString());
+ foreach (var item in jsonData)
+ {
+ item["purchaseDesc"] = item["purchaseDesc"]?.ToString(Formatting.None);
+ }
+
+ List<DeliveryNoticeDetail> noticeList = jsonData.ToObject<List<DeliveryNoticeDetail>>();
// 鏂板鍒楄〃绌哄�兼鏌�
if (noticeList == null || !noticeList.Any() || noticeList.Count < 1)
diff --git a/service/Warehouse/MesXkyShdManager.cs b/service/Warehouse/MesXkyShdManager.cs
index 3ab65b1..cdb3113 100644
--- a/service/Warehouse/MesXkyShdManager.cs
+++ b/service/Warehouse/MesXkyShdManager.cs
@@ -31,20 +31,22 @@
// if (diffNum.Diffnum != 0)
// throw new Exception($"閫佽揣鍗曞彿銆恵unity.shdh}銆戞潯鐮佹湭鍏ㄩ儴鎵撳嵃鎴栨湭鍚屾锛屾棤娉曟敹璐э紒");
- var sql2 = @"select D.item_no,
+ var sql2 = @"WITH dhmx AS(
+ SELECT E.line_k3id,B.paper_bill_no,B.guid,E.quantity FROM dbo.MES_INV_ITEM_ARN B LEFT JOIN MES_INV_ITEM_ARN_DETAIL E ON B.guid = E.parent_Guid
+)
+select DISTINCT D.item_no,
D.item_name,
D.item_model,
A.delivery_qty AS shsl,
- ISNULL(E.quantity, 0) as ysl,
- A.delivery_qty - ISNULL(E.quantity, 0) as dssl,
+ ISNULL(dhmx.quantity, 0) as ysl,
+ A.delivery_qty - ISNULL(dhmx.quantity, 0) as dssl,
A.po_erp_no,
C.PURCHASE_ORDER_LINE_NUMBER,
- B.GUID AS DDHID
+ dhmx.GUID AS DDHID
from DELIVERY_NOTICE_DETAIL A
- LEFT JOIN dbo.MES_INV_ITEM_ARN B on B.paper_bill_no = A.delivery_no
LEFT JOIN MES_ROH_IN_DATA C ON A.po_line_no = C.EBELN_K3ID
LEFT JOIN MES_ITEMS D ON C.ITEM_ID = D.item_id
- LEFT JOIN dbo.MES_INV_ITEM_ARN_DETAIL E on E.parent_Guid = B.guid AND E.line_k3id = A.po_line_no
+ LEFT JOIN dhmx ON dhmx.line_k3id = A.po_line_no AND dhmx.paper_bill_no = A.delivery_no
WHERE A.delivery_no = @shdh";
var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams);
diff --git a/service/Warehouse/MesXsckManager.cs b/service/Warehouse/MesXsckManager.cs
index d5da216..df9f864 100644
--- a/service/Warehouse/MesXsckManager.cs
+++ b/service/Warehouse/MesXsckManager.cs
@@ -20,57 +20,82 @@
/// 鑾峰彇鐢熶骇鍙戣揣閫氱煡鍗曞彿鍒楄〃
/// </summary>
/// <returns>鍙戣揣閫氱煡鍗曞彿鍒楄〃</returns>
- public List<string> GetFHTZBillNo(WarehouseQuery query)
+ public dynamic GetFHTZBillNo(dynamic query, dynamic RequestInfo)
{
- var list = Db.Queryable<SalesDeliver>()
- .Where(s => (s.FApproverStatus ?? false) == true)
- .Select(s => s.BillNo)
- .ToList();
- return list;
+ var orgId = RequestInfo.OrgId;
+
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鑾峰彇鏈畬鎴愮殑閫�鏂欏崟鍙峰垪琛�
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ // 杩斿洖鍗曞彿瀛楃涓插垪琛℅et_Qt_ck_List
+ var blDetails = Db.Ado.SqlQuery<string>(
+ "EXEC prc_pda_xsck_list @pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ return blDetails;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
/// 鏍规嵁鍙戣揣閫氱煡鍗曡幏鍙栧搴斾唬鍙戣揣鏄庣粏 prc_rf_pda_scan_zout_showbl
/// </summary>
/// <returns>鍙戣揣閫氱煡鍗曟槑缁嗗垪琛�</returns>
- public List<ItemDetailModel> GetMesItemFHTZetailByBillNo(
- WarehouseQuery query)
+ public dynamic GetMesItemFHTZetailByBillNo(dynamic query, dynamic RequestInfo)
{
if (string.IsNullOrEmpty(query.billNo))
throw new Exception("璇烽�夊崟鎹彿锛�");
- // 妫�鏌ュ彂璐ч�氱煡鍗曟槸鍚﹀瓨鍦ㄤ笖瀹℃牳
- var mesItem = Db.Queryable<SalesDeliver>()
- .Where(a => a.BillNo == query.billNo && a.FApproverStatus == true)
- .First();
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
- if (mesItem == null)
- throw new Exception("鍗曟嵁鍙蜂笉瀛樺湪鎴栨湭瀹℃牳锛�");
+ if (string.IsNullOrEmpty(query.billNo?.ToString()))
+ throw new ArgumentException("鍗曟嵁鍙蜂笉鑳戒负绌�", nameof(query.billNo));
- if (mesItem.FinishStatus == true)
- throw new Exception("鍗曟嵁鍙峰凡瀹岀粨锛�");
+ var orgId = RequestInfo.OrgId;
+
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
// 鑾峰彇鏈畬鎴愮殑鍙戣揣閫氱煡鍗曟槑缁�
- var blDetails = Db.Queryable<SalesDeliver, SalesDeliverDetail, SalesOrderDetail,MesItems>((a, b, c, d) =>
- new JoinQueryInfos(JoinType.Left, a.Id == b.Pid,
- JoinType.Left, b.SalesDetailId == c.Id,
- JoinType.Left, c.MaterialId == d.ItemId.ToString()))
- .Where((a, b) => a.BillNo == query.billNo
- && (b.FMustQty ?? 0) - (b.FRealQty ?? 0) > 0)
- .Select((a, b, c, d) => new ItemDetailModel
+ var parameters = new[]
+{
+ new SugarParameter("@billNo", query.billNo),
+ new SugarParameter("@pi_orgId",orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_xsck_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ var items = blDetails.Where(x => x.DSQty > 0).ToList(); // 寰呮壂鐗╂枡
+ var ysitems = blDetails.Where(x => x.SQty > 0).ToList(); // 宸叉壂鐗╂枡
+ return new
{
- ItemNo = d.ItemNo,
- ItemName = d.ItemName,
- ItemModel = d.ItemModel,
- FQty = b.FMustQty,
- SQty = b.FRealQty,
- FMaterialId = d.ItemId.ToString(),
- Id = b.Id.ToString()
-
- })
- .ToList();
-
- return blDetails;
+ items = items,
+ ysitems = ysitems
+ };
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
diff --git a/service/Warehouse/MesXsthManager.cs b/service/Warehouse/MesXsthManager.cs
index 56a163f..27d063f 100644
--- a/service/Warehouse/MesXsthManager.cs
+++ b/service/Warehouse/MesXsthManager.cs
@@ -19,13 +19,33 @@
/// 鑾峰彇閿�鍞��璐х敵璇峰垪琛�
/// </summary>
/// <returns>閿�鍞��璐х敵璇峰垪琛�</returns>
- public List<string> GetXsthBillNo(WarehouseQuery query)
+ public dynamic GetXsthBillNo(WarehouseQuery query,dynamic RequestInfo)
{
- var list = Db.Queryable<SalesReturnNotice>()
- .Where(s => s.CheckStatus == true)
- .Select(s => s.BillNo).ToList();
+ var orgId = RequestInfo.OrgId;
- return list;
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鑾峰彇鏈畬鎴愮殑閫�鏂欏崟鍙峰垪琛�
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_orgId", orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ // 杩斿洖鍗曞彿瀛楃涓插垪琛�
+ var blDetails = Db.Ado.SqlQuery<string>(
+ "EXEC prc_pda_xsth_list @pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ return blDetails;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
@@ -33,35 +53,50 @@
/// </summary>
/// <param name="query">浠撳簱鏌ヨ鍙傛暟</param>
/// <returns>鐗╂枡鏄庣粏鍒楄〃</returns>
- public List<ItemDetailModel> GetMesItemDetailByBillNo(
- WarehouseQuery query)
+ public dynamic GetMesItemDetailByBillNo(dynamic query, dynamic RequestInfo)
{
- // 鍏宠仈鏌ヨ鐗╂枡琛ㄣ�佺墿鏂欐槑缁嗚〃鍜岀墿鏂欏熀纭�淇℃伅琛�
- var mesItemTblDetails = Db
- .Queryable<SalesReturnNotice, SalesReturnNoticeDetail, MesItems>(
- (a, b, c) => new JoinQueryInfos(
- JoinType.Left,
- a.Id == b.Pid,
- JoinType.Left,
- b.MaterialId == c.Id.ToString())
- ).Where((a, b, c) => a.BillNo == query.billNo && a.CheckStatus == true)
- .Select<ItemDetailModel>((a, b, c) => new ItemDetailModel
+ if (string.IsNullOrEmpty(query.billNo))
+ throw new Exception("璇烽�夊崟鎹彿锛�");
+
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
+
+ if (string.IsNullOrEmpty(query.billNo?.ToString()))
+ throw new ArgumentException("鍗曟嵁鍙蜂笉鑳戒负绌�", nameof(query.billNo));
+
+ var orgId = RequestInfo.OrgId;
+
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 鑾峰彇鏈畬鎴愮殑閿�鍞��璐ф槑缁�
+ var parameters = new[]
+{
+ new SugarParameter("@billNo", query.billNo),
+ new SugarParameter("@pi_orgId",orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ try
+ {
+ List<dynamic>? blDetails = Db.Ado.SqlQuery<dynamic>(
+ "EXEC prc_pda_xsth_detailList @billNo,@pi_orgId,@inP1,@inP2,@inP3,@inP4", parameters);
+ var items = blDetails.Where(x => x.DSQty > 0).ToList(); // 寰呮壂鐗╂枡
+ var ysitems = blDetails.Where(x => x.SQty > 0).ToList(); // 宸叉壂鐗╂枡
+ return new
{
- ItemNo = c.ItemNo,
- ItemName = c.ItemName,
- ItemModel = c.ItemModel,
- FQty = b.SqQty, // 鐢宠鏁伴噺
- SQty = b.YsQty, // 宸叉壂鏁伴噺
- Pid = b.Pid.ToString(),
- FMaterialId = b.MaterialId,
- Id = b.Id.ToString()
- }).ToList();
-
- // 绛涢�夊嚭寰呴��鏁伴噺澶т簬宸查��鏁伴噺鐨勮褰�
- //var itemTblDetails = mesItemTblDetails
- // .Where(s => (s.Tld005 ?? 0) - (s.Tld006 ?? 0) > 0).ToList();
-
- return mesItemTblDetails;
+ items = items,
+ ysitems = ysitems,
+ Count = items.Count + ysitems.Count
+ };
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
}
/// <summary>
diff --git a/service/Wom/MesWorkProdManager.cs b/service/Wom/MesWorkProdManager.cs
index c1352bf..827cf8b 100644
--- a/service/Wom/MesWorkProdManager.cs
+++ b/service/Wom/MesWorkProdManager.cs
@@ -1,12 +1,10 @@
锘縰sing NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
-using NewPdaSqlServer.entity.Base;
using NewPdaSqlServer.util;
using SqlSugar;
using System.Data;
using System.Data.SqlClient;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace NewPdaSqlServer.service.Wom;
@@ -46,212 +44,212 @@
/// </exception>
public ScanWorkResult ScanWorkAsync(ScanWorkRequest request)
{
- // // 1. 楠岃瘉鍛樺伐淇℃伅
- // var staff = Db.Queryable<MesStaff>()
- // .Where(x => x.StaffNo == request.StaffNo)
- // .First();
- // if (staff == null)
- // throw new Exception("璇峰厛閫夋嫨浜哄憳");
+ //// 1. 楠岃瘉鍛樺伐淇℃伅
+ //var staff = Db.Queryable<MesStaff>()
+ // .Where(x => x.StaffNo == request.StaffNo)
+ // .First();
+ //if (staff == null)
+ // throw new Exception("璇峰厛閫夋嫨浜哄憳");
- // // 2. 楠岃瘉鏉$爜淇℃伅
- // var barcode = Db.Queryable<MesInvItemBarcodes>()
- // .Where(x => x.ItemBarcode == request.ItemBarcode)
- // .First();
- // if (barcode == null)
- // throw new Exception($"鏃犳鏉$爜锛岃鏍稿锛亄request.ItemBarcode}");
+ //// 2. 楠岃瘉鏉$爜淇℃伅
+ //var barcode = Db.Queryable<MesInvItemBarcodes>()
+ // .Where(x => x.ItemBarcode == request.ItemBarcode)
+ // .First();
+ //if (barcode == null)
+ // throw new Exception($"鏃犳鏉$爜锛岃鏍稿锛亄request.ItemBarcode}");
- // // 3. 楠岃瘉鐗╂枡淇℃伅
- // var item = Db.Queryable<MesItems>()
- // .Where(x => x.Id == barcode.ItemId)
- // .First();
- // if (item == null)
- // throw new Exception($"鏃犳鐗╂枡锛岃鏍稿锛亄request.ItemBarcode}");
+ //// 3. 楠岃瘉鐗╂枡淇℃伅
+ //var item = Db.Queryable<MesItems>()
+ // .Where(x => x.Id == barcode.ItemId)
+ // .First();
+ //if (item == null)
+ // throw new Exception($"鏃犳鐗╂枡锛岃鏍稿锛亄request.ItemBarcode}");
- // // 4. 鏍规嵁鏉$爜澶囨敞纭畾鍗曟嵁绫诲瀷鍜屼氦鏄撳彿
- // var billTypeId = 900; // 榛樿鍗曟嵁绫诲瀷
- // var transactionNo = 902; // 榛樿浜ゆ槗鍙�
- // switch (barcode.Memo?.Trim() ?? "0")
- // {
- // case "涓濆嵃":
- // transactionNo = 901; // 涓濆嵃宸ュ簭
- // break;
- // case "鍗婃垚鍝�":
- // transactionNo = 902; // 鍗婃垚鍝佸伐搴�
- // break;
- // case "鍖呰":
- // case "鎴愬搧":
- // transactionNo = 903; // 鎴愬搧/鍖呰宸ュ簭
- // break;
- // }
+ //// 4. 鏍规嵁鏉$爜澶囨敞纭畾鍗曟嵁绫诲瀷鍜屼氦鏄撳彿
+ //var billTypeId = 900; // 榛樿鍗曟嵁绫诲瀷
+ //var transactionNo = 902; // 榛樿浜ゆ槗鍙�
+ //switch (barcode.Memo?.Trim() ?? "0")
+ //{
+ // case "涓濆嵃":
+ // transactionNo = 901; // 涓濆嵃宸ュ簭
+ // break;
+ // case "鍗婃垚鍝�":
+ // transactionNo = 902; // 鍗婃垚鍝佸伐搴�
+ // break;
+ // case "鍖呰":
+ // case "鎴愬搧":
+ // transactionNo = 903; // 鎴愬搧/鍖呰宸ュ簭
+ // break;
+ //}
- // // 5. 妫�鏌ユ潯鐮佹槸鍚﹂噸澶嶆壂鎻�
- // var exists = Db.Queryable<MesWorkProd, MesWorkProdCDetails>(
- // (a, b) =>
- // new JoinQueryInfos(JoinType.Inner,
- // a.Id == b.MesWorkProdId))
- // .Where((a, b) => b.ItemBarcode == request.ItemBarcode
- // && a.BillTypeId == billTypeId
- // && a.TransactionNo == transactionNo)
- // .Any();
+ //// 5. 妫�鏌ユ潯鐮佹槸鍚﹂噸澶嶆壂鎻�
+ //var exists = Db.Queryable<MesWorkProd, MesWorkProdCDetails>(
+ // (a, b) =>
+ // new JoinQueryInfos(JoinType.Inner,
+ // a.Id == b.MesWorkProdId))
+ // .Where((a, b) => b.ItemBarcode == request.ItemBarcode
+ // && a.BillTypeId == billTypeId
+ // && a.TransactionNo == transactionNo)
+ // .Any();
- // if (exists)
- // throw new Exception("鏉$爜閲嶅鎵弿锛岃鏍稿锛�");
+ //if (exists)
+ // throw new Exception("鏉$爜閲嶅鎵弿锛岃鏍稿锛�");
- // // 6. 鑾峰彇宸叉姤宸ユ暟閲�
- // var reportedQty = Db.Queryable<MesWorkProd, MesWorkProdCDetails>(
- // (a, b) =>
- // new JoinQueryInfos(JoinType.Inner,
- // a.BillNo == b.BillNo))
- // .Where((a, b) => a.BillTypeId == billTypeId
- // && a.TransactionNo == transactionNo
- // && a.TaskNo == barcode.BillNo)
- // .Sum((a, b) => b.Quantity);
+ //// 6. 鑾峰彇宸叉姤宸ユ暟閲�
+ //var reportedQty = Db.Queryable<MesWorkProd, MesWorkProdCDetails>(
+ // (a, b) =>
+ // new JoinQueryInfos(JoinType.Inner,
+ // a.BillNo == b.BillNo))
+ // .Where((a, b) => a.BillTypeId == billTypeId
+ // && a.TransactionNo == transactionNo
+ // && a.TaskNo == barcode.BillNo)
+ // .Sum((a, b) => b.Quantity);
- // // 7. 鑾峰彇宸ュ崟璁″垝鏁伴噺鍜屽瀷鍙�
- // var workOrder = Db.Queryable<Womdaa>()
- // .Where(x => x.Daa001 == barcode.BillNo)
- // .First();
- // if (workOrder == null)
- // throw new Exception($"鏃犲伐鍗曟槑缁嗭紝璇锋牳瀵癸紒{request.ItemBarcode}");
+ //// 7. 鑾峰彇宸ュ崟璁″垝鏁伴噺鍜屽瀷鍙�
+ //var workOrder = Db.Queryable<Womdaa>()
+ // .Where(x => x.Daa001 == barcode.BillNo)
+ // .First();
+ //if (workOrder == null)
+ // throw new Exception($"鏃犲伐鍗曟槑缁嗭紝璇锋牳瀵癸紒{request.ItemBarcode}");
- // var planQty = workOrder.Daa008;
- // var itemModel = workOrder.Daa004;
+ //var planQty = workOrder.Daa008;
+ //var itemModel = workOrder.Daa004;
- // // 8. 浣跨敤浜嬪姟澶勭悊鎶ュ伐鏁版嵁
- // UseTransaction(db =>
- // {
- // // 9. 澶勭悊鏈夋暟閲忔潯鐮佺殑鑷姩鎶ュ伐
- // if (barcode.Quantity > 0)
- // {
- // var reportQty = barcode.Quantity;
- // if (reportQty <= 0)
- // throw new Exception(
- // $"鎶ュ伐鏁伴噺涓嶈兘灏忎簬绛変簬0锛岃鏍稿锛亄request.ItemBarcode}");
+ //// 8. 浣跨敤浜嬪姟澶勭悊鎶ュ伐鏁版嵁
+ //UseTransaction(db =>
+ //{
+ // // 9. 澶勭悊鏈夋暟閲忔潯鐮佺殑鑷姩鎶ュ伐
+ // if (barcode.Quantity > 0)
+ // {
+ // var reportQty = barcode.Quantity;
+ // if (reportQty <= 0)
+ // throw new Exception(
+ // $"鎶ュ伐鏁伴噺涓嶈兘灏忎簬绛変簬0锛岃鏍稿锛亄request.ItemBarcode}");
- // var totalQty = (reportedQty ?? 0) + reportQty;
- // if (totalQty > workOrder.Daa008)
- // throw new Exception(
- // $"鏈鎶ュ伐鏁伴噺锛歿reportQty} 澶т簬鍓╀綑鎶ュ伐鏁伴噺锛歿workOrder.Daa008 - reportedQty ?? 0}锛岃鏍稿锛�");
+ // var totalQty = (reportedQty ?? 0) + reportQty;
+ // if (totalQty > workOrder.Daa008)
+ // throw new Exception(
+ // $"鏈鎶ュ伐鏁伴噺锛歿reportQty} 澶т簬鍓╀綑鎶ュ伐鏁伴噺锛歿workOrder.Daa008 - reportedQty ?? 0}锛岃鏍稿锛�");
- // // 10. 鏇存柊鏉$爜鐘舵��
- // db.Updateable<MesInvItemBarcodes>()
- // .SetColumns(x => new MesInvItemBarcodes
- // {
- // WorkFlg = true
- // //Quantity = reportQty
- // })
- // .Where(x => x.Guid == barcode.Guid)
- // .ExecuteCommand();
+ // // 10. 鏇存柊鏉$爜鐘舵��
+ // db.Updateable<MesInvItemBarcodes>()
+ // .SetColumns(x => new MesInvItemBarcodes
+ // {
+ // WorkFlg = true
+ // //Quantity = reportQty
+ // })
+ // .Where(x => x.Guid == barcode.Guid)
+ // .ExecuteCommand();
- // // 11. 鑾峰彇鎴栧垱寤烘姤宸ュ崟
- // var workProd = db.Queryable<MesWorkProd>()
- // .Where(x => x.TaskNo == barcode.BillNo
- // && x.CreateDate.Value.Date.ToString(
- // "yyyy-MM-dd") ==
- // DateTime.Now.Date.ToString("yyyy-MM-dd")
- // && x.BillTypeId == billTypeId
- // && x.TransactionNo == transactionNo
- // && x.ReportBy == request.StaffNo)
- // .First();
+ // // 11. 鑾峰彇鎴栧垱寤烘姤宸ュ崟
+ // var workProd = db.Queryable<MesWorkProd>()
+ // .Where(x => x.TaskNo == barcode.BillNo
+ // && x.CreateDate.Value.Date.ToString(
+ // "yyyy-MM-dd") ==
+ // DateTime.Now.Date.ToString("yyyy-MM-dd")
+ // && x.BillTypeId == billTypeId
+ // && x.TransactionNo == transactionNo
+ // && x.ReportBy == request.StaffNo)
+ // .First();
- // var id = Guid.Empty;
- // var billNo = "";
- // if (workProd == null)
- // {
- // id = Guid.NewGuid();
- // billNo = BillNo.GetBillNo("BG(鎶ュ伐)");
+ // var id = Guid.Empty;
+ // var billNo = "";
+ // if (workProd == null)
+ // {
+ // id = Guid.NewGuid();
+ // billNo = BillNo.GetBillNo("BG(鎶ュ伐)");
- // workProd = new MesWorkProd
- // {
- // Id = id,
- // BillNo = billNo,
- // LineNo = barcode.LineNo,
- // Company = barcode.Company,
- // Factory = barcode.Factory,
- // CreateBy = request.UserNo,
- // CreateDate = DateTime.Now,
- // LastupdateBy = request.UserNo,
- // LastupdateDate = DateTime.Now,
- // BillTypeId = billTypeId,
- // TransactionNo = transactionNo,
- // TaskNo = barcode.BillNo,
- // ReportBy = request.StaffNo,
- // ReportDate = DateTime.Now
- // };
+ // workProd = new MesWorkProd
+ // {
+ // Id = id,
+ // BillNo = billNo,
+ // LineNo = barcode.LineNo,
+ // Company = barcode.Company,
+ // Factory = barcode.Factory,
+ // CreateBy = request.UserNo,
+ // CreateDate = DateTime.Now,
+ // LastupdateBy = request.UserNo,
+ // LastupdateDate = DateTime.Now,
+ // BillTypeId = billTypeId,
+ // TransactionNo = transactionNo,
+ // TaskNo = barcode.BillNo,
+ // ReportBy = request.StaffNo,
+ // ReportDate = DateTime.Now
+ // };
- // db.Insertable(workProd).IgnoreColumns(true)
- // .ExecuteCommand();
- // }
- // else
- // {
- // id = workProd.Id;
- // billNo = workProd.BillNo;
- // }
+ // db.Insertable(workProd).IgnoreColumns(true)
+ // .ExecuteCommand();
+ // }
+ // else
+ // {
+ // id = workProd.Id;
+ // billNo = workProd.BillNo;
+ // }
- // // 12. 鎻掑叆鎶ュ伐鏄庣粏
- // var detailId = Guid.NewGuid();
- // db.Insertable(new MesWorkProdCDetails
- // {
- // Id = detailId,
- // MesWorkProdId = id,
- // BillNo = billNo,
- // ItemBarcode = request.ItemBarcode,
- // Quantity = (int)reportQty,
- // Company = barcode.Company,
- // Factory = barcode.Factory,
- // CreateBy = request.UserNo,
- // CreateDate = DateTime.Now,
- // LastupdateBy = request.UserNo,
- // LastupdateDate = DateTime.Now,
- // ItemNo = item.ItemNo,
- // WorkLast = barcode.WorkLast,
- // SilkPqty = barcode.SilkPqty,
- // SilkId = barcode.SilkId,
- // Silk = barcode.Silk,
- // BgYg = request.StaffNo
- // }).IgnoreColumns(true).ExecuteCommand();
+ // // 12. 鎻掑叆鎶ュ伐鏄庣粏
+ // var detailId = Guid.NewGuid();
+ // db.Insertable(new MesWorkProdCDetails
+ // {
+ // Id = detailId,
+ // MesWorkProdId = id,
+ // BillNo = billNo,
+ // ItemBarcode = request.ItemBarcode,
+ // Quantity = (int)reportQty,
+ // Company = barcode.Company,
+ // Factory = barcode.Factory,
+ // CreateBy = request.UserNo,
+ // CreateDate = DateTime.Now,
+ // LastupdateBy = request.UserNo,
+ // LastupdateDate = DateTime.Now,
+ // ItemNo = item.ItemNo,
+ // WorkLast = barcode.WorkLast,
+ // SilkPqty = barcode.SilkPqty,
+ // SilkId = barcode.SilkId,
+ // Silk = barcode.Silk,
+ // BgYg = request.StaffNo
+ // }).IgnoreColumns(true).ExecuteCommand();
- // // 13. 鏇存柊宸ュ崟宸叉姤宸ユ暟閲�
- // db.Updateable<Womdaa>()
- // .SetColumns(x => new Womdaa
- // {
- // Daa011 = (x.Daa011 ?? 0) + (int)barcode.Quantity
- // })
- // .Where(x => x.Daa001 == barcode.BillNo)
- // .ExecuteCommand();
+ // // 13. 鏇存柊宸ュ崟宸叉姤宸ユ暟閲�
+ // db.Updateable<Womdaa>()
+ // .SetColumns(x => new Womdaa
+ // {
+ // Daa011 = (x.Daa011 ?? 0) + (int)barcode.Quantity
+ // })
+ // .Where(x => x.Daa001 == barcode.BillNo)
+ // .ExecuteCommand();
- // // 14. 閲嶆柊鑾峰彇鏈�鏂板凡鎶ュ伐鏁伴噺
- // reportedQty = db.Queryable<MesWorkProd, MesWorkProdCDetails>(
- // (a, b) =>
- // new JoinQueryInfos(JoinType.Inner,
- // a.BillNo == b.BillNo))
- // .Where((a, b) => a.BillTypeId == billTypeId
- // && a.TransactionNo == transactionNo
- // && a.TaskNo == barcode.BillNo)
- // .Sum((a, b) => b.Quantity);
- // }
+ // // 14. 閲嶆柊鑾峰彇鏈�鏂板凡鎶ュ伐鏁伴噺
+ // reportedQty = db.Queryable<MesWorkProd, MesWorkProdCDetails>(
+ // (a, b) =>
+ // new JoinQueryInfos(JoinType.Inner,
+ // a.BillNo == b.BillNo))
+ // .Where((a, b) => a.BillTypeId == billTypeId
+ // && a.TransactionNo == transactionNo
+ // && a.TaskNo == barcode.BillNo)
+ // .Sum((a, b) => b.Quantity);
+ // }
- // return 1;
- // });
+ // return 1;
+ //});
- // // 15. 杩斿洖澶勭悊缁撴灉
- // return new ScanWorkResult
- // {
- // TaskNo = barcode.BillNo,
- // ItemNo = item.ItemNo,
- // PlanQty = planQty ?? 0,
- // ReportedQty = reportedQty ?? 0,
- // CurrentQty = barcode.Quantity.Value,
- // BarcodeQty = barcode.Quantity.Value,
- // ItemName = item.ItemName,
- // ItemModel = itemModel,
- // Message = "鎵爜鎴愬姛锛�"
- // };
+ //// 15. 杩斿洖澶勭悊缁撴灉
+ //return new ScanWorkResult
+ //{
+ // TaskNo = barcode.BillNo,
+ // ItemNo = item.ItemNo,
+ // PlanQty = planQty ?? 0,
+ // ReportedQty = reportedQty ?? 0,
+ // CurrentQty = barcode.Quantity.Value,
+ // BarcodeQty = barcode.Quantity.Value,
+ // ItemName = item.ItemName,
+ // ItemModel = itemModel,
+ // Message = "鎵爜鎴愬姛锛�"
+ //};
//1.楠岃瘉鍛樺伐淇℃伅
- var staff = Db.Queryable<MesStaff>()
- .Where(x => x.StaffNo == request.StaffNo)
- .First();
+ var staff = Db.Queryable<MesStaff>()
+ .Where(x => x.StaffNo == request.StaffNo)
+ .First();
if (staff == null)
throw new Exception("璇峰厛閫夋嫨浜哄憳");
@@ -293,51 +291,13 @@
var po_outMsg = parameters[2].Value?.ToString() ?? string.Empty;
var po_outSum = parameters[3].Value != DBNull.Value ? Convert.ToInt32(parameters[3].Value) : -1;
var po_womInBarSum = parameters[4].Value != DBNull.Value ? Convert.ToDecimal(parameters[4].Value) : 0m;
-
-
- // 澹版槑鍙橀噺鍦ㄥ灞傦紝纭繚鍦ㄦ墍鏈夊垎鏀腑閮藉彲璁块棶
- MesInvItemIns rksqOrder = null;
- List<MesInvItemInRksqDetails> rksqDetails = new List<MesInvItemInRksqDetails>();
-
- if (po_outSum == 1)
- {
- rksqOrder = Db.Queryable<MesInvItemIns>()
- .Where(x => x.RbillNo == barcode.BillNo && x.TransctionNo == "181" && x.CreateBy == request.StaffNo)
- .First();
-
- if (rksqOrder != null)
- {
- var sql = string.Format(@"SELECT A.item_barcode ItemBarcode,B.QUANTITY BgQuantity,c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel
-FROM MES_INV_ITEM_IN_RKSQ_DETAILS A
-LEFT JOIN MES_INV_ITEM_BARCODES B ON A.item_barcode = B.ITEM_BARCODE
-LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
-WHERE A.bill_no= '{0}' ORDER BY A.create_date DESC", rksqOrder.BillNo);
-
- rksqDetails = Db.Ado.SqlQuery<MesInvItemInRksqDetails>(sql).ToList();
- }
- }
- else if (po_outSum == 2)
- {
- rksqOrder = Db.Queryable<MesInvItemIns>()
- .Where(x => x.RbillNo == barcode.BillNo && x.TransctionNo == "181" && x.CreateBy == request.StaffNo)
- .First();
-
- if (rksqOrder != null)
- {
- rksqOrder.BillNo = "";
- }
-
- rksqDetails = new List<MesInvItemInRksqDetails>();
- }
+
// Check if the procedure failed
if (po_outSum == -1)
{
throw new Exception(po_outMsg);
}
-
- // 澶勭悊rksqOrder涓簄ull鐨勬儏鍐�
- string sjBillNo = rksqOrder?.BillNo ?? "";
// 15. Return processing result
return new ScanWorkResult
@@ -351,8 +311,8 @@
ItemName = item.ItemName,
ItemModel = workOrder.Daa004,
Message = po_outMsg,
- sjBillNo = sjBillNo,
- BarcodesDetail = rksqDetails,
+ //sjBillNo = sjBillNo,
+ //BarcodesDetail = rksqDetails,
};
}
@@ -376,220 +336,124 @@
/// </exception>
public bool ScanWorkProdAsync(ScanWorkRequest request)
{
- //// 1. 楠岃瘉鎶ュ伐鏁伴噺鏄惁澶т簬0
- //if (request.Quantity <= 0)
- // throw new Exception("鎶ュ伐鏁伴噺涓嶈兘灏忎簬绛変簬 0锛岃鏍稿锛�");
+ // 1. 楠岃瘉鎶ュ伐鏁伴噺鏄惁澶т簬0
+ if (request.Quantity <= 0)
+ throw new Exception("鎶ュ伐鏁伴噺涓嶈兘灏忎簬绛変簬 0锛岃鏍稿锛�");
- //// 2. 鏌ヨ鏉$爜淇℃伅锛岄獙璇佹潯鐮佹槸鍚﹀瓨鍦�
- //var barcode = Db.Queryable<MesInvItemBarcodes>()
- // .Where(x => x.ItemBarcode == request.ItemBarcode)
- // .First();
- //if (barcode == null)
- // throw new Exception($"搴撳瓨涓棤姝ゆ潯鐮侊紝璇锋牳瀵癸紒{request.ItemBarcode}");
+ // 2. 鏌ヨ鏉$爜淇℃伅锛岄獙璇佹潯鐮佹槸鍚﹀瓨鍦�
+ var barcode = Db.Queryable<MesInvItemBarcodes>()
+ .Where(x => x.ItemBarcode == request.ItemBarcode)
+ .First();
+ if (barcode == null)
+ throw new Exception($"搴撳瓨涓棤姝ゆ潯鐮侊紝璇锋牳瀵癸紒{request.ItemBarcode}");
- //// 3. 鏌ヨ宸ュ崟淇℃伅锛岄獙璇佸伐鍗曟槸鍚﹀瓨鍦�
- //var womdaa = Db.Queryable<Womdaa>()
- // .Where(x => x.Daa001 == barcode.BillNo)
- // .First();
- //if (womdaa == null)
- // throw new Exception($"鏉$爜涓嶆槸鎶ュ伐鏉$爜/鏃犲搴斿伐鍗曪紝璇锋牳瀵癸紒{request.ItemBarcode}");
+ // 3. 鏌ヨ宸ュ崟淇℃伅锛岄獙璇佸伐鍗曟槸鍚﹀瓨鍦�
+ var womdaa = Db.Queryable<Womdaa>()
+ .Where(x => x.Daa001 == barcode.BillNo)
+ .First();
+ if (womdaa == null)
+ throw new Exception($"鏉$爜涓嶆槸鎶ュ伐鏉$爜/鏃犲搴斿伐鍗曪紝璇锋牳瀵癸紒{request.ItemBarcode}");
- //// 4. 鏍规嵁鏉$爜澶囨敞纭畾鍗曟嵁绫诲瀷鍜屼氦鏄撳彿
- //var billTypeId = 900; // 榛樿鍗曟嵁绫诲瀷
- //var transactionNo = 902; // 榛樿浜ゆ槗鍙�(鍗婃垚鍝佸伐搴�)
- //switch (barcode.Memo?.Trim() ?? "0")
- //{
- // case "涓濆嵃":
- // transactionNo = 901; // 涓濆嵃宸ュ簭
- // break;
- // case "鍗婃垚鍝�":
- // transactionNo = 902; // 鍗婃垚鍝佸伐搴�
- // break;
- // case "鎴愬搧":
- // case "鍖呰":
- // transactionNo = 903; // 鎴愬搧/鍖呰宸ュ簭
- // break;
- //}
-
- //// 5. 姹囨�诲凡鎵潯鐮佹暟閲忥紝楠岃瘉鏄惁瓒呭嚭璁″垝鏁伴噺
- //var sumQty = Db.Queryable<MesWorkProd, MesWorkProdCDetails>((a, b) =>
- // new JoinQueryInfos(JoinType.Inner, a.BillNo == b.BillNo))
- // .Where((a, b) => a.BillTypeId == billTypeId
- // && a.TransactionNo == transactionNo
- // && b.SilkId == barcode.SilkId
- // && a.TaskNo == barcode.BillNo)
- // .Sum((a, b) => b.Quantity);
-
- //sumQty = (sumQty ?? 0) + (int)request.Quantity;
-
- //if (sumQty > womdaa.Daa008)
- // throw new Exception(
- // $"鏈鎶ュ伐鏁伴噺锛歿request.Quantity} 澶т簬鍓╀綑鎶ュ伐鏁伴噺锛歿womdaa.Daa008 - (sumQty - request.Quantity)}锛岃鏍稿锛�");
-
- //// 6. 寮�鍚簨鍔″鐞嗘姤宸ユ暟鎹�
- //return UseTransaction(db =>
- //{
- // // 6.1 鏇存柊鏉$爜淇℃伅锛岃缃凡鎶ュ伐鏍囪鍜屾暟閲�
- // db.Updateable<MesInvItemBarcodes>()
- // .SetColumns(x => x.WorkFlg == true)
- // .SetColumns(x => x.Quantity == request.Quantity)
- // .Where(x => x.Guid == barcode.Guid)
- // .ExecuteCommand();
-
- // // 6.2 鑾峰彇鎴栧垱寤烘姤宸ュ崟
- // var workProd = db.Queryable<MesWorkProd>()
- // .Where(x => x.TaskNo == barcode.BillNo
- // && x.CreateDate.Value.Date.ToString("yyyy-MM-dd") ==
- // DateTime.Now.Date.ToString("yyyy-MM-dd")
- // && x.BillTypeId == billTypeId
- // && x.TransactionNo == transactionNo
- // && x.Status == 0)
- // .First();
-
- // // 6.3 濡傛灉鎶ュ伐鍗曚笉瀛樺湪鍒欏垱寤烘柊鐨勬姤宸ュ崟
- // if (workProd == null)
- // {
- // var billNo = BillNo.GetBillNo("BG(鎶ュ伐缂栧彿)");
- // workProd = new MesWorkProd
- // {
- // Id = Guid.NewGuid(),
- // BillNo = billNo,
- // LineNo = barcode.LineNo,
- // Company = barcode.Company,
- // Factory = barcode.Factory,
- // CreateBy = request.UserNo,
- // CreateDate = DateTime.Now,
- // LastupdateBy = request.UserNo,
- // LastupdateDate = DateTime.Now,
- // PbillNo = barcode.BillNo,
- // BillTypeId = billTypeId,
- // TransactionNo = transactionNo,
- // TaskNo = barcode.BillNo
- // };
-
- // db.Insertable(workProd).IgnoreColumns(true).ExecuteCommand();
- // }
-
- // // 6.4 鎻掑叆鎶ュ伐鏄庣粏璁板綍
- // var detail = new MesWorkProdCDetails
- // {
- // Id = Guid.NewGuid(),
- // BillNo = workProd.BillNo,
- // ItemBarcode = request.ItemBarcode,
- // Quantity = (int)request.Quantity,
- // Company = barcode.Company,
- // Factory = barcode.Factory,
- // CreateBy = request.UserNo,
- // CreateDate = DateTime.Now,
- // LastupdateBy = request.UserNo,
- // LastupdateDate = DateTime.Now,
- // ItemNo = barcode.ItemNo,
- // PbillNo = barcode.BillNo,
- // WorkLast = barcode.WorkLast,
- // SilkPqty = barcode.SilkPqty,
- // SilkId = barcode.SilkId,
- // Silk = barcode.Silk
- // };
-
- // db.Insertable(detail).IgnoreColumns(true).ExecuteCommand();
-
- // return 1;
- //}) > 0;
-
- // 璋冪敤瀛樺偍杩囩▼澶勭悊鐢熶骇鎶ュ伐瀹℃牳
- var parameters = new SqlParameter[]
+ // 4. 鏍规嵁鏉$爜澶囨敞纭畾鍗曟嵁绫诲瀷鍜屼氦鏄撳彿
+ var billTypeId = 900; // 榛樿鍗曟嵁绫诲瀷
+ var transactionNo = 902; // 榛樿浜ゆ槗鍙�(鍗婃垚鍝佸伐搴�)
+ switch (barcode.Memo?.Trim() ?? "0")
{
- // 杈撳嚭鍙傛暟锛氳繑鍥炴秷鎭紙鏈�澶ч暱搴�2500瀛楃锛�
- new SqlParameter("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output },
- // 杈撳嚭鍙傛暟锛氳繑鍥炲奖鍝嶈鏁�
- new SqlParameter("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output },
- // 杈撳叆鍙傛暟锛氭搷浣滀汉宸ュ彿
- new SqlParameter("@userno", request.UserNo),
- // 杈撳叆鍙傛暟锛氬崟鎹紪鍙凤紙杩欓噷浼犲叆浜嗘潯鐮佸�硷級
- new SqlParameter("@inorder", request.sjBillNo),
- // 杈撳叆鍙傛暟锛氭搷浣滅被鍨嬶紙1涓哄鏍革紝0涓哄弽瀹℃牳锛�
- new SqlParameter("@inFieldValue", 1)
- // 娉細浠ヤ笅鍙傛暟鍦ㄥ瓨鍌ㄨ繃绋嬩腑鏈夐粯璁ゅ�硷紝鍙牴鎹渶瑕佹坊鍔�
- // @inFieldName nvarchar(20)=null, // 鎵╁睍瀛楁鍚�
- // @in1 nvarchar(20)=null, // 鎵╁睍瀛楁1
- // @in2 nvarchar(20)=null // 鎵╁睍瀛楁2
- };
-
- // 瀛樺偍杩囩▼鍚嶇О
- string procedureName = "prc_pda_scbg_submit";
- // 鎵ц瀛樺偍杩囩▼
- int res = DbHelperSQL.RunProcedure_NonQuery(procedureName, parameters);
-
- // 鑾峰彇杈撳嚭鍙傛暟鍊硷紙甯︾被鍨嬭浆鎹級
- var outMsg = parameters[0].Value?.ToString() ?? string.Empty; // 杩斿洖娑堟伅
- var outSum = parameters[1].Value != DBNull.Value ? Convert.ToInt32(parameters[1].Value) : -1; // 褰卞搷琛屾暟
-
- if (outSum == -1)
- {
- throw new Exception(outMsg);
+ case "涓濆嵃":
+ transactionNo = 901; // 涓濆嵃宸ュ簭
+ break;
+ case "鍗婃垚鍝�":
+ transactionNo = 902; // 鍗婃垚鍝佸伐搴�
+ break;
+ case "鎴愬搧":
+ case "鍖呰":
+ transactionNo = 903; // 鎴愬搧/鍖呰宸ュ簭
+ break;
}
- else
+
+ // 5. 姹囨�诲凡鎵潯鐮佹暟閲忥紝楠岃瘉鏄惁瓒呭嚭璁″垝鏁伴噺
+ var sumQty = Db.Queryable<MesWorkProd, MesWorkProdCDetails>((a, b) =>
+ new JoinQueryInfos(JoinType.Inner, a.BillNo == b.BillNo))
+ .Where((a, b) => a.BillTypeId == billTypeId
+ && a.TransactionNo == transactionNo
+ && b.SilkId == barcode.SilkId
+ && a.TaskNo == barcode.BillNo)
+ .Sum((a, b) => b.Quantity);
+
+ sumQty = (sumQty ?? 0) + (int)request.Quantity;
+
+ if (sumQty > womdaa.Daa008)
+ throw new Exception(
+ $"鏈鎶ュ伐鏁伴噺锛歿request.Quantity} 澶т簬鍓╀綑鎶ュ伐鏁伴噺锛歿womdaa.Daa008 - (sumQty - request.Quantity)}锛岃鏍稿锛�");
+
+ // 6. 寮�鍚簨鍔″鐞嗘姤宸ユ暟鎹�
+ return UseTransaction(db =>
{
- return true;
- }
+ // 6.1 鏇存柊鏉$爜淇℃伅锛岃缃凡鎶ュ伐鏍囪鍜屾暟閲�
+ db.Updateable<MesInvItemBarcodes>()
+ .SetColumns(x => x.WorkFlg == true)
+ .SetColumns(x => x.Quantity == request.Quantity)
+ .Where(x => x.Guid == barcode.Guid)
+ .ExecuteCommand();
+
+ // 6.2 鑾峰彇鎴栧垱寤烘姤宸ュ崟
+ var workProd = db.Queryable<MesWorkProd>()
+ .Where(x => x.TaskNo == barcode.BillNo
+ && x.CreateDate.Value.Date.ToString("yyyy-MM-dd") ==
+ DateTime.Now.Date.ToString("yyyy-MM-dd")
+ && x.BillTypeId == billTypeId
+ && x.TransactionNo == transactionNo
+ && x.Status == 0)
+ .First();
+
+ // 6.3 濡傛灉鎶ュ伐鍗曚笉瀛樺湪鍒欏垱寤烘柊鐨勬姤宸ュ崟
+ if (workProd == null)
+ {
+ var billNo = BillNo.GetBillNo("BG(鎶ュ伐缂栧彿)");
+ workProd = new MesWorkProd
+ {
+ Id = Guid.NewGuid(),
+ BillNo = billNo,
+ LineNo = barcode.LineNo,
+ Company = barcode.Company,
+ Factory = barcode.Factory,
+ CreateBy = request.UserNo,
+ CreateDate = DateTime.Now,
+ LastupdateBy = request.UserNo,
+ LastupdateDate = DateTime.Now,
+ PbillNo = barcode.BillNo,
+ BillTypeId = billTypeId,
+ TransactionNo = transactionNo,
+ TaskNo = barcode.BillNo
+ };
+
+ db.Insertable(workProd).IgnoreColumns(true).ExecuteCommand();
+ }
+
+ // 6.4 鎻掑叆鎶ュ伐鏄庣粏璁板綍
+ var detail = new MesWorkProdCDetails
+ {
+ Id = Guid.NewGuid(),
+ BillNo = workProd.BillNo,
+ ItemBarcode = request.ItemBarcode,
+ Quantity = (int)request.Quantity,
+ Company = barcode.Company,
+ Factory = barcode.Factory,
+ CreateBy = request.UserNo,
+ CreateDate = DateTime.Now,
+ LastupdateBy = request.UserNo,
+ LastupdateDate = DateTime.Now,
+ ItemNo = barcode.ItemNo,
+ PbillNo = barcode.BillNo,
+ WorkLast = barcode.WorkLast,
+ SilkPqty = barcode.SilkPqty,
+ SilkId = barcode.SilkId,
+ Silk = barcode.Silk
+ };
+
+ db.Insertable(detail).IgnoreColumns(true).ExecuteCommand();
+
+ return 1;
+ }) > 0;
}
-
- public ScanWorkResult GetRksqList(ScanWorkRequest request)
- {
-
- //1.楠岃瘉鍛樺伐淇℃伅
- var staff = Db.Queryable<MesStaff>()
- .Where(x => x.StaffNo == request.StaffNo)
- .First();
- if (staff == null)
- throw new Exception("璇峰厛閫夋嫨浜哄憳");
-
- var rksqOrder = Db.Queryable<MesInvItemIns>()
- .Where(x => x.BillNo == request.sjBillNo && x.Status == 0)
- .First();
- if (rksqOrder == null)
- throw new Exception("璇ユ楠屽崟宸叉彁浜ら�佹");
-
- var sql = string.Format(@"SELECT A.item_barcode ItemBarcode,B.QUANTITY BgQuantity,c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel
- FROM MES_INV_ITEM_IN_RKSQ_DETAILS A
- LEFT JOIN MES_INV_ITEM_BARCODES B ON A.item_barcode = B.ITEM_BARCODE
- LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
- WHERE A.bill_no= '{0}'ORDER BY A.create_date DESC", rksqOrder.BillNo);
-
- var RKSQ = Db.Ado.SqlQuery<MesInvItemInRksqDetails>(sql);
-
-
- var rksqDetails = RKSQ.ToList();
-
-
- //var rksqDetails = Db.Queryable<MesInvItemInRksqDetails>()
- // .Where(x => x.BillNo == )
- // .ToList();
-
- // 15. Return processing result
- return new ScanWorkResult
- {
- BarcodesDetail = rksqDetails,
- };
- }
-
- public ScanWorkResult GetRksqSelect(ScanWorkRequest request)
- {
- //1.楠岃瘉鍛樺伐淇℃伅
- var staff = Db.Queryable<MesStaff>()
- .Where(x => x.StaffNo == request.StaffNo)
- .First();
- if (staff == null)
- throw new Exception("璇峰厛閫夋嫨浜哄憳");
-
- var rksqOrder = Db.Queryable<MesInvItemIns>()
- .Where(x => x.TransctionNo=="181"&& x.Status == 0 && x.CreateBy== request.StaffNo)
- .ToList();
-
- return new ScanWorkResult
- {
- rksqOrderList = rksqOrder,
- };
- }
-
}
\ No newline at end of file
diff --git a/service/Wom/WomdaaManager.cs b/service/Wom/WomdaaManager.cs
index 1436d92..3861ba6 100644
--- a/service/Wom/WomdaaManager.cs
+++ b/service/Wom/WomdaaManager.cs
@@ -2,6 +2,7 @@
using System.Data.SqlClient;
using System.Text;
using Masuit.Tools;
+using Masuit.Tools.Hardware;
using Microsoft.SqlServer.Server;
using NewPdaSqlServer.DB;
using NewPdaSqlServer.Dto.service;
@@ -17,7 +18,7 @@
//杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 WomdaaManager.cs
//鑾峰彇宸ュ崟鍙�
- public List<string> GetProductionPickDaa001(WarehouseQuery query)
+ public List<string> GetProductionPickDaa001(WarehouseQuery query, dynamic requestInfo)
{
var sql =
"SELECT DAA001 FROM WOMDAA A LEFT JOIN (SELECT COUNT(1) UN_NUM, PID FROM WOMDAB WHERE DAB006 > DAB007 GROUP BY DAB002) B ON A.GUID = B.daaGuid WHERE DAA001 = " +
@@ -28,9 +29,57 @@
}
//鏍规嵁宸ュ崟鍙疯繑鍥炰骇鍝佸瀷鍙峰拰寰呴鐗╂枡
- public ProductionPickDto GetItemsByDaa001(WarehouseQuery query)
+ public dynamic GetItemsByDaa001(WarehouseQuery query, dynamic requestInfo)
{
- return getDaa001(query);
+ if (string.IsNullOrEmpty(query.daa001))
+ throw new Exception("璇烽�夊伐鍗曞彿锛�");
+
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
+
+ if (string.IsNullOrEmpty(query.daa001?.ToString()))
+ throw new ArgumentException("宸ュ崟鍙蜂笉鑳戒负绌�", nameof(query.daa001));
+
+ var orgId = requestInfo.OrgId;
+
+ if (orgId == null)
+ throw new Exception("缁勭粐涓嶅瓨鍦紒");
+
+ // 璋冪敤瀛樺偍杩囩▼鑾峰彇鐗╂枡鏄庣粏
+ var parameters = new[]
+ {
+ new SugarParameter("@daa001", query.daa001),
+ new SugarParameter("@pi_orgId",orgId),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+ var womdabs = Db.Ado.SqlQuery<ItemDetailModel>("EXEC prc_pda_scll_detailList @daa001", parameters);
+
+ var DS_list = womdabs.Where(s => s.DSQty > 0).ToList();
+ var YS_list = womdabs.Where(s => s.SQty > 0).ToList();
+
+ // 淇锛氳ˉ鍏呰幏鍙� womdaa 瀵硅薄
+ var daa001Value = query.daa001?.ToString();
+ var womdaa = Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_getDaaInfo @daa001", parameters).First();
+
+ if (womdaa == null)
+ {
+ throw new Exception("璇ュ伐鍗曚俊鎭笉瀛樺湪锛岃鏍稿锛�");
+ }
+
+ var dto = new ProductionPickDto
+ {
+ daa001 = query.daa001,
+ daaInfo = womdaa,
+ PlanNo = womdaa.workNo,
+ startTime = womdaa.startTime,
+ items = DS_list,
+ Ysitems = YS_list
+ };
+
+ return dto;
}
public ProductionPickDto ScanCode(WarehouseQuery query)
@@ -203,7 +252,7 @@
// })
// .ToList();
- var sql =string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,b.dab006 FQty,b.dab007 SQty,b.dab006 - b.dab007 DSQty ,
+ var sql =string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,b.dab006 FQty,b.dab007 SQty,b.dab006 - b.dab007 DSQty ,C.item_id FMaterialId ,
dbo.F_QX_GETRECODEPOTSE(B.dab003,'','','') as RecoKw
FROM WOMDAB B
LEFT JOIN WOMDAA A ON A.guid = B.daaGuid
@@ -265,32 +314,41 @@
/// <returns></returns>
public dynamic getZsBarInfo(dynamic query)
{
+ if (query == null)
+ throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
- var sql = string.Format(@"SELECT TOP 1 A.barCode AS zsBarcode,
- D.name AS lineName,
- D.line_no,
- B.daa001,
- C.item_no,
- C.item_name,
- C.item_model,
- A.quantity as barQty,
- B.daa008 as sumQty,
- isnull((SELECT count(1) FROM WORK_COLLECT WHERE processNo = '{0}' AND ABOUT_GUID = A.ABOUT_GUID),0) AS finQty,
- isnull((SELECT TOP 1 processNo FROM WORK_COLLECT WHERE WORK_COLLECT.barCode = '{1}' AND checkResult = '鈭�' ORDER BY WORK_COLLECT.createDate DESC ),'') AS lastGx
-FROM WORK_TRAC_CODE A
- LEFT JOIN WOMDAA B ON A.ABOUT_GUID = B.guid
- LEFT JOIN MES_ITEMS C ON B.daa002 = C.item_id
- LEFT JOIN MES_WORKSHOP_LINE D ON A.lineId = D.id
-WHERE A.barCode = '{1}'", query.GX, query.Zsbarcode);
+ if (string.IsNullOrEmpty(query.Zsbarcode?.ToString()))
+ throw new ArgumentException("杩芥函鐮佷笉鑳戒负绌�", nameof(query.Zsbarcode));
- var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql);
+ if (string.IsNullOrEmpty(query.GX?.ToString()))
+ throw new ArgumentException("宸ュ簭涓嶈兘涓虹┖", nameof(query.GX));
- if (ZsBarInfo.Count < 1)
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_trac_barcode", query.Zsbarcode),
+ new SugarParameter("@pi_gx", query.GX),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null),
+ new SugarParameter("@inP4", null)
+ };
+
+ try
{
- throw new Exception($"璇ヨ拷婧爜{query.Zsbarcode}涓嶅瓨鍦ㄤ笉瀛樺湪");
- }
+ var ZsBarInfo = Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_scll_selZsBarInfo @pi_trac_barcode,@pi_gx,@inP1,@inP2,@inP3,@inP4", parameters);
- return ZsBarInfo;
+ if (ZsBarInfo.Count < 1)
+ {
+ throw new Exception($"璇ヨ拷婧爜{query.Zsbarcode}涓嶅瓨鍦ㄦ垨宸茬粦瀹�");
+ }
+
+ return ZsBarInfo;
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
}
//鑾峰彇鐢熶骇
@@ -301,12 +359,44 @@
LEFT JOIN WORK_TRAC_CODE B ON A.barCode = B.barCode
LEFT JOIN SYS_USER C ON C.ACCOUNT = A.createBy
LEFT JOIN MES_WORKSHOP_LINE D ON B.lineId = D.id
-WHERE A.barCode = '{0}'", query.Zsbarcode);
+WHERE A.barCode = '{0}'
+ORDER BY A.createDate", query.Zsbarcode);
var Traceability = Db.Ado.SqlQuery<dynamic>(sql);
return Traceability;
}
+
+ /// <summary>
+ /// 鑾峰彇鐗╂枡鐩稿叧鏉$爜淇℃伅
+ /// </summary>
+ /// <param name="unity"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public dynamic GetBarKwByItem(dynamic unity)
+ {
+ if (unity == null)
+ throw new ArgumentNullException(nameof(unity), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
+
+ if (string.IsNullOrEmpty(unity.itemId?.ToString()))
+ throw new ArgumentException("鐗╂枡ID涓嶈兘涓虹┖", nameof(unity.itemId));
+
+ try
+ {
+ var parameters = new List<SugarParameter>
+ {
+ new SugarParameter("@itemId", unity.itemId)
+ };
+
+ return Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_scll_selBarMx @itemId", parameters);
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"鑾峰彇鏉$爜淇℃伅澶辫触锛歿ex.Message}");
+ }
+
+ }
+
public dynamic ProductBinding(dynamic query)
{
@@ -384,7 +474,7 @@
if (string.IsNullOrEmpty(query.Kbbarcode?.ToString()))
throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.userName));
- var sql = string.Format(@"SELECT OLDQTY,
+ var sql = string.Format(@"SELECT QUANTITY,
ISNULL((SELECT COUNT(1) FROM MES_INV_ITEM_BARCODES_TBMX WHERE ABOUT_TB_BARCODE = '{0}'), 0) AS YSum,
DAA001
FROM MES_INV_ITEM_BARCODES A LEFT JOIN WOMDAA B ON A.ABOUT_GUID = B.guid
@@ -665,7 +755,7 @@
//鏍规嵁宸ュ崟鍙疯繑鍥炰骇鍝佸瀷鍙峰拰寰呴鐗╂枡
- public XcslResultDto GetItemsXcsl(WarehouseQuery query)
+ public dynamic GetItemsXcsl(WarehouseQuery query)
{
if (string.IsNullOrEmpty(query.daa001)) throw new Exception("宸ュ崟鍙蜂负绌�");
@@ -684,73 +774,49 @@
if (womdaa?.Daa001 == null) throw new Exception("宸ュ崟鍙蜂笉瀛樺湪");
- // 浣跨敤鍙傛暟鍖栨煡璇㈤槻姝QL娉ㄥ叆
- var sqlParams = new List<SugarParameter> { new("@daa001", query.daa001) };
+ if (womdaa?.Daa001 == null) throw new Exception("宸ュ崟鍙蜂笉瀛樺湪");
- var sql1 = @"SELECT A.item_out_no,
- SUM(B.QUANTITY) AS BL_Num,
- ISNULL(Sub.JS_Sum, 0) AS JS_Num, -- 浣跨敤LEFT JOIN瀛愭煡璇㈢殑缁撴灉
- C.item_no,
- C.item_name,
- C.item_model,
- D.USER_NAME
-FROM MES_INV_ITEM_OUTS A
- LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
- LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
- LEFT JOIN SYS_USER D ON A.create_by = D.ACCOUNT
--- 鏂板LEFT JOIN鑱氬悎瀛愭煡璇�
- LEFT JOIN (SELECT B1.ITEM_ID,
- SUM(B1.QUANTITY) AS JS_Sum
- FROM MES_INV_ITEM_OUTS A1
- LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B1 ON A1.GUID = B1.ITEM_OUT_ID
- WHERE A1.out_type = '鐢熶骇棰嗘枡'
- AND A1.task_no = @daa001
- AND ISNULL(B1.IS_XCSL, '0') = 1
- GROUP BY B1.ITEM_ID -- 鎸塈TEM_ID鎻愬墠鑱氬悎
-) AS Sub ON Sub.ITEM_ID = C.item_id
-WHERE A.out_type = '鐢熶骇棰嗘枡'
- AND A.task_no = @daa001
-GROUP BY A.item_out_no,
- C.item_no,
- C.item_name,
- C.item_model,
- D.USER_NAME,
- C.item_id,
- ISNULL(Sub.JS_Sum, 0);";
+ // 浣跨敤ADO.NET鐩存帴璋冪敤瀛樺偍杩囩▼
+ var ds = new DataSet();
- var XcslItem = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams);
+ // 鍋囪鎮ㄤ娇鐢ㄧ殑鏄疭QL Server锛屽垱寤篠qlConnection
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ conn.Open();
- var sql2 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,A.create_date
-FROM MES_INV_ITEM_OUTS A
-LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
-LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
-LEFT JOIN SYS_USER D ON A.create_by = D.ACCOUNT
-WHERE out_type = '鐢熶骇棰嗘枡'
-AND A.task_no = @daa001
-AND ISNULL(IS_XCSL,'0') = 0";
+ using (var cmd = new SqlCommand("prc_pda_xcsl_detailList", conn))
+ {
+ cmd.CommandType = CommandType.StoredProcedure;
- var XcslWjsBar = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams);
+ // 娣诲姞鍙傛暟
+ cmd.Parameters.Add(new SqlParameter("@daa001", query.daa001));
+ cmd.Parameters.Add(new SqlParameter("@pi_orgId", DBNull.Value));
+ cmd.Parameters.Add(new SqlParameter("@inP1", DBNull.Value));
+ cmd.Parameters.Add(new SqlParameter("@inP2", DBNull.Value));
+ cmd.Parameters.Add(new SqlParameter("@inP3", DBNull.Value));
+ cmd.Parameters.Add(new SqlParameter("@inP4", DBNull.Value));
- var sql3 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,B.XCSL_CREATE_DATE
-FROM MES_INV_ITEM_OUTS A
-LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
-LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
-LEFT JOIN SYS_USER D ON B.XCSL_CREATE_BY = D.ACCOUNT
-WHERE out_type = '鐢熶骇棰嗘枡'
-AND A.task_no = @daa001
-AND ISNULL(IS_XCSL,'0') = 1";
+ using (var adapter = new System.Data.SqlClient.SqlDataAdapter(cmd))
+ {
+ adapter.Fill(ds);
+ }
+ }
+ }
- var XcslYjsBar = Db.Ado.SqlQuery<dynamic>(sql3, sqlParams);
+ // 杞崲缁撴灉
+ var XcslItem = Db.Utilities.DataTableToDynamic(ds.Tables[0]);
+ var XcslWjsBar = Db.Utilities.DataTableToDynamic(ds.Tables[1]);
+ var XcslYjsBar = Db.Utilities.DataTableToDynamic(ds.Tables[2]);
+ var daaInfo = Db.Utilities.DataTableToDynamic(ds.Tables[3]);
-
- var dto = new XcslResultDto
+ var dto = new
{
GD_Num = womdaa.Daa008,
workNo = womdaa.Daa021,
XcslItemList = XcslItem,
XcslWjsBarList = XcslWjsBar,
- XcslYjsBarList = XcslYjsBar
-
+ XcslYjsBarList = XcslYjsBar,
+ DaaInfoList = daaInfo
};
return dto;
@@ -894,32 +960,45 @@
}
}
- public dynamic GetXcslDaa(dynamic unity)
+ public dynamic GetXcslDaa(dynamic unity,dynamic RequestInfo)
{
- var sqlParams = new List<SugarParameter> { };
+ //var sqlParams = new List<SugarParameter> { };
- var sql2 = new StringBuilder(@"
- SELECT '['+DAA001+']['+DAA021+']' AS daaInfo,DAA001,DAA021
- FROM WOMDAA
- WHERE daa018 <>'W:瀹屽伐'");
+ //var sql2 = new StringBuilder(@"
+ //SELECT '['+DAA001+']['+DAA021+']' AS daaInfo,DAA001,DAA021
+ //FROM WOMDAA
+ //WHERE daa018 <>'W:瀹屽伐'");
- if (!string.IsNullOrWhiteSpace(unity.selectKey?.ToString()))
+ //if (!string.IsNullOrWhiteSpace(unity.selectKey?.ToString()))
+ //{
+ // sqlParams.Add(new("@selectKey", unity.selectKey));
+ // sql2.Append(@"
+ // AND (DAA001 LIKE '%' + @selectKey + '%'
+ // OR DAA021 LIKE '%' + @selectKey + '%')");
+ //}
+
+ //var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ //if (XcslItem == null)
+ //{
+ // throw new Exception("璇ユ潯浠朵笅鏃犲搴斿伐鍗曚俊鎭紝璇烽噸鏂拌緭鍏ワ紒");
+ //}
+ var orgId = RequestInfo.OrgId;
+ var parameters = new List<SugarParameter>
{
- sqlParams.Add(new("@selectKey", unity.selectKey));
- sql2.Append(@"
- AND (DAA001 LIKE '%' + @selectKey + '%'
- OR DAA021 LIKE '%' + @selectKey + '%')");
- }
+ new SugarParameter("@selectKey", unity.selectKey),
+ new SugarParameter("@inP1", orgId), // 鍙�夊弬鏁�
+ new SugarParameter("@inP2", unity.selDaaType), // 鍙�夊弬鏁�
+ new SugarParameter("@inP3", null), // 鍙�夊弬鏁�
+ new SugarParameter("@inP4", null), // 鍙�夊弬鏁�
+ // ...鍏朵粬鍙�夊弬鏁�
+ };
- var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+ var result = Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_getWorkOrderInfo @selectKey, @inP1, @inP2, @inP3, @inP4", parameters);
- if (XcslItem == null)
- {
- throw new Exception("璇ユ潯浠朵笅鏃犲搴斿伐鍗曚俊鎭紝璇烽噸鏂拌緭鍏ワ紒");
- }
- return XcslItem;
+ return result;
}
@@ -1087,4 +1166,423 @@
}
}
+
+ /// <summary>
+ /// 鍐呯鏍稿锛氳幏鍙栧悗鐩栫爜瀵瑰簲浜у搧淇℃伅
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ public dynamic getHgBarInfo(dynamic query)
+ {
+
+ var sql = string.Format(@"DECLARE @ZsBar varchar(100)
+SELECT TOP 1 @ZsBar= ABOUT_TRAC_BARCODE FROM MES_INV_ITEM_BARCODES_TBMX WHERE ITEM_BARCODE = '{1}'
+SELECT TOP 1 A.barCode AS zsBarcode,
+ D.name AS lineName,
+ D.line_no,
+ B.daa001,
+ C.item_no,
+ C.item_name,
+ C.item_model,
+ A.quantity as barQty,
+ B.daa008 as sumQty,
+ isnull((SELECT count(1) FROM WORK_COLLECT WHERE processNo = '{0}' AND ABOUT_GUID = A.ABOUT_GUID),0) AS finQty,
+ isnull((SELECT TOP 1 processNo FROM WORK_COLLECT WHERE WORK_COLLECT.barCode = @ZsBar AND ISNULL(checkResult,'') = '鈭�' AND ISNULL(barCodeStatus,1) = 1 ORDER BY WORK_COLLECT.createDate DESC ),'') AS lastGx
+FROM WORK_TRAC_CODE A
+ LEFT JOIN WOMDAA B ON A.ABOUT_GUID = B.guid
+ LEFT JOIN MES_ITEMS C ON B.daa002 = C.item_id
+ LEFT JOIN MES_WORKSHOP_LINE D ON A.lineId = D.id
+WHERE A.barCode = @ZsBar", query.GX, query.Zsbarcode);
+
+ var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql);
+
+ if (ZsBarInfo.Count < 1)
+ {
+ throw new Exception($"璇ュ悗鐩栫爜{query.Zsbarcode}涓嶅瓨鍦ㄦ垨鏈粦瀹�");
+ }
+
+ return ZsBarInfo;
+ }
+
+ /// <summary>
+ /// 鍐呯鏍稿锛氭牴鎹祦姘寸爜鑾峰彇鐢熶骇灞ュ巻
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ public dynamic getTraceabilityByLsBar(dynamic query)
+ {
+ var sql = string.Format(@"SELECT processNo, A.barCode, B.lineId, line_no, name AS lineName, checkResult, C.USER_NAME
+FROM WORK_COLLECT A
+ LEFT JOIN WORK_TRAC_CODE B ON A.barCode = B.barCode
+ LEFT JOIN SYS_USER C ON C.ACCOUNT = A.createBy
+ LEFT JOIN MES_WORKSHOP_LINE D ON B.lineId = D.id
+WHERE A.barCode = (SELECT TOP 1 ABOUT_TRAC_BARCODE FROM MES_INV_ITEM_BARCODES_TBMX WHERE ITEM_BARCODE = '{0}')
+ORDER BY A.createDate", query.Zsbarcode);
+
+ var Traceability = Db.Ado.SqlQuery<dynamic>(sql);
+
+ return Traceability;
+ }
+
+ /// <summary>
+ /// 鍐呯鏍稿锛氭壂鐮佹牳瀵�
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ /// <exception cref="ArgumentNullException"></exception>
+ /// <exception cref="ArgumentException"></exception>
+ /// <exception cref="Exception"></exception>
+ public dynamic ScanNxhd(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
+
+ // 2. 浣跨敤 string.IsNullOrEmpty 鐩存帴鍒ゆ柇瀛楃涓插睘鎬э紙閬垮厤 NullReferenceException锛�
+ if (string.IsNullOrEmpty(query.userName?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
+
+ if (string.IsNullOrEmpty(query.ZsBar?.ToString()))
+ throw new ArgumentException("鍚庣洊鐮佷笉鍏佽涓虹┖", nameof(query.ZsBar));
+
+ if (string.IsNullOrEmpty(query.LsBar?.ToString()))
+ throw new ArgumentException("绠辨潯鐮佷笉鍏佽涓虹┖", nameof(query.LsBar));
+
+ var _strMsg = "";
+ var _intSum = "";
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("prc_pda_Scan_Nxhd", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
+ new("@pi_hg_barcode", SqlDbType.NVarChar, 100) { Value = query.ZsBar },
+ new("@pi_x_barcode", SqlDbType.NVarChar, 100) { Value = query.LsBar },
+ new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
+ new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
+ };
+
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+
+ cmd.ExecuteNonQuery();
+
+ _strMsg = parameters[3].Value?.ToString() ?? "";
+ _intSum = parameters[4].Value?.ToString() ?? "-1";
+
+ var result = Convert.ToInt32(_intSum);
+ if (result <= 0) throw new Exception(_strMsg);
+
+ var dto = new
+ {
+ message = _strMsg,
+ status = result,
+ tracBarcode = query.ZsBar
+ };
+
+ return dto;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鍐呯鏍稿锛氭壂鐮佹牳瀵�
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ /// <exception cref="ArgumentNullException"></exception>
+ /// <exception cref="ArgumentException"></exception>
+ /// <exception cref="Exception"></exception>
+ public dynamic ScanFgbd(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
+
+ if (string.IsNullOrEmpty(query.userName?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
+
+ if (string.IsNullOrEmpty(query.HgBar?.ToString()))
+ throw new ArgumentException("鍚庣洊鐮佷笉鍏佽涓虹┖", nameof(query.HgBar));
+
+ if (string.IsNullOrEmpty(query.FgBar?.ToString()))
+ throw new ArgumentException("杩斿伐鐮佷笉鍏佽涓虹┖", nameof(query.FgBar));
+
+ var _strMsg = "";
+ var _intSum = "";
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("prc_pda_Scan_Fgbd", conn))
+ {
+ try
+ {
+ conn.Open();
+ cmd.CommandType = CommandType.StoredProcedure;
+ SqlParameter[] parameters =
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
+ new("@pi_fg_barcode", SqlDbType.NVarChar, 100) { Value = query.FgBar },
+ new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = query.HgBar },//鍚庣洊/娴佹按
+ new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
+ new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
+ };
+
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+
+ cmd.ExecuteNonQuery();
+
+ _strMsg = parameters[3].Value?.ToString() ?? "";
+ _intSum = parameters[4].Value?.ToString() ?? "-1";
+
+ var result = Convert.ToInt32(_intSum);
+ if (result <= 0) throw new Exception(_strMsg);
+
+ var dto = new
+ {
+ message = _strMsg,
+ status = result,
+ tracBarcode = query.ZsBar
+ };
+
+ return dto;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ conn.Close();
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇AGV绾夸綋鍒楄〃
+ /// </summary>
+ /// <param name="unity"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public dynamic GetAgvXt(dynamic unity)
+ {
+
+ var sqlParams = new List<SugarParameter> { };
+
+ var sql2 = new StringBuilder(@"
+SELECT NAME,line_no FROM MES_WORKSHOP_LINE WHERE isAgv = 1 ORDER BY line_no");
+
+
+ var XtItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
+
+ if (XtItem == null)
+ {
+ throw new Exception("鏃犲搴擜GV缁戝畾绾夸綋淇℃伅锛�");
+ }
+
+ return XtItem;
+ }
+
+ /// <summary>
+ /// AGV閫佹
+ /// </summary>
+ /// <param name="query"></param>
+ /// <returns></returns>
+ /// <exception cref="ArgumentNullException"></exception>
+ /// <exception cref="ArgumentException"></exception>
+ /// <exception cref="Exception"></exception>
+ public dynamic HandleAGVInspection(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query));
+
+ if (string.IsNullOrEmpty(query.userAccount?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛璐﹀彿涓嶈兘涓虹┖", nameof(query.userAccount));
+
+ if (string.IsNullOrEmpty(query.KbBar?.ToString()))
+ throw new ArgumentException("鍗℃澘鏉$爜涓嶈兘涓虹┖", nameof(query.KbBar));
+
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("prc_pda_AgvSj", conn))
+ {
+ cmd.CommandType = CommandType.StoredProcedure;
+ var parameters = new SqlParameter[]
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
+ new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar },
+ new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output },
+ new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output }
+ };
+
+ cmd.Parameters.AddRange(parameters);
+ conn.Open();
+ cmd.ExecuteNonQuery();
+
+ var result = new
+ {
+ message = parameters[2].Value?.ToString(),
+ status = Convert.ToInt32(parameters[3].Value)
+ };
+
+ if (result.status <= 0)
+ throw new Exception(result.message);
+
+ return result;
+ }
+ }
+ }
+
+ public dynamic HandleAGVCall(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query));
+
+ if (string.IsNullOrEmpty(query.userAccount?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛璐﹀彿涓嶈兘涓虹┖", nameof(query.userAccount));
+
+ if (string.IsNullOrEmpty(query.XtNum?.ToString()))
+ throw new ArgumentException("绾夸綋缂栧彿涓嶈兘涓虹┖", nameof(query.XtNum));
+
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("prc_pda_AgvHj", conn))
+ {
+ cmd.CommandType = CommandType.StoredProcedure;
+ var parameters = new SqlParameter[]
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
+ new("@pi_xtNum", SqlDbType.NVarChar, 100) { Value = query.XtNum },
+ new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output },
+ new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output }
+ };
+
+ cmd.Parameters.AddRange(parameters);
+ conn.Open();
+ cmd.ExecuteNonQuery();
+
+ var result = new
+ {
+ message = parameters[2].Value?.ToString(),
+ status = Convert.ToInt32(parameters[3].Value)
+ };
+
+ if (result.status <= 0)
+ throw new Exception(result.message);
+
+ return result;
+ }
+ }
+ }
+
+
+ public dynamic HandleAgvJy(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query));
+
+ // 鍙傛暟楠岃瘉寮哄寲
+ if (string.IsNullOrEmpty(query.userAccount?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userAccount));
+
+ if (string.IsNullOrEmpty(query.KbBar?.ToString()))
+ throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.KbBar));
+
+ if (string.IsNullOrEmpty(query.jyz?.ToString()))
+ throw new ArgumentException("妫�楠岀粨鏋滀笉鍏佽涓虹┖", nameof(query.jyz));
+
+ var _strMsg = "";
+ var _intSum = "";
+
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("prc_pda_AgvJy", conn))
+ {
+ cmd.CommandType = CommandType.StoredProcedure;
+
+ // 娣诲姞瀛樺偍杩囩▼鍙傛暟
+ SqlParameter[] parameters =
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
+ new("@pi_kbBarcode", SqlDbType.NVarChar, 100) { Value = query.KbBar },
+ new("@pi_jyz", SqlDbType.NVarChar, 100) { Value = query.jyz },
+ new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output },
+ new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output }
+ };
+
+ foreach (var parameter in parameters)
+ cmd.Parameters.Add(parameter);
+
+ conn.Open();
+ cmd.ExecuteNonQuery();
+
+ _strMsg = parameters[3].Value?.ToString() ?? "";
+ _intSum = parameters[4].Value?.ToString() ?? "-1";
+
+ var result = Convert.ToInt32(_intSum);
+ if (result <= 0) throw new Exception(_strMsg);
+
+ return new
+ {
+ message = _strMsg,
+ status = result,
+ kbBarcode = query.KbBar
+ };
+ }
+ }
+ }
+
+ public dynamic HandleAgvRk(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query));
+
+ if (string.IsNullOrEmpty(query.userAccount?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛璐﹀彿涓嶈兘涓虹┖", nameof(query.userAccount));
+
+ if (string.IsNullOrEmpty(query.KbBar?.ToString()))
+ throw new ArgumentException("鍗℃澘鏉$爜涓嶈兘涓虹┖", nameof(query.KbBar));
+
+ if (string.IsNullOrEmpty(query.Postition?.ToString()))
+ throw new ArgumentException("妤煎眰浣嶇疆涓嶈兘涓虹┖", nameof(query.Postition));
+
+ using (var conn = new SqlConnection(DbHelperSQL.strConn))
+ {
+ using (var cmd = new SqlCommand("prc_pda_AgvRk", conn))
+ {
+ cmd.CommandType = CommandType.StoredProcedure;
+ var parameters = new SqlParameter[]
+ {
+ new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
+ new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar },
+ new("@pi_kb_Postition", SqlDbType.NVarChar, 100) { Value = query.Postition },
+ new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output },
+ new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output }
+ };
+
+ cmd.Parameters.AddRange(parameters);
+ conn.Open();
+ cmd.ExecuteNonQuery();
+
+ var result = new
+ {
+ message = parameters[3].Value?.ToString(),
+ status = Convert.ToInt32(parameters[4].Value)
+ };
+
+ if (result.status <= 0)
+ throw new Exception(result.message);
+
+ return result;
+ }
+ }
+ }
+
}
\ No newline at end of file
diff --git a/service/Wom/WomdaahbManager.cs b/service/Wom/WomdaahbManager.cs
deleted file mode 100644
index 4c4edc2..0000000
--- a/service/Wom/WomdaahbManager.cs
+++ /dev/null
@@ -1,1121 +0,0 @@
-锘縰sing System.Data;
-using System.Data.SqlClient;
-using System.Text;
-using Masuit.Tools;
-using Microsoft.SqlServer.Server;
-using NewPdaSqlServer.DB;
-using NewPdaSqlServer.Dto.service;
-using NewPdaSqlServer.entity;
-using NewPdaSqlServer.entity.Base;
-using SqlSugar;
-
-namespace NewPdaSqlServer.service.Wom;
-
-public class WomdaahbManager : Repository<Womdaa>
-{
- //褰撳墠绫诲凡缁忕户鎵夸簡 Repository 澧炪�佸垹銆佹煡銆佹敼鐨勬柟娉�
- //杩欓噷闈㈠啓鐨勪唬鐮佷笉浼氱粰瑕嗙洊,濡傛灉瑕侀噸鏂扮敓鎴愯鍒犻櫎 WomdaaManager.cs
-
- //鑾峰彇宸ュ崟鍙�
- public List<string> GetProductionPickDaa001(WarehouseQuery query)
- {
- var sql =
- "SELECT DAAhb001 FROM WOMDAAhb A WHERE DAAHB001 = " +
- query.hbNo +
- " and FSTATUS=1 order by a.CREATE_DATE desc";
-
- return Db.Ado.SqlQuery<string>(sql);
- }
-
- //鏍规嵁宸ュ崟鍙疯繑鍥炰骇鍝佸瀷鍙峰拰寰呴鐗╂枡
- public ProductionPickDto GetItemsByDaa001(WarehouseQuery query)
- {
- return getDaa001(query);
- }
-
- public ProductionPickDto ScanCode(WarehouseQuery query)
- {
- var _strMsg = "";
- var _intSum = "";
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
- if (query.hbNo.IsNullOrEmpty()) throw new Exception("鍚堝苟棰嗘枡鍗曞彿涓嶅厑璁镐负绌�");
- if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
-
- using (var cmd = new SqlCommand("[prc_pda_SCLLHB]", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
- SqlParameter[] parameters =
- {
- new("@outMsg", SqlDbType.NVarChar, 300),
- new("@outSum", SqlDbType.NVarChar, 300),
- new("@barcode_num", SqlDbType.NVarChar, 300),
- new("@split_num", SqlDbType.NVarChar, 300),
- new("@c_User", query.userName),
- new("@p_biLL_no", query.hbNo),
- new("@p_item_barcode", query.barcode)
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Direction = ParameterDirection.Output;
- parameters[2].Direction = ParameterDirection.Output;
- parameters[3].Direction = ParameterDirection.Output;
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
- cmd.ExecuteNonQuery();
- _strMsg = parameters[0].Value.ToString();
- _intSum = parameters[1].Value.ToString();
-
- var barcodeNum = parameters[2].Value.ToString();
- var splitNum = parameters[3].Value.ToString();
-
- var result = Convert.ToInt32(_intSum);
- if (result <= 0) throw new Exception(_strMsg);
-
- var dto = new ProductionPickDto
- {
- daa001 = query.hbNo,
- barcodeNum = barcodeNum,
- splitNum = splitNum,
- barcode = query.barcode,
- strMsg = _strMsg,
- result = _intSum
- };
-
- return dto;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }
-
- //prC_pda_SCLL_CF
- public ProductionPickDto ScanCodeCF(WarehouseQuery query)
- {
- if (query.userName.IsNullOrEmpty()) throw new Exception("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖");
- if (query.hbNo.IsNullOrEmpty()) throw new Exception("鍚堝苟棰嗘枡鍗曞彿涓嶅厑璁镐负绌�");
- if (query.barcode.IsNullOrEmpty()) throw new Exception("鏉$爜涓嶅厑璁镐负绌�");
-
- if (query.Num is null or 0) throw new Exception("鏉$爜鎷嗗垎鏁颁笉鍏佽涓虹┖鎴栬�呬负0");
-
- var _strMsg = "";
- var _intSum = "";
- var _cfBar = "";//鎷嗗垎鍚庢潯鐮�
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- using (var cmd = new SqlCommand("[prc_pda_SCLLHB_CF]", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
- SqlParameter[] parameters =
- {
- new("@outMsg", SqlDbType.NVarChar, 2000),
- new("@outSum", SqlDbType.NVarChar, 300),
- new("@outCfBar", SqlDbType.NVarChar, 300),
- new("@c_User", query.userName),
- new("@p_biLL_no", query.hbNo),
- new("@p_item_barcode", query.barcode),
- new("@num", query.Num)
- };
- parameters[0].Direction = ParameterDirection.Output;
- parameters[1].Direction = ParameterDirection.Output;
- parameters[2].Direction = ParameterDirection.Output;
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
- cmd.ExecuteNonQuery();
- _strMsg = parameters[0].Value.ToString();
- _intSum = parameters[1].Value.ToString();
- _cfBar = parameters[2].Value.ToString();
-
-
- var result = Convert.ToInt32(_intSum);
- if (result <= 0) throw new Exception(_strMsg);
-
- var dto = new ProductionPickDto
- {
- daa001 = query.hbNo,
- barcode = query.barcode,//鍘熸潯鐮�
- cfBarcode = _cfBar//鎷嗗垎鍚庢潯鐮�
- };
-
- return dto;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }
-
- private ProductionPickDto getDaa001(WarehouseQuery query)
- {
- if (string.IsNullOrEmpty(query.hbNo)) throw new Exception("鍚堝苟鍗曞彿涓虹┖");
-
- var queryResult = Db.Queryable<Womdaahb, Womdaa, MesItems>(
- (b, a, i) => new JoinQueryInfos(
- JoinType.Left, b.OrgId.ToString() == a.ErpSczz, // Womdaahb 鈫� Womdaa 鍏宠仈
- JoinType.Left, a.Daa002 == i.ItemId.ToString()) // Womdaa 鈫� MesItems 鍏宠仈
- )
- .Where((b, a, i) =>
- (b.Daah009 != null && a.Daa021 != null) && // 闃叉null寮傚父
- (
- b.Daah009.Contains("," + a.Daa021 + ",") || // 鍖归厤涓棿鍊�
- b.Daah009.StartsWith(a.Daa021 + ",") || // 鍖归厤寮�澶村��
- b.Daah009.EndsWith("," + a.Daa021) || // 鍖归厤缁撳熬鍊�
- b.Daah009 == a.Daa021 // 瀹屽叏鍖归厤
- )
- )
- .Where((b, a, i) => b.Daahb001 == query.hbNo && b.Fstatus == 1) // 鍏朵粬鏉′欢
- .Select((b, a, i) => new
- {
- b.Daahb001,
- a.Daa001, // 宸ュ崟鍙�
- a.CaaGuid, // Womdaa 鐨� GUID
- i.ItemName // MesItems 鐨勫瓧娈�
- })
- .First();
-
- if (queryResult?.Daahb001 == null) throw new Exception("鍚堝苟鍗曞彿涓嶅瓨鍦�");
-
- //var womdabs = Db.Queryable<Womdaa, Womdab, MesItems, Womcab>(
- // (a, b, c, d) =>
- // new JoinQueryInfos(
- // JoinType.Left,
- // a.Guid == b.DaaGuid,
- // JoinType.Inner,
- // c.Id.ToString() ==
- // b.Dab003,
- // JoinType.Inner, b.Erpid == d.Erpid
- // ))
- // .Where((a, b, c, d) =>
- // a.Daa001 == query.daa001 && d.Iss1ueType == "1")
- // .Select((a, b, c, d) => new ItemDetailModel
- // {
- // ItemNo = c.ItemNo,
- // ItemName = c.ItemName,
- // ItemModel = c.ItemModel,
- // FQty = b.Dab006, // 鐢宠鏁伴噺
- // SQty = b.Dab007, // 宸叉壂鏁伴噺
- // DSQty = b.Dab006 - b.Dab007, // 宸叉壂鏁伴噺
- // })
- // .ToList();
-
- var sql =string.Format(@"SELECT max(ahb.GUID) as hbguid,
- m.item_no as itemNo,
- max(m.item_name) as itemName,
- max(m.item_model) as itemModel,
- sum(b.dab006) as FQty,
- sum(b.dab007) as SQty,
- sum(b.dab006) - sum(b.dab007) as DSQty,
- sum(b.dab020) as slsl,
- max(u.fname) as dw,
- max(ahb.DAAHB001) as hbdh,
- dbo.F_QX_GETRECODEPOTSE(MAX(B.DAB003),'','','') AS RecoKw
- FROM WOMDAAHB ahb
- left join WOMDAAHB_LIST ahbl on ahb.GUID = ahbl.MID
- left join WOMDAA A on ahbl.PWORK_NO = a.daa021 and ahb.org_id = a.erp_sczz
- left join WOMDAB b on b.daaGuid = a.guid
- left join WOMCAA ca on a.caaGuid = ca.guid
- LEFT JOIN WOMCAB D ON B.erpid = D.ERPID
- LEFT JOIN MES_WORKSHOP_LINE WL ON WL.ID = A.DAA015
- left join mes_items m on M.ID = b.dab003
- left join MES_UNIT u on u.id = ahbl.UNIT
- left join [dbo].[v_caa] v on v.guid = a.guid
- WHERE ahb.daahb001 = '{0}' AND D.ISSUE_TYPE = 1
- group by m.item_no
- ORDER BY m.item_no
- ", query.hbNo);
-
- var womdabs = Db.Ado.SqlQuery<ItemDetailModel>(sql);
-
-
- var DS_list = womdabs.Where(s => s.DSQty > 0).ToList();
-
- var YS_list = womdabs.Where(s => s.SQty > 0).ToList();
-
- var mesInvItemOutCDetailsList = Db
- .Queryable<MesInvItemOutCDetails, MesItems, MesDepots>
- ((a, b, c) =>
- new JoinQueryInfos(
- JoinType.Inner, a.ItemId == b.Id,
- JoinType.Inner, c.DepotId == a.DepotId
- ))
- .Where((a, b, c) => a.WorkNo == query.daa001)
- .Select((a, b, c) => new MesInvItemOutCDetails
- {
- ItemName = b.ItemName,
- ItemNo = b.ItemNo,
- ItemId = a.ItemId,
- DepotId = a.DepotId,
- WorkNo = a.WorkNo,
- DepotName = c.DepotName,
- Quantity = a.Quantity
- })
- .ToList();
-
- var womcaa = Db.Queryable<Womcaa>().Where(s => s.Guid == queryResult.CaaGuid)
- .First();
-
- if (womcaa == null)
- {
- throw new Exception("鐢熶骇浠诲姟鍗曚笉瀛樺湪");
- }
-
- var dto = new ProductionPickDto
- {
- daa001 = queryResult.Daahb001,
- //PlanNo = womcaa.Caa020,
- items = DS_list,
- Ysitems = YS_list
- // yisao = mesInvItemOutCDetailsList
- };
-
- return dto;
- }
-
- /// <summary>
- /// 鑾峰彇宸ュ崟鏉$爜淇℃伅
- /// </summary>
- /// <param name="query"></param>
- /// <returns></returns>
- public dynamic getZsBarInfo(dynamic query)
- {
-
- var sql = string.Format(@"SELECT TOP 1 A.barCode AS zsBarcode,
- D.name AS lineName,
- D.line_no,
- B.daa001,
- C.item_no,
- C.item_name,
- C.item_model,
- A.quantity as barQty,
- B.daa008 as sumQty,
- isnull((SELECT count(1) FROM WORK_COLLECT WHERE processNo = '{0}' AND ABOUT_GUID = A.ABOUT_GUID),0) AS finQty,
- isnull((SELECT TOP 1 processNo FROM WORK_COLLECT WHERE WORK_COLLECT.barCode = '{1}' AND checkResult = '鈭�' ORDER BY WORK_COLLECT.createDate DESC ),'') AS lastGx
-FROM WORK_TRAC_CODE A
- LEFT JOIN WOMDAA B ON A.ABOUT_GUID = B.guid
- LEFT JOIN MES_ITEMS C ON B.daa002 = C.item_id
- LEFT JOIN MES_WORKSHOP_LINE D ON A.lineId = D.id
-WHERE A.barCode = '{1}'", query.GX, query.Zsbarcode);
-
- var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql);
-
- if (ZsBarInfo.Count < 1)
- {
- throw new Exception($"璇ヨ拷婧爜{query.Zsbarcode}涓嶅瓨鍦ㄤ笉瀛樺湪");
- }
-
- return ZsBarInfo;
- }
-
- //鑾峰彇鐢熶骇
- public dynamic getTraceability(dynamic query)
- {
- var sql = string.Format(@"SELECT processNo, A.barCode, B.lineId, line_no, name AS lineName, checkResult, C.USER_NAME
-FROM WORK_COLLECT A
- LEFT JOIN WORK_TRAC_CODE B ON A.barCode = B.barCode
- LEFT JOIN SYS_USER C ON C.ACCOUNT = A.createBy
- LEFT JOIN MES_WORKSHOP_LINE D ON B.lineId = D.id
-WHERE A.barCode = '{0}'", query.Zsbarcode);
-
- var Traceability = Db.Ado.SqlQuery<dynamic>(sql);
-
- return Traceability;
- }
-
- public dynamic ProductBinding(dynamic query)
- {
- if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
-
- // 2. 浣跨敤 string.IsNullOrEmpty 鐩存帴鍒ゆ柇瀛楃涓插睘鎬э紙閬垮厤 NullReferenceException锛�
- if (string.IsNullOrEmpty(query.userName?.ToString()))
- throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
-
- if (string.IsNullOrEmpty(query.ZsBar?.ToString()))
- throw new ArgumentException("杩芥函鐮佷笉鍏佽涓虹┖", nameof(query.ZsBar));
-
- if (string.IsNullOrEmpty(query.LsBar?.ToString()))
- throw new ArgumentException("鍚庣洊鐮佷笉鍏佽涓虹┖", nameof(query.LsBar));
-
- var _strMsg = "";
- var _intSum = "";
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- using (var cmd = new SqlCommand("prc_pda_product_binding", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
- SqlParameter[] parameters =
- {
- new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
- new("@pi_trac_barcode", SqlDbType.NVarChar, 100) { Value = query.ZsBar },
- new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = query.LsBar },
- new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
- };
-
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
-
- cmd.ExecuteNonQuery();
-
- _strMsg = parameters[3].Value?.ToString() ?? "";
- _intSum = parameters[4].Value?.ToString() ?? "-1";
-
- var result = Convert.ToInt32(_intSum);
- if (result <= 0) throw new Exception(_strMsg);
-
- var dto = new
- {
- message = _strMsg,
- status = result,
- tracBarcode = query.ZsBar
- };
-
- return dto;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }
-
-
- /// <summary>
- /// 鑾峰彇鍗℃澘淇℃伅
- /// </summary>
- /// <param name="query"></param>
- /// <returns></returns>
- public dynamic getKbBarInfo(dynamic query)
- {
- if (string.IsNullOrEmpty(query.Kbbarcode?.ToString()))
- throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.userName));
-
- var sql = string.Format(@"SELECT OLDQTY,
- ISNULL((SELECT COUNT(1) FROM MES_INV_ITEM_BARCODES_TBMX WHERE ABOUT_TB_BARCODE = '{0}'), 0) AS YSum,
- DAA001
-FROM MES_INV_ITEM_BARCODES A LEFT JOIN WOMDAA B ON A.ABOUT_GUID = B.guid
-WHERE ITEM_BARCODE = '{0}' ", query.Kbbarcode);
-
- var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql);
-
- if (ZsBarInfo.Count < 1)
- {
- throw new Exception($"璇ュ崱鏉跨爜{query.Zsbarcode}涓嶅瓨鍦紒");
- }
-
- return ZsBarInfo;
- }
-
- /// <summary>
- /// 鑾峰彇鍗℃澘鏄庣粏淇℃伅
- /// </summary>
- /// <param name="query"></param>
- /// <returns></returns>
- public dynamic getKbBarMxInfo(dynamic query)
- {
-
- var sql = string.Format(@"SELECT ITEM_BARCODE, QUANTITY,item_no,item_name,item_model,weight
-FROM MES_INV_ITEM_BARCODES_TBMX A
- LEFT JOIN WOMDAA B ON B.daa001 = A.DAA_001
- LEFT JOIN MES_ITEMS C ON C.item_id = B.daa002
-WHERE ABOUT_TB_BARCODE = '{0}' ", query.Kbbarcode);
-
- var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql);
-
-
- return ZsBarInfo;
- }
-
- /// <summary>
- /// 鑾峰彇绠辨槑缁嗕俊鎭�
- /// </summary>
- /// <param name="query"></param>
- /// <returns></returns>
- public dynamic getXBarInfo(dynamic query)
- {
- //var sql1 = string.Format(@"SELECT 1 FROM MES_INV_ITEM_BARCODES_TBMX WHERE ITEM_BARCODE = '{0}' ", query.Xbarcode);
-
- //var IS_CZ = Db.Ado.SqlQuery<dynamic>(sql1);
-
- //if (IS_CZ.Count < 1)
- //{
- // throw new Exception($"璇ョ鏉$爜[{query.Xbarcode}]涓嶅瓨鍦紒");
- //}
-
-
- // 鏍¢獙瀛樺偍杩囩▼
- if (string.IsNullOrEmpty(query.KbBar?.ToString()))
- throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.KbBar));
- // 鏍¢獙瀛樺偍杩囩▼
- if (string.IsNullOrEmpty(query.Xbarcode?.ToString()))
- throw new ArgumentException("绠辨潯鐮佷笉鍏佽涓虹┖", nameof(query.Xbarcode));
-
- var successRecords = new List<dynamic>();
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- conn.Open();
- using (var transaction = conn.BeginTransaction()) // 寮�鍚簨鍔�
- {
- try
- {
-
- using (var cmd = new SqlCommand("prc_pda_Xbar_binding_JY", conn, transaction))
- {
- cmd.CommandType = CommandType.StoredProcedure;
- SqlParameter[] parameters =
- {
- new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
- new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar },
- new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = query.Xbarcode },
- new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
- };
-
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
-
- cmd.ExecuteNonQuery();
-
- var _strMsg = parameters[3].Value?.ToString() ?? "";
- var _intSum = parameters[4].Value?.ToString() ?? "-1";
-
- var result = Convert.ToInt32(_intSum);
- if (result <= 0)
- {
- //transaction.Rollback();
- throw new Exception(_strMsg);
- //return new {
- // status = result,
- // message = $"鎿嶄綔鍥炴粴锛歿_strMsg}",
- // failedBarcode = xBar.iteM_BARCODE,
- // successCount = successRecords.Count
- //};
- }
-
- }
-
- transaction.Commit(); // 鍏ㄩ儴鎴愬姛鎻愪氦浜嬪姟
- }
- catch (Exception ex)
- {
- transaction.Rollback();
- throw new Exception($"寮傚父淇℃伅 锛歿ex.Message}");
- }
- finally
- {
- conn.Close();
- }
- }
- }
-
- var sql2 = string.Format(@"SELECT ITEM_BARCODE, QUANTITY,item_no,item_name,item_model,'0' as is_hedui
-FROM MES_INV_ITEM_BARCODES_TBMX A
- LEFT JOIN WOMDAA B ON B.daa001 = A.DAA_001
- LEFT JOIN MES_ITEMS C ON C.item_id = B.daa002
-WHERE DAA_001 = '{0}'
- AND ITEM_BARCODE = '{1}'
- AND ISNULL(ABOUT_TB_BARCODE, '') = '' ", query.DAA001, query.Xbarcode);
-
- var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql2);
-
- if (ZsBarInfo.Count < 1)
- {
- throw new Exception($"璇ョ鏉$爜[{query.Xbarcode}]瀵瑰簲宸ュ崟涓庢墭鐮佸伐鍗昜{query.DAA001}]涓嶅尮閰嶆垨宸茬粦瀹氭墭鐮侊紒");
- }
-
- return ZsBarInfo;
- }
-
- public dynamic submitAllChecked(dynamic query)
- {
- if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
-
- // 鍙傛暟鏍¢獙寮哄寲
- if (string.IsNullOrEmpty(query.userName?.ToString()))
- throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
-
- if (string.IsNullOrEmpty(query.KbBar?.ToString()))
- throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.KbBar));
-
- if (query.XbarInfo == null || !((IEnumerable<dynamic>)query.XbarInfo).GetEnumerator().MoveNext())
- throw new ArgumentException("绠辩爜鍒楄〃涓嶈兘涓虹┖", nameof(query.XbarInfo));
-
- var successRecords = new List<dynamic>();
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- conn.Open();
- using (var transaction = conn.BeginTransaction()) // 寮�鍚簨鍔�
- {
- try
- {
- foreach (var xBar in query.XbarInfo) // 閬嶅巻绠辩爜闆嗗悎
- {
- using (var cmd = new SqlCommand("prc_pda_Xbar_binding", conn, transaction))
- {
- cmd.CommandType = CommandType.StoredProcedure;
- SqlParameter[] parameters =
- {
- new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
- new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar },
- new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = xBar.iteM_BARCODE },
- new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
- };
-
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
-
- cmd.ExecuteNonQuery();
-
- var _strMsg = parameters[3].Value?.ToString() ?? "";
- var _intSum = parameters[4].Value?.ToString() ?? "-1";
-
- var result = Convert.ToInt32(_intSum);
- if (result <= 0)
- {
- //transaction.Rollback();
- throw new Exception(_strMsg);
- //return new {
- // status = result,
- // message = $"鎿嶄綔鍥炴粴锛歿_strMsg}",
- // failedBarcode = xBar.iteM_BARCODE,
- // successCount = successRecords.Count
- //};
- }
-
- successRecords.Add(new {
- kbBarcode = query.KbBar,
- xBarcode = xBar.iteM_BARCODE,
- processTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
- });
- }
- }
- transaction.Commit(); // 鍏ㄩ儴鎴愬姛鎻愪氦浜嬪姟
- return new {
- status = 1,
- message = "鎵归噺缁戝畾鎴愬姛",
- successCount = successRecords.Count,
- details = successRecords
- };
- }
- catch (Exception ex)
- {
- transaction.Rollback();
- throw new Exception($"寮傚父淇℃伅 锛歿ex.Message}");
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }
-
- public dynamic SubmitKbInspection(dynamic query)
- {
- if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
-
- // 鍙傛暟鏍¢獙
- if (string.IsNullOrEmpty(query.userAccount?.ToString()))
- throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userAccount));
-
- if (string.IsNullOrEmpty(query.KbBar?.ToString()))
- throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.KbBar));
-
- var _strMsg = "";
- var _status = -1;
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- using (var cmd = new SqlCommand("prc_pda_KBbar_submitInspection", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
- SqlParameter[] parameters =
- {
- new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
- new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar },
- new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
- };
-
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
-
- cmd.ExecuteNonQuery();
-
- _strMsg = parameters[2].Value?.ToString() ?? "";
- _status = Convert.ToInt32(parameters[3].Value ?? -1);
-
- if (_status <= 0) throw new Exception(_strMsg);
-
- return new {
- message = _strMsg,
- status = _status,
- kbBarcode = query.KbBar
- };
- }
- catch (Exception ex)
- {
- throw new Exception($"鍗℃澘閫佹澶辫触锛歿ex.Message}");
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }
-
-
-
- //鏍规嵁宸ュ崟鍙疯繑鍥炰骇鍝佸瀷鍙峰拰寰呴鐗╂枡
- public XcslResultDto GetItemsXcsl(WarehouseQuery query)
- {
- if (string.IsNullOrEmpty(query.daa001)) throw new Exception("宸ュ崟鍙蜂负绌�");
-
- var womdaa = Db.Queryable<Womdaa, MesItems>((a, i) =>
- new JoinQueryInfos(JoinType.Left,
- a.Daa002 == i.ItemId.ToString()))
- .Where((a, i) => a.Daa001 == query.daa001
- && a.Fstatus == 1)
- .Select((a, i) => new
- {
- a.Daa001,
- a.CaaGuid,
- a.Daa008,
- a.Daa021
- }).First();
-
- if (womdaa?.Daa001 == null) throw new Exception("宸ュ崟鍙蜂笉瀛樺湪");
-
- // 浣跨敤鍙傛暟鍖栨煡璇㈤槻姝QL娉ㄥ叆
- var sqlParams = new List<SugarParameter> { new("@daa001", query.daa001) };
-
- var sql1 = @"SELECT A.item_out_no,
- SUM(B.QUANTITY) AS BL_Num,
- ISNULL(Sub.JS_Sum, 0) AS JS_Num, -- 浣跨敤LEFT JOIN瀛愭煡璇㈢殑缁撴灉
- C.item_no,
- C.item_name,
- C.item_model,
- D.USER_NAME
-FROM MES_INV_ITEM_OUTS A
- LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
- LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
- LEFT JOIN SYS_USER D ON A.create_by = D.ACCOUNT
--- 鏂板LEFT JOIN鑱氬悎瀛愭煡璇�
- LEFT JOIN (SELECT B1.ITEM_ID,
- SUM(B1.QUANTITY) AS JS_Sum
- FROM MES_INV_ITEM_OUTS A1
- LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B1 ON A1.GUID = B1.ITEM_OUT_ID
- WHERE A1.out_type = '鐢熶骇棰嗘枡'
- AND A1.task_no = @daa001
- AND ISNULL(B1.IS_XCSL, '0') = 1
- GROUP BY B1.ITEM_ID -- 鎸塈TEM_ID鎻愬墠鑱氬悎
-) AS Sub ON Sub.ITEM_ID = C.item_id
-WHERE A.out_type = '鐢熶骇棰嗘枡'
- AND A.task_no = @daa001
-GROUP BY A.item_out_no,
- C.item_no,
- C.item_name,
- C.item_model,
- D.USER_NAME,
- C.item_id,
- ISNULL(Sub.JS_Sum, 0);";
-
- var XcslItem = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams);
-
- var sql2 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,A.create_date
-FROM MES_INV_ITEM_OUTS A
-LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
-LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
-LEFT JOIN SYS_USER D ON A.create_by = D.ACCOUNT
-WHERE out_type = '鐢熶骇棰嗘枡'
-AND A.task_no = @daa001
-AND ISNULL(IS_XCSL,'0') = 0";
-
- var XcslWjsBar = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams);
-
- var sql3 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,B.XCSL_CREATE_DATE
-FROM MES_INV_ITEM_OUTS A
-LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
-LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
-LEFT JOIN SYS_USER D ON B.XCSL_CREATE_BY = D.ACCOUNT
-WHERE out_type = '鐢熶骇棰嗘枡'
-AND A.task_no = @daa001
-AND ISNULL(IS_XCSL,'0') = 1";
-
- var XcslYjsBar = Db.Ado.SqlQuery<dynamic>(sql3, sqlParams);
-
-
- var dto = new XcslResultDto
- {
- GD_Num = womdaa.Daa008,
- workNo = womdaa.Daa021,
- XcslItemList = XcslItem,
- XcslWjsBarList = XcslWjsBar,
- XcslYjsBarList = XcslYjsBar
-
- };
-
- return dto;
- }
-
- // 鐜板満鏀舵枡灞曠ず鍒楄〃
- public class XcslResultDto
- {
- public int? GD_Num { get; set; }
- public string? workNo { get; set; }
- public List<dynamic> XcslItemList { get; set; }
- public List<dynamic> XcslWjsBarList { get; set; }
- public List<dynamic> XcslYjsBarList { get; set; }
- }
-
-
- public dynamic ScanXcsl(dynamic query)
- {
- if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
-
- // 鍙傛暟鏍¢獙锛堟牴鎹瓨鍌ㄨ繃绋嬫柊澧炲弬鏁帮級
- if (string.IsNullOrEmpty(query.userAccount?.ToString()))
- throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userAccount));
-
- if (string.IsNullOrEmpty(query.Bar?.ToString()))
- throw new ArgumentException("鐗╂枡鏉$爜涓嶅厑璁镐负绌�", nameof(query.Bar));
-
- if (string.IsNullOrEmpty(query.DAA001?.ToString()))
- throw new ArgumentException("宸ュ崟鍗曞彿涓嶅厑璁镐负绌�", nameof(query.DAA001));
-
- var _strMsg = "";
- var _status = -1;
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- using (var cmd = new SqlCommand("prc_pda_ScanXcsl", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
- // 鏍规嵁瀛樺偍杩囩▼璋冩暣鍙傛暟椤哄簭鍜屽懡鍚�
- SqlParameter[] parameters =
- {
- new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
- new("@pi_barcode", SqlDbType.NVarChar, 100) { Value = query.Bar },
- new("@pi_daa001", SqlDbType.NVarChar, 100) { Value = query.DAA001 },
- new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
- };
-
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
-
- cmd.ExecuteNonQuery();
-
- _strMsg = parameters[3].Value?.ToString() ?? "";
- _status = Convert.ToInt32(parameters[4].Value ?? -1);
-
- if (_status <= 0) throw new Exception(_strMsg);
-
- return new
- {
- message = _strMsg,
- status = _status,
- daa001 = query.DAA001,
- barCode = query.Bar
- };
- }
- catch (Exception ex)
- {
- throw new Exception($"浜х嚎鏀舵枡澶辫触锛歿ex.Message}");
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }
-
-
- public dynamic GetWeightByXt(dynamic query)
- {
- if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓簄ull");
-
- // 鍙傛暟鏍¢獙
- if (string.IsNullOrEmpty(query.userName?.ToString()))
- throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
-
- if (string.IsNullOrEmpty(query.LsBar?.ToString()))
- throw new ArgumentException("鍗℃澘鏉$爜涓嶅厑璁镐负绌�", nameof(query.LsBar));
-
- var _strMsg = "";
- var _status = -1;
- var _weight = "0";
-
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- using (var cmd = new SqlCommand("prc_pda_Xbar_chenzhong", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
-
- SqlParameter[] parameters =
- {
- new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName },
- new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = query.LsBar },
- new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output },
- new("@po_outWeight", SqlDbType.NVarChar, 100) { Direction = ParameterDirection.Output }
- };
-
- cmd.Parameters.AddRange(parameters);
- cmd.ExecuteNonQuery();
-
- _strMsg = parameters[2].Value?.ToString() ?? "";
- _status = Convert.ToInt32(parameters[3].Value ?? -1);
- _weight = parameters[4].Value?.ToString() ?? "0";
-
- if (_status <= 0) throw new Exception(_strMsg);
-
- return new
- {
- message = _strMsg,
- status = _status,
- weight = _weight,
- barCode = query.Bar
- };
- }
- catch (Exception ex)
- {
- throw new Exception($"浜у搧绉伴噸澶辫触锛歿ex.Message}");
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }
-
- public dynamic GetXcslDaa(dynamic unity)
- {
-
- var sqlParams = new List<SugarParameter> { };
-
- var sql2 = new StringBuilder(@"
- SELECT daahb001 as daaInfo,daahb001 as daa001
- FROM WOMDAAHB
- WHERE FSTATUS = 1 and COMPLETE_STATUS=0");
-
- if (!string.IsNullOrWhiteSpace(unity.selectKey?.ToString()))
- {
- sqlParams.Add(new("@selectKey", unity.selectKey));
- sql2.Append(@"
- AND (DAAHB001 LIKE '%' + @selectKey + '%' ");
- }
-
- var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
-
- if (XcslItem == null)
- {
- throw new Exception("璇ユ潯浠朵笅鏃犲搴斿伐鍗曚俊鎭紝璇烽噸鏂拌緭鍏ワ紒");
- }
-
- return XcslItem;
- }
-
-
- public XcslResultDto GetItemsXctl(WarehouseQuery query)
- {
- if (string.IsNullOrEmpty(query.daa001)) throw new Exception("宸ュ崟鍙蜂负绌�");
-
- var womdaa = Db.Queryable<Womdaa, MesItems>((a, i) =>
- new JoinQueryInfos(JoinType.Left,
- a.Daa002 == i.ItemId.ToString()))
- .Where((a, i) => a.Daa001 == query.daa001
- && a.Fstatus == 1)
- .Select((a, i) => new
- {
- a.Daa001,
- a.CaaGuid,
- a.Daa008,
- a.Daa021
- }).First();
-
- if (womdaa?.Daa001 == null) throw new Exception("宸ュ崟鍙蜂笉瀛樺湪");
-
- // 浣跨敤鍙傛暟鍖栨煡璇㈤槻姝QL娉ㄥ叆
- var sqlParams = new List<SugarParameter> { new("@daa001", query.daa001) };
-
- var sql1 = @"SELECT A.item_out_no,
- SUM(B.QUANTITY) AS BL_Num,
- ISNULL(SL_SUM.JS_Sum, 0) AS JS_Num,
- ISNULL(TL_SUM.JS_Sum, 0) AS TR_Num,
- C.item_no,
- C.item_name,
- C.item_model
-FROM MES_INV_ITEM_OUTS A
- LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
- LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
- LEFT JOIN SYS_USER D ON A.create_by = D.ACCOUNT
- LEFT JOIN (SELECT B1.ITEM_ID,
- SUM(B1.QUANTITY) AS JS_Sum
- FROM MES_INV_ITEM_OUTS A1
- LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B1 ON A1.GUID = B1.ITEM_OUT_ID
- WHERE A1.out_type = '鐢熶骇棰嗘枡'
- AND A1.task_no = @daa001
- AND ISNULL(B1.IS_XCSL, '0') = 1
- GROUP BY B1.ITEM_ID
-) AS SL_SUM ON SL_SUM.ITEM_ID = C.item_id
- LEFT JOIN (SELECT B1.ITEM_ID,
- SUM(B1.QUANTITY) AS JS_Sum
- FROM MES_INV_ITEM_OUTS A1
- LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B1 ON A1.GUID = B1.ITEM_OUT_ID
- WHERE A1.out_type = '鐢熶骇棰嗘枡'
- AND A1.task_no = @daa001
- AND ISNULL(B1.IS_CXTR, '0') = 1
- GROUP BY B1.ITEM_ID
-) AS TL_SUM ON TL_SUM.ITEM_ID = C.item_id
-WHERE A.out_type = '鐢熶骇棰嗘枡'
- AND A.task_no = @daa001
-GROUP BY A.item_out_no,
- C.item_no,
- C.item_name,
- C.item_model,
- D.USER_NAME,
- C.item_id,
- ISNULL(SL_SUM.JS_Sum, 0),
- ISNULL(TL_SUM.JS_Sum, 0);";
-
- var XcslItem = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams);
-
- var sql2 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,A.create_date
-FROM MES_INV_ITEM_OUTS A
-LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
-LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
-LEFT JOIN SYS_USER D ON A.create_by = D.ACCOUNT
-WHERE out_type = '鐢熶骇棰嗘枡'
-AND A.task_no = @daa001
-AND ISNULL(IS_CXTR,'0') = 0";
-
- var XcslWjsBar = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams);
-
- var sql3 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,B.CXTR_CREATE_DATE
-FROM MES_INV_ITEM_OUTS A
-LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID
-LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id
-LEFT JOIN SYS_USER D ON B.CXTR_CREATE_BY = D.ACCOUNT
-WHERE out_type = '鐢熶骇棰嗘枡'
-AND A.task_no = @daa001
-AND ISNULL(IS_CXTR,'0') = 1";
-
- var XcslYjsBar = Db.Ado.SqlQuery<dynamic>(sql3, sqlParams);
-
-
- var dto = new XcslResultDto
- {
- GD_Num = womdaa.Daa008,
- workNo = womdaa.Daa021,
- XcslItemList = XcslItem,
- XcslWjsBarList = XcslWjsBar,
- XcslYjsBarList = XcslYjsBar
-
- };
-
- return dto;
- }
-
- public dynamic ScanXctl(dynamic query)
- {
- if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
-
- // 鍙傛暟鏍¢獙锛堟牴鎹瓨鍌ㄨ繃绋嬫柊澧炲弬鏁帮級
- if (string.IsNullOrEmpty(query.userAccount?.ToString()))
- throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userAccount));
-
- if (string.IsNullOrEmpty(query.Bar?.ToString()))
- throw new ArgumentException("鐗╂枡鏉$爜涓嶅厑璁镐负绌�", nameof(query.Bar));
-
- if (string.IsNullOrEmpty(query.DAA001?.ToString()))
- throw new ArgumentException("宸ュ崟鍗曞彿涓嶅厑璁镐负绌�", nameof(query.DAA001));
-
- var _strMsg = "";
- var _status = -1;
- using (var conn = new SqlConnection(DbHelperSQL.strConn))
- {
- using (var cmd = new SqlCommand("prc_pda_ScanXctl", conn))
- {
- try
- {
- conn.Open();
- cmd.CommandType = CommandType.StoredProcedure;
- // 鏍规嵁瀛樺偍杩囩▼璋冩暣鍙傛暟椤哄簭鍜屽懡鍚�
- SqlParameter[] parameters =
- {
- new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount },
- new("@pi_barcode", SqlDbType.NVarChar, 100) { Value = query.Bar },
- new("@pi_daa001", SqlDbType.NVarChar, 100) { Value = query.DAA001 },
- new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output },
- new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }
- };
-
- foreach (var parameter in parameters)
- cmd.Parameters.Add(parameter);
-
- cmd.ExecuteNonQuery();
-
- _strMsg = parameters[3].Value?.ToString() ?? "";
- _status = Convert.ToInt32(parameters[4].Value ?? -1);
-
- if (_status <= 0) throw new Exception(_strMsg);
-
- return new
- {
- message = _strMsg,
- status = _status,
- daa001 = query.DAA001,
- barCode = query.Bar
- };
- }
- catch (Exception ex)
- {
- throw new Exception($"浜х嚎鏀舵枡澶辫触锛歿ex.Message}");
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/service/Wom/WwGdManager.cs b/service/Wom/WwGdManager.cs
index 777d7dc..dd7f308 100644
--- a/service/Wom/WwGdManager.cs
+++ b/service/Wom/WwGdManager.cs
@@ -169,7 +169,7 @@
JoinType.Inner, b.Erpid.ToString() == d.ErpId
))
.Where((a, b, c, d) =>
- a.Daa001 == query.daa001 && d.IssuingMethod == "1")
+ a.Daa001 == query.daa001 )
.Select((a, b, c, d) => new WwGdDetail
{
Pid = b.Pid,
diff --git a/service/base/LoginService.cs b/service/base/LoginService.cs
index 8aabbb9..5314f17 100644
--- a/service/base/LoginService.cs
+++ b/service/base/LoginService.cs
@@ -2,24 +2,49 @@
using NewPdaSqlServer.DB;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.util;
+using SqlSugar;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace NewPdaSqlServer.service.@base;
public class LoginService : RepositoryNoEntity
{
- public SysUser login(string name, string pwd)
+ public dynamic login(string name, string pwd)
{
+
var strPass = UtilityHelper.MD5Encrypt32(pwd);
- var sysUser = Db.Queryable<SysUser>()
- .Where(s => s.Account == name
- && s.Password == strPass).First();
+ //var sysUser = Db.Queryable<SysUser>()
+ // .Where(s => s.Account == name
+ // && s.Password == strPass).First();
- if (sysUser == null) throw new Exception("鐢ㄦ埛涓嶅瓨鍦�");
- var db_password = sysUser.Password;
- if (!strPass.Equals(db_password)) throw new Exception("鐢ㄦ埛鍚嶆垨鑰呭瘑鐮侀敊璇�");
- return sysUser;
+
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_account", name),
+ new SugarParameter("@pi_password", strPass),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null)
+ };
+
+ try
+ {
+ var sysUser = Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_login_selUserOrgInfo @pi_account,@pi_password,@inP1,@inP2,@inP3", parameters).First();
+
+ if (sysUser == null) throw new Exception("鐢ㄦ埛涓嶅瓨鍦�");
+
+ var db_password = sysUser.Password;
+ if (!strPass.Equals(db_password)) throw new Exception("鐢ㄦ埛鍚嶆垨鑰呭瘑鐮侀敊璇�");
+ return sysUser;
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
+
}
public List<dynamic> getUserMenu(string name)
@@ -35,7 +60,7 @@
else
{
string sql = string.Format(@"SELECT A.* FROM MES_SYS_PAGEVIEW A
- LEFT JOIN SYS_USER_BIND B ON A.guid = B.aboutGuid
+ LEFT JOIN SYS_USER_BIND B ON CAST(A.guid AS VARCHAR(100)) = B.aboutGuid
LEFT JOIN SYS_USER C ON C.GUID = B.userGuid
WHERE C.ACCOUNT = '{0}'", name);
pageViewList = Db.Ado.SqlQuery<MesSysPageview>(sql);
@@ -71,7 +96,7 @@
var icoimg = "";
if (mesFile != null)
- icoimg = "http://116.148.211.203:81/upload/" +
+ icoimg = "http://192.168.1.145:81/upload/" +
mesFile.UrlPath;
groupObj.child.Add(new MesSysPageview
@@ -123,4 +148,34 @@
//return sysUser;
return null;
}
+
+ public dynamic changeOrg(dynamic query)
+ {
+ if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
+
+ if (string.IsNullOrEmpty(query.userName?.ToString()))
+ throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
+
+ var parameters = new[]
+ {
+ new SugarParameter("@pi_account", query.userName),
+ new SugarParameter("@inP1", null),
+ new SugarParameter("@inP2", null),
+ new SugarParameter("@inP3", null)
+ };
+
+ try
+ {
+ var orgInfo = Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_my_selOrgInfo @pi_account,@inP1,@inP2,@inP3", parameters);
+
+ //if (sysUser.Count < 1) throw new Exception("鐢ㄦ埛涓嶅瓨鍦ㄥ叧鑱旂粍缁�");
+ return orgInfo;
+ }
+ catch (Exception ex)
+ {
+ // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+ throw new Exception($"{ex.Message}");
+ }
+
+ }
}
\ No newline at end of file
diff --git a/service/base/MesPrintMangeer.cs b/service/base/MesPrintMangeer.cs
index dd0a641..5ee9f12 100644
--- a/service/base/MesPrintMangeer.cs
+++ b/service/base/MesPrintMangeer.cs
@@ -47,23 +47,11 @@
new("@oldBar", query.barcode.Trim())
};
- var sql = @"SELECT TOP 1 C.ITEM_NO,C.item_name,C.item_model,B.OLDQTY as QUANTITY,B.CREATE_DATE, '鎷嗗垎鏉$爜' AS BarType,A.ITEM_BARCODE,GETDATE() as print_date
- FROM MES_INV_ITEM_STOCKS A
- LEFT JOIN MES_INV_ITEM_BARCODES B ON A.ITEM_BARCODE = B.ITEM_BARCODE
- LEFT JOIN MES_ITEMS C ON C.item_id = B.ITEM_ID
- WHERE A.ITEM_BARCODE = @cfBar
-
- UNION ALL
-
- SELECT TOP 1 C.ITEM_NO,C.item_name,C.item_model,A.QUANTITY as QUANTITY,B.CREATE_DATE, '鍘熷鏉$爜' AS BarType,A.ITEM_BARCODE,GETDATE() as print_date
- FROM MES_INV_ITEM_STOCKS A
- LEFT JOIN MES_INV_ITEM_BARCODES B ON A.ITEM_BARCODE = B.ITEM_BARCODE
- LEFT JOIN MES_ITEMS C ON C.item_id = B.ITEM_ID
- WHERE A.ITEM_BARCODE = @oldBar";
+ var sql = @"EXEC prc_pda_base_selBarCfInfo @cfBar,@oldBar";
var mergedData = Db.Ado.SqlQuery<dynamic>(sql, sqlParams);
- if (mergedData.Count < 2) throw new Exception("鏉$爜淇℃伅瀛樺湪寮傚父锛岃鑱旂郴绠$悊鍛橈紒");
+ //if (mergedData.Count < 2) throw new Exception("鏉$爜淇℃伅瀛樺湪寮傚父锛岃鑱旂郴绠$悊鍛橈紒");
return mergedData;
}
@@ -93,9 +81,9 @@
FROM MES_INV_ITEM_BARCODES B
LEFT JOIN MES_ITEMS C ON C.item_id = B.ITEM_ID
WHERE B.ITEM_BARCODE = @cfBar
-
+
UNION ALL
-
+
SELECT TOP 1 C.ITEM_NO,C.item_name,C.item_model,B.QUANTITY as QUANTITY,B.CREATE_DATE, '鍘熷鏉$爜' AS BarType,B.ITEM_BARCODE,GETDATE() as print_date
FROM MES_INV_ITEM_BARCODES B
LEFT JOIN MES_ITEMS C ON C.item_id = B.ITEM_ID
@@ -109,6 +97,5 @@
}
-
-}
+ }
}
\ No newline at end of file
diff --git a/util/BillNo.cs b/util/BillNo.cs
index aa7c5ef..5b985cf 100644
--- a/util/BillNo.cs
+++ b/util/BillNo.cs
@@ -29,4 +29,26 @@
return str;
}
-}
\ No newline at end of file
+
+ public static string ExecuteBarcodeSplit(string cUser, string oldBarcode, decimal? qty)
+ {
+ var sbSql = new StringBuilder();
+ sbSql.Append("DECLARE @outMsg nvarchar(2000), @outSum int, @barcodeNew varchar(200) ");
+ sbSql.Append("EXEC prc_pda_bar_cf '").Append(cUser).Append("', '")
+ .Append(oldBarcode).Append("', ").Append(qty)
+ .Append(", @outMsg OUTPUT, @outSum OUTPUT, @barcodeNew OUTPUT ");
+ sbSql.Append("SELECT @barcodeNew");
+ var str = "";
+ try
+ {
+ str = DbHelperSQL.GetSingle(sbSql.ToString())?.ToString();
+ }
+ catch (Exception ex)
+ {
+ // 璁板綍鏃ュ織鎴栧鐞嗗紓甯�
+ str = "";
+ }
+ return str;
+ }
+}
+
diff --git a/util/LogUtil.cs b/util/LogUtil.cs
index 7c96c8c..8c88150 100644
--- a/util/LogUtil.cs
+++ b/util/LogUtil.cs
@@ -1,10 +1,11 @@
锘縩amespace NewPdaSqlServer.util
{
+ using NewPdaSqlServer.DB;
using NewPdaSqlServer.entity;
using SqlSugar;
using System;
- public class LogService
+ public class LogService : RepositoryNoEntity
{
/// <summary>
/// 鍒涘缓鏃ュ織璁板綍
@@ -52,7 +53,7 @@
int sendStatus,
string executeTime)
{
- db.Ado.ExecuteCommand(
+ Db.Ado.ExecuteCommand(
"exec prc_log_create @edtUserGuid, @abtGuid, @abtTable, @detail, @hNo,@RtnLogGuid, @SendJson, @RtnJson, @xkyBeginTime, @xkyEndTime, @sendStatus, @executeTime",
new {
edtUserGuid,
diff --git a/util/XkyApiHelper.cs b/util/XkyApiHelper.cs
index c66c687..0a3159b 100644
--- a/util/XkyApiHelper.cs
+++ b/util/XkyApiHelper.cs
@@ -16,10 +16,17 @@
//this.operateCompanyCode = "鍙橀噺_operateCompanyCode";
//this.ownerCompanyCode = "鍙橀噺_ownerCompanyCode";
//this.appSecret = "鍙橀噺_appSecret";
- this.appKey = "5f0f8dadc4edc70197a73f7ef506aa9b";
- this.operateCompanyCode = "85621331";
- this.ownerCompanyCode = "85621331";
- this.appSecret = "fa7c117c02fd4967849a612963c034ca";
+ //娴嬭瘯
+ //this.appKey = "5f0f8dadc4edc70197a73f7ef506aa9b";
+ //this.operateCompanyCode = "85621331";
+ //this.ownerCompanyCode = "85621331";
+ //this.appSecret = "fa7c117c02fd4967849a612963c034ca";
+ //this.version = "1.0";
+ //姝e紡
+ this.appKey = "edfa5f089979c94f2db47ab0b2cdc35d";
+ this.operateCompanyCode = "25832037";
+ this.ownerCompanyCode = "25832037";
+ this.appSecret = "4e46a1b61c5a8ce2fb2a519120f59520";
this.version = "1.0";
}
--
Gitblit v1.9.3