From 8d46fbb3dcdc7831757800ae78f5aabaac1d4195 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 17 十一月 2025 09:08:01 +0800
Subject: [PATCH] 添加项目文件。
---
VueWebCoreApi/Models/TreeObejct.cs | 23
VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs | 4687 ++++
VueWebCoreApi/wwwroot/Excel/物料清单.xls | 0
VueWebCoreApi.sln | 25
VueWebCoreApi/Models/CapacityPlanningSetup.cs | 21
VueWebCoreApi/Models/RoleUserSubmit.cs | 14
VueWebCoreApi/wwwroot/AppMenuImage/app_5_7.png | 0
VueWebCoreApi/DLL/DAL/MouldManagerDAL.cs | 4548 ++++
VueWebCoreApi/Models/AppDevicecCheck.cs | 24
VueWebCoreApi/wwwroot/AppMenuImage/app_1_1.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_6_14.png | 0
VueWebCoreApi/Models/PartRout.cs | 15
VueWebCoreApi/Controllers/GridReportController.cs | 41
VueWebCoreApi/DLL/BLL/SopManageMentBLL.cs | 94
VueWebCoreApi/DLL/BLL/DeviceManagerBLL.cs | 458
VueWebCoreApi/Models/ScanStartReportDataOut.cs | 32
VueWebCoreApi/DLL/BLL/AppAnalyticsBLL.cs | 27
VueWebCoreApi/DLL/DAL/GridReportDAL.cs | 63
VueWebCoreApi/Quartz/QuartzSearchData.cs | 116
VueWebCoreApi/wwwroot/AppMenuImage/app_8_2.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_3.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_5_0.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_6_8.png | 0
VueWebCoreApi/DLL/DAL/GeneralBasicDataDAL.cs | 697
VueWebCoreApi/wwwroot/AppMenuImage/app_4_3.png | 0
VueWebCoreApi/Models/AppLabCode.cs | 27
VueWebCoreApi/SignalR/UserIdsStore.cs | 15
VueWebCoreApi/Tools/TOrganizationRecursion.cs | 115
VueWebCoreApi/Properties/launchSettings.json | 38
VueWebCoreApi/Quartz/HttpContext.cs | 20
VueWebCoreApi/wwwroot/Excel/设备点检标准.xls | 0
VueWebCoreApi/Models/APSList.cs | 19
VueWebCoreApi/Models/ObjectDataCont.cs | 15
VueWebCoreApi/Models/RolePermission/MenuItem.cs | 36
VueWebCoreApi/Controllers/AppAnalyticsController.cs | 73
VueWebCoreApi/Models/AppVersion.cs | 16
VueWebCoreApi/.config/dotnet-tools.json | 5
VueWebCoreApi/Models/MaterialCraftsSave.cs | 24
VueWebCoreApi/wwwroot/Excel/模具点检标准.xls | 0
VueWebCoreApi/Models/ReportVerify/DataModel.cs | 13
VueWebCoreApi/wwwroot/Excel/仓库设置.xls | 0
VueWebCoreApi/Models/RolePermission/RolePermission.cs | 50
VueWebCoreApi/DLL/BLL/BaseDateBLL.cs | 104
VueWebCoreApi/Tools/DALSkillCondition.cs | 34
VueWebCoreApi/wwwroot/Excel/岗位管理.xls | 0
VueWebCoreApi/Tools/Encrypt.cs | 143
VueWebCoreApi/Tools/JwtTools.cs | 133
VueWebCoreApi/Models/AttendanceSetting/AttendanceRecord.cs | 31
VueWebCoreApi/Models/WorkData/PartRouteList.cs | 15
VueWebCoreApi/wwwroot/AppMenuImage/app_5_4.png | 0
VueWebCoreApi/DLL/DAL/SystemSettingDAL.cs | 427
VueWebCoreApi/DLL/DAL/ReportManagerDAL.cs | 1923 +
VueWebCoreApi/Models/AppPurchOrderSave.cs | 56
VueWebCoreApi/Config/log4net.config | 33
VueWebCoreApi/Tools/ExcelModelCheck.cs | 14
VueWebCoreApi/DLL/BLL/LoginBLL.cs | 74
VueWebCoreApi/Models/WorkData/WorkStepList.cs | 27
VueWebCoreApi/Models/ErpOrder/ErpOrderBatch.cs | 71
VueWebCoreApi/Quartz/HttpResultfulJob.cs | 94
VueWebCoreApi/Models/InventoryModel/StorageRecord.cs | 59
VueWebCoreApi/wwwroot/Excel/缺陷定义.xls | 0
VueWebCoreApi/Tools/SchedulingMethod.cs | 75
VueWebCoreApi/Models/WareHouseLocation.cs | 19
VueWebCoreApi/VueWebCoreApi.csproj | 82
VueWebCoreApi/wwwroot/AppMenuImage/app_6_4.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_7.png | 0
VueWebCoreApi/Models/MaterialRout.cs | 18
VueWebCoreApi/Quartz/JobAction.cs | 18
VueWebCoreApi/Tools/DapperHelper.cs | 873
VueWebCoreApi/wwwroot/Excel/模具保养项目.xls | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_2_5.png | 0
VueWebCoreApi/Controllers/WorkOrderController.cs | 904
VueWebCoreApi/Tools/Regedit.cs | 573
VueWebCoreApi/Tools/SeachEncode.cs | 368
VueWebCoreApi/DLL/DAL/AppAnDonDAL.cs | 342
VueWebCoreApi/Models/AdvancedSchedAlready.cs | 17
VueWebCoreApi/Controllers/QualityManagementController.cs | 376
VueWebCoreApi/wwwroot/Excel/节拍工价.xls | 0
VueWebCoreApi/Tools/LogHelper.cs | 101
VueWebCoreApi/Controllers/ErpSyncMesController.cs | 102
VueWebCoreApi/Quartz/QuartzFileInfo.cs | 22
VueWebCoreApi/wwwroot/AppMenuImage/app_9.png | 0
VueWebCoreApi/Controllers/TaskBackGroundController.cs | 137
VueWebCoreApi/wwwroot/AppMenuImage/app_6_11.png | 0
VueWebCoreApi/Tools/RedisCommon.cs | 309
VueWebCoreApi/Quartz/FileQuartz.cs | 130
VueWebCoreApi/appsettings.Development.json | 9
VueWebCoreApi/Controllers/AppAnDonController.cs | 108
VueWebCoreApi/wwwroot/AppMenuImage/app_4_2.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_5_8.png | 0
VueWebCoreApi/Controllers/BasicSettingController.cs | 1207 +
VueWebCoreApi/Tools/DataOperator.cs | 1374 +
VueWebCoreApi/DLL/DAL/ExcelCheckDAL.cs | 314
VueWebCoreApi/DLL/DAL/AppPersonalDAL.cs | 67
VueWebCoreApi/wwwroot/AppMenuImage/app_6_7.png | 0
VueWebCoreApi/Controllers/AppPersonalController.cs | 46
VueWebCoreApi/SignalR/IChatClient.cs | 13
VueWebCoreApi/wwwroot/AppMenuImage/app_8_3.png | 0
VueWebCoreApi/Tools/ChannelActionFilterAttributeApp.cs | 38
VueWebCoreApi/Tools/DBHelper.cs | 731
VueWebCoreApi/Tools/RedisHelper.cs | 267
VueWebCoreApi/Models/WorkData/WorkList.cs | 103
VueWebCoreApi/Quartz/TaskLog.cs | 14
VueWebCoreApi/wwwroot/AppMenuImage/app_2_1.png | 0
VueWebCoreApi/Models/TreeDG.cs | 16
VueWebCoreApi/wwwroot/AppMenuImage/app_5_3.png | 0
VueWebCoreApi/Models/ObjectData.cs | 14
VueWebCoreApi/libman.json | 14
VueWebCoreApi/Models/MouldSearch/MouldMessage.cs | 65
VueWebCoreApi/Models/CapacityPlanSect.cs | 15
VueWebCoreApi/Controllers/ClientHubController.cs | 31
VueWebCoreApi/DLL/DAL/AppAnalyticsDAL.cs | 335
VueWebCoreApi/SignalR/ChatHub.cs | 87
VueWebCoreApi/Util/OpenapiHelper.cs | 60
VueWebCoreApi/Util/config.cs | 25
VueWebCoreApi/DLL/BLL/ErpSyncMesBLL.cs | 48
VueWebCoreApi/Tools/SeachEncodeJob.cs | 265
VueWebCoreApi/wwwroot/AppMenuImage/app_4.png | 0
VueWebCoreApi/Controllers/ErpMessageController.cs | 170
VueWebCoreApi/appsettings.json | 32
VueWebCoreApi/wwwroot/Excel/存货档案.xls | 0
VueWebCoreApi/Program.cs | 35
VueWebCoreApi/wwwroot/AppMenuImage/app_8.png | 0
VueWebCoreApi/Tools/TJson.cs | 30
VueWebCoreApi/Models/AlreadyScheduling.cs | 15
VueWebCoreApi/wwwroot/AppMenuImage/app_6_10.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_3_2.png | 0
VueWebCoreApi/Controllers/MouldManagerController.cs | 1454 +
VueWebCoreApi/Controllers/DeviceManagerController.cs | 1099 +
VueWebCoreApi/Controllers/HomeIndexController.cs | 162
VueWebCoreApi/DLL/BLL/MouldManagerBLL.cs | 505
VueWebCoreApi/Models/ScanStartReportData.cs | 34
VueWebCoreApi/DLL/BLL/KanBanManagerentBLL.cs | 120
VueWebCoreApi/Tools/GridMessage.cs | 12
VueWebCoreApi/DLL/DAL/ErpSyncMesDAL.cs | 207
VueWebCoreApi/wwwroot/AppMenuImage/app_6_3.png | 0
VueWebCoreApi/Models/TreeDM.cs | 31
VueWebCoreApi/DLL/BLL/HomeIndexBLL.cs | 56
VueWebCoreApi/DLL/BLL/WorkOrderBLL.cs | 301
VueWebCoreApi/Models/RolePermission/RolePermissionSava.cs | 60
VueWebCoreApi/wwwroot/AppMenuImage/app_1.png | 0
VueWebCoreApi/Models/WorkData/PartRouteStepList.cs | 19
VueWebCoreApi/wwwroot/Excel/往来单位.xls | 0
VueWebCoreApi/DLL/BLL/ExcelCheckBLL.cs | 35
VueWebCoreApi/Models/DeviceRepair.cs | 25
VueWebCoreApi/wwwroot/AppMenuImage/app_6_12.png | 0
VueWebCoreApi/Models/DeviceUpdate.cs | 49
VueWebCoreApi/DLL/DAL/DeviceManagerDAL.cs | 3664 +++
VueWebCoreApi/DLL/DAL/LoginDAL.cs | 546
VueWebCoreApi/DLL/DAL/SopManageMentDAL.cs | 682
VueWebCoreApi/wwwroot/AppMenuImage/app_4_1.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_5_9.png | 0
VueWebCoreApi/wwwroot/Excel/模具点检项目.xls | 0
VueWebCoreApi/Quartz/HttpManager.cs | 73
VueWebCoreApi/wwwroot/AppMenuImage/app_6_6.png | 0
VueWebCoreApi/Tools/CoreHttpContext .cs | 36
VueWebCoreApi/DLL/BLL/HourlyWageBLL.cs | 116
VueWebCoreApi/Controllers/ProductModelController.cs | 321
VueWebCoreApi/Models/AttendanceSetting/AttendanceSave.cs | 27
VueWebCoreApi/wwwroot/AppMenuImage/app_5_10.png | 0
VueWebCoreApi/wwwroot/Excel/模具保养标准.xls | 0
VueWebCoreApi/wwwroot/Excel/库位设置.xls | 0
VueWebCoreApi/wwwroot/Excel/设备清单.xls | 0
VueWebCoreApi/Models/StepDefect.cs | 15
VueWebCoreApi/Models/ReportDefectList.cs | 13
VueWebCoreApi/DLL/DAL/ProductModelDAL.cs | 1292 +
VueWebCoreApi/wwwroot/AppMenuImage/app_5_2.png | 0
VueWebCoreApi/Models/AttendanceSetting/Attendance.cs | 13
VueWebCoreApi/Controllers/HourlyWageController.cs | 352
VueWebCoreApi/Models/ApsOrderSerch.cs | 35
VueWebCoreApi/Controllers/ImportExcelController.cs | 222
VueWebCoreApi/Models/EqpRepair.cs | 17
VueWebCoreApi/Tools/ToMessage.cs | 24
VueWebCoreApi/wwwroot/AppMenuImage/app_9_1.png | 0
VueWebCoreApi/wwwroot/Excel/角色管理.xls | 0
VueWebCoreApi/Models/BomSub.cs | 17
VueWebCoreApi/DLL/BLL/GeneralBasicDataBLL.cs | 182
VueWebCoreApi/Models/MouldVerify/MouldModel.cs | 32
VueWebCoreApi/wwwroot/AppMenuImage/app_6_9.png | 0
VueWebCoreApi/wwwroot/Excel/人员管理.xls | 0
VueWebCoreApi/Tools/AppLableBarCode.cs | 191
VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs | 4296 ++++
VueWebCoreApi/wwwroot/AppMenuImage/app_5.png | 0
VueWebCoreApi/DLL/DAL/KanBanManagerentDAL.cs | 429
VueWebCoreApi/Controllers/ReportManagerController.cs | 743
VueWebCoreApi/Models/ChanjetEncryptMsg.cs | 17
VueWebCoreApi/wwwroot/Excel/班组管理.xls | 0
VueWebCoreApi/DLL/BLL/ReportManagerBLL.cs | 178
VueWebCoreApi/wwwroot/AppMenuImage/app_3_1.png | 0
VueWebCoreApi/DLL/DAL/QualityManagementDAL.cs | 1266 +
VueWebCoreApi/wwwroot/AppMenuImage/app_6_2.png | 0
VueWebCoreApi/Tools/ChannelActionFilterAttribute.cs | 70
VueWebCoreApi/Tools/DownLoad.cs | 569
VueWebCoreApi/Tools/ScanStartReport.cs | 1505 +
VueWebCoreApi/Quartz/QuartzNETExtension.cs | 512
VueWebCoreApi/Models/StepCheck.cs | 16
VueWebCoreApi/Models/AttendanceSetting/AttendanceSett.cs | 39
VueWebCoreApi/wwwroot/Excel/模具清单.xls | 0
VueWebCoreApi/Controllers/KanBanManagerentController.cs | 238
VueWebCoreApi/DLL/BLL/QualityManagementBLL.cs | 136
VueWebCoreApi/Models/CapaPlan.cs | 26
VueWebCoreApi/Models/Uom.cs | 15
VueWebCoreApi/wwwroot/AppMenuImage/app_5_6.png | 0
VueWebCoreApi/DLL/BLL/AppPersonalBLL.cs | 20
VueWebCoreApi/Models/AppScheduleKanban.cs | 44
VueWebCoreApi/Quartz/TaskAuthorAttribute.cs | 13
VueWebCoreApi/wwwroot/AppMenuImage/app_6_5.png | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_7_2.png | 0
VueWebCoreApi/wwwroot/Excel/设备保养标准.xls | 0
VueWebCoreApi/DLL/BLL/GridReportBLL.cs | 20
VueWebCoreApi/wwwroot/AppMenuImage/app_6_13.png | 0
VueWebCoreApi/Models/RoutEdit.cs | 18
VueWebCoreApi/Util/Message.cs | 38
VueWebCoreApi/Tools/ImportExcelData.cs | 6276 +++++
VueWebCoreApi/Models/AttendanceSetting/DailyWageReport.cs | 55
VueWebCoreApi/Quartz/FileHelper.cs | 113
VueWebCoreApi/wwwroot/Excel/工序设置.xls | 0
VueWebCoreApi/Controllers/GeneralBasicDataController.cs | 349
VueWebCoreApi/wwwroot/AppMenuImage/app_5_11.png | 0
VueWebCoreApi/Tools/JPushManage.cs | 71
VueWebCoreApi/Controllers/SopManageMentController.cs | 256
VueWebCoreApi/Quartz/TaskOptions.cs | 21
.dockerignore | 25
VueWebCoreApi/Models/AdvancedSchedulingDevice.cs | 28
VueWebCoreApi/Models/SystemSetting/ExceImport.cs | 17
VueWebCoreApi/wwwroot/AppMenuImage/app_5_1.png | 0
VueWebCoreApi/wwwroot/Excel/工艺路线.xls | 0
VueWebCoreApi/wwwroot/AppMenuImage/app_8_1.png | 0
VueWebCoreApi/Tools/AppSetting.cs | 33
VueWebCoreApi/Tools/ExcelList.cs | 56
VueWebCoreApi/Controllers/SystemSettingController.cs | 185
VueWebCoreApi/wwwroot/AppMenuImage/app_2.png | 0
VueWebCoreApi/DLL/DAL/BaseDateDAL.cs | 417
VueWebCoreApi/wwwroot/AppMenuImage/app_4_4.png | 0
VueWebCoreApi/wwwroot/Excel/设备保养项目.xls | 0
VueWebCoreApi/DLL/DAL/HomeIndexDAL.cs | 215
VueWebCoreApi/DLL/DAL/ProductionManagementDAL.cs | 4813 ++++
VueWebCoreApi/Models/StandEqp.cs | 25
VueWebCoreApi/Models/UnitMaterial/Unit.cs | 27
VueWebCoreApi/Models/InventoryModel/InReptModel.cs | 15
VueWebCoreApi/Quartz/IOCJobFactory.cs | 28
VueWebCoreApi/DLL/BLL/AppAnDonBLL.cs | 50
VueWebCoreApi/DLL/BLL/SystemSettingBLL.cs | 88
VueWebCoreApi/wwwroot/AppMenuImage/app_6.png | 0
VueWebCoreApi/Quartz/IPathProvider.cs | 48
VueWebCoreApi/wwwroot/AppMenuImage/app_4_5.png | 0
VueWebCoreApi/ApiGroup/OpenApiGroup.cs | 59
VueWebCoreApi/Quartz/ConvertPath.cs | 22
VueWebCoreApi/Models/User.cs | 46
VueWebCoreApi/Models/UpdateReport/UpdateProductReport.cs | 47
VueWebCoreApi/wwwroot/AppMenuImage/app_9_2.png | 0
VueWebCoreApi/DLL/BLL/ProductionManagementBLL.cs | 413
VueWebCoreApi/Dockerfile | 25
VueWebCoreApi/wwwroot/AppMenuImage/app_6_1.png | 0
VueWebCoreApi/Quartz/StaticHttpContextExtensions.cs | 20
VueWebCoreApi/Controllers/LoginController.cs | 392
VueWebCoreApi/Models/AnDnDate.cs | 23
VueWebCoreApi/wwwroot/Excel/设备点检项目.xls | 0
VueWebCoreApi/Models/ExcelErro.cs | 15
VueWebCoreApi/wwwroot/AppMenuImage/app_5_5.png | 0
VueWebCoreApi/DLL/BLL/ProductModelBLL.cs | 118
VueWebCoreApi/DLL/DAL/HourlyWageDAL.cs | 833
VueWebCoreApi/wwwroot/AppMenuImage/app_7_1.png | 0
VueWebCoreApi/Models/ObjectModel.cs | 13
VueWebCoreApi/Models/StepEqp.cs | 23
VueWebCoreApi/DLL/BLL/BasicSettingBLL.cs | 483
VueWebCoreApi/Startup.cs | 224
VueWebCoreApi/Tools/NPOIHelper.cs | 190
VueWebCoreApi/Tools/ImportExcel.cs | 1362 +
VueWebCoreApi/Models/ReportDefectHandle.cs | 13
270 files changed, 64,382 insertions(+), 0 deletions(-)
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3729ff0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md
\ No newline at end of file
diff --git a/VueWebCoreApi.sln b/VueWebCoreApi.sln
new file mode 100644
index 0000000..9c1a0f8
--- /dev/null
+++ b/VueWebCoreApi.sln
@@ -0,0 +1,25 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.32002.261
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VueWebCoreApi", "VueWebCoreApi\VueWebCoreApi.csproj", "{316CBE3A-CB91-4F63-AFA4-A8C533020BD7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {316CBE3A-CB91-4F63-AFA4-A8C533020BD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {316CBE3A-CB91-4F63-AFA4-A8C533020BD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {316CBE3A-CB91-4F63-AFA4-A8C533020BD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {316CBE3A-CB91-4F63-AFA4-A8C533020BD7}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {AA156355-614E-45A5-ABD3-8D69FE357018}
+ EndGlobalSection
+EndGlobal
diff --git a/VueWebCoreApi/.config/dotnet-tools.json b/VueWebCoreApi/.config/dotnet-tools.json
new file mode 100644
index 0000000..b0e38ab
--- /dev/null
+++ b/VueWebCoreApi/.config/dotnet-tools.json
@@ -0,0 +1,5 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {}
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/ApiGroup/OpenApiGroup.cs b/VueWebCoreApi/ApiGroup/OpenApiGroup.cs
new file mode 100644
index 0000000..e96f137
--- /dev/null
+++ b/VueWebCoreApi/ApiGroup/OpenApiGroup.cs
@@ -0,0 +1,59 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.ApiGroup
+{
+ public enum OpenApiGroup
+ {
+ [Description("绯荤粺棣栭〉")]
+ 绯荤粺棣栭〉 = 0,
+ [Description("鐧诲綍淇℃伅")]
+ 鐧诲綍淇℃伅 = 1,
+ [Description("鍩虹璁剧疆")]
+ 鍩虹璁剧疆 = 2,
+ [Description("鍩烘湰璧勬枡")]
+ 鍩烘湰璧勬枡 = 3,
+ [Description("鐗╂枡绠$悊")]
+ 鐗╂枡绠$悊 = 4,
+ [Description("璁惧绠$悊")]
+ 璁惧绠$悊 = 5,
+ [Description("妯″叿绠$悊")]
+ 妯″叿绠$悊 = 6,
+ [Description("宸ュ崟绠$悊")]
+ 宸ュ崟绠$悊 = 7,
+ [Description("缁熻鎶ヨ〃")]
+ 缁熻鎶ヨ〃 = 8,
+ [Description("璐ㄩ噺绠$悊")]
+ 璐ㄩ噺绠$悊 = 9,
+ [Description("鍛ㄦ湡浠诲姟")]
+ 鍛ㄦ湡浠诲姟 = 10,
+ [Description("绯荤粺璁剧疆")]
+ 绯荤粺璁剧疆 = 11,
+ [Description("閫氱敤鍩虹璧勬枡")]
+ 閫氱敤鍩虹璧勬枡 = 12,
+ [Description("鐣呮嵎閫欵RP鍩虹鏁版嵁鍚屾")]
+ 鐣呮嵎閫欵RP鍩虹鏁版嵁鍚屾 = 13,
+ [Description("Excel瀵煎叆")]
+ Excel瀵煎叆 = 14,
+ [Description("鍗曟嵁鎵撳嵃")]
+ 鍗曟嵁鎵撳嵃 = 15,
+ [Description("鐪嬫澘绠$悊")]
+ 鐪嬫澘绠$悊 = 16,
+ [Description("璁℃椂宸ヨ祫")]
+ 璁℃椂宸ヨ祫 = 17,
+ [Description("鐣呮嵎閫氭巿鏉冪鐞�")]
+ 鐣呮嵎閫氭巿鏉冪鐞� = 18,
+ [Description("App涓汉涓績")]
+ App涓汉涓績 = 20,
+ [Description("App鏅鸿兘鍒嗘瀽")]
+ App鏅鸿兘鍒嗘瀽 = 21,
+ [Description("App瀹夌伅绠$悊")]
+ App瀹夌伅绠$悊 = 22,
+ [Description("SOP绠$悊")]
+ SOP绠$悊 = 23
+
+ }
+}
diff --git a/VueWebCoreApi/Config/log4net.config b/VueWebCoreApi/Config/log4net.config
new file mode 100644
index 0000000..e2ac762
--- /dev/null
+++ b/VueWebCoreApi/Config/log4net.config
@@ -0,0 +1,33 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<log4net>
+ <appender name="rollingAppender" type="log4net.Appender.RollingFileAppender">
+ <!-- 瀹氫箟鏂囦欢瀛樻斁浣嶇疆 -->
+ <file value="Logs\\" />
+ <!-- 褰� staticLogFileName 涓� true 鏃讹紝杩欐槸鍩虹鏂囦欢鍚� -->
+ <appendToFile value="true" />
+ <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
+ <!-- 淇敼 rollingStyle 涓� Date 浠ョ‘淇濇寜鏃ユ湡婊氬姩 -->
+ <rollingStyle value="Date" />
+ <!-- 褰撳浠芥枃浠舵椂,涓烘枃浠跺悕鍔犵殑鍚庣紑(渚嬪鎸夋棩鏈�) -->
+ <datePattern value="yyyy-MM-dd'.txt'" />
+ <!-- 鑻ヨ姣忓ぉ鏃ュ織鐙珛鏂囦欢锛岃缃� staticLogFileName 涓� false -->
+ <staticLogFileName value="false" />
+ <!-- 鏃ュ織鏈�澶у浠芥暟 (鎸夋棩鏈熸粴鍔ㄦ椂锛岃〃绀轰繚鐣欏灏戝ぉ鐨勬棩蹇�) -->
+ <maxSizeRollBackups value="20" />
+ <!-- 鍙敤鐨勫崟浣�:KB|MB|GB -->
+ <maximumFileSize value="5MB" />
+ <filter type="log4net.Filter.LevelRangeFilter">
+ <param name="LevelMin" value="WARN" />
+ <param name="LevelMax" value="FATAL" />
+ </filter>
+ <layout type="log4net.Layout.PatternLayout">
+ <!-- 搴旂敤鎮ㄦ彁渚涚殑鑷畾涔夋牸寮� -->
+ <conversionPattern value="銆愭椂闂淬��:%d%n銆愮骇鍒��:%p%n銆愮被鍚嶃��:%c%n銆愮嚎绋婭D銆�: %thread %n銆愭枃浠跺湴鍧�銆�:%F 绗�%L琛�%n銆愭棩蹇楀唴瀹广��:%m%n銆愬紓甯歌缁嗐�戯細%exception %n---------------------------------------------------------------------------------------------------------------%n" />
+ </layout>
+ </appender>
+ <root>
+ <priority value="ALL"/>
+ <level value="ALL"/>
+ <appender-ref ref="rollingAppender" />
+ </root>
+</log4net>
\ No newline at end of file
diff --git a/VueWebCoreApi/Controllers/AppAnDonController.cs b/VueWebCoreApi/Controllers/AppAnDonController.cs
new file mode 100644
index 0000000..bda1f13
--- /dev/null
+++ b/VueWebCoreApi/Controllers/AppAnDonController.cs
@@ -0,0 +1,108 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "App瀹夌伅绠$悊")]
+ [ApiController]
+ [Route("api/[controller]")]
+ public class AppAnDonController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+
+ #region[瀹夌伅鍛煎彨鎵弿宸ヤ綅]
+ /// <summary>
+ /// 瀹夌伅鍛煎彨鎵弿宸ヤ綅
+ /// </summary>
+ /// <param name="eqpcode">璁惧鐮�</param>
+ /// <returns></returns>
+ [Route(template: "AppAnDonCallScanSearch")]
+ [HttpPost]
+ public JsonResult AppAnDonCallScanSearch(string eqpcode)
+ {
+ mes = AppAnDonBLL.AppAnDonCallScanSearch(eqpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅鍛煎彨,閫夋嫨鎵弿宸ヤ綅甯﹀嚭鍛煎彨绫诲瀷閫夐」鍙婂搴斾汉鍛樻暟鎹甝
+ /// <summary>
+ /// 瀹夌伅鍛煎彨,閫夋嫨鎵弿宸ヤ綅甯﹀嚭鍛煎彨绫诲瀷閫夐」鍙婂搴斾汉鍛樻暟鎹�
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="wkshpcode">杞﹂棿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "AppAnDonCallItemSearch")]
+ [HttpPost]
+ public JsonResult AppAnDonCallItemSearch(string eqpcode, string wkshpcode)
+ {
+ mes = AppAnDonBLL.AppAnDonCallItemSearch(eqpcode, wkshpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅鍛煎彨鎻愪氦]
+ /// <summary>
+ /// 瀹夌伅鍛煎彨鎻愪氦
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="wkshpcode">杞﹂棿缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AppAnDonCallSave")]
+ [HttpPost]
+ public JsonResult AppAnDonCallSave(string eqpcode, string wkshpcode, List<AnDnDate> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = AppAnDonBLL.AppAnDonCallSave(us, eqpcode, wkshpcode, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[瀹夌伅鍝嶅簲鎵弿宸ヤ綅/璁惧]
+ /// <summary>
+ /// 瀹夌伅鍝嶅簲鎵弿宸ヤ綅/璁惧
+ /// </summary>
+ /// <param name="eqpcode">璁惧/宸ヤ綅缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "AppAnDonLampResponseScanSearch")]
+ [HttpPost]
+ public JsonResult AppAnDonLampResponseScanSearch(string eqpcode)
+ {
+ mes = AppAnDonBLL.AppAnDonLampResponseScanSearch(eqpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅鍝嶅簲鎻愪氦]
+ /// <summary>
+ /// 瀹夌伅鍝嶅簲鎻愪氦
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="wkshpcode">杞﹂棿缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AppAnDonLampResponseSave")]
+ [HttpPost]
+ public JsonResult AppAnDonLampResponseSave(string eqpcode, string wkshpcode, List<ObjectData> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = AppAnDonBLL.AppAnDonLampResponseSave(us, eqpcode, wkshpcode, json);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/AppAnalyticsController.cs b/VueWebCoreApi/Controllers/AppAnalyticsController.cs
new file mode 100644
index 0000000..f45bad9
--- /dev/null
+++ b/VueWebCoreApi/Controllers/AppAnalyticsController.cs
@@ -0,0 +1,73 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "App鏅鸿兘鍒嗘瀽")]
+ [ApiController]
+ [Route("api/[controller]")]
+ public class AppAnalyticsController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[App鐢熶骇鐪嬫澘]
+ /// <summary>
+ /// App鐢熶骇鐪嬫澘
+ /// </summary>
+ /// <param name="Ratetime">鏃堕棿</param>
+ /// <param name="defecttype">缂洪櫡缁熻绫诲瀷</param>
+ /// <returns></returns>
+ [Route(template: "ProductionKanban")]
+ [HttpGet]
+ public JsonResult ProductionKanban(string Ratetime, string defecttype)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string startopendate = ""; //寮�濮嬫椂闂�
+ string endclosedate = ""; //缁撴潫鏃堕棿
+ if (Ratetime != "" && Ratetime != null)
+ {
+ startopendate = Ratetime.Split('~')[0].ToString();
+ endclosedate = Ratetime.Split('~')[1].ToString();
+ }
+ mes = AppAnalyticsBLL.ProductionKanban(us, startopendate, endclosedate, defecttype);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[App鐢熶骇杩涘害鐪嬫澘鍗曟嵁淇℃伅]
+ /// <summary>
+ /// App鐢熶骇杩涘害鐪嬫澘鍗曟嵁淇℃伅
+ /// </summary>
+ /// <param name="ordertype">鍗曟嵁绫诲瀷(SO:閿�鍞鍗曘�丮O:鐢熶骇璁㈠崟銆丳O:鐢熶骇宸ュ崟)</param>
+ /// <param name="partcode">浜у搧淇℃伅(鍙涓�)</param>
+ /// <param name="Ratetime">鍗曟嵁鏃ユ湡鑼冨洿</param>
+ /// <returns></returns>
+ [Route(template: "ProductionScheduleKanban")]
+ [HttpGet]
+ public JsonResult ProductionScheduleKanban(string ordertype, string partcode = null, string Ratetime = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ //var token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyY29kZSI6Ijk5OCIsInVzZXJuYW1lIjoi5rWL6K-V6LSm5Y-3MSIsInN0b3JnX2NvZGUiOiJTQ0IwMV8xXzEiLCJzdG9yZ19uYW1lIjoi57K-5bel6L2m6Ze0IiwiaXNfc3lzdGVtX2FkbWluIjoiTiIsInJvbGVfY29kZSI6Ijk5OTkiLCJyb2xlX2RhdGFwZXJtaXNzaW9ucyI6IiIsInVzZXJ0eXBlIjoiQVBQIiwicmVkaXNrZXkiOiJOZXdNRVNMb2dpblVzZXJJREFQUDk5OCIsInRpbWVvdXQiOiIyMDIzLTEyLTA3VDE0OjU0OjAzLjU0NDMxMjMrMDg6MDAifQ._L0xdKgeD_dgnedzV8EEN6y2Xad0J7beswuIcNj4OKs";
+ User us = JwtTools.Denocode(token.ToString());
+ string startopendate = ""; //寮�濮嬫椂闂�
+ string endclosedate = ""; //缁撴潫鏃堕棿
+ if (Ratetime != "" && Ratetime != null)
+ {
+ startopendate = Ratetime.Split('~')[0].ToString();
+ endclosedate = Ratetime.Split('~')[1].ToString();
+ }
+ mes = AppAnalyticsBLL.ProductionScheduleKanban(us,ordertype, partcode, startopendate, endclosedate);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/AppPersonalController.cs b/VueWebCoreApi/Controllers/AppPersonalController.cs
new file mode 100644
index 0000000..041856d
--- /dev/null
+++ b/VueWebCoreApi/Controllers/AppPersonalController.cs
@@ -0,0 +1,46 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "App涓汉涓績")]
+ [ApiController]
+ [Route("api/[controller]")]
+ public class AppPersonalController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[App涓汉璁′欢宸ヨ祫]
+ /// <summary>
+ /// App涓汉璁′欢宸ヨ祫
+ /// </summary>
+ /// <param name="compute">璁$畻鏂瑰紡:鏈亾璁$畻銆侀�愰亾璁$畻</param>
+ /// <param name="Ratetime">鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "PieceRateWage")]
+ [HttpGet]
+ public JsonResult PieceRateWage(string compute, string Ratetime)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string startopendate = ""; //寮�濮嬫椂闂�
+ string endclosedate = ""; //缁撴潫鏃堕棿
+ if (Ratetime != "" && Ratetime != null)
+ {
+ startopendate = Ratetime.Split('~')[0].ToString();
+ endclosedate = Ratetime.Split('~')[1].ToString();
+ }
+ mes = AppPersonalBLL.PieceRateWage(compute, us, startopendate, endclosedate);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/BasicSettingController.cs b/VueWebCoreApi/Controllers/BasicSettingController.cs
new file mode 100644
index 0000000..1b632b6
--- /dev/null
+++ b/VueWebCoreApi/Controllers/BasicSettingController.cs
@@ -0,0 +1,1207 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.RolePermission;
+using VueWebCoreApi.Models.WorkData;
+using VueWebCoreApi.Tools;
+using static VueWebCoreApi.Models.RolePermission.RolePermissionSava;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "鍩虹璁剧疆")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class BasicSettingController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[缁勭粐鏋舵瀯,鏌ヨ缁勭粐淇℃伅]
+ /// <summary>
+ /// 缁勭粐鏋舵瀯,鏌ヨ缁勭粐淇℃伅
+ /// </summary>
+ /// <param name="storg_code">缁勭粐缂栫爜</param>
+ /// <param name="storg_name">缁勭粐鍚嶇О</param>
+ /// <returns></returns>
+ [Route(template: "STorgData")]
+ [HttpGet]
+ public JsonResult STorgData(string storg_code, string storg_name)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.STorgData(storg_code, storg_name);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缁勭粐鏋舵瀯鏂板缂栬緫]
+ /// <summary>
+ /// 缁勭粐鏋舵瀯鏂板缂栬緫
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateOrganization")]
+ [HttpPost]
+ public JsonResult AddUpdateOrganization([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string OrganCode = obj["OrganCode"].ToString(); //缁勭粐缂栫爜
+ string OrganName = obj["OrganName"].ToString(); //缁勭粐鍚嶇О
+ string leve = obj["leve"].ToString(); //灞傜骇缂栫爜
+ string parent_id = obj["parent_id"].ToString(); //parent_id
+ string storgcode = obj["storgcode"].ToString(); //鎵�灞炵粍缁囩紪鐮�
+ string torg_seq = obj["torg_seq"].ToString(); //鎺掑簭搴忓彿
+ string status = obj["status"].ToString(); //鐘舵��
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.AddUpdateOrganization(OrganCode, OrganName, leve, parent_id, storgcode, torg_seq, status, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缁勭粐鏋舵瀯鍒犻櫎]
+ /// <summary>
+ /// 缁勭粐鏋舵瀯鍒犻櫎
+ /// </summary>
+ /// <param name="orgcode">缁勭粐缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteOrganization")]
+ [HttpPost]
+ public JsonResult DeleteOrganization(string orgcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.DeleteOrganization(orgcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[宀椾綅淇℃伅鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 宀椾綅淇℃伅鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="postcode">宀椾綅缂栫爜</param>
+ /// <param name="postname">宀椾綅鍚嶇О</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "PostData")]
+ [HttpGet]
+ public JsonResult PostData(string postcode, string postname, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.PostData(postcode, postname, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宀椾綅鏂板缂栬緫]
+ /// <summary>
+ /// 宀椾綅鏂板缂栬緫
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdatePost")]
+ [HttpPost]
+ public JsonResult AddUpdatePost([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string postcode = obj["postcode"].ToString(); //宀椾綅缂栫爜
+ string postname = obj["postname"].ToString(); //宀椾綅鍚嶇О
+ string description = obj["description"].ToString();//宀椾綅鎻忚堪
+ string status = obj["status"].ToString(); //鐘舵��
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.AddUpdatePost(postcode, postname, description, status, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宀椾綅鍒犻櫎]
+ /// <summary>
+ /// 宀椾綅鍒犻櫎
+ /// </summary>
+ /// <param name="postcode">宀椾綅缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeletePost")]
+ [HttpPost]
+ public JsonResult DeletePost(string postcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.DeletePost(postcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鐢ㄦ埛淇℃伅鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 鐢ㄦ埛淇℃伅鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="storgcode">宸︿晶缁勭粐缂栫爜</param>
+ /// <param name="usercode">鐢ㄦ埛缂栫爜</param>
+ /// <param name="username">鐢ㄦ埛鍚嶇О</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "UserData")]
+ [HttpGet]
+ public JsonResult UserData(string storgcode, string usercode, string username, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.UserData(storgcode, usercode, username, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢ㄦ埛淇℃伅鏂板缂栬緫]
+ /// <summary>
+ /// 鐢ㄦ埛淇℃伅鏂板缂栬緫
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateUserSave")]
+ [HttpPost]
+ public JsonResult AddUpdateUserSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string usercode = obj["usercode"].ToString(); //鐢ㄦ埛缂栫爜
+ string username = obj["username"].ToString(); //鐢ㄦ埛鍚嶇О
+ string password = obj["password"].ToString();//鐢ㄦ埛瀵嗙爜
+ string payrate = obj["payrate"].ToString();//钖祫灞炴��
+ string mobile = obj["mobile"].ToString();//鎵嬫満鍙�
+ string email = obj["email"].ToString();//閭
+ string storg_code = obj["storg_code"].ToString();//鎵�灞炵粍缁�
+ string status = obj["status"].ToString(); //鐘舵��
+ string post_code = obj["post_code"].ToString();//宀椾綅
+ string role_code = obj["role_code"].ToString();//瑙掕壊
+ string group_code = obj["group_code"].ToString();//鐝粍
+ string opertype = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.AddUpdateUserSave(usercode, username, password, payrate,mobile, email, storg_code, status, post_code, role_code, group_code, opertype, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢ㄦ埛淇℃伅鍒犻櫎]
+ /// <summary>
+ /// 鐢ㄦ埛淇℃伅鍒犻櫎
+ /// </summary>
+ /// <param name="usercode">鐢ㄦ埛缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteUserSave")]
+ [HttpPost]
+ public JsonResult DeleteUserSave(string usercode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.DeleteUserSave(usercode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鐝粍淇℃伅鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 鐝粍淇℃伅鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="groupcode">鐝粍缂栫爜</param>
+ /// <param name="groupname">鐝粍鍚嶇О</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "GroupData")]
+ [HttpGet]
+ public JsonResult GroupData(string groupcode, string groupname, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.GroupData(groupcode, groupname, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐝粍鏂板缂栬緫]
+ /// <summary>
+ /// 鐝粍鏂板缂栬緫
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateGroup")]
+ [HttpPost]
+ public JsonResult AddUpdateGroup([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string groupcode = obj["groupcode"].ToString(); //鐝粍缂栫爜
+ string groupname = obj["groupname"].ToString(); //鐝粍鍚嶇О
+ string description = obj["description"].ToString();//鐝粍鎻忚堪
+ string status = obj["status"].ToString(); //鐘舵��
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.AddUpdateGroup(groupcode, groupname, description, status, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐝粍鍒犻櫎]
+ /// <summary>
+ /// 鐝粍鍒犻櫎
+ /// </summary>
+ /// <param name="groupcode">鐝粍缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteGroup")]
+ [HttpPost]
+ public JsonResult DeleteGroup(string groupcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.DeleteGroup(groupcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[瑙掕壊绠$悊鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 瑙掕壊绠$悊鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="role_code">瑙掕壊缂栫爜</param>
+ /// <param name="role_name">瑙掕壊鍚嶇О</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "RoleData")]
+ [HttpGet]
+ public JsonResult RoleData(string role_code, string role_name, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.RoleData(role_code, role_name, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鏂板銆佺紪杈戜繚瀛榏
+ /// <summary>
+ /// 瑙掕壊绠$悊鏂板銆佺紪杈戜繚瀛�
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "RoleAddUpdateSava")]
+ [HttpPost]
+ public JsonResult RoleAddUpdateSava([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ var menucode = HttpContext.Request.Headers["Menucode"].ToString(); //鑿滃崟缂栫爜
+ string rolecode = obj["rolecode"].ToString(); //瑙掕壊缂栫爜
+ string rolename = obj["rolename"].ToString(); //瑙掕壊鍚嶇О
+ string status = obj["status"].ToString();//鐘舵��
+ string datacode = obj["datacode"].ToString(); //鏁版嵁鑼冨洿
+ string datapermissions = obj["datapermissions"].ToString(); //鏁版嵁鏉冮檺
+ string description = obj["description"].ToString(); //鎻忚堪
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.RoleAddUpdateSava(menucode, rolecode, rolename, status, datacode, datapermissions, description, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒犻櫎]
+ [Route(template: "RoleDeleteSava")]
+ [HttpPost]
+ public JsonResult RoleDeleteSava(string rolecode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.RoleDeleteSava(rolecode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鑾峰彇宸插垎閰嶇敤鎴峰垪琛╙
+ /// <summary>
+ /// 瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鑾峰彇宸插垎閰嶇敤鎴峰垪琛�
+ /// </summary>
+ /// <param name="flag">TRUE(宸插叧鑱�) FALSE(鏈叧鑱�)</param>
+ /// <param name="role_code">瑙掕壊缂栫爜</param>
+ /// <param name="usercode">鐢ㄦ埛缂栫爜</param>
+ /// <param name="username">鐢ㄦ埛鍚嶇О</param>
+ /// <param name="storg_code">缁勭粐缂栫爜</param>
+ /// <param name="post_code">宀椾綅缂栫爜</param>
+ /// <param name="group_code">鐝粍缂栫爜</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "RoleAssignedUserData")]
+ [HttpGet]
+ public JsonResult RoleAssignedUserData(string flag, string role_code, string usercode, string username, string storg_code, string post_code, string group_code, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.RoleAssignedUserData(flag, role_code, usercode, username, storg_code, post_code, group_code, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鎵归噺鍙栨秷宸插垎閰嶇殑鐢ㄦ埛]
+ /// <summary>
+ /// 瑙掕壊缂栫爜
+ /// </summary>
+ /// <param name="role_code">瑙掕壊缂栫爜</param>
+ /// <param name="user">鐢ㄦ埛缂栫爜鏁扮粍</param>
+ /// <returns></returns>
+ [Route(template: "RoleAssignedUserBatchCancel")]
+ [HttpPost]
+ public JsonResult RoleAssignedUserBatchCancel(string role_code, string[] user)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.RoleAssignedUserBatchCancel(role_code, user, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鎵归噺娣诲姞鏈垎閰嶇殑鐢ㄦ埛]
+ /// <summary>
+ /// 瑙掕壊缂栫爜
+ /// </summary>
+ /// <param name="role_code">瑙掕壊缂栫爜</param>
+ /// <param name="user">鐢ㄦ埛缂栫爜鏁扮粍</param>
+ /// <returns></returns>
+ [Route(template: "RoleAssignedUserBatchAdd")]
+ [HttpPost]
+ public JsonResult RoleAssignedUserBatchAdd(string role_code, string[] user)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.RoleAssignedUserBatchAdd(role_code, user, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[瑙掕壊鏉冮檺鏌ヨ瑙掕壊]
+ /// <summary>
+ /// 瑙掕壊鏉冮檺鏌ヨ瑙掕壊
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "RolePermissionSearchRole")]
+ [HttpGet]
+ public JsonResult RolePermissionSearchRole()
+ {
+ mes = BasicSettingBLL.RolePermissionSearchRole();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺鏌ヨ榛樿鑿滃崟鎸夐挳鏁版嵁]
+ /// <summary>
+ /// 瑙掕壊鏉冮檺鏌ヨ榛樿鑿滃崟鎸夐挳鏁版嵁
+ /// </summary>
+ /// <param name="type">鎿嶄綔绔被鍨�(PC/APP)</param>
+ /// <returns></returns>
+ [Route(template: "RolePermissionSearchRoleMenu")]
+ [HttpGet]
+ public JsonResult RolePermissionSearchRoleMenu(string type)
+ {
+ mes = BasicSettingBLL.RolePermissionSearchRoleMenu(type);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺,鏍规嵁瑙掕壊鏌ユ壘鍏宠仈鏉冮檺]
+ /// <summary>
+ /// 瑙掕壊鏉冮檺,鏍规嵁瑙掕壊鏌ユ壘鍏宠仈鏉冮檺
+ /// </summary>
+ /// <param name="rolecode">瑙掕壊缂栫爜</param>
+ /// <param name="type">鑿滃崟缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RolePermissionSearchRoleMenuButton")]
+ [HttpGet]
+ public JsonResult RolePermissionSearchRoleMenuButton(string rolecode, string type)
+ {
+ mes = BasicSettingBLL.RolePermissionSearchRoleMenuButton(rolecode, type);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺,鎻愪氦]
+ /// <summary>
+ /// 瑙掕壊鏉冮檺,鎻愪氦
+ /// </summary>
+ /// <param name="type">绫诲瀷</param>
+ /// <param name="rolecode">瑙掕壊缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "RolePermissionSava")]
+ [HttpPost]
+ public JsonResult RolePermissionSava([FromBody] object json, string rolecode, string type)
+ {
+ var jsonStr = JsonConvert.SerializeObject(json);
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.RolePermissionSava(jsonStr, rolecode, type, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[寰�鏉ュ崟浣嶅垎绫讳俊鎭痌
+ /// <summary>
+ /// 寰�鏉ュ崟浣嶅垎绫讳俊鎭�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "TCunstomerClassTree")]
+ [HttpGet]
+ public JsonResult TCunstomerClassTree()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.TCunstomerClassTree();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅垎绫绘柊澧�/缂栬緫鎻愪氦]
+ /// <summary>
+ /// 寰�鏉ュ崟浣嶅垎绫绘柊澧�/缂栬緫鎻愪氦
+ /// </summary>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮:ERP/MES</param>
+ /// <param name="customerclasscode">寰�鏉ュ崟浣嶅垎绫荤紪鐮�</param>
+ /// <param name="customerclassname">寰�鏉ュ崟浣嶅垎绫诲悕绉�</param>
+ /// <param name="parentcode">涓婄骇鍒嗙被缂栫爜</param>
+ /// <param name="OperType">鎿嶄綔绫诲瀷:Add/Update</param>
+ /// <returns></returns>
+ [Route(template: "TCunstomerClassTreeAddUpdate")]
+ [HttpPost]
+ public JsonResult TCunstomerClassTreeAddUpdate(string data_sources, string customerclasscode, string customerclassname, string parentcode, string OperType)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.TCunstomerClassTreeAddUpdate(data_sources, customerclasscode, customerclassname, parentcode, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅垎绫诲垹闄
+ /// <summary>
+ /// 寰�鏉ュ崟浣嶅垎绫诲垹闄�
+ /// </summary>
+ /// <param name="customerclasscode">寰�鏉ュ崟浣嶅垎绫荤紪鐮佸瓧涓查泦</param>
+ /// <returns></returns>
+ [Route(template: "TCunstomerClassTreeDelete")]
+ [HttpPost]
+ public JsonResult TCunstomerClassTreeDelete(string customerclasscode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.TCunstomerClassTreeDelete(customerclasscode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶄俊鎭垪琛╙
+ /// <summary>
+ /// 寰�鏉ュ崟浣嶄俊鎭垪琛�
+ /// </summary>
+ /// <param name="customerclasscode">寰�鏉ュ崟浣嶅垎绫荤紪鐮佸瓧绗︿覆闆�</param>
+ /// <param name="customercode">寰�鏉ュ崟浣嶇紪鐮�</param>
+ /// <param name="customername">寰�鏉ュ崟浣嶅悕绉�</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "TCunstomerData")]
+ [HttpGet]
+ public JsonResult TCunstomerData(string customerclasscode, string customercode, string customername, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.TCunstomerData(customerclasscode, customercode, customername, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶆柊澧�/缂栬緫淇濆瓨]
+ /// <summary>
+ /// 寰�鏉ュ崟浣嶆柊澧�/缂栬緫淇濆瓨
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "TCunstomerAddUpdate")]
+ [HttpPost]
+ public JsonResult TCunstomerAddUpdate([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string data_sources = obj["data_sources"].ToString(); //鏁版嵁鏉ユ簮:ERP/MES
+ string customercode = obj["customercode"].ToString(); //寰�鏉ュ崟浣嶇紪鐮�
+ string customername = obj["customername"].ToString(); //寰�鏉ュ崟浣嶅悕绉�
+ string customerclasscode = obj["customerclasscode"].ToString(); //寰�鏉ュ崟浣嶇被鍨嬬紪鐮�
+ string status = obj["status"].ToString(); //鐘舵��
+ string conttacts = obj["conttacts"].ToString(); //鑱旂郴浜�
+ string conttphone = obj["conttphone"].ToString(); //鑱旂郴鏂瑰紡
+ string addr = obj["addr"].ToString(); //鍦板潃
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.TCunstomerAddUpdate(data_sources, customercode, customername, customerclasscode, status, conttacts, conttphone, addr, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶄俊鎭垹闄
+ /// <summary>
+ /// 寰�鏉ュ崟浣嶄俊鎭垹闄�
+ /// </summary>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮:ERP/MES</param>
+ /// <param name="customercode">寰�鏉ュ崟浣嶇紪鐮�</param>
+ /// <returns></returns>
+ [Route(template: "TCunstomerDelete")]
+ [HttpPost]
+ public JsonResult TCunstomerDelete(string data_sources, string customercode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.TCunstomerDelete(data_sources, customercode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[浠撳簱淇℃伅鍒楄〃]
+ /// <summary>
+ /// 浠撳簱淇℃伅鍒楄〃
+ /// </summary>
+ /// <param name="code">浠撳簱缂栫爜</param>
+ /// <param name="name">浠撳簱鍚嶇О</param>
+ /// <param name="status">鐘舵��</param>
+ /// <param name="ishasPosition">璐т綅绠$悊</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "TSecStckData")]
+ [HttpGet]
+ public JsonResult TSecStckData(string code, string name, string status, string ishasPosition, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.TSecStckData(code, name, status, ishasPosition, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撳簱鏂板/缂栬緫淇濆瓨]
+ /// <summary>
+ /// 浠撳簱鏂板/缂栬緫淇濆瓨
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "TSecStckAddUpdate")]
+ [HttpPost]
+ public JsonResult TSecStckAddUpdate([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string data_sources = obj["data_sources"].ToString(); //鏁版嵁鏉ユ簮:ERP/MES
+ string stckcode = obj["stckcode"].ToString(); //浠撳簱缂栫爜
+ string stckname = obj["stckname"].ToString(); //浠撳簱鍚嶇О
+ string ishaspostion = obj["ishaspostion"].ToString(); //鏄惁璐т綅绠$悊
+ string status = obj["status"].ToString(); //鐘舵��
+ string description = obj["description"].ToString(); //澶囨敞
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.TSecStckAddUpdate(data_sources, stckcode, stckname, ishaspostion, status, description, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撳簱鍒犻櫎]
+ /// <summary>
+ /// 浠撳簱鍒犻櫎
+ /// </summary>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮:ERP/MES</param>
+ /// <param name="stckcode">浠撳簱缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "TSecStckDelete")]
+ [HttpPost]
+ public JsonResult TSecStckDelete(string data_sources, string stckcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.TSecStckDelete(data_sources, stckcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[浠撲綅鏍戝瀷淇℃伅]
+ /// <summary>
+ /// 浠撲綅鏍戝瀷淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "TSecLocaTree")]
+ [HttpGet]
+ public JsonResult TSecLocaTree()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.TSecLocaTree();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鍒楄〃]
+ /// <summary>
+ /// 浠撲綅淇℃伅鍒楄〃
+ /// </summary>
+ /// <param name="flag">閫変腑宸︿晶鏍戝瀷灞傜骇</param>
+ /// <param name="stckcode">浠撳簱缂栫爜瀛楃涓查泦</param>
+ /// <param name="locacode">浠撲綅缂栫爜</param>
+ /// <param name="locaname">浠撲綅鍚嶇О</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "TSecLocaData")]
+ [HttpGet]
+ public JsonResult TSecLocaData(string flag, string stckcode, string locacode, string locaname, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.TSecLocaData(flag, stckcode, locacode, locaname, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鏂板/缂栬緫淇濆瓨]
+ /// <summary>
+ /// 浠撲綅淇℃伅鏂板/缂栬緫淇濆瓨
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "TSecLocaAddUpdate")]
+ [HttpPost]
+ public JsonResult TSecLocaAddUpdate([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string data_sources = obj["data_sources"].ToString(); //鏁版嵁鏉ユ簮:ERP/MES
+ string locacode = obj["locacode"].ToString(); //璐т綅缂栫爜
+ string locaname = obj["locaname"].ToString(); //璐т綅鍚嶇О
+ string stckcode = obj["stckcode"].ToString(); //瀵瑰簲浠撳簱缂栫爜
+ string parentlocacode = obj["parentlocacode"].ToString(); //涓婄骇璐т綅缂栫爜
+ string depth = obj["depth"].ToString(); //绾ф
+ string status = obj["status"].ToString(); //鐘舵��
+ string description = obj["description"].ToString(); //澶囨敞
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.TSecLocaAddUpdate(data_sources, locacode, locaname, stckcode, parentlocacode, depth, status, description, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鍒犻櫎]
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮:ERP/MES</param>
+ /// <param name="locacode">浠撳簱缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "TSecLocaDelete")]
+ [HttpPost]
+ public JsonResult TSecLocaDelete(string data_sources, string locacode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.TSecLocaDelete(data_sources, locacode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[宸ヨ壓璺嚎宸ュ簭涓嬫媺鏌ヨ鎺ュ彛]
+ /// <summary>
+ /// 宸ヨ壓璺嚎宸ュ簭涓嬫媺鏌ヨ鎺ュ彛
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "StepSelect")]
+ [HttpGet]
+ public JsonResult StepSelect()
+ {
+ mes = BasicSettingBLL.StepSelect();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鏌ヨ]
+ /// <summary>
+ /// 宸ヨ壓璺嚎鏌ヨ
+ /// </summary>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <param name="routename">宸ヨ壓璺嚎鍚嶇О</param>
+ /// <param name="description">宸ヨ壓璺嚎鎻忚堪</param>
+ /// <param name="createuser">鍒涘缓浜哄憳</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "RouteSearch")]
+ [HttpGet]
+ public JsonResult RouteSearch(string routecode = null, string routename = null, string description = null, string createuser = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.RouteSearch(routecode, routename, description, createuser, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎棰勮]
+ /// <summary>
+ /// 宸ヨ壓璺嚎棰勮
+ /// </summary>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ViewRoute")]
+ [HttpGet]
+ public JsonResult ViewRoute(string routecode)
+ {
+ mes = BasicSettingBLL.ViewRoute(routecode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鏂板]
+ /// <summary>
+ /// 宸ヨ壓璺嚎鏂板
+ /// </summary>
+ /// <param name="id">宸ヨ壓璺嚎id</param>
+ /// <param name="opertype">鎿嶄綔绫诲瀷(鏂板)</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateRoute")]
+ [HttpPost]
+ public JsonResult AddUpdateRoute(string opertype, RoutEdit json, string id = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.AddUpdateRoute(id, opertype, us, json);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鍒犻櫎]
+ /// <summary>
+ /// 宸ヨ壓璺嚎鍒犻櫎
+ /// </summary>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteRoute")]
+ [HttpPost]
+ public JsonResult DeleteRoute(string routecode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.DeleteRoute(routecode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[宸ュ簭鏌ヨ]
+ /// <summary>
+ /// 宸ュ簭鏌ヨ
+ /// </summary>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="enable">鍚敤鐘舵��</param>
+ /// <param name="steptypecode">宸ュ簭绫诲瀷缂栫爜</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "StepSearch")]
+ [HttpGet]
+ public JsonResult StepSearch(string stepcode = null, string stepname = null, string enable = null, string steptypecode = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.StepSearch(stepcode, stepname, enable, steptypecode, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭鏂板缂栬緫]
+ /// <summary>
+ /// 宸ュ簭鏂板缂栬緫
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateStep")]
+ [HttpPost]
+ public JsonResult AddUpdateStep([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string stepid = obj["id"].ToString(); //宸ュ簭id(涓婚敭)
+ string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜
+ string stepname = obj["stepname"].ToString(); //宸ュ簭鍚嶇О
+ string steptypecode = obj["steptypecode"].ToString(); //宸ュ簭绫诲瀷缂栫爜
+ string enable = obj["enable"].ToString(); //鍚敤鐘舵��
+ string description = obj["description"].ToString(); //宸ュ簭鎻忚堪
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = BasicSettingBLL.AddUpdateStep(stepid, stepcode, stepname, steptypecode, enable, description, us, OperType);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭鍒犻櫎]
+ /// <summary>
+ /// 宸ュ簭鍒犻櫎
+ /// </summary>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteStep")]
+ [HttpPost]
+ public JsonResult DeleteStep(string stepcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.DeleteStep(stepcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鑺傛媿宸ヤ环,浜у搧淇℃伅鏌ヨ]
+ /// <summary>
+ /// 鑺傛媿宸ヤ环,浜у搧淇℃伅鏌ヨ
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "PartSelect")]
+ [HttpGet]
+ public JsonResult PartSelect()
+ {
+ mes = BasicSettingBLL.PartSelect();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹轰俊鎭痌
+ /// <summary>
+ /// 浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹轰俊鎭�
+ /// </summary>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "PartSelectRpute")]
+ [HttpGet]
+ public JsonResult PartSelectRpute(string partcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.PartSelectRpute(partcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏍规嵁宸ヨ壓淇℃伅(宸ヨ壓璺嚎缂栫爜)鏌ユ壘鍏宠仈宸ュ簭闆嗗悎]
+ /// <summary>
+ /// 鏍规嵁宸ヨ壓淇℃伅(宸ヨ壓璺嚎缂栫爜)鏌ユ壘鍏宠仈宸ュ簭闆嗗悎
+ /// </summary>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RouteSelectStep")]
+ [HttpGet]
+ public JsonResult RouteSelectStep(string partcode,string routecode)
+ {
+
+ mes = BasicSettingBLL.RouteSelectStep(partcode, routecode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鎵归噺鏌ユ壘鍏宠仈鐨勫伐鑹轰俊鎭痌
+ /// <summary>
+ /// 浜у搧缂栫爜鎵归噺鏌ユ壘鍏宠仈鐨勫伐鑹轰俊鎭�
+ /// </summary>
+ /// <param name="list">浜у搧缂栫爜闆嗗悎</param>
+ /// <returns></returns>
+ [Route(template: "PartSelectRputeList")]
+ [HttpPost]
+ public JsonResult PartSelectRputeList(List<PartRouteList> list)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.PartSelectRputeList(list, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏍规嵁宸ヨ壓淇℃伅(宸ヨ壓璺嚎缂栫爜)鎵归噺鏌ユ壘鍏宠仈宸ュ簭闆嗗悎]
+ /// <summary>
+ /// 鏍规嵁宸ヨ壓淇℃伅(宸ヨ壓璺嚎缂栫爜)鎵归噺鏌ユ壘鍏宠仈宸ュ簭闆嗗悎
+ /// </summary>
+ /// <param name="list">浜у搧缂栫爜,宸ヨ壓璺嚎缂栫爜闆嗗悎</param>
+ /// <returns></returns>
+ [Route(template: "RouteSelectStepList")]
+ [HttpPost]
+ public JsonResult RouteSelectStepList(List<PartRouteStepList> list)
+ {
+
+ mes = BasicSettingBLL.RouteSelectStepList(list);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鑺傛媿宸ヤ环鏌ヨ]
+ /// <summary>
+ /// 鑺傛媿宸ヤ环鏌ヨ
+ /// </summary>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "BeatRateSearch")]
+ [HttpGet]
+ public JsonResult BeatRateSearch(string partcode = null, string routecode = null, string stepcode = null,int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = BasicSettingBLL.BeatRateSearch(partcode, routecode, stepcode, us, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鎻愪氦]
+ /// <summary>
+ /// 鑺傛媿宸ヤ环鎻愪氦
+ /// </summary>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SaveBeatRate")]
+ [HttpPost]
+ public JsonResult SaveBeatRate(List<MaterialCraftsSave> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.SaveBeatRate(json,us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鍒犻櫎]
+ /// <summary>
+ /// 鑺傛媿宸ヤ环鍒犻櫎
+ /// </summary>
+ /// <param name="id">鏁版嵁鍒梚d</param>
+ /// <returns></returns>
+ [Route(template: "DeleteBeatRate")]
+ [HttpPost]
+ public JsonResult DeleteBeatRate(string id)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.DeleteBeatRate(id,us);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+
+
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫煡璇
+ /// <summary>
+ /// 瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫煡璇�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "AnDengTypeSearch")]
+ [HttpGet]
+ public JsonResult AnDengTypeSearch()
+ {
+ mes = BasicSettingBLL.AnDengTypeSearch();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫柊澧瀅
+ /// <summary>
+ /// 瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫柊澧�
+ /// </summary>
+ /// <param name="json">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateAnDengType")]
+ [HttpPost]
+ public JsonResult AddUpdateAnDengType(List<ObjectData> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.AddUpdateAnDengType(json, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬪垹闄
+ /// <summary>
+ /// 瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬪垹闄�
+ /// </summary>
+ /// <param name="andengtypecode">瀹夌伅鍛煎彨绫诲瀷缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteAnDengType")]
+ [HttpPost]
+ public JsonResult DeleteAnDengType(string andengtypecode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.DeleteAnDengType(andengtypecode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏌ヨ缁戝畾鐨勫搷搴斾汉鍛榏
+ /// <summary>
+ /// 瀹夌伅绯荤粺/鏌ヨ缁戝畾鐨勫搷搴斾汉鍛�
+ /// </summary>
+ /// <param name="wkshopcode">閫変腑鐨勮溅闂寸紪鐮�</param>
+ /// <param name="calltypecode">閫変腑鐨勫懠鍙被鍨嬬紪鐮�</param>
+ /// <returns></returns>
+ [Route(template: "AnDengResponUserSearch")]
+ [HttpGet]
+ public JsonResult AnDengResponUserSearch(string wkshopcode, string calltypecode)
+ {
+ mes = BasicSettingBLL.AnDengResponUserSearch(wkshopcode, calltypecode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏂板鍝嶅簲浜哄憳鏌ヨ宸茬粦瀹氱殑鍝嶅簲浜哄憳]
+ /// <summary>
+ /// 瀹夌伅绯荤粺/鏂板鍝嶅簲浜哄憳鏌ヨ宸茬粦瀹氱殑鍝嶅簲浜哄憳
+ /// </summary>
+ /// <param name="wkshopcode">閫変腑鐨勮溅闂寸紪鐮�</param>
+ /// <param name="calltypecode">閫変腑鐨勫懠鍙被鍨嬬紪鐮�</param>
+ /// <returns></returns>
+ [Route(template: "AnDengDigoResponUserSearch")]
+ [HttpGet]
+ public JsonResult AnDengDialogResponUserSearch(string wkshopcode, string calltypecode)
+ {
+ mes = BasicSettingBLL.AnDengDialogResponUserSearch(wkshopcode, calltypecode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏂板鍝嶅簲浜哄憳鎻愪氦]
+ /// <summary>
+ /// 瀹夌伅绯荤粺/鏂板鍝嶅簲浜哄憳鎻愪氦
+ /// </summary>
+ /// <param name="wkshopcode">閫変腑鐨勮溅闂寸紪鐮�</param>
+ /// <param name="calltypecode">閫変腑鐨勫懠鍙被鍨嬬紪鐮�</param>
+ /// <param name="enable">鍏佽鍏抽棴</param>
+ /// <param name="json">鍝嶅簲浜哄憳鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AnDengDigoResponUserSeave")]
+ [HttpPost]
+ public JsonResult AnDengDigoResponUserSeave(string wkshopcode, string calltypecode, string enable, DataTable json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.AnDengDigoResponUserSeave(wkshopcode, calltypecode, enable, us, json);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍏佽鍏抽棴]
+ /// <summary>
+ /// 瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍏佽鍏抽棴
+ /// </summary>
+ /// <param name="wkshopcode">閫変腑鐨勮溅闂寸紪鐮�</param>
+ /// <param name="calltypecode">閫変腑鐨勫懠鍙被鍨嬬紪鐮�</param>
+ /// <param name="enable">鍏佽鍏抽棴</param>
+ /// <returns></returns>
+ [Route(template: "AnDengResponUserCloseSeave")]
+ [HttpPost]
+ public JsonResult AnDengResponUserCloseSeave(string wkshopcode, string calltypecode, string enable)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.AnDengResponUserCloseSeave(wkshopcode, calltypecode, enable, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍒犻櫎]
+ /// <summary>
+ /// 瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍒犻櫎
+ /// </summary>
+ /// <param name="id">瀛恑d</param>
+ /// <param name="ando_cogfigid">涓籭d</param>
+ /// <returns></returns>
+ [Route(template: "AnDengResponUserDeleteSeave")]
+ [HttpPost]
+ public JsonResult AnDengResponUserDeleteSeave(string id, string ando_cogfigid)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = BasicSettingBLL.AnDengResponUserDeleteSeave(id, ando_cogfigid, us);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/ClientHubController.cs b/VueWebCoreApi/Controllers/ClientHubController.cs
new file mode 100644
index 0000000..0afcaf3
--- /dev/null
+++ b/VueWebCoreApi/Controllers/ClientHubController.cs
@@ -0,0 +1,31 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.SignalR;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.SignalR;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "娑堟伅鎻愰啋")]
+ [ApiController]
+ [Route("base/[controller]")]
+ public class ClientHubController : ControllerBase
+ {
+ private readonly ILogger<ClientHubController> _logger;
+ public ClientHubController(
+ ILogger<ClientHubController> logger
+ )
+ {
+ _logger = logger;
+ }
+ [Route(template: "SendMessage")]
+ [HttpGet]
+ public async Task SendMessage(string date, [FromServices] IHubContext<ChatHub, IChatClient> hubContext)
+ {
+ await hubContext.Clients.All.SendAll(date);
+ }
+ }
+}
diff --git a/VueWebCoreApi/Controllers/DeviceManagerController.cs b/VueWebCoreApi/Controllers/DeviceManagerController.cs
new file mode 100644
index 0000000..f6a24e8
--- /dev/null
+++ b/VueWebCoreApi/Controllers/DeviceManagerController.cs
@@ -0,0 +1,1099 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http.Headers;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+using static VueWebCoreApi.Models.DeviceUpdate;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "璁惧绠$悊")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class DeviceManagerController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[璁惧绫诲瀷鏌ヨ]
+ /// <summary>
+ /// 璁惧绫诲瀷鏌ヨ
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "DeviceTypeSearch")]
+ [HttpGet]
+ public JsonResult DeviceTypeSearch()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.DeviceTypeSearch();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷鏂板/缂栬緫]
+ /// <summary>
+ /// 璁惧绫诲瀷鏂板/缂栬緫
+ /// </summary>
+ /// <param name="OperType">鎿嶄綔绫诲瀷(Add/Update)</param>
+ /// <param name="json">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateDeviceType")]
+ [HttpPost]
+ public JsonResult AddUpdateDeviceType(string OperType, List<ObjectDataCont> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.AddUpdateDeviceType(OperType, json, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷鍒犻櫎]
+ /// <summary>
+ /// 璁惧绫诲瀷鍒犻櫎
+ /// </summary>
+ /// <param name="devicetypecode">璁惧绫诲瀷缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteDeviceType")]
+ [HttpPost]
+ public JsonResult DeleteDeviceType(string devicetypecode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.DeleteDeviceType(devicetypecode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[璁惧鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 璁惧鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="devicecode">璁惧缂栫爜</param>
+ /// <param name="devicename">璁惧鍚嶇О</param>
+ /// <param name="status">浣跨敤鐘舵��</param>
+ /// <param name="storgcode">鎵�灞炵粍缁�</param>
+ /// <param name="devicetype">璁惧绫诲瀷</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DeviceMangerSearch")]
+ [HttpGet]
+ public JsonResult DeviceMangerSearch(string devicecode = null, string devicename = null, string status = null, string storgcode = null, string devicetype = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = DeviceManagerBLL.DeviceMangerSearch(devicecode, devicename, status, storgcode, devicetype, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鏂板缂栬緫]
+ /// <summary>
+ /// 璁惧娓呭崟鏂板缂栬緫
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateDeviceManger")]
+ [HttpPost]
+ public JsonResult AddUpdateDeviceManger([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string devicecode = obj["devicecode"].ToString(); //璁惧缂栫爜
+ string devicename = obj["devicename"].ToString(); //璁惧鍚嶇О
+ string devicetype = obj["devicetypecode"].ToString(); //璁惧绫诲瀷缂栫爜
+ string storgcode = obj["storgcode"].ToString(); //鎵�灞炵粍缁囩紪鐮�
+ string status = obj["status"].ToString(); //浣跨敤鐘舵��
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = DeviceManagerBLL.AddUpdateDeviceManger(devicecode, devicename, devicetype, storgcode, status, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鍒犻櫎]
+ /// <summary>
+ /// 璁惧淇℃伅鍒犻櫎
+ /// </summary>
+ /// <param name="devicecode">璁惧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteDeviceManger")]
+ [HttpPost]
+ public JsonResult DeleteDeviceManger(string devicecode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.DeleteDeviceManger(devicecode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鏌ョ湅SOP]
+ /// <summary>
+ /// 璁惧淇℃伅鏌ョ湅SOP
+ /// </summary>
+ /// <param name="eqptypecode">璁惧绫诲瀷缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeviceSopSearch")]
+ [HttpGet]
+ public JsonResult DeviceSopSearch(string eqptypecode,string eqpcode)
+ {
+ mes = DeviceManagerBLL.DeviceSopSearch(eqptypecode,eqpcode);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[璁惧鐐规椤瑰垪琛ㄦ煡璇
+ /// <summary>
+ /// 璁惧鐐规椤瑰垪琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="checkitemcode">鐐规閮ㄤ綅缂栫爜</param>
+ /// <param name="checkitemname">鐐规閮ㄤ綅鍚嶇О</param>
+ /// <param name="checkdescr">鐐规瑕佹眰</param>
+ /// <param name="isqrcode">閫変腑鎵爜</param>
+ /// <param name="cycle">鐐规鍛ㄦ湡</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DeviceCheckItemSearch")]
+ [HttpGet]
+ public JsonResult DeviceCheckItemSearch(int page, int rows, string prop, string order, string checkitemcode = null, string checkitemname = null, string checkdescr = null, string isqrcode = null, string cycle = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = DeviceManagerBLL.DeviceCheckItemSearch(checkitemcode, checkitemname, checkdescr, isqrcode, cycle, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规椤规柊澧炵紪杈慮
+ /// <summary>
+ /// 璁惧鐐规椤规柊澧炵紪杈�
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateDeviceCheckItem")]
+ [HttpPost]
+ public JsonResult AddUpdateDeviceCheckItem([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string checkitemid = obj["id"].ToString(); //璁惧鐐规椤筰d(涓婚敭)
+ string checkitemcode = obj["checkitemcode"].ToString(); //璁惧鐐规閮ㄤ綅缂栫爜
+ string checkitemname = obj["checkitemname"].ToString(); //璁惧鐐规閮ㄤ綅鍚嶇О
+ string checkitemdescr = obj["checkitemdescr"].ToString(); //璁惧鐐规閮ㄤ綅瑕佹眰
+ string cycle = obj["cycle"].ToString(); //璁惧鐐规閮ㄤ綅鍛ㄦ湡
+ string isqrcode = obj["isqrcode"].ToString(); //鏄惁鎵爜
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = DeviceManagerBLL.AddUpdateDeviceCheckItem(checkitemid, checkitemcode, checkitemname, checkitemdescr, cycle, isqrcode, us, OperType);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规椤瑰垹闄
+ /// <summary>
+ /// 璁惧鐐规椤瑰垹闄�
+ /// </summary>
+ /// <param name="checkitemcode">璁惧鐐规椤圭洰(閮ㄤ綅)缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteDeviceCheckItem")]
+ [HttpPost]
+ public JsonResult DeleteDeviceCheckItem(string checkitemcode)
+ {
+ mes = DeviceManagerBLL.DeleteDeviceCheckItem(checkitemcode);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[璁惧淇濆吇椤瑰垪琛ㄦ煡璇
+ /// <summary>
+ /// 璁惧淇濆吇椤瑰垪琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="maiitemcode">淇濆吇閮ㄤ綅缂栫爜</param>
+ /// <param name="maiitemname">淇濆吇閮ㄤ綅鍚嶇О</param>
+ /// <param name="maidescr">淇濆吇瑕佹眰</param>
+ /// <param name="isqrcode">閫変腑鎵爜</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DeviceMaiItemSearch")]
+ [HttpGet]
+ public JsonResult DeviceMaiItemSearch(int page, int rows, string prop, string order, string maiitemcode = null, string maiitemname = null, string maidescr = null, string isqrcode = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = DeviceManagerBLL.DeviceMaiItemSearch(maiitemcode, maiitemname, maidescr, isqrcode, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇椤规柊澧炵紪杈慮
+ /// <summary>
+ /// 璁惧淇濆吇椤规柊澧炵紪杈�
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateDeviceMaiItem")]
+ [HttpPost]
+ public JsonResult AddUpdateDeviceMaiItem([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string maiitemid = obj["id"].ToString(); //璁惧淇濆吇椤筰d(涓婚敭)
+ string maiitemcode = obj["maiitemcode"].ToString(); //璁惧淇濆吇閮ㄤ綅缂栫爜
+ string maiitemname = obj["maiitemname"].ToString(); //璁惧淇濆吇閮ㄤ綅鍚嶇О
+ string maiitemdescr = obj["maiitemdescr"].ToString(); //璁惧淇濆吇閮ㄤ綅瑕佹眰
+ string isqrcode = obj["isqrcode"].ToString(); //鏄惁鎵爜
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = DeviceManagerBLL.AddUpdateDeviceMaiItem(maiitemid, maiitemcode, maiitemname, maiitemdescr, isqrcode, us, OperType);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇椤瑰垹闄
+ /// <summary>
+ /// 璁惧淇濆吇椤瑰垹闄�
+ /// </summary>
+ /// <param name="maiitemcode">璁惧淇濆吇椤圭洰(閮ㄤ綅)缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteDeviceMaiItem")]
+ [HttpPost]
+ public JsonResult DeleteDeviceMaiItem(string maiitemcode)
+ {
+ mes = DeviceManagerBLL.DeleteDeviceMaiItem(maiitemcode);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[璁惧鐐规鏍囧噯鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 璁惧鐐规鏍囧噯鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="checkstandcode">鐐规鏍囧噯缂栫爜</param>
+ /// <param name="checkstandname">鐐规鏍囧噯鍚嶇О</param>
+ /// <param name="checkcontr">鐐规绠℃帶</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DeviceCheckStandArdSearch")]
+ [HttpGet]
+ public JsonResult DeviceCheckStandArdSearch(int page, int rows, string prop, string order, string checkstandcode = null, string checkstandname = null, string checkcontr = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = DeviceManagerBLL.DeviceCheckStandArdSearch(us, checkstandcode, checkstandname, checkcontr, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鏂板銆佺紪杈戣幏鍙栨楠岄」鐩笅鎷夊垪琛╙
+ /// <summary>
+ /// 璁惧鐐规鏍囧噯鏂板銆佺紪杈戣幏鍙栨楠岄」鐩笅鎷夊垪琛�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "DeviceCheckItemSelect")]
+ [HttpGet]
+ public JsonResult DeviceCheckItemSelect()
+ {
+ mes = DeviceManagerBLL.DeviceCheckItemSelect();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ /// <summary>
+ /// 璁惧鐐规鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁
+ /// </summary>
+ /// <param name="checkstand_code">璁惧鐐规鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ViewDeviceCheckStanedSearch")]
+ [HttpPost]
+ public JsonResult ViewDeviceCheckStanedSearch(string checkstand_code)
+ {
+ mes = DeviceManagerBLL.ViewDeviceCheckStanedSearch(checkstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鏂板缂栬緫]
+ /// <summary>
+ /// 璁惧鐐规鏍囧噯鏂板缂栬緫
+ /// </summary>
+ /// <param name="opertype">鎿嶄綔绫诲瀷</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateDeviceCheckStandArd")]
+ [HttpPost]
+ public JsonResult AddUpdateDeviceCheckStandArd(string opertype, RoutEdit json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.AddUpdateDeviceCheckStandArd(opertype, json, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鍒犻櫎]
+ /// <summary>
+ /// 璁惧鐐规鏍囧噯鍒犻櫎
+ /// </summary>
+ /// <param name="checkstand_code">璁惧鐐规鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteDeviceCheckStaned")]
+ [HttpPost]
+ public JsonResult DeleteDeviceCheckStaned(string checkstand_code)
+ {
+ mes = DeviceManagerBLL.DeleteDeviceCheckStaned(checkstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鍏宠仈宸ヤ綔绔欐煡璇
+ /// <summary>
+ /// 璁惧鐐规鏍囧噯鍏宠仈宸ヤ綔绔欐煡璇�
+ /// </summary>
+ /// <param name="checkstand_code">璁惧鐐规鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeviceCheckStanedAssociationEqp")]
+ [HttpGet]
+ public JsonResult DeviceCheckStanedAssociationEqp(string checkstand_code)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.DeviceCheckStanedAssociationEqp(us, checkstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region [璁惧鐐规鏍囧噯鍏宠仈宸ヤ綔绔欐彁浜
+ /// <summary>
+ /// 璁惧鐐规鏍囧噯鍏宠仈宸ヤ綔绔欐彁浜�
+ /// </summary>
+ /// <param name="checkstand_code">璁惧鐐规鏍囧噯缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SaveDeviceCheckStanedAssociationEqp")]
+ [HttpPost]
+ public JsonResult SaveDeviceCheckStanedAssociationEqp(string checkstand_code, List<ObjectData> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.SaveDeviceCheckStanedAssociationEqp(us, checkstand_code, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[璁惧淇濆吇鏍囧噯鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 璁惧淇濆吇鏍囧噯鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="repairstandcode">淇濆吇鏍囧噯缂栫爜</param>
+ /// <param name="repairstandname">淇濆吇鏍囧噯鍚嶇О</param>
+ /// <param name="repairstanddescr">淇濆吇鏍囧噯鎻忚堪</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DeviceRepairStandArdSearch")]
+ [HttpGet]
+ public JsonResult DeviceRepairStandArdSearch(int page, int rows, string prop, string order, string repairstandcode = null, string repairstandname = null, string repairstanddescr = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = DeviceManagerBLL.DeviceRepairStandArdSearch(us, repairstandcode, repairstandname, repairstanddescr, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鏂板銆佺紪杈戣幏鍙栦繚鍏婚」鐩笅鎷夊垪琛╙
+ /// <summary>
+ /// 璁惧淇濆吇鏍囧噯鏂板銆佺紪杈戣幏鍙栦繚鍏婚」鐩笅鎷夊垪琛�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "DeviceRepairItemSelect")]
+ [HttpGet]
+ public JsonResult DeviceRepairItemSelect()
+ {
+ mes = DeviceManagerBLL.DeviceRepairItemSelect();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ /// <summary>
+ /// 璁惧淇濆吇鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁
+ /// </summary>
+ /// <param name="repairstand_code">璁惧淇濆吇鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ViewDeviceRepairStanedSearch")]
+ [HttpPost]
+ public JsonResult ViewDeviceRepairStanedSearch(string repairstand_code)
+ {
+ mes = DeviceManagerBLL.ViewDeviceRepairStanedSearch(repairstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鏂板缂栬緫]
+ /// <summary>
+ /// 璁惧淇濆吇鏍囧噯鏂板缂栬緫
+ /// </summary>
+ /// <param name="opertype">鎿嶄綔绫诲瀷</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateDeviceRepairStandArd")]
+ [HttpPost]
+ public JsonResult AddUpdateDeviceRepairStandArd(string opertype, EqpRepair json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.AddUpdateDeviceRepairStandArd(opertype, json, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鍒犻櫎]
+ /// <summary>
+ /// 璁惧淇濆吇鏍囧噯鍒犻櫎
+ /// </summary>
+ /// <param name="repairstand_code">璁惧淇濆吇鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteDeviceRepairStaned")]
+ [HttpPost]
+ public JsonResult DeleteDeviceRepairStaned(string repairstand_code)
+ {
+ mes = DeviceManagerBLL.DeleteDeviceRepairStaned(repairstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鍏宠仈宸ヤ綔绔欐煡璇
+ /// <summary>
+ /// 璁惧淇濆吇鏍囧噯鍏宠仈宸ヤ綔绔欐煡璇�
+ /// </summary>
+ /// <param name="repairstand_code">璁惧淇濆吇鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeviceRepairStanedAssociationEqp")]
+ [HttpGet]
+ public JsonResult DeviceRepairStanedAssociationEqp(string repairstand_code)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.DeviceRepairStanedAssociationEqp(us, repairstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region [璁惧淇濆吇鏍囧噯鍏宠仈宸ヤ綔绔欐彁浜
+ /// <summary>
+ /// 璁惧淇濆吇鏍囧噯鍏宠仈宸ヤ綔绔欐彁浜�
+ /// </summary>
+ /// <param name="repairstand_code">璁惧淇濆吇鏍囧噯缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SaveDeviceRepairStanedAssociationEqp")]
+ [HttpPost]
+ public JsonResult SaveDeviceRepairStanedAssociationEqp(string repairstand_code, List<ObjectData> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.SaveDeviceRepairStanedAssociationEqp(us, repairstand_code, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鏃ュ父鐐规,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ /// <summary>
+ /// 鏃ュ父鐐规,鎵弿宸ヤ綅/璁惧浜岀淮鐮�
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "CheckScanDeviceQrCodeData")]
+ [HttpGet]
+ public JsonResult CheckScanDeviceQrCodeData(string eqpcode)
+ {
+ mes = DeviceManagerBLL.CheckScanDeviceQrCodeData(eqpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏃ュ父鐐规,鎵弿宸ヤ綅/璁惧浜岀淮鐮佹煡鎵剧偣妫�鏍囧噯]
+ /// <summary>
+ /// 鏃ュ父鐐规,鎵弿宸ヤ綅/璁惧浜岀淮鐮佹煡鎵剧偣妫�鏍囧噯
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "CheckScanDeviceTemp")]
+ [HttpGet]
+ public JsonResult CheckScanDeviceTemp(string eqpcode)
+ {
+ mes = DeviceManagerBLL.CheckScanDeviceTemp(eqpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏃ュ父鐐规,閫夋嫨鎵爜璁惧銆佺偣妫�鏍囧噯甯﹀嚭鐐规椤筣
+ /// <summary>
+ /// 鏃ュ父鐐规,閫夋嫨鎵爜璁惧銆佺偣妫�鏍囧噯甯﹀嚭鐐规椤�
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="checktempcode">鐐规鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "SelectScanDeviceQrCodeItem")]
+ [HttpGet]
+ public JsonResult SelectScanDeviceQrCodeItem(string eqpcode, string checktempcode)
+ {
+ mes = DeviceManagerBLL.SelectScanDeviceQrCodeItem(eqpcode, checktempcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏃ュ父鐐规銆佹彁浜や繚瀛榏
+ /// <summary>
+ /// 鏃ュ父鐐规銆佹彁浜や繚瀛�
+ /// </summary>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AppDeviceCheckSave")]
+ [HttpPost]
+ public JsonResult AppDeviceCheckSave(AppDevicecCheck json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.AppDeviceCheckSave(us, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[瀹氭湡淇濆吇,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ /// <summary>
+ /// 瀹氭湡淇濆吇,鎵弿宸ヤ綅/璁惧浜岀淮鐮�
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairScanDeviceQrCodeData")]
+ [HttpGet]
+ public JsonResult RepairScanDeviceQrCodeData(string eqpcode)
+ {
+ mes = DeviceManagerBLL.RepairScanDeviceQrCodeData(eqpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹氭湡淇濆吇,鎵弿宸ヤ綅/璁惧浜岀淮鐮佹煡鎵句繚鍏绘爣鍑哴
+ /// <summary>
+ /// 瀹氭湡淇濆吇,鎵弿宸ヤ綅/璁惧浜岀淮鐮佹煡鎵句繚鍏绘爣鍑�
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairScanDeviceTemp")]
+ [HttpGet]
+ public JsonResult RepairScanDeviceTemp(string eqpcode)
+ {
+ mes = DeviceManagerBLL.RepairScanDeviceTemp(eqpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏃ュ父淇濆吇,閫夋嫨鎵爜璁惧鍒楄〃甯﹀嚭淇濆吇椤筣
+ /// <summary>
+ /// 鏃ュ父淇濆吇,閫夋嫨鎵爜璁惧鍒楄〃甯﹀嚭淇濆吇椤�
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="repartempcode">淇濆吇鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairSelectScanDeviceQrCodeItem")]
+ [HttpGet]
+ public JsonResult RepairSelectScanDeviceQrCodeItem(string eqpcode, string repartempcode)
+ {
+ mes = DeviceManagerBLL.RepairSelectScanDeviceQrCodeItem(eqpcode, repartempcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏃ュ父淇濆吇,鎻愪氦淇濆瓨]
+ /// <summary>
+ /// 鏃ュ父淇濆吇,鎻愪氦淇濆瓨
+ /// </summary>
+ /// <param name="maintcyc">淇濆吇鍛ㄦ湡</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AppDeviceRepairSave")]
+ [HttpPost]
+ public JsonResult AppDeviceRepairSave(string maintcyc, AppDevicecCheck json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.AppDeviceRepairSave(us, maintcyc, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[璁惧缁翠慨鐢宠,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ /// <summary>
+ /// 璁惧缁翠慨鐢宠,鎵弿宸ヤ綅/璁惧浜岀淮鐮�
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MaintainScanDeviceApplyQrCodeData")]
+ [HttpGet]
+ public JsonResult MaintainScanDeviceApplyQrCodeData(string eqpcode)
+ {
+ mes = DeviceManagerBLL.MaintainScanDeviceApplyQrCodeData(eqpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鐢宠,鎻愪氦淇濆瓨]
+ /// <summary>
+ /// 璁惧缁翠慨鐢宠,鎻愪氦淇濆瓨
+ /// </summary>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="wkshpcode">杞﹂棿缂栫爜</param>
+ /// <param name="faultsourcecode">鏁呴殰鏉ユ簮缂栫爜</param>
+ /// <param name="faultdescr">鏁呴殰鎻忚堪</param>
+ /// <returns></returns>
+ [Route(template: "MaintainScanDeviceApplySave")]
+ [HttpPost]
+ public JsonResult MaintainScanDeviceApplySave([FromForm] string eqpcode, [FromForm] string wkshpcode, [FromForm] string faultsourcecode, [FromForm] string faultdescr)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ var files = Request.Form.Files; // 鑾峰彇浼犺緭鐨勬枃浠跺垪琛�
+ mes = DeviceManagerBLL.MaintainScanDeviceApplySave(us, eqpcode, wkshpcode, faultsourcecode, faultdescr, files);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[璁惧缁翠慨涓婁紶鍥剧墖]
+ /// <summary>
+ /// 璁惧缁翠慨涓婁紶鍥剧墖
+ /// </summary>
+ /// <param name="type">鏁呴殰鎻忚堪:G 鏇存崲澶囦欢锛欱</param>
+ /// <returns></returns>
+ [Route(template: "UploadImageSave")]
+ [HttpPost]
+ public JsonResult UploadImageSave([FromForm] string type)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ var files = Request.Form.Files; // 鑾峰彇浼犺緭鐨勬枃浠跺垪琛�
+ mes = DeviceManagerBLL.UploadImageSave(us, type,files);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鍒犻櫎涓婁紶鍥剧墖]
+ /// <summary>
+ /// 璁惧缁翠慨鍒犻櫎涓婁紶鍥剧墖
+ /// </summary>
+ /// <param name="model">鍙傛暟</param>
+ /// <returns></returns>
+ [Route(template: "UploadImageDelete")]
+ [HttpPost]
+ public JsonResult UploadImageDelete(ObjectModel model)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.UploadImageDelete(us, model);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鍒楄〃]
+ /// <summary>
+ /// 璁惧缁翠慨鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "RepairScanDeviceQrCodeDataList")]
+ [HttpGet]
+ public JsonResult RepairScanDeviceQrCodeDataList()
+ {
+ mes = DeviceManagerBLL.RepairScanDeviceQrCodeDataList();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鎻愪氦]
+ /// <summary>
+ /// 璁惧缁翠慨鎻愪氦
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "RepairScanDeviceSave")]
+ [HttpPost]
+ public JsonResult RepairScanDeviceSave(DeviceUpdate model)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = DeviceManagerBLL.RepairScanDeviceSave(us,model);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[缁翠慨楠岃瘉鍒楄〃]
+ /// <summary>
+ /// 缁翠慨楠岃瘉鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "RepairVerificationScanDeviceData")]
+ [HttpGet]
+ public JsonResult RepairVerificationScanDeviceData()
+ {
+ mes = DeviceManagerBLL.RepairVerificationScanDeviceData();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缁翠慨楠岃瘉璇︽儏淇℃伅]
+ /// <summary>
+ /// 缁翠慨楠岃瘉璇︽儏淇℃伅
+ /// </summary>
+ /// <param name="repair_code">缁翠慨鍗曞彿</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="wkshpcode">杞﹂棿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairVerificationScanDeviceDataSub")]
+ [HttpGet]
+ public JsonResult RepairVerificationScanDeviceDataSub(string repair_code, string eqpcode, string wkshpcode)
+ {
+ mes = DeviceManagerBLL.RepairVerificationScanDeviceDataSub(repair_code, eqpcode, wkshpcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缁翠慨楠岃瘉鎻愪氦]
+ /// <summary>
+ /// 缁翠慨楠岃瘉鎻愪氦
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "RepairVerificationScanDeviceSave")]
+ [HttpPost]
+ public JsonResult RepairVerificationScanDeviceSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string repairwo = obj["repairwo"].ToString(); //缁翠慨鍗曞彿
+ string eqpcode = obj["eqpcode"].ToString(); //璁惧缂栫爜
+ string wkshpcode = obj["wkshpcode"].ToString(); //杞﹂棿缂栫爜
+ string result = obj["result"].ToString(); //楠岃瘉缁撴灉
+ mes = DeviceManagerBLL.RepairVerificationScanDeviceSave(us, repairwo, eqpcode, wkshpcode, result);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[璁惧鐐规璁板綍鏌ヨ]
+ /// <summary>
+ /// 璁惧鐐规璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="eqpname">璁惧鍚嶇О</param>
+ /// <param name="stanedname">鐐规鏍囧噯鍚嶇О</param>
+ /// <param name="checkuser">鐐规浜哄憳</param>
+ /// <param name="checkdate">鐐规鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "DeviceCheckTakeSearch")]
+ [HttpGet]
+ public JsonResult DeviceCheckTakeSearch(int page, int rows, string prop, string order, string wkshopcode = null, string eqpcode = null, string eqpname = null, string stanedname = null, string checkuser = null, string checkdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string checkopendate = "";//鐐规寮�濮嬫椂闂�
+ string checkclosedate = "";//鐐规缁撴潫鏃堕棿
+ if (checkdate != "" && checkdate != null)
+ {
+ checkopendate = checkdate.Split('~')[0].ToString();
+ checkclosedate = checkdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1;//璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍rowNum
+ mes = DeviceManagerBLL.DeviceCheckTakeSearch(us, wkshopcode, eqpcode, eqpname, stanedname, checkuser, checkopendate, checkclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规璁板綍鏄庣粏鏌ヨ]
+ /// <summary>
+ /// 璁惧鐐规璁板綍鏄庣粏鏌ヨ
+ /// </summary>
+ /// <param name="djwo">璁惧鐐规鍗曞彿</param>
+ /// <returns></returns>
+ [Route(template: "DeviceCheckSubTakeSearch")]
+ [HttpGet]
+ public JsonResult DeviceCheckSubTakeSearch(string djwo)
+ {
+ mes = DeviceManagerBLL.DeviceCheckSubTakeSearch(djwo);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鐐规璁板綍瀵煎嚭]
+ /// <summary>
+ /// 璁惧鐐规璁板綍瀵煎嚭
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栧彿</param>
+ /// <param name="eqpname">璁惧鍚嶇О</param>
+ /// <param name="stanedname">鐐规鏍囧噯鍚嶇О</param>
+ /// <param name="checkuser">鐐规浜哄憳</param>
+ /// <param name="checkdate">鐐规鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "DeviceCheckTakeOutExcel")]
+ [HttpGet]
+ public JsonResult DeviceCheckTakeOutExcel(string wkshopcode = null, string eqpcode = null, string eqpname = null, string stanedname = null, string checkuser = null, string checkdate = null)
+ {
+ var Token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(Token.ToString());
+ string checkopendate = "";//鐐规寮�濮嬫椂闂�
+ string checkclosedate = "";//鐐规缁撴潫鏃堕棿
+ if (checkdate != "" && checkdate != null)
+ {
+ checkopendate = checkdate.Split('~')[0].ToString();
+ checkclosedate = checkdate.Split('~')[1].ToString();
+ }
+ mes = DeviceManagerBLL.DeviceCheckTakeOutExcel(us,wkshopcode,eqpcode,eqpname,stanedname,checkuser,checkopendate,checkclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[璁惧淇濆吇璁板綍鏌ヨ]
+ /// <summary>
+ /// 璁惧淇濆吇璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="eqpname">璁惧鍚嶇О</param>
+ /// <param name="stanedname">淇濆吇鏍囧噯鍚嶇О</param>
+ /// <param name="repairuser">淇濆吇浜哄憳</param>
+ /// <param name="repairdate">淇濆吇鏃堕棿</param>
+ /// <param name="repairresult">淇濆吇缁撴灉</param>
+ /// <returns></returns>
+ [Route(template: "DeviceRepairTakeSearch")]
+ [HttpGet]
+ public JsonResult DeviceRepairTakeSearch(int page, int rows, string prop, string order, string wkshopcode = null, string eqpcode = null,string eqpname=null, string stanedname = null, string repairuser = null, string repairdate = null, string repairresult = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string repairopendate = ""; //鐐规寮�濮嬫椂闂�
+ string repairclosedate = ""; //鐐规缁撴潫鏃堕棿
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = DeviceManagerBLL.DeviceRepairTakeSearch(us, wkshopcode, eqpcode, eqpname, stanedname, repairuser, repairopendate, repairclosedate, repairresult, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇璁板綍鏄庣粏鏌ヨ]
+ /// <summary>
+ /// 璁惧淇濆吇璁板綍鏄庣粏鏌ヨ
+ /// </summary>
+ /// <param name="bywo">璁惧淇濆吇鍗曞彿</param>
+ /// <returns></returns>
+ [Route(template: "DeviceRepairSubTakeSearch")]
+ [HttpGet]
+ public JsonResult DeviceRepairSubTakeSearch(string bywo)
+ {
+ mes = DeviceManagerBLL.DeviceRepairSubTakeSearch(bywo);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇璁板綍瀵煎嚭]
+ /// <summary>
+ /// 璁惧淇濆吇璁板綍瀵煎嚭
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栧彿</param>
+ /// <param name="eqpname">璁惧鍚嶇О</param>
+ /// <param name="stanedname">鏍囧噯鍚嶇О</param>
+ /// <param name="repairuser">淇濆吇浜哄憳</param>
+ /// <param name="repairdate">淇濆吇鏃堕棿</param>
+ /// <param name="repairresult">淇濆吇缁撴灉</param>
+ /// <returns></returns>
+ [Route(template: "DeviceRepairTakeOutExcel")]
+ [HttpGet]
+ public JsonResult DeviceRepairTakeOutExcel(string wkshopcode = null, string eqpcode = null, string eqpname = null, string stanedname = null, string repairuser = null, string repairdate = null, string repairresult = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string repairopendate = ""; //鐐规寮�濮嬫椂闂�
+ string repairclosedate = ""; //鐐规缁撴潫鏃堕棿
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ mes = DeviceManagerBLL.DeviceRepairTakeOutExcel(us, wkshopcode, eqpcode, eqpname, stanedname, repairuser, repairopendate, repairclosedate, repairresult);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[璁惧缁翠慨璁板綍鏌ヨ]
+ /// <summary>
+ /// 璁惧缁翠慨璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="eqpname">璁惧鍚嶇О</param>
+ /// <param name="reportuser">鎶ヤ慨浜哄憳</param>
+ /// <param name="repairuser">缁翠慨浜哄憳</param>
+ /// <param name="vrifcatuser">楠岃瘉浜哄憳</param>
+ /// <param name="reportdate">鎶ヤ慨鏃堕棿</param>
+ /// <param name="repairdate">缁翠慨鏃堕棿</param>
+ /// <param name="vrifcatdate">楠岃瘉鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "DeviceUpdateSearch")]
+ [HttpGet]
+ public JsonResult DeviceUpdateSearch(int page, int rows, string prop, string order, string wkshopcode = null, string eqpcode = null, string eqpname = null, string reportuser = null, string repairuser = null, string vrifcatuser = null, string reportdate = null, string repairdate = null, string vrifcatdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string reportopendate = ""; //鎶ヤ慨寮�濮嬫椂闂�
+ string reportclosedate = ""; //鎶ヤ慨缁撴潫鏃堕棿
+ string repairopendate = ""; //缁翠慨寮�濮嬫椂闂�
+ string repairclosedate = ""; //缁翠慨缁撴潫鏃堕棿
+ string vrifcatopendate = ""; //缁翠慨楠岃瘉寮�濮嬫椂闂�
+ string vrifcatclosedate = ""; //缁翠慨楠岃瘉缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportopendate = reportdate.Split('~')[0].ToString();
+ reportclosedate = reportdate.Split('~')[1].ToString();
+ }
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ if (vrifcatdate != "" && vrifcatdate != null)
+ {
+ vrifcatopendate = vrifcatdate.Split('~')[0].ToString();
+ vrifcatclosedate = vrifcatdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = DeviceManagerBLL.DeviceUpdateSearch(us, wkshopcode, eqpcode, eqpname, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨璁板綍鏄庣粏鏌ヨ]
+ /// <summary>
+ /// 璁惧缁翠慨璁板綍鏄庣粏鏌ヨ
+ /// </summary>
+ /// <param name="repair_code">璁惧缁翠慨鍗曞彿</param>
+ /// <returns></returns>
+ [Route(template: "DeviceUpdateSubSearch")]
+ [HttpGet]
+ public JsonResult DeviceUpdateSubSearch(string repair_code)
+ {
+ mes = DeviceManagerBLL.DeviceUpdateSubSearch(repair_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨璁板綍瀵煎嚭]
+ /// <summary>
+ /// 璁惧缁翠慨璁板綍瀵煎嚭
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="eqpname">璁惧鍚嶇О</param>
+ /// <param name="reportuser">鎶ヤ慨浜哄憳</param>
+ /// <param name="repairuser">缁翠慨浜哄憳</param>
+ /// <param name="vrifcatuser">楠岃瘉浜哄憳</param>
+ /// <param name="reportdate">鎶ヤ慨鏃堕棿</param>
+ /// <param name="repairdate">缁翠慨鏃堕棿</param>
+ /// <param name="vrifcatdate">楠岃瘉鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "DeviceUpdateOutExcel")]
+ [HttpGet]
+ public JsonResult DeviceUpdateOutExcel(string wkshopcode = null, string eqpcode = null, string eqpname = null, string reportuser = null, string repairuser = null, string vrifcatuser = null, string reportdate = null, string repairdate = null, string vrifcatdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string reportopendate = ""; //鎶ヤ慨寮�濮嬫椂闂�
+ string reportclosedate = ""; //鎶ヤ慨缁撴潫鏃堕棿
+ string repairopendate = ""; //缁翠慨寮�濮嬫椂闂�
+ string repairclosedate = ""; //缁翠慨缁撴潫鏃堕棿
+ string vrifcatopendate = ""; //缁翠慨楠岃瘉寮�濮嬫椂闂�
+ string vrifcatclosedate = ""; //缁翠慨楠岃瘉缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportopendate = reportdate.Split('~')[0].ToString();
+ reportclosedate = reportdate.Split('~')[1].ToString();
+ }
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ if (vrifcatdate != "" && vrifcatdate != null)
+ {
+ vrifcatopendate = vrifcatdate.Split('~')[0].ToString();
+ vrifcatclosedate = vrifcatdate.Split('~')[1].ToString();
+ }
+ mes = DeviceManagerBLL.DeviceUpdateOutExcel(us, wkshopcode, eqpcode, eqpname, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/ErpMessageController.cs b/VueWebCoreApi/Controllers/ErpMessageController.cs
new file mode 100644
index 0000000..91260cc
--- /dev/null
+++ b/VueWebCoreApi/Controllers/ErpMessageController.cs
@@ -0,0 +1,170 @@
+锘縰sing Dapper;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+using VueWebCoreApi.Util;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "鐣呮嵎閫氭巿鏉冪鐞�")]
+ [ApiController]
+ [Route("api/[controller]")]
+ public class ErpMessageController : Controller
+ {
+
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+ [Route(template: "OAuth")]
+ [HttpGet]
+ public string OAuth(string code, string state)
+ {
+ Console.WriteLine($"Code:{code}");
+ LogHelper.WriteLogData("code:" + code);
+ return code;
+ }
+
+ [Route(template: "Receive")]
+ [HttpPost]
+ public dynamic Receive([FromBody] ChanjetEncryptMsg encryptMsg)
+ {
+ string enMsg = encryptMsg.GetEncryptMsg();
+ LogHelper.WriteLogData("瑙e瘑鍓嶇殑娑堟伅enMsg:" + enMsg);
+ String decryptMsg = OpenapiHelper.AesDecrypt(enMsg, config.Key_encryptKey);
+ LogHelper.WriteLogData2("瑙e瘑鍚庢秷鎭�:" + decryptMsg);
+
+ MessageBase message = JsonConvert.DeserializeObject<MessageBase>(decryptMsg);
+ object retObj = null;
+ try
+ {
+ switch (message.msgType)
+ {
+ case "APP_TEST":
+ LogHelper.WriteLogData("娑堟伅绫诲瀷msgType:" + message.msgType);
+ retObj = DealTestMsg(message);
+ break;
+ case "APP_TICKET":
+ LogHelper.WriteLogData("娑堟伅绫诲瀷msgType:" + message.msgType);
+ retObj = DealTicketMsg(message);
+ break;
+ case "TEMP_AUTH_CODE":
+ LogHelper.WriteLogData("娑堟伅绫诲瀷msgType:" + message.msgType);
+ retObj = DealOrgTempAuthMsg(message);
+ break;
+ case "PAY_ORDER_SUCCESS":
+ LogHelper.WriteLogData("娑堟伅绫诲瀷msgType:" + message.msgType);
+ retObj = DealOrderPayMsg(message);
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return retObj;
+ }
+
+ private object DealOrderPayMsg(MessageBase message)
+ {
+ //throw new NotImplementedException();
+ Dictionary<string, string> dic = new Dictionary<string, string>
+ {
+ { "result","success"}
+ };
+ return dic;
+ }
+
+ private object DealOrgTempAuthMsg(MessageBase message)
+ {
+ LogHelper.WriteLogData("寮�濮婳rgTempAuthContent");
+ OrgTempAuthContent content = JsonConvert.DeserializeObject<OrgTempAuthContent>(message.bizContent.ToString());
+ Console.WriteLine($"OrgTempAuthCode:{content.tempAuthCode}");
+ LogHelper.WriteLogData("缁撴潫OrgTempAuthContent");
+ return $"OrgTempAuthCode:{content.tempAuthCode}";
+ }
+
+ private object DealTicketMsg(MessageBase message)
+ {
+ AppTicketContent content = JsonConvert.DeserializeObject<AppTicketContent>(message.bizContent.ToString());
+ LogHelper.WriteLogData($"AppTicket:{content.appTicket}");
+ var dynamicParams = new DynamicParameters();
+
+
+ var sql = @"update T_AppTicket set AppTicket=@AppTicket,lm_date=@lm_date";
+ dynamicParams.Add("@AppTicket", content.appTicket);
+ dynamicParams.Add("@lm_date", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>
+ {
+ { "result","success"}
+ };
+ return dic;
+ }
+ else
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>
+ {
+ { "result","success"}
+ };
+ return dic;
+ }
+ }
+
+ private object DealTestMsg(MessageBase message)
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>
+ {
+ { "result","success"}
+ };
+ LogHelper.WriteLogData1(JsonConvert.SerializeObject(dic));
+ return dic;
+ }
+
+ /// <summary>
+ /// 鑾峰彇AppTicket
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "AppTicketSelect")]
+ [HttpGet]
+ public JsonResult AppTicketSelect()
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇杞﹂棿涓嬫媺妗嗘暟鎹�
+ sql = @"select * from T_AppTicket ";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏌ヨ澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return Json(mes);
+ }
+ }
+}
diff --git a/VueWebCoreApi/Controllers/ErpSyncMesController.cs b/VueWebCoreApi/Controllers/ErpSyncMesController.cs
new file mode 100644
index 0000000..ba332ce
--- /dev/null
+++ b/VueWebCoreApi/Controllers/ErpSyncMesController.cs
@@ -0,0 +1,102 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "鐣呮嵎閫欵RP鍩虹鏁版嵁鍚屾")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class ErpSyncMesController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[鐗╂枡绠$悊锛氳閲忓崟浣嶅悓姝
+ /// <summary>
+ /// 鐗╂枡绠$悊锛氳閲忓崟浣嶅悓姝�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "SaveSearchUnit")]
+ [HttpPost]
+ public JsonResult SaveSearchUnit()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ErpSyncMesBLL.SaveSearchUnit(us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐗╂枡绠$悊锛氬瓨璐ф。妗堝悓姝
+ /// <summary>
+ /// 鐗╂枡绠$悊锛氬瓨璐ф。妗堝悓姝�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "SaveSearchMateriel_Info")]
+ [HttpPost]
+ public JsonResult SaveSearchMateriel_Info()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ErpSyncMesBLL.SaveSearchMateriel_Info(us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍩虹璁剧疆锛氫粨搴撳悓姝
+ /// <summary>
+ /// 鍩虹璁剧疆锛氫粨搴撳悓姝�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "SaveSearchWareHouse")]
+ [HttpPost]
+ public JsonResult SaveSearchWareHouse()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ErpSyncMesBLL.SaveSearchWareHouse(us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍩虹璁剧疆锛氬線鏉ュ崟浣嶅悓姝
+ /// <summary>
+ /// 鍩虹璁剧疆锛氬線鏉ュ崟浣嶅悓姝�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "SeaveSearchPartner")]
+ [HttpPost]
+ public JsonResult SeaveSearchPartner()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ErpSyncMesBLL.SeaveSearchPartner(us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇绠$悊锛欵RP鐢熶骇璁㈠崟鍚屾]
+ /// <summary>
+ /// 鐢熶骇绠$悊锛欵RP鐢熶骇璁㈠崟鍚屾
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "SeaveSearchErpOrder")]
+ [HttpPost]
+ public JsonResult SeaveSearchErpOrder()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ErpSyncMesBLL.SeaveSearchErpOrder(us);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/GeneralBasicDataController.cs b/VueWebCoreApi/Controllers/GeneralBasicDataController.cs
new file mode 100644
index 0000000..8400389
--- /dev/null
+++ b/VueWebCoreApi/Controllers/GeneralBasicDataController.cs
@@ -0,0 +1,349 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "閫氱敤鍩虹璧勬枡")]
+ [ApiController]
+ [Route("api/[controller]")]
+ public class GeneralBasicDataController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[缁勭粐鏋舵瀯鍩虹璧勬枡]
+ /// <summary>
+ /// 缁勭粐鏋舵瀯鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "PrentOrganization")]
+ [HttpGet]
+ public JsonResult PrentOrganization()
+ {
+ mes = GeneralBasicDataBLL.PrentOrganization();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缁勭粐鏋舵瀯鍩虹璧勬枡(鏃犲叕鍙�)]
+ /// <summary>
+ /// 缁勭粐鏋舵瀯鍩虹璧勬枡(鏃犲叕鍙�)
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "PrentOrganizationNoCompany")]
+ [HttpGet]
+ public JsonResult PrentOrganizationNoCompany()
+ {
+ mes = GeneralBasicDataBLL.PrentOrganizationNoCompany();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宀椾綅鍩虹璧勬枡]
+ /// <summary>
+ /// 宀椾綅鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "PostPermissions")]
+ [HttpGet]
+ public JsonResult PostPermissions()
+ {
+ mes = GeneralBasicDataBLL.PostPermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瑙掕壊鍩虹璧勬枡]
+ /// <summary>
+ /// 瑙掕壊鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "RolePermissions")]
+ [HttpGet]
+ public JsonResult RolePermissions()
+ {
+ mes = GeneralBasicDataBLL.RolePermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐝粍鍩虹璧勬枡]
+ /// <summary>
+ ///鐝粍鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "GroupsPermissions")]
+ [HttpGet]
+ public JsonResult GroupsPermissions()
+ {
+ mes = GeneralBasicDataBLL.GroupsPermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浜哄憳鍩虹璧勬枡]
+ /// <summary>
+ /// 浜哄憳鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "PersonPermissions")]
+ [HttpGet]
+ public JsonResult PersonPermissions()
+ {
+ mes = GeneralBasicDataBLL.PersonPermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐝粍鏌ユ壘浜哄憳鍩虹璧勬枡]
+ /// <summary>
+ /// 鐝粍鏌ユ壘浜哄憳鍩虹璧勬枡
+ /// </summary>
+ /// <param name="groupcode">鐝粍缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "GroupsPersonPermissions")]
+ [HttpGet]
+ public JsonResult GroupsPersonPermissions(string groupcode)
+ {
+ mes = GeneralBasicDataBLL.GroupsPersonPermissions(groupcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鎵�灞炵粍缁囨煡鎵句汉鍛樺熀纭�璧勬枡]
+ /// <summary>
+ /// 鎵�灞炵粍缁囨煡鎵句汉鍛樺熀纭�璧勬枡
+ /// </summary>
+ /// <param name="torgcode">缁勭粐(杞﹂棿)缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "TorgPersonPermissions")]
+ [HttpGet]
+ public JsonResult TorgPersonPermissions(string torgcode)
+ {
+ mes = GeneralBasicDataBLL.TorgPersonPermissions(torgcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鎸夐挳鍩虹璧勬枡]
+ /// <summary>
+ /// 鎸夐挳鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "ButtonData")]
+ [HttpGet]
+ public JsonResult ButtonData()
+ {
+ mes = GeneralBasicDataBLL.ButtonData();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏁版嵁鏉冮檺鍩虹璧勬枡]
+ /// <summary>
+ /// 鏁版嵁鏉冮檺鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "DataPermissions")]
+ [HttpGet]
+ public JsonResult DataPermissions()
+ {
+ mes = GeneralBasicDataBLL.DataPermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍗曚綅淇℃伅鏌ヨ]
+ /// <summary>
+ /// 鍗曚綅淇℃伅鏌ヨ
+ /// </summary>
+ /// <param name="tunittype">璁¢噺鏂瑰紡锛歋(鍗曡閲�) M(澶氳閲�)</param>
+ /// <returns></returns>
+ [Route(template: "UnitSerch")]
+ [HttpGet]
+ public JsonResult UnitSerch(string tunittype)
+ {
+ mes = GeneralBasicDataBLL.UnitSerch(tunittype);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷淇℃伅鏌ヨ]
+ /// <summary>
+ /// 璁惧绫诲瀷淇℃伅鏌ヨ
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "DeviceTypeData")]
+ [HttpGet]
+ public JsonResult DeviceTypeData()
+ {
+ mes = GeneralBasicDataBLL.DeviceTypeData();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧鍩虹璧勬枡]
+ [Route(template: "EqpPermissions")]
+ [HttpGet]
+ public JsonResult EqpPermissions()
+ {
+ mes = GeneralBasicDataBLL.EqpPermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷缂栫爜鏌ユ壘璁惧淇℃伅]
+ /// <summary>
+ /// 璁惧绫诲瀷缂栫爜鏌ユ壘璁惧淇℃伅
+ /// </summary>
+ /// <param name="eqptypecode">璁惧绫诲瀷缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "EqpTypecodeSeachEqpPermissions")]
+ [HttpGet]
+ public JsonResult EqpTypecodeSeachEqpPermissions(string eqptypecode)
+ {
+ mes = GeneralBasicDataBLL.EqpTypecodeSeachEqpPermissions(eqptypecode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撳簱鍩虹璧勬枡]
+ /// <summary>
+ /// 浠撳簱鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WareHouse")]
+ [HttpGet]
+ public JsonResult WareHouse()
+ {
+ mes = GeneralBasicDataBLL.WareHouse();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撳簱搴撲綅鍩虹璧勬枡]
+ /// <summary>
+ /// 浠撳簱搴撲綅鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WareHouseLocation")]
+ [HttpGet]
+ public JsonResult WareHouseLocation()
+ {
+ mes = GeneralBasicDataBLL.WareHouseLocation();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撳簱鏌ユ壘浠撲綅淇℃伅]
+ /// <summary>
+ /// 浠撳簱鏌ユ壘浠撲綅淇℃伅
+ /// </summary>
+ /// <param name="warhousecode">浠撳簱缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "WareHouseSelectLocation")]
+ [HttpGet]
+ public JsonResult WareHouseSelectLocation(string warhousecode)
+ {
+ mes = GeneralBasicDataBLL.WareHouseSelectLocation(warhousecode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭鍩虹璧勬枡]
+ /// <summary>
+ /// 宸ュ簭鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "StepData")]
+ [HttpGet]
+ public JsonResult StepData()
+ {
+ mes = GeneralBasicDataBLL.StepData();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缂洪櫡鍩虹璧勬枡]
+ [Route(template: "DefectPermissions")]
+ [HttpGet]
+ public JsonResult DefectPermissions()
+ {
+ mes = GeneralBasicDataBLL.DefectPermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅熀纭�璧勬枡]
+ /// <summary>
+ /// 寰�鏉ュ崟浣嶅熀纭�璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "CustomerPermissions")]
+ [HttpGet]
+ public JsonResult CustomerPermissions()
+ {
+ mes = GeneralBasicDataBLL.CustomerPermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀛樿揣鏍戝瀷鍩虹璧勬枡]
+ /// <summary>
+ /// 瀛樿揣鏍戝瀷鍩虹璧勬枡
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "InventoryTreePermissions")]
+ [HttpGet]
+ public JsonResult InventoryTreePermissions()
+ {
+ mes = GeneralBasicDataBLL.InventoryTreePermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿妫�楠岄」鐩笅鎷夊垪琛╙
+ /// <summary>
+ /// 妯″叿妫�楠岄」鐩笅鎷夊垪琛�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "MouldCheckItemSelect")]
+ [HttpGet]
+ public JsonResult MouldCheckItemSelect()
+ {
+ mes = GeneralBasicDataBLL.MouldCheckItemSelect();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤圭洰涓嬫媺鍒楄〃]
+ /// <summary>
+ /// 妯″叿淇濆吇椤圭洰涓嬫媺鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "MouldRepairItemSelect")]
+ [HttpGet]
+ public JsonResult MouldRepairItemSelect()
+ {
+ mes = GeneralBasicDataBLL.MouldRepairItemSelect();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏌ヨ宸ュ崟鍩虹璧勬枡]
+ [Route(template: "WrkOrderDataSelect")]
+ [HttpGet]
+ public JsonResult WrkOrderDataSelect()
+ {
+ mes = GeneralBasicDataBLL.WrkOrderDataSelect();
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/GridReportController.cs b/VueWebCoreApi/Controllers/GridReportController.cs
new file mode 100644
index 0000000..c3fdee0
--- /dev/null
+++ b/VueWebCoreApi/Controllers/GridReportController.cs
@@ -0,0 +1,41 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "鍗曟嵁鎵撳嵃")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class GridReportController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[MES宸ュ崟鎵撳嵃1]
+ /// <summary>
+ /// MES宸ュ崟鎵撳嵃1
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderPrintSearch")]
+ [HttpPost]
+ public JsonResult MesOrderPrintSearch([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mesordercode = obj["mesordercode"].ToString(); //宸ュ崟鐘舵�佺爜
+ mes = GridReportBLL.MesOrderPrintSearch(us, mesordercode);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/HomeIndexController.cs b/VueWebCoreApi/Controllers/HomeIndexController.cs
new file mode 100644
index 0000000..bb0b383
--- /dev/null
+++ b/VueWebCoreApi/Controllers/HomeIndexController.cs
@@ -0,0 +1,162 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "绯荤粺棣栭〉")]
+ [ApiController]
+ [Route("api/[controller]")]
+ //[ChannelActionFilter]
+ public class HomeIndexController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[棣栭〉椤堕儴鍥涗釜(鐢熶骇璁㈠崟鏁般�佺敓浜у伐鍗曟暟銆佸湪鍒跺搧鏁般�佷笉鑹搧鏁�)]
+ /// <summary>
+ /// 棣栭〉椤堕儴鍥涗釜(鐢熶骇璁㈠崟鏁般�佺敓浜у伐鍗曟暟銆佸湪鍒跺搧鏁般�佷笉鑹搧鏁�)
+ /// </summary>
+ /// <param name="searchdate">鏃ユ湡</param>
+ /// <returns></returns>
+ [Route(template: "HomeIndexTopSearch")]
+ [HttpGet]
+ public JsonResult HomeIndexTopSearch(string searchdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //棰勮寮�宸ュ紑濮嬫椂闂�
+ string paydateenddate = ""; //棰勮寮�宸ョ粨鏉熸椂闂�
+ if (searchdate != "" && searchdate != null)
+ {
+ paydatestartdate = searchdate.Split('~')[0].ToString();
+ paydateenddate = searchdate.Split('~')[1].ToString();
+ }
+ mes = HomeIndexBLL.HomeIndexTopSearch(paydatestartdate, paydateenddate,us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[棣栭〉涓棿宸ュ簭瀹屾垚杩涘害,涓嶈壇鍝佹帓琛宂
+ /// <summary>
+ /// 棣栭〉涓棿宸ュ簭瀹屾垚杩涘害,涓嶈壇鍝佹帓琛�
+ /// </summary>
+ /// <param name="searchdate">鏃ユ湡</param>
+ /// <returns></returns>
+ [Route(template: "HomeIndexCenterLeftSearch")]
+ [HttpGet]
+ public JsonResult HomeIndexCenterLeftSearch(string searchdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //棰勮寮�宸ュ紑濮嬫椂闂�
+ string paydateenddate = ""; //棰勮寮�宸ョ粨鏉熸椂闂�
+ if (searchdate != "" && searchdate != null)
+ {
+ paydatestartdate = searchdate.Split('~')[0].ToString();
+ paydateenddate = searchdate.Split('~')[1].ToString();
+ }
+ mes = HomeIndexBLL.HomeIndexCenterLeftSearch(paydatestartdate, paydateenddate, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[涓嶈壇鍝佹帓琛屾槑缁哴
+ /// <summary>
+ /// 涓嶈壇鍝佹帓琛屾槑缁�
+ /// </summary>
+ /// <param name="searchdate">鏃ユ湡</param>
+ /// <param name="defect_code">涓嶈壇缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "HomeIndexCenterRightSearch")]
+ [HttpGet]
+ public JsonResult HomeIndexCenterRightSearch(string searchdate = null, string defect_code = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //棰勮寮�宸ュ紑濮嬫椂闂�
+ string paydateenddate = ""; //棰勮寮�宸ョ粨鏉熸椂闂�
+ if (searchdate != "" && searchdate != null)
+ {
+ paydatestartdate = searchdate.Split('~')[0].ToString();
+ paydateenddate = searchdate.Split('~')[1].ToString();
+ }
+ mes = HomeIndexBLL.HomeIndexCenterRightSearch(paydatestartdate, paydateenddate, defect_code, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[棣栭〉涓棿宸ュ簭瀹屾垚杩涘害鐗╂枡鏄庣粏]
+ /// <summary>
+ /// 棣栭〉涓棿宸ュ簭瀹屾垚杩涘害鐗╂枡鏄庣粏
+ /// </summary>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <param name="type">绫诲瀷:(浠诲姟:W 瀹屾垚:T)</param>
+ /// <param name="searchdate">鏃ユ湡</param>
+ /// <returns></returns>
+ [Route(template: "HomeIndexCenterLeftSubSearch")]
+ [HttpGet]
+ public JsonResult HomeIndexCenterLeftSubSearch(string stepcode=null,string type=null, string searchdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //棰勮寮�宸ュ紑濮嬫椂闂�
+ string paydateenddate = ""; //棰勮寮�宸ョ粨鏉熸椂闂�
+ if (searchdate != "" && searchdate != null)
+ {
+ paydatestartdate = searchdate.Split('~')[0].ToString();
+ paydateenddate = searchdate.Split('~')[1].ToString();
+ }
+ mes = HomeIndexBLL.HomeIndexCenterLeftSubSearch(stepcode,type,paydatestartdate, paydateenddate, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[棣栭〉涓笅閿�鍞俊鎭痌
+ /// <summary>
+ /// 棣栭〉涓笅閿�鍞俊鎭�
+ /// </summary>
+ /// <param name="type">鏌ヨ缁村害:璁㈠崟(W) 鐗╂枡(P)</param>
+ /// <param name="searchdate"></param>
+ /// <returns></returns>
+ [Route(template: "HomeIndexCenterSaOrderSearch")]
+ [HttpGet]
+ public JsonResult HomeIndexCenterSaOrderSearch(string type=null, string searchdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //棰勮寮�宸ュ紑濮嬫椂闂�
+ string paydateenddate = ""; //棰勮寮�宸ョ粨鏉熸椂闂�
+ if (searchdate != "" && searchdate != null)
+ {
+ paydatestartdate = searchdate.Split('~')[0].ToString();
+ paydateenddate = searchdate.Split('~')[1].ToString();
+ }
+ mes = HomeIndexBLL.HomeIndexCenterSaOrderSearch(type,paydatestartdate, paydateenddate, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[棣栭〉搴曢儴搴撳瓨淇℃伅]
+ /// <summary>
+ /// 棣栭〉搴曢儴搴撳瓨淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "HomeIndexBottomSearch")]
+ [HttpGet]
+ public JsonResult HomeIndexBottomSearch()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = HomeIndexBLL.HomeIndexBottomSearch(us);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/HourlyWageController.cs b/VueWebCoreApi/Controllers/HourlyWageController.cs
new file mode 100644
index 0000000..de66cd7
--- /dev/null
+++ b/VueWebCoreApi/Controllers/HourlyWageController.cs
@@ -0,0 +1,352 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.AttendanceSetting;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "璁℃椂宸ヨ祫")]
+ [ApiController]
+ [Route("api/[controller]")]
+
+ public class HourlyWageController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[鑰冨嫟璁剧疆鏌ヨ]
+ /// <summary>
+ /// 鑰冨嫟璁剧疆鏌ヨ
+ /// </summary>
+ /// <param name="wkshop_code">杞﹂棿缂栫爜</param>
+ /// <param name="creatuser">鍒涘缓浜哄憳</param>
+ /// <param name="creatdate">鍒涘缓鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceSettSearch")]
+ [HttpGet]
+ [ChannelActionFilter]
+ public JsonResult AttendanceSettSearch(string wkshop_code = null,string creatuser = null, string creatdate = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //鍒涘缓寮�濮嬫椂闂�
+ string paydateenddate = ""; //鍒涘缓缁撴潫鏃堕棿
+ if (creatdate != "" && creatdate != null)
+ {
+ paydatestartdate = creatdate.Split('~')[0].ToString();
+ paydateenddate = creatdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = HourlyWageBLL.AttendanceSettSearch(wkshop_code, creatuser, paydatestartdate, paydateenddate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁剧疆鏂板/缂栬緫]
+ /// <summary>
+ /// 鑰冨嫟璁剧疆鏂板/缂栬緫
+ /// </summary>
+ /// <param name="OperType">鎿嶄綔绫诲瀷(Add/Update)</param>
+ /// <param name="attendancesett">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceSettAddUpdate")]
+ [HttpPost]
+ [ChannelActionFilter]
+ public JsonResult AttendanceSettAddUpdate(AttendanceSett attendancesett, string OperType)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = HourlyWageBLL.AttendanceSettAddUpdate(attendancesett, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁剧疆鍒犻櫎]
+ /// <summary>
+ /// 鑰冨嫟璁剧疆鍒犻櫎
+ /// </summary>
+ /// <param name="attendancesett">鎻愪氦璁剧疆</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceSettDelete")]
+ [HttpPost]
+ [ChannelActionFilter]
+ public JsonResult AttendanceSettDelete(AttendanceSett attendancesett)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = HourlyWageBLL.AttendanceSettDelete(attendancesett, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鑰冨嫟鎵撳崱淇℃伅鏌ヨ]
+ /// <summary>
+ /// 鑰冨嫟鎵撳崱淇℃伅鏌ヨ
+ /// </summary>
+ /// <param name="usercode">鐢ㄦ埛缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceSearch")]
+ [HttpGet]
+ public JsonResult AttendanceSearch(string usercode = null)
+ {
+ mes = HourlyWageBLL.AttendanceSearch(usercode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑰冨嫟鎵撳崱淇℃伅鎻愪氦]
+ /// <summary>
+ /// 鑰冨嫟鎵撳崱淇℃伅鎻愪氦
+ /// </summary>
+ /// <param name="attendance">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceSave")]
+ [HttpPost]
+ public JsonResult AttendanceSave(Attendance attendance)
+ {
+ mes = HourlyWageBLL.AttendanceSave(attendance);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鑰冨嫟璁板綍鏌ヨ]
+ /// <summary>
+ /// 鑰冨嫟璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="wkshop_code">杞﹂棿缂栫爜</param>
+ /// <param name="creatusercode">鎵撳崱浜哄憳缂栫爜</param>
+ /// <param name="creatdate">鎵撳崱鏃ユ湡</param>
+ /// <param name="status">鏍哥畻鐘舵��(宸叉牳绠�/鏈牳绠�)</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceRecordSearch")]
+ [HttpGet]
+ [ChannelActionFilter]
+ public JsonResult AttendanceRecordSearch(string wkshop_code = null, string creatusercode = null, string creatdate = null,string status=null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //鎵撳崱寮�濮嬫椂闂�
+ string paydateenddate = ""; //鎵撳崱缁撴潫鏃堕棿
+ if (creatdate != "" && creatdate != null)
+ {
+ paydatestartdate = creatdate.Split('~')[0].ToString();
+ paydateenddate = creatdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = HourlyWageBLL.AttendanceRecordSearch(wkshop_code, creatusercode, paydatestartdate, paydateenddate,status, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鏂板缂栬緫]
+ /// <summary>
+ /// 鑰冨嫟璁板綍鏂板缂栬緫
+ /// </summary>
+ /// <param name="OperType">鎿嶄綔绫诲瀷</param>
+ /// <param name="attendanceRecord">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceRecordAddUpdate")]
+ [HttpPost]
+ [ChannelActionFilter]
+ public JsonResult AttendanceRecordAddUpdate(AttendanceRecord attendanceRecord, string OperType)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = HourlyWageBLL.AttendanceRecordAddUpdate(attendanceRecord, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鍒犻櫎]
+ /// <summary>
+ /// 鑰冨嫟璁板綍鍒犻櫎
+ /// </summary>
+ /// <param name="attendanceRecord">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceRecordDelete")]
+ [HttpPost]
+ [ChannelActionFilter]
+ public JsonResult AttendanceRecordDelete(AttendanceRecord attendanceRecord)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = HourlyWageBLL.AttendanceRecordDelete(attendanceRecord, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鏍哥畻鎻愪氦]
+ /// <summary>
+ /// 鑰冨嫟璁板綍鏍哥畻鎻愪氦
+ /// </summary>
+ /// <param name="attendanceSave">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AttendanceRecordSave")]
+ [HttpPost]
+ [ChannelActionFilter]
+ public JsonResult AttendanceRecordSave(AttendanceSave attendanceSave)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = HourlyWageBLL.AttendanceRecordSave(attendanceSave,us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鏃ヨ鏃跺伐璧勬姤琛ㄦ煡璇
+ /// <summary>
+ /// 鏃ヨ鏃跺伐璧勬姤琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="wkshop_code">杞﹂棿缂栫爜</param>
+ /// <param name="creatusercode">鎵撳崱浜哄憳缂栫爜</param>
+ /// <param name="creatdate">鎵撳崱鏃ユ湡</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DailyWageReportSearch")]
+ [HttpGet]
+ [ChannelActionFilter]
+ public JsonResult DailyWageReportSearch(string wkshop_code = null, string creatusercode = null, string creatdate = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //鍒涘缓寮�濮嬫椂闂�
+ string paydateenddate = ""; //鍒涘缓缁撴潫鏃堕棿
+ if (creatdate != "" && creatdate != null)
+ {
+ paydatestartdate = creatdate.Split('~')[0].ToString();
+ paydateenddate = creatdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = HourlyWageBLL.DailyWageReportSearch(wkshop_code, creatusercode, paydatestartdate, paydateenddate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏃ヨ鏃跺伐璧勪慨鏀规墸闄ゆ椂闀裤�佹墸闄よ柂璧刔
+ /// <summary>
+ /// 鏃ヨ鏃跺伐璧勪慨鏀规墸闄ゆ椂闀裤�佹墸闄よ柂璧�
+ /// </summary>
+ /// <param name="dailyWageReport">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "DailyWageReportUpdate")]
+ [HttpPost]
+ [ChannelActionFilter]
+ public JsonResult DailyWageReportUpdate(DailyWageReport dailyWageReport)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = HourlyWageBLL.DailyWageReportUpdate(dailyWageReport, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏃ヨ鏃跺伐璧勬姤琛ㄥ鍑篯
+ /// <summary>
+ /// 鏃ヨ鏃跺伐璧勬姤琛ㄥ鍑�
+ /// </summary>
+ /// <param name="wkshop_code">杞﹂棿缂栫爜</param>
+ /// <param name="creatusercode">鎵撳崱浜哄憳缂栫爜</param>
+ /// <param name="creatdate">鎵撳崱鏃ユ湡</param>
+ /// <returns></returns>
+ [Route(template: "DailyWageReportExcelSearch")]
+ [HttpGet]
+ [ChannelActionFilter]
+ public JsonResult DailyWageReportExcelSearch(string wkshop_code = null, string creatusercode = null, string creatdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //鍒涘缓寮�濮嬫椂闂�
+ string paydateenddate = ""; //鍒涘缓缁撴潫鏃堕棿
+ if (creatdate != "" && creatdate != null)
+ {
+ paydatestartdate = creatdate.Split('~')[0].ToString();
+ paydateenddate = creatdate.Split('~')[1].ToString();
+ }
+ mes = HourlyWageBLL.DailyWageReportExcelSearch(wkshop_code, creatusercode, paydatestartdate, paydateenddate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鏈堣鏃跺伐璧勬姤琛ㄦ煡璇
+ /// <summary>
+ /// 鏈堣鏃跺伐璧勬姤琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="wkshop_code">杞﹂棿缂栫爜</param>
+ /// <param name="creatdate">鏌ヨ鏈堜唤</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MonthlyWageReportSearch")]
+ [HttpPost]
+ [ChannelActionFilter]
+ public JsonResult MonthlyWageReportSearch(string wkshop_code = null, string creatdate = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //鍒涘缓寮�濮嬫椂闂�
+ string paydateenddate = ""; //鍒涘缓缁撴潫鏃堕棿
+ if (creatdate != "" && creatdate != null)
+ {
+ paydatestartdate = creatdate.Split('~')[0].ToString();
+ paydateenddate = creatdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = HourlyWageBLL.MonthlyWageReportSearch(wkshop_code, paydatestartdate, paydateenddate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏈堣鏃跺伐璧勬姤琛ㄥ鍑篯
+ /// <summary>
+ /// 鏈堣鏃跺伐璧勬姤琛ㄥ鍑�
+ /// </summary>
+ /// <param name="wkshop_code">杞﹂棿缂栫爜</param>
+ /// <param name="creatdate">鎵撳崱鏃ユ湡</param>
+ /// <returns></returns>
+ [Route(template: "MonthlyWageReportExcelSearch")]
+ [HttpGet]
+ [ChannelActionFilter]
+ public JsonResult MonthlyWageReportExcelSearch(string wkshop_code = null,string creatdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //鍒涘缓寮�濮嬫椂闂�
+ string paydateenddate = ""; //鍒涘缓缁撴潫鏃堕棿
+ if (creatdate != "" && creatdate != null)
+ {
+ paydatestartdate = creatdate.Split('~')[0].ToString();
+ paydateenddate = creatdate.Split('~')[1].ToString();
+ }
+ mes = HourlyWageBLL.MonthlyWageReportExcelSearch(wkshop_code, paydatestartdate, paydateenddate);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/ImportExcelController.cs b/VueWebCoreApi/Controllers/ImportExcelController.cs
new file mode 100644
index 0000000..1617421
--- /dev/null
+++ b/VueWebCoreApi/Controllers/ImportExcelController.cs
@@ -0,0 +1,222 @@
+锘縰sing Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.SystemSetting;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "Excel瀵煎叆")]
+ [ApiController]
+ [Route("api/[controller]")]
+ //[ChannelActionFilter]
+ public class ImportExcelController : Controller
+ {
+ private readonly IWebHostEnvironment _hostingEnvironment;
+
+ public ImportExcelController(IWebHostEnvironment hostingEnvironment)
+ {
+ _hostingEnvironment = hostingEnvironment;
+ }
+
+ #region[Excel瀵煎叆妯℃澘鍒楄〃]
+ /// <summary>
+ /// Excel瀵煎叆妯℃澘鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "ExcelModelData")]
+ [HttpGet]
+ public JsonResult ExcelModelData()
+ {
+ ToMessage mes = new ToMessage();
+ List<ScoreReport> list = ExcelList.ExcelData();
+ mes.code = "200";
+ mes.data = list;
+ return Json(mes);
+ }
+ #endregion
+
+ #region [Excel瀵煎叆妯℃澘涓嬭浇]
+ /// <summary>
+ /// Excel瀵煎叆妯℃澘涓嬭浇
+ /// </summary>
+ /// <param name="FileCode"></param>
+ /// <returns></returns>
+ [Route(template: "DownLoadExcel")]
+ [HttpGet]
+ public JsonResult DownLoadExcel(string FileCode = null)
+ {
+ ToMessage mes = new ToMessage();
+ List<ScoreReport> list = ExcelList.ExcelData();
+ list = list.Where(s => s.FileCode == FileCode).ToList();
+ var filename = list[0].FileName + ".xls";
+ string fileip = AppSetting.GetAppSetting("FileIP");
+ var msg = fileip + "/Excel/" + filename;
+ mes.code = "200";
+ mes.data = msg;
+ return Json(mes);
+
+ //ToMessage mes = new ToMessage();
+ //List<ScoreReport> list = ExcelList.ExcelData();
+ //list = list.Where(s => s.FileCode == FileCode).ToList();
+ //var filename = list[0].FileName + ".xls";
+ //var wwwRootPath = _hostingEnvironment.WebRootPath;
+ //var fileDirectory = Path.Combine(wwwRootPath, "Excel"); // 鏇挎崲涓烘偍鐨凟xcel鏂囦欢鎵�鍦ㄧ洰褰�
+ //var filePath = Path.Combine(fileDirectory, $"{filename}.xlsx"); // 鍋囪鏂囦欢鍚嶇紪鐮佷负鏂囦欢鍚�
+
+ //if (System.IO.File.Exists(filePath))
+ //{
+ // var fileInfo = new FileInfo(filePath);
+ // var result = new
+ // {
+ // FileName = fileInfo.Name,
+ // FilePath = filePath,
+ // FileSize = fileInfo.Length
+ // };
+ // return Json(result);
+ //}
+ //else
+ //{
+ // mes.code = "300";
+ // mes.data = "";
+ // mes.message = "鏂囦欢涓嶅瓨鍦�";
+ //}
+ //return Json(mes);
+ }
+ #endregion
+
+ #region [Excel瀵煎叆鏁版嵁鎻愪氦銆佹ā鏉块獙璇併�佹暟鎹鍏
+ /// <summary>
+ /// Excel瀵煎叆鏁版嵁鎻愪氦銆佹ā鏉块獙璇併�佹暟鎹鍏�
+ /// </summary>
+ /// <param name="myModel">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "ExcelModelCheck")]
+ [HttpPost]
+ public JsonResult ExcelModelCheck([FromBody] ExceImport myModel)
+ {
+ string FileCode = myModel.FileCode;
+ List<DataTable> dataTable = myModel.TableData;
+
+ ExcelModelCheck list = new ExcelModelCheck();
+ list.json1 = ExcelCheck(dataTable, FileCode); //妯℃澘楠岃瘉
+ if (list.json1.code == "301")
+ {
+ list.json1 = list.json1;
+ return Json(list);
+ }
+ list.json2 = ExcelCheckData(myModel); //鏁版嵁楠岃瘉
+ if (list.json2.code == "301")
+ {
+ list.json2 = list.json2;
+ return Json(list);
+ }
+ list.json3 = ExcelImportSubmit(dataTable, FileCode); //鏁版嵁瀵煎叆
+ if (list.json3.code == "300")
+ {
+ list.json3 = list.json3;
+ return Json(list);
+ }
+ return Json(list);
+ }
+ #endregion
+
+ #region [Excel瀵煎叆妯℃澘楠岃瘉]
+ /// <summary>
+ /// Excel瀵煎叆妯℃澘楠岃瘉
+ /// </summary>
+ /// <param name="dataTable">鎻愪氦鏁版嵁</param>
+ /// <param name="FileCode">鏂囦欢缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ExcelCheckUpload")]
+ [HttpGet]
+ [ApiExplorerSettings(IgnoreApi = true)]
+ public ToMessage ExcelCheck(List<DataTable> dataTable, string FileCode = null)
+ {
+ ToMessage mes = new ToMessage();
+ try
+ {
+ mes = ExcelCheckBLL.ExcelCheck(FileCode, dataTable);
+ if (mes.code == "301") //涓婁紶妯℃澘涓嶆槸鎸囧畾妯℃澘
+ {
+ return mes;
+ }
+ return mes;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [Excel瀵煎叆鏁版嵁楠岃瘉]
+ /// <summary>
+ /// Excel瀵煎叆鏁版嵁楠岃瘉
+ /// </summary>
+ /// <param name="myModel">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "ExcelCheckData")]
+ [HttpPost]
+ [ApiExplorerSettings(IgnoreApi = true)]
+ public ToMessage ExcelCheckData([FromBody] ExceImport myModel)
+ {
+ ToMessage mes = new ToMessage();
+ string message = "";
+ string StuCode = "";
+ int count = 0;
+ List<ExcelErro> list = new List<ExcelErro>();
+ string FileCode = myModel.FileCode;
+ List<DataTable> dataTable = myModel.TableData;
+ list = ExcelCheckBLL.ExcelCheckData(FileCode, dataTable, out StuCode, out message, out count);
+ mes.code = StuCode;
+ mes.message = message;
+ mes.count = count;
+ mes.data = list;
+ return mes;
+ }
+ #endregion
+
+ #region[Excel瀵煎叆鏁版嵁]
+ /// <summary>
+ /// Excel瀵煎叆鏁版嵁
+ /// </summary>
+ /// <param name="dataTable">鎻愪氦鏁版嵁</param>
+ /// <param name="FileCode">鏂囦欢缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ExcelImportSubmit")]
+ [HttpPost]
+ [ApiExplorerSettings(IgnoreApi = true)]
+ public ToMessage ExcelImportSubmit(List<DataTable> dataTable, string FileCode = null)
+ {
+ ToMessage mes = new ToMessage();
+ try
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ExcelCheckBLL.ExcelImportSubmit(FileCode, dataTable, us);
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ return mes;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/KanBanManagerentController.cs b/VueWebCoreApi/Controllers/KanBanManagerentController.cs
new file mode 100644
index 0000000..d5af50a
--- /dev/null
+++ b/VueWebCoreApi/Controllers/KanBanManagerentController.cs
@@ -0,0 +1,238 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "鐪嬫澘绠$悊")]
+ [ApiController]
+ [Route("api/[controller]")]
+ public class KanBanManagerentController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓婄敓浜т俊鎭痌
+ /// <summary>
+ /// 鍢夐┌杞﹂棿鐪嬫澘,涓婄敓浜т俊鎭�
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "WorkShopProduceTopData")]
+ [HttpGet]
+ public JsonResult WorkShopProduceTopData(string wkshopcode)
+ {
+ mes = KanBanManagerentBLL.WorkShopProduceTopData(wkshopcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓嬪乏杩戜竴鍛ㄤ笉鑹秼鍔縘
+ /// <summary>
+ /// 鍢夐┌杞﹂棿鐪嬫澘,涓嬪乏杩戜竴鍛ㄤ笉鑹秼鍔�
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "WorkShopProduceBottomLeftData")]
+ [HttpGet]
+ public JsonResult WorkShopProduceBottomLeftData(string wkshopcode)
+ {
+ mes = KanBanManagerentBLL.WorkShopProduceBottomLeftData(wkshopcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓嬪彸杩戜竴鏈堜笉鑹粺璁
+ /// <summary>
+ /// 鍢夐┌杞﹂棿鐪嬫澘,涓嬪彸杩戜竴鏈堜笉鑹粺璁�
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "WorkShopProduceBottomRightData")]
+ [HttpGet]
+ public JsonResult WorkShopProduceBottomRightData(string wkshopcode)
+ {
+ mes = KanBanManagerentBLL.WorkShopProduceBottomRightData(wkshopcode);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,宸︿笂鐢熶骇璁㈠崟]
+ /// <summary>
+ /// 杞﹂棿缁煎悎鐪嬫澘,宸︿笂鐢熶骇璁㈠崟
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜瀛楃涓查泦</param>
+ /// <returns></returns>
+ [Route(template: "WorkShopCompreLeftTop")]
+ [HttpGet]
+ public JsonResult WorkShopCompreLeftTop(string wkshopcode)
+ {
+ mes = KanBanManagerentBLL.WorkShopCompreLeftTop(wkshopcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,鍙充笂閿�鍞鍗昡
+ /// <summary>
+ /// 杞﹂棿缁煎悎鐪嬫澘,鍙充笂閿�鍞鍗�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WorkShopCompreRightTop")]
+ [HttpGet]
+ public JsonResult WorkShopCompreRightTop()
+ {
+ mes = KanBanManagerentBLL.WorkShopCompreRightTop();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,宸︿笅閲囪喘璁㈠崟]
+ /// <summary>
+ /// 杞﹂棿缁煎悎鐪嬫澘,宸︿笅閲囪喘璁㈠崟
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WorkShopCompreLeftBottom")]
+ [HttpGet]
+ public JsonResult WorkShopCompreLeftBottom()
+ {
+ mes = KanBanManagerentBLL.WorkShopCompreLeftBottom();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,鍙充笅搴撳瓨]
+ /// <summary>
+ /// 杞﹂棿缁煎悎鐪嬫澘,鍙充笅搴撳瓨
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WorkShopCompreRightBottom")]
+ [HttpGet]
+ public JsonResult WorkShopCompreRightBottom()
+ {
+ mes = KanBanManagerentBLL.WorkShopCompreRightBottom();
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[浠撳簱鐪嬫澘,宸︿笂浜у搧寰呭叆搴撳垪琛╙
+ /// <summary>
+ /// 浠撳簱鐪嬫澘,宸︿笂浜у搧寰呭叆搴撳垪琛�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WareHouseTopLeftData")]
+ [HttpGet]
+ public JsonResult WareHouseTopLeftData()
+ {
+ mes = KanBanManagerentBLL.WareHouseTopLeftData();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,宸︿笅濮斿寰呭叆搴撳垪琛╙
+ /// <summary>
+ /// 浠撳簱鐪嬫澘,宸︿笅濮斿寰呭叆搴撳垪琛�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WareHouseTopBottomData")]
+ [HttpGet]
+ public JsonResult WareHouseTopBottomData()
+ {
+ mes = KanBanManagerentBLL.WareHouseTopBottomData();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,鍙充笂鎴愬搧搴撱�佸崐鎴愬搧搴搕op5搴撳瓨鎺掕]
+ /// <summary>
+ /// 浠撳簱鐪嬫澘,鍙充笂鎴愬搧搴撱�佸崐鎴愬搧搴搕op5搴撳瓨鎺掕
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WareHouseRightTopData")]
+ [HttpGet]
+ public JsonResult WareHouseRightTopData()
+ {
+ mes = KanBanManagerentBLL.WareHouseRightTopData();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,鍙充笅鍘熸枡搴撳簱top5搴撳瓨鎺掕]
+ /// <summary>
+ /// 浠撳簱鐪嬫澘,鍙充笅鍘熸枡搴撳簱top5搴撳瓨鎺掕
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "WareHouseRightBottomData")]
+ [HttpGet]
+ public JsonResult WareHouseRightBottomData()
+ {
+ mes = KanBanManagerentBLL.WareHouseRightBottomData();
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鍢夐┌浠撳簱鐪嬫澘宸︿笂,閲囪喘寰呭叆搴揮
+ /// <summary>
+ /// 鍢夐┌浠撳簱鐪嬫澘宸︿笂,閲囪喘寰呭叆搴�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "ProcureOutsourcLeftTop")]
+ [HttpGet]
+ public JsonResult ProcureOutsourcLeftTop()
+ {
+ mes = KanBanManagerentBLL.ProcureOutsourcLeftTop();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘宸︿笅,閿�鍞緟鍙戣揣]
+ /// <summary>
+ /// 鍢夐┌浠撳簱鐪嬫澘宸︿笅,閿�鍞緟鍙戣揣
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "ProductConsignmentLeftBottom")]
+ [HttpGet]
+ public JsonResult ProductConsignmentLeftBottom()
+ {
+ mes = KanBanManagerentBLL.ProductConsignmentLeftBottom();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘鍙充笂,杩戜竴鍛ㄩ噰璐緟鍏ュ簱鐗╂枡鎺掕TOP5]
+ /// <summary>
+ /// 鍢夐┌浠撳簱鐪嬫澘鍙充笂,杩戜竴鍛ㄩ噰璐緟鍏ュ簱鐗╂枡鎺掕TOP5
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "ProcureOutsourcRightTop")]
+ [HttpGet]
+ public JsonResult ProcureOutsourcRightTop()
+ {
+ mes = KanBanManagerentBLL.ProcureOutsourcRightTop();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘鍙充笅,杩戜竴鍛ㄩ攢鍞緟鍙戣揣浜у搧鎺掕TOP5]
+ /// <summary>
+ /// 鍢夐┌浠撳簱鐪嬫澘鍙充笅,杩戜竴鍛ㄩ攢鍞緟鍙戣揣浜у搧鎺掕TOP5
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "ProductionStockedInRightBottom")]
+ [HttpGet]
+ public JsonResult ProductionStockedInRightBottom()
+ {
+ mes = KanBanManagerentBLL.ProductionStockedInRightBottom();
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/LoginController.cs b/VueWebCoreApi/Controllers/LoginController.cs
new file mode 100644
index 0000000..c888ce4
--- /dev/null
+++ b/VueWebCoreApi/Controllers/LoginController.cs
@@ -0,0 +1,392 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "鐧诲綍淇℃伅")]
+ [ApiController]
+ [Route("api/[controller]")]
+ public class LoginController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+ //鑾峰彇浼佷笟閰嶇疆Enterprise
+ private static readonly string Enterprise = AppSetting.GetAppSetting("Enterprise");
+
+
+ #region[鐢ㄦ埛鐧诲綍(PC)]
+ /// <summary>
+ /// 鐢ㄦ埛鐧诲綍(PC)
+ /// </summary>
+ /// <param name="username">鐢ㄦ埛缂栫爜</param>
+ /// <param name="password">瀵嗙爜</param>
+ /// <param name="usertype">鎿嶄綔绔被鍨�(PC)</param>
+ /// <returns></returns>
+ [Route(template: "LoginSave")]
+ [HttpGet]
+ public JsonResult LoginSave(string username, string password, string usertype)
+ {
+ try
+ {
+ Dictionary<string, object> payLoad = new Dictionary<string, object>();
+ mes = LoginBLL.LoginSearch(username, password);
+ if (mes.code == "200")
+ {
+ List<DataTable> list = (List<DataTable>)mes.data;
+ DataTable dt = list[0];
+ //jwt鐢熸垚Token鍓嶇殑鐢ㄦ埛淇℃伅
+ payLoad.Add("usercode", dt.Rows[0]["usercode"].ToString());
+ payLoad.Add("username", dt.Rows[0]["username"].ToString());
+ payLoad.Add("storg_code", dt.Rows[0]["storg_code"].ToString());
+ payLoad.Add("storg_name", dt.Rows[0]["storg_name"].ToString());
+ payLoad.Add("is_system_admin", dt.Rows[0]["is_system_admin"].ToString());
+ payLoad.Add("role_code", dt.Rows[0]["role_code"].ToString());
+ payLoad.Add("role_datapermissions", dt.Rows[0]["role_datapermissions"].ToString());
+ payLoad.Add("usertype", usertype);
+ payLoad.Add("rediskey", Enterprise + "LoginUserID" + usertype + JwtTools.FindFirstKeyByValue(payLoad, "usercode"));
+ payLoad.Add("mesSetting", list[1].Rows[0]["json"].ToString()); //鑾峰彇绯荤粺娴佺▼閰嶇疆
+ //鑾峰彇jwt鐢熸垚token
+ mes = JwtTools.Encode(payLoad);
+
+ List<User> mss = new List<User>();
+ User ms = new User();
+ ms.usercode = dt.Rows[0]["usercode"].ToString();
+ ms.username = dt.Rows[0]["username"].ToString();
+ ms.storg_code= dt.Rows[0]["storg_code"].ToString();
+ ms.storg_name = dt.Rows[0]["storg_name"].ToString();
+ ms.is_system_admin = dt.Rows[0]["is_system_admin"].ToString();
+ ms.role_code= dt.Rows[0]["role_code"].ToString();
+ ms.role_datapermissions = dt.Rows[0]["role_datapermissions"].ToString();
+ ms.usertype = usertype;
+ ms.rediskey = Enterprise + "LoginUserID" + ms.usertype + ms.usercode;
+ ms.mesSetting = list[1].Rows[0]["json"].ToString();
+ ms.token = mes.data.ToString();
+ mss.Add(ms);
+
+
+ User loginUser = JsonConvert.DeserializeObject<User>(JsonConvert.SerializeObject(ms));
+ //濡傛灉redis鐧诲綍鐢ㄦ埛涓笉瀛樺湪褰撳墠鐢ㄦ埛
+ if (redis.GetStringKey<User>(ms.rediskey) == null)
+ {
+ //鍐欏叆redis(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
+ redis.SetStringKey<User>(ms.rediskey, ms, TimeSpan.FromSeconds(redis.secondsTimeOut));
+ //鍐欏叆鐧诲綍鎿嶄綔璁板綍
+ LogHelper.DbOperateLog(ms.usercode, "鐧诲綍", "鐧诲綍浜嗙郴缁�", ms.usertype);
+ mes.code = "200";
+ mes.message = "鐧诲綍鎴愬姛!";
+ mes.data = ms.token.ToString();
+ }
+ else //濡傛灉瀛樺湪
+ {
+ //鑾峰彇redis涓綋鍓嶇敤鎴蜂俊鎭�
+ User r_loginUser = redis.GetStringKey<User>(ms.rediskey);
+ //濡傛灉session涓殑鐢ㄦ埛usercode鍜宺edis涓殑鐢ㄦ埛usercode鍖归厤
+ if ((r_loginUser.rediskey).Equals(loginUser.rediskey))
+ {
+ mes.data = ms.token.ToString();
+ mes.code = "302";
+ mes.message = "褰撳墠璐﹀彿宸茬櫥褰�,鏄惁寮哄埗涓嬬嚎!";
+ }
+ else
+ {
+ //閲嶇疆杩囨湡鏃堕棿(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
+ redis.SetStringKey<User>(loginUser.rediskey, loginUser, TimeSpan.FromSeconds(redis.secondsTimeOut));
+ //鍐欏叆鐧诲綍鎿嶄綔璁板綍
+ LogHelper.DbOperateLog(ms.usercode, "鐧诲綍", "鐧诲綍浜嗙郴缁�", ms.usertype);
+ mes.data = ms;
+ mes.code = "200";
+ mes.message = "鐧诲綍鎴愬姛!";
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ mes.data = null;
+ }
+
+ return Json(mes);
+ }
+ #endregion
+
+ #region[寮哄埗涓嬬嚎鎺ュ彛]
+ /// <summary>
+ /// 寮哄埗涓嬬嚎鎺ュ彛
+ /// </summary>
+ /// <param name="token">token</param>
+ /// <param name="rid">rid鏋佸厜鎺ㄩ�佽幏鍙栬澶噄d</param>
+ /// <returns></returns>
+ [Route(template: "ForcedOffline")]
+ [HttpPost]
+ public JsonResult ForcedOffline(string token, string rid)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+
+ try
+ {
+ User us = JwtTools.Denocode(token.ToString());
+ us.token = token.ToString();
+ if (us.usertype.ToString() == "APP")
+ {
+ //鏇存柊rid
+ sql = @"update [dbo].[TUser] set rid=@rid where usercode=@usercode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ rid = rid,
+ usercode = us.usercode.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ redis.KeyDelete(us.rediskey);//鍒犻櫎redis
+ redis.SetStringKey<User>(us.rediskey, us, TimeSpan.FromSeconds(redis.secondsTimeOut));//鍐欏叆redis
+ }
+ else
+ {
+ redis.KeyDelete(us.rediskey);//鍒犻櫎redis
+ redis.SetStringKey<User>(us.rediskey, us, TimeSpan.FromSeconds(redis.secondsTimeOut));//鍐欏叆redis
+ }
+ //鍐欏叆鏃ュ織
+ LogHelper.DbOperateLog(us.usercode, "寮哄埗涓嬬嚎", "琚己鍒朵笅绾夸簡", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "寮哄埗涓嬬嚎鎴愬姛!";
+ mes.data = null;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鏌ヨ鐧诲綍鑿滃崟]
+ /// <summary>
+ /// 鏌ヨ鐧诲綍鑿滃崟
+ /// </summary>
+ /// <param name="usertype">鎿嶄綔绔被鍨�(PC APP)</param>
+ /// <param name="usercode">鐧诲綍鐢ㄦ埛缂栫爜</param>
+ /// <param name="torg_code">缁勭粐缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "LoginMenu")]
+ [HttpGet]
+ [ChannelActionFilter]
+ public JsonResult LoginMenu(string usertype, string usercode,string torg_code)
+ {
+ try
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = LoginBLL.LoginMenu(usercode, usertype,us);
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ }
+ return Json(mes);
+ }
+ #endregion
+
+ #region[淇敼瀵嗙爜]
+ /// <summary>
+ /// 淇敼瀵嗙爜
+ /// </summary>
+ /// <param name="password">瀵嗙爜</param>
+ /// <param name="newpassword">鏂板瘑鐮�</param>
+ /// <returns></returns>
+ [ChannelActionFilter, Route(template: "UpdateUserPassword")]
+ [HttpPost]
+ public JsonResult UpdateUserPassword(string password, string newpassword)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = LoginBLL.UpdateUserPassword(us, password, newpassword);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐧诲嚭]
+ /// <summary>
+ /// 鐧诲嚭
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "LoginOut")]
+ [HttpPost]
+ [ChannelActionFilter]
+ public JsonResult LoginOut()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = LoginBLL.LoginOut(us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[APP鐢ㄦ埛鐧诲綍]
+ /// <summary>
+ /// APP鐢ㄦ埛鐧诲綍
+ /// </summary>
+ /// <param name="username">鐢ㄦ埛缂栫爜</param>
+ /// <param name="password">瀵嗙爜</param>
+ /// <param name="usertype">鎿嶄綔绔被鍨�(APP)</param>
+ /// <returns></returns>
+ [Route(template: "LoginAppSave")]
+ [HttpGet]
+ public JsonResult LoginAppSave(string username, string password, string usertype)
+ {
+ try
+ {
+ Dictionary<string, object> payLoad = new Dictionary<string, object>();
+ mes = LoginBLL.LoginSearch(username, password);
+ if (mes.code == "200")
+ {
+ List<DataTable> list = (List<DataTable>)mes.data;
+ DataTable dt = list[0];
+ //jwt鐢熸垚Token鍓嶇殑鐢ㄦ埛淇℃伅
+ payLoad.Add("usercode", dt.Rows[0]["usercode"].ToString());
+ payLoad.Add("username", dt.Rows[0]["username"].ToString());
+ payLoad.Add("storg_code", dt.Rows[0]["storg_code"].ToString());
+ payLoad.Add("storg_name", dt.Rows[0]["storg_name"].ToString());
+ payLoad.Add("is_system_admin", dt.Rows[0]["is_system_admin"].ToString());
+ payLoad.Add("role_code", dt.Rows[0]["role_code"].ToString());
+ payLoad.Add("role_datapermissions", dt.Rows[0]["role_datapermissions"].ToString());
+ payLoad.Add("usertype", usertype);
+ payLoad.Add("rediskey", Enterprise + "LoginUserID" + usertype + JwtTools.FindFirstKeyByValue(payLoad, "usercode"));
+ payLoad.Add("mesSetting", list[1].Rows[0]["json"].ToString()); //鑾峰彇绯荤粺娴佺▼閰嶇疆
+ //鑾峰彇jwt鐢熸垚token
+ mes = JwtTools.Encode(payLoad);
+
+ List<User> mss = new List<User>();
+ User ms = new User();
+ ms.usercode = dt.Rows[0]["usercode"].ToString();
+ ms.username = dt.Rows[0]["username"].ToString();
+ ms.storg_code = dt.Rows[0]["storg_code"].ToString();
+ ms.storg_name = dt.Rows[0]["storg_name"].ToString();
+ ms.is_system_admin = dt.Rows[0]["is_system_admin"].ToString();
+ ms.role_code = dt.Rows[0]["role_code"].ToString();
+ ms.role_datapermissions = dt.Rows[0]["role_datapermissions"].ToString();
+ ms.usertype = usertype;
+ ms.rediskey = Enterprise + "LoginUserID" + ms.usertype + ms.usercode;
+ ms.mesSetting = list[1].Rows[0]["json"].ToString();
+ ms.token = mes.data.ToString();
+ mss.Add(ms);
+
+
+ User loginUser = JsonConvert.DeserializeObject<User>(JsonConvert.SerializeObject(ms));
+ //濡傛灉redis鐧诲綍鐢ㄦ埛涓笉瀛樺湪褰撳墠鐢ㄦ埛
+ if (redis.GetStringKey<User>(ms.rediskey) == null)
+ {
+ //鍐欏叆redis(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
+ redis.SetStringKey<User>(ms.rediskey, ms, TimeSpan.FromSeconds(redis.secondsTimeOut));
+ //鍐欏叆鐧诲綍鎿嶄綔璁板綍
+ LogHelper.DbOperateLog(ms.usercode, "鐧诲綍", "鐧诲綍浜嗙郴缁�", ms.usertype);
+ mes.code = "200";
+ mes.message = "鐧诲綍鎴愬姛!";
+ mes.data = ms.token.ToString();
+ }
+ else //濡傛灉瀛樺湪
+ {
+ //鑾峰彇redis涓綋鍓嶇敤鎴蜂俊鎭�
+ User r_loginUser = redis.GetStringKey<User>(ms.rediskey);
+ //濡傛灉session涓殑鐢ㄦ埛usercode鍜宺edis涓殑鐢ㄦ埛usercode鍖归厤
+ if ((r_loginUser.rediskey).Equals(loginUser.rediskey))
+ {
+ redis.KeyDelete(loginUser.rediskey);//鍒犻櫎redis
+ redis.SetStringKey<User>(loginUser.rediskey, ms, TimeSpan.FromSeconds(redis.secondsTimeOut));//鍐欏叆redis
+ }
+ else
+ {
+ //閲嶇疆杩囨湡鏃堕棿(娉ㄦ剰锛歳edis绫婚噷闈㈢殑澶辨晥鏃堕棿蹇呴』鍦╧ey鍒涘缓瀹屾垚涔嬪悗鎵嶇敓鏁�)
+ redis.SetStringKey<User>(loginUser.rediskey, loginUser, TimeSpan.FromSeconds(redis.secondsTimeOut));
+ //鍐欏叆鐧诲綍鎿嶄綔璁板綍
+ LogHelper.DbOperateLog(ms.usercode, "鐧诲綍", "鐧诲綍浜嗙郴缁�", ms.usertype);
+ mes.data = ms;
+ mes.code = "200";
+ mes.message = "鐧诲綍鎴愬姛!";
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ mes.data = null;
+ }
+
+ return Json(mes);
+ }
+ #endregion
+
+ #region[APP瀵嗙爜閲嶇疆]
+ /// <summary>
+ /// APP瀵嗙爜閲嶇疆
+ /// </summary>
+ /// <returns></returns>
+ [ChannelActionFilter, Route(template: "ResettUserPassword")]
+ [HttpPost]
+ public JsonResult ResettUserPassword(string usertype)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = LoginBLL.ResettUserPassword(us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[App鐧诲綍鏌ヨ瀹夌伅鍛煎彨淇℃伅]
+ /// <summary>
+ /// App鐧诲綍鏌ヨ瀹夌伅鍛煎彨淇℃伅
+ /// </summary>
+ /// <param name="rid">鎵嬫満璁惧id(鏋佸厜鐢熸垚)</param>
+ /// <param name="usercode">鐢ㄦ埛缂栫爜</param>
+ /// <param name="username">鐢ㄦ埛鍚嶇О</param>
+ /// <param name="usertype">鎿嶄綔绔疨C/APP</param>
+ /// <param name="stu_torgcode">鎵�灞炵紪鐮佺粍缁�</param>
+ /// <param name="stu_torgtypecode">鎵�灞炵粍缁囩被鍨�</param>
+ /// <returns></returns>
+ [Route(template: "LoginAppAnDonMessage")]
+ [HttpPost]
+ public JsonResult LoginAppAnDonMessage(string rid, string usercode, string username, string usertype, string stu_torgcode, string stu_torgtypecode)
+ {
+ mes = LoginBLL.LoginAppAnDonMessage(rid, usercode, username, usertype, stu_torgcode, stu_torgtypecode);
+ return Json(mes);
+ //return mes.ResponseMess(mes);
+ }
+ #endregion
+
+ #region[App鐗堟湰鍗囩骇鎺ュ彛]
+ /// <summary>
+ /// App鐗堟湰鍗囩骇鎺ュ彛
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "AppUpgrade")]
+ [HttpPost]
+ public JsonResult AppUpgrade()
+ {
+ mes = LoginBLL.AppUpgrade();
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/MouldManagerController.cs b/VueWebCoreApi/Controllers/MouldManagerController.cs
new file mode 100644
index 0000000..bde517c
--- /dev/null
+++ b/VueWebCoreApi/Controllers/MouldManagerController.cs
@@ -0,0 +1,1454 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.MouldVerify;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "妯″叿绠$悊")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class MouldManagerController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[妯″叿娓呭崟鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 妯″叿娓呭崟鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="mouldstaus">妯″叿鐘舵��</param>
+ /// <param name="onstate">浣跨敤鐘舵��</param>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="createuser">鍒涘缓浜哄憳</param>
+ /// <param name="createdate">鍒涘缓鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MouldMangerSearch")]
+ [HttpGet]
+ public JsonResult MouldMangerSearch(string mouldstaus = null, string onstate = null,string mouldcode=null,string mouldname=null,string mouldspec=null,string createuser=null,string createdate=null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (createdate != "" && createdate != null)
+ {
+ opendate = createdate.Split('~')[0].ToString();
+ closedate = createdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldMangerSearch(mouldstaus, onstate, mouldcode, mouldname, mouldspec, createuser, opendate, closedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鏂板缂栬緫]
+ /// <summary>
+ /// 妯″叿娓呭崟鏂板缂栬緫
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateMouldManger")]
+ [HttpPost]
+ public JsonResult AddUpdateMouldManger([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mouldcode = obj["mouldcode"].ToString(); //妯″叿缂栫爜
+ string mouldname = obj["mouldname"].ToString(); //妯″叿鍚嶇О
+ string mouldspec = obj["mouldspec"].ToString(); //妯″叿瑙勬牸
+ string warehousecode = obj["warehousecode"].ToString(); //浠撳簱缂栫爜
+ string location_code = obj["location_code"].ToString(); //搴撲綅缂栫爜
+ string surplife = obj["surplife"].ToString(); //棰勮瀵垮懡
+ string resilife = obj["resilife"].ToString(); //鍓╀綑瀵垮懡
+ string status = obj["status"].ToString(); //妯″叿鐘舵��
+ string mouldpart = obj["mouldpart"].ToString(); //鍏宠仈浜у搧
+ string opertype = obj["opertype"].ToString(); //鎿嶄綔绫诲瀷
+ mes = MouldManagerBLL.AddUpdateMouldManger(mouldcode, mouldname, mouldspec, warehousecode, location_code, surplife, resilife, status, mouldpart, opertype, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鏌ョ湅灞ュ巻]
+ /// <summary>
+ /// 妯″叿娓呭崟鏌ョ湅灞ュ巻
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="createdate">鎿嶄綔鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MoldResumeSearch")]
+ [HttpGet]
+ public JsonResult MoldResumeSearch(string mouldcode, string createdate = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (createdate != "" && createdate != null)
+ {
+ opendate = createdate.Split('~')[0].ToString();
+ closedate = createdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MoldResumeSearch(mouldcode,opendate, closedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鍒犻櫎]
+ /// <summary>
+ /// 妯″叿娓呭崟鍒犻櫎
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteMouldManger")]
+ [HttpPost]
+ public JsonResult DeleteMouldManger(string mouldcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.DeleteMouldManger(mouldcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规椤瑰垪琛ㄦ煡璇
+ /// <summary>
+ /// 妯″叿鐐规椤瑰垪琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="checkitemcode">鐐规閮ㄤ綅缂栫爜</param>
+ /// <param name="checkitemname">鐐规閮ㄤ綅鍚嶇О</param>
+ /// <param name="checkdescr">鐐规瑕佹眰</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MouldCheckItemSearch")]
+ [HttpGet]
+ public JsonResult MouldCheckItemSearch(int page, int rows, string prop, string order, string checkitemcode = null, string checkitemname = null, string checkdescr = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldCheckItemSearch(checkitemcode, checkitemname, checkdescr, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规椤规柊澧炵紪杈慮
+ /// <summary>
+ /// 妯″叿鐐规椤规柊澧炵紪杈�
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateMouldCheckItem")]
+ [HttpPost]
+ public JsonResult AddUpdateMouldCheckItem([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string checkitemid = obj["id"].ToString(); //妯″叿鐐规椤筰d(涓婚敭)
+ string checkitemcode = obj["checkitemcode"].ToString(); //妯″叿鐐规閮ㄤ綅缂栫爜
+ string checkitemname = obj["checkitemname"].ToString(); //妯″叿鐐规閮ㄤ綅鍚嶇О
+ string checkitemdescr = obj["checkitemdescr"].ToString(); //妯″叿鐐规閮ㄤ綅瑕佹眰
+ string opertype = obj["opertype"].ToString(); //鎿嶄綔绫诲瀷
+ mes = MouldManagerBLL.AddUpdateMouldCheckItem(checkitemid, checkitemcode, checkitemname, checkitemdescr, us, opertype);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规椤瑰垹闄
+ /// <summary>
+ /// 妯″叿鐐规椤瑰垹闄�
+ /// </summary>
+ /// <param name="checkitemcode">妯″叿鐐规椤圭洰(閮ㄤ綅)缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteMouldCheckItem")]
+ [HttpPost]
+ public JsonResult DeleteMouldCheckItem(string checkitemcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.DeleteMouldCheckItem(checkitemcode,us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规鏍囧噯鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 妯″叿鐐规鏍囧噯鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="checkstandcode">鐐规鏍囧噯缂栫爜</param>
+ /// <param name="checkstandname">鐐规鏍囧噯鍚嶇О</param>
+ /// <param name="checkstandescr">鏍囧噯瑕佹眰</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DeviceCheckStandArdSearch")]
+ [HttpGet]
+ public JsonResult DeviceCheckStandArdSearch(int page, int rows, string prop, string order, string checkstandcode = null, string checkstandname = null, string checkstandescr = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.DeviceCheckStandArdSearch(checkstandcode, checkstandname, checkstandescr, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ /// <summary>
+ /// 妯″叿鐐规鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁
+ /// </summary>
+ /// <param name="checkstand_code">妯″叿鐐规鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ViewMouldCheckStanedSearch")]
+ [HttpPost]
+ public JsonResult ViewMouldCheckStanedSearch(string checkstand_code)
+ {
+ mes = MouldManagerBLL.ViewMouldCheckStanedSearch(checkstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鏂板缂栬緫]
+ /// <summary>
+ /// 妯″叿鐐规鏍囧噯鏂板缂栬緫
+ /// </summary>
+ /// <param name="opertype">鎿嶄綔绫诲瀷</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateMouldCheckStandArd")]
+ [HttpPost]
+ public JsonResult AddUpdateMouldCheckStandArd(string opertype, RoutEdit json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.AddUpdateMouldCheckStandArd(opertype, json, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鍒犻櫎]
+ /// <summary>
+ /// 妯″叿鐐规鏍囧噯鍒犻櫎
+ /// </summary>
+ /// <param name="checkstand_code">妯″叿鐐规鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteMouldCheckStaned")]
+ [HttpPost]
+ public JsonResult DeleteDeviceCheckStaned(string checkstand_code)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.DeleteMouldCheckStaned(checkstand_code,us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鍏宠仈妯″叿鏌ヨ]
+ /// <summary>
+ /// 妯″叿鐐规鏍囧噯鍏宠仈妯″叿鏌ヨ
+ /// </summary>
+ /// <param name="checkstand_code">妯″叿鐐规鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "CheckStanedAssociationMould")]
+ [HttpGet]
+ public JsonResult CheckStanedAssociationMould(string checkstand_code)
+ {
+ mes = MouldManagerBLL.CheckStanedAssociationMould(checkstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region [妯″叿鐐规鏍囧噯鍏宠仈妯″叿鎻愪氦]
+ /// <summary>
+ /// 妯″叿鐐规鏍囧噯鍏宠仈妯″叿鎻愪氦
+ /// </summary>
+ /// <param name="checkstand_code">妯″叿鐐规鏍囧噯缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SaveCheckStanedAssociationMould")]
+ [HttpPost]
+ public JsonResult SaveCheckStanedAssociationMould(string checkstand_code, List<ObjectData> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.SaveCheckStanedAssociationMould(checkstand_code, us, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇椤瑰垪琛ㄦ煡璇
+ /// <summary>
+ /// 妯″叿淇濆吇椤瑰垪琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="maiitemcode">淇濆吇閮ㄤ綅缂栫爜</param>
+ /// <param name="maiitemname">淇濆吇閮ㄤ綅鍚嶇О</param>
+ /// <param name="maidescr">淇濆吇瑕佹眰</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MouldMaiItemSearch")]
+ [HttpGet]
+ public JsonResult MouldMaiItemSearch(int page, int rows, string prop, string order, string maiitemcode = null, string maiitemname = null, string maidescr = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldMaiItemSearch(maiitemcode, maiitemname, maidescr, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤规柊澧炵紪杈慮
+ /// <summary>
+ /// 妯″叿淇濆吇椤规柊澧炵紪杈�
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateMouldMaiItem")]
+ [HttpPost]
+ public JsonResult AddUpdateMouldMaiItem([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string maiitemid = obj["id"].ToString(); //妯″叿淇濆吇椤筰d(涓婚敭)
+ string maiitemcode = obj["maiitemcode"].ToString(); //妯″叿鐐规閮ㄤ綅缂栫爜
+ string maiitemname = obj["maiitemname"].ToString(); //妯″叿鐐规閮ㄤ綅鍚嶇О
+ string maiitemdescr = obj["maiitemdescr"].ToString(); //妯″叿鐐规閮ㄤ綅瑕佹眰
+ string opertype = obj["opertype"].ToString(); //鎿嶄綔绫诲瀷
+ mes = MouldManagerBLL.AddUpdateMouldMaiItem(maiitemid, maiitemcode, maiitemname, maiitemdescr, us, opertype);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤瑰垹闄
+ /// <summary>
+ /// 妯″叿淇濆吇椤瑰垹闄�
+ /// </summary>
+ /// <param name="maiitemcode">妯″叿淇濆吇椤圭洰(閮ㄤ綅)缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteMouldMaiItem")]
+ [HttpPost]
+ public JsonResult DeleteMouldMaiItem(string maiitemcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.DeleteMouldMaiItem(maiitemcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇鏍囧噯鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 妯″叿淇濆吇鏍囧噯鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="repairstandcode">淇濆吇鏍囧噯缂栫爜</param>
+ /// <param name="repairstandname">淇濆吇鏍囧噯鍚嶇О</param>
+ /// <param name="repairstandescr">淇濆噯瑕佹眰</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MouldRepairStandArdSearch")]
+ [HttpGet]
+ public JsonResult MouldRepairStandArdSearch(int page, int rows, string prop, string order, string repairstandcode = null, string repairstandname = null, string repairstandescr = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldRepairStandArdSearch(repairstandcode, repairstandname, repairstandescr, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ /// <summary>
+ /// 妯″叿淇濆吇鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁
+ /// </summary>
+ /// <param name="repairstand_code">妯″叿淇濆吇鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ViewMouldRepairStanedSearch")]
+ [HttpPost]
+ public JsonResult ViewMouldRepairStanedSearch(string repairstand_code)
+ {
+ mes = MouldManagerBLL.ViewMouldRepairStanedSearch(repairstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯鏂板缂栬緫]
+ /// <summary>
+ /// 妯″叿淇濆吇鏍囧噯鏂板缂栬緫
+ /// </summary>
+ /// <param name="opertype">鎿嶄綔绫诲瀷</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateMouldRepairStandArd")]
+ [HttpPost]
+ public JsonResult AddUpdateMouldRepairStandArd(string opertype, RoutEdit json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.AddUpdateMouldRepairStandArd(opertype, json, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯鍒犻櫎]
+ /// <summary>
+ /// 妯″叿淇濆吇鏍囧噯鍒犻櫎
+ /// </summary>
+ /// <param name="repairstand_code">妯″叿淇濆吇鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteMouldRepairStaned")]
+ [HttpPost]
+ public JsonResult DeleteMouldRepairStaned(string repairstand_code)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.DeleteMouldRepairStaned(repairstand_code, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿鏌ヨ]
+ /// <summary>
+ /// 妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿鏌ヨ
+ /// </summary>
+ /// <param name="repairstand_code">妯″叿淇濆吇鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairStanedAssociationMould")]
+ [HttpGet]
+ public JsonResult RepairStanedAssociationMould(string repairstand_code)
+ {
+ mes = MouldManagerBLL.RepairStanedAssociationMould(repairstand_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region [妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿鎻愪氦]
+ /// <summary>
+ /// 妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿鎻愪氦
+ /// </summary>
+ /// <param name="repairstand_code">妯″叿淇濆吇鏍囧噯缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SaveRepairStanedAssociationMould")]
+ [HttpPost]
+ public JsonResult SaveRepairStanedAssociationMould(string repairstand_code, List<ObjectData> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.SaveRepairStanedAssociationMould(repairstand_code, us, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规,鎵弿妯″叿浜岀淮鐮乚
+ /// <summary>
+ /// 妯″叿鐐规,鎵弿妯″叿浜岀淮鐮�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "CheckScanMouldQrCodeData")]
+ [HttpGet]
+ public JsonResult CheckScanMouldQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.CheckScanMouldQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规,鎵弿妯″叿浜岀淮鐮佹煡鎵剧偣妫�鏍囧噯]
+ /// <summary>
+ /// 妯″叿鐐规,鎵弿妯″叿浜岀淮鐮佹煡鎵剧偣妫�鏍囧噯
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "CheckScanMouldTemp")]
+ [HttpGet]
+ public JsonResult CheckScanMouldTemp(string mouldcode)
+ {
+ mes = MouldManagerBLL.CheckScanMouldTemp(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规,閫夋嫨鎵爜妯″叿銆佺偣妫�鏍囧噯甯﹀嚭鐐规椤筣
+ /// <summary>
+ /// 妯″叿鐐规,閫夋嫨鎵爜妯″叿銆佺偣妫�鏍囧噯甯﹀嚭鐐规椤�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="checktempcode">鐐规鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "SelectScanMouldQrCodeItem")]
+ [HttpGet]
+ public JsonResult SelectScanMouldQrCodeItem(string mouldcode, string checktempcode)
+ {
+ mes = MouldManagerBLL.SelectScanMouldQrCodeItem(mouldcode, checktempcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规銆佹彁浜や繚瀛榏
+ /// <summary>
+ /// 妯″叿鐐规銆佹彁浜や繚瀛�
+ /// </summary>
+ /// <param name="menucode">鍔熻兘缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MouldCheckSave")]
+ [HttpPost]
+ public JsonResult MouldCheckSave(string menucode,AppDevicecCheck json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.MouldCheckSave(menucode,us, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇,鎵弿妯″叿浜岀淮鐮乚
+ /// <summary>
+ /// 妯″叿淇濆吇,鎵弿妯″叿浜岀淮鐮�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairScanMouldQrCodeData")]
+ [HttpGet]
+ public JsonResult RepairScanMouldQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.RepairScanMouldQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,鎵弿妯″叿浜岀淮鐮佹煡鎵句繚鍏绘爣鍑哴
+ /// <summary>
+ /// 妯″叿淇濆吇,鎵弿妯″叿浜岀淮鐮佹煡鎵句繚鍏绘爣鍑�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairScanMouldTemp")]
+ [HttpGet]
+ public JsonResult RepairScanMouldTemp(string mouldcode)
+ {
+ mes = MouldManagerBLL.RepairScanMouldTemp(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,閫夋嫨鎵爜妯″叿鍒楄〃甯﹀嚭淇濆吇椤筣
+ /// <summary>
+ /// 妯″叿淇濆吇,閫夋嫨鎵爜妯″叿鍒楄〃甯﹀嚭淇濆吇椤�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="repartempcode">淇濆吇鏍囧噯缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairSelectScanMouldQrCodeItem")]
+ [HttpGet]
+ public JsonResult RepairSelectScanMouldQrCodeItem(string mouldcode, string repartempcode)
+ {
+ mes = MouldManagerBLL.RepairSelectScanMouldQrCodeItem(mouldcode, repartempcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,鎻愪氦淇濆瓨]
+ /// <summary>
+ /// 妯″叿淇濆吇,鎻愪氦淇濆瓨
+ /// </summary>
+ /// <param name="menucode">鍔熻兘缂栫爜</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MouldRepairSave")]
+ [HttpPost]
+ public JsonResult MouldRepairSave(string menucode, AppDevicecCheck json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = MouldManagerBLL.MouldRepairSave(menucode, us, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿淇℃伅鏌ヨ,鎵弿妯″叿浜岀淮鐮乚
+ /// <summary>
+ /// 妯″叿淇℃伅鏌ヨ,鎵弿妯″叿浜岀淮鐮�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ScanMouldQrCodeMessageData")]
+ [HttpGet]
+ public JsonResult ScanMouldQrCodeMessageData(string mouldcode)
+ {
+ mes = MouldManagerBLL.ScanMouldQrCodeMessageData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇℃伅鏌ヨ鏄庣粏]
+ /// <summary>
+ /// 妯″叿淇℃伅鏌ヨ鏄庣粏
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ScanMouldQrCodeMessageSubData")]
+ [HttpGet]
+ public JsonResult ScanMouldQrCodeMessageSubData(string mouldcode)
+ {
+ mes = MouldManagerBLL.ScanMouldQrCodeMessageSubData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨鐢宠,鎵弿妯″叿浜岀淮鐮乚
+ /// <summary>
+ /// 妯″叿缁翠慨鐢宠,鎵弿妯″叿浜岀淮鐮�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MaintainScanMouldApplyQrCodeData")]
+ [HttpGet]
+ public JsonResult MaintainScanMouldApplyQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.MaintainScanMouldApplyQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨鐢宠,鎻愪氦淇濆瓨]
+ /// <summary>
+ /// 妯″叿缁翠慨鐢宠,鎻愪氦淇濆瓨
+ /// </summary>
+ /// <param name="menucode">鍔熻兘缂栧彿</param>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="faultsourcecode">鏁呴殰鏉ユ簮</param>
+ /// <param name="faultdescr">鏁呴殰鎻忚堪</param>
+ /// <returns></returns>
+ [Route(template: "MaintainScanMouldApplySave")]
+ [HttpPost]
+ public JsonResult MaintainScanMouldApplySave([FromForm] string menucode, [FromForm] string mouldcode,[FromForm] string faultsourcecode,[FromForm] string faultdescr)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ var files = Request.Form.Files; // 鑾峰彇浼犺緭鐨勬枃浠跺垪琛�
+ mes = MouldManagerBLL.MaintainScanMouldApplySave(menucode, mouldcode, faultsourcecode, faultdescr, us, files);
+ mes.message = menucode;
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿寰呯淮淇俊鎭垪琛╙
+ /// <summary>
+ /// 妯″叿寰呯淮淇俊鎭垪琛�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairScanMouldQrCodeDataList")]
+ [HttpGet]
+ public JsonResult RepairScanMouldQrCodeDataList(string mouldcode)
+ {
+ mes = MouldManagerBLL.RepairScanMouldQrCodeDataList(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨鎻愪氦]
+ /// <summary>
+ /// 妯″叿缁翠慨鎻愪氦
+ /// </summary>
+ /// <param name="menucode">鍔熻兘缂栧彿</param>
+ /// <param name="docu_code">缁翠慨鐢宠鍗曞彿</param>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="faultdescr">鏁呴殰鎻忚堪</param>
+ /// <param name="is_stoprepair">涓嬫満缁翠慨</param>
+ /// <param name="repaircontent">缁翠慨鍐呭</param>
+ /// <returns></returns>
+ [Route(template: "RepairScanMouldSave")]
+ [HttpPost]
+ public JsonResult RepairScanMouldSave([FromForm] string menucode, [FromForm] string docu_code, [FromForm] string mouldcode, [FromForm] string faultdescr, [FromForm] string is_stoprepair,[FromForm] string repaircontent)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ var files = Request.Form.Files; // 鑾峰彇浼犺緭鐨勬枃浠跺垪琛�
+ mes = MouldManagerBLL.RepairScanMouldSave(menucode, docu_code, mouldcode, faultdescr, is_stoprepair, repaircontent, us, files);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨寰呴獙璇佸垪琛╙
+ /// <summary>
+ /// 妯″叿缁翠慨寰呴獙璇佸垪琛�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairVerificationScanMouldData")]
+ [HttpGet]
+ public JsonResult RepairVerificationScanMouldData(string mouldcode)
+ {
+ mes = MouldManagerBLL.RepairVerificationScanMouldData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨寰呴獙璇佽鎯呬俊鎭痌
+ /// <summary>
+ /// 妯″叿缁翠慨寰呴獙璇佽鎯呬俊鎭�
+ /// </summary>
+ /// <param name="repair_code">缁翠慨鍗曞彿</param>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "RepairVerificationScanMouldDataSub")]
+ [HttpGet]
+ public JsonResult RepairVerificationScanMouldDataSub(string repair_code, string mouldcode)
+ {
+ mes = MouldManagerBLL.RepairVerificationScanMouldDataSub(repair_code, mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨楠岃瘉鎻愪氦]
+ /// <summary>
+ /// 妯″叿缁翠慨楠岃瘉鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "RepairVerificationScanMouldSave")]
+ [HttpPost]
+ public JsonResult RepairVerificationScanMouldSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string repairwo = obj["repairwo"].ToString(); //缁翠慨鍗曞彿
+ string mouldcode = obj["mouldcode"].ToString(); //妯″叿缂栫爜
+ string result = obj["result"].ToString(); //楠岃瘉缁撴灉
+ string surp_life = obj["surp_life"].ToString(); //缁翠慨鍚庡墿浣欏鍛�
+ mes = MouldManagerBLL.RepairVerificationScanMouldSave(repairwo, mouldcode,result, surp_life,us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿涓婃満,鎵弿妯″叿缂栫爜]
+ /// <summary>
+ /// 妯″叿涓婃満,鎵弿妯″叿缂栫爜
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MouldUpQrCodeData")]
+ [HttpGet]
+ public JsonResult MouldUpQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.MouldUpQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿涓婃満,閫夋嫨鏈笂妯¤澶嘳
+ /// <summary>
+ /// 妯″叿涓婃満,閫夋嫨鏈笂妯¤澶�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "MouldEqpPermissions")]
+ [HttpGet]
+ public JsonResult MouldEqpPermissions()
+ {
+ mes = MouldManagerBLL.MouldEqpPermissions();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿涓婃満鎻愪氦]
+ /// <summary>
+ /// 妯″叿涓婃満鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MouldUpSave")]
+ [HttpPost]
+ public JsonResult MouldUpSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mouldcode = obj["mouldcode"].ToString(); //妯″叿缂栫爜
+ string eqp_code = obj["eqp_code"].ToString(); //璁惧缂栫爜
+ string description = obj["description"].ToString(); //涓婃満鎻忚堪
+ mes = MouldManagerBLL.MouldUpSave(mouldcode, eqp_code, description, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿涓嬫満,鎵弿妯″叿缂栫爜]
+ /// <summary>
+ /// 妯″叿涓嬫満,鎵弿妯″叿缂栫爜
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MouldDownQrCodeData")]
+ [HttpGet]
+ public JsonResult MouldDownQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.MouldDownQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿涓嬫満鎻愪氦]
+ /// <summary>
+ /// 妯″叿涓嬫満鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MouldDownSave")]
+ [HttpPost]
+ public JsonResult MouldDownSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mouldcode = obj["mouldcode"].ToString(); //妯″叿缂栫爜
+ string eqp_code = obj["eqp_code"].ToString(); //璁惧缂栫爜
+ string usecount_life = obj["usecount_life"].ToString(); //鏈浣跨敤瀵垮懡(娆�)
+ string description = obj["description"].ToString(); //涓嬫満鎻忚堪
+ mes = MouldManagerBLL.MouldDownSave(mouldcode, eqp_code, usecount_life, description, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿澶栧��,鎵弿妯″叿缂栫爜]
+ /// <summary>
+ /// 妯″叿澶栧��,鎵弿妯″叿缂栫爜
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MouldLendOutQrCodeData")]
+ [HttpGet]
+ public JsonResult MouldLendOutQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.MouldLendOutQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿澶栧�熸彁浜
+ /// <summary>
+ /// 妯″叿澶栧�熸彁浜�
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MouldLendOutSave")]
+ [HttpPost]
+ public JsonResult MouldLendOutSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mouldcode = obj["mouldcode"].ToString(); //妯″叿缂栫爜
+ string description = obj["description"].ToString(); //澶栧�熸弿杩�
+ mes = MouldManagerBLL.MouldLendOutSave(mouldcode, description, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿褰掕繕,鎵弿妯″叿缂栫爜]
+ /// <summary>
+ /// 妯″叿褰掕繕,鎵弿妯″叿缂栫爜
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MouldReturnQrCodeData")]
+ [HttpGet]
+ public JsonResult MouldReturnQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.MouldReturnQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿褰掕繕鎻愪氦]
+ /// <summary>
+ /// 妯″叿褰掕繕鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MouldReturnSave")]
+ [HttpPost]
+ public JsonResult MouldReturnSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mouldcode = obj["mouldcode"].ToString(); //妯″叿缂栫爜
+ string description = obj["description"].ToString(); //褰掕繕鎻忚堪
+ mes = MouldManagerBLL.MouldReturnSave(mouldcode, description, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿鍏ュ簱,鎵弿妯″叿缂栫爜]
+ /// <summary>
+ /// 妯″叿鍏ュ簱,鎵弿妯″叿缂栫爜
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MouldInWareHouseQrCodeData")]
+ [HttpGet]
+ public JsonResult MouldInWareHouseQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.MouldInWareHouseQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鍏ュ簱鎻愪氦]
+ /// <summary>
+ /// 妯″叿鍏ュ簱鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MouldInWareHouseSave")]
+ [HttpPost]
+ public JsonResult MouldInWareHouseSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mouldcode = obj["mouldcode"].ToString(); //妯″叿缂栫爜
+ string warehousecode = obj["warehousecode"].ToString(); //浠撳簱缂栫爜
+ string locationcode = obj["locationcode"].ToString(); //搴撲綅缂栫爜
+ string description = obj["description"].ToString(); //鍏ュ簱鎻忚堪
+ mes = MouldManagerBLL.MouldInWareHouseSave(mouldcode, warehousecode, locationcode, description, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿鍑哄簱,鎵弿妯″叿缂栫爜]
+ /// <summary>
+ /// 妯″叿鍑哄簱,鎵弿妯″叿缂栫爜
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MouldOutWareHouseQrCodeData")]
+ [HttpGet]
+ public JsonResult MouldOutWareHouseQrCodeData(string mouldcode)
+ {
+ mes = MouldManagerBLL.MouldOutWareHouseQrCodeData(mouldcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鍑哄簱鎻愪氦]
+ /// <summary>
+ /// 妯″叿鍑哄簱鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MouldOutWareHouseSave")]
+ [HttpPost]
+ public JsonResult MouldOutWareHouseSave([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mouldcode = obj["mouldcode"].ToString(); //妯″叿缂栫爜
+ string warehousecode = obj["warehousecode"].ToString(); //浠撳簱缂栫爜
+ string locationcode = obj["locationcode"].ToString(); //搴撲綅缂栫爜
+ string description = obj["description"].ToString(); //鍑哄簱鎻忚堪
+ mes = MouldManagerBLL.MouldOutWareHouseSave(mouldcode, warehousecode, locationcode, description, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规璁板綍鏌ヨ]
+ /// <summary>
+ /// 妯″叿鐐规璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stanedcode">鐐规鏍囧噯缂栫爜</param>
+ /// <param name="stanedname">鐐规鏍囧噯鍚嶇О</param>
+ /// <param name="checkuser">鐐规浜哄憳</param>
+ /// <param name="checkdate">鐐规鏃堕棿</param>
+ /// <param name="checkrequest">鐐规缁撴灉</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MouldCheckTakeSearch")]
+ [HttpGet]
+ public JsonResult MouldCheckTakeSearch(int page, int rows, string prop, string order, string mouldcode = null, string mouldname = null, string mouldspec = null, string stanedcode = null,string stanedname=null, string checkuser = null, string checkdate = null,string checkrequest=null)
+ {
+ string checkopendate = ""; //鐐规寮�濮嬫椂闂�
+ string checkclosedate = ""; //鐐规缁撴潫鏃堕棿
+ if (checkdate != "" && checkdate != null)
+ {
+ checkopendate = checkdate.Split('~')[0].ToString();
+ checkclosedate = checkdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldCheckTakeSearch(mouldcode, mouldname, mouldspec, stanedcode, stanedname, checkuser, checkopendate, checkclosedate, checkrequest, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规璁板綍鏄庣粏鏌ヨ]
+ /// <summary>
+ /// 妯″叿鐐规璁板綍鏄庣粏鏌ヨ
+ /// </summary>
+ /// <param name="id">鐐规璁板綍涓籭d</param>
+ /// <returns></returns>
+ [Route(template: "MouldCheckSubTakeSearch")]
+ [HttpGet]
+ public JsonResult MouldCheckSubTakeSearch(string id)
+ {
+ mes = MouldManagerBLL.MouldCheckSubTakeSearch(id);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鐐规璁板綍瀵煎嚭]
+ /// <summary>
+ /// 妯″叿鐐规璁板綍瀵煎嚭
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stanedcode">鐐规鏍囧噯缂栫爜</param>
+ /// <param name="stanedname">鐐规鏍囧噯鍚嶇О</param>
+ /// <param name="checkuser">鐐规浜哄憳</param>
+ /// <param name="checkdate">鐐规鏃堕棿</param>
+ /// <param name="checkrequest">鐐规缁撴灉</param>
+ /// <returns></returns>
+ [Route(template: "MouldCheckTakeOutExcel")]
+ [HttpGet]
+ public JsonResult MouldCheckTakeOutExcel(string mouldcode = null, string mouldname = null, string mouldspec = null, string stanedcode = null, string stanedname = null, string checkuser = null, string checkdate = null,string checkrequest=null)
+ {
+ string checkopendate = ""; //鐐规寮�濮嬫椂闂�
+ string checkclosedate = ""; //鐐规缁撴潫鏃堕棿
+ if (checkdate != "" && checkdate != null)
+ {
+ checkopendate = checkdate.Split('~')[0].ToString();
+ checkclosedate = checkdate.Split('~')[1].ToString();
+ }
+ mes = MouldManagerBLL.MouldCheckTakeOutExcel(mouldcode, mouldname, mouldspec, stanedcode, stanedname, checkuser, checkopendate, checkclosedate, checkrequest);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇璁板綍鏌ヨ]
+ /// <summary>
+ /// 妯″叿淇濆吇璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stanedcode">淇濆吇鏍囧噯缂栫爜</param>
+ /// <param name="stanedname">淇濆吇鏍囧噯鍚嶇О</param>
+ /// <param name="repairuser">淇濆吇浜哄憳</param>
+ /// <param name="repairdate">淇濆吇鏃堕棿</param>
+ /// <param name="repairresult">淇濆吇缁撴灉</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MouldRepairTakeSearch")]
+ [HttpGet]
+ public JsonResult MouldRepairTakeSearch(int page, int rows, string prop, string order, string mouldcode = null, string mouldname = null, string mouldspec = null,string stanedcode=null, string stanedname = null, string repairuser = null, string repairdate = null, string repairresult = null)
+ {
+ string repairopendate = ""; //鐐规寮�濮嬫椂闂�
+ string repairclosedate = ""; //鐐规缁撴潫鏃堕棿
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldRepairTakeSearch(mouldcode, mouldname, mouldspec, stanedcode,stanedname, repairuser, repairopendate, repairclosedate, repairresult, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇璁板綍鏄庣粏鏌ヨ]
+ /// <summary>
+ /// 妯″叿淇濆吇璁板綍鏄庣粏鏌ヨ
+ /// </summary>
+ /// <param name="id">淇濆吇璁板綍涓昏〃id</param>
+ /// <returns></returns>
+ [Route(template: "MouldRepairSubTakeSearch")]
+ [HttpGet]
+ public JsonResult MouldRepairSubTakeSearch(string id)
+ {
+ mes = MouldManagerBLL.MouldRepairSubTakeSearch(id);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇璁板綍瀵煎嚭]
+ /// <summary>
+ /// 妯″叿淇濆吇璁板綍瀵煎嚭
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stanedcode">淇濆吇鏍囧噯缂栫爜</param>
+ /// <param name="stanedname">淇濆吇鏍囧噯鍚嶇О</param>
+ /// <param name="repairuser">淇濆吇浜哄憳</param>
+ /// <param name="repairdate">淇濆吇鏃堕棿</param>
+ /// <param name="repairresult">淇濆吇缁撴灉</param>
+ /// <returns></returns>
+ [Route(template: "MouldRepairTakeOutExcel")]
+ [HttpGet]
+ public JsonResult MouldRepairTakeOutExcel(string mouldcode = null, string mouldname = null, string mouldspec = null, string stanedcode = null, string stanedname = null, string repairuser = null, string repairdate = null, string repairresult = null)
+ {
+ string repairopendate = ""; //鐐规寮�濮嬫椂闂�
+ string repairclosedate = ""; //鐐规缁撴潫鏃堕棿
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ mes = MouldManagerBLL.MouldRepairTakeOutExcel(mouldcode, mouldname, mouldspec, stanedcode, stanedname, repairuser, repairopendate, repairclosedate, repairresult);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨璁板綍鏌ヨ]
+ /// <summary>
+ /// 妯″叿缁翠慨璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="reportuser">鎶ヤ慨浜哄憳</param>
+ /// <param name="reportdate">鎶ヤ慨鏃堕棿</param>
+ /// <param name="repairuser">缁翠慨浜哄憳</param>
+ /// <param name="repairdate">缁翠慨鏃堕棿</param>
+ /// <param name="vrifcatuser">楠岃瘉浜哄憳</param>
+ /// <param name="vrifcatdate">楠岃瘉鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MouldUpdateSearch")]
+ [HttpGet]
+ public JsonResult MouldUpdateSearch(int page, int rows, string prop, string order, string mouldcode = null, string mouldname = null, string mouldspec = null, string reportuser = null, string reportdate = null, string repairuser = null, string repairdate = null, string vrifcatuser = null, string vrifcatdate = null)
+ {
+ string reportopendate = ""; //鎶ヤ慨寮�濮嬫椂闂�
+ string reportclosedate = ""; //鎶ヤ慨缁撴潫鏃堕棿
+ string repairopendate = ""; //缁翠慨寮�濮嬫椂闂�
+ string repairclosedate = ""; //缁翠慨缁撴潫鏃堕棿
+ string vrifcatopendate = ""; //缁翠慨楠岃瘉寮�濮嬫椂闂�
+ string vrifcatclosedate = ""; //缁翠慨楠岃瘉缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportopendate = reportdate.Split('~')[0].ToString();
+ reportclosedate = reportdate.Split('~')[1].ToString();
+ }
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ if (vrifcatdate != "" && vrifcatdate != null)
+ {
+ vrifcatopendate = vrifcatdate.Split('~')[0].ToString();
+ vrifcatclosedate = vrifcatdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldUpdateSearch(mouldcode, mouldname, mouldspec, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨璁板綍鏄庣粏鏌ヨ]
+ /// <summary>
+ /// 妯″叿缁翠慨璁板綍鏄庣粏鏌ヨ
+ /// </summary>
+ /// <param name="repair_code">妯″叿缁翠慨鍗曞彿</param>
+ /// <returns></returns>
+ [Route(template: "MouldUpdateSubSearch")]
+ [HttpGet]
+ public JsonResult MouldUpdateSubSearch(string repair_code)
+ {
+ mes = MouldManagerBLL.MouldUpdateSubSearch(repair_code);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨璁板綍瀵煎嚭]
+ /// <summary>
+ /// 妯″叿缁翠慨璁板綍瀵煎嚭
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="reportuser">鎶ヤ慨浜哄憳</param>
+ /// <param name="reportdate">鎶ヤ慨鏃堕棿</param>
+ /// <param name="repairuser">缁翠慨浜哄憳</param>
+ /// <param name="repairdate">缁翠慨鏃堕棿</param>
+ /// <param name="vrifcatuser">楠岃瘉浜哄憳</param>
+ /// <param name="vrifcatdate">楠岃瘉鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "MouldUpdateOutExcel")]
+ [HttpGet]
+ public JsonResult MouldUpdateOutExcel(string mouldcode = null, string mouldname = null, string mouldspec = null, string reportuser = null, string reportdate = null, string repairuser = null, string repairdate = null, string vrifcatuser = null, string vrifcatdate = null)
+ {
+ string reportopendate = ""; //鎶ヤ慨寮�濮嬫椂闂�
+ string reportclosedate = ""; //鎶ヤ慨缁撴潫鏃堕棿
+ string repairopendate = ""; //缁翠慨寮�濮嬫椂闂�
+ string repairclosedate = ""; //缁翠慨缁撴潫鏃堕棿
+ string vrifcatopendate = ""; //缁翠慨楠岃瘉寮�濮嬫椂闂�
+ string vrifcatclosedate = ""; //缁翠慨楠岃瘉缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportopendate = reportdate.Split('~')[0].ToString();
+ reportclosedate = reportdate.Split('~')[1].ToString();
+ }
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ if (vrifcatdate != "" && vrifcatdate != null)
+ {
+ vrifcatopendate = vrifcatdate.Split('~')[0].ToString();
+ vrifcatclosedate = vrifcatdate.Split('~')[1].ToString();
+ }
+ mes = MouldManagerBLL.MouldUpdateOutExcel(mouldcode, mouldname, mouldspec, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿涓婁笅鏈鸿褰曟煡璇
+ /// <summary>
+ /// 妯″叿涓婁笅鏈鸿褰曟煡璇�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="type">鎿嶄綔绫诲瀷(涓婃満:UP 涓嬫満:DOWN)</param>
+ /// <param name="devicecode">璁惧缂栫爜</param>
+ /// <param name="operuser">鎿嶄綔浜哄憳</param>
+ /// <param name="operdate">鎿嶄綔鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勬牸</param>
+ /// <returns></returns>
+ [Route(template: "MouldUpDownMachinesSearch")]
+ [HttpGet]
+ public JsonResult MouldUpDownMachinesSearch(int page, int rows, string prop, string order, string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null,string devicecode=null,string operuser=null, string operdate = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (operdate != "" && operdate != null)
+ {
+ opendate = operdate.Split('~')[0].ToString();
+ closedate = operdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldUpDownMachinesSearch(mouldcode, mouldname, mouldspec,type,devicecode,operuser,opendate,closedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿涓婁笅鏈鸿瀵煎嚭]
+ /// <summary>
+ /// 妯″叿涓婁笅鏈鸿瀵煎嚭
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="type">鎿嶄綔绫诲瀷(涓婃満:UP 涓嬫満:DOWN)</param>
+ /// <param name="devicecode">璁惧缂栫爜</param>
+ /// <param name="operuser">鎿嶄綔浜哄憳</param>
+ /// <param name="operdate">鎿嶄綔鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "MouldUpDownMachinesOutExcel")]
+ [HttpGet]
+ public JsonResult MouldUpDownMachinesOutExcel(string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null, string devicecode = null, string operuser = null, string operdate = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (operdate != "" && operdate != null)
+ {
+ opendate = operdate.Split('~')[0].ToString();
+ closedate = operdate.Split('~')[1].ToString();
+ }
+ mes = MouldManagerBLL.MouldUpDownMachinesOutExcel(mouldcode, mouldname, mouldspec, type, devicecode, operuser, opendate, closedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿鍊熻繕璁板綍鏌ヨ]
+ /// <summary>
+ /// 妯″叿鍊熻繕璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="type">鎿嶄綔绫诲瀷</param>
+ /// <param name="operuser">鎿嶄綔浜哄憳</param>
+ /// <param name="operdate">鎿嶄綔鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勬牸</param>
+ /// <returns></returns>
+ [Route(template: "MouldCirculateMachinesSearch")]
+ [HttpGet]
+ public JsonResult MouldCirculateMachinesSearch(int page, int rows, string prop, string order, string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null, string operuser = null, string operdate = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (operdate != "" && operdate != null)
+ {
+ opendate = operdate.Split('~')[0].ToString();
+ closedate = operdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldCirculateMachinesSearch(mouldcode, mouldname, mouldspec, type, operuser, opendate, closedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鍊熻繕璁板綍瀵煎嚭]
+ /// <summary>
+ /// 妯″叿鍊熻繕璁板綍瀵煎嚭
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="type">鎿嶄綔绫诲瀷</param>
+ /// <param name="operuser">鎿嶄綔浜哄憳</param>
+ /// <param name="operdate">鎿嶄綔鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "MouldCirculateMachinesOutExcel")]
+ [HttpGet]
+ public JsonResult MouldCirculateMachinesOutExcel(string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null, string operuser = null, string operdate = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (operdate != "" && operdate != null)
+ {
+ opendate = operdate.Split('~')[0].ToString();
+ closedate = operdate.Split('~')[1].ToString();
+ }
+ mes = MouldManagerBLL.MouldCirculateMachinesOutExcel(mouldcode, mouldname, mouldspec, type, operuser, opendate, closedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[妯″叿鍑哄叆搴撹褰曟煡璇
+ /// <summary>
+ /// 妯″叿鍑哄叆搴撹褰曟煡璇�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="type">鎿嶄綔绫诲瀷(鍏ュ簱:IN 鍑哄簱:OUT)</param>
+ /// <param name="warehousecode">浠撳簱缂栫爜</param>
+ /// <param name="locationcode">搴撲綅缂栫爜</param>
+ /// <param name="operuser">鎿嶄綔浜哄憳</param>
+ /// <param name="operdate">鎿嶄綔鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MouldInOutMachinesSearch")]
+ [HttpGet]
+ public JsonResult MouldInOutMachinesSearch(int page, int rows, string prop, string order, string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null,string warehousecode=null,string locationcode=null, string operuser = null, string operdate = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (operdate != "" && operdate != null)
+ {
+ opendate = operdate.Split('~')[0].ToString();
+ closedate = operdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = MouldManagerBLL.MouldInOutMachinesSearch(mouldcode, mouldname, mouldspec, type, warehousecode,locationcode, operuser, opendate, closedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[妯″叿鍑哄叆搴撹褰曞鍑篯
+ /// <summary>
+ /// 妯″叿鍑哄叆搴撹褰曞鍑�
+ /// </summary>
+ /// <param name="mouldcode">妯″叿缂栫爜</param>
+ /// <param name="mouldname">妯″叿鍚嶇О</param>
+ /// <param name="mouldspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="type">鎿嶄綔绫诲瀷(鍏ュ簱:IN 鍑哄簱:OUT)</param>
+ /// <param name="warehousecode">浠撳簱缂栫爜</param>
+ /// <param name="locationcode">搴撲綅缂栫爜</param>
+ /// <param name="operuser">鎿嶄綔浜哄憳</param>
+ /// <param name="operdate">鎿嶄綔鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "MouldInOutMachinesOutExcel")]
+ [HttpGet]
+ public JsonResult MouldInOutMachinesOutExcel(string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null, string warehousecode = null, string locationcode = null, string operuser = null, string operdate = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (operdate != "" && operdate != null)
+ {
+ opendate = operdate.Split('~')[0].ToString();
+ closedate = operdate.Split('~')[1].ToString();
+ }
+ mes = MouldManagerBLL.MouldInOutMachinesOutExcel(mouldcode, mouldname, mouldspec, type, warehousecode, locationcode, operuser, opendate, closedate);
+ return Json(mes);
+ }
+ #endregion
+
+ }
+}
diff --git a/VueWebCoreApi/Controllers/ProductModelController.cs b/VueWebCoreApi/Controllers/ProductModelController.cs
new file mode 100644
index 0000000..2354d08
--- /dev/null
+++ b/VueWebCoreApi/Controllers/ProductModelController.cs
@@ -0,0 +1,321 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.UnitMaterial;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "鐗╂枡绠$悊")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class ProductModelController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[璁¢噺鍗曚綅缁勪俊鎭痌
+ /// <summary>
+ /// 璁¢噺鍗曚綅缁勪俊鎭�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "TUnitGroup")]
+ [HttpGet]
+ public JsonResult TUnitGroup()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.TUnitGroup();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅淇℃伅鍒楄〃]
+ /// <summary>
+ /// 璁¢噺鍗曚綅淇℃伅鍒楄〃
+ /// </summary>
+ /// <param name="tunittype">鍗曡閲�(S) 澶氳閲�(M)</param>
+ /// <param name="tunitgroupcode">璁¢噺鍗曚綅缁勭紪鐮�</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "TUnitData")]
+ [HttpGet]
+ public JsonResult TUnitData(string tunittype,string tunitgroupcode, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ProductModelBLL.TUnitData(tunittype,tunitgroupcode, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅缂栬緫鑾峰彇缁勬槑缁哴
+ /// <summary>
+ /// 璁¢噺鍗曚綅缂栬緫鑾峰彇缁勬槑缁�
+ /// </summary>
+ /// <param name="unitcode">璁¢噺鍗曚綅缂栫爜</param>
+ /// <param name="isgroup">鏄惁璁¢噺缁�:0(鍚�)1(鏄�)</param>
+ /// <returns></returns>
+ [Route(template: "TUnitGroupProject")]
+ [HttpGet]
+ public JsonResult TUnitGroupProject(string unitcode,string isgroup)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.TUnitGroupProject(unitcode,isgroup,us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅鏂板銆佺紪杈戜繚瀛榏
+ /// <summary>
+ /// 璁¢噺鍗曚綅鏂板銆佺紪杈戜繚瀛�
+ /// </summary>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮:ERP/MES</param>
+ /// <param name="tunittype">鍗曡閲�(S) 澶氳閲�(M)</param>
+ /// <param name="tunitgroupcode">璁¢噺鍗曚綅缁勭紪鐮�</param>
+ /// <param name="OperType">鎿嶄綔绫诲瀷:Add/Update</param>
+ /// <param name="listjson">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateTUnit")]
+ [HttpPost]
+ public JsonResult AddUpdateTUnit(string data_sources, string tunittype,string tunitgroupcode,string OperType, List<Unit> listjson)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ var menucode = HttpContext.Request.Headers["Menucode"].ToString(); //鑿滃崟缂栫爜
+ mes = ProductModelBLL.AddUpdateTUnit(menucode, data_sources,tunittype, tunitgroupcode, OperType, listjson, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅鍒犻櫎]
+ /// <summary>
+ /// 璁¢噺鍗曚綅鍒犻櫎
+ /// </summary>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮:ERP/MES</param>
+ /// <param name="tunittype">鍗曡閲�(S) 澶氳閲�(M)</param>
+ /// <param name="tunitgroupcode">璁¢噺鍗曚綅缁勭紪鐮�</param>
+ /// <param name="tunitcode">璁¢噺鍗曚綅缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteTUnit")]
+ [HttpPost]
+ public JsonResult DeleteTUnit(string data_sources, string tunittype, string tunitgroupcode, string tunitcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.DeleteTUnit(data_sources, tunittype, tunitgroupcode, tunitcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[瀛樿揣鍒嗙被淇℃伅]
+ /// <summary>
+ /// 瀛樿揣鍒嗙被淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "TMaterielClassTree")]
+ [HttpGet]
+ public JsonResult TMaterielClassTree()
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.TMaterielClassTree();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀛樿揣鍒嗙被鏂板/缂栬緫鎻愪氦]
+ /// <summary>
+ /// 瀛樿揣鍒嗙被鏂板/缂栬緫鎻愪氦
+ /// </summary>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮:ERP/MES</param>
+ /// <param name="inventoryclasscode">瀛樿揣鍒嗙被缂栫爜</param>
+ /// <param name="inventoryclassname">瀛樿揣鍒嗙被鍚嶇О</param>
+ /// <param name="parentcode">涓婄骇鍒嗙被缂栫爜</param>
+ /// <param name="OperType">鎿嶄綔绫诲瀷:Add/Update</param>
+ /// <returns></returns>
+ [Route(template: "TMaterielClassTreeAddUpdate")]
+ [HttpPost]
+ public JsonResult TMaterielClassTreeAddUpdate(string data_sources, string inventoryclasscode, string inventoryclassname,string parentcode,string OperType)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.TMaterielClassTreeAddUpdate(data_sources,inventoryclasscode, inventoryclassname, parentcode, OperType, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀛樿揣鍒嗙被鍒犻櫎]
+ /// <summary>
+ /// 瀛樿揣鍒嗙被鍒犻櫎
+ /// </summary>
+ /// <param name="inventoryclasscode">瀛樿揣鍒嗙被缂栫爜瀛椾覆闆�</param>
+ /// <returns></returns>
+ [Route(template: "TMaterielClassTreeDelete")]
+ [HttpPost]
+ public JsonResult TMaterielClassTreeDelete(string inventoryclasscode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.TMaterielClassTreeDelete(inventoryclasscode,us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀛樿揣淇℃伅鍒楄〃]
+ /// <summary>
+ /// 瀛樿揣淇℃伅鍒楄〃
+ /// </summary>
+ /// <param name="inventoryclasscode">瀛樿揣鍒嗙被缂栫爜瀛楃涓查泦</param>
+ /// <param name="partcode">瀛樿揣缂栫爜</param>
+ /// <param name="partname">瀛樿揣鍚嶇О</param>
+ /// <param name="partspec">瀛樿揣瑙勬牸</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "TMaterielData")]
+ [HttpGet]
+ public JsonResult TMaterielData(string inventoryclasscode,string partcode,string partname,string partspec, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ProductModelBLL.TMaterielData(inventoryclasscode, partcode,partname,partspec, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀛樿揣淇℃伅鏂板/缂栬緫淇濆瓨]
+ /// <summary>
+ /// 瀛樿揣淇℃伅鏂板/缂栬緫淇濆瓨
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "TMaterielAddUpdate")]
+ [HttpPost]
+ public JsonResult TMaterielAddUpdate([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string data_sources = obj["data_sources"].ToString(); //鏁版嵁鏉ユ簮:ERP/MES
+ string partcode = obj["partcode"].ToString(); //瀛樿揣缂栫爜
+ string partname = obj["partname"].ToString(); //瀛樿揣鍚嶇О
+ string partspec = obj["partspec"].ToString(); //瑙勬牸鍨嬪彿
+ string inventoryclasscode = obj["inventoryclasscode"].ToString(); //瀛樿揣绫诲瀷缂栫爜
+ string unittypcode = obj["unittypcode"].ToString(); //璁¢噺鏂瑰紡(0:澶氳閲�1:鍗曡閲�)
+ string unitcode = obj["unitcode"].ToString(); //璁¢噺鍗曚綅缂栫爜/璁¢噺鍗曚綅缁勭紪鐮�
+ string unitsubcode = obj["unitsubcode"].ToString(); //璁¢噺鍗曚綅缁勫瓙椤圭紪鐮�
+ string idSubUnitByReport= obj["idSubUnitByReport"].ToString(); //鎶ヨ〃杈呭崟浣嶇紪鐮�
+ string idUnitByStock = obj["idUnitByStock"].ToString(); //搴撳瓨甯哥敤鍗曚綅缂栫爜
+ string idUnitByPurchase = obj["idUnitByPurchase"].ToString(); //閲囪喘甯哥敤鍗曚綅缂栫爜
+ string idUnitBySale = obj["idUnitBySale"].ToString(); //閿�鍞父鐢ㄥ崟浣嶇紪鐮�
+ string idunitbymanufacture= obj["idunitbymanufacture"].ToString(); //鐢熶骇甯哥敤鍗曚綅
+ string isPurchase= obj["isPurchase"].ToString(); //鏄惁澶栬喘锛�0(鍚�)1(鏄�)
+ string isSale = obj["isSale"].ToString(); //鏄惁閿�鍞細0(鍚�)1(鏄�)
+ string isMadeSelf = obj["isMadeSelf"].ToString(); //鏄惁鑷埗锛�0(鍚�)1(鏄�)
+ string isMaterial = obj["isMaterial"].ToString(); //鏄惁鐢熶骇鑰楃敤锛�0(鍚�)1(鏄�)
+ string isMadeRequest = obj["isMadeRequest"].ToString(); //鏄惁濮斿锛�0(鍚�)1(鏄�)
+ string idwarehouse= obj["idwarehouse"].ToString(); //浠撳簱缂栫爜
+ string status=obj["status"].ToString(); //浣跨敤鐘舵�侊細姝e父(0)鍋滅敤(1)
+ string OperType = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = ProductModelBLL.TMaterielAddUpdate(data_sources,partcode,partname,partspec, inventoryclasscode, unittypcode, unitcode, unitsubcode, idSubUnitByReport,
+ idUnitByStock, idUnitByPurchase,idUnitBySale, idunitbymanufacture, isPurchase, isSale, isMadeSelf, isMaterial, isMadeRequest, idwarehouse, status, OperType,us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀛樿揣淇℃伅鍒犻櫎]
+ /// <summary>
+ /// 瀛樿揣淇℃伅鍒犻櫎
+ /// </summary>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮:ERP/MES</param>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "TMaterielDelete")]
+ [HttpPost]
+ public JsonResult TMaterielDelete(string data_sources,string partcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.TMaterielDelete(data_sources, partcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎/宸ュ簭)鏌ヨ]
+ /// <summary>
+ /// 瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎/宸ュ簭)鏌ヨ
+ /// </summary>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "TMaterielFileAssociationRoute")]
+ [HttpGet]
+ public JsonResult TMaterielFileAssociationRoute(string partcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.TMaterielFileAssociationRoute(partcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎鎴栧伐搴�)鎻愪氦]
+ /// <summary>
+ /// 瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎鎴栧伐搴�)鎻愪氦
+ /// </summary>
+ /// <param name="json">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "SaveTMaterielFile")]
+ [HttpPost]
+ public JsonResult SaveTMaterielFile(List<MaterialCraftsSave> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ProductModelBLL.SaveTMaterielFile(us, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[宸ュ崟浜у搧淇℃伅涓嬫媺妗嗘煡璇
+ /// <summary>
+ /// 宸ュ崟浜у搧淇℃伅涓嬫媺妗嗘煡璇�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "PartSelect")]
+ [HttpGet]
+ public JsonResult PartSelect()
+ {
+ try
+ {
+ mes = ProductModelBLL.PartSelect();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ }
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/QualityManagementController.cs b/VueWebCoreApi/Controllers/QualityManagementController.cs
new file mode 100644
index 0000000..4db3704
--- /dev/null
+++ b/VueWebCoreApi/Controllers/QualityManagementController.cs
@@ -0,0 +1,376 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "璐ㄩ噺绠$悊")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class QualityManagementController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[璐ㄩ噺绠$悊,缂洪櫡瀹氫箟鏌ヨ鍒楄〃]
+ /// <summary>
+ /// 璐ㄩ噺绠$悊,缂洪櫡瀹氫箟鏌ヨ鍒楄〃
+ /// </summary>
+ /// <param name="defectcode">缂洪櫡浠g爜</param>
+ /// <param name="defectname">缂洪櫡鍚嶇О</param>
+ /// <param name="defectdescr">缂洪櫡鎻忚堪</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DedectSearch")]
+ [HttpGet]
+ public JsonResult DedectSearch(string defectcode = null, string defectname = null, string defectdescr = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = QualityManagementBLL.DedectSearch(defectcode, defectname, defectdescr, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璐ㄩ噺绠$悊锛岀己闄峰畾涔夋柊澧炪�佺紪杈戞彁浜
+ /// <summary>
+ /// 璐ㄩ噺绠$悊锛岀己闄峰畾涔夋柊澧炪�佺紪杈戞彁浜�
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateDedect")]
+ [HttpPost]
+ public JsonResult AddUpdateDedect([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string defectcode = obj["defectcode"].ToString(); //缂洪櫡浠g爜
+ string defectname = obj["defectname"].ToString(); //缂洪櫡鍚嶇О
+ string defectdescr = obj["defectdescr"].ToString(); //缂洪櫡鎻忚堪
+ string opertype = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = QualityManagementBLL.AddUpdateDedect(defectcode, defectname, defectdescr, opertype, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璐ㄩ噺绠$悊锛岀己闄峰畾涔夊垹闄
+ /// <summary>
+ /// 璐ㄩ噺绠$悊锛岀己闄峰畾涔夊垹闄�
+ /// </summary>
+ /// <param name="defectcode">缂洪櫡浠g爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteDedect")]
+ [HttpPost]
+ public JsonResult DeleteDedect(string defectcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = QualityManagementBLL.DeleteDedect(defectcode,us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠岄」鐩垪琛ㄦ煡璇
+ /// <summary>
+ /// 宸ュ簭妫�楠岄」鐩垪琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="itemcode">妫�楠岄」鐩紪鐮�</param>
+ /// <param name="itemname">妫�楠岄」鐩悕绉�</param>
+ /// <param name="itemdescr">妫�楠岄」鐩弿杩�</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "StepCheckItemSearch")]
+ [HttpGet]
+ public JsonResult StepCheckItemSearch(string itemcode = null, string itemname = null, string itemdescr = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = QualityManagementBLL.StepCheckItemSearch(itemcode, itemname, itemdescr, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岄」鐩柊澧炪�佺紪杈戞彁浜
+ /// <summary>
+ /// 宸ュ簭妫�楠岄」鐩柊澧炪�佺紪杈戞彁浜�
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateStepCheckItem")]
+ [HttpPost]
+ public JsonResult AddUpdateStepCheckItem([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string checkitemcode = obj["checkitemcode"].ToString(); //宸ュ簭妫�楠岄」鐩唬鐮�
+ string checkitemname = obj["checkitemname"].ToString(); //宸ュ簭妫�楠岄」鐩悕绉�
+ string checkitemdescr = obj["checkitemdescr"].ToString(); //宸ュ簭妫�楠岄」鐩弿杩�
+ string opertype = obj["OperType"].ToString(); //鎿嶄綔绫诲瀷
+ mes = QualityManagementBLL.AddUpdateStepCheckItem(checkitemcode, checkitemname, checkitemdescr, opertype, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岄」鐩垹闄
+ /// <summary>
+ /// 宸ュ簭妫�楠岄」鐩垹闄�
+ /// </summary>
+ /// <param name="checkitemcode">妫�楠岄」鐩唬鐮�</param>
+ /// <returns></returns>
+ [Route(template: "DeleteStepCheckItem")]
+ [HttpPost]
+ public JsonResult DeleteStepCheckItem(string checkitemcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = QualityManagementBLL.DeleteStepCheckItem(checkitemcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[宸ュ簭璐ㄦ鏂规鍒楄〃鏌ヨ]
+ /// <summary>
+ /// 宸ュ簭璐ㄦ鏂规鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="qualityinsptcode">璐ㄦ鏂规缂栫爜</param>
+ /// <param name="qualityinsptname">璐ㄦ鏂规鍚嶇О</param>
+ /// <param name="status">鏈夋晥鐘舵��</param>
+ /// <param name="checktype">璐ㄦ绫诲瀷</param>
+ /// <param name="sampltype">鎶芥牱鏂瑰紡</param>
+ /// <param name="suitobject">閫傜敤瀵硅薄</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "QualityInspectionSearch")]
+ [HttpGet]
+ public JsonResult QualityInspectionSearch(string qualityinsptcode = null, string qualityinsptname = null, string status = null, string checktype = null, string sampltype = null, string suitobject = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = QualityManagementBLL.QualityInspectionSearch(qualityinsptcode, qualityinsptname, status, checktype, sampltype, suitobject, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏌ョ湅缂栬緫]
+ /// <summary>
+ /// 宸ュ簭璐ㄦ鏂规鏌ョ湅缂栬緫
+ /// </summary>
+ /// <param name="qualityinsptcode">璐ㄦ鏂规缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "QualityInspectionSeeEdit")]
+ [HttpGet]
+ public JsonResult QualityInspectionSeeEdit(string qualityinsptcode)
+ {
+ mes = QualityManagementBLL.QualityInspectionSeeEdit(qualityinsptcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏂板銆佺紪杈戣幏鍙栨楠岄」鐩笅鎷夊垪琛╙
+ /// <summary>
+ /// 宸ュ簭璐ㄦ鏂规鏂板銆佺紪杈戣幏鍙栨楠岄」鐩笅鎷夊垪琛�
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "QualityStepCheckItemSelect")]
+ [HttpGet]
+ public JsonResult QualityStepCheckItemSelect()
+ {
+ mes = QualityManagementBLL.QualityStepCheckItemSelect();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏂板/缂栬緫鎻愪氦]
+ /// <summary>
+ /// 宸ュ簭璐ㄦ鏂规鏂板/缂栬緫鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "QualityInspectionAddEditSave")]
+ [HttpPost]
+ public JsonResult QualityInspectionAddEditSave([FromBody] JObject obj)
+ {
+ string qualityinsptcode = obj["qualityinsptcode"].ToString(); //璐ㄦ鏂规缂栫爜
+ string qualityinsptname = obj["qualityinsptname"].ToString(); //璐ㄦ鏂规鍚嶇О
+ string status = obj["status"].ToString(); //鏈夋晥鐘舵��
+ string checktype = obj["checktype"].ToString(); //妫�楠岀被鍨�
+ string sampmethod = obj["sampmethod"].ToString(); //鎶芥鏂瑰紡
+ string sampscare = obj["sampscare"].ToString(); //鍥哄畾鎶芥(鏍锋湰鏁�) 姣斾緥鎶芥(鐧惧垎姣�)
+ string suitobject = obj["suitobject"].ToString(); //閫傜敤瀵硅薄
+ string suitpart = obj["suitpart"].ToString(); //閫傜敤鐗╂枡(缂栫爜)鎴栬�呯墿鏂欑被鍨�(缂栫爜)
+ string descr = obj["descr"].ToString(); //妫�楠屾柟妗堟弿杩�
+ string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜(棣栨銆佸贰妫�銆佸畬宸ユ楠�)
+ string checkitem = obj["checkitem"].ToString(); //璐ㄦ鍒楄〃
+ string type = obj["type"].ToString(); //鎿嶄綔绫诲瀷
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = QualityManagementBLL.QualityInspectionAddEditSave(qualityinsptcode, qualityinsptname, status, checktype, sampmethod, sampscare, suitobject, suitpart, descr, stepcode, checkitem, type, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鍒犻櫎]
+ /// <summary>
+ /// 宸ュ簭璐ㄦ鏂规鍒犻櫎
+ /// </summary>
+ /// <param name="qualityinsptcode">璐ㄦ鏂规缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "QualityInspectionDelete")]
+ [HttpPost]
+ public JsonResult QualityInspectionDelete(string qualityinsptcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = QualityManagementBLL.QualityInspectionDelete(qualityinsptcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠屾壂鐮佽幏鍙栦换鍔′俊鎭痌
+ /// <summary>
+ /// 宸ュ簭妫�楠屾壂鐮佽幏鍙栦换鍔′俊鎭�
+ /// </summary>
+ /// <param name="orderstepqrcode">鎵弿宸ュ簭浜岀淮鐮佷俊鎭�</param>
+ /// <param name="checktype">妫�楠屾柟寮廎irstCheck锛堥妫�锛� PatroCheck(宸℃) EndCheck(瀹屽伐妫�)</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepCheckSearch")]
+ [HttpGet]
+ public JsonResult MesOrderStepCheckSearch(string orderstepqrcode, string checktype)
+ {
+ mes = QualityManagementBLL.MesOrderStepCheckSearch(orderstepqrcode, checktype);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠屾牴鎹�夋嫨鐨勬楠屾柟妗堟煡鎵炬楠岄」鐩甝
+ /// <summary>
+ /// 鍏ュ巶妫�楠�,宸ュ簭妫�楠屾牴鎹�夋嫨鐨勬楠屾柟妗堟煡鎵炬楠岄」鐩�
+ /// </summary>
+ /// <param name="checkstandcode">妫�楠屾柟妗堢紪鐮�</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepCheckItemList")]
+ [HttpGet]
+ public JsonResult MesOrderStepCheckItemList(string checkstandcode)
+ {
+ mes = QualityManagementBLL.MesOrderStepCheckItemList(checkstandcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠�,鎻愪氦]
+ /// <summary>
+ /// 宸ュ簭妫�楠�,鎻愪氦
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "SaveMesOrderStepCheckItem")]
+ [HttpPost]
+ public JsonResult SaveMesOrderStepCheckItem([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string wocode = obj["wocode"].ToString(); //宸ュ崟缂栧彿
+ string partcode = obj["partcode"].ToString(); //浜у搧缂栫爜
+ string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜
+ string checkstandcode = obj["checkstandcode"].ToString(); //璐ㄦ鏂规缂栫爜
+ string check_type = obj["check_type"].ToString(); //妫�楠屾柟寮廎irstCheck锛堥妫�锛� PatroCheck(宸℃) EndCheck(瀹屽伐妫�)
+ string sampmethod = obj["sampmethod"].ToString(); //鎶芥鏂瑰紡锛氬浐瀹氭娊妫�(FIXED) 姣斾緥鎶芥(SCARE)
+ string qualitystatus = obj["qualitystatus"].ToString(); //璐ㄩ噺鐘舵��(鍚堟牸銆佷笉鍚堟牸)
+ string labqty = obj["good_qty"].ToString(); //宸ュ簭浠诲姟鍚堟牸鏁伴噺
+ string sampleqty = obj["sampleqty"].ToString(); //鏍锋湰鏁伴噺
+ string goodqty = obj["goodqty"].ToString(); //鍚堟牸鏁伴噺
+ string ngqty = obj["ngqty"].ToString();//涓嶅悎鏍兼暟閲�
+ string checkitemcont = obj["checkitemcont"].ToString(); //妫�楠岄」鐩暟鎹�
+ mes = QualityManagementBLL.SaveMesOrderStepCheckItem(wocode, partcode, stepcode, checkstandcode, check_type, sampmethod, qualitystatus, labqty, sampleqty, goodqty, ngqty, checkitemcont, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠岃褰曞垪琛ㄦ煡璇
+ /// <summary>
+ /// 宸ュ簭妫�楠岃褰曞垪琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partapec">浜у搧鍚嶇О</param>
+ /// <param name="stepname">浜у搧鍚嶇О</param>
+ /// <param name="standname">浜у搧鍚嶇О</param>
+ /// <param name="checktype">妫�楠岀被鍨嬬紪鐮�</param>
+ /// <param name="checkresult">妫�楠岀粨鏋�</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "StepCheckTableSearch")]
+ [HttpGet]
+ public JsonResult StepCheckTableSearch(string wocode = null, string partcode = null, string partname = null, string partapec = null, string stepname = null, string standname = null, string checktype = null, string checkresult = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = QualityManagementBLL.StepCheckTableSearch(wocode, partcode, partname, partapec, stepname, standname, checktype, checkresult, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岃褰曞垪琛ㄦ槑缁嗘煡璇
+ /// <summary>
+ /// 宸ュ簭妫�楠岃褰曞垪琛ㄦ煡璇�
+ /// </summary>
+ /// <param name="id">涓昏〃id</param>
+ /// <returns></returns>
+ [Route(template: "StepCheckTableSubSearch")]
+ [HttpGet]
+ public JsonResult StepCheckTableSubSearch(string id)
+ {
+ mes = QualityManagementBLL.StepCheckTableSubSearch(id);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岃褰曞鍑篯
+ /// <summary>
+ /// 宸ュ簭妫�楠岃褰曞鍑�
+ /// </summary>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partapec">浜у搧鍚嶇О</param>
+ /// <param name="stepname">浜у搧鍚嶇О</param>
+ /// <param name="standname">浜у搧鍚嶇О</param>
+ /// <param name="checktype">妫�楠岀被鍨嬬紪鐮�</param>
+ /// <param name="checkresult">妫�楠岀粨鏋�</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "StepCheckTableOutExcel")]
+ [HttpGet]
+ public JsonResult StepCheckTableOutExcel(string wocode = null, string partcode = null, string partname = null, string partapec = null, string stepname = null, string standname = null, string checktype = null, string checkresult = null, string prop = null, string order = null)
+ {
+ mes = QualityManagementBLL.StepCheckTableOutExcel(wocode, partcode, partname, partapec, stepname, standname, checktype, checkresult, prop, order);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/ReportManagerController.cs b/VueWebCoreApi/Controllers/ReportManagerController.cs
new file mode 100644
index 0000000..1eb168f
--- /dev/null
+++ b/VueWebCoreApi/Controllers/ReportManagerController.cs
@@ -0,0 +1,743 @@
+锘縰sing Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "缁熻鎶ヨ〃")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class ReportManagerController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+
+ #region[鎶ュ伐璁板綍鍒楄〃鏁版嵁鏌ヨ]
+ /// <summary>
+ /// 鎶ュ伐璁板綍鍒楄〃鏁版嵁鏌ヨ
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="wo_code">宸ュ崟缂栧彿</param>
+ /// <param name="partnumber">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">浜у搧瑙勬牸</param>
+ /// <param name="stepname">鎶ュ伐宸ュ簭</param>
+ /// <param name="eqpcode">鎶ュ伐璁惧</param>
+ /// <param name="reportuser">鎶ュ伐浜哄憳</param>
+ /// <param name="reportdate">鎶ュ伐鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepReportSearch")]
+ [HttpGet]
+ public JsonResult MesOrderStepReportSearch(string wkshopcode = null, string wo_code = null, string partnumber = null, string partname = null, string partspec = null, string stepname = null, string eqpcode = null, string reportuser = null, string reportdate = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ string reportdateopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string reportdateclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportdateopendate = reportdate.Split('~')[0].ToString();
+ reportdateclosedate = reportdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.MesOrderStepReportSearch(wkshopcode, wo_code, partnumber, partname, partspec, stepname, eqpcode, reportuser, reportdateopendate, reportdateclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鎶ュ伐璁板綍鍒楄〃鏁版嵁瀵煎嚭]
+ /// <summary>
+ /// 鎶ュ伐璁板綍鍒楄〃鏁版嵁瀵煎嚭
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="wo_code">宸ュ崟缂栧彿</param>
+ /// <param name="partnumber">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">浜у搧瑙勬牸</param>
+ /// <param name="stepname">鎶ュ伐宸ュ簭</param>
+ /// <param name="eqpcode">鎶ュ伐璁惧</param>
+ /// <param name="reportuser">鎶ュ伐浜哄憳</param>
+ /// <param name="reportdate">鎶ュ伐鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepReportExcelSearch")]
+ [HttpGet]
+ public JsonResult MesOrderStepReportExcelSearch(string wkshopcode = null, string wo_code = null, string partnumber = null, string partname = null, string partspec = null, string stepname = null, string eqpcode = null, string reportuser = null, string reportdate = null)
+ {
+ string reportdateopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string reportdateclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportdateopendate = reportdate.Split('~')[0].ToString();
+ reportdateclosedate = reportdate.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.MesOrderStepReportExcelSearch(wkshopcode, wo_code, partnumber, partname, partspec, stepname, eqpcode, reportuser, reportdateopendate, reportdateclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇杩涘害鎶ヨ〃]
+ /// <summary>
+ /// 鐢熶骇杩涘害鎶ヨ〃
+ /// </summary>
+ /// <param name="status">宸ュ崟鐘舵��</param>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="socode">閿�鍞崟鍙�</param>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="lm_date">鍗曟嵁鏃ユ湡</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "ProductionScheduleReportSearch")]
+ [HttpGet]
+ public JsonResult ProductionScheduleReportSearch(int page, int rows, string prop, string order, string status = null,string socode=null, string wocode = null,string wkshopcode=null, string partcode = null, string partname = null, string partspec = null, string lm_date = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (lm_date != "" && lm_date != null)
+ {
+ opendate = lm_date.Split('~')[0].ToString();
+ closedate = lm_date.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.ProductionScheduleReportSearch(status, wkshopcode, socode, wocode,partcode, partname, partspec, opendate, closedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇杩涘害鎶ヨ〃瀵煎嚭]
+ /// <summary>
+ /// 鐢熶骇杩涘害鎶ヨ〃瀵煎嚭
+ /// </summary>
+ /// <param name="status">宸ュ崟鐘舵��</param>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="socode">閿�鍞崟鍙�</param>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="lm_date">鍗曟嵁鏃ユ湡</param>
+ /// <returns></returns>
+ [Route(template: "ProductionScheduleReportExcelSearch")]
+ [HttpGet]
+ public JsonResult ProductionScheduleReportExcelSearch(string status = null, string wkshopcode = null, string socode = null, string wocode = null,string partcode = null, string partname = null, string partspec = null, string lm_date = null)
+ {
+ string opendate = ""; //寮�濮嬫椂闂�
+ string closedate = ""; //缁撴潫鏃堕棿
+ if (lm_date != "" && lm_date != null)
+ {
+ opendate = lm_date.Split('~')[0].ToString();
+ closedate = lm_date.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.ProductionScheduleReportExcelSearch(status, wkshopcode, socode,wocode, partcode, partname, partspec, opendate, closedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ヨ]
+ /// <summary>
+ /// 鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="compute">璁$畻鏂瑰紡(閫愰亾/鏈亾)</param>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="socode">閿�鍞崟鍙�</param>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="groupcode">鐢熶骇鐝粍</param>
+ /// <param name="username">鎿嶄綔浜哄憳</param>
+ /// <param name="operdate">鎿嶄綔鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "GroupSalaryReportSearch")]
+ [HttpGet]
+ public JsonResult GroupSalaryReportSearch(int page, int rows, string prop, string order, string compute,string wkshopcode=null,string socode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, string stepname = null, string groupcode = null, string username = null, string operdate = null)
+ {
+ string operopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string operclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (operdate != "" && operdate != null)
+ {
+ operopendate = operdate.Split('~')[0].ToString();
+ operclosedate = operdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.GroupSalaryReportSearch(compute, wkshopcode, socode, wocode, partcode, partname, partspec, stepname, groupcode, username, operopendate, operclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ョ湅鎶ュ伐浜哄憳]
+ /// <summary>
+ /// 鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ョ湅鎶ュ伐浜哄憳
+ /// </summary>
+ /// <param name="id">鎶ュ伐璁板綍涓昏〃id</param>
+ /// <returns></returns>
+ [Route(template: "GroupSalaryReportSearchUser")]
+ [HttpGet]
+ public JsonResult GroupSalaryReportSearchUser(string id)
+ {
+ mes = ReportManagerBLL.GroupSalaryReportSearchUser(id);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍瀵煎嚭]
+ /// <summary>
+ /// 鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="compute">璁$畻鏂瑰紡(閫愰亾/鏈亾)</param>
+ /// <param name="socode">閿�鍞崟鍙�</param>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="groupcode">鐢熶骇鐝粍</param>
+ /// <param name="username">鎿嶄綔浜哄憳</param>
+ /// <param name="operdate">鎿嶄綔鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "GroupSalaryReportExcelSearch")]
+ [HttpGet]
+ public JsonResult GroupSalaryReportExcelSearch(string compute,string wkshopcode=null, string socode = null, string wocode = null, string partcode = null, string partname = null, string partspec = null, string stepname = null, string groupcode = null, string username = null, string operdate = null)
+ {
+ string operopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string operclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (operdate != "" && operdate != null)
+ {
+ operopendate = operdate.Split('~')[0].ToString();
+ operclosedate = operdate.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.GroupSalaryReportExcelSearch(compute,wkshopcode, socode, wocode, partcode, partname, partspec, stepname, groupcode, username, operopendate, operclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃]
+ /// <summary>
+ /// 浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃
+ /// </summary>
+ /// <param name="compute">璁$畻鏂瑰紡(閫愰亾/鏈亾)</param>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="socode">閿�鍞崟鍙�</param>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepcode">宸ュ簭缂栧彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="reportname">鎶ュ伐浜哄憳</param>
+ /// <param name="reportdate">鎶ュ伐鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "PeopleSalaryReportSearch")]
+ [HttpGet]
+ public JsonResult PeopleSalaryReportSearch(int page, int rows, string prop, string order, string compute,string wkshopcode=null,string socode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null,string stepcode=null, string stepname = null, string reportname = null, string reportdate = null)
+ {
+ string reportopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string reportclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportopendate = reportdate.Split('~')[0].ToString();
+ reportclosedate = reportdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.PeopleSalaryReportSearch(compute, wkshopcode, socode, wocode, partcode, partname, partspec, stepcode, stepname, reportname, reportopendate, reportclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃瀵煎嚭]
+ /// <summary>
+ /// 浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃瀵煎嚭
+ /// </summary>
+ /// <param name="compute">璁$畻鏂瑰紡(閫愰亾/鏈亾)</param>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="socode">閿�鍞崟鍙�</param>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepcode">宸ュ簭缂栧彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="reportname">鎶ュ伐浜哄憳</param>
+ /// <param name="reportdate">鎶ュ伐鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "PeopleSalaryReportExcelSearch")]
+ [HttpGet]
+ public JsonResult PeopleSalaryReportExcelSearch(string compute,string wkshopcode=null,string socode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null,string stepcode=null, string stepname = null, string reportname = null, string reportdate = null)
+ {
+ string reportopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string reportclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportopendate = reportdate.Split('~')[0].ToString();
+ reportclosedate = reportdate.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.PeopleSalaryReportExcelSearch(compute, wkshopcode, socode, wocode, partcode, partname, partspec,stepcode,stepname, reportname, reportopendate, reportclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[濮斿鎶ヨ〃璁板綍鏌ヨ]
+ /// <summary>
+ /// 濮斿鎶ヨ〃璁板綍鏌ヨ
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="suppername">渚涙柟鍚嶇О</param>
+ /// <param name="type">鎿嶄綔绫诲瀷</param>
+ /// <param name="receivdate">鏀舵枡鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "OutSourceReportSearch")]
+ [HttpGet]
+ public JsonResult OutSourceReportSearch(int page, int rows, string prop, string order,string wkshopcode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, string stepname = null, string suppername = null, string type = null, string receivdate = null)
+ {
+ string receivopendate = ""; //鏀舵枡寮�濮嬫椂闂�
+ string receivclosedate = ""; //鏀舵枡缁撴潫鏃堕棿
+ if (receivdate != "" && receivdate != null)
+ {
+ receivopendate = receivdate.Split('~')[0].ToString();
+ receivclosedate = receivdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.OutSourceReportSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, suppername, type, receivopendate, receivclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[濮斿鎶ヨ〃璁板綍瀵煎嚭]
+ /// <summary>
+ /// 濮斿鎶ヨ〃璁板綍瀵煎嚭
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="suppername">渚涙柟鍚嶇О</param>
+ /// <param name="type">鎿嶄綔绫诲瀷</param>
+ /// <param name="receivdate">鏀舵枡鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "OutSourceReportExcelSearch")]
+ [HttpGet]
+ public JsonResult OutSourceReportExcelSearch(string wkshopcode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, string stepname = null, string suppername = null, string type = null, string receivdate = null)
+ {
+ string receivopendate = ""; //鏀舵枡寮�濮嬫椂闂�
+ string receivclosedate = ""; //鏀舵枡缁撴潫鏃堕棿
+ if (receivdate != "" && receivdate != null)
+ {
+ receivopendate = receivdate.Split('~')[0].ToString();
+ receivclosedate = receivdate.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.OutSourceReportExcelSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, suppername, type, receivopendate, receivclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[涓嶈壇鏄庣粏鎶ヨ〃]
+ /// <summary>
+ /// 涓嶈壇鏄庣粏鎶ヨ〃
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="defectcode">缂洪櫡浠g爜</param>
+ /// <param name="defectname">缂洪櫡鍚嶇О</param>
+ /// <param name="reportname">鎶ュ伐浜哄憳</param>
+ /// <param name="reportdate">鎶ュ伐鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DefectDetailsReportSearch")]
+ [HttpGet]
+ public JsonResult DefectDetailsReportSearch(int page, int rows, string prop, string order,string wkshopcode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, string stepname = null, string defectcode = null, string defectname = null, string reportname = null, string reportdate = null)
+ {
+ string reportopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string reportclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportopendate = reportdate.Split('~')[0].ToString();
+ reportclosedate = reportdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.DefectDetailsReportSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, defectcode, defectname, reportname, reportopendate, reportclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[涓嶈壇鏄庣粏鎶ヨ〃瀵煎嚭]
+ /// <summary>
+ /// 涓嶈壇鏄庣粏鎶ヨ〃瀵煎嚭
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="defectcode">缂洪櫡浠g爜</param>
+ /// <param name="defectname">缂洪櫡鍚嶇О</param>
+ /// <param name="reportname">鎶ュ伐浜哄憳</param>
+ /// <param name="reportdate">鎶ュ伐鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "DefectDetailsReportExcelSearch")]
+ [HttpGet]
+ public JsonResult DefectDetailsReportExcelSearch(string wkshopcode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, string stepname = null, string defectcode = null, string defectname = null, string reportname = null, string reportdate = null)
+ {
+ string reportopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string reportclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportopendate = reportdate.Split('~')[0].ToString();
+ reportclosedate = reportdate.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.DefectDetailsReportExcelSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, defectcode, defectname, reportname, reportopendate, reportclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[缁翠慨鏄庣粏鎶ヨ〃]
+ /// <summary>
+ /// 缁翠慨鏄庣粏鎶ヨ〃
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="style">鎿嶄綔绫诲瀷</param>
+ /// <param name="defectname">缂洪櫡鍚嶇О</param>
+ /// <param name="repairname">缁翠慨浜哄憳</param>
+ /// <param name="repairdate">缁翠慨鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MaintenanceDetailsReportSearch")]
+ [HttpGet]
+ public JsonResult MaintenanceDetailsReportSearch(int page, int rows, string prop, string order,string wkshopcode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, string stepname = null, string style = null, string defectname = null, string repairname = null, string repairdate = null)
+ {
+ string repairopendate = ""; //缁翠慨寮�濮嬫椂闂�
+ string repairclosedate = ""; //缁翠慨缁撴潫鏃堕棿
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.MaintenanceDetailsReportSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, style, defectname, repairname, repairopendate, repairclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缁翠慨鏄庣粏鎶ヨ〃瀵煎嚭]
+ /// <summary>
+ /// 缁翠慨鏄庣粏鎶ヨ〃瀵煎嚭
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栧彿</param >
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="stepname">宸ュ簭鍚嶇О</param>
+ /// <param name="style">鎿嶄綔绫诲瀷</param>
+ /// <param name="defectname">缂洪櫡鍚嶇О</param>
+ /// <param name="repairname">缁翠慨浜哄憳</param>
+ /// <param name="repairdate">缁翠慨鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "MaintenanceDetailsReportExcelSearch")]
+ [HttpGet]
+ public JsonResult MaintenanceDetailsReportExcelSearch(string wkshopcode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, string stepname = null, string style = null, string defectname = null, string repairname = null, string repairdate = null)
+ {
+ string repairopendate = ""; //缁翠慨寮�濮嬫椂闂�
+ string repairclosedate = ""; //缁翠慨缁撴潫鏃堕棿
+ if (repairdate != "" && repairdate != null)
+ {
+ repairopendate = repairdate.Split('~')[0].ToString();
+ repairclosedate = repairdate.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.MaintenanceDetailsReportExcelSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, style, defectname, repairname, repairopendate, repairclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[瀹夌伅鎶ヨ〃鏄庣粏]
+ /// <summary>
+ /// 瀹夌伅鎶ヨ〃鏄庣粏
+ /// </summary>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="calltypecode">鍛煎彨绫诲瀷缂栫爜</param>
+ /// <param name="calluser">鍛煎彨浜哄憳</param>
+ /// <param name="calldate">鍛煎彨鏃堕棿</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="eqpname">璁惧鍚嶇О</param>
+ /// <param name="responduser">鍝嶅簲浜哄憳</param>
+ /// <param name="responddate">鍝嶅簲鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "AnDonReportDefinitSearch")]
+ [HttpGet]
+ public JsonResult AnDonReportDefinitSearch(int page, int rows, string prop, string order, string wkshopcode = null, string calltypecode = null, string calluser = null, string calldate = null, string eqpcode = null, string eqpname = null, string responduser = null, string responddate = null)
+ {
+ string callopendate = ""; //鍛煎彨寮�濮嬫椂闂�
+ string callclosedate = ""; //鍛煎彨缁撴潫鏃堕棿
+ string respondopendate = ""; //鍝嶅簲寮�濮嬫椂闂�
+ string respondclosedate = ""; //鍝嶅簲缁撴潫鏃堕棿
+ if (calldate != "" && calldate != null)
+ {
+ callopendate = calldate.Split('~')[0].ToString();
+ callclosedate = calldate.Split('~')[1].ToString();
+ }
+ if (responddate != "" && responddate != null)
+ {
+ respondopendate = responddate.Split('~')[0].ToString();
+ respondclosedate = responddate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.AnDonReportDefinitSearch(wkshopcode, calltypecode, calluser, callopendate, callclosedate, eqpcode, eqpname, responduser, respondopendate, respondclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅鎶ヨ〃鏄庣粏瀵煎嚭]
+ /// <summary>
+ /// 瀹夌伅鎶ヨ〃鏄庣粏瀵煎嚭
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="calltypecode">鍛煎彨绫诲瀷缂栫爜</param>
+ /// <param name="calluser">鍛煎彨浜哄憳</param>
+ /// <param name="calldate">鍛煎彨鏃堕棿</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="eqpname">璁惧鍚嶇О</param>
+ /// <param name="responduser">鍝嶅簲浜哄憳</param>
+ /// <param name="responddate">鍝嶅簲鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "AnDonReportDefinitExcelSearch")]
+ [HttpGet]
+ public JsonResult AnDonReportDefinitExcelSearch(string wkshopcode = null, string calltypecode = null, string calluser = null, string calldate = null, string eqpcode = null, string eqpname = null, string responduser = null, string responddate = null)
+ {
+ string callopendate = ""; //鍛煎彨寮�濮嬫椂闂�
+ string callclosedate = ""; //鍛煎彨缁撴潫鏃堕棿
+ string respondopendate = ""; //鍝嶅簲寮�濮嬫椂闂�
+ string respondclosedate = ""; //鍝嶅簲缁撴潫鏃堕棿
+ if (calldate != "" && calldate != null)
+ {
+ callopendate = calldate.Split('~')[0].ToString();
+ callclosedate = calldate.Split('~')[1].ToString();
+ }
+ if (responddate != "" && responddate != null)
+ {
+ respondopendate = responddate.Split('~')[0].ToString();
+ respondclosedate = responddate.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.AnDonReportDefinitExcelSearch(wkshopcode, calltypecode, calluser, callopendate, callclosedate, eqpcode, eqpname, responduser, respondopendate, respondclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[瀹夌伅鎶ヨ〃姹囨�籡
+ /// <summary>
+ /// 瀹夌伅鎶ヨ〃姹囨��
+ /// </summary>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="calltypecode">鍛煎彨绫诲瀷缂栫爜</param>
+ /// <param name="calldate">鍛煎彨鏃堕棿</param>
+ /// <param name="responddate">鍝嶅簲鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "AnDonReportSumSearch")]
+ [HttpGet]
+ public JsonResult AnDonReportSumSearch(int page, int rows, string prop, string order, string wkshopcode = null, string eqpcode = null, string calltypecode = null, string calldate = null, string responddate = null)
+ {
+ string callopendate = ""; //鍛煎彨寮�濮嬫椂闂�
+ string callclosedate = ""; //鍛煎彨缁撴潫鏃堕棿
+ string respondopendate = ""; //鍝嶅簲寮�濮嬫椂闂�
+ string respondclosedate = ""; //鍝嶅簲缁撴潫鏃堕棿
+ if (calldate != "" && calldate != null)
+ {
+ callopendate = calldate.Split('~')[0].ToString();
+ callclosedate = calldate.Split('~')[1].ToString();
+ }
+ if (responddate != "" && responddate != null)
+ {
+ respondopendate = responddate.Split('~')[0].ToString();
+ respondclosedate = responddate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.AnDonReportSumSearch(wkshopcode, eqpcode, calltypecode, callopendate, callclosedate, respondopendate, respondclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[瀹夌伅鎶ヨ〃姹囨�诲鍑篯
+ /// <summary>
+ /// 瀹夌伅鎶ヨ〃姹囨�诲鍑�
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="calltypecode">鍛煎彨绫诲瀷缂栫爜</param>
+ /// <param name="calldate">鍛煎彨鏃堕棿</param>
+ /// <param name="responddate">鍝嶅簲鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "AnDonReportSumExcelSearch")]
+ [HttpGet]
+ public JsonResult AnDonReportSumExcelSearch(string wkshopcode = null, string eqpcode = null, string calltypecode = null, string calldate = null, string responddate = null)
+ {
+ string callopendate = ""; //鍛煎彨寮�濮嬫椂闂�
+ string callclosedate = ""; //鍛煎彨缁撴潫鏃堕棿
+ string respondopendate = ""; //鍝嶅簲寮�濮嬫椂闂�
+ string respondclosedate = ""; //鍝嶅簲缁撴潫鏃堕棿
+ if (calldate != "" && calldate != null)
+ {
+ callopendate = calldate.Split('~')[0].ToString();
+ callclosedate = calldate.Split('~')[1].ToString();
+ }
+ if (responddate != "" && responddate != null)
+ {
+ respondopendate = responddate.Split('~')[0].ToString();
+ respondclosedate = responddate.Split('~')[1].ToString();
+ }
+ mes = ReportManagerBLL.AnDonReportSumExcelSearch(wkshopcode, eqpcode, calltypecode, callopendate, callclosedate, respondopendate, respondclosedate);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[T+鍏ュ簱璁板綍琛ㄥご]
+ /// <summary>
+ /// T+鍏ュ簱璁板綍琛ㄥご
+ /// </summary>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <param name="hbillno">鍏ュ簱鍗曞彿</param>
+ /// <param name="hbdate">鍗曟嵁鏃ユ湡</param>
+ /// <param name="username">鎿嶄綔浜哄憳</param>
+ /// <param name="userdate">鎿嶄綔鏃堕棿</param>
+ /// <returns></returns>
+ [Route(template: "InStorageRecordMainSearch")]
+ [HttpGet]
+ public JsonResult InStorageRecordMainSearch(int page, int rows, string prop, string order, string hbillno = null, string hbdate = null, string username = null, string userdate = null)
+ {
+ string hbdateopendate = ""; //鍗曟嵁寮�濮嬫椂闂�
+ string hbdateclosedate = ""; //鍗曟嵁缁撴潫鏃堕棿
+ string userdateopendate = ""; //鎿嶄綔寮�濮嬫椂闂�
+ string userdateclosedate = ""; //鎿嶄綔缁撴潫鏃堕棿
+ if (hbdate != "" && hbdate != null)
+ {
+ hbdateopendate = hbdate.Split('~')[0].ToString();
+ hbdateclosedate = hbdate.Split('~')[1].ToString();
+ }
+ if (userdate != "" && userdate != null)
+ {
+ userdateopendate = userdate.Split('~')[0].ToString();
+ userdateclosedate = userdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = ReportManagerBLL.InStorageRecordMainSearch(hbillno, username, hbdateopendate, hbdateclosedate, userdateopendate, userdateclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[T+鍏ュ簱璁板綍琛ㄤ綋]
+ /// <summary>
+ /// T+鍏ュ簱璁板綍琛ㄤ綋
+ /// </summary>
+ /// <param name="hbillno">鍏ュ簱鍗曞彿</param>
+ /// <returns></returns>
+ [Route(template: "InStorageRecordSubSearch")]
+ [HttpGet]
+ public JsonResult InStorageRecordSubSearch(string hbillno = null)
+ {
+ mes = ReportManagerBLL.InStorageRecordSubSearch(hbillno);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[T+鍏ュ簱璁板綍鍒犻櫎]
+ /// <summary>
+ /// T+鍏ュ簱璁板綍鍒犻櫎
+ /// </summary>
+ /// <param name="dt">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "DeleteInStorageRecord")]
+ [HttpPost]
+ public JsonResult DeleteInStorageRecord(DataTable dt)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ //var token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyY29kZSI6Ijk5OTkiLCJ1c2VybmFtZSI6Iuezu-e7n-euoeeQhuWRmCIsInN0b3JnX2NvZGUiOiIiLCJzdG9yZ19uYW1lIjoiIiwiaXNfc3lzdGVtX2FkbWluIjoiWSIsInJvbGVfY29kZSI6IiIsInJvbGVfZGF0YXBlcm1pc3Npb25zIjoiIiwidXNlcnR5cGUiOiJQQyIsInJlZGlza2V5IjoiTmV3TUVTTG9naW5Vc2VySURQQzk5OTkiLCJtZXNTZXR0aW5nIjoie1wicm91dGVcIjp0cnVlLFwiaXNPcmRlclwiOnRydWUsXCJkZXZpY2VcIjp0cnVlLFwidGVjaFwiOnRydWUsXCJ3b3JrT3JkZXJcIjp0cnVlLFwiZXZlcnlcIjpmYWxzZSxcImxhc3RcIjpmYWxzZX0iLCJ0aW1lb3V0IjoiMjAyNC0xMC0yNFQxMjozNTo1MC4zNDI1NzE2KzA4OjAwIn0.Nbc-1sXd4QLLsnj8wH9XC7iWEmP0wDG82gwLxIh94e4";
+ User us = JwtTools.Denocode(token.ToString());
+ mes = ReportManagerBLL.DeleteInStorageRecord(dt, us);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/SopManageMentController.cs b/VueWebCoreApi/Controllers/SopManageMentController.cs
new file mode 100644
index 0000000..d3a3985
--- /dev/null
+++ b/VueWebCoreApi/Controllers/SopManageMentController.cs
@@ -0,0 +1,256 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "SOP绠$悊")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class SopManageMentController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[绯荤粺璁剧疆,璁惧SOP鏌ヨ]
+ /// <summary>
+ /// 绯荤粺璁剧疆,璁惧SOP鏌ヨ
+ /// </summary>
+ /// <param name="search">鎼滅储鍏抽敭瀛�</param>
+ /// <param name="check">鏄惁閫変腑鏈�楂樼増鏈�</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "DeviceSopSearch")]
+ [HttpGet]
+ public JsonResult DeviceSopSearch(string search = null, string check = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = SopManageMentBLL.DeviceSopSearch(search, check, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,璁惧SOP鏂板]
+ /// <summary>
+ /// 绯荤粺璁剧疆,璁惧SOP鏂板
+ /// </summary>
+ /// <param name="eqptypecode">璁惧绫诲瀷缂栫爜</param>
+ /// <param name="device">璁惧闆嗗悎瀛楃涓�</param>
+ /// <param name="filename">鏂囦欢鍚嶇О</param>
+ /// <param name="filetypecode">鏂囦欢绫诲瀷缂栫爜</param>
+ /// <param name="file">涓婁紶鏂囦欢</param>
+ /// <returns></returns>
+ [Route(template: "DeviceSopAddSeave")]
+ [HttpPost]
+ public JsonResult DeviceSopAddSeave([FromForm] string eqptypecode, [FromForm] string device, [FromForm] string filename, [FromForm] string filetypecode, IFormFile file)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SopManageMentBLL.DeviceSopAddSeave(eqptypecode, device, filename, filetypecode, file, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,璁惧SOP鍒犻櫎]
+ /// <summary>
+ /// 绯荤粺璁剧疆,璁惧SOP鍒犻櫎
+ /// </summary>
+ /// <param name="id">鏁版嵁id</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="filepath">鏂囦欢璺緞</param>
+ /// <returns></returns>
+ [Route(template: "DeviceSopDeleteSeave")]
+ [HttpPost]
+ public JsonResult DeviceSopDeleteSeave(string id, string eqpcode, string filepath)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SopManageMentBLL.DeviceSopDeleteSeave(id, eqpcode, filepath, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鏌ヨ]
+ /// <summary>
+ /// 绯荤粺璁剧疆,宸ヨ壓SOP鏌ヨ
+ /// </summary>
+ /// <param name="search">鎼滅储鍏抽敭瀛�</param>
+ /// <param name="check">鏄惁閫変腑鏈�楂樼増鏈�</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "ProcessSopSearch")]
+ [HttpGet]
+ public JsonResult ProcessSopSearch(string search = null, string check = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = SopManageMentBLL.ProcessSopSearch(search, check, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP涓婁紶鑾峰彇鏈�澶х増鏈彿]
+ /// <summary>
+ /// 绯荤粺璁剧疆,宸ヨ壓SOP涓婁紶鑾峰彇鏈�澶х増鏈彿
+ /// </summary>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <param name="filetypecode">鏂囦欢绫诲瀷缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ProcessSopMaxVersion")]
+ [HttpGet]
+ public JsonResult ProcessSopMaxVersion(string partcode, string routecode, string stepcode,string filetypecode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SopManageMentBLL.ProcessSopMaxVersion(partcode, routecode, stepcode,filetypecode,us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鏂板]
+ /// <summary>
+ /// 绯荤粺璁剧疆,宸ヨ壓SOP鏂板
+ /// </summary>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <param name="filename">鏂囦欢鍚嶇О</param>
+ /// <param name="filetypecode">鏂囦欢绫诲瀷缂栫爜</param>
+ /// <param name="file">涓婁紶鏂囦欢</param>
+ /// <param name="version">鐗堟湰鍙�</param>
+ /// <returns></returns>
+ [Route(template: "ProcessSopAddSeave")]
+ [HttpPost]
+ public JsonResult ProcessSopAddSeave([FromForm] string partcode, [FromForm] string routecode, [FromForm] string stepcode, [FromForm] string filename, [FromForm] string filetypecode, [FromForm] string version, IFormFile file)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SopManageMentBLL.ProcessSopAddSeave(partcode, routecode, stepcode, filename, filetypecode, version, file, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鍒犻櫎]
+ /// <summary>
+ /// 绯荤粺璁剧疆,宸ヨ壓SOP鍒犻櫎
+ /// </summary>
+ /// <param name="id">鏁版嵁id</param>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <param name="filepath">鏂囦欢璺緞</param>
+ /// <returns></returns>
+ [Route(template: "ProcessSopDeleteSeave")]
+ [HttpPost]
+ public JsonResult ProcessSopDeleteSeave(string id, string partcode,string routecode,string stepcode, string filepath)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SopManageMentBLL.ProcessSopDeleteSeave(id, partcode, routecode, stepcode, filepath, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鏌ヨ]
+ /// <summary>
+ /// 绯荤粺璁剧疆,宸ュ崟SOP鏌ヨ
+ /// </summary>
+ /// <param name="search">鎼滅储鍏抽敭瀛�</param>
+ /// <param name="check">鏄惁閫変腑鏈�楂樼増鏈�</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "WrkOrderSearch")]
+ [HttpGet]
+ public JsonResult WrkOrderSearch(string search = null, string check = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = SopManageMentBLL.WrkOrderSearch(search, check, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP涓婁紶鑾峰彇鏈�澶х増鏈彿]
+ /// <summary>
+ /// 绯荤粺璁剧疆,宸ュ崟SOP涓婁紶鑾峰彇鏈�澶х増鏈彿
+ /// </summary>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="filetypecode">鏂囦欢绫诲瀷缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "WrkOrderSopMaxVersion")]
+ [HttpGet]
+ public JsonResult WrkOrderSopMaxVersion(string wocode, string partcode, string filetypecode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SopManageMentBLL.WrkOrderSopMaxVersion(wocode, partcode, filetypecode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鏂板]
+ /// <summary>
+ /// 绯荤粺璁剧疆,宸ュ崟SOP鏂板
+ /// </summary>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="filename">鏂囦欢鍚嶇О</param>
+ /// <param name="filetypecode">鏂囦欢绫诲瀷缂栫爜</param>
+ /// <param name="file">涓婁紶鏂囦欢</param>
+ /// <param name="version">鐗堟湰鍙�</param>
+ /// <returns></returns>
+ [Route(template: "WrkOrderSopAddSeave")]
+ [HttpPost]
+ public JsonResult WrkOrderSopAddSeave([FromForm] string wocode, [FromForm] string partcode, [FromForm] string filename, [FromForm] string filetypecode, [FromForm] string version, IFormFile file)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SopManageMentBLL.WrkOrderSopAddSeave(wocode, partcode, filename, filetypecode, version, file, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鍒犻櫎]
+ /// <summary>
+ /// 绯荤粺璁剧疆,宸ュ崟SOP鍒犻櫎
+ /// </summary>
+ /// <param name="id">鏁版嵁id</param>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="filepath">鏂囦欢璺緞</param>
+ /// <returns></returns>
+ [Route(template: "WrkOrderSopDeleteSeave")]
+ [HttpPost]
+ public JsonResult WrkOrderSopDeleteSeave(string id, string wocode, string partcode, string filepath)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SopManageMentBLL.WrkOrderSopDeleteSeave(id, wocode, partcode, filepath, us);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Controllers/SystemSettingController.cs b/VueWebCoreApi/Controllers/SystemSettingController.cs
new file mode 100644
index 0000000..444dcb9
--- /dev/null
+++ b/VueWebCoreApi/Controllers/SystemSettingController.cs
@@ -0,0 +1,185 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "绯荤粺璁剧疆")]
+ [ApiController]
+ [Route("api/[controller]")]
+ [ChannelActionFilter]
+ public class SystemSettingController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[缂栫爜瑙勫垯鑾峰彇鍙缃殑鍔熻兘鑿滃崟淇℃伅]
+ /// <summary>
+ /// 缂栫爜瑙勫垯鑾峰彇鍙缃殑鍔熻兘鑿滃崟淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "CodeMenuSelect")]
+ [HttpGet]
+ public JsonResult CodeMenuSelect()
+ {
+ mes = SystemSettingBLL.CodeMenuSelect();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯鏌ヨ]
+ /// <summary>
+ /// 缂栫爜瑙勫垯鏌ヨ
+ /// </summary>
+ /// <param name="rightname">缂栫爜鍚嶇О</param>
+ /// <param name="prefix">鍥哄畾瀛楃</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "EncodingRules")]
+ [HttpGet]
+ public JsonResult EncodingRules(string rightname = null, string prefix = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = SystemSettingBLL.EncodingRules(rightname, prefix, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯缂栬緫淇濆瓨]
+ /// <summary>
+ /// 缂栫爜瑙勫垯缂栬緫淇濆瓨
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁瀵硅薄</param>
+ /// <returns></returns>
+ [Route(template: "SaveEncodingRules")]
+ [HttpPost]
+ public JsonResult SaveEncodingRules([FromBody] JObject obj)
+ {
+ string rightcode = obj["rightcode"].ToString(); //鍔熻兘缂栫爜
+ string rightname = obj["rightname"].ToString(); //鍔熻兘鍚嶇О
+ string prefix = obj["prefix"].ToString(); //鍥哄畾瀛楃
+ string filingdate = obj["filingdate"].ToString(); //鎻愪氦鏃ユ湡
+ string incbit = obj["incbit"].ToString(); //鑷浣嶆暟
+ string type = obj["type"].ToString(); //鎿嶄綔绔被鍨�:PC/APP
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SystemSettingBLL.SaveEncodingRules(rightcode, rightname, prefix, filingdate, incbit, type, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯鍒犻櫎]
+ /// <summary>
+ /// 缂栫爜瑙勫垯鍒犻櫎
+ /// </summary>
+ /// <param name="menucode">鍔熻兘缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "DeleteEncodingRules")]
+ [HttpPost]
+ public JsonResult DeleteEncodingRules(string menucode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SystemSettingBLL.DeleteEncodingRules(menucode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�(姣忔鑾峰彇鏈�鏂�)]
+ /// <summary>
+ /// 鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�(姣忔鑾峰彇鏈�鏂�)
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "NewEncodingRules")]
+ [HttpGet]
+ public JsonResult NewEncodingRules(string rightcode)
+ {
+ mes = SystemSettingBLL.NewEncodingRules(rightcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�(鍙湁浣跨敤鎵嶈幏鍙栨渶鏂�)]
+ /// <summary>
+ /// 鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�(鍙湁浣跨敤鎵嶈幏鍙栨渶鏂�)
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "OnlyEncodingRules")]
+ [HttpGet]
+ public JsonResult OnlyEncodingRules(string rightcode)
+ {
+ mes = SystemSettingBLL.OnlyEncodingRules(rightcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鍥炲啓瑙勫垯鐢熸垚鐨勭紪鐮�(浣跨敤淇濆瓨)]
+ /// <summary>
+ /// 鍥炲啓瑙勫垯鐢熸垚鐨勭紪鐮�(浣跨敤淇濆瓨)
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <param name="incbit">娴佹按鍙�</param>
+ /// <returns></returns>
+ [Route(template: "SaveOnlyEncodingRules")]
+ [HttpPost]
+ public JsonResult SaveOnlyEncodingRules(string rightcode,string incbit)
+ {
+ mes = SystemSettingBLL.SaveOnlyEncodingRules(rightcode, incbit);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熸垚绯荤粺鏉$爜(鑷畾涔�),鐢熸垚鐗╂枡鏍囩鏉$爜(姣忔鑾峰彇鏈�鏂�,App鍙娇鐢�)]
+ /// <summary>
+ /// 鐢熸垚绯荤粺鏉$爜(鑷畾涔�),鐢熸垚鐗╂枡鏍囩鏉$爜(姣忔鑾峰彇鏈�鏂�,App鍙娇鐢�)
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="qty">鏁伴噺</param>
+ /// <param name="onelabqty">鍗曟爣绛炬暟閲�</param>
+ /// <returns></returns>
+ [Route(template: "LabelBarCode")]
+ [HttpGet]
+ public JsonResult LabelBarCode(string rightcode, string partcode, string qty, string onelabqty)
+ {
+ mes = SystemSettingBLL.LabelBarCode(rightcode, partcode, qty, onelabqty);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[绯荤粺璁剧疆,娴佺▼璁剧疆鎻愪氦]
+ /// <summary>
+ /// 绯荤粺璁剧疆,娴佺▼璁剧疆鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SaveSystemProcConfig")]
+ [HttpPost]
+ public JsonResult SaveSystemProcConfig([FromBody] JObject obj)
+ {
+ // 鑾峰彇 mesSetting 瀵硅薄
+ JObject systemjson = (JObject)obj["mesSetting"];
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = SystemSettingBLL.SaveSystemProcConfig(systemjson, us);
+ return Json(mes);
+ }
+ #endregion
+
+ }
+}
diff --git a/VueWebCoreApi/Controllers/TaskBackGroundController.cs b/VueWebCoreApi/Controllers/TaskBackGroundController.cs
new file mode 100644
index 0000000..e256430
--- /dev/null
+++ b/VueWebCoreApi/Controllers/TaskBackGroundController.cs
@@ -0,0 +1,137 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Quartz;
+using Quartz.Spi;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Extensions;
+using VueWebCoreApi.Quartz;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "鍛ㄦ湡浠诲姟")]
+ [ApiController]
+ [Route("api/[controller]")]
+ public class TaskBackGroundController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ private readonly ISchedulerFactory _schedulerFactory;
+ private readonly IJobFactory _jobFactory;
+ public TaskBackGroundController(ISchedulerFactory schedulerFactory, IJobFactory jobFactory)
+ {
+ this._jobFactory = jobFactory;
+ this._schedulerFactory = schedulerFactory;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鎵�鏈夌殑浣滀笟
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "GetJobs")]
+ [HttpGet]
+ public async Task<IActionResult> GetJobs()
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛锛�";
+ mes.data = await _schedulerFactory.GetJobs();
+ return Json(mes);
+ }
+
+ /// <summary>
+ /// 鑾峰彇浣滀笟杩愯鏃ュ織
+ /// </summary>
+ /// <param name="taskName"></param>
+ /// <param name="groupName"></param>
+ /// <param name="page"></param>
+ /// <returns></returns>
+ [Route(template: "GetRunLog")]
+ [HttpGet]
+ public IActionResult GetRunLog(string taskName, string groupName, int page = 1)
+ {
+ mes.code = "200";
+ mes.data = FileQuartz.GetJobRunLog(taskName, groupName, page);
+ return Json(mes);
+ }
+
+ /// <summary>
+ /// 娣诲姞浠诲姟
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ [Route(template: "Add")]
+ [HttpPost]
+ //[TaskAuthor]
+ public async Task<IActionResult> Add(TaskOptions taskOptions)
+ {
+ return Json(await taskOptions.AddJob(_schedulerFactory, jobFactory: _jobFactory));
+ }
+
+ /// <summary>
+ /// 鍒犻櫎浠诲姟
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ [Route(template: "Remove")]
+ [HttpPost]
+ //[TaskAuthor]
+ public async Task<IActionResult> Remove(TaskOptions taskOptions)
+ {
+ return Json(await _schedulerFactory.Remove(taskOptions));
+ }
+
+ /// <summary>
+ /// 淇敼浠诲姟
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ [Route(template: "Update")]
+ [HttpPost]
+ //[TaskAuthor]
+ public async Task<IActionResult> Update(TaskOptions taskOptions)
+ {
+ return Json(await _schedulerFactory.Update(taskOptions));
+ }
+
+ /// <summary>
+ /// 鏆傚仠浠诲姟
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ [Route(template: "Pause")]
+ [HttpPost]
+ //[TaskAuthor]
+ public async Task<IActionResult> Pause(TaskOptions taskOptions)
+ {
+ return Json(await _schedulerFactory.Pause(taskOptions));
+ }
+
+ /// <summary>
+ /// 寮�鍚换鍔�
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ [Route(template: "Start")]
+ [HttpPost]
+ //[TaskAuthor]
+ public async Task<IActionResult> Start(TaskOptions taskOptions)
+ {
+ return Json(await _schedulerFactory.Start(taskOptions));
+ }
+
+ /// <summary>
+ /// 绔嬪嵆鎵ц
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ [Route(template: "Run")]
+ [HttpPost]
+ //[TaskAuthor]
+ public async Task<IActionResult> Run(TaskOptions taskOptions)
+ {
+ return Json(await _schedulerFactory.Run(taskOptions));
+ }
+ }
+}
diff --git a/VueWebCoreApi/Controllers/WorkOrderController.cs b/VueWebCoreApi/Controllers/WorkOrderController.cs
new file mode 100644
index 0000000..411d8fc
--- /dev/null
+++ b/VueWebCoreApi/Controllers/WorkOrderController.cs
@@ -0,0 +1,904 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.ErpOrder;
+using VueWebCoreApi.Models.InventoryModel;
+using VueWebCoreApi.Models.ReportVerify;
+using VueWebCoreApi.Models.UpdateReport;
+using VueWebCoreApi.Models.WorkData;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Controllers
+{
+ [ApiExplorerSettings(GroupName = "宸ュ崟绠$悊")]
+ [ApiController]
+ [Route("api/[controller]")]
+ //[ChannelActionFilter]
+ public class WorkOrderController : Controller
+ {
+ //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ #region[ERP璁㈠崟鏌ヨ]
+ /// <summary>
+ /// ERP璁㈠崟鏌ヨ
+ /// </summary>
+ /// <param name="erporderstus">璁㈠崟鐘舵�佺爜</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="erpordercode">璁㈠崟缂栧彿</param>
+ /// <param name="saleordercode">閿�鍞崟鍙�</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">浜у搧瑙勬牸</param>
+ /// <param name="datatype">鏃ユ湡绫诲瀷(璁″垝寮�宸�(PS)銆佽鍒掑畬宸�(PE)銆侀璁′氦浠�(ED))</param>
+ /// <param name="searchdate">寮�濮嬫棩鏈�</param>
+ /// <param name="creatuser">鍒涘缓浜哄憳</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "ErpOrderSearch")]
+ [HttpGet]
+ public JsonResult ErpOrderSearch(string erporderstus = null,string wkshopcode=null, string erpordercode = null, string saleordercode = null, string partcode = null, string partname = null, string partspec = null,string datatype=null, string searchdate = null, string creatuser = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //棰勮寮�宸ュ紑濮嬫椂闂�
+ string paydateenddate = ""; //棰勮寮�宸ョ粨鏉熸椂闂�
+ if (searchdate != "" && searchdate != null)
+ {
+ paydatestartdate = searchdate.Split('~')[0].ToString();
+ paydateenddate = searchdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.ErpOrderSearch(erporderstus, wkshopcode, erpordercode, saleordercode, partcode, partname, partspec, startNum, datatype,paydatestartdate, paydateenddate, creatuser, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[ERP璁㈠崟涓嬭揪]
+ /// <summary>
+ /// ERP璁㈠崟涓嬭揪
+ /// </summary>
+ /// <param name="obj">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MarkSaveErpOrder")]
+ [HttpPost]
+ public JsonResult MarkSaveErpOrder([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string erporderid = obj["erporderid"].ToString(); //璁㈠崟id
+ string sbid = obj["sbid"].ToString(); //sbid(璁㈠崟鏄庣粏id)
+ string erpordercode = obj["erpordercode"].ToString(); //璁㈠崟缂栧彿
+ string saleordercode = obj["saleordercode"].ToString(); //閿�鍞鍗曞彿
+ string partcode = obj["partcode"].ToString(); //浜у搧缂栫爜
+ string wkshopcode = obj["wkshopcode"].ToString(); //杞﹂棿缂栫爜
+ string warehousecode = obj["warehousecode"].ToString(); //浠撳簱缂栫爜
+ string erpqty = obj["erpqty"].ToString(); //璁㈠崟鏁伴噺
+ string markqty = obj["markqty"].ToString(); //涓嬪崟鏁伴噺
+ string ordernum = obj["ordernum"].ToString(); //涓嬪崟鍗曟暟
+ string relse_qty = obj["relse_qty"].ToString(); //宸蹭笅鍗曟暟閲�
+ string saleOrderDeliveryDate = obj["saleOrderDeliveryDate"].ToString(); //浜や粯鏃堕棿
+ string paystartdate = obj["paystartdate"].ToString(); //棰勮寮�宸ユ棩鏈�
+ string payenddate = obj["payenddate"].ToString(); //棰勮瀹屽伐鏃ユ湡
+ string clerkuser = obj["clerkuser"].ToString(); //閿�鍞鍗曚笟鍔″憳
+ mes = WorkOrderBLL.MarkSaveErpOrder(erporderid, sbid, erpordercode, saleordercode, partcode, wkshopcode, warehousecode, erpqty, markqty, ordernum, relse_qty, saleOrderDeliveryDate, paystartdate, payenddate, clerkuser, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[璁㈠崟鎵归噺涓嬭揪]
+ [Route(template: "MarkBatchSaveErpOrder")]
+ [HttpPost]
+ public JsonResult MarkBatchSaveErpOrder(List<ErpOrderBatch> obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MarkBatchSaveErpOrder(obj, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[ERP璁㈠崟鍏抽棴]
+ /// <summary>
+ /// ERP璁㈠崟鍏抽棴
+ /// </summary>
+ /// <param name="erporderid">璁㈠崟id</param>
+ /// <param name="erpordercode">璁㈠崟鍙�</param>
+ /// <returns></returns>
+ [Route(template: "ClosedErpOrder")]
+ [HttpPost]
+ public JsonResult ClosedErpOrder(string erporderid, string erpordercode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.ClosedErpOrder(erporderid, erpordercode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[ERP璁㈠崟鍒犻櫎]
+ /// <summary>
+ /// ERP璁㈠崟鍒犻櫎
+ /// </summary>
+ /// <param name="erporderid">璁㈠崟id</param>
+ /// <param name="erpordercode">璁㈠崟鍙�</param>
+ /// <returns></returns>
+ [Route(template: "DeleteErpOrder")]
+ [HttpPost]
+ public JsonResult DeleteErpOrder(string erporderid, string erpordercode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.DeleteErpOrder(erporderid, erpordercode, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[MES宸ュ崟鏌ヨ]
+ /// <summary>
+ /// MES宸ュ崟鏌ヨ
+ /// </summary>
+ /// <param name="mesorderstus">宸ュ崟鐘舵�佺爜</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="mesordercode">宸ュ崟缂栧彿</param>
+ /// <param name="sourceorder">婧愬崟鍗曞彿</param>
+ /// <param name="saleordercode">閿�鍞崟鍙�</param>
+ /// <param name="ordertype">鍗曟嵁绫诲瀷</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">浜у搧瑙勬牸</param>
+ /// <param name="datatype">鏃ユ湡绫诲瀷(璁″垝寮�宸�(PS)銆佽鍒掑畬宸�(PE)銆侀璁′氦浠�(ED)銆佸垱寤烘棩鏈�(CT))</param>
+ /// <param name="creatuser">鍒涘缓浜哄憳</param>
+ /// <param name="searchdate">鏌ヨ鏃ユ湡</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderSearch")]
+ [HttpGet]
+ public JsonResult MesOrderSearch(int page, int rows, string prop, string order, string mesorderstus = null,string wkshopcode=null, string mesordercode = null, string sourceorder = null, string saleordercode = null, string ordertype = null, string partcode = null, string partname = null, string partspec = null, string creatuser = null,string datatype=null, string searchdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string paydatestartdate = ""; //棰勮寮�宸ュ紑濮嬫椂闂�
+ string paydateenddate = ""; //棰勮寮�宸ョ粨鏉熸椂闂�
+ if (searchdate != "" && searchdate != null)
+ {
+ paydatestartdate = searchdate.Split('~')[0].ToString();
+ paydateenddate = searchdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.MesOrderSearch(mesorderstus, wkshopcode, mesordercode, sourceorder, saleordercode, ordertype, partcode, partname, partspec, startNum, creatuser, datatype, paydatestartdate, paydateenddate, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ]
+ /// <summary>
+ /// MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="mesordercode">宸ュ崟缂栧彿</param>
+ /// <param name="sourceorder">婧愬崟鍗曞彿</param>
+ /// <param name="saleordercode">閿�鍞崟鍙�</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">浜у搧瑙勬牸</param>
+ /// <param name="creatuser">鍒涘缓浜哄憳</param>
+ /// <param name="createdate">鍒涘缓鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MesBadOrderSearch")]
+ [HttpGet]
+ public JsonResult MesBadOrderSearch(int page, int rows, string prop, string order,string wkshopcode=null, string mesordercode = null, string sourceorder = null, string saleordercode = null, string partcode = null, string partname = null, string partspec = null, string creatuser = null, string createdate = null)
+ {
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.MesBadOrderSearch(wkshopcode,mesordercode, sourceorder, saleordercode, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+ /// <summary>
+ /// MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿
+ /// </summary>
+ /// <returns></returns>
+ [Route(template: "AddMesOrderCodeSearch")]
+ [HttpPost]
+ public JsonResult AddMesOrderCodeSearch()
+ {
+ mes = WorkOrderBLL.AddMesOrderCodeSearch();
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟缂栬緫鑾峰彇宸ュ簭鏁版嵁]
+ /// <summary>
+ /// MES宸ュ崟缂栬緫鑾峰彇宸ュ簭鏁版嵁
+ /// </summary>
+ /// <param name="sourceid">婧愬崟id</param>
+ /// <param name="sourcewo">婧愬崟鍗曞彿</param>
+ /// <param name="wocode">宸ュ崟鍙�</param>
+ /// <param name="data_sources">鏁版嵁鏉ユ簮锛欵RP/MES</param>
+ /// <returns></returns>
+ [Route(template: "UpdateMesOrderStepSearch")]
+ [HttpGet]
+ public JsonResult UpdateMesOrderStepSearch(string sourceid,string sourcewo,string wocode,string data_sources)
+ {
+ mes = WorkOrderBLL.UpdateMesOrderStepSearch(sourceid, sourcewo, wocode, data_sources);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
+ /// <summary>
+ /// MES宸ュ崟鏂板銆佺紪杈戞彁浜�
+ /// </summary>
+ /// <param name="OperType">鎿嶄綔绫诲瀷</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateMesOrder")]
+ [HttpPost]
+ public JsonResult AddUpdateMesOrder(WorkList json,string OperType)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.AddUpdateMesOrder(OperType,json, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺缁戝畾鑾峰彇宸ュ簭鏁版嵁]
+ /// <summary>
+ /// MES宸ュ崟鎵归噺缁戝畾鑾峰彇宸ュ簭鏁版嵁
+ /// </summary>
+ /// <param name="worksteplist">鏌ヨ鍙傛暟缁�</param>
+ /// <returns></returns>
+ [Route(template: "UpdateMesOrderStepListSearch")]
+ [HttpPost]
+ public JsonResult UpdateMesOrderStepListSearch(List<WorkStepList> worksteplist)
+ {
+ mes = WorkOrderBLL.UpdateMesOrderStepListSearch(worksteplist);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佺紪杈戞壒閲忕粦瀹氭彁浜
+ /// <summary>
+ /// MES宸ュ崟鏂板銆佺紪杈戞壒閲忕粦瀹氭彁浜�
+ /// </summary>
+ /// <param name="OperType">鎿嶄綔绫诲瀷</param>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "AddUpdateMesOrderList")]
+ [HttpPost]
+ public JsonResult AddUpdateMesOrderList(List<WorkList> json, string OperType)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.AddUpdateMesOrderList(OperType, json, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵撳嵃鏇存柊鎵撳嵃娆℃暟]
+ /// <summary>
+ /// MES宸ュ崟鎵撳嵃鏇存柊鎵撳嵃娆℃暟
+ /// </summary>
+ /// <param name="wo_code">宸ュ崟缂栧彿</param>
+ /// <returns></returns>
+ [Route(template: "UpdateMesOrderPrintCount")]
+ [HttpPost]
+ public JsonResult UpdateMesOrderPrintCount(string wo_code)
+ {
+ mes = WorkOrderBLL.UpdateMesOrderPrintCount(wo_code);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[MES宸ュ崟鍒犻櫎]
+ /// <summary>
+ /// MES宸ュ崟鍒犻櫎
+ /// </summary>
+ /// <param name="souceid">婧愬崟id</param>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="m_po">璁㈠崟缂栧彿</param>
+ /// <param name="orderqty">宸ュ崟鏁伴噺</param>
+ /// <returns></returns>
+ [Route(template: "DeleteMesOrder")]
+ [HttpPost]
+ public JsonResult DeleteMesOrder(string souceid, string wocode, string m_po, string orderqty)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.DeleteMesOrder(souceid, wocode, m_po, orderqty,us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ユ壘鍘嗗彶寮曠敤鏈�鏂板伐搴忎俊鎭痌
+ /// <summary>
+ /// MES宸ュ崟鏌ユ壘鍘嗗彶寮曠敤鏈�鏂板伐搴忎俊鎭�
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderNewStepContent")]
+ [HttpPost]
+ public JsonResult MesOrderNewStepContent(string wkshopcode,string routecode, string partcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderNewStepContent(wkshopcode, routecode, partcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ョ湅宸ュ崟SOP]
+ /// <summary>
+ /// MES宸ュ崟鏌ョ湅宸ュ崟SOP
+ /// </summary>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="materielcode">浜у搧缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderSopSearch")]
+ [HttpGet]
+ public JsonResult MesOrderSopSearch(string wocode, string materielcode)
+ {
+ mes = WorkOrderBLL.MesOrderSopSearch(wocode, materielcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ョ湅宸ヨ壓SOP]
+ /// <summary>
+ /// MES宸ュ崟鏌ョ湅宸ヨ壓SOP
+ /// </summary>
+ /// <param name="materielcode">浜у搧缂栫爜</param>
+ /// <param name="routecode">宸ヨ壓璺嚎缂栫爜</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderProcessSopSearch")]
+ [HttpGet]
+ public JsonResult MesOrderProcessSopSearch(string materielcode,string routecode,string stepcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderProcessSopSearch(materielcode, routecode, stepcode,us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[MES宸ュ崟娲惧彂鎻愪氦]
+ /// <summary>
+ /// MES宸ュ崟娲惧彂鎻愪氦
+ /// </summary>
+ /// <param name="wocodelist">宸ュ崟鍙锋暟缁�</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderDistribution")]
+ [HttpPost]
+ public JsonResult MesOrderDistribution([FromBody] string[] wocodelist)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderDistribution(wocodelist, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[MES宸ュ崟鍏抽棴鍒楄〃鏌ヨ]
+ /// <summary>
+ /// MES宸ュ崟鍏抽棴鍒楄〃鏌ヨ
+ /// </summary>
+ /// <param name="mesorderstus">宸ュ崟鐘舵��(宸插叧闂�/鏈叧闂�)</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="mesordercode">宸ュ崟缂栧彿</param>
+ /// <param name="sourceorder">婧愬崟鍗曞彿</param>
+ /// <param name="saleordercode">閿�鍞崟鍙�</param>
+ /// <param name="ordertype">鍗曟嵁绫诲瀷</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">浜у搧瑙勬牸</param>
+ /// <param name="creatuser">鍒涘缓浜哄憳</param>
+ /// <param name="createdate">鍒涘缓鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderClosedSearch")]
+ [HttpGet]
+ public JsonResult MesOrderClosedSearch(int page, int rows, string prop, string order, string mesorderstus = null,string wkshopcode=null, string mesordercode = null, string sourceorder = null, string saleordercode = null, string ordertype = null, string partcode = null, string partname = null, string partspec = null, string creatuser = null, string createdate = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.MesOrderClosedSearch(mesorderstus, wkshopcode, mesordercode, sourceorder, saleordercode, ordertype, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鍏抽棴鎻愪氦]
+ /// <summary>
+ /// MES宸ュ崟鍏抽棴鎻愪氦
+ /// </summary>
+ /// <param name="wocodelist">宸ュ崟鍙锋暟缁�</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderBitchClosedSeave")]
+ [HttpPost]
+ public JsonResult MesOrderBitchClosedSeave([FromBody] string[] wocodelist)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderBitchClosedSeave(us, wocodelist);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)]
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="wocode">宸ュ崟鍙�</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯(榛樿鎸夌収璁″垝寮�宸ユ椂闂存搴�)</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepSearch")]
+ [HttpGet]
+ public JsonResult MesOrderStepSearch(string wkshopcode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.MesOrderStepSearch(wkshopcode,wocode, partcode, partname, partspec, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(澶栧崗)]
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(澶栧崗)
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="wocode">宸ュ崟鍙�</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯(榛樿鎸夌収璁″垝寮�宸ユ椂闂存搴�)</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderWxStepSearch")]
+ [HttpGet]
+ public JsonResult MesOrderWxStepSearch(string wkshopcode, string wocode = null, string partcode = null, string partname = null, string partspec = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.MesOrderWxStepSearch(wkshopcode,wocode, partcode, partname, partspec, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇)]
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇)
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="wocode">宸ュ崟鍙�</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯(榛樿鎸夌収璁″垝寮�宸ユ椂闂存搴�)</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderNgStepSearch")]
+ [HttpGet]
+ public JsonResult MesOrderNgStepSearch(string wkshopcode=null, string wocode = null, string partcode = null, string partname = null, string partspec = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.MesOrderNgStepSearch(wkshopcode,wocode, partcode, partname, partspec, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇鏄庣粏)]
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇鏄庣粏)
+ /// </summary>
+ /// <param name="wocode">宸ュ崟鍙�</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderNgSubStepSearch")]
+ [HttpGet]
+ public JsonResult MesOrderNgSubStepSearch(string wocode,string stepcode)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderNgSubStepSearch(wocode,stepcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region [鐢熶骇寮�鎶ュ伐锛氭姤宸�/澶栧崗(鍙戞枡/鏀舵枡)鏃舵潯浠跺垽鏂強鏁版嵁杩斿洖鎺ュ彛]
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐锛氭姤宸�/澶栧崗(鍙戞枡/鏀舵枡)鏃舵潯浠跺垽鏂強鏁版嵁杩斿洖鎺ュ彛
+ /// </summary>
+ /// <param name="OperType">鎿嶄綔绫诲瀷锛氳嚜鍒�(ZZ)/澶栧崗(WX)</param>
+ /// <param name="SelectType">鎿嶄綔绫诲瀷锛氳嚜鍒�(浼犵┖)/澶栧崗(鍙戞枡鏍囪瘑(OUT)/鏀舵枡鏍囪瘑(IN))</param>
+ /// <param name="wocode">宸ュ崟缂栧彿</param>
+ /// <param name="stepcode">宸ュ簭缂栧彿</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepStart")]
+ [HttpGet]
+ public JsonResult MesOrderStepStart(string OperType,string SelectType, string wocode, string stepcode )
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderStepStart(OperType,SelectType, wocode, stepcode, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鎶ュ伐鎻愪氦]
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐,鎶ュ伐鎻愪氦
+ /// </summary>
+ /// <param name="obj">鎶ュ伐鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SavaMesOrderStepReport")]
+ [HttpPost]
+ public JsonResult SavaMesOrderStepReport([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mesordercode = obj["mesordercode"].ToString(); //宸ュ崟缂栧彿
+ string partcode = obj["partcode"].ToString(); //浜у搧缂栫爜
+ string stepseq = obj["stepseq"].ToString(); //宸ュ簭搴忓彿
+ string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜
+ string stepprice = obj["stepprice"].ToString(); //宸ュ簭宸ヤ环
+ string eqpcode = obj["eqpcode"].ToString(); //璁惧缂栫爜
+ string inbarcode = obj["inbarcode"].ToString(); //鍏ュ簱鏉$爜
+ string reckway = obj["reckway"].ToString(); //璁′欢鏂瑰紡(鐝粍:group銆佷釜浜�:person)
+ string usergroupcode = obj["usergroupcode"].ToString(); //鐝粍缂栫爜
+ string reportuser = obj["reportuser"].ToString(); //鎶ュ伐浜哄憳
+ string payrate = obj["payrate"].ToString(); //钖祫绫诲瀷锛歋(璁′欢)锛孴(璁℃椂)锛孧(鏈�)
+ string taskqty = obj["taskqty"].ToString(); //浠诲姟鏁伴噺
+ string startqty = obj["startqty"].ToString(); //寮�宸ユ暟閲�
+ string reportqty = obj["reportqty"].ToString(); //鎶ュ伐宸ユ暟閲�
+ string defectlist = obj["defectlist"].ToString();//涓嶈壇姹囨��
+ string remarks = obj["remarks"].ToString(); //澶囨敞
+ List<ReportDefectList> defectobjs = JsonConvert.DeserializeObject<List<ReportDefectList>>(defectlist);
+ mes = WorkOrderBLL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, stepprice, eqpcode, inbarcode, reckway, usergroupcode, reportuser, payrate, taskqty, startqty, reportqty, defectobjs, remarks, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鍙戞枡鎻愪氦]
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐,鍙戞枡鎻愪氦
+ /// </summary>
+ /// <param name="obj">鍙戞枡鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SavaMesOrderStepOut")]
+ [HttpPost]
+ public JsonResult SavaMesOrderStepOut([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mesordercode = obj["mesordercode"].ToString(); //宸ュ崟缂栧彿
+ string partcode = obj["partcode"].ToString(); //浜у搧缂栫爜
+ string stepseq = obj["stepseq"].ToString(); //宸ュ簭搴忓彿
+ string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜
+ string wxcode = obj["wxcode"].ToString(); //澶栧崗渚涘簲鍟嗙紪鐮�
+ string outuser = obj["outuser"].ToString(); //鍙戞枡浜哄憳
+ string taskqty = obj["taskqty"].ToString(); //浠诲姟鏁伴噺
+ string fqty = obj["fqty"].ToString(); //鍙戞枡鏁伴噺
+ mes = WorkOrderBLL.SavaMesOrderStepOut(mesordercode, partcode, stepseq, stepcode, wxcode, outuser, taskqty, fqty, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鏀舵枡鎻愪氦]
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐,鏀舵枡鎻愪氦
+ /// </summary>
+ /// <param name="obj">鏀舵枡鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "SavaMesOrderStepIn")]
+ [HttpPost]
+ public JsonResult SavaMesOrderStepIn([FromBody] JObject obj)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ string mesordercode = obj["mesordercode"].ToString(); //宸ュ崟缂栧彿
+ string partcode = obj["partcode"].ToString(); //浜у搧缂栫爜
+ string stepseq = obj["stepseq"].ToString(); //宸ュ簭搴忓彿
+ string stepcode = obj["stepcode"].ToString(); //宸ュ簭缂栫爜
+ string wxcode = obj["wxcode"].ToString(); //澶栧崗渚涘簲鍟嗙紪鐮�
+ string inbarcode = obj["inbarcode"].ToString(); //鍏ュ簱鏉$爜
+ string inuser = obj["inuser"].ToString(); //鏀舵枡浜哄憳
+ string taskqty = obj["taskqty"].ToString(); //浠诲姟鏁伴噺
+ string sqty = obj["sqty"].ToString(); //鏀舵枡鏁伴噺
+ string defectlist = obj["defectlist"].ToString();//涓嶈壇姹囨��
+ string remarks = obj["remarks"].ToString(); //澶囨敞
+ List<ReportDefectList> defectobjs = JsonConvert.DeserializeObject<List<ReportDefectList>>(defectlist);
+ mes = WorkOrderBLL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty, defectobjs, remarks, us);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[涓嶈壇澶勭悊,鎻愪氦]
+ /// <summary>
+ /// 涓嶈壇澶勭悊,鎻愪氦
+ /// </summary>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "EditOrderNgStepSeave")]
+ [HttpPost]
+ public JsonResult EditOrderNgStepSeave(ReportDefectHandle json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.EditOrderNgStepSeave(json, us);
+ return Json(mes);
+ }
+ #endregion
+
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鍒楄〃鏁版嵁鏌ヨ鎺ュ彛]
+ /// <summary>
+ /// 鐢熶骇鎵ц,鎶ュ伐璋冩暣鍒楄〃鏁版嵁鏌ヨ鎺ュ彛
+ /// </summary>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="wo_code">宸ュ崟缂栧彿</param>
+ /// <param name="partnumber">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">浜у搧瑙勬牸</param>
+ /// <param name="reportuser">鎶ュ伐浜哄憳</param>
+ /// <param name="reportdate">鎶ュ伐鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepVerifySearch")]
+ [HttpGet]
+ public JsonResult MesOrderStepVerifySearch(string wkshopcode=null, string wo_code = null, string partnumber = null, string partname = null, string partspec = null, string reportuser = null, string reportdate = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ string reportdateopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string reportdateclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportdateopendate = reportdate.Split('~')[0].ToString();
+ reportdateclosedate = reportdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.MesOrderStepVerifySearch(wkshopcode,wo_code, partnumber, partname, partspec, reportuser, reportdateopendate, reportdateclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鑾峰彇閫夊畾鎶ュ伐璁板綍鐨勪笉鑹暟鎹甝
+ /// <summary>
+ /// 鐢熶骇鎵ц,鎶ュ伐璋冩暣鑾峰彇閫夊畾鎶ュ伐璁板綍鐨勪笉鑹暟鎹�
+ /// </summary>
+ /// <param name="wo_code">宸ュ崟鍙�</param>
+ /// <param name="step_code">宸ュ簭鍙�</param>
+ /// <param name="step_type">宸ュ簭绫诲瀷(鑷埗:Z 澶栧崗:W)</param>
+ /// <param name="isbott">鏄惁棣栭亾宸ュ簭</param>
+ /// <param name="isend">鏄惁鏈亾宸ュ簭</param>
+ /// <param name="id">鎶ュ伐涓籭d</param>
+ /// <param name="sbid">鎶ュ伐瀛恑d</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepModelSearch")]
+ [HttpGet]
+ public JsonResult MesOrderStepModelSearch(string wo_code,string step_code,string step_type,string isbott,string isend,string id, string sbid)
+ {
+ mes = WorkOrderBLL.MesOrderStepModelSearch(wo_code, step_code, step_type, isbott, isend,id,sbid);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鏁版嵁鎻愪氦]
+ /// <summary>
+ /// 鐢熶骇鎵ц,鎶ュ伐璋冩暣鏁版嵁鎻愪氦
+ /// </summary>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepUpdateSeave")]
+ [HttpPost]
+ public JsonResult MesOrderStepUpdateSeave(List<UpdateProductReport> json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderStepUpdateSeave(us, json);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鍒楄〃鏁版嵁鏌ヨ鎺ュ彛]
+ /// <summary>
+ /// 鐢熶骇鎵ц,鎶ュ伐瀹℃牳鍒楄〃鏁版嵁鏌ヨ鎺ュ彛
+ /// </summary>
+ /// <param name="reviewstatus">瀹℃牳鐘舵��</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="wo_code">宸ュ崟缂栧彿</param>
+ /// <param name="partnumber">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">浜у搧瑙勬牸</param>
+ /// <param name="stepname">鎶ュ伐宸ュ簭</param>
+ /// <param name="reportuser">鎶ュ伐浜哄憳</param>
+ /// <param name="reportdate">鎶ュ伐鏃堕棿</param>
+ /// <param name="page">椤电爜</param>
+ /// <param name="rows">姣忛〉鏉℃暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepReportVerifySearch")]
+ [HttpGet]
+ public JsonResult MesOrderStepReportVerifySearch(string reviewstatus=null, string wkshopcode=null, string wo_code = null, string partnumber = null, string partname = null, string partspec = null,string stepname=null, string reportuser = null, string reportdate = null, int page = 0, int rows = 0, string prop = null, string order = null)
+ {
+ string reportdateopendate = ""; //鎶ュ伐寮�濮嬫椂闂�
+ string reportdateclosedate = ""; //鎶ュ伐缁撴潫鏃堕棿
+ if (reportdate != "" && reportdate != null)
+ {
+ reportdateopendate = reportdate.Split('~')[0].ToString();
+ reportdateclosedate = reportdate.Split('~')[1].ToString();
+ }
+ int startNum = rows * (page - 1) + 1; //璧峰璁板綍rowNum
+ int endNum = rows * page; //缁撴潫璁板綍 rowNum
+ mes = WorkOrderBLL.MesOrderStepReportVerifySearch(reviewstatus,wkshopcode, wo_code, partnumber, partname, partspec,stepname,reportuser, reportdateopendate, reportdateclosedate, startNum, endNum, prop, order);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鏁版嵁鎻愪氦]
+ /// <summary>
+ /// 鐢熶骇鎵ц,鎶ュ伐瀹℃牳鏁版嵁鎻愪氦
+ /// </summary>
+ /// <param name="json">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepReportVerifySeave")]
+ [HttpPost]
+ public JsonResult MesOrderStepReportVerifySeave([FromBody] DataModel json)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderStepReportVerifySeave(us, json);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐寮冨鏁版嵁鎻愪氦]
+ /// <summary>
+ /// 鐢熶骇鎵ц,鎶ュ伐寮冨鏁版嵁鎻愪氦
+ /// </summary>
+ /// <param name="id">鎶ュ伐璁板綍id</param>
+ /// <param name="steptype">宸ュ簭绫诲瀷</param>
+ /// <returns></returns>
+ [Route(template: "MesOrderStepReportNotVerifySeave")]
+ [HttpPost]
+ public JsonResult MesOrderStepReportNotVerifySeave(string id, string steptype)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.MesOrderStepReportNotVerifySeave(us, id, steptype);
+ return Json(mes);
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇鍏ュ簱鏉$爜琛ユ墦]
+ /// <summary>
+ /// 鐢熶骇鍏ュ簱鏉$爜琛ユ墦
+ /// </summary>
+ /// <param name="ordercode">宸ュ崟缂栧彿</param>
+ /// <returns></returns>
+ [Route(template: "ProductInHouseLabCode")]
+ [HttpGet]
+ public JsonResult ProductInHouseLabCode(string ordercode)
+ {
+ mes = WorkOrderBLL.ProductInHouseLabCode(ordercode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱淇℃伅鏌ヨ]
+ /// <summary>
+ /// 鐢熶骇鍏ュ簱淇℃伅鏌ヨ
+ /// </summary>
+ /// <param name="deptno">閮ㄩ棬缂栫爜(T8浣跨敤)</param>
+ /// <param name="saleordercode">閿�鍞崟鍙�</param>
+ /// <param name="wkshopcode">杞﹂棿缂栫爜</param>
+ /// <param name="erpordercode">璁㈠崟缂栧彿</param>
+ /// <param name="mesordercode">宸ュ崟缂栧彿</param>
+ /// <param name="partcode">浜у搧缂栫爜</param>
+ /// <param name="partname">浜у搧鍚嶇О</param>
+ /// <param name="partspec">瑙勬牸鍨嬪彿</param>
+ /// <returns></returns>
+ [Route(template: "ProductInHouseOrderSearch")]
+ [HttpGet]
+ public JsonResult ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode = null, string mesordercode = null, string partcode = null, string partname = null, string partspec = null)
+ {
+ mes = WorkOrderBLL.ProductInHouseOrderSearch(deptno, saleordercode, wkshopcode, erpordercode, mesordercode, partcode, partname, partspec);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱鑾峰彇鍗曟嵁鍙穄
+ /// <summary>
+ /// 鐢熶骇鍏ュ簱鑾峰彇鍗曟嵁鍙�
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <returns></returns>
+ [Route(template: "ProductInHouseOrderCodeSearch")]
+ [HttpPost]
+ public JsonResult ProductInHouseOrderCodeSearch(string rightcode)
+ {
+ mes = WorkOrderBLL.ProductInHouseOrderCodeSearch(rightcode);
+ return Json(mes);
+ }
+ #endregion
+
+ #region[鐣呮嵎閫歍+鐢熶骇鍏ュ簱鎻愪氦-瀛樺偍杩囩▼鐗�(閫傜敤鍚屼竴鍙版湇鍔″櫒锛屽悓涓�涓暟鎹簱)]
+ /// <summary>
+ /// 鐣呮嵎閫歍+鐢熶骇鍏ュ簱鎻愪氦-瀛樺偍杩囩▼鐗�(閫傜敤鍚屼竴鍙版湇鍔″櫒锛屽悓涓�涓暟鎹簱)
+ /// </summary>
+ /// <param name="data">鎻愪氦鏁版嵁</param>
+ /// <returns></returns>
+ [Route(template: "TProductInHouseOrderSpSeave")]
+ [HttpPost]
+ public JsonResult TProductInHouseOrderSpSeave(InReptModel data)
+ {
+ var token = HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ mes = WorkOrderBLL.TProductInHouseOrderSpSeave(data, us);
+ return Json(mes);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/AppAnDonBLL.cs b/VueWebCoreApi/DLL/BLL/AppAnDonBLL.cs
new file mode 100644
index 0000000..e0ea1cf
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/AppAnDonBLL.cs
@@ -0,0 +1,50 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class AppAnDonBLL
+ {
+ #region[瀹夌伅鍛煎彨鎵弿宸ヤ綅]
+ public static ToMessage AppAnDonCallScanSearch(string eqpcode)
+ {
+ return AppAnDonDAL.AppAnDonCallScanSearch(eqpcode);
+ }
+ #endregion
+
+ #region[瀹夌伅鍛煎彨,閫夋嫨鎵弿宸ヤ綅甯﹀嚭鍛煎彨绫诲瀷閫夐」鍙婂搴斾汉鍛樻暟鎹甝
+ public static ToMessage AppAnDonCallItemSearch(string eqpcode, string wkshpcode)
+ {
+ return AppAnDonDAL.AppAnDonCallItemSearch(eqpcode, wkshpcode);
+ }
+ #endregion
+
+ #region[瀹夌伅鍛煎彨鎻愪氦]
+ public static ToMessage AppAnDonCallSave(User us, string eqpcode, string wkshpcode, List<AnDnDate> json)
+ {
+ return AppAnDonDAL.AppAnDonCallSave(us, eqpcode, wkshpcode, json);
+ }
+ #endregion
+
+
+
+ #region[瀹夌伅鍝嶅簲鎵弿宸ヤ綅/璁惧]
+ public static ToMessage AppAnDonLampResponseScanSearch(string eqpcode)
+ {
+ return AppAnDonDAL.AppAnDonLampResponseScanSearch(eqpcode);
+ }
+ #endregion
+
+ #region[瀹夌伅鍝嶅簲鎻愪氦]
+ public static ToMessage AppAnDonLampResponseSave(User us, string eqpcode, string wkshpcode, List<ObjectData> json)
+ {
+ return AppAnDonDAL.AppAnDonLampResponseSave(us, eqpcode, wkshpcode, json);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/AppAnalyticsBLL.cs b/VueWebCoreApi/DLL/BLL/AppAnalyticsBLL.cs
new file mode 100644
index 0000000..851eacd
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/AppAnalyticsBLL.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class AppAnalyticsBLL
+ {
+ #region[App鐢熶骇鐪嬫澘]
+ public static ToMessage ProductionKanban(User us, string startopendate, string endclosedate, string defecttype)
+ {
+ return AppAnalyticsDAL.ProductionKanban(us, startopendate, endclosedate,defecttype);
+ }
+ #endregion
+
+ #region[App鐢熶骇杩涘害鐪嬫澘鍗曟嵁淇℃伅]
+ public static ToMessage ProductionScheduleKanban(User us, string ordertype, string partcode, string startopendate, string endclosedate)
+ {
+ return AppAnalyticsDAL.ProductionScheduleKanban(us, ordertype, partcode, startopendate, endclosedate);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/AppPersonalBLL.cs b/VueWebCoreApi/DLL/BLL/AppPersonalBLL.cs
new file mode 100644
index 0000000..4f2c534
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/AppPersonalBLL.cs
@@ -0,0 +1,20 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class AppPersonalBLL
+ {
+ #region[App涓汉璁′欢宸ヨ祫]
+ public static ToMessage PieceRateWage(string compute, User us, string startopendate, string endclosedate)
+ {
+ return AppPersonalDAL.PieceRateWage(compute, us, startopendate, endclosedate);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/BaseDateBLL.cs b/VueWebCoreApi/DLL/BLL/BaseDateBLL.cs
new file mode 100644
index 0000000..fa108a7
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/BaseDateBLL.cs
@@ -0,0 +1,104 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class BaseDateBLL
+ {
+ #region[閲囪喘渚涙柟淇℃伅鏌ヨ]
+ public static ToMessage PurchSupplierSelect()
+ {
+ return BaseDateDAL.PurchSupplierSelect();
+ }
+ #endregion
+
+ #region[閮ㄩ棬淇℃伅鏌ヨ]
+ public static ToMessage DepartMentSelect()
+ {
+ return BaseDateDAL.DepartMentSelect();
+ }
+ #endregion
+
+ #region[浠撳簱淇℃伅鏌ヨ]
+ public static ToMessage StoreHouseSearch()
+ {
+ return BaseDateDAL.StoreHouseSearch();
+ }
+ #endregion
+
+ #region[搴撲綅淇℃伅鏌ヨ]
+ public static ToMessage WarehouseLocationSearch()
+ {
+ return BaseDateDAL.WarehouseLocationSearch();
+ }
+ #endregion
+
+ #region[搴撲綅鏌ヨ浠撳簱]
+ public static ToMessage WarehouseLocationSearchStoreHouse(string locationcode)
+ {
+ return BaseDateDAL.WarehouseLocationSearchStoreHouse(locationcode);
+ }
+ #endregion
+
+ #region[鍗曚綅淇℃伅鏌ヨ]
+ public static ToMessage UnitSerch()
+ {
+ return BaseDateDAL.UnitSerch();
+ }
+ #endregion
+
+ #region[璐ㄦ鏂规淇℃伅]
+ public static ToMessage QualityScheme()
+ {
+ return BaseDateDAL.QualityScheme();
+ }
+ #endregion
+
+ #region[瀛樿揣鏌ヨ]
+ public static ToMessage InventorySelect(string param)
+ {
+ return BaseDateDAL.InventorySelect(param);
+ }
+ #endregion
+
+ #region[閫氳繃閫夋嫨鐨勬墍灞炵粍缁囨煡璇㈡墍灞炵彮缁刔
+ public static ToMessage StorgGroupSelect(string stu_torgcode, string description)
+ {
+ return BaseDateDAL.StorgGroupSelect(stu_torgcode, description);
+ }
+ #endregion
+
+ #region[閫氳繃閫夋嫨鐨勬墍灞炵粍缁囨煡璇㈡墍灞炶鑹茬被鍨媇
+ public static ToMessage StorgRoleSelect(string stu_torgcode, string description)
+ {
+ return BaseDateDAL.StorgRoleSelect(stu_torgcode, description);
+ }
+ #endregion
+
+
+ #region[ERP鐢熶骇杞﹂棿/閮ㄩ棬淇℃伅鏌ヨ]
+ public static ToMessage ErpWkshopDepartmentSelect()
+ {
+ return BaseDateDAL.ErpWkshopDepartmentSelect();
+ }
+ #endregion
+
+ #region[ERP鐢熶粨搴撲俊鎭煡璇
+ public static ToMessage ErpWarehouseSelect()
+ {
+ return BaseDateDAL.ErpWarehouseSelect();
+ }
+ #endregion
+
+ #region[ERP鐢熺敤鎴蜂俊鎭煡璇
+ public static ToMessage ErpUserSelect()
+ {
+ return BaseDateDAL.ErpUserSelect();
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/BasicSettingBLL.cs b/VueWebCoreApi/DLL/BLL/BasicSettingBLL.cs
new file mode 100644
index 0000000..6ef03c0
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/BasicSettingBLL.cs
@@ -0,0 +1,483 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.RolePermission;
+using VueWebCoreApi.Models.WorkData;
+using VueWebCoreApi.Tools;
+using static VueWebCoreApi.Models.RolePermission.RolePermissionSava;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class BasicSettingBLL
+ {
+
+
+ #region[寰�鏉ュ崟浣嶆煡璇
+ public static ToMessage CurrentUnitSearch(string cuntUnitCode, string cuntUnitName, string unitAttr, string createUser, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.CurrentUnitSearch(cuntUnitCode, cuntUnitName, unitAttr, createUser, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶆柊澧炵紪杈慮
+ public static ToMessage AddUpdateCurrentUnit(string unitid, string unitcode, string unitname, string typecode, string person, string contact, string description, string usercode, string OperType)
+ {
+ return BasicSettingDAL.AddUpdateCurrentUnit(unitid, unitcode, unitname, typecode, person, contact, description, usercode, OperType);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅垹闄
+ public static ToMessage DeleteCurrentUnit(string unitcode)
+ {
+ return BasicSettingDAL.DeleteCurrentUnit(unitcode);
+ }
+ #endregion
+
+
+ #region[閫氳繃杞﹂棿缂栫爜鏌ユ壘璁惧淇℃伅]
+ public static ToMessage WhkspIsEqpSearch(string wkshpcode)
+ {
+ return BasicSettingDAL.WhkspIsEqpSearch(wkshpcode);
+ }
+ #endregion
+
+
+
+
+
+ #region[缁勭粐鏋舵瀯,鏌ヨ缁勭粐淇℃伅]
+ public static ToMessage STorgData(string storg_code, string storg_name)
+ {
+ return BasicSettingDAL.STorgData(storg_code, storg_name);
+ }
+ #endregion
+
+ #region [缁勭粐鏋舵瀯鏂板缂栬緫]
+ public static ToMessage AddUpdateOrganization(string OrganCode, string OrganName, string leve, string parent_id,string storgcode, string torg_seq, string status, string OperType, User us)
+ {
+ return BasicSettingDAL.AddUpdateOrganization(OrganCode, OrganName, leve, parent_id, storgcode, torg_seq, status, OperType, us);
+ }
+ #endregion
+
+ #region [缁勭粐鏋舵瀯鍒犻櫎]
+ public static ToMessage DeleteOrganization(string orgcode, User us)
+ {
+ return BasicSettingDAL.DeleteOrganization(orgcode,us);
+ }
+ #endregion
+
+
+ #region[宀椾綅淇℃伅鍒楄〃鏌ヨ]
+ public static ToMessage PostData(string postcode, string postname, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.PostData(postcode, postname, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[宀椾綅鏂板缂栬緫]
+ public static ToMessage AddUpdatePost(string postcode, string postname, string description, string status, string OperType, User us)
+ {
+ return BasicSettingDAL.AddUpdatePost(postcode, postname, description, status, OperType, us);
+ }
+ #endregion
+
+ #region[宀椾綅鍒犻櫎鍒犻櫎]
+ public static ToMessage DeletePost(string postcode, User us)
+ {
+ return BasicSettingDAL.DeletePost(postcode,us);
+ }
+ #endregion
+
+
+ #region[鐢ㄦ埛淇℃伅鍒楄〃鏌ヨ]
+ public static ToMessage UserData(string storgcode, string usercode, string username, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.UserData(storgcode,usercode, username, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢ㄦ埛淇℃伅鏂板缂栬緫]
+ public static ToMessage AddUpdateUserSave(string usercode, string username, string password,string payrate, string mobile, string email, string storg_code, string status, string post_code, string role_code,string group_code, string opertype, User us)
+ {
+ return BasicSettingDAL.AddUpdateUserSave(usercode, username, password, payrate, mobile, email, storg_code, status, post_code, role_code, group_code, opertype, us);
+ }
+ #endregion
+
+ #region[鐢ㄦ埛淇℃伅鍒犻櫎]
+ public static ToMessage DeleteUserSave(string usercode, User us)
+ {
+ return BasicSettingDAL.DeleteUserSave(usercode, us);
+ }
+ #endregion
+
+
+ #region[鐝粍淇℃伅鍒楄〃鏌ヨ]
+ public static ToMessage GroupData(string groupcode, string groupname, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.GroupData(groupcode, groupname, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐝粍鏂板缂栬緫]
+ public static ToMessage AddUpdateGroup(string groupcode, string groupname, string description, string status, string OperType, User us)
+ {
+ return BasicSettingDAL.AddUpdateGroup(groupcode, groupname, description, status, OperType, us);
+ }
+ #endregion
+
+ #region[鐝粍鍒犻櫎]
+ public static ToMessage DeleteGroup(string groupcode, User us)
+ {
+ return BasicSettingDAL.DeleteGroup(groupcode,us);
+ }
+ #endregion
+
+
+ #region[瑙掕壊绠$悊鍒楄〃鏌ヨ]
+ public static ToMessage RoleData(string role_code, string role_name, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.RoleData(role_code, role_name, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鏂板銆佺紪杈戜繚瀛榏
+ public static ToMessage RoleAddUpdateSava(string menucode,string rolecode, string rolename,string status,string datacode,string datapermissions,string description,string OperType, User us)
+ {
+ return BasicSettingDAL.RoleAddUpdateSava(menucode, rolecode, rolename, status, datacode, datapermissions, description, OperType, us);
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒犻櫎]
+ public static ToMessage RoleDeleteSava(string rolecode,User us)
+ {
+ return BasicSettingDAL.RoleDeleteSava(rolecode,us);
+ }
+ #endregion
+
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鑾峰彇宸插垎閰嶇敤鎴峰垪琛╙
+ public static ToMessage RoleAssignedUserData(string flag, string role_code,string usercode,string username,string storg_code,string post_code,string group_code, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.RoleAssignedUserData(flag,role_code, usercode, username, storg_code, post_code, group_code, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鎵归噺鍙栨秷宸插垎閰嶇殑鐢ㄦ埛]
+ public static ToMessage RoleAssignedUserBatchCancel(string role_code, string[] user, User us)
+ {
+ return BasicSettingDAL.RoleAssignedUserBatchCancel(role_code,user,us);
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鎵归噺娣诲姞鏈垎閰嶇殑鐢ㄦ埛]
+ public static ToMessage RoleAssignedUserBatchAdd(string role_code, string[] user, User us)
+ {
+ return BasicSettingDAL.RoleAssignedUserBatchAdd(role_code, user, us);
+ }
+ #endregion
+
+
+
+ #region[瑙掕壊鏉冮檺鏌ヨ瑙掕壊]
+ public static ToMessage RolePermissionSearchRole()
+ {
+ return BasicSettingDAL.RolePermissionSearchRole();
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺鏌ヨ榛樿鑿滃崟鎸夐挳鏁版嵁]
+ public static ToMessage RolePermissionSearchRoleMenu(string type)
+ {
+ return BasicSettingDAL.RolePermissionSearchRoleMenu(type);
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺,鏍规嵁瑙掕壊鏌ユ壘鍏宠仈鏉冮檺]
+ public static ToMessage RolePermissionSearchRoleMenuButton(string rolecode,string type)
+ {
+ return BasicSettingDAL.RolePermissionSearchRoleMenuButton(rolecode, type);
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺,鎻愪氦]
+ public static ToMessage RolePermissionSava(string json, string rolecode,string type, User us)
+ {
+ return BasicSettingDAL.RolePermissionSava(json, rolecode, type,us);
+ }
+ #endregion
+
+
+
+
+ #region[寰�鏉ュ崟浣嶅垎绫讳俊鎭痌
+ public static ToMessage TCunstomerClassTree()
+ {
+ return BasicSettingDAL.TCunstomerClassTree();
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅垎绫绘柊澧�/缂栬緫鎻愪氦]
+ public static ToMessage TCunstomerClassTreeAddUpdate(string data_sources, string customerclasscode, string customerclassname, string parentcode, string OperType, User us)
+ {
+ return BasicSettingDAL.TCunstomerClassTreeAddUpdate(data_sources, customerclasscode, customerclassname, parentcode, OperType, us);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅垎绫诲垹闄
+ public static ToMessage TCunstomerClassTreeDelete(string customerclasscode, User us)
+ {
+ return BasicSettingDAL.TCunstomerClassTreeDelete(customerclasscode,us);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶄俊鎭垪琛╙
+ public static ToMessage TCunstomerData(string customerclasscode, string customercode, string customername, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.TCunstomerData(customerclasscode, customercode, customername, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶆柊澧�/缂栬緫淇濆瓨]
+ public static ToMessage TCunstomerAddUpdate(string data_sources, string customercode, string customername, string customerclasscode, string status, string conttacts, string conttphone, string addr, string OperType, User us)
+ {
+ return BasicSettingDAL.TCunstomerAddUpdate(data_sources, customercode, customername, customerclasscode, status, conttacts, conttphone, addr, OperType, us);
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶄俊鎭垹闄
+ public static ToMessage TCunstomerDelete(string data_sources, string customercode, User us)
+ {
+ return BasicSettingDAL.TCunstomerDelete(data_sources,customercode,us);
+ }
+ #endregion
+
+
+ #region[浠撳簱淇℃伅鍒楄〃]
+ public static ToMessage TSecStckData(string code, string name, string status, string ishasPosition, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.TSecStckData(code, name, status, ishasPosition, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[浠撳簱鏂板/缂栬緫淇濆瓨]
+ public static ToMessage TSecStckAddUpdate(string data_sources, string stckcode, string stckname, string ishaspostion, string status, string description, string OperType, User us)
+ {
+ return BasicSettingDAL.TSecStckAddUpdate(data_sources, stckcode, stckname, ishaspostion, status, description, OperType, us);
+ }
+ #endregion
+
+ #region[浠撳簱鍒犻櫎]
+ public static ToMessage TSecStckDelete(string data_sources, string stckcode, User us)
+ {
+ return BasicSettingDAL.TSecStckDelete(data_sources,stckcode,us);
+ }
+ #endregion
+
+
+ #region[浠撲綅鏍戝瀷淇℃伅]
+ public static ToMessage TSecLocaTree()
+ {
+ return BasicSettingDAL.TSecLocaTree();
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鍒楄〃]
+ public static ToMessage TSecLocaData(string flag, string stckcode, string locacode, string locaname, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.TSecLocaData(flag,stckcode, locacode, locaname, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鏂板/缂栬緫淇濆瓨]
+ public static ToMessage TSecLocaAddUpdate(string data_sources, string locacode, string locaname, string stckcode, string parentlocacode,string depth, string status, string description, string OperType, User us)
+ {
+ return BasicSettingDAL.TSecLocaAddUpdate(data_sources, locacode, locaname, stckcode, parentlocacode, depth, status, description, OperType, us);
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鍒犻櫎]
+ public static ToMessage TSecLocaDelete(string data_sources, string locacode, User us)
+ {
+ return BasicSettingDAL.TSecLocaDelete(data_sources, locacode, us);
+ }
+ #endregion
+
+
+ #region[宸ヨ壓璺嚎宸ュ簭涓嬫媺鏌ヨ鎺ュ彛]
+ public static ToMessage StepSelect()
+ {
+ return BasicSettingDAL.StepSelect();
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鏌ヨ]
+ public static ToMessage RouteSearch(string routecode, string routename, string description, string createuser, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.RouteSearch(routecode, routename, description, createuser, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎棰勮]
+ public static ToMessage ViewRoute(string routecode)
+ {
+ return BasicSettingDAL.ViewRoute(routecode);
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鏂板]
+ public static ToMessage AddUpdateRoute(string id, string opertype, User us, RoutEdit json)
+ {
+ return BasicSettingDAL.AddUpdateRoute(id, opertype, us, json);
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鍒犻櫎]
+ public static ToMessage DeleteRoute(string routecode, User us)
+ {
+ return BasicSettingDAL.DeleteRoute(routecode,us);
+ }
+ #endregion
+
+
+ #region[宸ュ簭鏌ヨ]
+ public static ToMessage StepSearch(string stepcode, string stepname, string enable, string steptypecode, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.StepSearch(stepcode, stepname, enable, steptypecode, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[宸ュ簭鏂板缂栬緫]
+ public static ToMessage AddUpdateStep(string stepid, string stepcode, string stepname, string steptypecode, string enable, string description, User us, string operType)
+ {
+ return BasicSettingDAL.AddUpdateStep(stepid,stepcode, stepname, steptypecode, enable, description, us, operType);
+ }
+ #endregion
+
+ #region[宸ュ簭鍒犻櫎]
+ public static ToMessage DeleteStep(string stepcode, User us)
+ {
+ return BasicSettingDAL.DeleteStep(stepcode,us);
+ }
+ #endregion
+
+
+ #region[鑺傛媿宸ヤ环,浜у搧淇℃伅鏌ヨ]
+ public static ToMessage PartSelect()
+ {
+ return BasicSettingDAL.PartSelect();
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鏌ユ壘宸ヨ壓淇℃伅]
+ public static ToMessage PartSelectRpute(string partcode,User us)
+ {
+ return BasicSettingDAL.PartSelectRpute(partcode,us);
+ }
+ #endregion
+
+ #region[鏍规嵁宸ヨ壓淇℃伅(宸ヨ壓璺嚎缂栫爜)鏌ユ壘鍏宠仈宸ュ簭闆嗗悎]
+ public static ToMessage RouteSelectStep(string partcode, string routecode)
+ {
+ return BasicSettingDAL.RouteSelectStep(partcode,routecode);
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鎵归噺鏌ユ壘鍏宠仈鐨勫伐鑹轰俊鎭痌
+ public static ToMessage PartSelectRputeList(List<PartRouteList> list, User us)
+ {
+ return BasicSettingDAL.PartSelectRputeList(list, us);
+ }
+ #endregion
+
+ #region[鏍规嵁宸ヨ壓淇℃伅(宸ヨ壓璺嚎缂栫爜)鎵归噺鏌ユ壘鍏宠仈宸ュ簭闆嗗悎]
+ public static ToMessage RouteSelectStepList(List<PartRouteStepList> list)
+ {
+ return BasicSettingDAL.RouteSelectStepList(list);
+ }
+ #endregion
+
+
+
+ #region[鑺傛媿宸ヤ环鏌ヨ]
+ public static ToMessage BeatRateSearch(string partcode, string routecode, string stepcode, User us, int startNum, int endNum, string prop, string order)
+ {
+ return BasicSettingDAL.BeatRateSearch(partcode, routecode, stepcode, us, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鎻愪氦]
+ public static ToMessage SaveBeatRate(List<MaterialCraftsSave> json, User us)
+ {
+ return BasicSettingDAL.SaveBeatRate(json,us);
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鍒犻櫎]
+ public static ToMessage DeleteBeatRate(string id, User us)
+ {
+ return BasicSettingDAL.DeleteBeatRate(id, us);
+ }
+ #endregion
+
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫煡璇
+ public static ToMessage AnDengTypeSearch()
+ {
+ return BasicSettingDAL.AnDengTypeSearch();
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫柊澧瀅
+ public static ToMessage AddUpdateAnDengType(List<ObjectData> json, User us)
+ {
+ return BasicSettingDAL.AddUpdateAnDengType(json, us);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬪垹闄
+ public static ToMessage DeleteAnDengType(string andengtypecode,User us)
+ {
+ return BasicSettingDAL.DeleteAnDengType(andengtypecode,us);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏌ヨ缁戝畾鐨勫搷搴斾汉鍛榏
+ public static ToMessage AnDengResponUserSearch(string wkshopcode, string calltypecode)
+ {
+ return BasicSettingDAL.AnDengResponUserSearch(wkshopcode, calltypecode);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏂板鍝嶅簲浜哄憳鏌ヨ宸茬粦瀹氱殑鍝嶅簲浜哄憳]
+ public static ToMessage AnDengDialogResponUserSearch(string wkshopcode, string calltypecode)
+ {
+ return BasicSettingDAL.AnDengDialogResponUserSearch(wkshopcode, calltypecode);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏂板鍝嶅簲浜哄憳鎻愪氦]
+ public static ToMessage AnDengDigoResponUserSeave(string wkshopcode, string calltypecode, string enable, User us, DataTable json)
+ {
+ return BasicSettingDAL.AnDengDigoResponUserSeave(wkshopcode, calltypecode, enable, us, json);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍏佽鍏抽棴]
+ public static ToMessage AnDengResponUserCloseSeave(string wkshopcode, string calltypecode, string enable, User us)
+ {
+ return BasicSettingDAL.AnDengResponUserCloseSeave(wkshopcode, calltypecode, enable, us);
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍒犻櫎]
+ public static ToMessage AnDengResponUserDeleteSeave(string id, string ando_cogfigid,User us)
+ {
+ return BasicSettingDAL.AnDengResponUserDeleteSeave(id, ando_cogfigid,us);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/DeviceManagerBLL.cs b/VueWebCoreApi/DLL/BLL/DeviceManagerBLL.cs
new file mode 100644
index 0000000..4340d76
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/DeviceManagerBLL.cs
@@ -0,0 +1,458 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class DeviceManagerBLL
+ {
+
+
+
+ #region[璁惧缁勬煡璇
+ public static ToMessage DeviceGroupSearch(int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceGroupSearch(startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧缁勬柊澧瀅
+ public static ToMessage AddUpdateDeviceGroup(List<ObjectDataCont> json, string username)
+ {
+ return DeviceManagerDAL.AddUpdateDeviceGroup(json, username);
+ }
+ #endregion
+
+ #region[璁惧缁勫垹闄
+ public static ToMessage DeleteDeviceGroup(string devicegroupcode)
+ {
+ return DeviceManagerDAL.DeleteDeviceGroup(devicegroupcode);
+ }
+ #endregion
+
+
+ #region[璁惧绫诲瀷鏌ユ壘璁惧缁刔
+ public static ToMessage DeviceTypeSelectGroup(string eqptypecode)
+ {
+ return DeviceManagerDAL.DeviceTypeSelectGroup(eqptypecode);
+ }
+ #endregion
+
+ #region[鎵�灞炶溅闂翠笅鎷夋帴鍙
+ public static ToMessage WorkShopSelect(string stu_torgcode, string description)
+ {
+ return DeviceManagerDAL.WorkShopSelect(stu_torgcode, description);
+ }
+ #endregion
+
+ #region[鎵�灞炶溅闂存煡鎵炬墍灞炰骇绾挎帴鍙
+ public static ToMessage WorkShopSelectLine(string workshopcode)
+ {
+ return DeviceManagerDAL.WorkShopSelectLine(workshopcode);
+ }
+ #endregion
+
+
+
+
+
+
+
+
+ #region[璁惧绫诲瀷鏌ヨ]
+ public static ToMessage DeviceTypeSearch()
+ {
+ return DeviceManagerDAL.DeviceTypeSearch();
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷鏂板]
+ public static ToMessage AddUpdateDeviceType(string OperType, List<ObjectDataCont> json, User us)
+ {
+ return DeviceManagerDAL.AddUpdateDeviceType(OperType,json, us);
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷鍒犻櫎]
+ public static ToMessage DeleteDeviceType(string devicetypecode, User us)
+ {
+ return DeviceManagerDAL.DeleteDeviceType(devicetypecode,us);
+ }
+ #endregion
+
+
+ #region [璁惧娓呭崟鏌ヨ]
+ public static ToMessage DeviceMangerSearch(string devicecode, string devicename, string status, string storgcode, string devicetype, int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceMangerSearch(devicecode, devicename, status, storgcode, devicetype, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鏂板缂栬緫]
+ public static ToMessage AddUpdateDeviceManger(string devicecode, string devicename, string devicetype, string storgcode, string status, string OperType, User us)
+ {
+ return DeviceManagerDAL.AddUpdateDeviceManger(devicecode, devicename, devicetype, storgcode, status, OperType, us);
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鍒犻櫎]
+ public static ToMessage DeleteDeviceManger(string devicecode,User us)
+ {
+ return DeviceManagerDAL.DeleteDeviceManger(devicecode,us);
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鏌ョ湅SOP]
+ public static ToMessage DeviceSopSearch(string eqptypecode, string eqpcode)
+ {
+ return DeviceManagerDAL.DeviceSopSearch(eqptypecode,eqpcode);
+ }
+ #endregion
+
+
+ #region[璁惧鐐规椤瑰垪琛ㄦ煡璇
+ public static ToMessage DeviceCheckItemSearch(string checkitemcode, string checkitemname, string checkdescr, string isqrcode, string cycle, int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceCheckItemSearch(checkitemcode, checkitemname, checkdescr, isqrcode, cycle, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧鐐规椤规柊澧炵紪杈慮
+ public static ToMessage AddUpdateDeviceCheckItem(string checkitemid, string checkitemcode, string checkitemname, string checkitemdescr, string cycle, string isqrcode, User us, string operType)
+ {
+ return DeviceManagerDAL.AddUpdateDeviceCheckItem(checkitemid, checkitemcode, checkitemname, checkitemdescr, cycle, isqrcode, us, operType);
+ }
+ #endregion
+
+ #region[璁惧鐐规椤瑰垹闄
+ public static ToMessage DeleteDeviceCheckItem(string checkitemcode)
+ {
+ return DeviceManagerDAL.DeleteDeviceCheckItem(checkitemcode);
+ }
+ #endregion
+
+
+ #region[璁惧淇濆吇椤瑰垪琛ㄦ煡璇
+ public static ToMessage DeviceMaiItemSearch(string maiitemcode, string maiitemname, string maidescr, string isqrcode, int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceMaiItemSearch(maiitemcode, maiitemname, maidescr, isqrcode, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇椤规柊澧炵紪杈慮
+ public static ToMessage AddUpdateDeviceMaiItem(string maiitemid, string maiitemcode, string maiitemname, string maiitemdescr, string isqrcode, User us, string operType)
+ {
+ return DeviceManagerDAL.AddUpdateDeviceMaiItem(maiitemid, maiitemcode, maiitemname, maiitemdescr, isqrcode, us, operType);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇椤瑰垹闄
+ public static ToMessage DeleteDeviceMaiItem(string maiitemcode)
+ {
+ return DeviceManagerDAL.DeleteDeviceMaiItem(maiitemcode);
+ }
+ #endregion
+
+
+
+ #region[璁惧鐐规鏍囧噯鍒楄〃鏌ヨ]
+ public static ToMessage DeviceCheckStandArdSearch(User us, string checkstandcode, string checkstandname, string checkcontr, int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceCheckStandArdSearch(us, checkstandcode, checkstandname, checkcontr, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鏂板銆佺紪杈戣幏鍙栨楠岄」鐩笅鎷夊垪琛╙
+ public static ToMessage DeviceCheckItemSelect()
+ {
+ return DeviceManagerDAL.DeviceCheckItemSelect();
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ public static ToMessage ViewDeviceCheckStanedSearch(string checkstand_code)
+ {
+ return DeviceManagerDAL.ViewDeviceCheckStanedSearch(checkstand_code);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鏂板缂栬緫]
+ public static ToMessage AddUpdateDeviceCheckStandArd(string opertype, RoutEdit json, User us)
+ {
+ return DeviceManagerDAL.AddUpdateDeviceCheckStandArd(opertype, json, us);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鍒犻櫎]
+ public static ToMessage DeleteDeviceCheckStaned(string checkstand_code)
+ {
+ return DeviceManagerDAL.DeleteDeviceCheckStaned(checkstand_code);
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鍏宠仈宸ヤ綔绔欐煡璇
+ public static ToMessage DeviceCheckStanedAssociationEqp(User us, string checkstand_code)
+ {
+ return DeviceManagerDAL.DeviceCheckStanedAssociationEqp(us, checkstand_code);
+ }
+ #endregion
+
+ #region [璁惧鐐规鏍囧噯鍏宠仈宸ヤ綔绔欐彁浜
+ public static ToMessage SaveDeviceCheckStanedAssociationEqp(User us, string checkstand_code, List<ObjectData> json)
+ {
+ return DeviceManagerDAL.SaveDeviceCheckStanedAssociationEqp(us, checkstand_code, json);
+ }
+ #endregion
+
+
+
+ #region[璁惧淇濆吇鏍囧噯鍒楄〃鏌ヨ]
+ public static ToMessage DeviceRepairStandArdSearch(User us, string repairstandcode, string repairstandname, string repairstanddescr, int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceRepairStandArdSearch(us, repairstandcode, repairstandname, repairstanddescr, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鏂板銆佺紪杈戣幏鍙栦繚鍏婚」鐩笅鎷夊垪琛╙
+ public static ToMessage DeviceRepairItemSelect()
+ {
+ return DeviceManagerDAL.DeviceRepairItemSelect();
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ public static ToMessage ViewDeviceRepairStanedSearch(string repairstand_code)
+ {
+ return DeviceManagerDAL.ViewDeviceRepairStanedSearch(repairstand_code);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鏂板缂栬緫]
+ public static ToMessage AddUpdateDeviceRepairStandArd(string opertype, EqpRepair json, User us)
+ {
+ return DeviceManagerDAL.AddUpdateDeviceRepairStandArd(opertype, json, us);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鍒犻櫎]
+ public static ToMessage DeleteDeviceRepairStaned(string repairstand_code)
+ {
+ return DeviceManagerDAL.DeleteDeviceRepairStaned(repairstand_code);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鍏宠仈宸ヤ綔绔欐煡璇
+ public static ToMessage DeviceRepairStanedAssociationEqp(User us, string repairstand_code)
+ {
+ return DeviceManagerDAL.DeviceRepairStanedAssociationEqp(us, repairstand_code);
+ }
+ #endregion
+
+ #region [璁惧淇濆吇鏍囧噯鍏宠仈宸ヤ綔绔欐彁浜
+ public static ToMessage SaveDeviceRepairStanedAssociationEqp(User us, string repairstand_code, List<ObjectData> json)
+ {
+ return DeviceManagerDAL.SaveDeviceRepairStanedAssociationEqp(us, repairstand_code, json);
+ }
+ #endregion
+
+
+ #region[鏃ュ父鐐规,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ public static ToMessage CheckScanDeviceQrCodeData(string eqpcode)
+ {
+ return DeviceManagerDAL.CheckScanDeviceQrCodeData(eqpcode);
+ }
+ #endregion
+
+ #region[鏃ュ父鐐规,鎵弿宸ヤ綅/璁惧浜岀淮鐮佹煡鎵剧偣妫�鏍囧噯]
+ public static ToMessage CheckScanDeviceTemp(string eqpcode)
+ {
+ return DeviceManagerDAL.CheckScanDeviceTemp(eqpcode);
+ }
+ #endregion
+
+ #region[鏃ュ父鐐规,閫夋嫨鎵爜璁惧鍒楄〃甯﹀嚭鐐规椤筣
+ public static ToMessage SelectScanDeviceQrCodeItem(string eqpcode, string checktempcode)
+ {
+ return DeviceManagerDAL.SelectScanDeviceQrCodeItem(eqpcode, checktempcode);
+ }
+ #endregion
+
+ #region[鏃ュ父鐐规銆佹彁浜や繚瀛榏
+ public static ToMessage AppDeviceCheckSave(User us, AppDevicecCheck json)
+ {
+ return DeviceManagerDAL.AppDeviceCheckSave(us, json);
+ }
+ #endregion
+
+
+
+ #region[瀹氭湡淇濆吇,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ public static ToMessage RepairScanDeviceQrCodeData(string eqpcode)
+ {
+ return DeviceManagerDAL.RepairScanDeviceQrCodeData(eqpcode);
+ }
+ #endregion
+
+ #region[瀹氭湡淇濆吇,鎵弿宸ヤ綅/璁惧浜岀淮鐮佹煡鎵句繚鍏绘爣鍑哴
+ public static ToMessage RepairScanDeviceTemp(string eqpcode)
+ {
+ return DeviceManagerDAL.RepairScanDeviceTemp(eqpcode);
+ }
+ #endregion
+
+ #region[鏃ュ父淇濆吇,閫夋嫨鎵爜璁惧鍒楄〃甯﹀嚭淇濆吇椤筣
+ public static ToMessage RepairSelectScanDeviceQrCodeItem(string eqpcode, string repartempcode)
+ {
+ return DeviceManagerDAL.RepairSelectScanDeviceQrCodeItem(eqpcode, repartempcode);
+ }
+ #endregion
+
+ #region[鏃ュ父淇濆吇,鎻愪氦淇濆瓨]
+ public static ToMessage AppDeviceRepairSave(User us, string maintcyc, AppDevicecCheck json)
+ {
+ return DeviceManagerDAL.AppDeviceRepairSave(us, maintcyc, json);
+ }
+ #endregion
+
+
+
+ #region[璁惧缁翠慨鐢宠,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ public static ToMessage MaintainScanDeviceApplyQrCodeData(string eqpcode)
+ {
+ return DeviceManagerDAL.MaintainScanDeviceApplyQrCodeData(eqpcode);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鐢宠,鎻愪氦淇濆瓨]
+ public static ToMessage MaintainScanDeviceApplySave(User us, string eqpcode, string wkshpcode, string faultsourcecode, string faultdescr, IFormFileCollection files)
+ {
+ return DeviceManagerDAL.MaintainScanDeviceApplySave(us, eqpcode, wkshpcode, faultsourcecode, faultdescr, files);
+ }
+ #endregion
+
+
+ #region[璁惧缁翠慨涓婁紶鍥剧墖]
+ public static ToMessage UploadImageSave(User us,string type, IFormFileCollection files)
+ {
+ return DeviceManagerDAL.UploadImageSave(us,type,files);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鍒犻櫎涓婁紶鍥剧墖]
+ public static ToMessage UploadImageDelete(User us, ObjectModel model)
+ {
+ return DeviceManagerDAL.UploadImageDelete(us, model);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鍒楄〃]
+ public static ToMessage RepairScanDeviceQrCodeDataList()
+ {
+ return DeviceManagerDAL.RepairScanDeviceQrCodeDataList();
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鎻愪氦]
+ public static ToMessage RepairScanDeviceSave(User us, DeviceUpdate model)
+ {
+ return DeviceManagerDAL.RepairScanDeviceSave(us,model);
+ }
+ #endregion
+
+
+ #region[缁翠慨楠岃瘉鍒楄〃]
+ public static ToMessage RepairVerificationScanDeviceData()
+ {
+ return DeviceManagerDAL.RepairVerificationScanDeviceData();
+ }
+ #endregion
+
+ #region[缁翠慨楠岃瘉璇︽儏淇℃伅]
+ public static ToMessage RepairVerificationScanDeviceDataSub(string repair_code, string eqpcode, string wkshpcode)
+ {
+ return DeviceManagerDAL.RepairVerificationScanDeviceDataSub(repair_code, eqpcode, wkshpcode);
+ }
+ #endregion
+
+ #region[缁翠慨楠岃瘉鎻愪氦]
+ public static ToMessage RepairVerificationScanDeviceSave(User us, string repairwo, string eqpcode, string wkshpcode, string result)
+ {
+ return DeviceManagerDAL.RepairVerificationScanDeviceSave(us, repairwo, eqpcode, wkshpcode, result);
+ }
+ #endregion
+
+
+
+ #region[璁惧鐐规璁板綍鏌ヨ]
+ public static ToMessage DeviceCheckTakeSearch(User us, string wkshopcode, string eqpcode, string eqpname, string stanedname, string checkuser, string checkopendate, string checkclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceCheckTakeSearch(us, wkshopcode, eqpcode, eqpname, stanedname, checkuser, checkopendate, checkclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧鐐规璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage DeviceCheckSubTakeSearch(string djwo)
+ {
+ return DeviceManagerDAL.DeviceCheckSubTakeSearch(djwo);
+ }
+ #endregion
+
+ #region[璁惧鐐规璁板綍瀵煎嚭]
+ public static ToMessage DeviceCheckTakeOutExcel(User us, string wkshopcode, string eqpcode, string eqpname, string stanedname, string checkuser, string checkopendate, string checkclosedate)
+ {
+ return DeviceManagerDAL.DeviceCheckTakeOutExcel(us, wkshopcode, eqpcode, eqpname, stanedname, checkuser, checkopendate, checkclosedate);
+ }
+ #endregion
+
+
+ #region[璁惧淇濆吇璁板綍鏌ヨ]
+ public static ToMessage DeviceRepairTakeSearch(User us, string wkshopcode, string eqpcode, string eqpname, string stanedname, string repairuser, string repairopendate, string repairclosedate, string repairresult, int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceCheckTakeSearch(us, wkshopcode, eqpcode, eqpname, stanedname, repairuser, repairopendate, repairclosedate, repairresult, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage DeviceRepairSubTakeSearch(string bywo)
+ {
+ return DeviceManagerDAL.DeviceRepairSubTakeSearch(bywo);
+ }
+ #endregion
+
+ #region[璁惧淇濆吇璁板綍瀵煎嚭]
+ public static ToMessage DeviceRepairTakeOutExcel(User us, string wkshopcode, string eqpcode, string eqpname, string stanedname, string repairuser, string repairopendate, string repairclosedate, string repairresult)
+ {
+ return DeviceManagerDAL.DeviceRepairTakeOutExcel(us, wkshopcode, eqpcode, eqpname, stanedname, repairuser, repairopendate, repairclosedate, repairresult);
+ }
+ #endregion
+
+
+
+ #region[璁惧缁翠慨璁板綍鏌ヨ]
+ public static ToMessage DeviceUpdateSearch(User us, string wkshopcode, string eqpcode, string eqpname, string reportuser, string repairuser, string vrifcatuser, string reportopendate, string reportclosedate, string repairopendate, string repairclosedate, string vrifcatopendate, string vrifcatclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return DeviceManagerDAL.DeviceUpdateSearch(us, wkshopcode, eqpcode, eqpname, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage DeviceUpdateSubSearch(string repair_code)
+ {
+ return DeviceManagerDAL.DeviceUpdateSubSearch(repair_code);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨璁板綍瀵煎嚭]
+ public static ToMessage DeviceUpdateOutExcel(User us, string wkshopcode, string eqpcode, string eqpname, string reportuser, string repairuser, string vrifcatuser, string reportopendate, string reportclosedate, string repairopendate, string repairclosedate, string vrifcatopendate, string vrifcatclosedate)
+ {
+ return DeviceManagerDAL.DeviceUpdateOutExcel(us, wkshopcode, eqpcode, eqpname, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate);
+ }
+ #endregion
+
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/ErpSyncMesBLL.cs b/VueWebCoreApi/DLL/BLL/ErpSyncMesBLL.cs
new file mode 100644
index 0000000..e02f8f5
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/ErpSyncMesBLL.cs
@@ -0,0 +1,48 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class ErpSyncMesBLL
+ {
+ #region[鐗╂枡绠$悊锛氳閲忓崟浣嶅悓姝
+ public static ToMessage SaveSearchUnit(User us)
+ {
+ return ErpSyncMesDAL.SaveSearchUnit(us);
+ }
+ #endregion
+
+ #region[鐗╂枡绠$悊锛氬瓨璐ф。妗堝悓姝
+ public static ToMessage SaveSearchMateriel_Info(User us)
+ {
+ return ErpSyncMesDAL.SaveSearchMateriel_Info(us);
+ }
+ #endregion
+
+ #region[鍩虹璁剧疆锛氫粨搴撳悓姝
+ public static ToMessage SaveSearchWareHouse(User us)
+ {
+ return ErpSyncMesDAL.SaveSearchWareHouse(us);
+ }
+ #endregion
+
+ #region[鍩虹璁剧疆锛氬線鏉ュ崟浣嶅悓姝
+ public static ToMessage SeaveSearchPartner(User us)
+ {
+ return ErpSyncMesDAL.SeaveSearchPartner(us);
+ }
+ #endregion
+
+ #region[鐢熶骇绠$悊锛欵RP鐢熶骇璁㈠崟鍚屾]
+ public static ToMessage SeaveSearchErpOrder(User us)
+ {
+ return ErpSyncMesDAL.SeaveSearchErpOrder(us);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/ExcelCheckBLL.cs b/VueWebCoreApi/DLL/BLL/ExcelCheckBLL.cs
new file mode 100644
index 0000000..a90435e
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/ExcelCheckBLL.cs
@@ -0,0 +1,35 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class ExcelCheckBLL
+ {
+ #region銆怑xcel瀵煎叆妯℃澘楠岃瘉銆�
+ public static ToMessage ExcelCheck(string fileCode, List<DataTable> dataTable)
+ {
+ return ExcelCheckDAL.ExcelCheck(fileCode, dataTable);
+ }
+ #endregion
+
+ #region[Excel瀵煎叆鏁版嵁楠岃瘉]
+ public static List<ExcelErro> ExcelCheckData(string fileCode, List<DataTable> dataTable, out string stuCode, out string message, out int count)
+ {
+ return ExcelCheckDAL.ExcelCheckData(fileCode, dataTable, out stuCode, out message, out count);
+ }
+ #endregion
+
+ #region[Excel瀵煎叆鏁版嵁]
+ public static ToMessage ExcelImportSubmit(string FileCode, List<DataTable> dataTable, User us)
+ {
+ return ExcelCheckDAL.ExcelImportSubmit(FileCode, dataTable, us);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/GeneralBasicDataBLL.cs b/VueWebCoreApi/DLL/BLL/GeneralBasicDataBLL.cs
new file mode 100644
index 0000000..b404819
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/GeneralBasicDataBLL.cs
@@ -0,0 +1,182 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class GeneralBasicDataBLL
+ {
+
+ #region [缁勭粐鏋舵瀯鏌ユ壘]
+ public static ToMessage PrentOrganization()
+ {
+ return GeneralBasicDataDAL.PrentOrganization();
+ }
+ #endregion
+
+ #region[缁勭粐鏋舵瀯鍩虹璧勬枡(鏃犲叕鍙�)]
+ public static ToMessage PrentOrganizationNoCompany()
+ {
+ return GeneralBasicDataDAL.PrentOrganizationNoCompany();
+ }
+ #endregion
+
+ #region[宀椾綅鍩虹璧勬枡]
+ public static ToMessage PostPermissions()
+ {
+ return GeneralBasicDataDAL.PostPermissions();
+ }
+ #endregion
+
+ #region[瑙掕壊鍩虹璧勬枡]
+ public static ToMessage RolePermissions()
+ {
+ return GeneralBasicDataDAL.RolePermissions();
+ }
+ #endregion
+
+ #region[鐝粍鍩虹璧勬枡]
+ public static ToMessage GroupsPermissions()
+ {
+ return GeneralBasicDataDAL.GroupsPermissions();
+ }
+ #endregion
+
+ #region[浜哄憳鍩虹璧勬枡]
+ public static ToMessage PersonPermissions()
+ {
+ return GeneralBasicDataDAL.PersonPermissions();
+ }
+ #endregion
+
+ #region[鐝粍鏌ユ壘浜哄憳鍩虹璧勬枡]
+ public static ToMessage GroupsPersonPermissions(string groupcode)
+ {
+ return GeneralBasicDataDAL.GroupsPersonPermissions(groupcode);
+ }
+ #endregion
+
+ #region[鎵�灞炵粍缁囨煡鎵句汉鍛樺熀纭�璧勬枡]
+ public static ToMessage TorgPersonPermissions(string torgcode)
+ {
+ return GeneralBasicDataDAL.TorgPersonPermissions(torgcode);
+ }
+ #endregion
+
+ #region[鎸夐挳鍩虹璧勬枡]
+ public static ToMessage ButtonData()
+ {
+ return GeneralBasicDataDAL.ButtonData();
+ }
+ #endregion
+
+ #region[鏁版嵁鏉冮檺鍩虹璧勬枡]
+ public static ToMessage DataPermissions()
+ {
+ return GeneralBasicDataDAL.DataPermissions();
+ }
+ #endregion
+
+
+ #region[鍗曚綅淇℃伅鏌ヨ]
+ public static ToMessage UnitSerch(string tunittype)
+ {
+ return GeneralBasicDataDAL.UnitSerch(tunittype);
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷淇℃伅鏌ヨ]
+ public static ToMessage DeviceTypeData()
+ {
+ return GeneralBasicDataDAL.DeviceTypeData();
+ }
+ #endregion
+
+ #region[璁惧鍩虹璧勬枡]
+ public static ToMessage EqpPermissions()
+ {
+ return GeneralBasicDataDAL.EqpPermissions();
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷缂栫爜鏌ユ壘璁惧淇℃伅]
+ public static ToMessage EqpTypecodeSeachEqpPermissions(string eqptypecode)
+ {
+ return GeneralBasicDataDAL.EqpTypecodeSeachEqpPermissions(eqptypecode);
+ }
+ #endregion
+
+ #region[浠撳簱鍩虹璧勬枡]
+ public static ToMessage WareHouse()
+ {
+ return GeneralBasicDataDAL.WareHouse();
+ }
+ #endregion
+
+ #region[浠撳簱搴撲綅鍩虹璧勬枡]
+ public static ToMessage WareHouseLocation()
+ {
+ return GeneralBasicDataDAL.WareHouseLocation();
+ }
+ #endregion
+
+ #region[浠撳簱鏌ユ壘浠撲綅淇℃伅]
+ public static ToMessage WareHouseSelectLocation(string warhousecode)
+ {
+ return GeneralBasicDataDAL.WareHouseSelectLocation(warhousecode);
+ }
+ #endregion
+
+ #region[宸ュ簭鍩虹璧勬枡]
+ public static ToMessage StepData()
+ {
+ return GeneralBasicDataDAL.StepData();
+ }
+ #endregion
+
+ #region[缂洪櫡鍩虹璧勬枡]
+ public static ToMessage DefectPermissions()
+ {
+ return GeneralBasicDataDAL.DefectPermissions();
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅熀纭�璧勬枡]
+ public static ToMessage CustomerPermissions()
+ {
+ return GeneralBasicDataDAL.CustomerPermissions();
+ }
+ #endregion
+
+ #region[瀛樿揣鏍戝瀷鍩虹璧勬枡]
+ public static ToMessage InventoryTreePermissions()
+ {
+ return GeneralBasicDataDAL.InventoryTreePermissions();
+ }
+ #endregion
+
+ #region[妯″叿妫�楠岄」鐩笅鎷夊垪琛╙
+ public static ToMessage MouldCheckItemSelect()
+ {
+ return GeneralBasicDataDAL.MouldCheckItemSelect();
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤圭洰涓嬫媺鍒楄〃]
+ public static ToMessage MouldRepairItemSelect()
+ {
+ return GeneralBasicDataDAL.MouldRepairItemSelect();
+ }
+ #endregion
+
+ #region[鏌ヨ宸ュ崟/浜у搧鍩虹璧勬枡]
+ public static ToMessage WrkOrderDataSelect()
+ {
+ return GeneralBasicDataDAL.WrkOrderDataSelect();
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/GridReportBLL.cs b/VueWebCoreApi/DLL/BLL/GridReportBLL.cs
new file mode 100644
index 0000000..33d22d1
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/GridReportBLL.cs
@@ -0,0 +1,20 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class GridReportBLL
+ {
+ #region[MES宸ュ崟鎵撳嵃]
+ public static ToMessage MesOrderPrintSearch(User us, string mesordercode)
+ {
+ return GridReportDAL.MesOrderPrintSearch(us, mesordercode);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/HomeIndexBLL.cs b/VueWebCoreApi/DLL/BLL/HomeIndexBLL.cs
new file mode 100644
index 0000000..28753ad
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/HomeIndexBLL.cs
@@ -0,0 +1,56 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class HomeIndexBLL
+ {
+
+ #region[棣栭〉椤堕儴鍥涗釜(鐢熶骇璁㈠崟鏁般�佺敓浜у伐鍗曟暟銆佸湪鍒跺搧鏁般�佷笉鑹搧鏁�)]
+ public static ToMessage HomeIndexTopSearch(string paydatestartdate, string paydateenddate, User us)
+ {
+ return HomeIndexDAL.HomeIndexTopSearch(paydatestartdate, paydateenddate, us);
+ }
+ #endregion
+
+ #region[棣栭〉涓棿宸ュ簭瀹屾垚杩涘害,涓嶈壇鍝佹帓琛宂
+ public static ToMessage HomeIndexCenterLeftSearch(string paydatestartdate, string paydateenddate, User us)
+ {
+ return HomeIndexDAL.HomeIndexCenterLeftSearch(paydatestartdate, paydateenddate, us);
+ }
+ #endregion
+
+ #region[涓嶈壇鍝佹帓琛屾槑缁哴
+ public static ToMessage HomeIndexCenterRightSearch(string paydatestartdate, string paydateenddate, string defect_code, User us)
+ {
+ return HomeIndexDAL.HomeIndexCenterRightSearch(paydatestartdate, paydateenddate, defect_code, us);
+ }
+ #endregion
+
+ #region[棣栭〉涓棿宸ュ簭瀹屾垚杩涘害鐗╂枡鏄庣粏]
+ public static ToMessage HomeIndexCenterLeftSubSearch(string stepcode,string type, string paydatestartdate, string paydateenddate, User us)
+ {
+ return HomeIndexDAL.HomeIndexCenterLeftSubSearch(stepcode, type,paydatestartdate, paydateenddate, us);
+ }
+ #endregion
+
+ #region[棣栭〉涓笅閿�鍞俊鎭痌
+ public static ToMessage HomeIndexCenterSaOrderSearch(string type, string paydatestartdate, string paydateenddate, User us)
+ {
+ return HomeIndexDAL.HomeIndexCenterSaOrderSearch(type, paydatestartdate, paydateenddate, us);
+ }
+ #endregion
+
+ #region[棣栭〉搴曢儴搴撳瓨淇℃伅]
+ public static ToMessage HomeIndexBottomSearch(User us)
+ {
+ return HomeIndexDAL.HomeIndexBottomSearch(us);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/HourlyWageBLL.cs b/VueWebCoreApi/DLL/BLL/HourlyWageBLL.cs
new file mode 100644
index 0000000..04cb0f0
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/HourlyWageBLL.cs
@@ -0,0 +1,116 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.AttendanceSetting;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class HourlyWageBLL
+ {
+ #region[鑰冨嫟璁剧疆鏌ヨ]
+ public static ToMessage AttendanceSettSearch(string wkshop_code, string creatuser, string paydatestartdate, string paydateenddate, int startNum, int endNum, string prop, string order)
+ {
+ return HourlyWageDAL.AttendanceSettSearch(wkshop_code,creatuser,paydatestartdate,paydateenddate,startNum,endNum,prop,order);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁剧疆鏂板/缂栬緫]
+ public static ToMessage AttendanceSettAddUpdate(AttendanceSett attendancesett,string OperType, User us)
+ {
+ return HourlyWageDAL.AttendanceSettAddUpdate(attendancesett, OperType, us);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁剧疆鍒犻櫎]
+ public static ToMessage AttendanceSettDelete(AttendanceSett attendancesett, User us)
+ {
+ return HourlyWageDAL.AttendanceSettDelete(attendancesett, us);
+ }
+ #endregion
+
+
+ #region[鑰冨嫟鎵撳崱淇℃伅鏌ヨ]
+ public static ToMessage AttendanceSearch(string usercode)
+ {
+ return HourlyWageDAL.AttendanceSearch(usercode);
+ }
+ #endregion
+
+ #region[鑰冨嫟鎵撳崱淇℃伅鎻愪氦]
+ public static ToMessage AttendanceSave(Attendance attendance)
+ {
+ return HourlyWageDAL.AttendanceSave(attendance);
+ }
+ #endregion
+
+
+ #region[鑰冨嫟璁板綍鏌ヨ]
+ public static ToMessage AttendanceRecordSearch(string wkshop_code, string creatusercode, string paydatestartdate, string paydateenddate,string status, int startNum, int endNum, string prop, string order)
+ {
+ return HourlyWageDAL.AttendanceRecordSearch(wkshop_code, creatusercode, paydatestartdate, paydateenddate,status, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鏂板缂栬緫]
+ public static ToMessage AttendanceRecordAddUpdate(AttendanceRecord attendanceRecord, string operType, User us)
+ {
+ return HourlyWageDAL.AttendanceRecordAddUpdate(attendanceRecord, operType,us);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鍒犻櫎]
+ public static ToMessage AttendanceRecordDelete(AttendanceRecord attendanceRecord, User us)
+ {
+ return HourlyWageDAL.AttendanceRecordDelete(attendanceRecord, us);
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鏍哥畻鎻愪氦]
+ public static ToMessage AttendanceRecordSave(AttendanceSave attendanceSave, User us)
+ {
+ return HourlyWageDAL.AttendanceRecordSave(attendanceSave,us);
+ }
+ #endregion
+
+
+ #region[鏃ヨ鏃跺伐璧勬姤琛ㄦ煡璇
+ public static ToMessage DailyWageReportSearch(string wkshop_code, string creatusercode, string paydatestartdate, string paydateenddate, int startNum, int endNum, string prop, string order)
+ {
+ return HourlyWageDAL.DailyWageReportSearch(wkshop_code, creatusercode, paydatestartdate, paydateenddate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鏃ヨ鏃跺伐璧勪慨鏀规墸闄ゆ椂闀裤�佹墸闄よ柂璧刔
+ public static ToMessage DailyWageReportUpdate(DailyWageReport dailyWageReport, User us)
+ {
+ return HourlyWageDAL.DailyWageReportUpdate(dailyWageReport,us);
+ }
+ #endregion
+
+ #region[鏃ヨ鏃跺伐璧勬姤琛ㄥ鍑篯
+ public static ToMessage DailyWageReportExcelSearch(string wkshop_code, string creatusercode, string paydatestartdate, string paydateenddate)
+ {
+ return HourlyWageDAL.DailyWageReportExcelSearch(wkshop_code, creatusercode, paydatestartdate, paydateenddate);
+ }
+ #endregion
+
+
+ #region[鏈堣鏃跺伐璧勬姤琛ㄦ煡璇
+ public static ToMessage MonthlyWageReportSearch(string wkshop_code,string paydatestartdate, string paydateenddate, int startNum, int endNum, string prop, string order)
+ {
+ return HourlyWageDAL.MonthlyWageReportSearch(wkshop_code, paydatestartdate, paydateenddate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鏈堣鏃跺伐璧勬姤琛ㄥ鍑篯
+ public static ToMessage MonthlyWageReportExcelSearch(string wkshop_code, string paydatestartdate, string paydateenddate)
+ {
+ return HourlyWageDAL.MonthlyWageReportExcelSearch(wkshop_code,paydatestartdate, paydateenddate);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/KanBanManagerentBLL.cs b/VueWebCoreApi/DLL/BLL/KanBanManagerentBLL.cs
new file mode 100644
index 0000000..3785f80
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/KanBanManagerentBLL.cs
@@ -0,0 +1,120 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class KanBanManagerentBLL
+ {
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓婄敓浜т俊鎭痌
+ public static ToMessage WorkShopProduceTopData(string wkshopcode)
+ {
+ return KanBanManagerentDAL.WorkShopProduceTopData(wkshopcode);
+ }
+ #endregion
+
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓嬪乏杩戜竴鍛ㄤ笉鑹秼鍔縘
+ public static ToMessage WorkShopProduceBottomLeftData(string wkshopcode)
+ {
+ return KanBanManagerentDAL.WorkShopProduceBottomLeftData(wkshopcode);
+ }
+ #endregion
+
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓嬪彸杩戜竴鏈堜笉鑹粺璁
+ public static ToMessage WorkShopProduceBottomRightData(string wkshopcode)
+ {
+ return KanBanManagerentDAL.WorkShopProduceBottomRightData(wkshopcode);
+ }
+ #endregion
+
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,宸︿笂鐢熶骇璁㈠崟]
+ public static ToMessage WorkShopCompreLeftTop(string wkshopcode)
+ {
+ return KanBanManagerentDAL.WorkShopCompreLeftTop(wkshopcode);
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,鍙充笂閿�鍞鍗昡
+ public static ToMessage WorkShopCompreRightTop()
+ {
+ return KanBanManagerentDAL.WorkShopCompreRightTop();
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,宸︿笅閲囪喘璁㈠崟]
+ public static ToMessage WorkShopCompreLeftBottom()
+ {
+ return KanBanManagerentDAL.WorkShopCompreLeftBottom();
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,鍙充笅搴撳瓨]
+ public static ToMessage WorkShopCompreRightBottom()
+ {
+ return KanBanManagerentDAL.WorkShopCompreRightBottom();
+ }
+ #endregion
+
+
+ #region[浠撳簱鐪嬫澘,宸︿笂浜у搧寰呭叆搴撳垪琛╙
+ public static ToMessage WareHouseTopLeftData()
+ {
+ return KanBanManagerentDAL.WareHouseTopLeftData();
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,宸︿笅濮斿寰呭叆搴撳垪琛╙
+ public static ToMessage WareHouseTopBottomData()
+ {
+ return KanBanManagerentDAL.WareHouseTopBottomData();
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,鍙充笂鎴愬搧搴撱�佸崐鎴愬搧搴搕op5搴撳瓨鎺掕]
+ public static ToMessage WareHouseRightTopData()
+ {
+ return KanBanManagerentDAL.WareHouseRightTopData();
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,鍙充笅鍘熸枡搴撳簱top5搴撳瓨鎺掕]
+ public static ToMessage WareHouseRightBottomData()
+ {
+ return KanBanManagerentDAL.WareHouseRightBottomData();
+ }
+ #endregion
+
+
+ #region[鍢夐┌浠撳簱鐪嬫澘宸︿笂,閲囪喘寰呭叆搴揮
+ public static ToMessage ProcureOutsourcLeftTop()
+ {
+ return KanBanManagerentDAL.ProcureOutsourcLeftTop();
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘宸︿笅,閿�鍞緟鍙戣揣]
+ public static ToMessage ProductConsignmentLeftBottom()
+ {
+ return KanBanManagerentDAL.ProductConsignmentLeftBottom();
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘鍙充笂,杩戜竴鍛ㄩ噰璐緟鍏ュ簱鐗╂枡鎺掕TOP5]
+ public static ToMessage ProcureOutsourcRightTop()
+ {
+ return KanBanManagerentDAL.ProcureOutsourcRightTop();
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘鍙充笅,杩戜竴鍛ㄩ攢鍞緟鍙戣揣浜у搧鎺掕TOP5]
+ public static ToMessage ProductionStockedInRightBottom()
+ {
+ return KanBanManagerentDAL.ProductionStockedInRightBottom();
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/LoginBLL.cs b/VueWebCoreApi/DLL/BLL/LoginBLL.cs
new file mode 100644
index 0000000..eb91198
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/LoginBLL.cs
@@ -0,0 +1,74 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class LoginBLL
+ {
+
+ #region [鐧诲綍鏌ヨ]
+ public static ToMessage LoginSearch(string username, string password)
+ {
+ return LoginDAL.LoginSearch(username, password);
+ }
+ #endregion
+
+ #region [鍐欏叆鐧诲綍璁板綍琛╙
+ public static ToMessage LoginBas(string usercode, string oper_type, string description, string type)
+ {
+ return LoginDAL.LoginBas(usercode, oper_type, description,type);
+ }
+ #endregion
+
+ #region[鏌ヨ鑿滃崟鍔熻兘]
+ public static ToMessage LoginMenu(string usercode, string usertype, User us)
+ {
+ return LoginDAL.LoginMenu(usercode, usertype, us);
+ }
+ #endregion
+
+ #region[淇敼瀵嗙爜]
+ public static ToMessage UpdateUserPassword(User us, string password, string newpassword)
+ {
+ return LoginDAL.UpdateUserPassword(us, password, newpassword);
+ }
+ #endregion
+
+ #region[鐧诲嚭]
+ public static ToMessage LoginOut(User us)
+ {
+ return LoginDAL.LoginOut(us);
+ }
+ #endregion
+
+
+
+ #region[APP瀵嗙爜閲嶇疆]
+ public static ToMessage ResettUserPassword(User us)
+ {
+ return LoginDAL.ResettUserPassword(us);
+ }
+ #endregion
+
+ #region[App鐧诲綍鏌ヨ瀹夌伅鍛煎彨淇℃伅]
+ public static ToMessage LoginAppAnDonMessage(string rid, string usercode, string username, string usertype, string stu_torgcode, string stu_torgtypecode)
+ {
+ return LoginDAL.LoginAppAnDonMessage(rid, usercode, username, usertype, stu_torgcode, stu_torgtypecode);
+ }
+ #endregion
+
+
+ #region[App鐗堟湰鍗囩骇鎺ュ彛]
+ public static ToMessage AppUpgrade()
+ {
+ return LoginDAL.AppUpgrade();
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/MouldManagerBLL.cs b/VueWebCoreApi/DLL/BLL/MouldManagerBLL.cs
new file mode 100644
index 0000000..9af0110
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/MouldManagerBLL.cs
@@ -0,0 +1,505 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class MouldManagerBLL
+ {
+ #region[妯″叿娓呭崟鍒楄〃鏌ヨ]
+ public static ToMessage MouldMangerSearch(string mouldstaus, string onstate, string mouldcode, string mouldname, string mouldspec, string createuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldMangerSearch(mouldstaus, onstate, mouldcode, mouldname, mouldspec, createuser, opendate, closedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鏂板缂栬緫]
+ public static ToMessage AddUpdateMouldManger(string mouldcode, string mouldname, string mouldspec,string warehousecode,string location_code, string surplife, string resilife, string status, string mouldpart, string opertype, User us)
+ {
+ return MouldManagerDAL.AddUpdateMouldManger(mouldcode, mouldname, mouldspec, warehousecode, location_code, surplife, resilife, status, mouldpart, opertype, us);
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鏌ョ湅灞ュ巻]
+ public static ToMessage MoldResumeSearch(string mouldcode, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MoldResumeSearch(mouldcode,opendate, closedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鍒犻櫎]
+ public static ToMessage DeleteMouldManger(string mouldcode, User us)
+ {
+ return MouldManagerDAL.DeleteMouldManger(mouldcode, us);
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规椤瑰垪琛ㄦ煡璇
+ public static ToMessage MouldCheckItemSearch(string checkitemcode, string checkitemname, string checkdescr, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldCheckItemSearch(checkitemcode, checkitemname, checkdescr, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿鐐规椤规柊澧炵紪杈慮
+ public static ToMessage AddUpdateMouldCheckItem(string checkitemid, string checkitemcode, string checkitemname, string checkitemdescr, User us, string opertype)
+ {
+ return MouldManagerDAL.AddUpdateMouldCheckItem(checkitemid, checkitemcode, checkitemname, checkitemdescr, us, opertype);
+ }
+ #endregion
+
+ #region[妯″叿鐐规椤瑰垹闄
+ public static ToMessage DeleteMouldCheckItem(string checkitemcode,User us)
+ {
+ return MouldManagerDAL.DeleteMouldCheckItem(checkitemcode,us);
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规鏍囧噯鍒楄〃鏌ヨ]
+ public static ToMessage DeviceCheckStandArdSearch(string checkstandcode, string checkstandname, string checkstandescr, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.DeviceCheckStandArdSearch(checkstandcode, checkstandname, checkstandescr, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ public static ToMessage ViewMouldCheckStanedSearch(string checkstand_code)
+ {
+ return MouldManagerDAL.ViewMouldCheckStanedSearch(checkstand_code);
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鏂板缂栬緫]
+ public static ToMessage AddUpdateMouldCheckStandArd(string opertype, RoutEdit json, User us)
+ {
+ return MouldManagerDAL.AddUpdateMouldCheckStandArd(opertype, json, us);
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鍒犻櫎]
+ public static ToMessage DeleteMouldCheckStaned(string checkstand_code, User us)
+ {
+ return MouldManagerDAL.DeleteMouldCheckStaned(checkstand_code, us);
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鍏宠仈妯″叿鏌ヨ]
+ public static ToMessage CheckStanedAssociationMould(string checkstand_code)
+ {
+ return MouldManagerDAL.CheckStanedAssociationMould(checkstand_code);
+ }
+ #endregion
+
+ #region [妯″叿鐐规鏍囧噯鍏宠仈妯″叿鎻愪氦]
+ public static ToMessage SaveCheckStanedAssociationMould(string checkstand_code, User us, List<ObjectData> json)
+ {
+ return MouldManagerDAL.SaveCheckStanedAssociationMould(checkstand_code, us, json);
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇椤瑰垪琛ㄦ煡璇
+ public static ToMessage MouldMaiItemSearch(string maiitemcode, string maiitemname, string maidescr, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldMaiItemSearch(maiitemcode, maiitemname, maidescr, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤规柊澧炵紪杈慮
+ public static ToMessage AddUpdateMouldMaiItem(string maiitemid, string maiitemcode, string maiitemname, string maiitemdescr, User us, string opertype)
+ {
+ return MouldManagerDAL.AddUpdateMouldMaiItem(maiitemid, maiitemcode, maiitemname, maiitemdescr, us, opertype);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤瑰垹闄
+ public static ToMessage DeleteMouldMaiItem(string maiitemcode, User us)
+ {
+ return MouldManagerDAL.DeleteMouldMaiItem(maiitemcode, us);
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇鏍囧噯鍒楄〃鏌ヨ]
+ public static ToMessage MouldRepairStandArdSearch(string repairstandcode, string repairstandname, string repairstandescr, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldRepairStandArdSearch(repairstandcode, repairstandname, repairstandescr, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ public static ToMessage ViewMouldRepairStanedSearch(string repairstand_code)
+ {
+ return MouldManagerDAL.ViewMouldRepairStanedSearch(repairstand_code);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯鏂板缂栬緫]
+ public static ToMessage AddUpdateMouldRepairStandArd(string opertype, RoutEdit json, User us)
+ {
+ return MouldManagerDAL.AddUpdateMouldRepairStandArd(opertype, json, us);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯鍒犻櫎]
+ public static ToMessage DeleteMouldRepairStaned(string repairstand_code, User us)
+ {
+ return MouldManagerDAL.DeleteMouldRepairStaned(repairstand_code, us);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿鏌ヨ]
+ public static ToMessage RepairStanedAssociationMould(string repairstand_code)
+ {
+ return MouldManagerDAL.RepairStanedAssociationMould(repairstand_code);
+ }
+ #endregion
+
+ #region [妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿鎻愪氦]
+ public static ToMessage SaveRepairStanedAssociationMould(string repairstand_code, User us, List<ObjectData> json)
+ {
+ return MouldManagerDAL.SaveRepairStanedAssociationMould(repairstand_code, us, json);
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规,鎵弿妯″叿浜岀淮鐮乚
+ public static ToMessage CheckScanMouldQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.CheckScanMouldQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿鐐规,鎵弿妯″叿浜岀淮鐮佹煡鎵剧偣妫�鏍囧噯]
+ public static ToMessage CheckScanMouldTemp(string mouldcode)
+ {
+ return MouldManagerDAL.CheckScanMouldTemp(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿鐐规,閫夋嫨鎵爜妯″叿銆佺偣妫�鏍囧噯甯﹀嚭鐐规椤筣
+ public static ToMessage SelectScanMouldQrCodeItem(string mouldcode, string checktempcode)
+ {
+ return MouldManagerDAL.SelectScanMouldQrCodeItem(mouldcode,checktempcode);
+ }
+ #endregion
+
+ #region[妯″叿鐐规銆佹彁浜や繚瀛榏
+ public static ToMessage MouldCheckSave(string menucode, User us, AppDevicecCheck json)
+ {
+ return MouldManagerDAL.MouldCheckSave(menucode,us, json);
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇,鎵弿妯″叿浜岀淮鐮乚
+ public static ToMessage RepairScanMouldQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.RepairScanMouldQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,鎵弿妯″叿浜岀淮鐮佹煡鎵句繚鍏绘爣鍑哴
+ public static ToMessage RepairScanMouldTemp(string mouldcode)
+ {
+ return MouldManagerDAL.RepairScanMouldTemp(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,閫夋嫨鎵爜妯″叿鍒楄〃甯﹀嚭淇濆吇椤筣
+ public static ToMessage RepairSelectScanMouldQrCodeItem(string mouldcode, string repartempcode)
+ {
+ return MouldManagerDAL.RepairSelectScanMouldQrCodeItem(mouldcode,repartempcode);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,鎻愪氦淇濆瓨]
+ public static ToMessage MouldRepairSave(string menucode, User us, AppDevicecCheck json)
+ {
+ return MouldManagerDAL.MouldRepairSave(menucode, us,json);
+ }
+ #endregion
+
+
+ #region[妯″叿淇℃伅鏌ヨ,鎵弿妯″叿浜岀淮鐮乚
+ public static ToMessage ScanMouldQrCodeMessageData(string mouldcode)
+ {
+ return MouldManagerDAL.ScanMouldQrCodeMessageData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿淇℃伅鏌ヨ鏄庣粏]
+ public static ToMessage ScanMouldQrCodeMessageSubData(string mouldcode)
+ {
+ return MouldManagerDAL.ScanMouldQrCodeMessageSubData(mouldcode);
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨鐢宠,鎵弿妯″叿浜岀淮鐮乚
+ public static ToMessage MaintainScanMouldApplyQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.MaintainScanMouldApplyQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鐢宠,鎻愪氦淇濆瓨]
+ public static ToMessage MaintainScanMouldApplySave(string menucode, string mouldcode, string faultsourcecode, string faultdescr, User us, IFormFileCollection files)
+ {
+ return MouldManagerDAL.MaintainScanMouldApplySave(menucode,mouldcode, faultsourcecode,faultdescr,us,files);
+ }
+ #endregion
+
+
+ #region[妯″叿寰呯淮淇俊鎭垪琛╙
+ public static ToMessage RepairScanMouldQrCodeDataList(string mouldcode)
+ {
+ return MouldManagerDAL.RepairScanMouldQrCodeDataList(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨鎻愪氦]
+ public static ToMessage RepairScanMouldSave(string menucode, string docu_code, string mouldcode, string faultdescr, string is_stoprepair, string repaircontent, User us, IFormFileCollection files)
+ {
+ return MouldManagerDAL.RepairScanMouldSave(menucode,docu_code, mouldcode,faultdescr,is_stoprepair,repaircontent,us,files);
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨寰呴獙璇佸垪琛╙
+ public static ToMessage RepairVerificationScanMouldData(string mouldcode)
+ {
+ return MouldManagerDAL.RepairVerificationScanMouldData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨寰呴獙璇佽鎯呬俊鎭痌
+ public static ToMessage RepairVerificationScanMouldDataSub(string repair_code, string mouldcode)
+ {
+ return MouldManagerDAL.RepairVerificationScanMouldDataSub(repair_code,mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨楠岃瘉鎻愪氦]
+ public static ToMessage RepairVerificationScanMouldSave(string repairwo, string mouldcode, string result,string surp_life, User us)
+ {
+ return MouldManagerDAL.RepairVerificationScanMouldSave(repairwo, mouldcode,result, surp_life, us);
+ }
+ #endregion
+
+
+ #region[妯″叿涓婃満,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldUpQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.MouldUpQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿涓婃満,閫夋嫨鏈笂妯¤澶嘳
+ public static ToMessage MouldEqpPermissions()
+ {
+ return MouldManagerDAL.MouldEqpPermissions();
+ }
+ #endregion
+
+ #region[妯″叿涓婃満鎻愪氦]
+ public static ToMessage MouldUpSave(string mouldcode, string eqp_code, string description, User us)
+ {
+ return MouldManagerDAL.MouldUpSave(mouldcode,eqp_code,description,us);
+ }
+ #endregion
+
+
+ #region[妯″叿涓嬫満,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldDownQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.MouldDownQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿涓嬫満鎻愪氦]
+ public static ToMessage MouldDownSave(string mouldcode, string eqp_code, string usecount_life, string description, User us)
+ {
+ return MouldManagerDAL.MouldDownSave(mouldcode, eqp_code, usecount_life, description, us);
+ }
+ #endregion
+
+
+ #region[妯″叿澶栧��,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldLendOutQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.MouldLendOutQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿澶栧�熸彁浜
+ public static ToMessage MouldLendOutSave(string mouldcode, string description, User us)
+ {
+ return MouldManagerDAL.MouldLendOutSave(mouldcode, description,us);
+ }
+ #endregion
+
+
+ #region[妯″叿褰掕繕,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldReturnQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.MouldReturnQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿褰掕繕鎻愪氦]
+ public static ToMessage MouldReturnSave(string mouldcode, string description, User us)
+ {
+ return MouldManagerDAL.MouldReturnSave(mouldcode, description,us);
+ }
+ #endregion
+
+
+ #region[妯″叿鍏ュ簱,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldInWareHouseQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.MouldInWareHouseQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿鍏ュ簱鎻愪氦]
+ public static ToMessage MouldInWareHouseSave(string mouldcode, string warehousecode,string locationcode, string description, User us)
+ {
+ return MouldManagerDAL.MouldInWareHouseSave(mouldcode, warehousecode, locationcode, description, us);
+ }
+ #endregion
+
+
+ #region[妯″叿鍑哄簱,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldOutWareHouseQrCodeData(string mouldcode)
+ {
+ return MouldManagerDAL.MouldOutWareHouseQrCodeData(mouldcode);
+ }
+ #endregion
+
+ #region[妯″叿鍑哄簱鎻愪氦]
+ public static ToMessage MouldOutWareHouseSave(string mouldcode, string warehousecode,string locationcode, string description, User us)
+ {
+ return MouldManagerDAL.MouldOutWareHouseSave(mouldcode, warehousecode, locationcode, description, us);
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规璁板綍鏌ヨ]
+ public static ToMessage MouldCheckTakeSearch(string mouldcode, string mouldname, string mouldspec, string stanedcode, string stanedname, string checkuser, string checkopendate, string checkclosedate,string checkrequest, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldCheckTakeSearch(mouldcode, mouldname, mouldspec, stanedcode, stanedname, checkuser, checkopendate, checkclosedate, checkrequest, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿鐐规璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage MouldCheckSubTakeSearch(string id)
+ {
+ return MouldManagerDAL.MouldCheckSubTakeSearch(id);
+ }
+ #endregion
+
+ #region[妯″叿鐐规璁板綍瀵煎嚭]
+ public static ToMessage MouldCheckTakeOutExcel(string mouldcode, string mouldname, string mouldspec, string stanedcode, string stanedname, string checkuser, string checkopendate, string checkclosedate,string checkrequest)
+ {
+ return MouldManagerDAL.MouldCheckTakeOutExcel(mouldcode, mouldname, mouldspec, stanedcode, stanedname, checkuser, checkopendate, checkclosedate, checkrequest);
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇璁板綍鏌ヨ]
+ public static ToMessage MouldRepairTakeSearch(string mouldcode, string mouldname, string mouldspec, string stanedcode, string stanedname, string repairuser, string repairopendate, string repairclosedate, string repairresult, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldRepairTakeSearch(mouldcode, mouldname, mouldspec, stanedcode, stanedname, repairuser, repairopendate, repairclosedate, repairresult, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage MouldRepairSubTakeSearch(string id)
+ {
+ return MouldManagerDAL.MouldRepairSubTakeSearch(id);
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇璁板綍瀵煎嚭]
+ public static ToMessage MouldRepairTakeOutExcel(string mouldcode, string mouldname, string mouldspec, string stanedcode, string stanedname, string repairuser, string repairopendate, string repairclosedate, string repairresult)
+ {
+ return MouldManagerDAL.MouldRepairTakeOutExcel(mouldcode, mouldname, mouldspec, stanedcode, stanedname, repairuser, repairopendate, repairclosedate, repairresult);
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨璁板綍鏌ヨ]
+ public static ToMessage MouldUpdateSearch(string mouldcode, string mouldname, string mouldspec, string reportuser, string repairuser, string vrifcatuser, string reportopendate, string reportclosedate, string repairopendate, string repairclosedate, string vrifcatopendate, string vrifcatclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldUpdateSearch(mouldcode, mouldname, mouldspec, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage MouldUpdateSubSearch(string repair_code)
+ {
+ return MouldManagerDAL.MouldUpdateSubSearch(repair_code);
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨璁板綍瀵煎嚭]
+ public static ToMessage MouldUpdateOutExcel(string mouldcode, string mouldname, string mouldspec, string reportuser, string repairuser, string vrifcatuser, string reportopendate, string reportclosedate, string repairopendate, string repairclosedate, string vrifcatopendate, string vrifcatclosedate)
+ {
+ return MouldManagerDAL.MouldUpdateSearch(mouldcode, mouldname, mouldspec, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate);
+ }
+ #endregion
+
+
+ #region[妯″叿涓婁笅鏈鸿褰曟煡璇
+ public static ToMessage MouldUpDownMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string devicecode, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldUpDownMachinesSearch(mouldcode, mouldname, mouldspec, type, devicecode, operuser, opendate, closedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿涓婁笅鏈鸿瀵煎嚭Excel]
+ public static ToMessage MouldUpDownMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string devicecode, string operuser, string opendate, string closedate)
+ {
+ return MouldManagerDAL.MouldUpDownMachinesOutExcel(mouldcode, mouldname, mouldspec, type, devicecode, operuser, opendate, closedate);
+ }
+ #endregion
+
+
+ #region[妯″叿鍊熻繕璁板綍鏌ヨ]
+ public static ToMessage MouldCirculateMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldCirculateMachinesSearch(mouldcode, mouldname, mouldspec, type, operuser, opendate, closedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿鍊熻繕璁板綍瀵煎嚭]
+ public static ToMessage MouldCirculateMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string operuser, string opendate, string closedate)
+ {
+ return MouldManagerDAL.MouldCirculateMachinesOutExcel(mouldcode, mouldname, mouldspec, type, operuser, opendate, closedate);
+ }
+ #endregion
+
+
+ #region[妯″叿鍑哄叆搴撹褰曟煡璇
+ public static ToMessage MouldInOutMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string warehousecode, string locationcode, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ return MouldManagerDAL.MouldInOutMachinesSearch(mouldcode, mouldname, mouldspec, type, warehousecode, locationcode, operuser, opendate, closedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[妯″叿鍑哄叆搴撹褰曞鍑篯
+ public static ToMessage MouldInOutMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string warehousecode, string locationcode, string operuser, string opendate, string closedate)
+ {
+ return MouldManagerDAL.MouldInOutMachinesOutExcel(mouldcode, mouldname, mouldspec, type, warehousecode, locationcode, operuser, opendate, closedate);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/ProductModelBLL.cs b/VueWebCoreApi/DLL/BLL/ProductModelBLL.cs
new file mode 100644
index 0000000..d90377b
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/ProductModelBLL.cs
@@ -0,0 +1,118 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.UnitMaterial;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class ProductModelBLL
+ {
+ #region[璁¢噺鍗曚綅缁勪俊鎭痌
+ public static ToMessage TUnitGroup()
+ {
+ return ProductModelDAL.TUnitGroup();
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅淇℃伅鍒楄〃]
+ public static ToMessage TUnitData(string tunittype, string tunitgroupcode, int startNum, int endNum, string prop, string order)
+ {
+ return ProductModelDAL.TUnitData(tunittype, tunitgroupcode, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅缂栬緫鑾峰彇缁勬槑缁哴
+ public static ToMessage TUnitGroupProject(string unitcode, string isgroup, User us)
+ {
+ return ProductModelDAL.TUnitGroupProject(unitcode,isgroup,us);
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅鏂板銆佺紪杈戜繚瀛榏
+ public static ToMessage AddUpdateTUnit(string menucode,string data_sources, string tunittype, string tunitgroupcode, string OperType, List<Unit> listjson, User us)
+ {
+ return ProductModelDAL.AddUpdateTUnit(menucode, data_sources,tunittype, tunitgroupcode, OperType, listjson, us);
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅鍒犻櫎]
+ public static ToMessage DeleteTUnit(string data_sources, string tunittype, string tunitgroupcode, string tunitcode, User us)
+ {
+ return ProductModelDAL.DeleteTUnit(data_sources, tunittype, tunitgroupcode, tunitcode, us);
+ }
+ #endregion
+
+
+
+ #region[瀛樿揣鍒嗙被淇℃伅]
+ public static ToMessage TMaterielClassTree()
+ {
+ return ProductModelDAL.TMaterielClassTree();
+ }
+ #endregion
+
+ #region[瀛樿揣鍒嗙被鏂板/缂栬緫鎻愪氦]
+ public static ToMessage TMaterielClassTreeAddUpdate(string data_sources, string inventoryclasscode, string inventoryclassname, string parentcode, string OperType, User us)
+ {
+ return ProductModelDAL.TMaterielClassTreeAddUpdate(data_sources,inventoryclasscode, inventoryclassname, parentcode, OperType,us);
+ }
+ #endregion
+
+ #region[瀛樿揣鍒嗙被鍒犻櫎]
+ public static ToMessage TMaterielClassTreeDelete(string inventoryclasscode, User us)
+ {
+ return ProductModelDAL.TMaterielClassTreeDelete(inventoryclasscode, us);
+ }
+ #endregion
+
+
+ #region[瀛樿揣淇℃伅鍒楄〃]
+ public static ToMessage TMaterielData(string inventoryclasscode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ {
+ return ProductModelDAL.TMaterielData(inventoryclasscode, partcode, partname, partspec, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[瀛樿揣淇℃伅鏂板/缂栬緫淇濆瓨]
+ public static ToMessage TMaterielAddUpdate(string data_sources, string partcode, string partname, string partspec, string inventoryclasscode, string unittypcode, string unitcode, string unitsubcode, string idSubUnitByReport, string idUnitByStock, string idUnitByPurchase, string idUnitBySale, string idunitbymanufacture, string isPurchase, string isSale, string isMadeSelf, string isMaterial, string isMadeRequest, string idwarehouse, string status, string OperType, User us)
+ {
+ return ProductModelDAL.TMaterielAddUpdate(data_sources, partcode, partname, partspec, inventoryclasscode, unittypcode, unitcode, unitsubcode, idSubUnitByReport,
+ idUnitByStock, idUnitByPurchase, idUnitBySale, idunitbymanufacture, isPurchase, isSale, isMadeSelf, isMaterial, isMadeRequest, idwarehouse, status, OperType, us);
+ }
+ #endregion
+
+ #region[瀛樿揣淇℃伅鍒犻櫎]
+ public static ToMessage TMaterielDelete(string data_sources, string partcode, User us)
+ {
+ return ProductModelDAL.TMaterielDelete(data_sources, partcode,us);
+ }
+ #endregion
+
+ #region[瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎鎴栧伐搴�)鏌ヨ]
+ public static ToMessage TMaterielFileAssociationRoute(string partcode,User us)
+ {
+ return ProductModelDAL.TMaterielFileAssociationRoute(partcode,us);
+ }
+ #endregion
+
+ #region[瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎鎴栧伐搴�)鎻愪氦]
+ public static ToMessage SaveTMaterielFile(User us, List<MaterialCraftsSave> json)
+ {
+ return ProductModelDAL.SaveTMaterielFile(us,json);
+ }
+ #endregion
+
+
+
+ #region[宸ュ崟浜у搧淇℃伅涓嬫媺妗嗘煡璇
+ public static ToMessage PartSelect()
+ {
+ return ProductModelDAL.PartSelect();
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/ProductionManagementBLL.cs b/VueWebCoreApi/DLL/BLL/ProductionManagementBLL.cs
new file mode 100644
index 0000000..473d774
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/ProductionManagementBLL.cs
@@ -0,0 +1,413 @@
+锘縰sing Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class ProductionManagementBLL
+ {
+ #region[鑾峰彇鍗曟嵁鍙穄
+ public static ToMessage ProductInHouseOrderCodeSearch(string rightcode)
+ {
+ return ProductionManagementDAL.ProductInHouseOrderCodeSearch(rightcode);
+ }
+ #endregion
+
+
+
+
+ #region[MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ]
+ public static ToMessage MesBadOrderSearch(string mesordercode, string sourceorder, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ return ProductionManagementDAL.MesBadOrderSearch(mesordercode, sourceorder, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order);
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鏌ユ壘宸ヨ壓璺嚎涓嬫媺鎺ュ彛]
+ public static ToMessage PartSelectRoute(string partcode, string wkshopcode)
+ {
+ return ProductionManagementDAL.PartSelectRoute(partcode, wkshopcode);
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鏌ユ壘杞﹂棿涓嬫媺鎺ュ彛]
+ public static ToMessage RouteSelectWkshop(string stu_torgcode, string stu_torgtypecode, string partcode)
+ {
+ return ProductionManagementDAL.RouteSelectWkshop(stu_torgcode, stu_torgtypecode, partcode);
+ }
+ #endregion
+
+ #region[鏍规嵁閫夋嫨宸ヨ壓璺嚎鏌ョ湅宸ュ簭鎺ュ彛]
+ public static ToMessage SelectRouteStep(string routecode)
+ {
+ return ProductionManagementDAL.SelectRouteStep(routecode);
+ }
+ #endregion
+
+ #region銆愮敓浜х鐞嗐�佸伐鍗曟柊澧炪�佺紪杈戞椂,閫夋嫨鎺掔▼鏄椂鑾峰彇鐗╂枡娓呭崟鐗堟湰鍙枫��
+ public static ToMessage JobCreationSonAddVison(string partnumber)
+ {
+ return ProductionManagementDAL.JobCreationSonAddVison(partnumber);
+ }
+ #endregion
+
+ #region[宸ュ崟娲惧彂閫夋嫨宸ヨ壓璺嚎鎴栭�夋嫨鐢熶骇杞﹂棿鏃跺垽鏂粦瀹氭潯浠禲
+ public static ToMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode)
+ {
+ return ProductionManagementDAL.SelectRouteOrWkshop(partcode, routecode, wkshopcode);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+ public static ToMessage AddMesOrderCodeSearch()
+ {
+ return ProductionManagementDAL.AddMesOrderCodeSearch();
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
+ public static ToMessage AddUpdateMesOrder(string mesorderstus, string mesordercode, string sourceorder, string ordertype, string partcode, string mesqty, string routecode, string wkshopcode, string planstartdate, string planenddate, string orderlev, string username, string opertype, string is_aps, string bom_id)
+ {
+ return ProductionManagementDAL.AddUpdateMesOrder(mesorderstus, mesordercode, sourceorder, ordertype, partcode, mesqty, routecode, wkshopcode, planstartdate, planenddate, orderlev, username, opertype, is_aps, bom_id);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鍒犻櫎]
+ public static ToMessage DeleteMesOrder(string souceid, string wocode, string m_po, string orderqty)
+ {
+ return ProductionManagementDAL.DeleteMesOrder(souceid, wocode, m_po, orderqty);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鍏抽棴]
+ public static ToMessage ClosedMesOrder(string username, string wocode, string m_po)
+ {
+ return ProductionManagementDAL.ClosedMesOrder(username, wocode, m_po);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ョ湅宸ュ簭浠诲姟]
+ public static ToMessage SearchWorkStep(string wo_code)
+ {
+ return ProductionManagementDAL.SearchWorkStep(wo_code);
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇褰撳墠宸ュ簭瀵瑰簲鐨勮澶�(鑷埗)]
+ public static ToMessage MesOrderStepEqpSearch(string orderstepqrcode)
+ {
+ return ProductionManagementDAL.MesOrderStepEqpSearch(orderstepqrcode);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇褰撳墠宸ュ簭瀵瑰簲鐨勪緵鏂�(澶栧崗)]
+ public static ToMessage MesOrderWxStepEqpSearch(string orderstepqrcode)
+ {
+ return ProductionManagementDAL.MesOrderWxStepEqpSearch(orderstepqrcode);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟]
+ public static ToMessage MesOrderStepSearch(string stu_torgcode, string stu_torgtypecode, string orderstepqrcode, int startNum, int endNum, string prop, string order)
+ {
+ return ProductionManagementDAL.MesOrderStepSearch(stu_torgcode, stu_torgtypecode, orderstepqrcode, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(澶栧崗)]
+ public static ToMessage MesOrderWxStepSearch(string stu_torgcode, string stu_torgtypecode, string orderstepqrcode, int startNum, int endNum, string prop, string order)
+ {
+ return ProductionManagementDAL.MesOrderWxStepSearch(stu_torgcode, stu_torgtypecode, orderstepqrcode, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇)]
+ public static ToMessage MesOrderNgStepSearch(string stu_torgcode, string stu_torgtypecode, string orderstepqrcode, int startNum, int endNum, string prop, string order)
+ {
+ return ProductionManagementDAL.MesOrderNgStepSearch(stu_torgcode, stu_torgtypecode, orderstepqrcode, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇鏄庣粏)]
+ public static ToMessage MesOrderNgSubStepSearch(string orderstepqrcode)
+ {
+ return ProductionManagementDAL.MesOrderNgSubStepSearch(orderstepqrcode);
+ }
+ #endregion
+
+ #region [鐢熶骇寮�鎶ュ伐锛氬紑宸�(寮�濮�/鎶ュ伐)/澶栧崗鍙戞枡鏃舵潯浠跺垽鏂強鏁版嵁杩斿洖鎺ュ彛]
+ public static ToMessage MesOrderStepStart(string OperType, string stu_torgcode, string SelectType, string orderstepqrcode)
+ {
+ return ProductionManagementDAL.MesOrderStepStart(OperType, stu_torgcode, SelectType, orderstepqrcode);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氬紑宸ユ椂鑾峰彇璁惧涓嬫媺鍒楄〃]
+ public static ToMessage MesOrderStepStartSelectEqp(string orderstepqrcode)
+ {
+ return ProductionManagementDAL.MesOrderStepStartSelectEqp(orderstepqrcode);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氭姤宸ユ椂鑾峰彇鐢熶骇鐝粍涓嬫媺妗哴
+ public static ToMessage MesOrderStepReportSelectUserGroup(string stu_torgcode, string stu_torgtypecode, string wkshopcode)
+ {
+ return ProductionManagementDAL.MesOrderStepReportSelectUserGroup(stu_torgcode, stu_torgtypecode, wkshopcode);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氭牴鎹敓浜х彮缁勬煡鎵句汉鍛樺垪琛╙
+ public static ToMessage MesOrderGroupSelectUser(string stu_torgcode, string usergroupcode)
+ {
+ return ProductionManagementDAL.MesOrderGroupSelectUser(stu_torgcode, usergroupcode);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氫汉鍛樹笅鎷夊垪琛╙
+ public static ToMessage MesOrderSelectUser(string usercode)
+ {
+ return ProductionManagementDAL.MesOrderSelectUser(usercode);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氬彂鏂�/鏀舵枡鏃惰幏鍙栧鍗忎笅鎷夊垪琛╙
+ public static ToMessage MesOrderStepSelectWX(string orderstepqrcode)
+ {
+ return ProductionManagementDAL.MesOrderStepSelectWX(orderstepqrcode);
+ }
+ #endregion
+
+ #region[鐢熶骇鎶ュ伐锛氭姤宸�/澶栧崗鏀舵枡 鑾峰彇涓嶈壇鍘熷洜涓嬫媺鍒楄〃]
+ public static ToMessage MesOrderStepSelectCause(string orderstepqrcode)
+ {
+ return ProductionManagementDAL.MesOrderStepSelectCause(orderstepqrcode);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,寮�宸�(寮�濮�)鎻愪氦]
+ public static ToMessage SavaMesOrderStepStart(string mesordercode, string partcode, string stepseq, string stepcode, string eqpcode, string taskqty, string startqty, string username)
+ {
+ return ProductionManagementDAL.SavaMesOrderStepStart(mesordercode, partcode, stepseq, stepcode, eqpcode, taskqty, startqty, username);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鎶ュ伐鎻愪氦]
+ public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode, string eqpcode, string inbarcode, string reckway, string usergroupcode, string reportuser, string taskqty, string startqty, string reportqty, string ngqty, string badcode, string remarks, string username)
+ {
+ return ProductionManagementDAL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, eqpcode, inbarcode, reckway, usergroupcode, reportuser, taskqty, startqty, reportqty, ngqty, badcode, remarks, username);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鍙戞枡鎻愪氦]
+ public static ToMessage SavaMesOrderStepOut(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string outuser, string taskqty, string fqty, string username)
+ {
+ return ProductionManagementDAL.SavaMesOrderStepOut(mesordercode, partcode, stepseq, stepcode, wxcode, outuser, taskqty, fqty, username);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐, 鏀舵枡鎻愪氦]
+ public static ToMessage SavaMesOrderStepIn(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string inbarcode, string inuser, string taskqty, string sqty, string ngqty, string badcode, string remarks, string username)
+ {
+ return ProductionManagementDAL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty, ngqty, badcode, remarks, username);
+ }
+ #endregion
+
+ #region[涓嶈壇澶勭悊,鎻愪氦]
+ public static ToMessage EditOrderNgStepSeave(ReportDefectHandle json, string username)
+ {
+ return ProductionManagementDAL.EditOrderNgStepSeave(json, username);
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠屾壂鐮佽幏鍙栦换鍔′俊鎭痌
+ public static ToMessage MesOrderStepCheckSearch(string stu_torgcode, string orderstepqrcode, string checktype)
+ {
+ return ProductionManagementDAL.MesOrderStepCheckSearch(stu_torgcode, orderstepqrcode, checktype);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠屾牴鎹�夋嫨鐨勬楠屾柟妗堟煡鎵炬楠岄」鐩甝
+ public static ToMessage MesOrderStepCheckItemList(string checkstandcode)
+ {
+ return ProductionManagementDAL.MesOrderStepCheckItemList(checkstandcode);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠�,鎻愪氦]
+ public static ToMessage SaveMesOrderStepCheckItem(string stu_torgcode, string wocode, string partcode, string stepcode, string checkstandcode, string check_type, string sampmethod, string qualitystatus, string labqty, string sampleqty, string goodqty, string ngqty, string checkitemcont, string username)
+ {
+ return ProductionManagementDAL.SaveMesOrderStepCheckItem(stu_torgcode, wocode, partcode, stepcode, checkstandcode, check_type, sampmethod, qualitystatus, labqty, sampleqty, goodqty, ngqty, checkitemcont, username);
+ }
+ #endregion
+
+
+
+ #region[MES宸ュ崟鎵归噺鍏抽棴鏌ヨ]
+ public static ToMessage MesOrderBitchClosedSearch(string stu_torgcode, string stu_torgtypecode, string mesorderstus, string mesordercode, string sourceorder, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ return ProductionManagementDAL.MesOrderBitchClosedSearch(stu_torgcode, stu_torgtypecode, mesorderstus, mesordercode, sourceorder, ordertype, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺鍏抽棴鎻愪氦]
+ public static ToMessage MesOrderBitchClosedSeave(string username, DataTable dt)
+ {
+ return ProductionManagementDAL.MesOrderBitchClosedSeave(username, dt);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺鍙嶅叧闂璢
+ public static ToMessage MesOrderBitchAntiClosedSeave(string username, DataTable dt)
+ {
+ return ProductionManagementDAL.MesOrderBitchAntiClosedSeave(username, dt);
+ }
+ #endregion
+
+
+
+ #region[浜ц兘瑙勫垝璁剧疆鏌ヨ]
+ public static ToMessage CapacityPlanningSetupSearch()
+ {
+ return ProductionManagementDAL.CapacityPlanningSetupSearch();
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝璁剧疆鏂板]
+ public static ToMessage CapacityPlanningSetupAddUpdate(string username, List<CapacityPlanningSetup> objs)
+ {
+ return ProductionManagementDAL.CapacityPlanningSetupAddUpdate(username, objs);
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝鏂规璁剧疆鍒犻櫎]
+ public static ToMessage CapacityPlanningSetupDelete(string username, string capsetupcode)
+ {
+ return ProductionManagementDAL.CapacityPlanningSetupDelete(username, capsetupcode);
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝鏌ヨ]
+ public static ToMessage CapacityPlanningSearch(string workshop, string devicetype, string stustype, int startNum, int endNum, string prop, string order)
+ {
+ return ProductionManagementDAL.CapacityPlanningSearch(workshop, devicetype, stustype, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝榛樿鏂规淇濆瓨鎻愪氦]
+ public static ToMessage CapacityPlanSubmit(string type, string captplanid, string wkshopcode, string capunitcode, string capsetupcode, string captplantype, string username)
+ {
+ return ProductionManagementDAL.CapacityPlanSubmit(type, captplanid, wkshopcode, capunitcode, capsetupcode, captplantype, username);
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝鐐瑰嚮鏃ュ巻缁勪欢鏌ユ壘宸插叧鑱旂殑鏃ユ湡鏂规]
+ public static ToMessage CapacityPlanningCalendar(string captplanid)
+ {
+ return ProductionManagementDAL.CapacityPlanningCalendar(captplanid);
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝鏃ュ巻鍙屽嚮鏃跺甫鍑哄搴旂殑鏂规]
+ public static ToMessage CapacityPlanningOnclickSelect(string captplanid, string datetime)
+ {
+ return ProductionManagementDAL.CapacityPlanningOnclickSelect(captplanid, datetime);
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝宸ヤ綔鏃ュ巻閫夋嫨鎻愪氦]
+ public static ToMessage CapacityPlanningGivePlanSubmit(string captplanid, string wkshopcode, string capunitcode, string capsetupcode, string captplantype, List<CapaPlan> objs, string type, string username)
+ {
+ return ProductionManagementDAL.CapacityPlanningGivePlanSubmit(captplanid, wkshopcode, capunitcode, capsetupcode, captplantype, objs, type, username);
+ }
+ #endregion
+
+
+ #region[鑷姩鎺掔▼宸ュ崟鏌ヨ]
+ public static ToMessage AdvancedSchedulingSearch(string workshop, string wocode, string partcode, string partname, int startNum, int endNum, string prop, string order)
+ {
+ return ProductionManagementDAL.AdvancedSchedulingSearch(workshop, wocode, partcode, partname, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鎺掍骇璁惧淇℃伅]
+ public static List<AdvancedSchedulingDevice> OnclickAdvancedSchedulingDevice(string wocode, string wkshpcode, string partcode, string startdate, string enddate, ref ToMessage mes)
+ {
+ return ProductionManagementDAL.OnclickAdvancedSchedulingDevice(wocode, wkshpcode, partcode, startdate, enddate, ref mes);
+ }
+ #endregion
+
+ #region[璁惧宸叉帓绋嬩俊鎭痌
+ public static DataTable AlreadyScheduling(string wocode, string wkshpcode, string partcode, string botproccode, string startdate, string enddate)
+ {
+ return ProductionManagementDAL.AlreadyScheduling(wocode, wkshpcode, partcode, botproccode, startdate, enddate);
+ }
+ #endregion
+
+ #region[NEW鎺掍骇璁惧淇℃伅]
+ public static List<AdvancedSchedulingDevice> NewOnclickAdvancedSchedulingDevice(List<ApsOrderSerch> json, ref ToMessage mes)
+ {
+ return ProductionManagementDAL.NewOnclickAdvancedSchedulingDevice(json, ref mes);
+ }
+ #endregion
+
+ #region[NEW璁惧宸叉帓绋嬩俊鎭痌
+ public static List<DataTable> NewAlreadyScheduling(List<ApsOrderSerch> json)
+ {
+ return ProductionManagementDAL.NewAlreadyScheduling(json);
+ }
+ #endregion
+
+ #region[鎺掔▼鏁版嵁鎻愪氦]
+ public static ToMessage SubmitAlreadyScheduling(string username, string wocode, string botprocecode, List<AlreadyScheduling> objs)
+ {
+ return ProductionManagementDAL.SubmitAlreadyScheduling(username, wocode, botprocecode, objs);
+ }
+ #endregion
+
+
+ #region[鐢熶骇鍏ュ簱鏉$爜琛ユ墦]
+ public static ToMessage ProductInHouseLabCode(string ordercode)
+ {
+ return ProductionManagementDAL.ProductInHouseLabCode(ordercode);
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱閫氳繃杞﹂棿鏌ユ壘鐢熶骇璁㈠崟]
+ public static ToMessage ProductInHouseWkshopOrder(string ordertype, string wkshopcode)
+ {
+ return ProductionManagementDAL.ProductInHouseWkshopOrder(ordertype, wkshopcode);
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱淇℃伅鏌ヨ]
+ public static ToMessage ProductInHouseOrderSearch(string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec, string startorderdate, string endorderdate)
+ {
+ return ProductionManagementDAL.ProductInHouseOrderSearch(wkshopcode, erpordercode, mesordercode, partcode, partname, partspec, startorderdate, endorderdate);
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱鎻愪氦]
+ public static ToMessage ProductInHouseOrderSeave(string username, JObject obj)
+ {
+ return ProductionManagementDAL.ProductInHouseOrderSeave(username, obj);
+ }
+ #endregion
+
+
+ #region[App鐢熶骇鍏ュ簱鎵弿鏉$爜]
+ public static ToMessage MesAppProductInHouseOrderBarCodeSearch(string labcode)
+ {
+ return ProductionManagementDAL.MesAppProductInHouseOrderBarCodeSearch(labcode);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/QualityManagementBLL.cs b/VueWebCoreApi/DLL/BLL/QualityManagementBLL.cs
new file mode 100644
index 0000000..5e0448c
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/QualityManagementBLL.cs
@@ -0,0 +1,136 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class QualityManagementBLL
+ {
+ #region[璐ㄩ噺绠$悊,缂洪櫡瀹氫箟鏌ヨ鍒楄〃]
+ public static ToMessage DedectSearch(string defectcode, string defectname, string defectdescr, int startNum, int endNum, string prop, string order)
+ {
+ return QualityManagementDAL.DedectSearch(defectcode, defectname, defectdescr, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[璐ㄩ噺绠$悊锛岀己闄峰畾涔夋柊澧炪�佺紪杈戞彁浜
+ public static ToMessage AddUpdateDedect(string defectcode, string defectname, string defectdescr, string opertype, User us)
+ {
+ return QualityManagementDAL.AddUpdateDedect(defectcode, defectname, defectdescr, opertype, us);
+ }
+ #endregion
+
+ #region[璐ㄩ噺绠$悊锛岀己闄峰畾涔夊垹闄
+ public static ToMessage DeleteDedect(string defectcode, User us)
+ {
+ return QualityManagementDAL.DeleteDedect(defectcode,us);
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠岄」鐩垪琛ㄦ煡璇
+ public static ToMessage StepCheckItemSearch(string itemcode, string itemname, string itemdescr, int startNum, int endNum, string prop, string order)
+ {
+ return QualityManagementDAL.StepCheckItemSearch(itemcode, itemname, itemdescr, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岄」鐩柊澧炪�佺紪杈戞彁浜
+ public static ToMessage AddUpdateStepCheckItem(string checkitemcode, string checkitemname, string checkitemdescr, string opertype, User us)
+ {
+ return QualityManagementDAL.AddUpdateStepCheckItem(checkitemcode, checkitemname, checkitemdescr, opertype, us);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岄」鐩垹闄
+ public static ToMessage DeleteStepCheckItem(string checkitemcode, User us)
+ {
+ return QualityManagementDAL.DeleteStepCheckItem(checkitemcode,us);
+ }
+ #endregion
+
+
+ #region[宸ュ簭璐ㄦ鏂规鍒楄〃鏌ヨ]
+ public static ToMessage QualityInspectionSearch(string qualityinsptcode, string qualityinsptname, string status, string checktype, string sampltype, string suitobject, int startNum, int endNum, string prop, string order)
+ {
+ return QualityManagementDAL.QualityInspectionSearch(qualityinsptcode, qualityinsptname, status, checktype, sampltype, suitobject, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏌ョ湅缂栬緫]
+ public static ToMessage QualityInspectionSeeEdit(string qualityinsptcode)
+ {
+ return QualityManagementDAL.QualityInspectionSeeEdit(qualityinsptcode);
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏂板銆佺紪杈戣幏鍙栨楠岄」鐩笅鎷夊垪琛╙
+ public static ToMessage QualityStepCheckItemSelect()
+ {
+ return QualityManagementDAL.QualityStepCheckItemSelect();
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏂板/缂栬緫鎻愪氦]
+ public static ToMessage QualityInspectionAddEditSave(string qualityinsptcode, string qualityinsptname, string status, string checktype, string sampmethod, string sampscare, string suitobject, string suitpart, string descr, string stepcode, string checkitem, string type, User us)
+ {
+ return QualityManagementDAL.QualityInspectionAddEditSave(qualityinsptcode, qualityinsptname, status, checktype, sampmethod, sampscare, suitobject, suitpart, descr, stepcode, checkitem, type, us);
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鍒犻櫎]
+ public static ToMessage QualityInspectionDelete(string qualityinsptcode, User us)
+ {
+ return QualityManagementDAL.QualityInspectionDelete(qualityinsptcode, us);
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠屾壂鐮佽幏鍙栦换鍔′俊鎭痌
+ public static ToMessage MesOrderStepCheckSearch(string orderstepqrcode, string checktype)
+ {
+ return QualityManagementDAL.MesOrderStepCheckSearch(orderstepqrcode, checktype);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠屾牴鎹�夋嫨鐨勬楠屾柟妗堟煡鎵炬楠岄」鐩甝
+ public static ToMessage MesOrderStepCheckItemList(string checkstandcode)
+ {
+ return QualityManagementDAL.MesOrderStepCheckItemList(checkstandcode);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠�,鎻愪氦]
+ public static ToMessage SaveMesOrderStepCheckItem(string wocode, string partcode, string stepcode, string checkstandcode, string check_type, string sampmethod, string qualitystatus, string labqty, string sampleqty, string goodqty, string ngqty, string checkitemcont, User us)
+ {
+ return QualityManagementDAL.SaveMesOrderStepCheckItem(wocode, partcode, stepcode, checkstandcode, check_type, sampmethod, qualitystatus, labqty, sampleqty, goodqty, ngqty, checkitemcont, us);
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠岃褰曞垪琛ㄦ煡璇
+ public static ToMessage StepCheckTableSearch(string wocode, string partcode, string partname, string partapec, string stepname, string standname, string checktype, string checkresult, int startNum, int endNum, string prop, string order)
+ {
+ return QualityManagementDAL.StepCheckTableSearch(wocode, partcode, partname, partapec, stepname, standname, checktype, checkresult, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岃褰曞垪琛ㄦ槑缁嗘煡璇
+ public static ToMessage StepCheckTableSubSearch(string id)
+ {
+ return QualityManagementDAL.StepCheckTableSubSearch(id);
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岃褰曞鍑篯
+ public static ToMessage StepCheckTableOutExcel(string wocode, string partcode, string partname, string partapec, string stepname, string standname, string checktype, string checkresult, string prop, string order)
+ {
+ return QualityManagementDAL.StepCheckTableOutExcel(wocode, partcode, partname, partapec, stepname, standname, checktype, checkresult, prop, order);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/ReportManagerBLL.cs b/VueWebCoreApi/DLL/BLL/ReportManagerBLL.cs
new file mode 100644
index 0000000..157d51e
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/ReportManagerBLL.cs
@@ -0,0 +1,178 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class ReportManagerBLL
+ {
+ #region[鎶ュ伐璁板綍鍒楄〃鏁版嵁鏌ヨ鎺ュ彛]
+ public static ToMessage MesOrderStepReportSearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string stepname, string eqpcode, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.MesOrderStepReportSearch(wkshopcode, wo_code, partnumber, partname, partspec, stepname, eqpcode, reportuser, reportdateopendate, reportdateclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鎶ュ伐璁板綍鍒楄〃鏁版嵁瀵煎嚭]
+ public static ToMessage MesOrderStepReportExcelSearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string stepname, string eqpcode, string reportuser, string reportdateopendate, string reportdateclosedate)
+ {
+ return ReportManagerDAL.MesOrderStepReportExcelSearch(wkshopcode, wo_code, partnumber, partname, partspec, stepname, eqpcode, reportuser, reportdateopendate, reportdateclosedate);
+ }
+ #endregion
+
+
+ #region[鐢熶骇杩涘害鎶ヨ〃]
+ public static ToMessage ProductionScheduleReportSearch(string status, string wkshopcode,string socode, string wocode,string partcode, string partname, string partspec, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.ProductionScheduleReportSearch(wkshopcode, status, socode, wocode,partcode, partname, partspec, opendate, closedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇杩涘害鎶ヨ〃瀵煎嚭]
+ public static ToMessage ProductionScheduleReportExcelSearch(string status, string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec, string opendate, string closedate)
+ {
+ return ReportManagerDAL.ProductionScheduleReportExcelSearch(wkshopcode, status, socode, wocode, partcode, partname, partspec, opendate, closedate);
+ }
+ #endregion
+
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ヨ]
+ public static ToMessage GroupSalaryReportSearch(string compute,string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec, string stepname, string groupcode, string username, string operopendate, string operclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.GroupSalaryReportSearch(compute, wkshopcode, socode, wocode, partcode, partname, partspec, stepname, groupcode, username, operopendate, operclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ョ湅鎶ュ伐浜哄憳]
+ public static ToMessage GroupSalaryReportSearchUser(string id)
+ {
+ return ReportManagerDAL.GroupSalaryReportSearchUser(id);
+ }
+ #endregion
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍瀵煎嚭]
+ public static ToMessage GroupSalaryReportExcelSearch(string compute,string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec, string stepname, string groupcode, string username, string operopendate, string operclosedate)
+ {
+ return ReportManagerDAL.GroupSalaryReportExcelSearch(compute, wkshopcode, socode, wocode, partcode, partname, partspec, stepname, groupcode, username, operopendate, operclosedate);
+ }
+ #endregion
+
+
+ #region[浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃]
+ public static ToMessage PeopleSalaryReportSearch(string compute,string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec,string stepcode, string stepname, string reportname, string reportopendate, string reportclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.PeopleSalaryReportSearch(compute, wkshopcode, socode, wocode, partcode, partname, partspec, stepcode, stepname, reportname, reportopendate, reportclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃瀵煎嚭]
+ public static ToMessage PeopleSalaryReportExcelSearch(string compute,string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec, string stepcode, string stepname, string reportname, string reportopendate, string reportclosedate)
+ {
+ return ReportManagerDAL.PeopleSalaryReportSearch(compute, wkshopcode, socode, wocode, partcode, partname, partspec, stepcode, stepname, reportname, reportopendate, reportclosedate);
+ }
+ #endregion
+
+
+ #region[濮斿鎶ヨ〃璁板綍鏌ヨ]
+ public static ToMessage OutSourceReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string suppername, string type, string receivopendate, string receivclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.OutSourceReportSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, suppername, type, receivopendate, receivclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[濮斿鎶ヨ〃璁板綍瀵煎嚭]
+ public static ToMessage OutSourceReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string suppername, string type, string receivopendate, string receivclosedate)
+ {
+ return ReportManagerDAL.OutSourceReportExcelSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, suppername, type, receivopendate, receivclosedate);
+ }
+ #endregion
+
+
+ #region[涓嶈壇鏄庣粏鎶ヨ〃]
+ public static ToMessage DefectDetailsReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string defectcode, string defectname, string reportname, string reportopendate, string reportclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.DefectDetailsReportSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, defectcode, defectname, reportname, reportopendate, reportclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[涓嶈壇鏄庣粏鎶ヨ〃瀵煎嚭]
+ public static ToMessage DefectDetailsReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string defectcode, string defectname, string reportname, string reportopendate, string reportclosedate)
+ {
+ return ReportManagerDAL.DefectDetailsReportExcelSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, defectcode, defectname, reportname, reportopendate, reportclosedate);
+ }
+ #endregion
+
+
+ #region[缁翠慨鏄庣粏鎶ヨ〃]
+ public static ToMessage MaintenanceDetailsReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string style, string defectname, string repairname, string repairopendate, string repairclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.MaintenanceDetailsReportSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, style, defectname, repairname, repairopendate, repairclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[缁翠慨鏄庣粏鎶ヨ〃瀵煎嚭]
+ public static ToMessage MaintenanceDetailsReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string style, string defectname, string repairname, string repairopendate, string repairclosedate)
+ {
+ return ReportManagerDAL.MaintenanceDetailsReportExcelSearch(wkshopcode,wocode, partcode, partname, partspec, stepname, style, defectname, repairname, repairopendate, repairclosedate);
+ }
+ #endregion
+
+
+ #region[瀹夌伅鎶ヨ〃鏄庣粏]
+ public static ToMessage AnDonReportDefinitSearch(string wkshopcode, string calltypecode, string calluser, string callopendate, string callclosedate, string eqpcode, string eqpname, string responduser, string respondopendate, string respondclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.AnDonReportDefinitSearch(wkshopcode, calltypecode, calluser, callopendate, callclosedate, eqpcode, eqpname, responduser, respondopendate, respondclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[瀹夌伅鎶ヨ〃鏄庣粏瀵煎嚭]
+ public static ToMessage AnDonReportDefinitExcelSearch(string wkshopcode, string calltypecode, string calluser, string callopendate, string callclosedate, string eqpcode, string eqpname, string responduser, string respondopendate, string respondclosedate)
+ {
+ return ReportManagerDAL.AnDonReportDefinitExcelSearch(wkshopcode, calltypecode, calluser, callopendate, callclosedate, eqpcode, eqpname, responduser, respondopendate, respondclosedate);
+ }
+ #endregion
+
+
+ #region[瀹夌伅鎶ヨ〃姹囨�籡
+ public static ToMessage AnDonReportSumSearch(string wkshopcode, string eqpcode, string calltypecode, string callopendate, string callclosedate, string respondopendate, string respondclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.AnDonReportSumSearch(wkshopcode, eqpcode, calltypecode, callopendate, callclosedate, respondopendate, respondclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[瀹夌伅鎶ヨ〃姹囨�诲鍑篯
+ public static ToMessage AnDonReportSumExcelSearch(string wkshopcode, string eqpcode, string calltypecode, string callopendate, string callclosedate, string respondopendate, string respondclosedate)
+ {
+ return ReportManagerDAL.AnDonReportSumExcelSearch(wkshopcode, eqpcode, calltypecode, callopendate, callclosedate, respondopendate, respondclosedate);
+ }
+ #endregion
+
+
+
+ #region[T+鍏ュ簱璁板綍琛ㄥご]
+ public static ToMessage InStorageRecordMainSearch(string hbillno, string username, string hbdateopendate, string hbdateclosedate, string userdateopendate, string userdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return ReportManagerDAL.InStorageRecordMainSearch(hbillno, username, hbdateopendate, hbdateclosedate, userdateopendate, userdateclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[T+鍏ュ簱璁板綍琛ㄤ綋]
+ public static ToMessage InStorageRecordSubSearch(string hbillno)
+ {
+ return ReportManagerDAL.InStorageRecordSubSearch(hbillno);
+ }
+ #endregion
+
+ #region[T+鍏ュ簱璁板綍鍒犻櫎]
+ public static ToMessage DeleteInStorageRecord(DataTable dt, User us)
+ {
+ return ReportManagerDAL.DeleteInStorageRecord(dt, us);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/SopManageMentBLL.cs b/VueWebCoreApi/DLL/BLL/SopManageMentBLL.cs
new file mode 100644
index 0000000..03aaa09
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/SopManageMentBLL.cs
@@ -0,0 +1,94 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class SopManageMentBLL
+ {
+ #region[绯荤粺璁剧疆,璁惧SOP鏌ヨ]
+ public static ToMessage DeviceSopSearch(string search, string check, int startNum, int endNum, string prop, string order)
+ {
+ return SopManageMentDAL.DeviceSopSearch(search, check, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,璁惧SOP鏂板]
+ public static ToMessage DeviceSopAddSeave(string eqptypecode, string device, string filename, string filetypecode, IFormFile file, User us)
+ {
+ return SopManageMentDAL.DeviceSopAddSeave(eqptypecode, device, filename, filetypecode, file, us);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,璁惧SOP鍒犻櫎]
+ public static ToMessage DeviceSopDeleteSeave(string id, string eqpcode, string filepath, User us)
+ {
+ return SopManageMentDAL.DeviceSopDeleteSeave(id, eqpcode, filepath, us);
+ }
+ #endregion
+
+
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鏌ヨ]
+ public static ToMessage ProcessSopSearch(string search, string check, int startNum, int endNum, string prop, string order)
+ {
+ return SopManageMentDAL.ProcessSopSearch(search, check, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP涓婁紶鑾峰彇鏈�澶х増鏈彿]
+ public static ToMessage ProcessSopMaxVersion(string partcode, string routecode, string stepcode, string filetypecode, User us)
+ {
+ return SopManageMentDAL.ProcessSopMaxVersion(partcode, routecode, stepcode, filetypecode, us);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鏂板]
+ public static ToMessage ProcessSopAddSeave(string partcode, string routecode, string stepcode, string filename, string filetypecode,string version, IFormFile file, User us)
+ {
+ return SopManageMentDAL.ProcessSopAddSeave(partcode, routecode, stepcode, filename, filetypecode, version, file, us);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鍒犻櫎]
+ public static ToMessage ProcessSopDeleteSeave(string id, string partcode,string routecode,string stepcode, string filepath, User us)
+ {
+ return SopManageMentDAL.ProcessSopDeleteSeave(id, partcode, routecode, stepcode, filepath, us);
+ }
+ #endregion
+
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鏌ヨ]
+ public static ToMessage WrkOrderSearch(string search, string check, int startNum, int endNum, string prop, string order)
+ {
+ return SopManageMentDAL.WrkOrderSearch(search, check, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP涓婁紶鑾峰彇鏈�澶х増鏈彿]
+ public static ToMessage WrkOrderSopMaxVersion(string wocode, string partcode, string filetypecode, User us)
+ {
+ return SopManageMentDAL.WrkOrderSopMaxVersion(wocode, partcode, filetypecode, us);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鏂板]
+ public static ToMessage WrkOrderSopAddSeave(string wocode, string partcode, string filename, string filetypecode, string version, IFormFile file, User us)
+ {
+ return SopManageMentDAL.WrkOrderSopAddSeave(wocode, partcode, filename, filetypecode, version, file, us);
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鍒犻櫎]
+ public static ToMessage WrkOrderSopDeleteSeave(string id, string wocode, string partcode, string filepath, User us)
+ {
+ return SopManageMentDAL.WrkOrderSopDeleteSeave(id, wocode, partcode, filepath, us);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/SystemSettingBLL.cs b/VueWebCoreApi/DLL/BLL/SystemSettingBLL.cs
new file mode 100644
index 0000000..84928af
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/SystemSettingBLL.cs
@@ -0,0 +1,88 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class SystemSettingBLL
+ {
+ #region[缂栫爜瑙勫垯鑾峰彇鍙缃殑鍔熻兘鑿滃崟淇℃伅]
+ public static ToMessage CodeMenuSelect()
+ {
+ return SystemSettingDAL.CodeMenuSelect();
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯鏌ヨ]
+ public static ToMessage EncodingRules(string rightname, string prefix, int startNum, int endNum, string prop, string order)
+ {
+ return SystemSettingDAL.EncodingRules(rightname, prefix, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯缂栬緫淇濆瓨]
+ public static ToMessage SaveEncodingRules(string rightcode, string rightname, string prefix, string filingdate, string incbit,string type, User us)
+ {
+ return SystemSettingDAL.SaveEncodingRules(rightcode, rightname, prefix, filingdate, incbit, type, us);
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯鍒犻櫎]
+ public static ToMessage DeleteEncodingRules(string menucode, User us)
+ {
+ return SystemSettingDAL.DeleteEncodingRules(menucode,us);
+ }
+ #endregion
+
+ #region[鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�(姣忔鑾峰彇鏈�鏂�)]
+ public static ToMessage NewEncodingRules(string rightcode)
+ {
+ return SystemSettingDAL.NewEncodingRules(rightcode);
+ }
+ #endregion
+
+ #region[鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�(鍙湁浣跨敤鎵嶈幏鍙栨渶鏂�)]
+ public static ToMessage OnlyEncodingRules(string rightcode)
+ {
+ return SystemSettingDAL.OnlyEncodingRules(rightcode);
+ }
+ #endregion
+
+ #region[鍥炲啓瑙勫垯鐢熸垚鐨勭紪鐮�(浣跨敤淇濆瓨)]
+ public static ToMessage SaveOnlyEncodingRules(string rightcode,string incbit)
+ {
+ return SystemSettingDAL.SaveOnlyEncodingRules(rightcode,incbit);
+ }
+ #endregion
+
+ #region[鐢熸垚鐗╂枡鏍囩鏉$爜(姣忔鑾峰彇鏈�鏂�,App鍙娇鐢�)]
+ public static ToMessage LabelBarCode(string rightcode, string partcode, string qty, string onelabqty)
+ {
+ return SystemSettingDAL.LabelBarCode(rightcode, partcode, qty, onelabqty);
+ }
+ #endregion
+
+
+ #region[App鐗堟湰鍗囩骇鎺ュ彛]
+ public static ToMessage AppUpgrade(string rid, string vision)
+ {
+ return SystemSettingDAL.AppUpgrade(rid, vision);
+ }
+ #endregion
+
+
+ #region[绯荤粺璁剧疆,娴佺▼璁剧疆鎻愪氦]
+ public static ToMessage SaveSystemProcConfig(JObject systemjson, User us)
+ {
+ return SystemSettingDAL.SaveSystemProcConfig(systemjson, us);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/BLL/WorkOrderBLL.cs b/VueWebCoreApi/DLL/BLL/WorkOrderBLL.cs
new file mode 100644
index 0000000..ea755d9
--- /dev/null
+++ b/VueWebCoreApi/DLL/BLL/WorkOrderBLL.cs
@@ -0,0 +1,301 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.DAL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.ErpOrder;
+using VueWebCoreApi.Models.InventoryModel;
+using VueWebCoreApi.Models.ReportVerify;
+using VueWebCoreApi.Models.UpdateReport;
+using VueWebCoreApi.Models.WorkData;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.BLL
+{
+ public class WorkOrderBLL
+ {
+
+ #region[ERP璁㈠崟鏌ヨ]
+ public static ToMessage ErpOrderSearch(string erporderstus,string wkshopcode, string erpordercode, string saleordercode, string partcode, string partname, string partspec, int startNum,string datatype, string paydatestartdate, string paydateenddate, string creatuser, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.ErpOrderSearch(erporderstus, wkshopcode, erpordercode, saleordercode, partcode, partname, partspec, startNum, datatype, paydatestartdate, paydateenddate, creatuser, endNum, prop, order);
+ }
+ #endregion
+
+ #region[ERP璁㈠崟涓嬭揪]
+ public static ToMessage MarkSaveErpOrder(string erporderid,string sbid, string erpordercode, string saleordercode, string partcode, string wkshopcode, string warehousecode, string erpqty, string markqty, string ordernum, string relse_qty, string saleOrderDeliveryDate,string paystartdate,string payenddate, string clerkuser, User us)
+ {
+ return WorkOrderDAL.MarkSaveErpOrder(erporderid, sbid, erpordercode, saleordercode, partcode, wkshopcode, warehousecode, erpqty, markqty, ordernum, relse_qty, saleOrderDeliveryDate, paystartdate, payenddate, clerkuser, us);
+ }
+ #endregion
+
+ #region[璁㈠崟鎵归噺涓嬭揪]
+ public static ToMessage MarkBatchSaveErpOrder(List<ErpOrderBatch> obj, User us)
+ {
+ return WorkOrderDAL.MarkBatchSaveErpOrder(obj,us);
+ }
+ #endregion
+
+ #region[ERP璁㈠崟鍏抽棴]
+ public static ToMessage ClosedErpOrder(string erporderid, string erpordercode, User us)
+ {
+ return WorkOrderDAL.ClosedErpOrder(erporderid, erpordercode, us);
+ }
+ #endregion
+
+ #region[ERP璁㈠崟鍒犻櫎]
+ public static ToMessage DeleteErpOrder(string erporderid, string erpordercode, User us)
+ {
+ return WorkOrderDAL.DeleteErpOrder(erporderid, erpordercode, us);
+ }
+ #endregion
+
+
+
+ #region[MES宸ュ崟鏌ヨ]
+ public static ToMessage MesOrderSearch(string mesorderstus,string wkshopcode, string mesordercode,string sourceorder, string saleordercode, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string datatype,string paydatestartdate,string paydateenddate, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.MesOrderSearch(mesorderstus, wkshopcode, mesordercode, sourceorder, saleordercode, ordertype, partcode, partname, partspec, startNum, creatuser, datatype, paydatestartdate, paydateenddate, endNum, prop, order);
+ }
+ #endregion
+
+ #region[MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ]
+ public static ToMessage MesBadOrderSearch(string wkshopcode, string mesordercode, string sourceorder, string saleordercode, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.MesBadOrderSearch(wkshopcode,mesordercode, sourceorder, saleordercode, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+ public static ToMessage AddMesOrderCodeSearch()
+ {
+ return WorkOrderDAL.AddMesOrderCodeSearch();
+ }
+ #endregion
+
+ #region[MES宸ュ崟缂栬緫鑾峰彇宸ュ簭鏁版嵁]
+ public static ToMessage UpdateMesOrderStepSearch(string sourceid, string sourcewo, string wocode, string data_sources)
+ {
+ return WorkOrderDAL.UpdateMesOrderStepSearch(sourceid,sourcewo,wocode,data_sources);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
+ public static ToMessage AddUpdateMesOrder(string OperType, WorkList json, User us)
+ {
+ return WorkOrderDAL.AddUpdateMesOrder(OperType,json,us);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺缁戝畾鑾峰彇宸ュ簭鏁版嵁]
+ public static ToMessage UpdateMesOrderStepListSearch(List<WorkStepList> worksteplist)
+ {
+ return WorkOrderDAL.UpdateMesOrderStepListSearch(worksteplist);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佺紪杈戞壒閲忕粦瀹氭彁浜
+ public static ToMessage AddUpdateMesOrderList(string OperType, List<WorkList> json, User us)
+ {
+ return WorkOrderDAL.AddUpdateMesOrderList(OperType, json, us);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵撳嵃鏇存柊鎵撳嵃娆℃暟]
+ public static ToMessage UpdateMesOrderPrintCount(string wo_code)
+ {
+ return WorkOrderDAL.UpdateMesOrderPrintCount(wo_code);
+ }
+ #endregion
+
+
+ #region[MES宸ュ崟鍒犻櫎]
+ public static ToMessage DeleteMesOrder(string souceid, string wocode, string m_po, string orderqty, User us)
+ {
+ return WorkOrderDAL.DeleteMesOrder(souceid, wocode, m_po, orderqty,us);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ユ壘鍘嗗彶寮曠敤鏈�鏂板伐搴忎俊鎭痌
+ public static ToMessage MesOrderNewStepContent(string wkshopcode,string routecode, string partcode, User us)
+ {
+ return WorkOrderDAL.MesOrderNewStepContent(wkshopcode, routecode, partcode, us);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ョ湅宸ュ崟SOP]
+ public static ToMessage MesOrderSopSearch(string wocode, string materielcode)
+ {
+ return WorkOrderDAL.MesOrderSopSearch(wocode, materielcode);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ョ湅宸ヨ壓SOP]
+ public static ToMessage MesOrderProcessSopSearch(string materielcode, string routecode, string stepcode, User us)
+ {
+ return WorkOrderDAL.MesOrderProcessSopSearch(materielcode, routecode, stepcode,us);
+ }
+ #endregion
+
+
+ #region[MES宸ュ崟娲惧彂鎻愪氦]
+ public static ToMessage MesOrderDistribution(string[] wocodelist, User us)
+ {
+ return WorkOrderDAL.MesOrderDistribution(wocodelist, us);
+ }
+ #endregion
+
+ #region[宸ュ崟鍏抽棴鍒楄〃鏌ヨ]
+ public static ToMessage MesOrderClosedSearch(string mesorderstus,string wkshopcode, string mesordercode, string sourceorder, string saleordercode, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.MesOrderClosedSearch(mesorderstus, wkshopcode, mesordercode, sourceorder, saleordercode, ordertype, partcode, partname, partspec, startNum, creatuser, createdate, endNum, prop, order);
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺鍏抽棴鎻愪氦]
+ public static ToMessage MesOrderBitchClosedSeave(User us, string[] wocodelist)
+ {
+ return WorkOrderDAL.MesOrderBitchClosedSeave(us,wocodelist);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)]
+ public static ToMessage MesOrderStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.MesOrderStepSearch(wkshopcode,wocode, partcode, partname, partspec, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(澶栧崗)]
+ public static ToMessage MesOrderWxStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.MesOrderWxStepSearch(wkshopcode,wocode, partcode, partname, partspec, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇)]
+ public static ToMessage MesOrderNgStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.MesOrderNgStepSearch(wkshopcode,wocode, partcode, partname, partspec, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇鏄庣粏)]
+ public static ToMessage MesOrderNgSubStepSearch(string wocode, string stepcode)
+ {
+ return WorkOrderDAL.MesOrderNgSubStepSearch(wocode, stepcode);
+ }
+ #endregion
+
+ #region [鐢熶骇寮�鎶ュ伐锛氭姤宸�/澶栧崗(鍙戞枡/鏀舵枡)鏃舵潯浠跺垽鏂強鏁版嵁杩斿洖鎺ュ彛]
+ public static ToMessage MesOrderStepStart(string OperType, string SelectType, string wocode, string stepcode,User us)
+ {
+ return WorkOrderDAL.MesOrderStepStart(OperType, SelectType, wocode, stepcode, us);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鎶ュ伐鎻愪氦]
+ public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode,string stepprice, string eqpcode, string inbarcode, string reckway, string usergroupcode, string reportuser,string payrate, string taskqty, string startqty, string reportqty, List<ReportDefectList> defectobjs, string remarks, User us)
+ {
+ return WorkOrderDAL.SavaMesOrderStepReport(mesordercode, partcode, stepseq, stepcode, stepprice, eqpcode, inbarcode, reckway, usergroupcode, reportuser, payrate, taskqty, startqty, reportqty, defectobjs, remarks, us);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鍙戞枡鎻愪氦]
+ public static ToMessage SavaMesOrderStepOut(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string outuser, string taskqty, string fqty, User us)
+ {
+ return WorkOrderDAL.SavaMesOrderStepOut(mesordercode, partcode, stepseq, stepcode, wxcode, outuser, taskqty, fqty, us);
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鏀舵枡鎻愪氦]
+ public static ToMessage SavaMesOrderStepIn(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string inbarcode, string inuser, string taskqty, string sqty, List<ReportDefectList> defectobjs, string remarks, User us)
+ {
+ return WorkOrderDAL.SavaMesOrderStepIn(mesordercode, partcode, stepseq, stepcode, wxcode, inbarcode, inuser, taskqty, sqty, defectobjs, remarks, us);
+ }
+ #endregion
+
+ #region[涓嶈壇澶勭悊,鎻愪氦]
+ public static ToMessage EditOrderNgStepSeave(ReportDefectHandle json, User us)
+ {
+ return WorkOrderDAL.EditOrderNgStepSeave(json, us);
+ }
+ #endregion
+
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鏁版嵁鏌ヨ鎺ュ彛]
+ public static ToMessage MesOrderStepVerifySearch(string wkshopcode,string wo_code, string partnumber, string partname, string partspec, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.MesOrderStepVerifySearch(wkshopcode,wo_code, partnumber, partname, partspec, reportuser, reportdateopendate, reportdateclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鑾峰彇閫夊畾鎶ュ伐璁板綍鐨勪笉鑹暟鎹甝
+ public static ToMessage MesOrderStepModelSearch(string wo_code, string step_code, string step_type, string isbott, string isend, string id, string sbid)
+ {
+ return WorkOrderDAL.MesOrderStepModelSearch(wo_code, step_code, step_type, isbott, isend, id, sbid);
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鏁版嵁鎻愪氦]
+ public static ToMessage MesOrderStepUpdateSeave(User us, List<UpdateProductReport> json)
+ {
+ return WorkOrderDAL.MesOrderStepUpdateSeave(us,json);
+ }
+ #endregion
+
+
+ #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鍒楄〃鏁版嵁鏌ヨ鎺ュ彛]
+ public static ToMessage MesOrderStepReportVerifySearch(string reviewstatus, string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string stepname, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ return WorkOrderDAL.MesOrderStepReportVerifySearch(reviewstatus,wkshopcode, wo_code, partnumber, partname, partspec, stepname, reportuser, reportdateopendate, reportdateclosedate, startNum, endNum, prop, order);
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鏁版嵁鎻愪氦]
+ public static ToMessage MesOrderStepReportVerifySeave(User us, DataModel json)
+ {
+ return WorkOrderDAL.MesOrderStepReportVerifySeave(us,json);
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐寮冨鏁版嵁鎻愪氦]
+ public static ToMessage MesOrderStepReportNotVerifySeave(User us, string id, string steptype)
+ {
+ return WorkOrderDAL.MesOrderStepReportNotVerifySeave(us, id, steptype);
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇鍏ュ簱鏉$爜琛ユ墦]
+ public static ToMessage ProductInHouseLabCode(string ordercode)
+ {
+ return WorkOrderDAL.ProductInHouseLabCode(ordercode);
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱淇℃伅鏌ヨ]
+ public static ToMessage ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec)
+ {
+ return WorkOrderDAL.ProductInHouseOrderSearch(deptno, saleordercode, wkshopcode, erpordercode, mesordercode, partcode, partname, partspec);
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱鑾峰彇鍗曟嵁鍙穄
+ public static ToMessage ProductInHouseOrderCodeSearch(string rightcode)
+ {
+ return WorkOrderDAL.ProductInHouseOrderCodeSearch(rightcode);
+ }
+ #endregion
+
+ #region[鐣呮嵎閫歍+鐢熶骇鍏ュ簱鎻愪氦-瀛樺偍杩囩▼鐗�(閫傜敤鍚屼竴鍙版湇鍔″櫒锛屽悓涓�涓暟鎹簱)]
+ public static ToMessage TProductInHouseOrderSpSeave(InReptModel data, User us)
+ {
+ return WorkOrderDAL.TProductInHouseOrderSpSeave(data, us);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/AppAnDonDAL.cs b/VueWebCoreApi/DLL/DAL/AppAnDonDAL.cs
new file mode 100644
index 0000000..79881a8
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/AppAnDonDAL.cs
@@ -0,0 +1,342 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class AppAnDonDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[瀹夌伅鍛煎彨鎵弿宸ヤ綅]
+ public static ToMessage AppAnDonCallScanSearch(string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧鍙婃墍灞炶溅闂�
+ sql = @"select A.code,A.name,T.torg_code as wksp_code,T.torg_name as wksp_name,E.eqpchkmain_code
+ from TEqpInfo A
+ left join TOrganization T on A.torg_code=T.torg_code
+ left join TEqpchk_Eqp E on A.code=E.eqp_code
+ where A.code=@eqpcode and A.enable='Y'";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧/宸ヤ綅涓嶅瓨鍦ㄦ垨寮傚父!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅鍛煎彨,閫夋嫨鎵弿宸ヤ綅甯﹀嚭鍛煎彨绫诲瀷閫夐」鍙婂搴斾汉鍛樻暟鎹甝
+ public static ToMessage AppAnDonCallItemSearch(string eqpcode, string wkshpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<AnDnDate> list = new List<AnDnDate>();
+ try
+ {
+ //鏍规嵁杞﹂棿浠g爜鏌ユ壘鍛煎彨绫诲瀷鏁版嵁
+ sql = @"select A.id,B.code,B.name,(case when F.type is null then 'N' else 'Y' end) flag
+ from TAnDon_Roul_ConFig A
+ inner join TAnDonType B on A.andotype_code=B.code
+ inner join TEqpInfo E on A.wkshp_code=e.torg_code
+ left join(
+ select type,wkshp_code,eqp_code from TAnDon_Task_Info where eqp_code=@eqpcode and wkshp_code=@wkshpcode and status='START'
+ ) F on A.wkshp_code=F.wkshp_code and E.code=F.eqp_code and B.code=F.type
+ where A.wkshp_code=@wkshpcode and E.code=@eqpcode and A.enable='N'";
+ dynamicParams.Add("@wkshpcode", wkshpcode);
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ AnDnDate mn = new AnDnDate();
+ mn.code = data.Rows[i]["CODE"].ToString();
+ mn.name = data.Rows[i]["NAME"].ToString();
+ mn.flag = data.Rows[i]["FLAG"].ToString();
+ mn.children = new List<AnDnDateSub>();
+ //鏍规嵁鍛煎彨绫诲瀷id鏌ユ壘缁戝畾浜哄憳
+ sql = @"select U.usercode,U.username,U.rid
+ from TAnDon_Roul_ConFigUser A
+ inner join TUser U on A.usercode=U.usercode
+ where A.ando_cogfigid=@id";
+ dynamicParams.Add("@id", data.Rows[i]["ID"].ToString());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ for (int j = 0; j < data0.Rows.Count; j++)
+ {
+ AnDnDateSub sn = new AnDnDateSub();
+ sn.rid = data0.Rows[j]["RID"].ToString();//rid
+ sn.alias = data0.Rows[j]["RID"].ToString() + data0.Rows[j]["USERCODE"].ToString(); //鍒悕
+ sn.usercode = data0.Rows[j]["USERCODE"].ToString();
+ sn.username = data0.Rows[j]["USERNAME"].ToString();
+ mn.children.Add(sn);
+ }
+ }
+ list.Add(mn);
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧鏈缃畨鐏懠鍙被鍨嬫垨鑰呭懠鍙被鍨嬪凡鍏抽棴!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅鍛煎彨鎻愪氦]
+ public static ToMessage AppAnDonCallSave(User us, string eqpcode, string wkshpcode, List<AnDnDate> json)
+ {
+ string sql = "";
+ int AnDnID = 0; //鏈�澶d
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ List<string> list1 = new List<string>();
+ try
+ {
+ list.Clear();
+ //鑾峰彇涓昏〃鏈�澶D
+ AnDnID = DapperHelper.insertReturnId("TAnDon_Task_Info");
+ for (int i = 0; i < json.Count; i++)
+ {
+ AnDnID = AnDnID + 1;//鑷1
+ string code = json[i].code.ToString();
+ string name = json[i].name.ToString();
+ sql = @"select * from TAnDon_Task_Info where wkshp_code=@wkshpcode and eqp_code=@eqpcode and type=@typecode and status='START'";
+ dynamicParams.Add("@wkshpcode", wkshpcode);
+ dynamicParams.Add("@eqpcode", eqpcode);
+ dynamicParams.Add("@typecode", code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧宸茬粡鍛煎彨銆�" + name + "銆�,璇峰厛鍝嶅簲!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ //鍐欏叆瀹夌伅鍛煎彨琛�
+ sql = @"insert into TAnDon_Task_Info(wkshp_code,eqp_code,type,start_date,start_user,status)
+ values(@wkshp_code,@eqp_code,@type,@start_date,@start_user,@status)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshp_code = wkshpcode,
+ eqp_code = eqpcode,
+ type = code,
+ start_date = DateTime.Now.ToString(),
+ start_user = us.usercode,
+ status = "START"
+ }
+ });
+
+ //for (int j = 0; j < json[i].children.Count; j++)
+ //{
+ // //鍐欏叆瀹夌伅璁板綍鎺ㄩ�佷汉鍛樿〃
+ // sql = @"insert into TAnDnMessagePush(m_id,wkshp_code,eqp_code,type,resp_user,status)
+ // values(@m_id,@wkshp_code,@eqp_code,@type,@resp_user,@status)";
+ // list.Add(new
+ // {
+ // str = sql,
+ // parm = new
+ // {
+ // m_id = AnDnID,
+ // //m_id = int.Parse(dt.Rows[0]["ID"].ToString()),
+ // wkshp_code = wkshpcode,
+ // eqp_code = eqpcode,
+ // type = code,
+ // resp_user = json[i].children[j].usercode,
+ // alias = json[i].children[j].alias,
+ // status = "N"
+ // }
+ // });
+ //}
+ }
+ }
+ //鏋佸厜鎺ㄩ��
+ //mes = JPushManage.ExecutePushByUserId(us.usercode, wkshpcode, eqpcode, json);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "瀹夌伅鍛煎彨", "鍛煎彨浜�:" + string.Join(",", json.Select(item => item.name)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍛煎彨鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍛煎彨澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[瀹夌伅鍝嶅簲鎵弿宸ヤ綅/璁惧]
+ public static ToMessage AppAnDonLampResponseScanSearch(string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧鍙婃墍灞炶溅闂寸殑瀹夌伅鍛煎彨璁板綍
+ sql = @"select A.eqp_code,B.name as eqp_name,T.torg_code as wksp_code,T.torg_name as wksp_name,A.type as typecode,D.name as typename
+ from TAnDon_Task_Info A
+ left join TEqpInfo B on A.eqp_code=B.code
+ left join TOrganization T on B.torg_code=T.torg_code
+ left join TAnDonType D on A.type=D.code
+ where A.eqp_code=@eqpcode and A.status='START' and B.enable='Y'";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧/宸ヤ綅鏈畨鐏懠鍙�!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅鍝嶅簲鎻愪氦]
+ public static ToMessage AppAnDonLampResponseSave(User us, string eqpcode, string wkshpcode, List<ObjectData> json)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ for (int i = 0; i < json.Count; i++)
+ {
+ string code = json[i].code.ToString();
+ string name = json[i].name.ToString();
+ //鏇存柊瀹夌伅鍛煎彨琛�
+ sql = @"update TAnDon_Task_Info set resp_user=@resp_user,resp_date=@resp_date,status='CLOSED',taking=cast ( cast ( datediff ( ss, start_date, @resp_date) / ( 60 * 60 * 24 ) as int ) as varchar ) + '澶�' +
+ cast ( cast ( datediff ( ss, start_date, @resp_date ) % 86400 / 3600 as int ) as varchar ) + '灏忔椂' +
+ cast ( cast ( datediff ( ss, start_date, @resp_date ) % 3600 / 60 as int ) as varchar ) + '鍒�' +
+ cast ( cast ( datediff ( ss, start_date, @resp_date ) % 60 as int ) as varchar ) + '绉�'
+ where wkshp_code=@wkshp_code and eqp_code=@eqp_code and type=@type and status='START'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshp_code = wkshpcode,
+ eqp_code = eqpcode,
+ type = code,
+ resp_date = DateTime.Now.ToString(),
+ resp_user = us.usercode,
+ status = "START"
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ LogHelper.DbOperateLog(us.usercode, "瀹夌伅鍝嶅簲", "鍝嶅簲浜�:" + string.Join(",", json.Select(item => item.name)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍝嶅簲鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍝嶅簲澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/AppAnalyticsDAL.cs b/VueWebCoreApi/DLL/DAL/AppAnalyticsDAL.cs
new file mode 100644
index 0000000..9c91f76
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/AppAnalyticsDAL.cs
@@ -0,0 +1,335 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class AppAnalyticsDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[App鐢熶骇鐪嬫澘]
+ public static ToMessage ProductionKanban(User us, string startopendate, string endclosedate, string defecttype)
+ {
+ Dictionary<object, object> dList = new Dictionary<object, object>();
+ var dynamicParams = new DynamicParameters();
+ string search = "", torg_codelist = "", sql = "";
+ try
+ {
+ //鑾峰彇褰撳墠鐢ㄦ埛鎵�灞炵粍缁囧強鎵�鏈夊瓙鑺傜偣缁勭粐
+ mes = TOrganizationRecursion.TOrgCodeSeach(us.storg_code);
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ torg_codelist = mes.data.ToString(); //鑾峰彇缁勭粐闆嗗悎
+ }
+ // --------------鐢熶骇鎬昏--------------
+ string[] torglist = Array.ConvertAll<string, string>(torg_codelist.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ //瀛樺偍杩囩▼鍚�
+ // --------------鏌ヨ宸ュ崟浠诲姟鏁般�佹姤宸ユ暟銆佽绠楀伐璧勬敹鍏�--------------
+ sql = @"h_p_JLApp_ProductAnalysisTop";
+ dynamicParams.Add("@torglist", mes.data.ToString());
+ dynamicParams.Add("@startopendate", startopendate + " 00:00:00");
+ dynamicParams.Add("@endclosedate", endclosedate + " 23:59:59");
+ var data0 = DapperHelper.selectProcedure(sql, dynamicParams);
+ dList.Add("dt0", data0);
+ // --------------鐢熶骇宸ュ崟--------------
+ sql = @"h_p_JLApp_ProductAnalysisCenter";
+ dynamicParams.Add("@torglist", mes.data.ToString());
+ dynamicParams.Add("@startopendate", startopendate + " 00:00:00");
+ dynamicParams.Add("@endclosedate", endclosedate + " 23:59:59");
+ var data1 = DapperHelper.selectProcedure(sql, dynamicParams);
+ dList.Add("dt1", data1);
+ // --------------缂洪櫡缁熻--------------
+ sql = @"h_p_JLApp_ProductAnalysisBottom";
+ dynamicParams.Add("@compute", defecttype);
+ dynamicParams.Add("@torglist", mes.data.ToString());
+ dynamicParams.Add("@startopendate", startopendate + " 00:00:00");
+ dynamicParams.Add("@endclosedate", endclosedate + " 23:59:59");
+ var data2 = DapperHelper.selectProcedure(sql, dynamicParams);
+ dList.Add("dt2", data2);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dList;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[App鐢熶骇杩涘害鐪嬫澘鍗曟嵁淇℃伅]
+ public static ToMessage ProductionScheduleKanban(User us, string ordertype, string partcode, string startopendate, string endclosedate)
+ {
+ Dictionary<object, object> dList = new Dictionary<object, object>();
+ List<AppScheduleKanban> list = new List<AppScheduleKanban>();
+ var dynamicParams = new DynamicParameters();
+ string search = "", search1 = "", sql = "", torg_codelist = "";
+ DataTable dt;
+ try
+ {
+ //鑾峰彇褰撳墠鐢ㄦ埛鎵�灞炵粍缁囧強鎵�鏈夊瓙鑺傜偣缁勭粐
+ mes = TOrganizationRecursion.TOrgCodeSeachNo(us.storg_code);
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ torg_codelist = mes.data.ToString(); //鑾峰彇缁勭粐闆嗗悎
+ string[] torglist = Array.ConvertAll<string, string>(torg_codelist.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ search1 += " and A.wkshp_code in @wkshp_code ";
+ dynamicParams.Add("@wkshp_code", torglist.ToArray());
+ }
+
+ //鏍规嵁鏌ヨ鏉′欢,鏌ユ壘绗﹀悎瑕佹眰鐨勫崟鎹�
+ switch (ordertype)
+ {
+ case "SO": //鎸夐攢鍞鍗曠粺璁�
+ if (partcode != "" && partcode != null)
+ {
+ string[] selects = Array.ConvertAll<string, string>(partcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ search += " and A.materiel_code in @partcode ";
+ dynamicParams.Add("@partcode", selects.ToArray());
+ }
+ if (startopendate != "" && startopendate != null)
+ {
+ search += " and convert(varchar(100),A.saleOrderDate,21)>=@startopendate and convert(varchar(100),A.saleOrderDate,21)<=@endclosedate ";
+ dynamicParams.Add("@startopendate", startopendate + " 00:00:00");
+ dynamicParams.Add("@endclosedate", endclosedate + " 23:59:59");
+ }
+ //鑾峰彇鍗曟嵁淇℃伅
+ sql = @"select distinct saleOrderCode,A.saleOrderDate,sum(A.saleOrderqty) as saleOrderqty
+ from TKimp_Ewo A
+ where A.saleOrderCode<>'' and A.status<>'CLOSED' " + search + " group by A.saleOrderCode,A.saleOrderDate order by A.saleOrderDate desc";
+ dt = DapperHelper.selectlist(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ AppScheduleKanban cmp = new AppScheduleKanban();
+ cmp.ordercode = dt.Rows[i]["saleOrderCode"].ToString();
+ cmp.orderqty = dt.Rows[i]["saleOrderqty"].ToString();
+ cmp.children = new List<AppScheduleKanbanSub>();
+ //鑾峰彇鍗曟嵁涓嬩骇鍝佸畬鎴愪俊鎭�
+ sql = @"select AA.wo,AA.partcode,AA.partname,AA.partspec,AA.saleOrderqty,isnull(BB.good_qty,0) as good_qty from(
+ select distinct E.wo,T.partcode,T.partname,T.partspec,sum(E.saleOrderqty) as saleOrderqty
+ from TKimp_Ewo E
+ left join TMateriel_Info T on E.materiel_code=T.partcode
+ where E.saleOrderCode=@saleOrderCode and E.status<>'CLOSED'
+ group by E.wo,T.partcode,T.partname,T.partspec
+ ) as AA
+ left join
+ (
+ select M.m_po,sum(S.good_qty) as good_qty from TK_Wrk_Man M
+ inner join TK_Wrk_Step S on M.wo_code=S.wo_code
+ where S.isend='Y' and S.good_qty>0
+ group by M.m_po
+ ) as BB on AA.wo=BB.m_po";
+ dynamicParams.Add("@saleOrderCode", dt.Rows[i]["saleOrderCode"].ToString());
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ decimal good_qty = data.AsEnumerable().Select(d => d.Field<decimal>("good_qty")).Sum(); //鎶ュ伐鎬绘暟閲�
+ cmp.ordergoodqty = good_qty.ToString();
+ for (int j = 0; j < data.Rows.Count; j++)
+ {
+ AppScheduleKanbanSub cbp = new AppScheduleKanbanSub();
+ cbp.code = data.Rows[j]["partcode"].ToString();
+ cbp.name = data.Rows[j]["partname"].ToString();
+ cbp.spec = data.Rows[j]["partspec"].ToString();
+ cbp.planqty = data.Rows[j]["saleOrderqty"].ToString();
+ cbp.goodqty = data.Rows[j]["good_qty"].ToString();
+ cmp.children.Add(cbp);
+ }
+ list.Add(cmp);
+ }
+ mes.code = "200";
+ mes.message = "success!";
+ mes.data = list;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犵鍚堣姹傚崟鎹紒";
+ mes.data = null;
+ }
+ break;
+ case "MO": //鎸夌敓浜ц鍗曠粺璁�
+ if (partcode != "" && partcode != null)
+ {
+ string[] selects = Array.ConvertAll<string, string>(partcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ search += " and A.materiel_code in @partcode ";
+ dynamicParams.Add("@partcode", selects.ToArray());
+ }
+ if (startopendate != "" && startopendate != null)
+ {
+ search += " and convert(varchar(100),A.createdate,21)>=@startopendate and convert(varchar(100),A.createdate,21)<=@endclosedate ";
+ dynamicParams.Add("@startopendate", startopendate + " 00:00:00");
+ dynamicParams.Add("@endclosedate", endclosedate + " 23:59:59");
+ }
+ //鑾峰彇鍗曟嵁淇℃伅
+ sql = @"select distinct A.wo,A.createdate,sum(A.qty) as orderqty
+ from TKimp_Ewo A
+ where 1=1 " + search + " group by A.wo,A.createdate order by A.createdate desc";
+ dt = DapperHelper.selectlist(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ AppScheduleKanban cmp = new AppScheduleKanban();
+ cmp.ordercode = dt.Rows[i]["wo"].ToString();
+ cmp.orderqty = dt.Rows[i]["orderqty"].ToString();
+ cmp.children = new List<AppScheduleKanbanSub>();
+ //鑾峰彇鍗曟嵁涓嬩骇鍝佸畬鎴愪俊鎭�
+ sql = @"select distinct E.wo,T.partcode,T.partname,T.partspec,sum(E.qty) as orderqty,isnull(BB.good_qty,0) as good_qty
+ from TKimp_Ewo E
+ left join TMateriel_Info T on E.materiel_code=T.partcode
+ left join (
+ select M.m_po,sum(S.good_qty) as good_qty from TK_Wrk_Man M
+ inner join TK_Wrk_Step S on M.wo_code=S.wo_code
+ where S.isend='Y' and S.good_qty>0
+ group by M.m_po
+ ) as BB on E.wo=BB.m_po
+ where E.wo=@wo and E.status<>'CLOSED'
+ group by E.wo,T.partcode,T.partname,T.partspec,BB.good_qty";
+ dynamicParams.Add("@wo", dt.Rows[i]["wo"].ToString());
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ decimal good_qty = data.AsEnumerable().Select(d => d.Field<decimal>("good_qty")).Sum(); //鎶ュ伐鎬绘暟閲�
+ cmp.ordergoodqty = good_qty.ToString();
+ for (int j = 0; j < data.Rows.Count; j++)
+ {
+ AppScheduleKanbanSub cbp = new AppScheduleKanbanSub();
+ cbp.code = data.Rows[j]["partcode"].ToString();
+ cbp.name = data.Rows[j]["partname"].ToString();
+ cbp.spec = data.Rows[j]["partspec"].ToString();
+ cbp.planqty = data.Rows[j]["orderqty"].ToString();
+ cbp.goodqty = data.Rows[j]["good_qty"].ToString();
+ cmp.children.Add(cbp);
+ }
+ list.Add(cmp);
+ }
+ mes.code = "200";
+ mes.message = "success!";
+ mes.data = list;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犵鍚堣姹傚崟鎹紒";
+ mes.data = null;
+ }
+ break;
+ case "PO": //鎸夌敓浜у伐鍗曠粺璁�
+ if (partcode != "" && partcode != null)
+ {
+ string[] selects = Array.ConvertAll<string, string>(partcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ search += " and A.materiel_code in @partcode ";
+ dynamicParams.Add("@partcode", selects.ToArray());
+ }
+ if (startopendate != "" && startopendate != null)
+ {
+ search += " and convert(varchar(100),A.lm_date,21)>=@startopendate and convert(varchar(100),A.lm_date,21)<=@endclosedate ";
+ dynamicParams.Add("@startopendate", startopendate + " 00:00:00");
+ dynamicParams.Add("@endclosedate", endclosedate + " 23:59:59");
+ }
+ //鑾峰彇鍗曟嵁淇℃伅
+ sql = @"select distinct A.wo_code,T.partcode,T.partname,T.partspec,A.lm_date,sum(A.plan_qty) as orderqty
+ from TK_Wrk_Man A
+ left join TMateriel_Info T on A.materiel_code=T.partcode
+ where A.status<>'CLOSED' " + search + search1 + " group by A.wo_code,T.partcode,T.partname,T.partspec,A.lm_date order by A.lm_date desc";
+ dt = DapperHelper.selectlist(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ AppScheduleKanban cmp = new AppScheduleKanban();
+ cmp.ordercode = dt.Rows[i]["wo_code"].ToString();
+ cmp.partcode = dt.Rows[i]["partcode"].ToString();
+ cmp.partname = dt.Rows[i]["partname"].ToString();
+ cmp.partspec = dt.Rows[i]["partspec"].ToString();
+ cmp.orderqty = dt.Rows[i]["orderqty"].ToString();
+ cmp.children = new List<AppScheduleKanbanSub>();
+ //鑾峰彇鍗曟嵁涓嬩骇鍝佸畬鎴愪俊鎭�
+ sql = @"select M.wo_code,T.stepcode,T.stepname,S.plan_qty,S.good_qty,S.isend
+ from TK_Wrk_Man M
+ inner join TK_Wrk_Step S on M.wo_code=S.wo_code
+ left join TStep T on S.step_code=T.stepcode
+ where M.wo_code=@wo_code
+ order by S.seq ";
+ dynamicParams.Add("@wo_code", dt.Rows[i]["wo_code"].ToString());
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ cmp.ordergoodqty = data.AsEnumerable().Where(t => t.Field<string>("isend") == "Y").ToList().Select(c => c.Field<decimal>("good_qty")).First().ToString();
+ for (int j = 0; j < data.Rows.Count; j++)
+ {
+ AppScheduleKanbanSub cbp = new AppScheduleKanbanSub();
+ cbp.code = data.Rows[j]["stepcode"].ToString();
+ cbp.name = data.Rows[j]["stepname"].ToString();
+ cbp.spec = data.Rows[j]["isend"].ToString();
+ cbp.planqty = data.Rows[j]["plan_qty"].ToString();
+ cbp.goodqty = data.Rows[j]["good_qty"].ToString();
+ cmp.children.Add(cbp);
+ }
+ list.Add(cmp);
+ }
+ else
+ {
+ cmp.ordergoodqty = "0";
+ list.Add(cmp);
+ }
+ }
+ mes.code = "200";
+ mes.message = "success!";
+ mes.data = list;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犵鍚堣姹傚崟鎹紒";
+ mes.data = null;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/AppPersonalDAL.cs b/VueWebCoreApi/DLL/DAL/AppPersonalDAL.cs
new file mode 100644
index 0000000..7c9a8c9
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/AppPersonalDAL.cs
@@ -0,0 +1,67 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Globalization;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class AppPersonalDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[App涓汉璁′欢宸ヨ祫]
+ public static ToMessage PieceRateWage(string compute, User us, string startopendate, string endclosedate)
+ {
+ Dictionary<object, object> dList = new Dictionary<object, object>();
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ string sql = "";
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ // --------------鏌ヨ鎶ュ伐鏁般�佽壇鍝佹墸闄ゃ�佽绠楀伐璧勬敹鍏�--------------
+ sql = @"h_p_JLApp_PieceRateWageSummary";
+ dynamicParams.Add("@compute", compute);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@startopendate", startopendate + " 00:00:00");
+ dynamicParams.Add("@endclosedate", endclosedate + " 23:59:59");
+ var data0 = DapperHelper.selectProcedure(sql, dynamicParams);
+ dList.Add("dt0", data0);
+
+ // --------------鏌ヨ鎶ュ伐鏄庣粏(鎸夌収宸ュ崟銆佷骇鍝併�佸伐搴忓垎缁�)--------------
+ sql = @"h_p_JLApp_PieceRateWageDetailed";
+ dynamicParams.Add("@compute", compute);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@startopendate", startopendate + " 00:00:00");
+ dynamicParams.Add("@endclosedate", endclosedate + " 23:59:59");
+ var data1 = DapperHelper.selectProcedure(sql, dynamicParams);
+ dList.Add("dt1", data1);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dList;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/BaseDateDAL.cs b/VueWebCoreApi/DLL/DAL/BaseDateDAL.cs
new file mode 100644
index 0000000..02c2866
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/BaseDateDAL.cs
@@ -0,0 +1,417 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class BaseDateDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+ #region[閲囪喘渚涙柟淇℃伅鏌ヨ]
+ public static ToMessage PurchSupplierSelect()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select code,name from TCustomer
+ where type in('211','228') and is_delete='0'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[閮ㄩ棬淇℃伅鏌ヨ]
+ public static ToMessage DepartMentSelect()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select org_code as code,org_name as name from TOrganization
+ where description='D' and is_delete='0'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱淇℃伅鏌ヨ]
+ public static ToMessage StoreHouseSearch()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select code,name from T_Sec_Stck";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[搴撲綅淇℃伅鏌ヨ]
+ public static ToMessage WarehouseLocationSearch()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select code,name from T_Sec_Loca";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[搴撲綅鏌ユ壘浠撳簱]
+ public static ToMessage WarehouseLocationSearchStoreHouse(string locationcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select code,name from T_Sec_Loca";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.message = "搴撲綅淇℃伅涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ sql = @"select A.code as locationcode,A.name as locationname,B.code as warehousecode,B.name as warehousename
+ from T_Sec_Loca A
+ inner join T_Sec_Stck B on A.stock_code=B.code
+ where A.code=@locationcode";
+ dynamicParams.Add("@locationcode", locationcode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鍗曚綅淇℃伅鏌ヨ]
+ public static ToMessage UnitSerch()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select code,name from TUom
+ where is_delete='0'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璐ㄦ鏂规淇℃伅]
+ public static ToMessage QualityScheme()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select code,name,sampmethod,sampscare from TStepCheckStandard
+ where status='Y' and checktype='InCheck'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀛樿揣鏌ヨ]
+ public static ToMessage InventorySelect(string param)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TMateriel_Info where concat(partcode, partname,partspec) like concat('%',@param,'%');";
+ dynamicParams.Add("@param", param);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[閫氳繃閫夋嫨鐨勬墍灞炵粍缁囨煡璇㈡墍灞炵彮缁刔
+ public static ToMessage StorgGroupSelect(string stu_torgcode, string description)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ switch (description)
+ {
+ case "":
+ break;
+ case "D":
+ search += "and parent.org_code=@stu_torgcode or child.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and parent.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ var sql = @"select group_code,group_name
+ from TGroup G
+ left join TOrganization parent on G.torg_code=parent.org_code
+ left join TOrganization as child on parent.parent_id=child.id
+ where G.is_delete<>'1' " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[閫氳繃閫夋嫨鐨勬墍灞炵粍缁囨煡璇㈡墍灞炶鑹茬被鍨媇
+ public static ToMessage StorgRoleSelect(string stu_torgcode, string description)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ //鑾峰彇璁惧绫诲瀷鏁版嵁
+ switch (description)
+ {
+ case "":
+ break;
+ case "D":
+ search += "and parent.org_code=@stu_torgcode or child.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and parent.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ var sql = @"select roletype_code,roletype_name,torg_code,parent.org_name
+ from TRoleType R
+ left join TOrganization parent on R.torg_code=parent.org_code
+ left join TOrganization as child on parent.parent_id=child.id
+ where R.is_delete<>'1' " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[ERP鐢熶骇杞﹂棿/閮ㄩ棬淇℃伅鏌ヨ]
+ public static ToMessage ErpWkshopDepartmentSelect()
+ {
+ string sql = "";
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_BASIC_Wkshop_Department";
+ var data = DapperHelper.lissql(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "erp绯荤粺涓湭缁存姢姝や俊鎭�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[ERP鐢熶粨搴撲俊鎭煡璇
+ public static ToMessage ErpWarehouseSelect()
+ {
+ string sql = "";
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_BASIC_Warehouse";
+ var data = DapperHelper.lissql(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "erp绯荤粺涓湭缁存姢姝や俊鎭�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[ERP鐢熺敤鎴蜂俊鎭煡璇
+ public static ToMessage ErpUserSelect()
+ {
+ string sql = "";
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_BASIC_User";
+ var data = DapperHelper.lissql(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "erp绯荤粺涓湭缁存姢姝や俊鎭�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs b/VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs
new file mode 100644
index 0000000..591982b
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs
@@ -0,0 +1,4296 @@
+锘縰sing Dapper;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.RolePermission;
+using VueWebCoreApi.Models.WorkData;
+using VueWebCoreApi.Tools;
+using static VueWebCoreApi.Models.RolePermission.RolePermission;
+using static VueWebCoreApi.Models.RolePermission.RolePermissionSava;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class BasicSettingDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+ public static dynamic CompanyCode = AppSetting.GetAppSetting("CompanyCode");
+ public static dynamic CompanyName = AppSetting.GetAppSetting("CompanyName");
+
+
+
+ #region[寰�鏉ュ崟浣嶆煡璇
+ public static ToMessage CurrentUnitSearch(string cuntUnitCode, string cuntUnitName, string unitAttr, string createUser, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (cuntUnitCode != "" && cuntUnitCode != null)
+ {
+ search += "and A.code like '%'+@cuntUnitCode+'%' ";
+ dynamicParams.Add("@cuntUnitCode", cuntUnitCode);
+ }
+ if (cuntUnitName != "" && cuntUnitName != null)
+ {
+ search += "and A.name like '%'+@cuntUnitName+'%' ";
+ dynamicParams.Add("@cuntUnitName", cuntUnitName);
+ }
+ if (unitAttr != "" && unitAttr != null)
+ {
+ search += "and A.type=@unitAttr ";
+ dynamicParams.Add("@unitAttr", unitAttr);
+ }
+ if (createUser != "" && createUser != null)
+ {
+ search += "and T.username like '%'+@createUser+'%' ";
+ dynamicParams.Add("@createUser", createUser);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.type,A.conttacts,A.conttphone,A.addr,T.username as lm_user,A.lm_date from TCustomer A
+ left join TUser T on A.lm_user=T.usercode
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶆柊澧炵紪杈慮
+ public static ToMessage AddUpdateCurrentUnit(string unitid, string unitcode, string unitname, string typecode, string person, string contact, string description, string usercode, string OperType)
+ {
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ var sql0 = @"select * from TCustomer where code=@unitcode";
+ dynamicParams.Add("@unitcode", unitcode);
+ var data = DapperHelper.selectdata(sql0, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,缂栫爜閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+ var sql = @"insert into TCustomer(code,name,type,conttacts,conttphone,addr,lm_user,lm_date)
+ values(@unitcode,@unitname,@typecode,@person,@contact,@description,@usercode,@CreateDate)";
+ dynamicParams.Add("@unitcode", unitcode);
+ dynamicParams.Add("@unitname", unitname);
+ dynamicParams.Add("@typecode", typecode);
+ dynamicParams.Add("@person", person);
+ dynamicParams.Add("@contact", contact);
+ dynamicParams.Add("@description", description);
+ dynamicParams.Add("@usercode", usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ var sql = @"update TCustomer set name=@unitname,type=@typecode,conttacts=@person,conttphone=@contact,addr=@description,lm_user=@usercode,lm_date=@CreateDate where id=@unitid";
+ dynamicParams.Add("@unitid", unitid);
+ dynamicParams.Add("@unitname", unitname);
+ dynamicParams.Add("@typecode", typecode);
+ dynamicParams.Add("@person", person);
+ dynamicParams.Add("@contact", contact);
+ dynamicParams.Add("@description", description);
+ dynamicParams.Add("@usercode", usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅垹闄
+ public static ToMessage DeleteCurrentUnit(string unitcode)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ sql = @"select * from TFlw_Rteqp where eqp_code=@unitcode";
+ dynamicParams.Add("@unitcode", unitcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶栧崗渚涙柟宸插叧鑱斿鍗忓伐搴�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎寰�鏉ュ崟浣嶈〃
+ sql = @"delete TCustomer where code=@unitcode";
+ list.Add(new { str = sql, parm = new { unitcode = unitcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[閫氳繃杞﹂棿缂栫爜鏌ユ壘璁惧淇℃伅]
+ public static ToMessage WhkspIsEqpSearch(string wkshpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇璁惧涓嬫媺妗嗘暟鎹�
+ sql = @"select code as eqp_code,name as eqp_name
+ from TEqpInfo where wksp_code=@wkshpcode and enable='Y' ";
+ dynamicParams.Add("@wkshpcode", wkshpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+
+ #region[缁勭粐鏋舵瀯,鏌ヨ缁勭粐淇℃伅]
+ public static ToMessage STorgData(string storg_code, string storg_name)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (storg_code != "" && storg_code != null)
+ {
+ search += "and T.torg_code like '%'+@storg_code+'%' ";
+ dynamicParams.Add("@storg_code", storg_code);
+ }
+ if (storg_name != "" && storg_name != null)
+ {
+ search += "and T.torg_name like '%'+@storg_name+'%' ";
+ dynamicParams.Add("@storg_name", storg_name);
+ }
+ var sql = @"select T.id,T.parent_id,T.torg_code,T.torg_name,T.status,T.leve,T.torg_seq,
+ T.lm_user as usercode,U.username,T.lm_date
+ from TOrganization T
+ left join TUser U on T.lm_user=U.usercode
+ where 1=1" + search + " order by T.lm_date desc";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = data.Rows.Count;
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏂板缂栬緫缁勭粐鏋舵瀯]
+ public static ToMessage AddUpdateOrganization(string OrganCode, string OrganName, string leve, string parent_id, string storgcode, string torg_seq, string status, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ sql = @"select * from TOrganization where torg_code=@organCode";
+ dynamicParams.Add("@organCode", OrganCode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触,缂栫爜閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+
+ sql = @"insert into TOrganization(parent_id,torg_code,torg_name,status,leve,torg_seq,lm_user,lm_date)
+ values(@parent_id,@torg_code,@torg_name,@status,@leve,@torg_seq,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ parent_id = storgcode,
+ torg_code = OrganCode,
+ torg_name = OrganName,
+ status = status,
+ leve = leve,
+ torg_seq = torg_seq,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗙粍缁�:" + OrganCode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇鎵�灞炵粍缁囨槸鍚︽湁鍙樻洿
+ if (parent_id != storgcode)
+ {
+ //鍒ゆ柇鏂伴�夋嫨鐨勭粍缁囨槸鍚﹁寮曠敤
+ sql = @"select * from TUser where storg_code=@storgcode and status='Y'";
+ dynamicParams.Add("@storgcode", storgcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂伴�夋嫨鐨勬墍灞炵粍缁囧凡浣跨敤涓嶅厑璁镐慨鏀�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ //鍒ゆ柇鍘熸湁缁勭粐鍙婂瓙绾ф槸鍚﹁寮曠敤
+ sql = @"with CTE as (
+ select torg_code
+ from TOrganization
+ where torg_code =@OrganCode
+ union all
+ select t.torg_code
+ from TOrganization AS t
+ inner join CTE AS c ON t.parent_id = c.torg_code
+ )
+ select * from TUser
+ where storg_code in (select torg_code from CTE)";
+ dynamicParams.Add("@OrganCode", OrganCode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鍘熸湁缁勭粐鎴栧瓙绾ц浣跨敤涓嶅厑璁镐慨鏀�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //淇敼褰撳墠缁勭粐鏁版嵁
+ sql = @"update TOrganization set parent_id=@parent_id,torg_name=@torg_name,leve=@leve,torg_seq=@torg_seq,lm_user=@lm_user,lm_date=@lm_date
+ where torg_code=@torg_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ parent_id = storgcode,
+ torg_code = OrganCode,
+ torg_name = OrganName,
+ leve = leve,
+ torg_seq = torg_seq,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //閫掑綊鏇存柊鐘舵��,褰撳墠閫変腑鏁版嵁鍙婂瓙绾�
+ sql = @"with CTE as (
+ select torg_code
+ from TOrganization
+ where torg_code =@OrganCode
+ union all
+ select t.torg_code
+ from TOrganization AS t
+ inner join CTE AS c ON t.parent_id = c.torg_code
+ )
+ update TOrganization set status=@status
+ where torg_code in (select torg_code from CTE)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ OrganCode = OrganCode,
+ status = status
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗙粍缁�:" + OrganCode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [缁勭粐鏋舵瀯鍒犻櫎]
+ public static ToMessage DeleteOrganization(string orgcode, User us)
+ {
+ var sql = "";
+ var cont = 0;
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TOrganization where parent_id=@orgcode";
+ dynamicParams.Add("@orgcode", orgcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠缁勭粐鏈変笅绾у叧鑱�,璇峰厛鍒犻櫎涓嬬骇缁勭粐!";
+ return mes;
+ }
+ sql = @"select * from TUser where storg_code=@orgcode";
+ dynamicParams.Add("@orgcode", orgcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇ョ粍缁囦笅鏈夊叧鑱旂殑鐢ㄦ埛,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ sql = @"delete TOrganization where torg_code=@orgcode";
+ dynamicParams.Add("@orgcode", orgcode);
+ cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗙粍缁�:" + orgcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[宀椾綅淇℃伅鍒楄〃鏌ヨ]
+ public static ToMessage PostData(string postcode, string postname, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (postcode != "" && postcode != null)
+ {
+ search += "and P.postcode like '%'+@postcode+'%' ";
+ dynamicParams.Add("@postcode", postcode);
+ }
+ if (postname != "" && postname != null)
+ {
+ search += "and P.postname like '%'+@postname+'%' ";
+ dynamicParams.Add("@postname", postname);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select P.id,P.postcode,P.postname,P.status,P.description,
+ P.lm_user as usercode,U.username,P.lm_date
+ from TPost P
+ left join TUser U on P.lm_user=U.usercode
+ where 1=1 " + search + "";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宀椾綅鏂板缂栬緫]
+ public static ToMessage AddUpdatePost(string postcode, string postname, string description, string status, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ sql = @"select * from TPost where postcode=@postcode";
+ dynamicParams.Add("@postcode", postcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触,缂栫爜閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+
+ sql = @"insert into TPost(postcode,postname,status,description,lm_user,lm_date)
+ values(@postcode,@postname,@status,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ postcode = postcode,
+ postname = postname,
+ status = status,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗矖浣�:" + postcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ if (status == "N")
+ {
+ //褰撳矖浣嶇姸鎬佷负鍋滅敤鏃�,鍒ゆ柇褰撳墠宀椾綅鏄惁琚敤鎴峰紩鐢�
+ sql = @"select * from TUser where ',' + post_code + ',' like '%,'+@postcode+',%'";
+ dynamicParams.Add("@postcode", postcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇ュ矖浣嶆湁鍏宠仈鐨勭敤鎴�,涓嶅厑璁稿仠鐢�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ sql = @"update TPost set postname=@postname,status=@status,description=@description,lm_user=@lm_user,lm_date=@lm_date
+ where postcode=@postcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ postcode = postcode,
+ postname = postname,
+ status = status,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗矖浣�:" + postcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宀椾綅鍒犻櫎鍒犻櫎]
+ public static ToMessage DeletePost(string postcode, User us)
+ {
+ var sql = "";
+ var cont = 0;
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TUser where ',' + post_code + ',' like '%,'+@postcode+',%'";
+ dynamicParams.Add("@postcode", postcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇ュ矖浣嶆湁鍏宠仈鐨勭敤鎴�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ sql = @"delete TPost where postcode=@postcode";
+ dynamicParams.Add(@"postcode", postcode);
+ cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗矖浣�:" + postcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐢ㄦ埛淇℃伅鍒楄〃鏌ヨ]
+ public static ToMessage UserData(string storgcode, string usercode, string username, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search0 = "";
+ string search = "";
+ try
+ {
+ if (storgcode != "" && storgcode != null)
+ {
+ search0 += "and torg_code=@storgcode ";
+ dynamicParams.Add("@storgcode", storgcode);
+ }
+ if (usercode != "" && usercode != null)
+ {
+ search += "and U.usercode like '%'+@usercode+'%' ";
+ dynamicParams.Add("@usercode", usercode);
+ }
+ if (username != "" && username != null)
+ {
+ search += "and U.username like '%'+@username+'%' ";
+ dynamicParams.Add("@username", username);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var withsql = @"with cte as (
+ select torg_code, torg_name, parent_id
+ from TOrganization
+ where status='Y' " + search0 + " union all select T.torg_code, T.torg_name, T.parent_id from TOrganization T inner join CTE ON T.parent_id = CTE.torg_code)";
+ var sql = @"SELECT distinct U.usercode,U.username,U.password,U.payrate,U.mobile,U.email,U.status,U.storg_code as storg_code,T.torg_name as storg_name,T.parent_id,
+ U.role_code,
+ STUFF((SELECT ',' + R.rolename
+ FROM TRole R
+ WHERE CHARINDEX(',' + R.rolecode + ',', ',' + U.role_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS rolename,
+ U.post_code,
+ STUFF((SELECT ',' + P.postname
+ FROM TPost P
+ WHERE CHARINDEX(',' + P.postcode + ',', ',' + U.post_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS postname,
+ U.group_code,
+ STUFF((SELECT ',' + P.usergroupname
+ FROM TGroup P
+ WHERE CHARINDEX(',' + P.usergroupcode + ',', ',' + U.group_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS group_name,
+ U.lm_user as createusercode,S.username as createusername,U.lm_date
+ FROM TUser U
+ inner join cte on U.storg_code=cte.torg_code
+ left join TOrganization T on U.storg_code=T.torg_code
+ left join TUser S on U.lm_user=S.usercode
+ where 1=1 " + search + "";
+ var data = DapperHelper.GetPagedDataWith<object>(withsql, sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢ㄦ埛淇℃伅鏂板缂栬緫]
+ public static ToMessage AddUpdateUserSave(string usercode, string username, string password,string payrate, string mobile, string email, string storg_code, string status, string post_code, string role_code, string group_code, string opertype, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ //string result = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鏌ヨ鎵�鏈夌殑缁勭粐鏁版嵁
+ //sql = @"select * from TOrganization where status='Y'";
+ //var dattorg = DapperHelper.selecttable(sql);
+
+ //鏍规嵁鏂板鐢ㄦ埛鍏宠仈鐨勮鑹叉煡鎵捐鑹茶〃瀵瑰簲鐨勬暟鎹寖鍥�
+ //string[] rolecode = Array.ConvertAll<string, string>(role_code.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ //sql = @"select R.datarange,T.dataname,R.datapermissions from TRole R
+ // inner join TData T on R.datarange=T.datacode
+ // where R.rolecode in @rolecode and R.status='Y'";
+ //dynamicParams.Add("@rolecode", rolecode);
+ //var data0 = DapperHelper.selectlist(sql, dynamicParams);
+ //浣跨敤LINQ鍘婚噸,鍚堝苟鏁版嵁鑼冨洿
+ //DataTable dtResult = data0.AsEnumerable().Distinct(DataRowComparer.Default).CopyToDataTable();
+
+ //for (int i = 0; i < dtResult.Rows.Count; i++)
+ //{
+ // switch (dtResult.Rows[i]["dataname"].ToString())
+ // {
+ // case "鍏ㄩ儴":
+ // //鏌ヨ鎵�鏈夌粍缁囩紪鐮�
+ // // 浣跨敤lambda琛ㄨ揪寮忔煡璇ame瀛楁锛屽苟閫氳繃閫楀彿闅斿紑
+ // string all = string.Join(",", dattorg.AsEnumerable().Select(row => row.Field<string>("torg_code")));
+ // result += all + ",";
+ // break;
+ // //鏌ヨ鏈儴闂ㄧ粍缁囩紪鐮�
+ // case "鏈骇":
+ // // 浣跨敤閫掑綊鍜� lambda 琛ㄨ揪寮忔煡璇㈡寚瀹� id 鐨勭埗绾х紪鐮�,leve=1 浠h〃閮ㄩ棬
+ // string leve = storg_code;
+ // result += leve + ",";
+ // break;
+ // //鏈汉缂栫爜
+ // case "鏈汉":
+ // result += usercode + ",";
+ // break;
+ // //鏌ヨ鑷畾涔夌殑缁勭粐缂栫爜
+ // case "鑷畾涔�":
+ // result += dtResult.Rows[i]["datapermissions"].ToString() + ",";
+ // break;
+ // default:
+ // break;
+ // }
+ //}
+ //// 绉婚櫎鏈�鍚庝竴涓�楀彿
+ //result = result.TrimEnd(',');
+ ////鍘婚櫎閲嶅鍊�
+ //result = string.Join(",", result.Split(',').Distinct().ToArray());
+
+ if (opertype == "Add")
+ {
+ //鏌ヨ鏂板鐢ㄦ埛缂栫爜鏄惁閲嶅
+ sql = @"select * from TUser where usercode=@usercode";
+ dynamicParams.Add("@usercode", usercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触,缂栫爜閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+ sql = @"insert into TUser(usercode,username,password,payrate,mobile,email,status,storg_code,role_code,role_datapermissions,post_code,group_code,is_system_admin,lm_user,lm_date)
+ values(@usercode,@username,@password,@payrate,@mobile,@email,@status,@storg_code,@role_code,@role_datapermissions,@post_code,@group_code,@is_system_admin,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ usercode = usercode,
+ username = username,
+ password = password,
+ payrate= payrate,
+ mobile = mobile,
+ email = email,
+ status = status,
+ storg_code = storg_code,
+ role_code = role_code,
+ role_datapermissions = "",
+ post_code = post_code,
+ group_code = group_code,
+ is_system_admin = "N",
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗙敤鎴�:" + usercode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+
+ sql = @"update TUser set username=@username,password=@password,payrate=@payrate,mobile=@mobile,email=@email,status=@status,storg_code=@storg_code,
+ role_code=@role_code,role_datapermissions=@role_datapermissions,post_code=@post_code,group_code=@group_code,lm_user=@lm_user,lm_date=@lm_date
+ where usercode=@usercode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ usercode = usercode,
+ username = username,
+ password = password,
+ payrate= payrate,
+ mobile = mobile,
+ email = email,
+ status = status,
+ storg_code = storg_code,
+ role_code = role_code,
+ role_datapermissions = "",
+ post_code = post_code,
+ group_code = group_code,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗙敤鎴�:" + usercode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢ㄦ埛淇℃伅鍒犻櫎]
+ public static ToMessage DeleteUserSave(string usercode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠鐢ㄦ埛鏄惁鏈夋姤宸ヨ褰�
+
+ sql = @"delete TUser where usercode=@usercode";
+ list.Add(new { str = sql, parm = new { usercode = usercode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗙敤鎴�:" + usercode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鐢ㄦ埛鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鐢ㄦ埛澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐝粍淇℃伅鍒楄〃鏌ヨ]
+ public static ToMessage GroupData(string groupcode, string groupname, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (groupcode != "" && groupcode != null)
+ {
+ search += "and G.usergroupcode like '%'+@groupcode+'%' ";
+ dynamicParams.Add("@groupcode", groupcode);
+ }
+ if (groupname != "" && groupname != null)
+ {
+ search += "and G.usergroupname like '%'+@groupname+'%' ";
+ dynamicParams.Add("@groupname", groupname);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select G.usergroupcode,G.usergroupname,G.status,G.description,
+ G.lm_user as usercode,U.username,G.lm_date
+ from TGroup G
+ left join TUser U on G.lm_user=U.usercode
+ where 1=1 " + search + "";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐝粍鏂板缂栬緫]
+ public static ToMessage AddUpdateGroup(string groupcode, string groupname, string description, string status, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ sql = @"select * from TGroup where usergroupcode=@groupcode";
+ dynamicParams.Add("@groupcode", groupcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触,缂栫爜閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+
+ sql = @"insert into TGroup(usergroupcode,usergroupname,status,description,lm_user,lm_date)
+ values(@usergroupcode,@usergroupname,@status,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ usergroupcode = groupcode,
+ usergroupname = groupname,
+ status = status,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗙彮缁�:" + groupcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ if (status == "N")
+ {
+ //褰撶彮缁勭姸鎬佷负鍋滅敤鏃�,鍒ゆ柇褰撳墠鐝粍鏄惁琚敤鎴峰紩鐢�
+ sql = @"select * from TUser where ',' + group_code + ',' like '%,'+@groupcode+',%'";
+ dynamicParams.Add("@groupcode", groupcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇ョ彮缁勬湁鍏宠仈鐨勭敤鎴�,涓嶅厑璁稿仠鐢�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ sql = @"update TGroup set usergroupname=@usergroupname,status=@status,description=@description,lm_user=@lm_user,lm_date=@lm_date
+ where usergroupcode=@usergroupcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ usergroupcode = groupcode,
+ usergroupname = groupname,
+ status = status,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗙彮缁�:" + groupcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐝粍鍒犻櫎]
+ public static ToMessage DeleteGroup(string groupcode, User us)
+ {
+ var sql = "";
+ var cont = 0;
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TUser where ',' + group_code + ',' like '%,'+@groupcode+',%'";
+ dynamicParams.Add("@groupcode", groupcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇ョ彮缁勬湁鍏宠仈鐨勭敤鎴�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ sql = @"delete TGroup where usergroupcode=@groupcode";
+ dynamicParams.Add(@"groupcode", groupcode);
+ cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗙彮缁�:" + groupcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[瑙掕壊绠$悊鍒楄〃鏌ヨ]
+ public static ToMessage RoleData(string role_code, string role_name, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (role_code != "" && role_code != null)
+ {
+ search += "and R.rolecode like '%'+@role_code+'%' ";
+ dynamicParams.Add("@role_code", role_code);
+ }
+ if (role_name != "" && role_name != null)
+ {
+ search += "and R.rolename like '%'+@role_name+'%' ";
+ dynamicParams.Add("@role_name", role_name);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select R.rolecode,R.rolename,R.status,R.datarange as datacode,TB.dataname,
+ R.datapermissions as datapermissionscode,R.description,
+ STUFF((SELECT ',' + P.torg_name
+ FROM TOrganization P
+ WHERE CHARINDEX(',' + P.torg_code+ ',', ',' + R.datapermissions + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS datapermissionsname,
+ R.lm_user as usercode,U.username,R.lm_date
+ from TRole R
+ left join TData TB on R.datarange=TB.datacode
+ left join TUser U on R.lm_user=U.usercode
+ where 1=1 " + search + "";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鏂板銆佺紪杈戜繚瀛榏
+ public static ToMessage RoleAddUpdateSava(string menucode, string rolecode, string rolename, string status, string datacode, string datapermissions, string description, string OperType, User us)
+ {
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ string sql = "";
+ string updatedJson = "";
+ try
+ {
+ list.Clear();
+ if (OperType == "Add")
+ {
+ //鑾峰彇瑙掕壊缂栫爜
+ mes = SeachEncodeJob.EncodingSeach(menucode);
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ //鏌ヨ瑙掕壊鍚嶇О鏄惁瀛樺湪
+ sql = @"select * from TRole where rolename=@rolename";
+ dynamicParams.Add("@rolename", rolename);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.message = "鍚屽悕瑙掕壊宸插瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍐欏叆瑙掕壊琛�
+ sql = @"insert into TRole(rolecode,rolename,status,datarange,datapermissions,identifying,description,lm_user,lm_date)
+ values(@rolecode,@rolename,@status,@datarange,@datapermissions,@identifying,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ rolecode = ((List<string>)mes.data)[0].ToString(),
+ rolename = rolename,
+ status = status,
+ datarange = datacode,
+ datapermissions = datapermissions,
+ identifying = "2", //0(绠$悊鍛�) 1(鎵�鏈変汉) 2(鍏跺畠)
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //鍥炲啓缂栫爜瑙勫垯琛�
+ list.AddRange(SeachEncodeJob.StrEncodingUpdate(menucode, ((List<string>)mes.data)[1].ToString()));
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗚鑹�:" + ((List<string>)mes.data)[0].ToString(), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ if (status == "N")
+ {
+ //褰撹鑹茬姸鎬佷负鍋滅敤鏃�,鍒ゆ柇褰撳墠瑙掕壊鏄惁琚敤鎴峰紩鐢�
+ sql = @"select * from TUser where ',' + role_code + ',' like '%,'+@rolecode+',%'";
+ dynamicParams.Add("@rolecode", rolecode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇ヨ鑹叉湁鍏宠仈鐨勭敤鎴�,涓嶅厑璁稿仠鐢�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ //閫氳繃瑙掕壊缂栫爜鏌ヨ瑙掕壊鏁版嵁鍏宠仈琛�
+ sql = @"select * from TAuthority where rolecode=@rolecode";
+ dynamicParams.Add("@rolecode", rolecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ JArray jsonArray = JArray.Parse(data.Rows[0]["jsondate"].ToString());
+ jsonArray.Select(j =>
+ {
+ JObject jsonObject = (JObject)j;
+ if (datacode == "CUSTOM")
+ {
+ jsonObject["datacode"] = datapermissions;
+ }
+ else
+ {
+ jsonObject["datacode"] = datacode;
+ }
+ return j;
+ }).ToList();
+ updatedJson = JsonConvert.SerializeObject(jsonArray);
+ //鏇存柊瑙掕壊鏁版嵁琛�
+ sql = @"update TAuthority set jsondate=@jsondate,type=@type
+ where rolecode=@rolecode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ rolecode = rolecode,
+ jsondate = updatedJson,
+ type = us.usertype
+ }
+ });
+ }
+ //淇敼瑙掕壊琛�
+ sql = @"update TRole set rolename=@rolename,status=@status,datarange=@datarange,
+ datapermissions=@datapermissions,description=@description,lm_user=@lm_user,lm_date=@lm_date
+ where rolecode=@rolecode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ rolecode = rolecode,
+ rolename = rolename,
+ status = status,
+ datarange = datacode,
+ datapermissions = datapermissions,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗚鑹插悕绉�:" + rolecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒犻櫎]
+ public static ToMessage RoleDeleteSava(string rolecode, User us)
+ {
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ string sql = "";
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇褰撳墠瑙掕壊鏄惁鍏宠仈鐢ㄦ埛
+ sql = @"select * from TUser where ',' + role_code + ',' like '%,'+@rolecode+',%'";
+ dynamicParams.Add("@rolecode", rolecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇ヨ鑹叉湁鍏宠仈鐨勭敤鎴�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎瑙掕壊鏁版嵁鍏宠仈琛� TAuthority
+ sql = @"delete TAuthority where rolecode=@rolecode";
+ list.Add(new { str = sql, parm = new { rolecode = rolecode } });
+ //鍒犻櫎瑙掕壊琛�
+ sql = @"delete TRole where rolecode=@rolecode and identifying='2'";
+ list.Add(new { str = sql, parm = new { rolecode = rolecode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗚鑹�:" + rolecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鑾峰彇宸插垎閰嶇敤鎴峰垪琛╙
+ public static ToMessage RoleAssignedUserData(string flag, string role_code, string usercode, string username, string storg_code, string post_code, string group_code, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ switch (flag)
+ {
+ case "TRUE":
+ if (role_code != "" && role_code != null)
+ {
+ search += "and ',' + U.role_code + ',' like '%,'+@role_code+',%' ";
+ dynamicParams.Add("@role_code", role_code);
+ }
+ break;
+ case "FALSE":
+ if (role_code != "" && role_code != null)
+ {
+ search += "and ',' + U.role_code + ',' not like '%,'+@role_code+',%' ";
+ dynamicParams.Add("@role_code", role_code);
+ }
+ break;
+ }
+
+ if (usercode != "" && usercode != null)
+ {
+ search += "and U.usercode like '%'+@usercode+'%' ";
+ dynamicParams.Add("@usercode", usercode);
+ }
+ if (username != "" && username != null)
+ {
+ search += "and U.username like '%'+@username+'%' ";
+ dynamicParams.Add("@username", username);
+ }
+ if (storg_code != "" && storg_code != null)
+ {
+ search += "and U.storg_code=@storg_code ";
+ dynamicParams.Add("@storg_code", storg_code);
+ }
+ if (post_code != "" && post_code != null)
+ {
+ search += "and ',' + U.post_code + ',' like '%,'+@post_code+',%' ";
+ dynamicParams.Add("@post_code", post_code);
+ }
+ if (group_code != "" && group_code != null)
+ {
+ search += "and ',' + U.group_code + ',' like '%,'+@group_code+',%' ";
+ dynamicParams.Add("@group_code", group_code);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"SELECT distinct U.usercode,U.username,U.password,U.mobile,U.email,U.status,U.storg_code as storg_code,T.torg_name as storg_name,T.parent_id,
+ U.role_code,
+ STUFF((SELECT ',' + R.rolename
+ FROM TRole R
+ WHERE CHARINDEX(',' + R.rolecode + ',', ',' + U.role_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS rolename,
+ U.post_code,
+ STUFF((SELECT ',' + P.postname
+ FROM TPost P
+ WHERE CHARINDEX(',' + P.postcode + ',', ',' + U.post_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS postname,
+ U.group_code,
+ STUFF((SELECT ',' + P.usergroupname
+ FROM TGroup P
+ WHERE CHARINDEX(',' + P.usergroupcode + ',', ',' + U.group_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS group_name,
+ U.lm_user as createusercode,S.username as createusername,U.lm_date
+ FROM TUser U
+ left join TOrganization T on U.storg_code=T.torg_code
+ left join TUser S on U.lm_user=S.usercode
+ where 1=1 and U.status='Y' and U.role_code<>'' " + search + "";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鎵归噺鍙栨秷宸插垎閰嶇殑鐢ㄦ埛]
+ public static ToMessage RoleAssignedUserBatchCancel(string role_code, string[] user, User us)
+ {
+ List<object> list = new List<object>();
+ string sql = "";
+ try
+ {
+ list.Clear();
+ //鎵归噺鏇存柊鐢ㄦ埛琛ㄤ腑鍏宠仈鐨勮鑹�(鑷畾涔夊嚱鏁癟SplitString鏉ユ媶鍒嗗瓧绗︿覆)
+ sql = @"update TUser
+ set role_code = stuff(
+ (
+ select ',' + value
+ from dbo.TSplitString(role_code, ',')
+ where value <> @role_code
+ for XML PATH('')
+ ), 1, 1, ''
+ )
+ where usercode in @usercode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ role_code = role_code,
+ usercode = user
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍙栨秷", "鍙栨秷浜嗚鑹插叧鑱旂殑鐢ㄦ埛:" + string.Join(",", user), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瑙掕壊绠$悊鍒嗛厤鐢ㄦ埛,鎵归噺娣诲姞鏈垎閰嶇殑鐢ㄦ埛]
+ public static ToMessage RoleAssignedUserBatchAdd(string role_code, string[] user, User us)
+ {
+ List<object> list = new List<object>();
+ string sql = "";
+ try
+ {
+ list.Clear();
+ //鎵归噺鏇存柊鐢ㄦ埛琛ㄤ腑鍏宠仈鐨勮鑹�
+ sql = @"update TUser
+ set role_code = case
+ when role_code IS NULL OR role_code = '' then @role_code
+ else role_code + ',' + @role_code
+ end
+ where usercode in @usercode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ role_code = role_code,
+ usercode = user
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "娣诲姞", "娣诲姞浜嗚鑹插叧鑱旂殑鐢ㄦ埛:" + string.Join(",", user), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[瑙掕壊鏉冮檺鏌ヨ瑙掕壊]
+ public static ToMessage RolePermissionSearchRole()
+ {
+ List<TRole> list = new List<TRole>();
+ var dynamicParams = new DynamicParameters();
+ string sql = "";
+ try
+ {
+ //鏌ヨ鎵�鏈夎鑹�
+ sql = @"select R.rolecode as code,R.rolename as name,R.datarange,T.dataname,R.datapermissions,R.identifying
+ from TRole R
+ left join TData T on R.datarange=T.datacode
+ where status='Y'";
+ list = DapperHelper.select<TRole>(sql, null);
+ if (list.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = list.Count;
+ mes.message = "鏌ヨ瑙掕壊鎴愬姛锛�";
+ mes.data = list;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏆傛棤瑙掕壊锛�";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺鏌ヨ榛樿鑿滃崟鎸夐挳鏁版嵁]
+ public static ToMessage RolePermissionSearchRoleMenu(string type)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sql = "";
+ try
+ {
+ //鏌ヨ鎵�鏈夐粯璁よ彍鍗曞強鎸夐挳銆佹暟鎹�
+ sql = @"select menucode,menu_seq,menuname,parent_id,buttoncodelist
+ from TMenu
+ where is_show='Y' and Type=@type ";
+ dynamicParams.Add("@type", type);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛锛�";
+ mes.data = data;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏆傛棤鑿滃崟锛�";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺,鏍规嵁瑙掕壊鏌ユ壘鍏宠仈鏉冮檺]
+ public static ToMessage RolePermissionSearchRoleMenuButton(string rolecode, string type)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sql = "";
+ try
+ {
+ //鏌ヨ鎵�鏈夐粯璁よ彍鍗曞強鎸夐挳銆佹暟鎹�
+ sql = @"select jsondate from TAuthority where rolecode=@rolecode and type=@type";
+ dynamicParams.Add("@rolecode", rolecode);
+ dynamicParams.Add("@type", type);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛锛�";
+ mes.data = data;
+ return mes;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瑙掕壊鏉冮檺,鎻愪氦]
+ public static ToMessage RolePermissionSava(string json, string rolecode, string type, User us)
+ {
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ string sql = "";
+ try
+ {
+ list.Clear();
+ //鍒犻櫎鏉冮檺鍏崇郴琛�
+ sql = @"delete from TAuthority where rolecode=@rolecode and type=@type";
+ list.Add(new { str = sql, parm = new { rolecode = rolecode.ToString(), type = type } });
+ //閲嶆柊鍐欏叆鏉冮檺鍏崇郴琛�
+ sql = @"insert into TAuthority(rolecode,jsondate,type) values(@rolecode,@jsondate,@type)";
+ list.Add(new { str = sql, parm = new { rolecode = rolecode, jsondate = json.ToString(), type = type } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒嗛厤", "鍒嗛厤浜嗚鑹叉潈闄�:" + "-->瑙掕壊:" + rolecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[寰�鏉ュ崟浣嶅垎绫讳俊鎭痌
+ public static ToMessage TCunstomerClassTree()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇寰�鏉ュ崟浣嶅垎绫讳俊鎭�
+ sql = @"select code,name,idparent,data_sources from TCustomerType ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅垎绫绘柊澧�/缂栬緫鎻愪氦]
+ public static ToMessage TCunstomerClassTreeAddUpdate(string data_sources, string customerclasscode, string customerclassname, string parentcode, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (parentcode != "" || parentcode != null) //寰�鏉ュ崟浣嶅垎绫讳笂绾х紪鐮佷负绌�
+ {
+ sql = @"select * from TCustomer where customertype=@parentcode";
+ dynamicParams.Add("@parentcode", parentcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "寰�鏉ュ崟浣嶅垎绫讳笂绾т笉鑳芥槸宸叉湁寰�鏉ュ崟浣嶇殑鍒嗙被锛岃閲嶆柊杈撳叆锛�";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (OperType == "Add")
+ {
+ //鍒ゆ柇寰�鏉ュ崟浣嶅垎绫荤紪鐮佹槸鍚﹂噸澶�
+ sql = @"select * from TCustomerType where code=@customerclasscode";
+ dynamicParams.Add("@customerclasscode", customerclasscode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "寰�鏉ュ崟浣嶅垎绫荤紪鐮佸凡瀛樺湪,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇寰�鏉ュ崟浣嶅垎绫诲悕绉版槸鍚﹂噸澶�
+ sql = @"select * from TCustomerType where name=@customerclassname";
+ dynamicParams.Add("@customerclassname", customerclassname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "寰�鏉ュ崟浣嶅垎绫诲悕绉板凡瀛樺湪,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍐欏叆寰�鏉ュ崟浣嶅垎绫�
+ sql = @"insert into TCustomerType(code,name,idparent,lm_user,lm_date,data_sources)
+ values(@code,@name,@idparent,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = customerclasscode,
+ name = customerclassname,
+ idparent = parentcode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗線鏉ュ崟浣嶅垎绫�:" + customerclasscode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇瀛樿揣鍒嗙被鍚嶇О鏄惁閲嶅
+ sql = @"select * from TCustomerType where code<>@customerclasscode and name=@customerclassname";
+ dynamicParams.Add("@customerclasscode", customerclasscode);
+ dynamicParams.Add("@customerclassname", customerclassname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "寰�鏉ュ崟浣嶅垎绫诲悕绉板凡瀛樺湪,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鏇存柊瀛樿揣鍒嗙被
+ sql = @"update TCustomerType set name=@name,idparent=@idparent,lm_user=@lm_user,lm_date=@lm_date where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = customerclasscode,
+ name = customerclassname,
+ idparent = parentcode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗線鏉ュ崟浣嶅垎绫�:" + customerclasscode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅垎绫诲垹闄
+ public static ToMessage TCunstomerClassTreeDelete(string customerclasscode, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string[] classcode = Array.ConvertAll<string, string>(customerclasscode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ //鍒ゆ柇瀛樿揣鍒嗙被鏄惁琚瓨璐т俊鎭紩鐢�
+ sql = @"select * from TCustomer where customertype in @customerclasscode";
+ dynamicParams.Add("@customerclasscode", classcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠寰�鏉ュ崟浣嶅垎绫绘垨涓嬬骇琚紩鐢ㄤ笉鍏佽鍒犻櫎锛�";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎寰�鏉ュ崟浣嶅垎绫�
+ sql = @"delete TCustomerType where code in @code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = classcode
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗線鏉ュ崟浣嶅垎绫�:" + string.Join(",", classcode), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶄俊鎭垪琛╙
+ public static ToMessage TCunstomerData(string customerclasscode, string customercode, string customername, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "", sql = "";
+ IEnumerable<object> data;
+ try
+ {
+ if (customerclasscode != "" && customerclasscode != null)
+ {
+ string[] classcode = Array.ConvertAll<string, string>(customerclasscode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ search += "and C.customertype in @classcode ";
+ dynamicParams.Add("@classcode", classcode);
+ }
+ if (customercode != "" && customercode != null)
+ {
+ search += "and C.code like '%'+@customercode+'%' ";
+ dynamicParams.Add("@customercode", customercode);
+ }
+ if (customername != "" && customername != null)
+ {
+ search += "and C.name like '%'+@customername+'%' ";
+ dynamicParams.Add("@customername", customername);
+ }
+ sql = @"select C.code,C.name,C.status,C.conttacts,C.conttphone,C.addr,C.customertype as customertypecode,T.name as customertypename,
+ C.lm_user as usercode,U.username,C.lm_date,C.data_sources
+ from TCustomer C
+ left join TCustomerType T on C.customertype=T.code
+ left join TUser U on C.lm_user=U.usercode
+ where 1=1 " + search;
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶆柊澧�/缂栬緫淇濆瓨]
+ public static ToMessage TCunstomerAddUpdate(string data_sources, string customercode, string customername, string customerclasscode, string status, string conttacts, string conttphone, string addr, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ //鍒ゆ柇寰�鏉ュ崟浣嶇紪鐮佹槸鍚﹂噸澶�
+ sql = @"select * from TCustomer where code=@customercode";
+ dynamicParams.Add("@customercode", customercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "寰�鏉ュ崟浣嶇紪鐮佸凡瀛樺湪,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇寰�鏉ュ崟浣嶅悕绉版槸鍚﹂噸澶�
+ sql = @"select * from TCustomer where name=@customername";
+ dynamicParams.Add("@customername", customername);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "寰�鏉ュ崟浣嶅悕绉板凡瀛樺湪,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍐欏叆寰�鏉ュ崟浣�
+ sql = @"insert into TCustomer(code,name,status,conttacts,conttphone,addr,customertype,lm_user,lm_date,data_sources)
+ values(@code,@name,@status,@conttacts,@conttphone,@addr,@customertype,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = customercode,
+ name = customername,
+ status = status,
+ conttacts = conttacts,
+ conttphone = conttphone,
+ addr = addr,
+ customertype = customerclasscode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗線鏉ュ崟浣�:" + customercode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇寰�鏉ュ崟浣嶅悕绉版槸鍚﹂噸澶�
+ sql = @"select * from TCustomer where code<>@code and name=@name";
+ dynamicParams.Add("@code", customercode);
+ dynamicParams.Add("@name", customername);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "寰�鏉ュ崟浣嶅悕绉板凡瀛樺湪,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鏇存柊瀛樿揣鍒嗙被
+ sql = @"update TCustomer set name=@name,status=@status,conttacts=@conttacts,conttphone=@conttphone,addr=@addr,customertype=@customertype,lm_user=@lm_user,lm_date=@lm_date
+ where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = customercode,
+ name = customername,
+ status = status,
+ conttacts = conttacts,
+ conttphone = conttphone,
+ addr = addr,
+ customertype = customerclasscode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗線鏉ュ崟浣�:" + customercode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶄俊鎭垹闄
+ public static ToMessage TCunstomerDelete(string data_sources, string customercode, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇寰�鏉ュ崟浣嶆槸鍚﹁鍗曟嵁寮曠敤
+
+ //鍒犻櫎瀛樿揣妗f
+ sql = @"delete TCustomer where code=@code and data_sources=@data_sources";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = customercode,
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗線鏉ュ崟浣�:" + customercode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[浠撳簱淇℃伅鍒楄〃]
+ public static ToMessage TSecStckData(string code, string name, string status, string ishasPosition, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "", sql = "";
+ IEnumerable<object> data;
+ try
+ {
+ if (code != "" && code != null)
+ {
+ search += "and S.code like '%'+@code+'%' ";
+ dynamicParams.Add("@code", code);
+ }
+ if (name != "" && name != null)
+ {
+ search += "and S.name like '%'+@name+'%' ";
+ dynamicParams.Add("@name", name);
+ }
+ if (status != "" && status != null)
+ {
+ search += "and S.status=@status ";
+ dynamicParams.Add("@status", status);
+ }
+ if (ishasPosition != "" && ishasPosition != null)
+ {
+ search += "and S.ishasPosition=@ishasPosition ";
+ dynamicParams.Add("@ishasPosition", ishasPosition);
+ }
+ sql = @"select S.code,S.name,S.status,S.ishasPosition,S.description,S.lm_user as usercode,U.username,S.lm_date,S.data_sources
+ from TSecStck S
+ left join TUser U on S.lm_user=U.usercode
+ where 1=1 " + search;
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱鏂板/缂栬緫淇濆瓨]
+ public static ToMessage TSecStckAddUpdate(string data_sources, string stckcode, string stckname, string ishaspostion, string status, string description, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ //鍒ゆ柇浠撳簱缂栫爜鏄惁閲嶅
+ sql = @"select * from TSecStck where code=@stckcode";
+ dynamicParams.Add("@stckcode", stckcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浠撳簱缂栫爜宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇浠撳簱鍚嶇О鏄惁閲嶅
+ sql = @"select * from TSecStck where name=@stckname";
+ dynamicParams.Add("@stckname", stckname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浠撳簱鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍐欏叆浠撳簱
+ sql = @"insert into TSecStck(code,name,status,ishasPosition,description,lm_user,lm_date,data_sources)
+ values(@code,@name,@status,@ishasPosition,@description,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = stckcode,
+ name = stckname,
+ status = status,
+ ishasPosition = ishaspostion,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗕粨搴�:" + stckcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇浠撳簱鍚嶇О鏄惁閲嶅
+ sql = @"select * from TSecStck where code<>@code and name=@name";
+ dynamicParams.Add("@code", stckcode);
+ dynamicParams.Add("@name", stckname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浠撳簱鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鏇存柊浠撳簱
+ sql = @"update TSecStck set name=@name,status=@status,ishasPosition=@ishasPosition,description=@description,lm_user=@lm_user,lm_date=@lm_date
+ where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = stckcode,
+ name = stckname,
+ status = status,
+ ishasPosition = ishaspostion,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ if (status == "1") //浠撳簱鍋滅敤鏃�,涓嬮潰鎵�鏈夌殑浠撲綅鍋滅敤
+ {
+ //鏇存柊搴撲綅鐘舵�佷负绂佺敤
+ sql = @"update TSecLoca set status=@status where idwarehouse=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ status = status,
+ code = stckcode
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗕粨搴�:" + stckcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱鍒犻櫎]
+ public static ToMessage TSecStckDelete(string data_sources, string stckcode, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇浠撳簱鏄惁鏈夊簱浣�
+ sql = @"select * from TSecLoca where idwarehouse=@stckcode";
+ dynamicParams.Add("@stckcode", stckcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浠撳簱宸插惎鐢ㄨ揣浣�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎浠撳簱
+ sql = @"delete TSecStck where code=@code and data_sources=@data_sources";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = stckcode,
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗕粨搴�:" + stckcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[浠撲綅鏍戝瀷淇℃伅]
+ public static ToMessage TSecLocaTree()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇寮�鍚粨浣嶇鎺х殑浠撳簱淇℃伅
+ sql = @"select code,name,'-1' as idparent,'' as warhouse,'0' as depth from TSecStck where ishasPosition='1'
+ union all
+ select code,name,case when L.idparent is NULL or L.idparent='' then '-1' else L.idparent end as idparent,idwarehouse,depth
+ from TSecLoca L ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鍒楄〃]
+ public static ToMessage TSecLocaData(string flag, string stckcode, string locacode, string locaname, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "", sql = "";
+ IEnumerable<object> data;
+ try
+ {
+ if (flag == "-1" && stckcode == null)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏆傛棤鏁版嵁!";
+ mes.data = null;
+ return mes;
+ }
+ string[] classcode = Array.ConvertAll<string, string>(stckcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ switch (flag)
+ {
+ case "-1": //鍏ㄩ儴
+ search += " and L.idparent is null or L.idparent='' and L.idwarehouse in @idwarehouse ";
+ dynamicParams.Add("@idwarehouse", classcode);
+ break;
+ case "0": //浠撳簱
+ search += " and L.depth='1' and L.idwarehouse in @idwarehouse ";
+ dynamicParams.Add("@idwarehouse", classcode);
+ break;
+ default: //浠撲綅
+ search += " and L.idparent in @idparent";
+ dynamicParams.Add("@idparent", classcode);
+ break;
+ }
+ if (locacode != "" && locacode != null)
+ {
+ search += "and L.code like '%'+@locacode+'%' ";
+ dynamicParams.Add("@locacode", locacode);
+ }
+ if (locaname != "" && locaname != null)
+ {
+ search += "and L.name like '%'+@locaname+'%' ";
+ dynamicParams.Add("@locaname", locaname);
+ }
+ sql = @"select L.code,L.name,L.status,L.description,L.idwarehouse as stckcode,T.name as stckname,
+ L.idparent as parentcode,S.name as parentname,L.data_sources,L.lm_user as usercode,U.username,L.lm_date
+ from TSecLoca L
+ left join TSecStck T on L.idwarehouse=T.code
+ left join TSecLoca S on L.idparent=S.code
+ left join TUser U on L.lm_user=U.usercode
+ where 1=1 " + search;
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鏂板/缂栬緫淇濆瓨]
+ public static ToMessage TSecLocaAddUpdate(string data_sources, string locacode, string locaname, string stckcode, string parentlocacode, string depth, string status, string description, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ //鍒ゆ柇浠撲綅缂栫爜鏄惁閲嶅
+ sql = @"select * from TSecLoca where code=@locacode";
+ dynamicParams.Add("@locacode", locacode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浠撲綅缂栫爜宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇寰�鏉ュ崟浣嶅悕绉版槸鍚﹂噸澶�
+ sql = @"select * from TSecLoca where name=@locaname";
+ dynamicParams.Add("@locaname", locaname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浠撲綅宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ if (depth == "1") //灞傜骇涓�1鏃�,缃┖涓婄骇缂栫爜
+ {
+ parentlocacode = "";
+ }
+ //鍐欏叆浠撲綅
+ sql = @"insert into TSecLoca(code,name,idwarehouse,idparent,status,description,lm_user,lm_date,data_sources,depth)
+ values(@code,@name,@idwarehouse,@idparent,@status,@description,@lm_user,@lm_date,@data_sources,@depth)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = locacode,
+ name = locaname,
+ idwarehouse = stckcode,
+ idparent = parentlocacode,
+ status = status,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = data_sources,
+ depth = depth
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗕粨浣�:" + locacode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇涓婄骇璐т綅缂栫爜鏄惁绛変簬璐т綅缂栫爜
+ if (locacode == parentlocacode)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "涓婄骇璐т綅涓嶈兘鏄簱浣嶆湰韬紒";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇寰�鏉ュ崟浣嶅悕绉版槸鍚﹂噸澶�
+ sql = @"select * from TSecLoca where code<>@code and name=@name";
+ dynamicParams.Add("@code", locacode);
+ dynamicParams.Add("@name", locaname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浠撲綅鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ if (depth == "1") //灞傜骇涓�1鏃�,缃┖涓婄骇缂栫爜
+ {
+ parentlocacode = "";
+ }
+ //鏇存柊瀛樿揣鍒嗙被
+ sql = @"update TSecLoca set name=@name,idwarehouse=@idwarehouse,idparent=@idparent,depth=@depth,status=@status,description=@description,lm_user=@lm_user,lm_date=@lm_date
+ where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = locacode,
+ name = locaname,
+ idwarehouse = stckcode,
+ idparent = parentlocacode,
+ depth = depth,
+ status = status,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ if (status == "1") //浠撲綅鍋滅敤鏃�,涓嬮潰鎵�鏈夌殑浠撲綅鍋滅敤
+ {
+ //鏇存柊搴撲綅鐘舵�佷负绂佺敤
+ sql = @"update TSecLoca set status=@status where idparent=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ status = status,
+ code = locacode
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗕粨浣�:" + locacode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撲綅淇℃伅鍒犻櫎]
+ public static ToMessage TSecLocaDelete(string data_sources, string locacode, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠浠撲綅涓嬫槸鍚︽湁瀛愰」
+ sql = @"select * from TSecLoca where idparent=@locacode";
+ dynamicParams.Add("@locacode", locacode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠浠撲綅涓嬪瓨鍦ㄥ瓙椤�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎浠撲綅
+ sql = @"delete TSecLoca where code=@code and data_sources=@data_sources";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = locacode,
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗕粨浣�:" + locacode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[宸ュ簭涓嬫媺鏌ヨ鎺ュ彛]
+ public static ToMessage StepSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇宸ュ簭鏁版嵁
+ sql = @"select stepcode,stepname from TStep where is_delete<>'1' and enable='Y'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鏌ヨ]
+ public static ToMessage RouteSearch(string routecode, string routename, string description, string createuser, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (routecode != "" && routecode != null)
+ {
+ search += "and A.code like '%'+@routecode+'%' ";
+ dynamicParams.Add("@routecode", routecode);
+ }
+ if (routename != "" && routename != null)
+ {
+ search += "and A.name like '%'+@routename+'%' ";
+ dynamicParams.Add("@routename", routename);
+ }
+ if (description != "" && description != null)
+ {
+ search += "and A.description like '%'+@description+'%' ";
+ dynamicParams.Add("@description", description);
+ }
+ if (createuser != "" && createuser != null)
+ {
+ search += "and U.username like '%'+@createuser+'%' ";
+ dynamicParams.Add("@createuser", createuser);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,A.enable,U.username as lm_user,A.lm_date from TFlw_Rout A
+ left join TUser U on A.lm_user=U.usercode
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎棰勮]
+ public static ToMessage ViewRoute(string routecode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<RoutEdit> list = new List<RoutEdit>();
+ try
+ {
+ //鑾峰彇宸ヨ壓璺嚎淇℃伅
+ sql = @"select code,name,description,enable
+ from TFlw_Rout
+ where code=@routecode and is_delete<>'1'";
+ dynamicParams.Add("@routecode", routecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ RoutEdit rout = new RoutEdit();
+ rout.code = data.Rows[i]["CODE"].ToString();
+ rout.name = data.Rows[i]["NAME"].ToString();
+ rout.enable = data.Rows[i]["ENABLE"].ToString();
+ rout.description = data.Rows[i]["DESCRIPTION"].ToString();
+
+ //鏍规嵁宸ヨ壓璺嚎缂栫爜鑾峰彇鍏宠仈鐨勫伐搴忎俊鎭�
+ sql = @"select A.seq,B.stepcode,B.stepname,B.enable from TFlw_Rtdt A
+ inner join TStep B on A.step_code=B.stepcode
+ where A.rout_code=@route_code and B.is_delete<>'1' order by A.seq asc";
+ dynamicParams.Add("@route_code", rout.code);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ rout.Data = data0;
+ list.Add(rout);
+
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鏂板]
+ public static ToMessage AddUpdateRoute(string id, string opertype, User us, RoutEdit json)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (opertype == "Add")
+ {
+ var sql0 = @"select * from TFlw_Rout where code=@code";
+ dynamicParams.Add("@code", json.code);
+ var data = DapperHelper.selectdata(sql0, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,缂栫爜閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+ //鏂板宸ヨ壓璺嚎琛�
+ sql = @"insert into TFlw_Rout(code,name,description,enable,lm_user,lm_date) values(@code,@name,@description,@enable,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { code = json.code, name = json.name, description = json.description, enable = json.enable, lm_user = us.usercode, lm_date = DateTime.Now.ToString() } });
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ string is_firststep = "N"; //鏄惁棣栭亾宸ュ簭
+ string is_laststep = "N"; //鏄惁鏈亾宸ュ簭
+ if (json.Data.Rows[i]["SEQ"].ToString() == "1") //鏄惁棣栭亾宸ュ簭
+ {
+ is_firststep = "Y";
+ }
+ if (Convert.ToInt32(json.Data.Rows[i]["SEQ"].ToString()) == json.Data.Rows.Count) //鏄惁鏈亾宸ュ簭
+ {
+ is_laststep = "Y";
+ }
+ //鏂板宸ヨ壓璺嚎鍏宠仈宸ュ簭琛�
+ sql = @"insert TFlw_Rtdt (rout_code,seq,step_code,first_choke,last_choke,lm_user,lm_date) values(@rout_code,@seq,@step_code,@first_choke,@last_choke,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { rout_code = json.code, seq = Convert.ToInt32(json.Data.Rows[i]["SEQ"].ToString()), step_code = json.Data.Rows[i]["STEPCODE"].ToString(), first_choke = is_firststep, last_choke = is_laststep, lm_user = us.usercode, lm_date = DateTime.Now.ToString() } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗伐鑹鸿矾绾�:" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鍒犻櫎]
+ public static ToMessage DeleteRoute(string routecode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇宸ヨ壓璺矾绾挎槸鍚﹁瀛樿揣缁戝畾
+ sql = @"select * from TMateriel_Route where route_code=@routecode";
+ dynamicParams.Add("@routecode", routecode);
+ var data_0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data_0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀛樿揣妗f宸插叧鑱斿伐鑹鸿矾绾匡紝涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇宸ヨ壓璺嚎鏄惁琚伐鍗曞紩鐢�(琚紩鐢ㄥ垯涓嶈兘鍒犻櫎)
+ sql = @"select * from TK_Wrk_Man where route_code=@routecode";
+ dynamicParams.Add("@routecode", routecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ヨ壓璺嚎宸茶宸ュ崟寮曠敤锛屼笉鍏佽鍒犻櫎!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ //鍒ゆ柇褰撳墠宸ヨ壓璺嚎鏄惁鏈夎缃妭鎷嶅伐浠�(鏈夎缃紝鎻愮ず鍏堝垹闄よ妭鎷嶅伐浠疯缃�)
+ sql = @"select * from TPrteEqp_Stad where route_code=@routecode";
+ dynamicParams.Add("@routecode", routecode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ヨ壓璺嚎宸茶缃妭鎷嶅伐浠凤紝璇峰厛鍒犻櫎璁剧疆!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ //鍒犻櫎宸ヨ壓璺嚎鍏宠仈宸ュ簭琛�
+ sql = @"delete TFlw_Rtdt where rout_code=@routecode";
+ list.Add(new { str = sql, parm = new { routecode = routecode } });
+ //鍒犻櫎宸ヨ壓璺嚎琛�
+ sql = @"delete TFlw_Rout where code=@routecode";
+ list.Add(new { str = sql, parm = new { routecode = routecode } });
+ //鍒犻櫎鐗╂枡鍏宠仈宸ヨ壓璺嚎琛�
+ sql = @"delete TMateriel_Route where route_code=@routecode";
+ list.Add(new { str = sql, parm = new { routecode = routecode } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗伐鑹鸿矾绾�:" + routecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ return mes;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[宸ュ簭鏌ヨ]
+ public static ToMessage StepSearch(string stepcode, string stepname, string enable, string steptypecode, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (stepcode != "" && stepcode != null)
+ {
+ search += "and A.stepcode like '%'+@stepcode+'%' ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and A.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (enable != "" && enable != null)
+ {
+ search += "and A.enable=@enable ";
+ dynamicParams.Add("@enable", enable);
+ }
+ if (steptypecode != "" && steptypecode != null)
+ {
+ search += "and A.flwtype=@steptypecode ";
+ dynamicParams.Add("@steptypecode", steptypecode);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.stepcode,A.stepname,A.flwtype,A.enable,A.descr,U.username as lm_user,A.lm_date
+ from TStep A
+ left join TUser U on A.lm_user=U.usercode
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭鏂板缂栬緫]
+ public static ToMessage AddUpdateStep(string stepid, string stepcode, string stepname, string steptypecode, string enable, string description, User us, string operType)
+ {
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ var sql = "";
+ try
+ {
+ if (operType == "Add")
+ {
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,缂栫爜閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+ sql = @"insert into TStep(stepcode,stepname,flwtype,enable,descr,lm_user,lm_date)
+ values(@stepcode,@stepname,@steptypecode,@enable,@description,@username,@CreateDate)";
+ dynamicParams.Add("@stepcode", stepcode);
+ dynamicParams.Add("@stepname", stepname);
+ dynamicParams.Add("@steptypecode", steptypecode);
+ dynamicParams.Add("@enable", enable);
+ dynamicParams.Add("@description", description);
+ dynamicParams.Add("@username", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗伐搴�:" + stepcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (operType == "Update")
+ {
+ list.Clear();
+ //濡傛灉褰撳墠宸ュ簭浣跨敤鐘舵�佷綅N(鏈惎鐢�),闇�鍒ゆ柇褰撳墠宸ュ簭鏄惁琚伐鍗曞紩鐢�
+ if (enable == "N")
+ {
+ var sql0 = @"select * from TK_Wrk_Step A where A.step_code=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql0, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ簭鏈夊叧鑱斿伐鍗�,涓嶅厑璁镐慨鏀�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ sql = @"update TStep set stepname=@stepname,flwtype=@steptypecode,enable=@enable,descr=@description,
+ lm_user=@username,lm_date=@CreateDate where id=@stepid";
+ list.Add(new { str = sql, parm = new { stepid = stepid, stepname = stepname, steptypecode = steptypecode, enable = enable, description = description, username = us.usercode, CreateDate = DateTime.Now.ToString() } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗伐搴�:" + stepcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭鍒犻櫎]
+ public static ToMessage DeleteStep(string stepcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //褰撳墠宸ュ簭鏄惁鍏宠仈宸ュ崟
+ sql = @"select * from TK_Wrk_Step A where A.step_code=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ簭鏈夊叧鑱斿伐鍗�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎宸ュ簭
+ sql = @"delete TStep where stepcode=@stepcode";
+ list.Add(new { str = sql, parm = new { stepcode = stepcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗伐搴�:" + stepcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鑺傛媿宸ヤ环,浜у搧淇℃伅鏌ヨ]
+ public static ToMessage PartSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇鐗╂枡鏁版嵁
+ sql = @"select M.partcode,M.partname,M.partspec,T.code as uom_code,T.name as uom_name,
+ M.idunitgroup as stocktype_code,D.name as stocktype_name
+ from TMateriel_Info M
+ left join TUnit T on M.idunit=T.code
+ left join TUnitGroup D on M.idunitgroup=D.code";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鏌ユ壘宸ヨ壓淇℃伅]
+ public static ToMessage PartSelectRpute(string partcode, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹鸿矾绾夸俊鎭�
+ sql = @"select A.route_code,B.name as route_name
+ from TMateriel_Route A
+ inner join TFlw_Rout B on A.route_code=B.code
+ where A.materiel_code=@partcode and B.is_delete<>'1' and A.is_delete<>'1'";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ else //宸ュ簭鐗�
+ {
+ //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐搴忎俊鎭�
+ sql = @"select A.step_seq,A.step_code,S.stepname as step_name,A.unprice,A.isbott,A.isend
+ from (
+ select S.materiel_code,R.step_seq,S.step_code,S.unprice,R.isbott,R.isend from TPrteEqp_Stad S
+ inner join TMateriel_Step R on S.materiel_code=R.materiel_code and S.step_code=R.step_code
+ where S.materiel_code=@partcode
+ union all
+ select materiel_code,step_seq,step_code,'0' as unprice,isbott,isend from TMateriel_Step
+ where materiel_code=@partcode and materiel_code+step_code
+ not in(select materiel_code+step_code from TPrteEqp_Stad
+ where materiel_code=@partcode)
+ ) as A
+ left join TStep S on A.step_code=S.stepcode";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏍规嵁宸ヨ壓淇℃伅(宸ヨ壓璺嚎缂栫爜)鏌ユ壘鍏宠仈宸ュ簭闆嗗悎]
+ public static ToMessage RouteSelectStep(string partcode, string routecode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //閫氳繃宸ヨ壓璺嚎缂栫爜鏌ユ壘鍏宠仈鐨勫伐搴忎俊鎭�
+ sql = @"select A.step_seq,A.step_code,S.stepname as step_name,A.unprice,A.isbott,A.isend
+ from (
+ select S.materiel_code,R.seq as step_seq,S.step_code,S.unprice,R.first_choke as isbott,R.last_choke as isend from TPrteEqp_Stad S
+ inner join TFlw_Rtdt R on S.route_code=R.rout_code and S.step_code=R.step_code
+ where S.materiel_code=@partcode and S.route_code=@route_code
+ union all
+ select @partcode as materiel_code,B.seq as step_seq,B.step_code,'0' as unprice,B.first_choke as isbott,B.last_choke as isend from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ where A.code=@route_code and @partcode+A.code+B.step_code
+ not in(select materiel_code+rout_code+step_code from TPrteEqp_Stad
+ where materiel_code=@partcode and route_code=@route_code)
+ ) as A
+ left join TStep S on A.step_code=S.stepcode";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@route_code", routecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鎵归噺鏌ユ壘鍏宠仈鐨勫伐鑹轰俊鎭痌
+ public static ToMessage PartSelectRputeList(List<PartRouteList> list, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<Dictionary<object, object>> dir = new List<Dictionary<object, object>>();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ // 鍒涘缓涓�涓柊鐨勫瓧鍏�
+ Dictionary<object, object> dict = new Dictionary<object, object>();
+ //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐鑹鸿矾绾夸俊鎭�
+ sql = @"select A.route_code,B.name as route_name
+ from TMateriel_Route A
+ inner join TFlw_Rout B on A.route_code=B.code
+ where A.materiel_code=@partcode and B.is_delete<>'1' and A.is_delete<>'1'";
+ dynamicParams.Add("@partcode", list[i].partcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ // 鍚戝瓧鍏镐腑娣诲姞鏁版嵁
+ dict.Add("routedata", data);
+ // 灏嗗瓧鍏告坊鍔犲埌鍒楄〃涓�
+ dir.Add(dict);
+ }
+ }
+ else //宸ュ簭鐗�
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ // 鍒涘缓涓�涓柊鐨勫瓧鍏�
+ Dictionary<object, object> dict = new Dictionary<object, object>();
+ //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐搴忎俊鎭�
+ sql = @"select A.step_seq,A.step_code as stepcode,S.stepname as stepname,A.unprice as stepprice,A.isbott,A.isend
+ from (
+ select S.materiel_code,R.step_seq,S.step_code,S.unprice,R.isbott,R.isend from TPrteEqp_Stad S
+ inner join TMateriel_Step R on S.materiel_code=R.materiel_code and S.step_code=R.step_code
+ where S.materiel_code=@partcode
+ union all
+ select materiel_code,step_seq,step_code,'0' as unprice,isbott,isend from TMateriel_Step
+ where materiel_code=@partcode and materiel_code+step_code
+ not in(select materiel_code+step_code from TPrteEqp_Stad
+ where materiel_code=@partcode)
+ ) as A
+ left join TStep S on A.step_code=S.stepcode";
+ dynamicParams.Add("@partcode", list[i].partcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ // 鍚戝瓧鍏镐腑娣诲姞鏁版嵁
+ dict.Add("stepdata", data);
+ // 灏嗗瓧鍏告坊鍔犲埌鍒楄〃涓�
+ dir.Add(dict);
+ }
+ }
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = dir.Count;
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏍规嵁宸ヨ壓淇℃伅(宸ヨ壓璺嚎缂栫爜)鎵归噺鏌ユ壘鍏宠仈宸ュ簭闆嗗悎]
+ public static ToMessage RouteSelectStepList(List<PartRouteStepList> list)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<Dictionary<object, object>> dir = new List<Dictionary<object, object>>();
+ try
+ {
+ for (int i = 0; i < list.Count; i++)
+ {
+ // 鍒涘缓涓�涓柊鐨勫瓧鍏�
+ Dictionary<object, object> dict = new Dictionary<object, object>();
+ //閫氳繃宸ヨ壓璺嚎缂栫爜鏌ユ壘鍏宠仈鐨勫伐搴忎俊鎭�
+ sql = @"select A.step_seq,A.step_code as stepcode,S.stepname as stepname,A.unprice as stepprice,A.isbott,A.isend
+ from (
+ select S.materiel_code,R.seq as step_seq,S.step_code,S.unprice,R.first_choke as isbott,R.last_choke as isend from TPrteEqp_Stad S
+ inner join TFlw_Rtdt R on S.route_code=R.rout_code and S.step_code=R.step_code
+ where S.materiel_code=@partcode and S.route_code=@route_code
+ union all
+ select @partcode as materiel_code,B.seq as step_seq,B.step_code,'0' as unprice,B.first_choke as isbott,B.last_choke as isend from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ where A.code=@route_code and @partcode+A.code+B.step_code
+ not in(select materiel_code+rout_code+step_code from TPrteEqp_Stad
+ where materiel_code=@partcode and route_code=@route_code)
+ ) as A
+ left join TStep S on A.step_code=S.stepcode";
+ dynamicParams.Add("@partcode", list[i].partcode);
+ dynamicParams.Add("@route_code", list[i].routecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ // 鍚戝瓧鍏镐腑娣诲姞鏁版嵁
+ dict.Add("stepdata", data);
+ // 灏嗗瓧鍏告坊鍔犲埌鍒楄〃涓�
+ dir.Add(dict);
+ }
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鑺傛媿宸ヤ环鏌ヨ]
+ public static ToMessage BeatRateSearch(string partcode, string routecode, string stepcode, User us, int startNum, int endNum, string prop, string order)
+ {
+ string sql = "", search="";
+ int total = 0;
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode=@partcode ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (stepcode != "" && stepcode != null)
+ {
+ search += "and AA.stepcode=@stepcode ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ if (routecode != "" && routecode != null)
+ {
+ search += "and AA.route_code=@routecode ";
+ dynamicParams.Add("@routecode", routecode);
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ total = 0; //鎬绘潯鏁�
+ sql = @"select * from (
+ select A.id,A.materiel_code as partcode,B.partname,B.partspec,A.route_code,C.name as route_name,
+ D.stepcode,D.stepname,A.unprice,U.username as lm_user,A.lm_date
+ from TPrteEqp_Stad A
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TFlw_Rout C on A.route_code=C.code
+ left join TStep D on A.step_code=D.stepcode
+ left join TUser U on A.lm_user=U.usercode
+ ) as AA where" + search;
+ }
+ else //宸ュ簭鐗�
+ {
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ total = 0; //鎬绘潯鏁�
+ sql = @"select * from (
+ select A.id,A.materiel_code as partcode,B.partname,B.partspec,D.stepcode,D.stepname,A.unprice,U.username as lm_user,A.lm_date
+ from TPrteEqp_Stad A
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TStep D on A.step_code=D.stepcode
+ left join TUser U on A.lm_user=U.usercode
+ ) as AA where" + search;
+ }
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鎻愪氦]
+ public static ToMessage SaveBeatRate(List<MaterialCraftsSave> json, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ for (int i = 0; i < json[0].children.Count; i++)
+ {
+ //褰撳墠浜у搧宸ヨ壓璺嚎瀵瑰簲宸ュ簭鏄惁宸茶缃妭鎷嶅伐浠�
+ sql = @"select * from TPrteEqp_Stad
+ where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode";
+ dynamicParams.Add("@partcode", json[0].partcode);
+ dynamicParams.Add("@routecode", json[0].defaultroute_code);
+ dynamicParams.Add("@stepcode", json[0].children[i].code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ sql = @"update TPrteEqp_Stad set unprice=@unprice,lm_user=@username,lm_date=@userdate
+ where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = json[0].partcode,
+ routecode = json[0].defaultroute_code,
+ stepcode = json[0].children[i].code,
+ unprice = json[0].children[i].unprice,
+ username = us.usercode,
+ userdate = DateTime.Now.ToString()
+ }
+ });
+ }
+ else
+ {
+ sql = @"insert into TPrteEqp_Stad(materiel_code,route_code,step_code,unprice,lm_user,lm_date)
+ values(@partcode,@routecode,@stepcode,@unprice,@username,@userdate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = json[0].partcode,
+ routecode = json[0].defaultroute_code,
+ stepcode = json[0].children[i].code,
+ unprice = json[0].children[i].unprice,
+ username = us.usercode,
+ userdate = DateTime.Now.ToString()
+ }
+ });
+ }
+ }
+ }
+ else //宸ュ簭鐗�
+ {
+ for (int i = 0; i < json[0].children.Count; i++)
+ {
+ //褰撳墠浜у搧瀵瑰簲宸ュ簭鏄惁宸茶缃妭鎷嶅伐浠�
+ sql = @"select * from TPrteEqp_Stad
+ where materiel_code=@partcode and step_code=@stepcode";
+ dynamicParams.Add("@partcode", json[0].partcode);
+ dynamicParams.Add("@stepcode", json[0].children[i].code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ sql = @"update TPrteEqp_Stad set unprice=@unprice,lm_user=@username,lm_date=@userdate
+ where materiel_code=@partcode and step_code=@stepcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = json[0].partcode,
+ stepcode = json[0].children[i].code,
+ unprice = json[0].children[i].unprice,
+ username = us.usercode,
+ userdate = DateTime.Now.ToString()
+ }
+ });
+ }
+ else
+ {
+ sql = @"insert into TPrteEqp_Stad(materiel_code,step_code,unprice,lm_user,lm_date)
+ values(@partcode,@stepcode,@unprice,@username,@userdate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = json[0].partcode,
+ stepcode = json[0].children[i].code,
+ unprice = json[0].children[i].unprice,
+ username = us.usercode,
+ userdate = DateTime.Now.ToString()
+ }
+ });
+ }
+ }
+ }
+
+
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鑺傛媿宸ヤ环", "浜у搧锛�"+ json[0].partcode + "璁剧疆浜嗗伐浠�:" + string.Join(",", json[0].children.Select(s => s.unprice)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑺傛媿宸ヤ环鍒犻櫎]
+ public static ToMessage DeleteBeatRate(string id, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒犻櫎鑺傛媿宸ヤ环琛�
+ sql = @"delete TPrteEqp_Stad where id=@id";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ id = id
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫煡璇
+ public static ToMessage AnDengTypeSearch()
+ {
+ try
+ {
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select id, code,name
+ from TAnDonType
+ where is_delete<>'1' ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬫柊澧瀅
+ public static ToMessage AddUpdateAnDengType(List<ObjectData> json, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //寰幆鍐欏叆鍛煎彨绫诲瀷琛�
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"insert into TAnDonType(code,name,lm_user,lm_date) values(@code,@name,@username,@createdate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = json[i].code,
+ name = json[i].name,
+ username = us.usercode,
+ createdate = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗畨鐏懠鍙被鍨�:" + string.Join(",", json.Select(item => item.name)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鑷畾涔夊畨鐏懠鍙被鍨嬪垹闄
+ public static ToMessage DeleteAnDengType(string andengtypecode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇鍛煎彨绫诲瀷涓嬫槸鍚﹀叧鑱�
+ sql = @"select * from TAnDon_Roul_ConFig where andotype_code=@andengtypecode and is_delete<>'1'";
+ dynamicParams.Add("@andengtypecode", andengtypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鍛煎彨绫诲瀷宸插叧鑱斿懠鍙厤缃�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ }
+ else
+ {
+ sql = @"delete TAnDonType where code=@andengtypecode";
+ list.Add(new { str = sql, parm = new { andengtypecode = andengtypecode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗畨鐏懠鍙被鍨�:" + andengtypecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏌ヨ缁戝畾鐨勫搷搴斾汉鍛榏
+ public static ToMessage AnDengResponUserSearch(string wkshopcode, string calltypecode)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select B.id,B.ando_cogfigid,U.usercode,U.username,A.enable from TAnDon_Roul_ConFig A
+ inner join TAnDon_Roul_ConFigUser B on A.id=B.ando_cogfigid
+ left join TUser U on B.usercode=U.usercode
+ where A.wkshp_code=@wkshopcode and A.andotype_code=@calltypecode";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@calltypecode", calltypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏂板鍝嶅簲浜哄憳鏌ヨ宸茬粦瀹氱殑鍝嶅簲浜哄憳]
+ public static ToMessage AnDengDialogResponUserSearch(string wkshopcode, string calltypecode)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select A.usercode,A.username,(case when B.usercode<>'' then 'Y' else 'N' end) as flag
+ from TUser A
+ left join (
+ select B.usercode from TAnDon_Roul_ConFig A
+ inner join TAnDon_Roul_ConFigUser B on A.id=B.ando_cogfigid
+ where A.wkshp_code=@wkshopcode and A.andotype_code=@calltypecode
+ ) B on A.usercode=B.usercode
+ where A.is_system_admin='N'";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@calltypecode", calltypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏆傛棤鍝嶅簲浜哄憳!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鏂板鍝嶅簲浜哄憳鎻愪氦]
+ public static ToMessage AnDengDigoResponUserSeave(string wkshopcode, string calltypecode, string enable, User us, DataTable json)
+ {
+ var sql = "";
+ int mid = 0;
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇鍛煎彨绫诲瀷涓嬫槸鍚﹀叧鑱�
+ sql = @"select isnull(id,0) id from TAnDon_Roul_ConFig where wkshp_code=@wkshopcode and andotype_code=@calltypecode and is_delete<>'1'";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@calltypecode", calltypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mid = Convert.ToInt32(data.Rows[0]["ID"].ToString());
+ //娓呴櫎瀹夌伅銆佽澶囦换鍔¢厤缃叧鑱斾汉鍛樿〃鏁版嵁
+ sql = @"delete TAnDon_Roul_ConFigUser where ando_cogfigid=@mid";
+ list.Add(new { str = sql, parm = new { mid = mid } });
+ }
+ else
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TAnDon_Roul_ConFig')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ mid = Convert.ToInt32(dt.Rows[0]["ID"].ToString());
+ //鍐欏叆瀹夌伅銆佽澶囦换鍔¢厤缃〃鏁版嵁
+ sql = @"insert into TAnDon_Roul_ConFig(wkshp_code,andotype_code,lm_user,lm_date,enable) values(@wkshp_code,@andotype_code,@lm_user,@lm_date,@enable)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshp_code = wkshopcode,
+ andotype_code = calltypecode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ enable = enable
+ }
+ });
+ }
+ //寰幆鍐欏叆瀹夌伅銆佽澶囦换鍔¢厤缃叧鑱斾汉鍛樿〃
+ for (int i = 0; i < json.Rows.Count; i++)
+ {
+ sql = @"insert into TAnDon_Roul_ConFigUser(ando_cogfigid,usercode) values(@ando_cogfigid,@role_code)";
+ list.Add(new { str = sql, parm = new { ando_cogfigid = mid, role_code = json.Rows[i]["CODE"].ToString() } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "瀹夌伅鍝嶅簲浜哄憳缁戝畾", "杞﹂棿锛�" + wkshopcode + ",鍛煎彨绫诲瀷锛�" + calltypecode + ",缁戝畾鍝嶅簲浜哄憳:" + string.Join(",", json.AsEnumerable().Select(row => row.Field<string>("code"))), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍏佽鍏抽棴]
+ public static ToMessage AnDengResponUserCloseSeave(string wkshopcode, string calltypecode, string enable, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ //鏇存柊瀹夌伅銆佽澶囦换鍔¢厤缃〃鐘舵��
+ sql = @"update TAnDon_Roul_ConFig set enable=@enable,lm_user=@lm_user,lm_date=@lm_date where wkshp_code=@wkshp_code and andotype_code=@andengtypecode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshp_code = wkshopcode,
+ andengtypecode = calltypecode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ enable = enable
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "瀹夌伅璁剧疆鍛煎彨绫诲瀷鍏抽棴", "杞﹂棿锛�" + wkshopcode + ",鍛煎彨绫诲瀷锛�" + calltypecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅绯荤粺/鍝嶅簲浜哄憳鍒犻櫎]
+ public static ToMessage AnDengResponUserDeleteSeave(string id, string ando_cogfigid, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鏌ヨ瀹夌伅銆佽澶囦换鍔¢厤缃〃
+ sql = @"select id from TAnDon_Roul_ConFigUser where ando_cogfigid=@ando_cogfigid";
+ dynamicParams.Add("@ando_cogfigid", ando_cogfigid);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 1)
+ {
+ //鏍规嵁瀛愯〃id鍒犻櫎瀵瑰簲瀛愯〃浜哄憳
+ sql = @"delete TAnDon_Roul_ConFigUser where id=@id";
+ list.Add(new { str = sql, parm = new { id = id } });
+ }
+ else
+ {
+ //鏍规嵁瀛愯〃id鍒犻櫎瀵瑰簲瀛愯〃浜哄憳
+ sql = @"delete TAnDon_Roul_ConFigUser where id=@id";
+ list.Add(new { str = sql, parm = new { id = id } });
+ //鏍规嵁涓昏〃id鍒犻櫎涓昏〃鏁版嵁
+ sql = @"delete TAnDon_Roul_ConFig where id=@id";
+ list.Add(new { str = sql, parm = new { id = ando_cogfigid } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "瀹夌伅璁剧疆鍛煎彨绫诲瀷浜哄憳鍒犻櫎,鎿嶄綔鍛煎彨閰嶇疆琛╥d涓猴細" + ando_cogfigid, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/DeviceManagerDAL.cs b/VueWebCoreApi/DLL/DAL/DeviceManagerDAL.cs
new file mode 100644
index 0000000..5740f43
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/DeviceManagerDAL.cs
@@ -0,0 +1,3664 @@
+锘縰sing Dapper;
+using Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class DeviceManagerDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[璁惧缁勬煡璇
+ public static ToMessage DeviceGroupSearch(int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.code,A.name,A.eqptype_code,B.name as eqptype_name,A.remark
+ from TEqpGroup A
+ inner join TEqpType B on A.eqptype_code=B.code
+ where A.is_delete<>'1' ";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧缁勬柊澧瀅
+ public static ToMessage AddUpdateDeviceGroup(List<ObjectDataCont> json, string username)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //寰幆鍐欏叆璁惧绫诲瀷琛�
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"insert into TEqpGroup(code,name,lm_user,lm_date,remark,eqptype_code) values(@code,@name,@username,@createdate,@description,@eqptype_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = json[i].code,
+ name = json[i].name,
+ username = username,
+ createdate = DateTime.Now.ToString(),
+ description = json[i].description,
+ eqptype_code = json[i].group
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷鍒犻櫎]
+ public static ToMessage DeleteDeviceGroup(string devicegroupcode)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇璁惧缁勪笅鏄惁鍏宠仈璁惧
+ sql = @"select * from TEqpInfo where eqpgroup_code=@devicegroupcode and is_delete<>'1'";
+ dynamicParams.Add("@devicegroupcode", devicegroupcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠璁惧缁勫凡鏈夊叧鑱旇澶囩粍,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ }
+ else
+ {
+ //鍒犻櫎璁惧缁�
+ sql = @"delete TEqpGroup where code=@devicegroupcode";
+ list.Add(new { str = sql, parm = new { devicegroupcode = devicegroupcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[璁惧绫诲瀷鏌ユ壘璁惧缁刔
+ public static ToMessage DeviceTypeSelectGroup(string eqptypecode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<TreeObejct> list = new List<TreeObejct>();
+ try
+ {
+ //鑾峰彇璁惧绫诲瀷鏁版嵁
+ sql = @"select code,name from TEqpGroup where eqptype_code=@eqptypecode and is_delete<>'1'";
+ dynamicParams.Add("@eqptypecode", eqptypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鎵�灞炶溅闂翠笅鎷夋帴鍙
+ public static ToMessage WorkShopSelect(string stu_torgcode, string description)
+ {
+ string sql = "";
+ string search = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇璁惧绫诲瀷鏁版嵁
+ switch (description)
+ {
+ case "":
+ search += "and parent.description=@description ";
+ dynamicParams.Add("@description", "W");
+ break;
+ case "D":
+ search += "and child.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and parent.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ sql = @"select parent.org_code as code,parent.org_name as name
+ from TOrganization parent
+ left join TOrganization as child on parent.parent_id=child.id
+ where parent.is_delete<>'1' " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鎵�灞炶溅闂存煡鎵炬墍灞炰骇绾挎帴鍙
+ public static ToMessage WorkShopSelectLine(string workshopcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<TreeObejct> list = new List<TreeObejct>();
+ try
+ {
+ //鑾峰彇瑙掕壊绫诲瀷闆嗗悎(鍖呭惈缁戝畾鏍囪瘑)
+ dynamicParams.Add("@workshop_code", workshopcode);
+ var data = DapperHelper.selectProcedure("h_p_T_WorkShopSelectLine", dynamicParams);
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+
+
+
+
+
+
+ #region[璁惧绫诲瀷鏌ヨ]
+ public static ToMessage DeviceTypeSearch()
+ {
+ try
+ {
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var sql = @"select id, code,name
+ from TEqpType";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = data.Rows.Count;
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷鏂板]
+ public static ToMessage AddUpdateDeviceType(string OperType, List<ObjectDataCont> json, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ if (OperType == "Add")
+ {
+ //鍒ゆ柇璁惧绫诲瀷鏄惁閲嶅
+ sql = @"select * from TEqpType where code=@devtypecode";
+ dynamicParams.Add("@devtypecode", json[0].code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧绫诲瀷缂栫爜宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇璁惧绫诲瀷鍚嶇О鏄惁閲嶅
+ sql = @"select * from TEqpType where name=@devtypename";
+ dynamicParams.Add("@devtypename", json[0].name);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧绫诲瀷鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //寰幆鍐欏叆璁惧绫诲瀷琛�
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"insert into TEqpType(code,name,lm_user,lm_date,remark) values(@code,@name,@username,@createdate,@description)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = json[i].code,
+ name = json[i].name,
+ username = us.usercode,
+ createdate = DateTime.Now.ToString(),
+ description = json[i].description
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗚澶囩被鍨�:" + string.Join(",", json.Select(m => m.code)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇璁惧鍚嶇О鏄惁閲嶅
+ sql = @"select * from TEqpType where code<>@devtypecode and name=@devtypename";
+ dynamicParams.Add("@devtypecode", json[0].code);
+ dynamicParams.Add("@devtypename", json[0].name);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧绫诲瀷鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"update TEqpType set name=@devtypename,remark=@remark,lm_user=@lm_user,lm_date=@lm_date
+ where code=@devtypecode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ devtypecode = json[i].code,
+ devtypename = json[i].name,
+ remark = json[i].description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗚澶囩被鍨�:" + string.Join(",", json.Select(m => m.code)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷鍒犻櫎]
+ public static ToMessage DeleteDeviceType(string devicetypecode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇璁惧鏈夋棤鍏宠仈璁惧绫诲瀷
+ sql = @"select * from TEqpInfo where eqptype_code=@devicetypecode";
+ dynamicParams.Add("@devicetypecode", devicetypecode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠璁惧绫诲瀷宸叉湁鍏宠仈璁惧,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ }
+ else
+ {
+ sql = @"delete TEqpType where code=@devicetypecode";
+ list.Add(new { str = sql, parm = new { devicetypecode = devicetypecode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗚澶囩被鍨�:" + devicetypecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region [璁惧娓呭崟鏌ヨ]
+ public static ToMessage DeviceMangerSearch(string devicecode, string devicename, string status, string storgcode, string devicetype, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (devicecode != "" && devicecode != null)
+ {
+ search += "and A.code like '%'+@devicecode+'%' ";
+ dynamicParams.Add("@devicecode", devicecode);
+ }
+ if (devicename != "" && devicename != null)
+ {
+ search += "and A.name like '%'+@devicename+'%' ";
+ dynamicParams.Add("@devicename", devicename);
+ }
+ if (status != "" && status != null)
+ {
+ search += "and A.enable=@status ";
+ dynamicParams.Add("@status", status);
+ }
+ if (storgcode != "" && storgcode != null)
+ {
+ search += "and A.torg_code=@storgcode ";
+ dynamicParams.Add("@storgcode", storgcode);
+ }
+ if (devicetype != "" && devicetype != null)
+ {
+ search += "and A.eqptype_code=@devicetype ";
+ dynamicParams.Add("@devicetype", devicetype);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.eqptype_code,B.name as eqptype_name,A.enable,A.torg_code,T.torg_name,A.opc_uom,U.username as lm_user,A.lm_date
+ from TEqpInfo A
+ left join TEqpType B on A.eqptype_code=B.code
+ left join TOrganization T on A.torg_code=T.torg_code
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鏂板缂栬緫]
+ public static ToMessage AddUpdateDeviceManger(string devicecode, string devicename, string devicetype, string storgcode, string status, string OperType, User us)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sql = "";
+ try
+ {
+ if (OperType == "Add")
+ {
+ //鍒ゆ柇璁惧缂栫爜鏄惁閲嶅
+ sql = @"select * from TEqpInfo where code=@devicecode";
+ dynamicParams.Add("@devicecode", devicecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧缂栫爜宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇璁惧鍚嶇О鏄惁閲嶅
+ sql = @"select * from TEqpInfo where name=@devicename";
+ dynamicParams.Add("@devicename", devicename);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+
+ sql = @"insert into TEqpInfo(code,name,eqptype_code,torg_code,enable,opc_uom,lm_user,lm_date)
+ values(@devicecode,@devicename,@devicetype,@torg_code,@status,@uom,@usercode,@CreateDate)";
+ dynamicParams.Add("@devicecode", devicecode);
+ dynamicParams.Add("@devicename", devicename);
+ dynamicParams.Add("@devicetype", devicetype);
+ dynamicParams.Add("@torg_code", storgcode);
+ dynamicParams.Add("@status", status);
+ dynamicParams.Add("@uom", "鍙�");
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗚澶�:" + devicecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇璁惧鍚嶇О鏄惁閲嶅
+ sql = @"select * from TEqpInfo where code<>@code and name=@name";
+ dynamicParams.Add("@code", devicecode);
+ dynamicParams.Add("@name", devicename);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ sql = @"update TEqpInfo set name=@devicename,eqptype_code=@devicetype,torg_code=@torg_code,enable=@status,lm_user=@usercode,lm_date=@CreateDate
+ where code=@devicecode";
+ dynamicParams.Add("@devicecode", devicecode);
+ dynamicParams.Add("@devicename", devicename);
+ dynamicParams.Add("@devicetype", devicetype);
+ dynamicParams.Add("@torg_code", storgcode);
+ dynamicParams.Add("@status", status);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗚澶�:" + devicecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鍒犻櫎]
+ public static ToMessage DeleteDeviceManger(string devicecode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇璁惧鏄惁鏈夊紑鎶ュ伐,涓嶅厑璁稿垹闄�
+
+ //鍒犻櫎璁惧
+ sql = @"delete TEqpInfo where code=@devicecode";
+ list.Add(new { str = sql, parm = new { devicecode = devicecode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗚澶�:" + devicecode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇℃伅鏌ョ湅SOP]
+ public static ToMessage DeviceSopSearch(string eqptypecode, string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇SOP鏂囦欢淇℃伅
+ sql = @"select filename,filepath,version from TDeviceSop
+ where eqptypecode=@eqptypecode and eqpcode=@eqpcode
+ order by version";
+ dynamicParams.Add("@eqptypecode", eqptypecode);
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧鏆傛棤SOP鏂囦欢!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[璁惧鐐规椤瑰垪琛ㄦ煡璇
+ public static ToMessage DeviceCheckItemSearch(string checkitemcode, string checkitemname, string checkdescr, string isqrcode, string cycle, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (checkitemcode != "" && checkitemcode != null)
+ {
+ search += "and A.code like '%'+@checkitemcode+'%' ";
+ dynamicParams.Add("@checkitemcode", checkitemcode);
+ }
+ if (checkitemname != "" && checkitemname != null)
+ {
+ search += "and A.name like '%'+@checkitemname+'%' ";
+ dynamicParams.Add("@checkitemname", checkitemname);
+ }
+ if (checkdescr != "" && checkdescr != null)
+ {
+ search += "and A.description like '%'+@checkdescr+'%' ";
+ dynamicParams.Add("@checkdescr", checkdescr);
+ }
+ if (isqrcode != "" && isqrcode != null)
+ {
+ search += "and A.isscan=@isqrcode ";
+ dynamicParams.Add("@isqrcode", isqrcode);
+ }
+ if (cycle != "" && cycle != null)
+ {
+ search += "and A.cycle=@cycle ";
+ dynamicParams.Add("@cycle", cycle);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,A.isscan,A.cycle,U.username as lm_user,A.lm_date
+ from TEqpchk_Item A
+ left join TUser U on A.lm_user=U.usercode
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规椤规柊澧炵紪杈慮
+ public static ToMessage AddUpdateDeviceCheckItem(string checkitemid, string checkitemcode, string checkitemname, string checkitemdescr, string cycle, string isqrcode, User us, string operType)
+ {
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (operType == "Add")
+ {
+ var sql = @"insert into TEqpchk_Item(code,name,description,isscan,cycle,lm_user,lm_date)
+ values(@checkitemcode,@checkitemname,@checkitemdescr,@isqrcode,@cycle,@usercode,@CreateDate)";
+ dynamicParams.Add("@checkitemcode", checkitemcode);
+ dynamicParams.Add("@checkitemname", checkitemname);
+ dynamicParams.Add("@checkitemdescr", checkitemdescr);
+ dynamicParams.Add("@isqrcode", isqrcode);
+ dynamicParams.Add("@cycle", cycle);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (operType == "Update")
+ {
+ var sql = @"update TEqpchk_Item set name=@checkitemname,description=@checkitemdescr,isscan=@isqrcode,cycle=@cycle,
+ lm_user=@usercode,lm_date=@CreateDate
+ where id=@checkitemid";
+ dynamicParams.Add("@checkitemid", checkitemid);
+ dynamicParams.Add("@checkitemname", checkitemname);
+ dynamicParams.Add("@checkitemdescr", checkitemdescr);
+ dynamicParams.Add("@isqrcode", isqrcode);
+ dynamicParams.Add("@cycle", cycle);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规椤瑰垹闄
+ public static ToMessage DeleteDeviceCheckItem(string checkitemcode)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇鐐规鏍囧噯椤圭洰鏄惁鏈夊叧鑱旂偣妫�鏍囧噯,涓嶅厑璁稿垹闄�
+ sql = @"select * from TEqpchk_Deta
+ where code=@checkitemcode";
+ dynamicParams.Add("@checkitemcode", checkitemcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鐐规椤圭洰宸插叧鑱旀爣鍑�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍒犻櫎鐐规椤圭洰
+ sql = @"delete TEqpchk_Item where code=@checkitemcode";
+ list.Add(new { str = sql, parm = new { checkitemcode = checkitemcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[璁惧淇濆吇椤瑰垪琛ㄦ煡璇
+ public static ToMessage DeviceMaiItemSearch(string maiitemcode, string maiitemname, string maidescr, string isqrcode, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (maiitemcode != "" && maiitemcode != null)
+ {
+ search += "and A.code like '%'+@maiitemcode+'%' ";
+ dynamicParams.Add("@maiitemcode", maiitemcode);
+ }
+ if (maiitemname != "" && maiitemname != null)
+ {
+ search += "and A.name like '%'+@maiitemname+'%' ";
+ dynamicParams.Add("@maiitemname", maiitemname);
+ }
+ if (maidescr != "" && maidescr != null)
+ {
+ search += "and A.description like '%'+@maidescr+'%' ";
+ dynamicParams.Add("@maidescr", maidescr);
+ }
+ if (isqrcode != "" && isqrcode != null)
+ {
+ search += "and A.isscan=@isqrcode ";
+ dynamicParams.Add("@isqrcode", isqrcode);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,A.isscan,U.username as lm_user,A.lm_date
+ from TEqpmai_Item A
+ left join TUser U on A.lm_user=U.usercode
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇椤规柊澧炵紪杈慮
+ public static ToMessage AddUpdateDeviceMaiItem(string maiitemid, string maiitemcode, string maiitemname, string maiitemdescr, string isqrcode, User us, string operType)
+ {
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (operType == "Add")
+ {
+ var sql = @"insert into TEqpmai_Item(code,name,description,isscan,lm_user,lm_date)
+ values(@maiitemcode,@maiitemname,@maiitemdescr,@isqrcode,@usercode,@CreateDate)";
+ dynamicParams.Add("@maiitemcode", maiitemcode);
+ dynamicParams.Add("@maiitemname", maiitemname);
+ dynamicParams.Add("@maiitemdescr", maiitemdescr);
+ dynamicParams.Add("@isqrcode", isqrcode);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (operType == "Update")
+ {
+ var sql = @"update TEqpmai_Item set name=@maiitemname,description=@maiitemdescr,isscan=@isqrcode,
+ lm_user=@usercode,lm_date=@CreateDate
+ where id=@maiitemid";
+ dynamicParams.Add("@maiitemid", maiitemid);
+ dynamicParams.Add("@maiitemname", maiitemname);
+ dynamicParams.Add("@maiitemdescr", maiitemdescr);
+ dynamicParams.Add("@isqrcode", isqrcode);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇椤瑰垹闄
+ public static ToMessage DeleteDeviceMaiItem(string maiitemcode)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇淇濆吇鏍囧噯椤圭洰鏄惁鏈夊叧鑱斾繚鍏绘爣鍑�,涓嶅厑璁稿垹闄�
+ sql = @"select * from TEqpmai_Deta
+ where code=@maiitemcode";
+ dynamicParams.Add("@maiitemcode", maiitemcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠淇濆吇椤圭洰宸插叧鑱旀爣鍑�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍒犻櫎淇濆吇椤圭洰
+ sql = @"delete TEqpmai_Item where code=@maiitemcode";
+ list.Add(new { str = sql, parm = new { maiitemcode = maiitemcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[璁惧鐐规鏍囧噯鍒楄〃鏌ヨ]
+ public static ToMessage DeviceCheckStandArdSearch(User us, string checkstandcode, string checkstandname, string checkcontr, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (checkstandcode != "" && checkstandcode != null)
+ {
+ search += "and A.code like '%'+@checkstandcode+'%' ";
+ dynamicParams.Add("@checkstandcode", checkstandcode);
+ }
+ if (checkstandname != "" && checkstandname != null)
+ {
+ search += "and A.name like '%'+@checkstandname+'%' ";
+ dynamicParams.Add("@checkstandname", checkstandname);
+ }
+ if (checkcontr != "" && checkcontr != null)
+ {
+ search += "and A.iscontr=@checkcontr ";
+ dynamicParams.Add("@checkcontr", checkcontr);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,A.iscontr,
+ (case when isnull(M.eqpchkmain_code,'')='' then 'N' else 'Y' end) as is_checkeqp,U.username as lm_user,A.lm_date
+ from TEqpchk_Main A
+ left join TUser U on A.lm_user=U.usercode
+ left join (
+ select distinct eqpchkmain_code from TEqpchk_Eqp M
+ ) M on A.code=M.eqpchkmain_code where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鏂板銆佺紪杈戣幏鍙栨楠岄」鐩笅鎷夊垪琛╙
+ public static ToMessage DeviceCheckItemSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁惧鐐规椤圭洰鏁版嵁
+ sql = @"select code,name,description from TEqpchk_Item where is_delete<>'1' ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ public static ToMessage ViewDeviceCheckStanedSearch(string checkstand_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇璁惧鐐规鏍囧噯淇℃伅
+ sql = @"select code,name,description,iscontr
+ from TEqpchk_Main
+ where code=@checkstand_code and is_delete<>'1'";
+ dynamicParams.Add("@checkstand_code", checkstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ RoutEdit rout = new RoutEdit();
+ if (data.Rows.Count > 0)
+ {
+ rout.code = data.Rows[0]["CODE"].ToString();
+ rout.name = data.Rows[0]["NAME"].ToString();
+ rout.description = data.Rows[0]["DESCRIPTION"].ToString();
+ rout.enable = data.Rows[0]["ISCONTR"].ToString();
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犵偣妫�鏍囧噯淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+ //鏍规嵁璁惧鐐规鏍囧噯缂栫爜鑾峰彇鍏宠仈鐨勬楠岄」鐩俊鎭�
+ sql = @"select B.code,B.name,A.chkdesc,A.isscan,A.cycle from TEqpchk_Deta A
+ left join TEqpchk_Item B on A.code=B.code
+ where A.eqpchk_main_code=@checkstaned_code order by A.seq asc";
+ dynamicParams.Add("@checkstaned_code", rout.code);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ rout.Data = data0;
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = rout;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鏂板缂栬緫]
+ public static ToMessage AddUpdateDeviceCheckStandArd(string opertype, RoutEdit json, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (opertype == "Add")
+ {
+ //鏂板璁惧鐐规鏍囧噯涓昏〃
+ sql = @"insert into TEqpchk_Main(code,name,description,iscontr,lm_user,lm_date) values(@code,@name,@descr,@iscontr,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { code = json.code, name = json.name, descr = json.description, iscontr = json.enable, lm_user = us.usercode, lm_date = DateTime.Now.ToString() } });
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ //鏂板璁惧鐐规鏍囧噯鍏宠仈鐐规椤瑰瓙琛�
+ sql = @"insert TEqpchk_Deta (seq,code,name,eqpchk_main_code,cycle,chkdesc,isscan,lm_user,lm_date)
+ values(@checkitem_seq,@checkitem_code,@checkitem_name,@code,@cycle,@chkdesc,@isscan,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checkitem_seq = Convert.ToInt32(json.Data.Rows[i]["CHECKITEM_SEQ"].ToString()),
+ checkitem_code = json.Data.Rows[i]["CHECKITEM_CODE"].ToString(),
+ checkitem_name = json.Data.Rows[i]["CHECKITEM_NAME"].ToString(),
+ code = json.code,
+ cycle = json.Data.Rows[i]["CYCLE"].ToString(),
+ chkdesc = json.Data.Rows[i]["CHECKITEM_DESCR"].ToString(),
+ isscan = json.Data.Rows[i]["ISSCAN"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ //鍒犻櫎鐐规鏍囧噯鍏宠仈鐐规椤圭洰瀛愯〃
+ sql = @"delete from TEqpchk_Deta where eqpchk_main_code=@checkstaned_code";
+ list.Add(new { str = sql, parm = new { checkstaned_code = json.code } });
+ //淇敼鐐规鏍囧噯涓昏〃
+ sql = @"update TEqpchk_Main set name=@checkstaned_name,description=@checkstaned_desc,iscontr=@iscontr where code=@checkstaned_code";
+ list.Add(new { str = sql, parm = new { checkstaned_code = json.code, checkstaned_name = json.name, checkstaned_desc = json.description, iscontr = json.enable } });
+ //鏂板鐐规鏍囧噯鍏宠仈鐐规椤圭洰瀛愯〃
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ sql = @"insert TEqpchk_Deta (seq,code,name,eqpchk_main_code,cycle,chkdesc,isscan,lm_user,lm_date)
+ values(@checkitem_seq,@checkitem_code,@checkitem_name,@code,@cycle,@chkdesc,@isscan,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checkitem_seq = Convert.ToInt32(json.Data.Rows[i]["CHECKITEM_SEQ"].ToString()),
+ checkitem_code = json.Data.Rows[i]["CHECKITEM_CODE"].ToString(),
+ checkitem_name = json.Data.Rows[i]["CHECKITEM_NAME"].ToString(),
+ code = json.code,
+ cycle = json.Data.Rows[i]["CYCLE"].ToString(),
+ chkdesc = json.Data.Rows[i]["CHECKITEM_DESCR"].ToString(),
+ isscan = json.Data.Rows[i]["ISSCAN"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鍒犻櫎]
+ public static ToMessage DeleteDeviceCheckStaned(string checkstand_code)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TEqpchk_Proc_Main where eqpchkmain_code=@checkstand_code";
+ dynamicParams.Add("@checkstand_code", checkstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鐐规鏍囧噯宸茬敓鎴愮偣妫�璁板綍,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎璁惧鐐规鏍囧噯涓昏〃
+ sql = @"delete TEqpchk_Main where code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ //鍒犻櫎璁惧鐐规鏍囧噯鍏宠仈鐐规椤圭洰瀛愯〃
+ sql = @"delete TEqpchk_Deta where eqpchk_main_code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ //鍒犻櫎璁惧鐐规鏍囧噯鍏宠仈璁惧琛�
+ sql = @"delete TEqpchk_Eqp where eqpchkmain_code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "璁惧鐐规鏍囧噯鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧鐐规鏍囧噯鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规鏍囧噯鍏宠仈宸ヤ綔绔欐煡璇
+ public static ToMessage DeviceCheckStanedAssociationEqp(User us, string checkstand_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<StandEqp> list = new List<StandEqp>();
+ try
+ {
+ //鑾峰彇宸ヤ綔绔欓泦鍚�(杞﹂棿,鍖呭惈宸茬粦瀹氬伐浣滅珯鏍囪瘑)
+ sql = @"select distinct E.torg_code as wksp_code,T.torg_name as wksp_name,'E' as type,(case when B.wksp_code is null then 'N' else 'Y' end) flag
+ from TEqpInfo E
+ left join TOrganization T on E.torg_code=T.torg_code
+ left join(
+ select distinct B.torg_code as wksp_code from TEqpchk_Eqp A
+ inner join TEqpInfo B on A.eqp_code=B.code
+ where A.eqpchkmain_code=@checkstand_code
+ ) B on T.torg_code=B.wksp_code";
+ dynamicParams.Add("@checkstand_code", checkstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ StandEqp rout = new StandEqp();
+ rout.code = data.Rows[i]["WKSP_CODE"].ToString();
+ rout.name = data.Rows[i]["WKSP_NAME"].ToString();
+ rout.type = data.Rows[i]["TYPE"].ToString();
+ rout.flag = data.Rows[i]["FLAG"].ToString();
+ rout.children = new List<StandEqpCn>();
+ sql = @"select * from(
+ select AA.code,AA.name,'E' as type,(case when BB.eqpchkmain_code is null then 'N' else 'Y' end) flag,(case when AA.eqpchkmain_code is null then 'N' else 'Y' end) flage1
+ from(
+ select A.code,A.name,'' as eqpchkmain_code
+ from TEqpInfo A
+ where A.torg_code=@wkspcode
+ ) as AA
+ left join (
+ select A.code,A.name,B.eqpchkmain_code
+ from TEqpInfo A
+ inner join TEqpchk_Eqp B on A.code=B.eqp_code
+ where A.torg_code=@wkspcode and B.eqpchkmain_code=@checkstand_code
+ ) as BB on AA.code=BB.code
+ ) as CC ";
+ dynamicParams.Add("@checkstand_code", checkstand_code);
+ dynamicParams.Add("@wkspcode", data.Rows[i]["WKSP_CODE"].ToString());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ for (int j = 0; j < data0.Rows.Count; j++)
+ {
+ StandEqpCn cn = new StandEqpCn();
+ cn.code = data0.Rows[j]["CODE"].ToString();//璁惧缂栫爜
+ cn.name = data0.Rows[j]["NAME"].ToString();//璁惧鍚嶇О
+ cn.type = data0.Rows[j]["TYPE"].ToString();//宸ヤ綔绔欑被鍨�(E:璁惧 W:澶栧崗渚涙柟)
+ cn.flag = data0.Rows[j]["FLAG"].ToString();//鍏宠仈鏍囪瘑
+ rout.children.Add(cn);
+ }
+ list.Add(rout);
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [璁惧鐐规鏍囧噯鍏宠仈宸ヤ綔绔欐彁浜
+ public static ToMessage SaveDeviceCheckStanedAssociationEqp(User us, string checkstand_code, List<ObjectData> json)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ //娓呴櫎璁惧鐐规鏍囧噯鍏宠仈璁惧琛ㄦ暟鎹�
+ sql = @"delete TEqpchk_Eqp where eqpchkmain_code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ //寰幆鍐欏叆璁惧鐐规鏍囧噯鍏宠仈璁惧琛�
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"insert into TEqpchk_Eqp(eqpchkmain_code,eqp_code,lm_user,lm_date,torg_code) values(@checkstand_code,@eqp_code,@lm_user,@lm_date,@torg_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ eqp_code = json[i].code,
+ checkstand_code = checkstand_code,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ torg_code = json[i].flag
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[璁惧淇濆吇鏍囧噯鍒楄〃鏌ヨ]
+ public static ToMessage DeviceRepairStandArdSearch(User us, string repairstandcode, string repairstandname, string repairstanddescr, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (repairstandcode != "" && repairstandcode != null)
+ {
+ search += "and A.code like '%'+@repairstandcode+'%' ";
+ dynamicParams.Add("@repairstandcode", repairstandcode);
+ }
+ if (repairstandname != "" && repairstandname != null)
+ {
+ search += "and A.name like '%'+@repairstandname+'%' ";
+ dynamicParams.Add("@repairstandname", repairstandname);
+ }
+ if (repairstanddescr != "" && repairstanddescr != null)
+ {
+ search += "and A.description like '%'+@repairstanddescr+'%' ";
+ dynamicParams.Add("@repairstanddescr", repairstanddescr);
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,
+ (case when isnull(M.eapmai_code,'')='' then 'N' else 'Y' end) as is_repaireqp,
+ A.main_cycle,U.username as lm_user,A.lm_date
+ from TEqpmai_Main A
+ left join TUser U on A.lm_user=U.usercode
+ left join (
+ select distinct eapmai_code from TEqpmai_Eqp M
+ ) M on A.code=M.eapmai_code where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鏂板銆佺紪杈戣幏鍙栦繚鍏婚」鐩笅鎷夊垪琛╙
+ public static ToMessage DeviceRepairItemSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁惧淇濆吇椤圭洰鏁版嵁
+ sql = @"select code,name,description from TEqpmai_Item where is_delete<>'1' ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ public static ToMessage ViewDeviceRepairStanedSearch(string repairstand_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇璁惧淇濆吇鏍囧噯淇℃伅
+ sql = @"select code,name,description,main_cycle
+ from TEqpmai_Main
+ where code=@repairstand_code and is_delete<>'1'";
+ dynamicParams.Add("@repairstand_code", repairstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ EqpRepair rout = new EqpRepair();
+ if (data.Rows.Count > 0)
+ {
+ rout.code = data.Rows[0]["CODE"].ToString();
+ rout.name = data.Rows[0]["NAME"].ToString();
+ rout.repaircycle = data.Rows[0]["MAIN_CYCLE"].ToString();
+ rout.description = data.Rows[0]["DESCRIPTION"].ToString();
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犱繚鍏绘爣鍑嗕俊鎭�!";
+ mes.data = null;
+ return mes;
+ }
+ //鏍规嵁璁惧淇濆吇鏍囧噯缂栫爜鑾峰彇鍏宠仈鐨勪繚鍏婚」鐩俊鎭�
+ sql = @"select B.code,B.name,A.chk_desc,A.isscan,A.cycle from TEqpmai_Deta A
+ left join TEqpmai_Item B on A.code=B.code
+ where A.eapmai_code=@repairstand_code order by A.seq asc";
+ dynamicParams.Add("@repairstand_code", rout.code);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ rout.Data = data0;
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = rout;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鏂板缂栬緫]
+ public static ToMessage AddUpdateDeviceRepairStandArd(string opertype, EqpRepair json, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (opertype == "Add")
+ {
+ //鏂板璁惧淇濆吇鏍囧噯涓昏〃
+ sql = @"insert into TEqpmai_Main(code,name,description,main_cycle,lm_user,lm_date) values(@code,@name,@descr,@main_cycle,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { code = json.code, name = json.name, descr = json.description, main_cycle = json.repaircycle, lm_user = us.usercode, lm_date = DateTime.Now.ToString() } });
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ //鏂板璁惧淇濆吇鏍囧噯鍏宠仈淇濆吇椤瑰瓙琛�
+ sql = @"insert TEqpmai_Deta (seq,code,name,eapmai_code,chk_desc,isscan,lm_user,lm_date)
+ values(@repairitem_seq,@repairitem_code,@repairitem_name,@code,@repairdesc,@isscan,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repairitem_seq = Convert.ToInt32(json.Data.Rows[i]["REPAIRITEM_SEQ"].ToString()),
+ repairitem_code = json.Data.Rows[i]["REPAIRITEM_CODE"].ToString(),
+ repairitem_name = json.Data.Rows[i]["REPAIRITEM_NAME"].ToString(),
+ code = json.code,
+ repairdesc = json.Data.Rows[i]["REPAIRITEM_DESCR"].ToString(),
+ isscan = json.Data.Rows[i]["ISSCAN"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ //鍒犻櫎淇濆吇鏍囧噯鍏宠仈鐐规椤圭洰瀛愯〃
+ sql = @"delete from TEqpmai_Deta where eapmai_code=@repairstaned_code";
+ list.Add(new { str = sql, parm = new { repairstaned_code = json.code } });
+ //淇敼淇濆吇鏍囧噯涓昏〃
+ sql = @"update TEqpmai_Main set name=@repairstaned_name,description=@repairstaned_desc,main_cycle=@main_cycle where code=@repairstaned_code";
+ list.Add(new { str = sql, parm = new { repairstaned_code = json.code, repairstaned_name = json.name, repairstaned_desc = json.description, main_cycle = json.repaircycle } });
+ //鏂板鐐规鏍囧噯鍏宠仈鐐规椤圭洰瀛愯〃
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ sql = @"insert TEqpmai_Deta (seq,code,name,eapmai_code,chk_desc,isscan,lm_user,lm_date)
+ values(@repairitem_seq,@repairitem_code,@repairitem_name,@code,@repairdesc,@isscan,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repairitem_seq = Convert.ToInt32(json.Data.Rows[i]["REPAIRITEM_SEQ"].ToString()),
+ repairitem_code = json.Data.Rows[i]["REPAIRITEM_CODE"].ToString(),
+ repairitem_name = json.Data.Rows[i]["REPAIRITEM_NAME"].ToString(),
+ code = json.code,
+ repairdesc = json.Data.Rows[i]["REPAIRITEM_DESCR"].ToString(),
+ isscan = json.Data.Rows[i]["ISSCAN"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鍒犻櫎]
+ public static ToMessage DeleteDeviceRepairStaned(string repairstand_code)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TEqpmaint_Proc_Main where eqpmaint_code=@repairstand_code";
+ dynamicParams.Add("@repairstand_code", repairstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠淇濆吇鏍囧噯宸茬敓鎴愪繚鍏昏褰�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎璁惧淇濆吇鏍囧噯涓昏〃
+ sql = @"delete TEqpmai_Main where code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ //鍒犻櫎璁惧淇濆吇鏍囧噯鍏宠仈淇濆吇椤圭洰瀛愯〃
+ sql = @"delete TEqpmai_Deta where eapmai_code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ //鍒犻櫎璁惧淇濆吇鏍囧噯鍏宠仈璁惧琛�
+ sql = @"delete TEqpmai_Eqp where eapmai_code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "璁惧淇濆吇鏍囧噯鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧淇濆吇鏍囧噯鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇鏍囧噯鍏宠仈宸ヤ綔绔欐煡璇
+ public static ToMessage DeviceRepairStanedAssociationEqp(User us, string repairstand_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<StandEqp> list = new List<StandEqp>();
+ try
+ {
+ //鑾峰彇宸ヤ綔绔欓泦鍚�(杞﹂棿,鍖呭惈宸茬粦瀹氬伐浣滅珯鏍囪瘑)
+ sql = @"select distinct E.torg_code as wksp_code,T.torg_name as wksp_name,'E' as type,(case when B.wksp_code is null then 'N' else 'Y' end) flag
+ from TEqpInfo E
+ left join TOrganization T on E.torg_code=T.torg_code
+ left join(
+ select distinct B.torg_code as wksp_code from TEqpmai_Eqp A
+ inner join TEqpInfo B on A.eqp_code=B.code
+ where A.eapmai_code=@repairstand_code
+ ) B on T.torg_code=B.wksp_code ";
+
+ dynamicParams.Add("@repairstand_code", repairstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ StandEqp rout = new StandEqp();
+ rout.code = data.Rows[i]["WKSP_CODE"].ToString();
+ rout.name = data.Rows[i]["WKSP_NAME"].ToString();
+ rout.type = data.Rows[i]["TYPE"].ToString();
+ rout.flag = data.Rows[i]["FLAG"].ToString();
+ rout.children = new List<StandEqpCn>();
+ //鏍规嵁杞﹂棿缂栫爜鏌ユ壘璁惧(鍖呭惈宸插叧鑱旀爣璇�)
+ sql = @"select * from(
+ select AA.code,AA.name,'E' as type,(case when BB.eapmai_code is null then 'N' else 'Y' end) flag,(case when AA.eapmai_code is null then 'N' else 'Y' end) flage1
+ from(
+ select A.code,A.name,'' as eapmai_code
+ from TEqpInfo A
+ where A.torg_code=@wkspcode
+ ) as AA
+ left join (
+ select A.code,A.name,B.eapmai_code
+ from TEqpInfo A
+ inner join TEqpmai_Eqp B on A.code=B.eqp_code
+ where A.torg_code=@wkspcode and B.eapmai_code=@repairstand_code
+ ) as BB on AA.code=BB.code
+ ) as CC";
+ dynamicParams.Add("@repairstand_code", repairstand_code);
+ dynamicParams.Add("@wkspcode", data.Rows[i]["WKSP_CODE"].ToString());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ for (int j = 0; j < data0.Rows.Count; j++)
+ {
+ StandEqpCn cn = new StandEqpCn();
+ cn.code = data0.Rows[j]["CODE"].ToString();//璁惧缂栫爜
+ cn.name = data0.Rows[j]["NAME"].ToString();//璁惧鍚嶇О
+ cn.type = data0.Rows[j]["TYPE"].ToString();//宸ヤ綔绔欑被鍨�(E:璁惧 W:澶栧崗渚涙柟)
+ cn.flag = data0.Rows[j]["FLAG"].ToString();//鍏宠仈鏍囪瘑
+ rout.children.Add(cn);
+ }
+ list.Add(rout);
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [璁惧淇濆吇鏍囧噯鍏宠仈宸ヤ綔绔欐彁浜
+ public static ToMessage SaveDeviceRepairStanedAssociationEqp(User us, string repairstand_code, List<ObjectData> json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ sql = @"delete TEqpmai_Eqp where eapmai_code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ //寰幆鍐欏叆璁惧淇濆吇鏍囧噯鍏宠仈璁惧琛�
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"insert into TEqpmai_Eqp(eapmai_code,eqp_code,lm_user,lm_date,torg_code) values(@repairstand_code,@eqp_code,@lm_user,@lm_date,@torg_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ eqp_code = json[i].code,
+ repairstand_code = repairstand_code,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ torg_code = json[i].flag
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鏃ュ父鐐规,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ public static ToMessage CheckScanDeviceQrCodeData(string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧鍙婃墍灞炶溅闂�
+ sql = @"select A.code,A.name,T.torg_code as wksp_code,T.torg_name as wksp_name,E.eqpchkmain_code
+ from TEqpInfo A
+ left join TOrganization T on A.torg_code=T.torg_code
+ left join TEqpchk_Eqp E on A.code=E.eqp_code
+ where A.code=@eqpcode and A.enable='Y'";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧/宸ヤ綅涓嶅瓨鍦ㄦ垨寮傚父!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏃ュ父鐐规,鎵弿宸ヤ綅/璁惧浜岀淮鐮佹煡鎵剧偣妫�鏍囧噯]
+ public static ToMessage CheckScanDeviceTemp(string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧鐐规鏍囧噯
+ sql = @"select M.code,M.name from TEqpchk_Eqp E
+ inner join TEqpchk_Main M on E.eqpchkmain_code=M.code
+ where E.eqp_code=@eqpcode order by M.lm_date desc";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧/宸ヤ綅鏈寚瀹氱偣妫�鏍囧噯!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+
+ #endregion
+
+ #region[鏃ュ父鐐规,閫夋嫨鎵爜璁惧鍒楄〃甯﹀嚭鐐规椤筣
+ public static ToMessage SelectScanDeviceQrCodeItem(string eqpcode, string checktempcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧鍏宠仈鐨勭偣妫�椤圭洰
+ sql = @"select S.seq,S.code,S.name,S.chkdesc,S.isscan,S.cycle
+ from TEqpchk_Eqp A
+ inner join TEqpchk_Main B on A.eqpchkmain_code=B.code
+ inner join TEqpchk_Deta S on B.code=S.eqpchk_main_code
+ where A.eqp_code=@eqpcode and B.code=@checktempcode
+ order by S.seq asc";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ dynamicParams.Add("@checktempcode", checktempcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧鏈缃偣妫�鏍囧噯缁戝畾鐐规椤圭洰!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏃ュ父鐐规銆佹彁浜や繚瀛榏
+ public static ToMessage AppDeviceCheckSave(User us, AppDevicecCheck json)
+ {
+ var sql = "";
+ string djwo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncode.EncodingSeach("2400"); //APP绔棩甯哥偣妫�鐢熸垚鍗曞彿
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ djwo = wo[0].ToString(); //鑾峰彇鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ if (json == null || json.children.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鐐规椤逛俊鎭笉鑳戒负绌�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍐欏叆鐐规璁板綍涓昏〃
+ sql = @"insert into TEqpchk_Proc_Main(djwo,eqp_code,eqpchkmain_code,chk_user,chk_date,chk_result)
+ values(@djwo,@eqp_code,@eqpchkmain_code,@lm_user,@lm_date,@chk_result)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ djwo = djwo,
+ eqp_code = json.code,
+ eqpchkmain_code = json.standcode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ chk_result = json.result
+ }
+ });
+ //寰幆鍐欏叆鐐规璁板綍瀛愯〃
+ for (int i = 0; i < json.children.Count; i++)
+ {
+ sql = @"insert into TEqpchk_Proc_Deta(seq,djwo,eqpchkdeta_code,chk_cyc,result,chk_value)
+ values(@seq,@djwo,@eqpchkdeta_code,@chk_cyc,@result,@chk_value)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ seq = json.children[i].seq,
+ djwo = djwo,
+ eqpchkdeta_code = json.children[i].itemcode,
+ chk_cyc = json.children[i].cycle,
+ result = json.children[i].result,
+ chk_value = json.children[i].value
+ }
+ }); ;
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "璁惧鐐规", "鐐规浜嗚澶囷細" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鐐规鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鐐规澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[瀹氭湡淇濆吇,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ public static ToMessage RepairScanDeviceQrCodeData(string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧鍙婃墍灞炶溅闂�
+ sql = @"select A.code,A.name,T.torg_code as wksp_code,T.torg_name as wksp_name,
+ E.eapmai_code,M.name as eapmai_name,M.main_cycle
+ from TEqpInfo A
+ left join TOrganization T on A.torg_code=T.torg_code
+ left join TEqpmai_Eqp E on A.code=E.eqp_code
+ left join TEqpmai_Main M on E.eapmai_code=M.code
+ where A.code=@eqpcode and A.enable='Y'";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧寮傚父!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹氭湡淇濆吇,鎵弿宸ヤ綅/璁惧浜岀淮鐮佹煡鎵句繚鍏绘爣鍑哴
+ public static ToMessage RepairScanDeviceTemp(string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧淇濆吇鏍囧噯
+ sql = @"select M.code,M.name,main_cycle from TEqpmai_Eqp E
+ inner join TEqpmai_Main M on E.eapmai_code=M.code
+ where E.eqp_code=@eqpcode
+ order by M.lm_date desc";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧/宸ヤ綅鏈寚瀹氫繚鍏绘爣鍑�!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏃ュ父淇濆吇,閫夋嫨鎵爜璁惧鍒楄〃甯﹀嚭淇濆吇椤筣
+ public static ToMessage RepairSelectScanDeviceQrCodeItem(string eqpcode, string repartempcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲璁惧鍏宠仈鐨勪繚鍏婚」鐩�
+ sql = @"select S.seq,S.code,S.name,S.chk_desc,S.isscan,B.main_cycle
+ from TEqpmai_Eqp A
+ inner join TEqpmai_Main B on A.eapmai_code=B.code
+ inner join TEqpmai_Deta S on B.code=S.eapmai_code
+ where A.eqp_code=@eqpcode and B.code=@repartempcode
+ order by S.seq asc";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ dynamicParams.Add("@repartempcode", repartempcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧鏈缃繚鍏绘爣鍑嗙粦瀹氱偣妫�椤圭洰!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏃ュ父淇濆吇,鎻愪氦淇濆瓨]
+ public static ToMessage AppDeviceRepairSave(User us, string maintcyc, AppDevicecCheck json)
+ {
+ var sql = "";
+ string bywo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncode.EncodingSeach("2401"); //APP绔畾鏈熶繚鍏荤敓鎴愬崟鍙�
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ bywo = wo[0].ToString(); //鑾峰彇鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ if (json == null || json.children.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇濆吇椤逛俊鎭笉鑳戒负绌�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍐欏叆淇濆吇璁板綍涓昏〃
+ sql = @"insert into TEqpmaint_Proc_Main(bywo,eqp_code,eqpmaint_code,maint_cyc,maint_result,maint_user,maint_date)
+ values(@bywo,@eqp_code,@eqpmaint_code,@maintcyc,@maint_result,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ bywo = bywo,
+ eqp_code = json.code,
+ eqpmaint_code = json.standcode,
+ maintcyc = maintcyc,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ maint_result = json.result
+ }
+ });
+ //寰幆鍐欏叆淇濆吇璁板綍瀛愯〃
+ for (int i = 0; i < json.children.Count; i++)
+ {
+ sql = @"insert into TEqpmaint_Proc_Deta(seq,bywo,eqpmaideta_code,result,maint_cyc,maint_value)
+ values(@seq,@bywo,@eqpmaideta_code,@result,@maint_cyc,@maint_value)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ seq = json.children[i].seq,
+ bywo = bywo,
+ eqpmaideta_code = json.children[i].itemcode,
+ maint_cyc = json.children[i].cycle,
+ result = json.children[i].result,
+ maint_value = json.children[i].value
+ }
+ }); ;
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "璁惧淇濆吇", "淇濆吇浜嗚澶囷細" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇濆吇鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇濆吇澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[璁惧缁翠慨鐢宠,鎵弿宸ヤ綅/璁惧浜岀淮鐮乚
+ public static ToMessage MaintainScanDeviceApplyQrCodeData(string eqpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇褰撳墠鎵爜璁惧鏄惁瀛樺湪宸茬敵璇锋垨宸茬淮淇姸鎬佹暟鎹�
+ sql = @"select * from TEqp_RepairRequest where eqp_code=@eqpcode and status<>'CONFIR'";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ //鏌ョ湅缁翠慨璁板綍閲岄潰鏄惁鏈夊凡鐢宠鏈淮淇強缁翠慨纭鐨勬暟鎹�
+ var rows = data0.AsEnumerable().Where(item => item["STATUS"].ToString().Equals("REPA")).ToArray();
+ if (rows.Length > 0)
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧/宸ヤ綅宸茬敵璇�,寰呯淮淇�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧/宸ヤ綅宸茬淮淇�,寰呯‘璁ら獙璇�!";
+ mes.data = null;
+ }
+ }
+ else
+ {
+ //鑾峰彇瀵瑰簲璁惧鍙婃墍灞炶溅闂�
+ sql = @"select A.code,A.name,T.torg_code as wksp_code,T.torg_name as wksp_name,E.eqpchkmain_code
+ from TEqpInfo A
+ left join TOrganization T on A.torg_code=T.torg_code
+ left join TEqpchk_Eqp E on A.code=E.eqp_code
+ where A.code=@eqpcode and A.enable='Y' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璁惧/宸ヤ綅涓嶅瓨鍦ㄦ垨寮傚父!";
+ mes.data = data;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鐢宠,鎻愪氦淇濆瓨]
+ public static ToMessage MaintainScanDeviceApplySave(User us, string eqpcode, string wkshpcode, string faultsourcecode, string faultdescr, IFormFileCollection files)
+ {
+ var sql = "";
+ string wxwo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncode.EncodingSeach("2404"); //APP绔澶囩淮淇敵璇风敓鎴愬崟鍙�
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ wxwo = wo[0].ToString(); //鑾峰彇鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ //缁翠慨鐢宠涓婁紶鍥剧墖
+ if (files != null && files.Count > 0)
+ {
+ for (int i = 0; i < files.Count; i++)
+ {
+ IFormFile file = files[i];
+ string imgName = "SQ" + DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString();
+ string filePath = "wwwroot/DeviceRecordImage/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻枃浠跺湴鍧�)
+ string filePath1 = "DeviceRecordImage/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻暟鎹〃鍦板潃)
+
+ // 鐢熸垚鏂囦欢鍚�
+ //var fileName = "SQ" + DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString() + Path.GetExtension(files[i].FileName);
+
+ // 鎷兼帴鏂囦欢淇濆瓨璺緞
+ //var filePath = Path.Combine("wwwroot/MouldRecordImage", fileName);
+
+ // 淇濆瓨鏂囦欢var stream = new FileStream(filePath, FileMode.Create)
+ using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ files[i].CopyTo(stream);
+ }
+ //寰幆鍐欑淮淇褰曞搴斿浘鐗囪〃
+ sql = @"insert into TEqp_RepairImage(source_wo,wo_type,img1url)
+ values(@source_wo,@wo_type,@img1url)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ source_wo = wxwo,
+ wo_type = "REPA",
+ img1url = filePath1
+ }
+ });
+ }
+ }
+
+ //鍐欏叆缁翠慨鐢宠璁板綍琛�
+ sql = @"insert into TEqp_RepairRequest(docu_code,docu_date,status,wksp_code,eqp_code,request_person,request_date,failure_descript,source)
+ values(@docu_code,@docu_date,@status,@wksp_code,@eqp_code,@request_person,@request_date,@failure_descript,@source)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ docu_code = wxwo,
+ docu_date = DateTime.Now.ToString(),
+ status = "REPA",
+ wksp_code = wkshpcode,
+ eqp_code = eqpcode,
+ request_person = us.usercode,
+ request_date = DateTime.Now.ToString(),
+ failure_descript = faultdescr,
+ source = faultsourcecode
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "璁惧缁翠慨鐢宠", "缁翠慨鐢宠璁惧锛�" + eqpcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缁翠慨鐢宠鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缁翠慨鐢宠澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[璁惧缁翠慨涓婁紶鍥剧墖]
+ public static ToMessage UploadImageSave(User us, string type, IFormFileCollection files)
+ {
+ string filePath = "", filePath1 = "";
+ List<string> list = new List<string>();
+ try
+ {
+
+ if (type == "G")
+ {
+ //楠岃瘉涓婁紶鍥剧墖
+ if (files != null && files.Count > 0)
+ {
+ for (int i = 0; i < files.Count; i++)
+ {
+
+ string imgName = "WX" + DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString();
+ filePath = "wwwroot/DeviceRecordImage/image1/" + imgName + files[i].FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻枃浠跺湴鍧�)
+ filePath1 = "DeviceRecordImage/image1/" + imgName + files[i].FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻暟鎹〃鍦板潃)
+ // 淇濆瓨鏂囦欢var stream = new FileStream(filePath, FileMode.Create)
+ using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ files[i].CopyTo(stream);
+ }
+ list.Add(filePath1);
+ }
+ }
+ }
+ if (type == "B")
+ {
+ //楠岃瘉涓婁紶鍥剧墖
+ if (files != null && files.Count > 0)
+ {
+ for (int i = 0; i < files.Count; i++)
+ {
+ string imgName = "WX" + DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString();
+ filePath = "wwwroot/DeviceRecordImage/image2/" + imgName + files[i].FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻枃浠跺湴鍧�)
+ filePath1 = "DeviceRecordImage/image2/" + imgName + files[i].FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻暟鎹〃鍦板潃)
+ // 淇濆瓨鏂囦欢var stream = new FileStream(filePath, FileMode.Create)
+ using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ files[i].CopyTo(stream);
+ }
+ list.Add(filePath1);
+ }
+ }
+ }
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍥剧墖涓婁紶鎴愬姛!";
+ mes.data = list;
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍥剧墖涓婁紶澶辫触" + e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鍒犻櫎涓婁紶鍥剧墖]
+ public static ToMessage UploadImageDelete(User us, ObjectModel model)
+ {
+ List<string> list = new List<string>();
+
+ // 娓呯悊鍜岄獙璇佽矾寰勶紝纭繚瀹冧笉浼氭寚鍚戜笉搴旇琚垹闄ょ殑鏂囦欢鎴栫洰褰�
+ // 渚嬪锛屽彧鍏佽鍒犻櫎uploads鐩綍涓嬬殑鏂囦欢
+ if (!model.url.StartsWith("DeviceRecordImage/"))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犳晥鐨勫浘鐗囪矾寰�!";
+ mes.data = null;
+ return mes;
+ }
+ // 鏋勫缓瀹屾暣鐨勬枃浠惰矾寰�
+ var filePath = Path.Combine("wwwroot", model.url);
+ try
+ {
+ // 妫�鏌ユ枃浠舵槸鍚﹀瓨鍦�
+ if (System.IO.File.Exists(filePath))
+ {
+ // 鍒犻櫎鏂囦欢
+ System.IO.File.Delete(filePath);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍥剧墖鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ // 鏂囦欢涓嶅瓨鍦�
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍥剧墖涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception ex)
+ {
+ // 鎹曡幏寮傚父骞惰繑鍥為敊璇俊鎭�
+ // 杩欓噷鍙互璁板綍寮傚父鍒版棩蹇椾腑锛屼互渚垮悗缁垎鏋�
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鍥剧墖鏃跺彂鐢熼敊璇�:" + ex.Message;
+ mes.data = null;
+ return mes;
+ }
+ }
+
+ #endregion
+
+ #region[璁惧缁翠慨鍒楄〃]
+ public static ToMessage RepairScanDeviceQrCodeDataList()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁惧缁翠慨鍒楄〃宸茬敵璇锋湭缁翠慨鐨勬暟鎹�
+ sql = @"select A.docu_code,B.code as eqpcode,B.name as eqpname,
+ T.torg_code as wksp_code,T.torg_name as wksp_name,
+ A.request_person,A.request_date,
+ (case when A.source='A' then '鐐规' when A.source='B' then '淇濆吇' when A.source='C' then '瀹夌伅' when A.source='D' then '鎵嬪伐' end) as source,
+ A.failure_descript
+ from TEqp_RepairRequest A
+ inner join TEqpInfo B on A.eqp_code=B.code
+ inner join TOrganization T on A.wksp_code=T.torg_code
+ where A.status='REPA'";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤缁翠慨鐢宠璁板綍!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧缁翠慨鎻愪氦]
+ public static ToMessage RepairScanDeviceSave(User us, DeviceUpdate model)
+ {
+ var sql = "";
+ string wxwo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncode.EncodingSeach("2402"); //APP璁惧缁翠慨鐢熸垚鍗曞彿
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ wxwo = wo[0].ToString(); //鑾峰彇鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ if (model.groupimage1.Count > 0)
+ {
+ for (int i = 0; i < model.groupimage1.Count; i++)
+ {
+ //寰幆鍐欑淮淇褰曞搴斿浘鐗囪〃
+ sql = @"insert into TEqp_RepairImage(source_wo,wo_type,img1url)
+ values(@source_wo,@wo_type,@img1url)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ source_wo = wxwo,
+ wo_type = "COMP",
+ img1url = model.groupimage1[i].ToString()
+ }
+ });
+ }
+ }
+ if (model.groupimage2.Count > 0)
+ {
+ for (int i = 0; i < model.groupimage2.Count; i++)
+ {
+ //寰幆鍐欑淮淇褰曞搴斿浘鐗囪〃
+ sql = @"insert into TEqp_RepairImage(source_wo,wo_type,img2url)
+ values(@source_wo,@wo_type,@img2url)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ source_wo = wxwo,
+ wo_type = "COMP",
+ img2url = model.groupimage2[i].ToString()
+ }
+ });
+ }
+ }
+ //鍐欏叆缁翠慨璁板綍琛�
+ sql = @"insert into TEqp_Repair(repair_code,docu_date,status,wksp_code,eqp_code,repair_person,repair_date,repair_content,repair_part,failure_descript,is_shutdown,source_wo)
+ values(@repair_code,@docu_date,@status,@wksp_code,@eqp_code,@repair_person,@repair_date,@repair_content,@repair_part,@failure_descript,@is_shutdown,@source_wo)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_code = wxwo,
+ docu_date = DateTime.Now.ToString(),
+ status = "COMP",
+ wksp_code = model.wkshpcode,
+ eqp_code = model.eqpcode,
+ repair_person = us.usercode,
+ repair_date = DateTime.Now.ToString(),
+ repair_content = model.repaircontent,
+ repair_part = model.replaceparts,
+ failure_descript = model.faultdescr,
+ is_shutdown = model.is_stoprepair,
+ source_wo = model.docu_code
+ }
+ });
+ //鏇存柊缁翠慨鐢宠鍗曠姸鎬�
+ sql = @"update TEqp_RepairRequest set status=@status where docu_code=@docu_code and wksp_code=@wkshpcode and eqp_code=@eqpcode";
+ list.Add(new { str = sql, parm = new { docu_code = model.docu_code, wkshpcode = model.wkshpcode, eqpcode = model.eqpcode, status = "COMP" } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "璁惧缁翠慨", "缁翠慨浜嗚澶囷細" + model.eqpcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缁翠慨鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缁翠慨澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[缁翠慨楠岃瘉鍒楄〃]
+ public static ToMessage RepairVerificationScanDeviceData()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁惧缁翠慨鍒楄〃宸茬淮淇殑鏁版嵁
+ sql = @"select A.repair_code,B.code as eqpcode,B.name as eqpname,
+ T.torg_code as wksp_code,T.torg_name as wksp_name,
+ A.repair_person,A.repair_date,A.is_shutdown,
+ A.failure_descript
+ from TEqp_Repair A
+ inner join TEqpInfo B on A.eqp_code=B.code
+ inner join TOrganization T on A.wksp_code=T.torg_code
+ where A.status='COMP'";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤缁翠慨璁板綍!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缁翠慨楠岃瘉璇︽儏淇℃伅]
+ public static ToMessage RepairVerificationScanDeviceDataSub(string repair_code, string eqpcode, string wkshpcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<string, object> dict = new Dictionary<string, object>();
+ try
+ {
+ //鏍规嵁璁惧缂栫爜\杞﹂棿缂栫爜鑾峰彇缁翠慨璇︽儏
+ sql = @"select repair_code,failure_descript,is_shutdown,repair_content,repair_part
+ from TEqp_Repair
+ where repair_code=@repair_code and wksp_code=@wkshpcode and eqp_code=@eqpcode";
+ dynamicParams.Add("@repair_code", repair_code);
+ dynamicParams.Add("@wkshpcode", wkshpcode);
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ dict.Add("failure_descript", data.Rows[0]["failure_descript"].ToString()); //鏁呴殰鎻忚堪
+
+ //鑾峰彇鏁呴殰涓婁紶鍥剧墖
+ sql = @"select img1url from TEqp_RepairImage where source_wo=@source_wo and wo_type='COMP'";
+ dynamicParams.Add("@source_wo", data.Rows[0]["repair_code"].ToString());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ dict.Add("failure_descriptimg", data0); //鏁呴殰涓婁紶鍥剧墖
+ }
+ if (data.Rows[0]["is_shutdown"].ToString() == "N") //鏄惁鍋滄満缁翠慨
+ {
+ dict.Add("repair_content", data.Rows[0]["repair_content"].ToString()); //缁翠慨鍐呭
+ dict.Add("repair_part", data.Rows[0]["repair_part"].ToString()); //鏇存崲澶囦欢
+
+ //鑾峰彇鏇存崲澶囦欢涓婁紶鍥剧墖
+ sql = @"select img2url from TEqp_RepairImage where source_wo=@source_wo and wo_type='COMP'";
+ dynamicParams.Add("@source_wo", data.Rows[0]["repair_code"].ToString());
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ dict.Add("repair_partimage", data1); //鏁呴殰涓婁紶鍥剧墖
+ }
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dict;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤缁翠慨璁板綍!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缁翠慨楠岃瘉鎻愪氦]
+ public static ToMessage RepairVerificationScanDeviceSave(User us, string repairwo, string eqpcode, string wkshpcode, string result)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鏍规嵁璁惧缁翠慨鍗曟煡鎵炬簮鍗�(缁翠慨鐢宠鍗�)
+ sql = @"select source_wo from TEqp_Repair where repair_code=@repairwo";
+ dynamicParams.Add("@repairwo", repairwo);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //鏇存柊璁惧缁翠慨璁板綍楠岃瘉浜哄憳銆侀獙璇佹椂闂淬�侀獙璇佺粨鏋溿�侀獙璇佺姸鎬�
+ sql = @"update TEqp_Repair set status=@status,is_verifi=@is_verifi,verify_result=@verify_result,verify_person=@verify_person,verify_date=@verify_date
+ where repair_code=@repair_code and wksp_code=@wksp_code and eqp_code=@eqp_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ status = "CONFIR",
+ is_verifi = "Y",
+ verify_result = result,
+ verify_person = us.usercode,
+ verify_date = DateTime.Now.ToString(),
+ repair_code = repairwo,
+ wksp_code = wkshpcode,
+ eqp_code = eqpcode
+ }
+ });
+ //鏇存柊缁翠慨鐢宠鍗曠姸鎬�
+ sql = @"update TEqp_RepairRequest set status=@status where docu_code=@docu_code and wksp_code=@wkshpcode and eqp_code=@eqpcode";
+ list.Add(new { str = sql, parm = new { docu_code = data.Rows[0]["source_wo"].ToString(), wkshpcode = wkshpcode, eqpcode = eqpcode, status = "CONFIR" } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缁翠慨楠岃瘉鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缁翠慨楠岃瘉澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[璁惧鐐规璁板綍鏌ヨ]
+ public static ToMessage DeviceCheckTakeSearch(User us, string wkshopcode, string eqpcode, string eqpname, string stanedname, string checkuser, string checkopendate, string checkclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and T.torg_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code like '%'+@eqpcode+'%' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (eqpname != "" && eqpname != null)
+ {
+ search += "and E.name like '%'+@eqpname+'%' ";
+ dynamicParams.Add("@eqpname", eqpname);
+ }
+ if (stanedname != "" && stanedname != null)
+ {
+ search += "and M.name like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@stanedname", stanedname);
+ }
+ if (checkuser != "" && checkuser != null)
+ {
+ search += "and A.chk_user like '%'+@checkuser+'%' ";
+ dynamicParams.Add("@checkuser", checkuser);
+ }
+ if (checkopendate != "" && checkopendate != null)
+ {
+ search += "and A.chk_date between @checkopendate and @checkclosedate ";
+ dynamicParams.Add("@checkopendate", checkopendate + " 00:00:00");
+ dynamicParams.Add("@checkclosedate", checkclosedate + " 23:59:59");
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.djwo,T.torg_code,T.torg_name,A.eqp_code,E.name as eqp_name,M.code as stanedcode,M.name as stanedname,
+ A.chk_user,A.chk_result,A.chk_date
+ from TEqpchk_Proc_Main A
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TEqpchk_Main M on A.eqpchkmain_code=M.code
+ left join TOrganization T on E.torg_code=T.torg_code
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage DeviceCheckSubTakeSearch(string djwo)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select A.seq,T.code as itemcode,T.name as itemname,A.result,A.chk_value,A.remark
+ from TEqpchk_Proc_Deta A
+ left join TEqpchk_Item T on A.eqpchkdeta_code=T.code
+ where A.djwo=@djwo";
+ dynamicParams.Add("@djwo", djwo);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鐐规璁板綍瀵煎嚭]
+ public static ToMessage DeviceCheckTakeOutExcel(User us, string wkshopcode, string eqpcode, string eqpname, string stanedname, string checkuser, string checkopendate, string checkclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and T.torg_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code like '%'+@eqpcode+'%' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (eqpname != "" && eqpname != null)
+ {
+ search += "and E.name like '%'+@eqpname+'%' ";
+ dynamicParams.Add("@eqpname", eqpname);
+ }
+ if (stanedname != "" && stanedname != null)
+ {
+ search += "and M.name like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@stanedname", stanedname);
+ }
+ if (checkuser != "" && checkuser != null)
+ {
+ search += "and A.chk_user like '%'+@checkuser+'%' ";
+ dynamicParams.Add("@checkuser", checkuser);
+ }
+ if (checkopendate != "" && checkopendate != null)
+ {
+ search += "and A.chk_date between @checkopendate and @checkclosedate ";
+ dynamicParams.Add("@checkopendate", checkopendate + " 00:00:00");
+ dynamicParams.Add("@checkclosedate", checkclosedate + " 23:59:59");
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.eqpchkdeta_code) = 1 THEN A.djwo
+ ELSE ''END AS '鐐规鍗曞彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY E.torg_code ORDER BY B.eqpchkdeta_code) = 1 THEN T.torg_name
+ ELSE ''END AS '鐢熶骇杞﹂棿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.eqp_code ORDER BY B.eqpchkdeta_code) = 1 THEN A.eqp_code
+ ELSE ''END AS '璁惧缂栧彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.eqp_code ORDER BY B.eqpchkdeta_code) = 1 THEN E.name
+ ELSE ''END AS '璁惧鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.eqpchkmain_code ORDER BY B.eqpchkdeta_code) = 1 THEN A.eqpchkmain_code
+ ELSE ''END AS '鐐规鏍囧噯缂栫爜',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.eqpchkmain_code ORDER BY B.eqpchkdeta_code) = 1 THEN M.name
+ ELSE ''END AS '鐐规鏍囧噯鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.chk_user ORDER BY B.eqpchkdeta_code) = 1 THEN A.chk_user
+ ELSE ''END AS '妫�楠屼汉鍛�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.chk_result ORDER BY B.eqpchkdeta_code) = 1 THEN A.chk_result
+ ELSE ''END AS '妫�楠岀粨鏋�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.chk_date ORDER BY B.eqpchkdeta_code) = 1 THEN A.chk_date
+ END AS '妫�楠屾椂闂�',
+ B.seq as '鐐规閮ㄤ綅搴忓彿',H.code '鐐规閮ㄤ綅缂栫爜',H.name '鐐规閮ㄤ綅鍚嶇О',B.result '鐐规缁撴灉',B.chk_value '鏁板��',B.remark '澶囨敞'
+ from TEqpchk_Proc_Main A
+ left join TEqpchk_Proc_Deta B on A.djwo=B.djwo
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TEqpchk_Main M on A.eqpchkmain_code=M.code
+ left join TOrganization T on E.torg_code=T.torg_code
+ left join TEqpchk_Item H on B.eqpchkdeta_code=H.code
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "宸ュ簭妫�楠岃褰�");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[璁惧淇濆吇璁板綍鏌ヨ]
+ public static ToMessage DeviceCheckTakeSearch(User us, string wkshopcode, string eqpcode, string eqpname, string stanedname, string repairuser, string repairopendate, string repairclosedate, string repairresult, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and T.torg_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code like '%'+@eqpcode+'%' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (eqpname != "" && eqpname != null)
+ {
+ search += "and E.name like '%'+@eqpname+'%' ";
+ dynamicParams.Add("@eqpname", eqpname);
+ }
+ if (stanedname != "" && stanedname != null)
+ {
+ search += "and M.name like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@stanedname", stanedname);
+ }
+ if (repairuser != "" && repairuser != null)
+ {
+ search += "and A.maint_user like '%'+@repairuser+'%' ";
+ dynamicParams.Add("@repairuser", repairuser);
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and A.maint_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+ if (repairresult != "" && repairresult != null)
+ {
+ search += "and A.maint_result=@repairresult ";
+ dynamicParams.Add("@repairresult", repairresult);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.bywo,T.torg_code,T.torg_name,A.eqp_code,E.name as eqp_name,M.code as stanedcode,M.name as stanedname,A.maint_cyc,
+ A.maint_user,A.maint_result,A.maint_date
+ from TEqpmaint_Proc_Main A
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TEqpmai_Main M on A.eqpmaint_code=M.code
+ left join TOrganization T on E.torg_code=T.torg_code
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage DeviceRepairSubTakeSearch(string bywo)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select A.seq,T.code as itemcode,T.name as itemname,A.result,A.maint_value,A.remark
+ from TEqpmaint_Proc_Deta A
+ left join TEqpmai_Item T on A.eqpmaideta_code=T.code
+ where A.bywo=@bywo";
+ dynamicParams.Add("@bywo", bywo);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧淇濆吇璁板綍瀵煎嚭]
+ public static ToMessage DeviceRepairTakeOutExcel(User us, string wkshopcode, string eqpcode, string eqpname, string stanedname, string repairuser, string repairopendate, string repairclosedate, string repairresult)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and T.torg_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code like '%'+@eqpcode+'%' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (eqpname != "" && eqpname != null)
+ {
+ search += "and E.name like '%'+@eqpname+'%' ";
+ dynamicParams.Add("@eqpname", eqpname);
+ }
+ if (stanedname != "" && stanedname != null)
+ {
+ search += "and M.name like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@stanedname", stanedname);
+ }
+ if (repairuser != "" && repairuser != null)
+ {
+ search += "and A.maint_user like '%'+@repairuser+'%' ";
+ dynamicParams.Add("@repairuser", repairuser);
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and A.chk_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+ if (repairresult != "" && repairresult != null)
+ {
+ search += "and A.maint_result=@repairresult ";
+ dynamicParams.Add("@repairresult", repairresult);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.eqpmaideta_code) = 1 THEN A.bywo
+ ELSE ''END AS '淇濆吇鍗曞彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY E.torg_code ORDER BY B.eqpmaideta_code) = 1 THEN T.torg_name
+ ELSE ''END AS '鐢熶骇杞﹂棿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.eqp_code ORDER BY B.eqpmaideta_code) = 1 THEN A.eqp_code
+ ELSE ''END AS '璁惧缂栧彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.eqp_code ORDER BY B.eqpmaideta_code) = 1 THEN E.name
+ ELSE ''END AS '璁惧鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.eqpmaint_code ORDER BY B.eqpmaideta_code) = 1 THEN A.eqpmaint_code
+ ELSE ''END AS '淇濆吇鏍囧噯缂栫爜',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.eqpmaint_code ORDER BY B.eqpmaideta_code) = 1 THEN M.name
+ ELSE ''END AS '淇濆吇鏍囧噯鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.maint_cyc ORDER BY B.eqpmaideta_code) = 1 THEN A.maint_cyc
+ ELSE ''END AS '淇濆吇鍛ㄦ湡',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.maint_user ORDER BY B.eqpmaideta_code) = 1 THEN A.maint_user
+ ELSE ''END AS '淇濆吇浜哄憳',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.maint_result ORDER BY B.eqpmaideta_code) = 1 THEN A.maint_result
+ ELSE ''END AS '淇濆吇缁撴灉',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.maint_date ORDER BY B.eqpmaideta_code) = 1 THEN A.maint_date
+ END AS '淇濆吇鏃堕棿',
+ B.seq as '淇濆吇閮ㄤ綅搴忓彿',H.code '淇濆吇閮ㄤ綅缂栫爜',H.name '淇濆吇閮ㄤ綅鍚嶇О',B.result '淇濆吇缁撴灉',B.maint_value '鏁板��',B.remark '澶囨敞'
+ from TEqpmaint_Proc_Main A
+ left join TEqpmaint_Proc_Deta B on A.bywo=B.bywo
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TEqpmai_Main M on A.eqpmaint_code=M.code
+ left join TOrganization T on E.torg_code=T.torg_code
+ left join TEqpmai_Item H on B.eqpmaideta_code=H.code
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "宸ュ簭妫�楠岃褰�");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[璁惧缁翠慨璁板綍鏌ヨ]
+ public static ToMessage DeviceUpdateSearch(User us, string wkshopcode, string eqpcode, string eqpname, string reportuser, string repairuser, string vrifcatuser, string reportopendate, string reportclosedate, string repairopendate, string repairclosedate, string vrifcatopendate, string vrifcatclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wksp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code like '%'+@eqpcode+'%' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (eqpname != "" && eqpname != null)
+ {
+ search += "and E.name like '%'+@eqpname+'%' ";
+ dynamicParams.Add("@eqpname", eqpname);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and B.request_person like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (repairuser != "" && repairuser != null)
+ {
+ search += "and A.repair_person like '%'+@repairuser+'%' ";
+ dynamicParams.Add("@repairuser", repairuser);
+ }
+ if (vrifcatuser != "" && vrifcatuser != null)
+ {
+ search += "and A.verify_person like '%'+@vrifcatuser+'%' ";
+ dynamicParams.Add("@vrifcatuser", vrifcatuser);
+ }
+ if (reportopendate != "" && reportopendate != null)
+ {
+ search += "and B.request_date between @reportopendate and @reportclosedate ";
+ dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00");
+ dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59");
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and A.repair_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+ if (vrifcatopendate != "" && vrifcatopendate != null)
+ {
+ search += "and A.verify_date between @vrifcatopendate and @vrifcatclosedate ";
+ dynamicParams.Add("@vrifcatopendate", vrifcatopendate + " 00:00:00");
+ dynamicParams.Add("@vrifcatclosedate", vrifcatclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.repair_code,A.wksp_code,T.torg_name as wksp_name,A.eqp_code,E.name as eqp_name,B.request_person,B.request_date,
+ A.repair_person,A.repair_date,CAST(datediff(minute, B.request_date,A.repair_date)/60.0 AS decimal(9,1)) as cycleDate,
+ A.verify_person,A.verify_date,(case when A.verify_result='OK' then '閫氳繃' when A.verify_result='NG' then '涓嶉�氳繃' end)as verify_result
+ from TEqp_Repair A
+ left join TEqp_RepairRequest B on A.source_wo=B.docu_code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TOrganization T on A.wksp_code=T.torg_code
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧缁翠慨璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage DeviceUpdateSubSearch(string repair_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<object, object> Dict = new Dictionary<object, object>();
+ try
+ {
+ //鑾峰彇璁惧鎶ヤ慨鐢宠鏁版嵁
+ sql = @"select B.docu_code,
+ (
+ case when B.source='A' then '璁惧鐐规'
+ when B.source='B' then '璁惧淇濆吇'
+ when B.source='C' then '瀹夌伅鍛煎彨'
+ when B.source='C' then '鎵嬪伐鍒涘缓' end
+ ) as source,B.failure_descript from TEqp_Repair A
+ left join TEqp_RepairRequest B on A.source_wo=B.docu_code
+ where A.repair_code=@repair_code";
+ dynamicParams.Add("@repair_code", repair_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ DeviceReport report = new DeviceReport();
+ report.faultsource = data.Rows[0]["source"].ToString();
+ report.faultdescr = data.Rows[0]["failure_descript"].ToString();
+ //鑾峰彇璁惧鎶ヤ慨鐢宠鍥剧墖鏁版嵁
+ sql = @"select M.img1url from TEqp_Repair A
+ left join TEqp_RepairRequest B on A.source_wo=B.docu_code
+ left join TEqp_RepairImage M on B.docu_code=M.source_wo
+ where A.repair_code=@repair_code and M.wo_type='REPA'";
+ dynamicParams.Add("@repair_code", repair_code);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ report.faultimage = data0;
+ Dict.Add("data1", report);
+
+ //鑾峰彇璁惧缁翠慨鏁版嵁
+ sql = @"select A.failure_descript,A.is_shutdown,A.repair_content,A.repair_part from TEqp_Repair A
+ left join TEqp_RepairRequest B on A.source_wo=B.docu_code
+ where A.repair_code=@repair_code";
+ dynamicParams.Add("@repair_code", repair_code);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ DeviceRepair repair = new DeviceRepair();
+ repair.faultdescr = data1.Rows[0]["failure_descript"].ToString();
+ repair.isstoprepair = data1.Rows[0]["is_shutdown"].ToString();
+ repair.repaircontent = data1.Rows[0]["repair_content"].ToString();
+ repair.repairpart = data1.Rows[0]["repair_part"].ToString();
+ //鑾峰彇璁惧缁翠慨鍥剧墖鏁版嵁
+ sql = @"select M.img1url,M.img2url from TEqp_Repair A
+ left join TEqp_RepairImage M on A.repair_code=M.source_wo
+ where A.repair_code=@repair_code and M.wo_type='COMP'";
+ dynamicParams.Add("@repair_code", repair_code);
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ repair.repairimage = data3;
+ Dict.Add("data2", repair);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = Dict;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧缁翠慨璁板綍瀵煎嚭]
+ public static ToMessage DeviceUpdateOutExcel(User us, string wkshopcode, string eqpcode, string eqpname, string reportuser, string repairuser, string vrifcatuser, string reportopendate, string reportclosedate, string repairopendate, string repairclosedate, string vrifcatopendate, string vrifcatclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wksp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code like '%'+@eqpcode+'%' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (eqpname != "" && eqpname != null)
+ {
+ search += "and E.name like '%'+@eqpname+'%' ";
+ dynamicParams.Add("@eqpname", eqpname);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and B.request_person like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (repairuser != "" && repairuser != null)
+ {
+ search += "and A.repair_person like '%'+@repairuser+'%' ";
+ dynamicParams.Add("@repairuser", repairuser);
+ }
+ if (vrifcatuser != "" && vrifcatuser != null)
+ {
+ search += "and A.verify_person like '%'+@vrifcatuser+'%' ";
+ dynamicParams.Add("@vrifcatuser", vrifcatuser);
+ }
+ if (reportopendate != "" && reportopendate != null)
+ {
+ search += "and B.request_date between @reportopendate and @reportclosedate ";
+ dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00");
+ dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59");
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and A.repair_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+ if (vrifcatopendate != "" && vrifcatopendate != null)
+ {
+ search += "and A.verify_date between @vrifcatopendate and @vrifcatclosedate ";
+ dynamicParams.Add("@vrifcatopendate", vrifcatopendate + " 00:00:00");
+ dynamicParams.Add("@vrifcatclosedate", vrifcatclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select
+ A.repair_code as '缁翠慨鍗曞彿',
+ T.torg_name as '鎵�灞炶溅闂�',
+ A.eqp_code as '璁惧缂栫爜',
+ E.name as '璁惧鍚嶇О',
+ B.request_person as '鎶ヤ慨浜哄憳',
+ B.request_date as '鎶ヤ慨鏃堕棿',
+ A.repair_person as '缁翠慨浜哄憳',
+ A.repair_date as '缁翠慨鏃堕棿',
+ CAST(datediff(minute, B.request_date,A.repair_date)/60.0 AS decimal(9,1)) as '缁翠慨鏃堕暱(灏忔椂)',
+ A.verify_person as '楠岃瘉浜哄憳',
+ A.verify_date as '楠岃瘉鏃堕棿',
+ (case when A.verify_result='OK' then '閫氳繃' when A.verify_result='NG' then '涓嶉�氳繃' end)as '楠岃瘉缁撴灉'
+ from TEqp_Repair A
+ left join TEqp_RepairRequest B on A.source_wo=B.docu_code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TOrganization T on A.wksp_code=T.torg_code
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "璁惧缁翠慨璁板綍");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/ErpSyncMesDAL.cs b/VueWebCoreApi/DLL/DAL/ErpSyncMesDAL.cs
new file mode 100644
index 0000000..bb8b2f1
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/ErpSyncMesDAL.cs
@@ -0,0 +1,207 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class ErpSyncMesDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+ #region[鐗╂枡绠$悊锛氳閲忓崟浣嶅悓姝
+ public static ToMessage SaveSearchUnit(User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_ERPUnit";
+ dynamicParams.Add("@username", us.usercode);
+ bool a = DapperHelper.IsProcedure(sql, dynamicParams);
+ if (a)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍚屾璁¢噺鍗曚綅鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍚屾璁¢噺鍗曚綅澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐗╂枡绠$悊锛氬瓨璐ф。妗堝悓姝
+ public static ToMessage SaveSearchMateriel_Info(User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_ERPInventory";
+ dynamicParams.Add("@username", us.usercode);
+ bool a = DapperHelper.IsProcedure(sql, dynamicParams);
+ if (a)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍚屾瀛樿揣妗f鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍚屾瀛樿揣妗f澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鍩虹璁剧疆锛氫粨搴撳悓姝
+ public static ToMessage SaveSearchWareHouse(User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_ERPWhareHouses";
+ dynamicParams.Add("@username", us.usercode);
+ bool a = DapperHelper.IsProcedure(sql, dynamicParams);
+ if (a)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍚屾浠撳簱鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍚屾浠撳簱澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鍩虹璁剧疆锛氬線鏉ュ崟浣嶅悓姝
+ public static ToMessage SeaveSearchPartner(User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_ERPPartner";
+ dynamicParams.Add("@username", us.usercode);
+ bool a = DapperHelper.IsProcedure(sql, dynamicParams);
+ if (a)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍚屾浠撳簱鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍚屾浠撳簱澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇绠$悊锛欵RP鐢熶骇璁㈠崟鍚屾]
+ public static ToMessage SeaveSearchErpOrder(User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_ERPMO";
+ dynamicParams.Add("@username", us.usercode);
+ bool a = DapperHelper.IsProcedure(sql, dynamicParams);
+ if (a)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍚屾鐢熶骇璁㈠崟鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍚屾鐢熶骇璁㈠崟澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/ExcelCheckDAL.cs b/VueWebCoreApi/DLL/DAL/ExcelCheckDAL.cs
new file mode 100644
index 0000000..7b4a21f
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/ExcelCheckDAL.cs
@@ -0,0 +1,314 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class ExcelCheckDAL
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string savePath = "";
+
+ #region銆怑xcel瀵煎叆妯℃澘楠岃瘉銆�
+ public static ToMessage ExcelCheck(string fileCode, List<DataTable> dataTable)
+ {
+ string StuCode = "";
+ string Message = "";
+ switch (fileCode)
+ {
+ case "0": //缁勭粐鏋舵瀯
+ Message = ImportExcelData.Zerro(savePath, out StuCode);
+ break;
+ case "1"://宀椾綅绠$悊
+ Message = ImportExcelData.One(dataTable, out StuCode);
+ break;
+ case "2"://鐝粍绠$悊
+ Message = ImportExcelData.Two(dataTable, out StuCode);
+ break;
+ case "3"://浜哄憳绠$悊
+ Message = ImportExcelData.Three(dataTable, out StuCode);
+ break;
+ case "4"://瑙掕壊绠$悊
+ Message = ImportExcelData.Four(dataTable, out StuCode);
+ break;
+ case "5"://寰�鏉ュ崟浣�
+ Message = ImportExcelData.Five(dataTable, out StuCode);
+ break;
+ case "6"://浠撳簱璁剧疆
+ Message = ImportExcelData.Six(dataTable, out StuCode);
+ break;
+ case "7"://搴撲綅璁剧疆
+ Message = ImportExcelData.Seven(dataTable, out StuCode);
+ break;
+ case "8"://瀛樿揣妗f
+ Message = ImportExcelData.Eight(dataTable, out StuCode);
+ break;
+ case "9"://璁惧娓呭崟
+ Message = ImportExcelData.Nine(dataTable, out StuCode);
+ break;
+ case "10"://璁惧鐐规椤圭洰
+ Message = ImportExcelData.Ten(dataTable, out StuCode);
+ break;
+ case "10_1"://璁惧鐐规鏍囧噯
+ Message = ImportExcelData.Ten_one(dataTable, out StuCode);
+ break;
+ case "11"://璁惧淇濆吇椤圭洰
+ Message = ImportExcelData.Eleven(dataTable, out StuCode);
+ break;
+ case "11_1"://璁惧淇濆吇鏍囧噯
+ Message = ImportExcelData.Eleven_one(dataTable, out StuCode);
+ break;
+ case "12"://妯″叿娓呭崟
+ Message = ImportExcelData.Twelve(dataTable, out StuCode);
+ break;
+ case "13"://妯″叿鐐规椤圭洰
+ Message = ImportExcelData.Thirteen(dataTable, out StuCode);
+ break;
+ case "13_1"://妯″叿鐐规鏍囧噯
+ Message = ImportExcelData.Thirteen_one(dataTable, out StuCode);
+ break;
+ case "14"://妯″叿淇濆吇椤圭洰
+ Message = ImportExcelData.Fourteen(dataTable, out StuCode);
+ break;
+ case "14_1"://妯″叿淇濆吇鏍囧噯
+ Message = ImportExcelData.Fourteen_one(dataTable, out StuCode);
+ break;
+ case "15"://宸ュ簭瀹氫箟
+ Message = ImportExcelData.Fifteen(dataTable, out StuCode);
+ break;
+ case "16"://宸ヨ壓璺嚎
+ Message = ImportExcelData.Sixteen(dataTable, out StuCode);
+ break;
+ case "24"://鑺傛媿宸ヤ环
+ Message = ImportExcelData.TwentyFour(savePath, out StuCode);
+ break;
+ case "17"://璐ㄦ鏍囧噯
+ Message = ImportExcelData.Seventeen(savePath, out StuCode);
+ break;
+ case "18"://缂洪櫡瀹氫箟
+ Message = ImportExcelData.Eighteen(dataTable, out StuCode);
+ break;
+ case "19"://鐢熶骇璁㈠崟
+ Message = ImportExcelData.Nineteen(savePath, out StuCode);
+ break;
+ case "20"://搴撳瓨鏌ヨ
+ Message = ImportExcelData.Twenty(savePath, out StuCode);
+ break;
+ case "21"://鐗╂枡娓呭崟
+ Message = ImportExcelData.TwentyOne(savePath, out StuCode);
+ break;
+ default:
+ StuCode = "300";
+ Message = "妯℃澘缂栫爜閿欒锛�";
+ break;
+ }
+
+
+ mes.code = StuCode;
+ mes.message = Message;
+
+ return mes;
+ }
+ #endregion
+
+ #region銆怑xcel瀵煎叆鏁版嵁楠岃瘉銆�
+ public static List<ExcelErro> ExcelCheckData(string fileCode, List<DataTable> dataTable, out string stuCode, out string message, out int count)
+ {
+ stuCode = "";
+ message = "";
+ count = 0;
+ List<ExcelErro> list = new List<ExcelErro>();
+ switch (fileCode)
+ {
+ case "0": //缁勭粐鏋舵瀯
+ list = ImportExcelData.ZerroData(savePath, out stuCode, out message, out count);
+ break;
+ case "1": //宀椾綅绠$悊
+ list = ImportExcelData.OneData(dataTable, out stuCode, out message, out count);
+ break;
+ case "2"://鐝粍绠$悊
+ list = ImportExcelData.TwoData(dataTable, out stuCode, out message, out count);
+ break;
+ case "3"://浜哄憳绠$悊
+ list = ImportExcelData.ThreeData(dataTable, out stuCode, out message, out count);
+ break;
+ case "4"://瑙掕壊绠$悊
+ list = ImportExcelData.FourData(dataTable, out stuCode, out message, out count);
+ break;
+ case "5"://寰�鏉ュ崟浣�
+ list = ImportExcelData.FiveData(dataTable, out stuCode, out message, out count);
+ break;
+ case "6"://浠撳簱璁剧疆
+ list = ImportExcelData.SixData(dataTable, out stuCode, out message, out count);
+ break;
+ case "7"://搴撲綅璁剧疆
+ list = ImportExcelData.SevenData(dataTable, out stuCode, out message, out count);
+ break;
+ case "8"://瀛樿揣妗f
+ list = ImportExcelData.EightData(dataTable, out stuCode, out message, out count);
+ break;
+ case "9"://璁惧娓呭崟
+ list = ImportExcelData.NineData(dataTable, out stuCode, out message, out count);
+ break;
+ case "10"://璁惧鐐规椤圭洰
+ list = ImportExcelData.TenData(dataTable, out stuCode, out message, out count);
+ break;
+ case "10_1"://璁惧鐐规鏍囧噯
+ list = ImportExcelData.Ten_oneData(dataTable, out stuCode, out message, out count);
+ break;
+ case "11"://璁惧淇濆吇椤圭洰
+ list = ImportExcelData.ElevenData(dataTable, out stuCode, out message, out count);
+ break;
+ case "11_1"://璁惧淇濆吇鏍囧噯
+ list = ImportExcelData.Eleven_oneData(dataTable, out stuCode, out message, out count);
+ break;
+ case "12"://妯″叿娓呭崟
+ list = ImportExcelData.TwelveData(dataTable, out stuCode, out message, out count);
+ break;
+ case "13"://妯″叿鐐规椤圭洰
+ list = ImportExcelData.ThirteenData(dataTable, out stuCode, out message, out count);
+ break;
+ case "13_1"://妯″叿鐐规鏍囧噯
+ list = ImportExcelData.Thirteen_oneData(dataTable, out stuCode, out message, out count);
+ break;
+ case "14"://妯″叿淇濆吇椤圭洰
+ list = ImportExcelData.FourteenData(dataTable, out stuCode, out message, out count);
+ break;
+ case "14_1"://妯″叿淇濆吇鏍囧噯
+ list = ImportExcelData.FourteenData_one(dataTable, out stuCode, out message, out count);
+ break;
+ case "15"://宸ュ簭瀹氫箟
+ list = ImportExcelData.FifteenData(dataTable, out stuCode, out message, out count);
+ break;
+ case "16"://宸ヨ壓璺嚎
+ list = ImportExcelData.SixteenData(dataTable, out stuCode, out message, out count);
+ break;
+ case "24"://鑺傛媿宸ヤ环
+ list = ImportExcelData.TwentyFourData(savePath, out stuCode, out message, out count);
+ break;
+ case "17"://璐ㄦ鏍囧噯
+ list = ImportExcelData.SeventeenData(savePath, out stuCode, out message, out count);
+ break;
+ case "18"://缂洪櫡瀹氫箟
+ list = ImportExcelData.EighteenData(dataTable, out stuCode, out message, out count);
+ break;
+ case "19"://鐢熶骇璁㈠崟
+ list = ImportExcelData.NineteenData(savePath, out stuCode, out message, out count);
+ break;
+ case "20"://搴撳瓨鏌ヨ
+ list = ImportExcelData.TwentyData(savePath, out stuCode, out message, out count);
+ break;
+ case "21"://鐗╂枡娓呭崟
+ list = ImportExcelData.TwentyOneData(savePath, out stuCode, out message, out count);
+ break;
+ default:
+ break;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel瀵煎叆鏁版嵁銆�
+ public static ToMessage ExcelImportSubmit(string FileCode, List<DataTable> dataTable, User us)
+ {
+ string StuCode = "";
+ string Message = "";
+ string User = "";
+ switch (FileCode)
+ {
+ case "0": //缁勭粐鏋舵瀯
+ Message = ImportExcelData.ZerroSubmit(savePath, User, out StuCode);
+ break;
+ case "1": //宀椾綅绠$悊
+ Message = ImportExcelData.OneSubmit(dataTable, us, out StuCode);
+ break;
+ case "2"://鐝粍绠$悊
+ Message = ImportExcelData.TwoSubmit(dataTable, us, out StuCode);
+ break;
+ case "3"://浜哄憳绠$悊
+ Message = ImportExcelData.ThreeSubmit(dataTable, us, out StuCode);
+ break;
+ case "4"://瑙掕壊绠$悊
+ Message = ImportExcelData.FourSubmit(dataTable, us, out StuCode);
+ break;
+ case "5"://寰�鏉ュ崟浣�
+ Message = ImportExcelData.FiveSubmit(dataTable, us, out StuCode);
+ break;
+ case "6"://浠撳簱璁剧疆
+ Message = ImportExcelData.SixSubmit(dataTable, us, out StuCode);
+ break;
+ case "7"://搴撲綅璁剧疆
+ Message = ImportExcelData.SevenSubmit(dataTable, us, out StuCode);
+ break;
+ case "8"://瀛樿揣妗f
+ Message = ImportExcelData.EightSubmit(dataTable, us, out StuCode);
+ break;
+ case "9"://璁惧娓呭崟
+ Message = ImportExcelData.NineSubmit(dataTable, us, out StuCode);
+ break;
+ case "10"://璁惧鐐规椤圭洰
+ Message = ImportExcelData.TenSubmit(dataTable, us, out StuCode);
+ break;
+ case "10_1"://璁惧鐐规鏍囧噯
+ Message = ImportExcelData.Ten_oneSubmit(dataTable, us, out StuCode);
+ break;
+ case "11"://璁惧淇濆吇椤圭洰
+ Message = ImportExcelData.ElevenSubmit(dataTable, us, out StuCode);
+ break;
+ case "11_1"://璁惧淇濆吇鏍囧噯
+ Message = ImportExcelData.Eleven_oneSubmit(dataTable, us, out StuCode);
+ break;
+ case "12"://妯″叿娓呭崟
+ Message = ImportExcelData.TwelveSubmit(dataTable, us, out StuCode);
+ break;
+ case "13"://妯″叿鐐规椤圭洰
+ Message = ImportExcelData.ThirteenSubmit(dataTable, us, out StuCode);
+ break;
+ case "13_1"://妯″叿鐐规鏍囧噯
+ Message = ImportExcelData.Thirteen_oneSubmit(dataTable, us, out StuCode);
+ break;
+ case "14"://妯″叿淇濆吇椤圭洰
+ Message = ImportExcelData.FourteenSubmit(dataTable, us, out StuCode);
+ break;
+ case "14_1"://妯″叿淇濆吇鏍囧噯
+ Message = ImportExcelData.Fourteen_oneSubmit(dataTable, us, out StuCode);
+ break;
+ case "15"://宸ュ簭瀹氫箟
+ Message = ImportExcelData.FifteenSubmit(dataTable, us, out StuCode);
+ break;
+ case "16"://宸ヨ壓璺嚎
+ Message = ImportExcelData.SixteenSubmit(dataTable, us, out StuCode);
+ break;
+ case "24"://鑺傛媿宸ヤ环
+ Message = ImportExcelData.TwentyFourSubmit(savePath, User, out StuCode);
+ break;
+ case "17"://璐ㄦ鏍囧噯
+ Message = ImportExcelData.SeventeenSubmit(savePath, User, out StuCode);
+ break;
+ case "18"://缂洪櫡瀹氫箟
+ Message = ImportExcelData.EighteenSubmit(dataTable, us, out StuCode);
+ break;
+ case "19"://鐢熶骇璁㈠崟
+ Message = ImportExcelData.NineteenSubmit(savePath, User, out StuCode);
+ break;
+ case "20"://搴撳瓨鏌ヨ
+ Message = ImportExcelData.TwentySubmit(savePath, User, out StuCode);
+ break;
+ case "21"://鐗╂枡娓呭崟
+ Message = ImportExcelData.TwentyOneSubmit(savePath, User, out StuCode);
+ break;
+ default:
+ break;
+ }
+
+ mes.code = StuCode;
+ mes.message = Message;
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/GeneralBasicDataDAL.cs b/VueWebCoreApi/DLL/DAL/GeneralBasicDataDAL.cs
new file mode 100644
index 0000000..d117537
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/GeneralBasicDataDAL.cs
@@ -0,0 +1,697 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.UnitMaterial;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class GeneralBasicDataDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+ public static dynamic CompanyCode = AppSetting.GetAppSetting("CompanyCode");
+ public static dynamic CompanyName = AppSetting.GetAppSetting("CompanyName");
+
+
+ #region [缁勭粐鏋舵瀯鏌ユ壘]
+ public static ToMessage PrentOrganization()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ sql = @"select * from TOrganization where status='Y'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缁勭粐鏋舵瀯鍩虹璧勬枡(鏃犲叕鍙�)]
+ public static ToMessage PrentOrganizationNoCompany()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ sql = @"select * from TOrganization where status='Y' and parent_id<>'0' or leve<>'0'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [宀椾綅鍩虹璧勬枡]
+ public static ToMessage PostPermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ sql = @"select postcode,postname from TPost where status='Y'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [瑙掕壊鍩虹璧勬枡]
+ public static ToMessage RolePermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ sql = @"select rolecode,rolename from TRole where status='Y'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [鐝粍鍩虹璧勬枡]
+ public static ToMessage GroupsPermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ sql = @"select usergroupcode,usergroupname from TGroup where status='Y'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜哄憳鍩虹璧勬枡]
+ public static ToMessage PersonPermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ sql = @"select usercode,username,payrate from TUser where status='Y'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐝粍鏌ユ壘浜哄憳鍩虹璧勬枡]
+ public static ToMessage GroupsPersonPermissions(string groupcode)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select stuff((select ',' + usercode
+ from (select usercode from TUser
+ where ',' + group_code + ',' LIKE @groupcode and status='Y') as A
+ FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '') AS usercode_list";
+ dynamicParams.Add("@groupcode", "%," + groupcode + ",%");
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鎵�灞炵粍缁囨煡鎵句汉鍛樺熀纭�璧勬枡]
+ public static ToMessage TorgPersonPermissions(string torgcode)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select usercode,username,payrate from TUser where storg_code=@torgcode";
+ dynamicParams.Add("@torgcode", torgcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鎸夐挳鍩虹璧勬枡]
+ public static ToMessage ButtonData()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select buttoncode,buttonname from TButton";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犳寜閽。妗堟暟鎹�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏁版嵁鏉冮檺鍩虹璧勬枡]
+ public static ToMessage DataPermissions()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select datacode,dataname from TData";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犳暟鎹潈闄愭。妗堟暟鎹�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鍗曚綅淇℃伅鏌ヨ]
+ public static ToMessage UnitSerch(string tunittype)
+ {
+ List<Unit> list = new List<Unit>();
+ var dynamicParams = new DynamicParameters();
+ string sql = "";
+ try
+ {
+ if (tunittype == "S")
+ {
+ sql = @"select code as unitcode,name as unitname,isSingleUnit,isMainUnit,isGroup
+ from TUnit where isSingleUnit='1' and isGroup='0' and disabled='0'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ if (tunittype == "M")
+ {
+ sql = @"select code as unitcode,name as unitname from TUnitGroup";
+ var data = DapperHelper.selectdatalist<Unit>(sql);
+
+ for (int i = 0; i < data.Count; i++)
+ {
+ sql = @"select code as unitcode,name as unitname,isSingleUnit,isMainUnit,isGroup
+ from TUnit where isGroup='1' and disabled='0' and idunitgroup=@unitcode";
+ dynamicParams.Add("@unitcode", data[i].unitcode);
+ var data0 = DapperHelper.select<unitporject>(sql, dynamicParams);
+ data[i].children = data0;
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷淇℃伅鏌ヨ]
+ public static ToMessage DeviceTypeData()
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇璁惧绫诲瀷鏁版嵁
+ sql = @"select code,name from TEqpType";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧鍩虹璧勬枡]
+ public static ToMessage EqpPermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ sql = @"select code,name from TEqpInfo where enable='Y'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁惧绫诲瀷缂栫爜鏌ユ壘璁惧淇℃伅]
+ public static ToMessage EqpTypecodeSeachEqpPermissions(string eqptypecode)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select code,name from TEqpInfo where enable='Y' and eqptype_code=@eqptypecode";
+ dynamicParams.Add("@eqptypecode", eqptypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱鍩虹璧勬枡]
+ public static ToMessage WareHouse()
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇浠撳簱鏁版嵁
+ sql = @"select code,name from TSecStck";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱搴撲綅鍩虹璧勬枡]
+ public static ToMessage WareHouseLocation()
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<WareHouseLocation> list = new List<WareHouseLocation>();
+ try
+ {
+ //鑾峰彇浠撳簱鏁版嵁
+ sql = @"select code,name from TSecStck where status='0'";
+ var data = DapperHelper.selecttable(sql);
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ WareHouseLocation warhouse = new WareHouseLocation();
+ warhouse.value = data.Rows[i]["code"].ToString();
+ warhouse.text = data.Rows[i]["name"].ToString();
+ warhouse.children = new List<LocationData>();
+ //鑾峰彇搴撲綅
+ sql = @"select code,name from TSecLoca where status='0' and idwarehouse=@idwarehouse";
+ dynamicParams.Add("@idwarehouse", data.Rows[i]["code"].ToString());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ for (int j = 0; j < data0.Rows.Count; j++)
+ {
+ LocationData locat = new LocationData();
+ locat.value = data0.Rows[j]["code"].ToString();
+ locat.text = data0.Rows[j]["name"].ToString();
+ warhouse.children.Add(locat);
+ }
+ list.Add(warhouse);
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱鏌ユ壘浠撲綅淇℃伅]
+ public static ToMessage WareHouseSelectLocation(string warhousecode)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select code,name,depth from TSecLoca where status='0' and idwarehouse=@idwarehouse";
+ dynamicParams.Add("@idwarehouse", warhousecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭鍩虹璧勬枡]
+ public static ToMessage StepData()
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇浠撳簱鏁版嵁
+ sql = @"select stepcode,stepname from TStep where enable='Y'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缂洪櫡鍩虹璧勬枡]
+ public static ToMessage DefectPermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ sql = @"select code,name from TDefect";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[寰�鏉ュ崟浣嶅熀纭�璧勬枡]
+ public static ToMessage CustomerPermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select code,name from TCustomer where status='0'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀛樿揣鏍戝瀷鍩虹璧勬枡]
+ public static ToMessage InventoryTreePermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"WITH RecursiveCTE AS (
+ SELECT code, name, idparent
+ FROM TMateriel_Class
+ WHERE code in(select distinct idinventoryclass from TMateriel_Info where status='0')
+ UNION ALL
+ SELECT c.code, c.name, c.idparent
+ FROM TMateriel_Class c
+ INNER JOIN RecursiveCTE r ON c.code = r.idparent
+ )
+ SELECT distinct code, name, idparent as parentid
+ FROM RecursiveCTE CTE
+ union all
+ select partcode as code,partname as name,idinventoryclass as parentid
+ from TMateriel_Info
+ where status='0'";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿妫�楠岄」鐩笅鎷夊垪琛╙
+ public static ToMessage MouldCheckItemSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇妯″叿鐐规椤圭洰鏁版嵁
+ sql = @"select code,name,description from TMouldchk_Item";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤圭洰涓嬫媺鍒楄〃]
+ public static ToMessage MouldRepairItemSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇妯″叿淇濆吇椤圭洰鏁版嵁
+ sql = @"select code,name,description from TMouldmai_Item";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏌ヨ宸ュ崟/浜у搧鍩虹璧勬枡]
+ public static ToMessage WrkOrderDataSelect()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select P.wo_code,P.materiel_code,M.partname as materiel_name
+ from TK_Wrk_Man P
+ left join TMateriel_Info M on P.materiel_code=M.partcode";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/GridReportDAL.cs b/VueWebCoreApi/DLL/DAL/GridReportDAL.cs
new file mode 100644
index 0000000..a123fdc
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/GridReportDAL.cs
@@ -0,0 +1,63 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class GridReportDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static GridMessage gidmes = new GridMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[MES宸ュ崟鎵撳嵃]
+ public static ToMessage MesOrderPrintSearch(User us, string mesordercode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+
+ //鑾峰彇璁惧绫诲瀷鏁版嵁
+ sql = @"select A.seq,A.wo_code,M.m_po,P.partcode,P.partname,P.partspec,M.plan_qty as orderqty,@username as lm_user,@createdate as lm_date,
+ B.stepcode,B.stepname,A.plan_qty,(case when A.good_qty=0 then '' end) as good_qty,(case when A.ng_qty=0 then '' end) as ng_qty,A.wo_code+';'+B.stepcode as stepqrcode
+ from TK_Wrk_Step A
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TStep B on A.step_code=B.stepcode
+ where A.wo_code=@mesordercode ";
+ dynamicParams.Add("@username", us.username);
+ dynamicParams.Add("@createdate", DateTime.Now.ToString());
+ dynamicParams.Add("@mesordercode", mesordercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ gidmes.recordset = data;
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛锛�";
+ mes.data = gidmes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犵敓浜т换鍔℃暟鎹紒";
+ mes.data = null;
+ }
+
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/HomeIndexDAL.cs b/VueWebCoreApi/DLL/DAL/HomeIndexDAL.cs
new file mode 100644
index 0000000..e679aed
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/HomeIndexDAL.cs
@@ -0,0 +1,215 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class HomeIndexDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[棣栭〉椤堕儴鍥涗釜(鐢熶骇璁㈠崟鏁般�佺敓浜у伐鍗曟暟銆佸湪鍒跺搧鏁般�佷笉鑹搧鏁�)]
+ public static ToMessage HomeIndexTopSearch(string paydatestartdate, string paydateenddate, User us)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sql = "";
+ try
+ {
+ sql = @"h_p_HomeIndexTopGetSum";
+ dynamicParams.Add("@StartTime", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@EndTime", paydateenddate + " 23:59:59");
+ var dt = DapperHelper.selectProcedure(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = dt.Rows.Count;
+ mes.data = dt;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[棣栭〉涓棿宸ュ簭瀹屾垚杩涘害,涓嶈壇鍝佹帓琛宂
+ public static ToMessage HomeIndexCenterLeftSearch(string paydatestartdate, string paydateenddate, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ try
+ {
+ //宸ュ簭瀹屾垚杩涘害
+ sql = @"h_p_HomeIndexCenterLeftGetSum";
+ dynamicParams.Add("@StartTime", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@EndTime", paydateenddate + " 23:59:59");
+ var dt = DapperHelper.selectProcedure(sql, dynamicParams);
+ dir.Add("CenterLeft", dt);
+
+ //涓嶈壇鎺掑悕
+ sql = @"h_p_HomeIndexCenterRightGetSum";
+ dynamicParams.Add("@StartTime", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@EndTime", paydateenddate + " 23:59:59");
+ var dt1 = DapperHelper.selectProcedure(sql, dynamicParams);
+ dir.Add("CenterRight", dt1);
+
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[涓嶈壇鍝佹帓琛屾槑缁哴
+ public static ToMessage HomeIndexCenterRightSearch(string paydatestartdate, string paydateenddate, string defect_code, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ try
+ {
+ //涓嶈壇鎺掑悕鏄庣粏
+ sql = @"h_p_HomeIndexCenterRightGetSubSum";
+ dynamicParams.Add("@Defect_code", defect_code);
+ dynamicParams.Add("@StartTime", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@EndTime", paydateenddate + " 23:59:59");
+ dt = DapperHelper.selectProcedure(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dt;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[棣栭〉涓棿宸ュ簭瀹屾垚杩涘害鐗╂枡鏄庣粏]
+ public static ToMessage HomeIndexCenterLeftSubSearch(string stepcode, string type, string paydatestartdate, string paydateenddate, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt = new DataTable();
+ try
+ {
+ sql = @"h_p_HomeIndexCenterLeftLeftSubSum";
+ dynamicParams.Add("@Stepcode", stepcode);
+ dynamicParams.Add("@Stype", type);
+ dynamicParams.Add("@StartTime", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@EndTime", paydateenddate + " 23:59:59");
+ dt = DapperHelper.selectProcedure(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dt;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[棣栭〉涓笅閿�鍞俊鎭痌
+ public static ToMessage HomeIndexCenterSaOrderSearch(string type, string paydatestartdate, string paydateenddate, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt = new DataTable();
+ try
+ {
+ sql = @"h_p_HomeIndexCenterSaOrderSum";
+ dynamicParams.Add("@Stype", type);
+ dynamicParams.Add("@StartTime", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@EndTime", paydateenddate + " 23:59:59");
+ dt = DapperHelper.selectProcedure(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dt;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[棣栭〉搴曢儴搴撳瓨淇℃伅]
+ public static ToMessage HomeIndexBottomSearch(User us)
+ {
+ var dynamicParams = new DynamicParameters();
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ string sql = "";
+ try
+ {
+ //姣涘澂搴撳瓨
+ sql = @"h_p_HomeIndexBottomOneGetSum";
+ DataTable dt = DapperHelper.IsProcedureNoData(sql);
+ dir.Add("BottomOne", dt);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = dir.Count;
+ mes.data = dir;
+
+ //浜ф垚鍝佸簱瀛�
+ sql = @"h_p_HomeIndexBottomTwoGetSum";
+ DataTable dt1 = DapperHelper.IsProcedureNoData(sql);
+ dir.Add("BottomTwo", dt1);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = dir.Count;
+ mes.data = dir;
+
+
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/HourlyWageDAL.cs b/VueWebCoreApi/DLL/DAL/HourlyWageDAL.cs
new file mode 100644
index 0000000..da3e04b
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/HourlyWageDAL.cs
@@ -0,0 +1,833 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.AttendanceSetting;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class HourlyWageDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+ #region[鑰冨嫟璁剧疆鏌ヨ]
+ public static ToMessage AttendanceSettSearch(string wkshop_code, string creatuser, string paydatestartdate, string paydateenddate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshop_code != "" && wkshop_code != null)
+ {
+ search += " and S.wkshop_code=@wkshop_code ";
+ dynamicParams.Add("@wkshop_code", wkshop_code);
+ }
+ if (creatuser != "" && creatuser != null)
+ {
+ search += " and S.lm_user=@creatuser ";
+ dynamicParams.Add("@creatuser", creatuser);
+ }
+
+ if (paydatestartdate != "" && paydatestartdate != null)
+ {
+ search += " and S.lm_date between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select S.wkshop_code,T.torg_name as wkshop_name,S.workhouse,S.uphouse,S.closehouse,S.downhouse,S.workprice,overprice,U.username,S.lm_date
+ from AttendanceSettings S
+ left join TOrganization T on S.wkshop_code=T.torg_code
+ left join TUser U on S.lm_user=U.usercode where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑰冨嫟璁剧疆鏂板/缂栬緫]
+ public static ToMessage AttendanceSettAddUpdate(AttendanceSett attendancesett, string OperType, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (OperType == "Add")
+ {
+ //鍐欏叆璁℃椂宸ヨ祫璁剧疆琛�
+ sql = @"insert into AttendanceSettings(wkshop_code,workhouse,closehouse,workprice,overprice,uphouse,downhouse,lm_user,lm_date)
+ values(@wkshop_code,@workhouse,@closehouse,@workprice,@overprice,@uphouse,@downhouse,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshop_code = attendancesett.wkshop_code,
+ workhouse = attendancesett.workhouse,
+ closehouse = attendancesett.closehouse,
+ workprice = attendancesett.workprice,
+ overprice = attendancesett.overprice,
+ uphouse = attendancesett.uphouse,
+ downhouse = attendancesett.downhouse,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗚�冨嫟璁剧疆杞﹂棿涓�:" + attendancesett.wkshop_code + ",涓婄彮鏃堕棿涓�:" + attendancesett.workhouse + ",涓嬬彮鏃堕棿涓�:" + attendancesett.closehouse + "鐨勬爣鍑�", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鑰冨嫟璁剧疆鏂板缓鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鑰冨嫟璁剧疆鏂板缓澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //淇敼宸ュ崟琛�
+ sql = @"update AttendanceSettings set workhouse=@workhouse,closehouse=@closehouse,workprice=@workprice,overprice=@overprice,uphouse=@uphouse,downhouse=@downhouse,
+ lm_user=@lm_user,lm_date=@lm_date where wkshop_code=@wkshop_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshop_code = attendancesett.wkshop_code,
+ workhouse = attendancesett.workhouse,
+ closehouse = attendancesett.closehouse,
+ workprice = attendancesett.workprice,
+ overprice = attendancesett.overprice,
+ uphouse = attendancesett.uphouse,
+ downhouse = attendancesett.downhouse,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗚�冨嫟璁剧疆杞﹂棿涓�:" + attendancesett.wkshop_code + ",涓婄彮鏃堕棿涓�:" + attendancesett.workhouse + ",涓嬬彮鏃堕棿涓�:" + attendancesett.closehouse + "鐨勬爣鍑�", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鑰冨嫟璁剧疆淇敼鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鑰冨嫟璁剧疆淇敼澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑰冨嫟璁剧疆鍒犻櫎]
+ public static ToMessage AttendanceSettDelete(AttendanceSett attendancesett, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鏍¢獙褰撳墠鑰冨嫟璁剧疆鏄惁琚紩鐢�
+ sql = @"select * from Attendance where wkshop_code=@wkshop_code";
+ dynamicParams.Add("@wkshop_code", attendancesett.wkshop_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鑰冨嫟璁剧疆宸茬粡鐢熸垚鑰冨嫟璁板綍,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ //璁℃椂宸ヨ祫璁剧疆琛�
+ sql = @"delete AttendanceSettings where wkshop_code=@wkshop_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshop_code = attendancesett.wkshop_code
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ LogHelper.WriteLogData(aa.ToString());
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗚�冨嫟璁剧疆杞﹂棿涓�:" + attendancesett.wkshop_code + ",涓婄彮鏃堕棿涓�:" + attendancesett.workhouse + ",涓嬬彮鏃堕棿涓�:" + attendancesett.closehouse + "鐨勬爣鍑�", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鑰冨嫟璁剧疆鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鑰冨嫟璁剧疆鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[鑰冨嫟鎵撳崱淇℃伅鏌ヨ]
+ public static ToMessage AttendanceSearch(string usercode)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ try
+ {
+ if (usercode == "" || usercode == null)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ彿涓嶈兘涓虹┖!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ search += " and A.usercode=@usercode ";
+ dynamicParams.Add("@usercode", usercode);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var sql = @"select A.wkshop_code,T.torg_name as wkshop_name,U.username,A.createdate,S.workprice
+ from Attendance A
+ left join AttendanceSettings S on A.wkshop_code=S.wkshop_code
+ left join TOrganization T on A.wkshop_code=T.torg_code
+ left join TUser U on A.usercode=U.usercode
+ where convert(date, A.createdate) = convert(date, getdate()) " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+
+ //鑾峰彇鐢ㄦ埛淇℃伅
+ var sql0 = @"select U.usercode,U.username,U.storg_code,T.torg_name,
+ STUFF((SELECT ',' + P.postname
+ FROM TPost P
+ WHERE CHARINDEX(',' + P.postcode + ',', ',' + U.post_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS postname
+ from TUser U
+ left join TOrganization T on U.storg_code=T.torg_code
+ where U.usercode=@usercode";
+ dynamicParams.Add("@usercode", usercode);
+ var data0 = DapperHelper.selectdata(sql0, dynamicParams);
+ dir.Add("userdate", data0);
+ dir.Add("checkcrd", data);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = dir.Count;
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑰冨嫟鎵撳崱淇℃伅鎻愪氦]
+ public static ToMessage AttendanceSave(Attendance attendance)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ //鍐欏叆璁℃椂宸ヨ祫鑰冨嫟鎵撳崱琛�
+ sql = @"insert into Attendance(wkshop_code,usercode,createdate) values(@wkshop_code,@usercode,@createdate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshop_code = attendance.wkshop_code,
+ usercode = attendance.user_code,
+ createdate = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(attendance.user_code, "鎵撳崱", "鐢ㄦ埛:" + attendance.user_code + "鎵撳崱,鎵撳崱鏃堕棿涓�:" + DateTime.Now.ToString() + "", "PC");
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎵撳崱鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎵撳崱澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鑰冨嫟璁板綍鏌ヨ]
+ public static ToMessage AttendanceRecordSearch(string wkshop_code, string creatusercode, string paydatestartdate, string paydateenddate,string status, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshop_code != "" && wkshop_code != null)
+ {
+ search += " and S.wkshop_code=@wkshop_code ";
+ dynamicParams.Add("@wkshop_code", wkshop_code);
+ }
+ if (creatusercode != "" && creatusercode != null)
+ {
+ search += " and A.usercode=@creatusercode";
+ dynamicParams.Add("@creatusercode", creatusercode);
+ }
+
+ if (paydatestartdate != "" && paydatestartdate != null)
+ {
+ search += " and A.createdate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ }
+ if (status != "" && status != null)
+ {
+ search += " and A.status=@status ";
+ dynamicParams.Add("@status", status);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,S.wkshop_code,T.torg_name as wkshop_name,A.usercode,U.username,A.createdate,S.workprice,A.status
+ from Attendance A
+ left join AttendanceSettings S on A.wkshop_code=S.wkshop_code
+ left join TOrganization T on A.wkshop_code=T.torg_code
+ left join TUser U on A.usercode=U.usercode where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鏂板缂栬緫]
+ public static ToMessage AttendanceRecordAddUpdate(AttendanceRecord attendanceRecord, string operType, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (operType == "Add")
+ {
+ //鍐欏叆璁℃椂宸ヨ祫鑰冨嫟鎵撳崱琛�
+ sql = @"insert into Attendance(wkshop_code,usercode,createdate,status)
+ values(@wkshop_code,@usercode,@createdate,@status)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wkshop_code = attendanceRecord.wkshop_code,
+ usercode = attendanceRecord.creatusercode,
+ createdate = attendanceRecord.creatdate,
+ status = attendanceRecord.status
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗘墦鍗¤褰曡溅闂翠负:" + attendanceRecord.wkshop_code + ",浜哄憳涓�:" + attendanceRecord.creatusercode + ",鑰冨嫟鏃堕棿涓�:" + attendanceRecord.creatdate + "", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎵撳崱璁板綍鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎵撳崱璁板綍澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (operType == "Update")
+ {
+ //淇敼璁℃椂宸ヨ祫鑰冨嫟鎵撳崱琛�
+ sql = @"update Attendance set createdate=@createdate where wkshop_code=@wkshop_code and usercode=@usercode and id=@id";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ id= attendanceRecord.id,
+ wkshop_code = attendanceRecord.wkshop_code,
+ usercode = attendanceRecord.creatusercode,
+ createdate = attendanceRecord.creatdate
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗘墦鍗¤褰昳d涓�"+attendanceRecord.id+",杞﹂棿涓�:" + attendanceRecord.wkshop_code + ",浜哄憳涓�:" + attendanceRecord.creatusercode + ",鑰冨嫟鏃堕棿涓�:" + attendanceRecord.creatdate + "", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎵撳崱璁板綍鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎵撳崱璁板綍澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鍒犻櫎]
+ public static ToMessage AttendanceRecordDelete(AttendanceRecord attendanceRecord, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //璁℃椂宸ヨ祫鑰冨嫟鎵撳崱琛�
+ sql = @"delete Attendance where id=@id";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ id = attendanceRecord.id
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ LogHelper.WriteLogData(aa.ToString());
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗘墦鍗¤褰曡溅闂翠负:" + attendanceRecord.wkshop_code + ",浜哄憳涓�:" + attendanceRecord.creatusercode + ",鑰冨嫟鏃堕棿涓�:" + attendanceRecord.creatdate + "", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎵撳崱璁板綍鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎵撳崱璁板綍鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑰冨嫟璁板綍鏍哥畻鎻愪氦]
+ public static ToMessage AttendanceRecordSave(AttendanceSave attendanceSave, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ string paydatestartdate = ""; //寮�濮嬫椂闂�
+ string paydateenddate = ""; //缁撴潫鏃堕棿
+ try
+ {
+ if (attendanceSave.creatdate != "" && attendanceSave.creatdate != null)
+ {
+ paydatestartdate = attendanceSave.creatdate.Split('~')[0].ToString();
+ paydateenddate = attendanceSave.creatdate.Split('~')[1].ToString();
+ }
+ //瀛樺偍杩囩▼鍚�
+ DataTable dt = new DataTable();
+ sql = @"h_p_MES_HourlyWage";
+ dynamicParams.Add("@wkshop_code", attendanceSave.wkshop_code);
+ dynamicParams.Add("@usercode", attendanceSave.creatusercode);
+ dynamicParams.Add("@startdate", paydatestartdate);
+ dynamicParams.Add("@closedate", paydateenddate);
+ dynamicParams.Add("@status", attendanceSave.status);
+ bool a = DapperHelper.IsProcedure(sql, dynamicParams);
+ if (a)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "璁℃椂宸ヨ祫鏍哥畻", "鐢ㄦ埛:" + us.usercode + "杩涜鏍哥畻,鎿嶄綔鏃堕棿涓猴細" + DateTime.Now.ToString() + "", "PC");
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏍哥畻鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏍哥畻澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鏃ヨ鏃跺伐璧勬姤琛ㄦ煡璇
+ public static ToMessage DailyWageReportSearch(string wkshop_code, string creatusercode, string paydatestartdate, string paydateenddate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshop_code != "" && wkshop_code != null)
+ {
+ search += " and S.wkshop_code=@wkshop_code ";
+ dynamicParams.Add("@wkshop_code", wkshop_code);
+ }
+ if (creatusercode != "" && creatusercode != null)
+ {
+ search += " and S.usercode=@creatusercode";
+ dynamicParams.Add("@creatusercode", creatusercode);
+ }
+
+ if (paydatestartdate != "" && paydatestartdate != null)
+ {
+ search += " and S.checkindate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select S.id,S.wkshop_code,T.torg_name as wkshop_name,S.usercode,U.username,S.checkindate,S.workcount,S.workprice,
+ S.overcount,S.overprice,S.deductcount,S.deductmoney,S.timimoney
+ from AttendanceSum S
+ left join TOrganization T on S.wkshop_code=T.torg_code
+ left join TUser U on S.usercode=U.usercode where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏃ヨ鏃跺伐璧勪慨鏀规墸闄ゆ椂闀裤�佹墸闄よ柂璧刔
+ public static ToMessage DailyWageReportUpdate(DailyWageReport dailyWageReport, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //璁℃椂宸ヨ祫鏃ユ眹鎬昏〃
+ sql = @"update AttendanceSum set deductcount=@deductcount,deductmoney=@deductmoney where id=@id";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ id = dailyWageReport.id,
+ deductcount = dailyWageReport.deductcount,
+ deductmoney = dailyWageReport.deductmoney
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ LogHelper.WriteLogData(aa.ToString());
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗伐璧勬棩姹囨�昏〃,杞﹂棿涓�:"+dailyWageReport.whshop_code+",鎵撳崱浜�:"+dailyWageReport.usercode+",鎵撳崱鏃堕棿涓�:"+dailyWageReport.checkindate+",鎵i櫎鏃堕暱涓�:" + dailyWageReport.deductcount + ",鎵i櫎宸ヨ祫涓�:" + dailyWageReport.deductmoney + "鐨勫伐璧勮褰�", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "宸ヨ祫淇敼鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ヨ祫淇敼澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏃ヨ鏃跺伐璧勬姤琛ㄥ鍑篯
+ public static ToMessage DailyWageReportExcelSearch(string wkshop_code, string creatusercode, string paydatestartdate, string paydateenddate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshop_code != "" && wkshop_code != null)
+ {
+ search += " and S.wkshop_code=@wkshop_code ";
+ dynamicParams.Add("@wkshop_code", wkshop_code);
+ }
+ if (creatusercode != "" && creatusercode != null)
+ {
+ search += " and S.usercode=@creatusercode";
+ dynamicParams.Add("@creatusercode", creatusercode);
+ }
+
+ if (paydatestartdate != "" && paydatestartdate != null)
+ {
+ search += " and S.checkindate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select S.wkshop_code as 鎵�灞炶溅闂寸紪鐮�,T.torg_name as 鎵�灞炶溅闂�,S.usercode as 鎵撳崱浜哄憳缂栫爜,U.username as 鎵撳崱浜哄憳,S.checkindate as 鎵撳崱鏃ユ湡,
+ S.workcount as '涓婄彮鏃堕暱(灏忔椂)',S.workprice as '宸ヤ环(鍏�/灏忔椂)',S.overcount as '鍔犵彮鏃堕暱(灏忔椂)',S.overprice as '鍔犵彮宸ヤ环(鍏�/灏忔椂)',
+ S.deductcount as '鎵i櫎鏃堕暱(灏忔椂)',S.deductmoney as '鎵i櫎宸ヨ祫(鍏�)',S.timimoney as '璁℃椂宸ヨ祫(鍏�)',(S.timimoney-S.deductmoney) as '缁撶畻宸ヨ祫(鍏�)'
+ from AttendanceSum S
+ left join TOrganization T on S.wkshop_code=T.torg_code
+ left join TUser U on S.usercode=U.usercode where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "鏃ヨ鏃跺伐璧勬姤琛�");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鏈堣鏃跺伐璧勬姤琛ㄦ煡璇
+ public static ToMessage MonthlyWageReportSearch(string wkshop_code, string paydatestartdate, string paydateenddate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshop_code != "" && wkshop_code != null)
+ {
+ search += " and S.wkshop_code=@wkshop_code ";
+ dynamicParams.Add("@wkshop_code", wkshop_code);
+ }
+ if (paydatestartdate != "" && paydatestartdate != null)
+ {
+ search += " and S.checkindate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select T.torg_name as wkshop_name,U.username,
+ sum(S.workcount) as TotalWorkCount,
+ avg(S.workprice) as workprice,
+ sum(S.overcount) AS TotalOverCount,
+ avg(S.overprice) as overprice,
+ (sum(S.workcount) * avg(S.workprice)) AS TotalWorkValue,
+ (sum(S.overcount) * avg(S.overprice)) AS TotalOverValue,
+ sum(S.timimoney) AS TotalTimedMoney
+ from AttendanceSum S
+ left join TOrganization T on S.wkshop_code=T.torg_code
+ left join TUser U on S.usercode=U.usercode
+ where 1=1 " + search+ " group by T.torg_name,U.username";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏈堣鏃跺伐璧勬姤琛ㄥ鍑篯
+ public static ToMessage MonthlyWageReportExcelSearch(string wkshop_code, string paydatestartdate, string paydateenddate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshop_code != "" && wkshop_code != null)
+ {
+ search += " and S.wkshop_code=@wkshop_code ";
+ dynamicParams.Add("@wkshop_code", wkshop_code);
+ }
+ if (paydatestartdate != "" && paydatestartdate != null)
+ {
+ search += " and S.checkindate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select T.torg_name as '鎵�灞炶溅闂�',U.username as '鎵撳崱浜哄憳',
+ sum(S.workcount) as '鎬诲伐浣滄椂闀�(灏忔椂)',
+ avg(S.workprice) as '姣忓皬鏃跺崟浠�(鍏�)',
+ sum(S.overcount) as '鎬诲姞鐝椂闀�(灏忔椂)',
+ avg(S.overprice) as '鍔犵彮姣忓皬鏃跺崟浠�(鍏�)',
+ (sum(S.workcount) * avg(S.workprice)) as '鎬诲伐浣滃伐璧�(鍏�)',
+ (sum(S.overcount) * avg(S.overprice)) as '鎬诲姞鐝伐璧�(鍏�)',
+ sum(S.timimoney) AS '鎬昏鏃跺伐璧�(鍏�)'
+ from AttendanceSum S
+ left join TOrganization T on S.wkshop_code=T.torg_code
+ left join TUser U on S.usercode=U.usercode
+ where 1=1 " + search + " group by T.torg_name,U.username";
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "鏈堣鏃跺伐璧勬姤琛�");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/KanBanManagerentDAL.cs b/VueWebCoreApi/DLL/DAL/KanBanManagerentDAL.cs
new file mode 100644
index 0000000..6661bbf
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/KanBanManagerentDAL.cs
@@ -0,0 +1,429 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class KanBanManagerentDAL
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓婄敓浜т俊鎭痌
+ public static ToMessage WorkShopProduceTopData(string wkshopcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ sql = @"select * from h_v_JLKanBan_WorkshopTop where wkshp_code in @wkshoplist";
+ dynamicParams.Add("@wkshoplist", wkshoplist);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓嬪乏杩戜竴鍛ㄤ笉鑹秼鍔縘
+ public static ToMessage WorkShopProduceBottomLeftData(string wkshopcode)
+ {
+ string sql = "";
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�(褰撳墠鏃堕棿寰�鍓嶄竴鍛�)
+ string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ sql = @"h_p_JLKanBan_WorkshopBottomLeft";
+ for (int i = 0; i < wkshoplist.Length; i++)
+ {
+ var dynamicParams = new DynamicParameters();
+ dynamicParams.Add("@wkshop_code", wkshoplist[i].ToString());
+ var dt = DapperHelper.selectProcedure(sql, dynamicParams);
+ dir.Add(wkshoplist[i].ToString(), dt);
+ }
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鍢夐┌杞﹂棿鐪嬫澘,涓嬪彸杩戜竴鏈堜笉鑹粺璁
+ public static ToMessage WorkShopProduceBottomRightData(string wkshopcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ sql = @"select * from h_v_JLKanBan_WorkshopBottomRight where wkshp_code in @wkshoplist";
+ dynamicParams.Add("@wkshoplist", wkshoplist);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,宸︿笂鐢熶骇璁㈠崟]
+ public static ToMessage WorkShopCompreLeftTop(string wkshopcode)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ Dictionary<object, object> dir0 = new Dictionary<object, object>();
+ Dictionary<object, object> dir1 = new Dictionary<object, object>();
+ try
+ {
+ string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftTop";
+ var data = DapperHelper.selecttable(sql);
+ //sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftCenter";
+ //var data1 = DapperHelper.selecttable(sql);
+ for (int i = 0; i < wkshoplist.Length; i++)
+ {
+ var top0 = data.AsEnumerable()
+ .Where(row => row.Field<string>("wkshp_code") == wkshoplist[i].ToString()) // 娣诲姞鏌ヨ鏉′欢
+ .Select(group => new
+ {
+ wkshp_code = group.Field<string>("wkshp_code"),
+ plan_qty = group.Field<decimal>("plan_qty"),
+ good_qty = group.Field<decimal>("good_qty")
+ }).DefaultIfEmpty(new { wkshp_code = wkshoplist[i].ToString(), plan_qty = 0m, good_qty = 0m })//涓虹┖鏃舵寚瀹氶粯璁ゅ��
+ .ToList();
+ dir0.Add(wkshoplist[i].ToString(), top0);
+
+ //var top1 = data1.AsEnumerable()
+ // .Where(row => row.Field<string>("wkshp_code") == wkshoplist[i].ToString()) // 娣诲姞鏌ヨ鏉′欢
+ // .Select(group => new
+ // {
+ // wkshp_code = group.Field<string>("wkshp_code"),
+ // plan_qty = group.Field<decimal>("plan_qty"),
+ // quantity = group.Field<decimal>("quantity")
+ // }).DefaultIfEmpty(new { wkshp_code = wkshoplist[i].ToString(), plan_qty = 0m, quantity = 0m })//涓虹┖鏃舵寚瀹氶粯璁ゅ��
+ // .ToList();
+ //dir1.Add(wkshoplist[i].ToString(), top1);
+ }
+ dir.Add("LeftTop", dir0);
+ //dir.Add("LeftBottom", dir1);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,鍙充笂閿�鍞鍗昡
+ public static ToMessage WorkShopCompreRightTop()
+ {
+ var sql = "";
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ try
+ {
+ sql = @"select * from h_v_JLKanBan_WorkShopCompreRightTop";
+ var data = DapperHelper.selecttable(sql);
+ sql = @"select * from h_v_JLKanBan_WorkShopCompreRightCenter";
+ var data1 = DapperHelper.selecttable(sql);
+ dir.Add("RightTop", data);
+ dir.Add("RightBottom", data1);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,宸︿笅閲囪喘璁㈠崟]
+ public static ToMessage WorkShopCompreLeftBottom()
+ {
+ var sql = "";
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ try
+ {
+ sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftBottom_Top";
+ var data = DapperHelper.selecttable(sql);
+ sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftBottom_Bottom";
+ var data1 = DapperHelper.selecttable(sql);
+ dir.Add("BottomLeftTop", data);
+ dir.Add("BottomLeftBottom", data1);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[杞﹂棿缁煎悎鐪嬫澘,鍙充笅搴撳瓨]
+ public static ToMessage WorkShopCompreRightBottom()
+ {
+ var sql = "";
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ try
+ {
+ sql = @"select * from h_v_JLKanBan_WorkShopCompreRightBottom";
+ var data = DapperHelper.selecttable(sql);
+ dir.Add("Y", data.Rows[0]["BaseQuantity"].ToString());
+ dir.Add("B", data.Rows[1]["BaseQuantity"].ToString());
+ dir.Add("C", data.Rows[2]["BaseQuantity"].ToString());
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[浠撳簱鐪嬫澘,宸︿笂浜у搧寰呭叆搴撳垪琛╙
+ public static ToMessage WareHouseTopLeftData()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇浠撳簱鐢熶骇鍔犲伐鍗曞緟鍏ュ簱鍒楄〃
+ sql = @"select * from h_v_JLKanBan_WareHouseTopLeft order by voucherdate";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,宸︿笅濮斿寰呭叆搴撳垪琛╙
+ public static ToMessage WareHouseTopBottomData()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇浠撳簱鐢熶骇鍔犲伐鍗曞緟鍏ュ簱鍒楄〃
+ sql = @"select * from h_v_JLKanBan_WareHouseTopBottom order by voucherdate";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,鍙充笂鎴愬搧搴撱�佸崐鎴愬搧搴搕op5搴撳瓨鎺掕]
+ public static ToMessage WareHouseRightTopData()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select * from h_v_JLKanBan_WareHouseRightTop";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浠撳簱鐪嬫澘,鍙充笅鍘熸枡搴撳簱top5搴撳瓨鎺掕]
+ public static ToMessage WareHouseRightBottomData()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select * from h_v_JLKanBan_WareHouseRightBottom";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[鍢夐┌浠撳簱鐪嬫澘宸︿笂,閲囪喘寰呭叆搴揮
+ public static ToMessage ProcureOutsourcLeftTop()
+ {
+ var sql = "";
+ try
+ {
+ sql = @"select * from h_v_JCKanBan_ProcureNotReceived";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘宸︿笅,浜у搧浠e彂璐
+ public static ToMessage ProductConsignmentLeftBottom()
+ {
+ var sql = "";
+ try
+ {
+ sql = @"select * from h_v_JCKanBan_ProductionNotDeliver";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘鍙充笂,杩戜竴鍛ㄩ噰璐緟鍏ュ簱鐗╂枡鎺掕TOP5]
+ public static ToMessage ProcureOutsourcRightTop()
+ {
+ var sql = "";
+ try
+ {
+ sql = @"select * from h_v_JCKanBan_ProcureNotReceivedSumTop";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鍢夐┌浠撳簱鐪嬫澘鍙充笅,杩戜竴鍛ㄩ攢鍞緟鍙戣揣浜у搧鎺掕TOP5]
+ public static ToMessage ProductionStockedInRightBottom()
+ {
+ var sql = "";
+ try
+ {
+ sql = @"select * from h_v_JCKanBan_ProductionNotDeliverSumTop";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/LoginDAL.cs b/VueWebCoreApi/DLL/DAL/LoginDAL.cs
new file mode 100644
index 0000000..c6127db
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/LoginDAL.cs
@@ -0,0 +1,546 @@
+锘縰sing Dapper;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.RolePermission;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class LoginDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+ public static string fileip = AppSetting.GetAppSetting("FileIP");
+ //鑾峰彇浼佷笟閰嶇疆Enterprise
+ private static readonly string Enterprise = AppSetting.GetAppSetting("Enterprise");
+
+ #region [鐧诲綍鏌ヨ]
+ public static ToMessage LoginSearch(string usercode, string password)
+ {
+ string strProcName = ""; //瀹氫箟灞�閮╯ql鍙橀噺
+ List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍙傛暟闆嗗悎
+ List<DataTable> datalist = new List<DataTable>();
+ try
+ {
+ //鏌ヨ璐﹀彿鏄惁瀛樺湪
+ strProcName = @"select U.id,U.usercode,U.username,U.password,U.storg_code,T.torg_name as storg_name,U.role_code,U.role_datapermissions,U.post_code,U.is_system_admin,U.status
+ from TUser U
+ left join TOrganization T on U.storg_code=T.torg_code
+ where usercode =@usercode and password=@password";
+ //鍒涘缓鍙傛暟
+ listStr.Add(new SqlParameter("@usercode", usercode));
+ listStr.Add(new SqlParameter("@password", password));
+ parameters = listStr.ToArray();
+ listStr.Clear();
+ DataTable dt_ = DBHelper.GetTable(strProcName, parameters);
+
+ datalist.Add(dt_);
+ //鏌ヨ绯荤粺娴佺▼閰嶇疆
+ strProcName = @"select json from TSystemProcConfig";
+ DataTable dt0_ = DBHelper.GetTable(strProcName);
+ datalist.Add(dt0_);
+
+ if (dt_.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.message = "璐﹀彿瀵嗙爜涓嶆纭�!";
+ mes.data = null;
+ return mes;
+ }
+ if (dt_.Rows[0]["status"].ToString() == "N")
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璐﹀彿宸插仠鐢�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇璐﹀彿鏄惁绯荤粺绠$悊鍛樿处鍙�
+ if (dt_.Rows[0]["is_system_admin"].ToString() == "Y")
+ {
+ mes.code = "200";
+ mes.data = datalist;
+ return mes;
+ }
+ //鎵цsql鏌ヨ鐢ㄦ埛鏄惁鎸囧畾缁勭粐
+ if (dt_.Rows[0]["storg_code"].ToString() == "" || dt_.Rows[0]["storg_code"].ToString() == null)
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠鐢ㄦ埛鏈寚瀹氱粍缁�!";
+ mes.data = null;
+ return mes;
+ }
+ //鎵цsql鏌ヨ鐢ㄦ埛鏄惁鎸囧畾宀椾綅
+ if (dt_.Rows[0]["post_code"].ToString() == "" || dt_.Rows[0]["post_code"].ToString() == null)
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠鐢ㄦ埛鏈寚瀹氬矖浣�!";
+ mes.data = null;
+ return mes;
+ }
+ //鎵цsql鏌ヨ鐢ㄦ埛鏄惁鎸囧畾瑙掕壊
+ if (dt_.Rows[0]["role_code"].ToString() == "" || dt_.Rows[0]["role_code"].ToString() == null)
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠鐢ㄦ埛鏈寚瀹氳鑹�!";
+ mes.data = null;
+ return mes;
+ }
+ mes.code = "200";
+ mes.data = datalist;
+ return mes;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ #endregion
+
+ #region [鍐欏叆鐧诲綍璁板綍琛╙
+ public static ToMessage LoginBas(string usercode, string oper_type, string description, string type)
+ {
+ var sql = "";
+ var cont = 0;
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"insert into T_Bas_User_Operlog(usercode,oper_date,oper_type,description,origin)
+ values(@usercode,@oper_date,@oper_type,@description,@origin)";
+ dynamicParams.Add("@usercode", usercode);
+ dynamicParams.Add("@oper_date", DateTime.Now.ToString());
+ dynamicParams.Add("@oper_type", oper_type);
+ dynamicParams.Add("@description", description);
+ dynamicParams.Add("@origin", type);
+ cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "璁板綍鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁板綍澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏌ヨ鑿滃崟鍔熻兘]
+ public static ToMessage LoginMenu(string usercode, string usertype, User us)
+ {
+ string sql = ""; string strProcName = ""; string result = ""; //瀹氫箟灞�閮╯ql鍙橀噺
+ var dynamicParams = new DynamicParameters();
+ List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍙傛暟闆嗗悎
+ try
+ {
+ listStr.Clear();
+ //鏌ヨ鎵�鏈夌殑缁勭粐鏁版嵁
+ sql = @"select * from TOrganization where status='Y' and parent_id<>'0'";
+ var dattorg = DapperHelper.selecttable(sql);
+ if (us.is_system_admin == "Y") //绠$悊鍛樿处鍙�
+ {
+ //鑾峰彇鏉冮檺鍏宠仈琛ㄦ暟鎹�(绠$悊鍛樿处鍙�)
+ sql = @"select jsondate from TRole TR
+ inner join TAuthority TA on TR.rolecode=TA.rolecode
+ where TR.identifying='0' and TA.type=@usertype";
+ dynamicParams.Add("@usertype", usertype);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ List<MenuItem> items = JsonConvert.DeserializeObject<List<MenuItem>>(data.Rows[0]["jsondate"].ToString());
+ // 鑾峰彇鎵�鏈夌殑menucode
+ List<string> menuCodes = items.Select(item => item.MenuCode).ToList();
+ string codeString = string.Join(",", menuCodes);
+ //鏌ヨ鑿滃崟鏁版嵁
+ sql = @"select menucode,menuname,menu_seq,imgurl,'0' as flag,parent_id,is_show
+ from TMenu where is_show='Y' and Type=@usertype order by menu_seq";
+ dynamicParams.Add("@usertype", usertype);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ string[] codes = codeString.Split(',');
+ // 浣跨敤lambda琛ㄨ揪寮忔煡璇㈠搴旂埗绾х紪鐮佺殑鐖剁骇鑿滃崟鏁版嵁娣诲姞鍒癓ist
+ List<TreeOne> parentMenus = data0.AsEnumerable()
+ .Where(row => codes.Contains(row.Field<string>("menucode")))
+ .Select(row => row.Field<string>("parent_id"))
+ .Distinct()
+ .Select(parentMenuCode => data0.AsEnumerable()
+ .FirstOrDefault(row => row.Field<string>("menucode") == parentMenuCode))
+ .Where(row => row != null).Select(row => new TreeOne
+ {
+ code = row.Field<string>("menucode"),
+ name = row.Field<string>("menuname"),
+ seq= row.Field<int>("menu_seq"),
+ flag = "0",
+ imgurl = fileip + row.Field<string>("imgurl"),
+ is_show= row.Field<string>("is_show")
+ }).ToList(); //.CopyToDataTable();
+ //娣诲姞瀛愯彍鍗曟暟鎹�
+ for (int i = 0; i < parentMenus.Count; i++)
+ {
+ parentMenus[i].children = data0.AsEnumerable().Where(row => codes.Contains(row.Field<string>("menucode")) && row.Field<string>("parent_id") == parentMenus[i].code)
+ .Select(row => new TreeTwo
+ {
+ code = row.Field<string>("menucode"),
+ name = row.Field<string>("menuname"),
+ seq= row.Field<int>("menu_seq"),
+ flag = "0",
+ imgurl = fileip + row.Field<string>("imgurl"),
+ buttoncode = items.Where(m => m.MenuCode == row.Field<string>("menucode")).Select(m => m.ButtonCode).FirstOrDefault(),
+ datacode = items.Where(m => m.MenuCode == row.Field<string>("menucode")).Select(m => m.DataCode).FirstOrDefault(),
+ is_show = row.Field<string>("is_show")
+ }).ToList();
+
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = parentMenus;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "绯荤粺鏈缃彍鍗曡祫鏂�,璇疯仈绯荤鐞嗗憳!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璐﹀彿瀵瑰簲瑙掕壊鏈缃姛鑳芥潈闄�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ string[] rolecode = Array.ConvertAll<string, string>(us.role_code.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ //鑾峰彇褰撳墠鐢ㄦ埛鎵�灞炲矖浣嶅搴旂殑瑙掕壊鍏宠仈琛ㄦ暟鎹�
+ sql = @"select TD.jsondate from TRole R
+ inner join TAuthority TD on R.rolecode=TD.rolecode
+ where R.rolecode in @rolecode
+ and TD.type=@usertype";
+ dynamicParams.Add("@rolecode", rolecode);
+ dynamicParams.Add("@usertype", usertype);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ List<MenuItem> item = new List<MenuItem>();
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ var aa = JsonConvert.DeserializeObject<List<MenuItem>>(data.Rows[i]["jsondate"].ToString());
+ for (int j = 0; j < aa.Count; j++)
+ {
+ item.Add(aa[j]);
+ }
+ }
+ // 鍙栧苟闆�
+ var items = item.GroupBy(m => m.MenuCode).Select(g => new MenuItem
+ {
+ MenuCode = g.Key,
+ ButtonCode = string.Join(",", string.Join(",", g.Select(m => m.ButtonCode)).Split(',').Distinct()),
+ DataCode = string.Join(",", string.Join(",", g.Select(m => m.DataCode=="LEVEL"?us.storg_code:m.DataCode == "PERSON"?us.usercode:m.DataCode)).Split(',')
+ .Distinct().Contains("ALL") ? "ALL": string.Join(",", string.Join(",", g.Select(m => m.DataCode == "LEVEL" ? us.storg_code : m.DataCode == "PERSON" ? us.usercode : m.DataCode)).Split(',').Distinct()))
+ //DataCode = string.Join(",", string.Join(",", g.Select(m => m.DataCode)).Split(',').Distinct().Contains("ALL") ? "ALL" : (string.Join(",", string.Join(",", g.Select(m => m.DataCode)).Split(',').Distinct().Contains("DEPT") ? "DEPT" : (string.Join(",", string.Join(",", g.Select(m => m.DataCode)).Split(',').Distinct().Contains("PERSON") ? "PERSON" : "")))))
+ }).ToList();
+
+ // 鑾峰彇鎵�鏈夌殑menucode
+ List<string> menuCodes = items.Select(item => item.MenuCode).ToList();
+ string codeString = string.Join(",", menuCodes);
+ //鏌ヨ鑿滃崟鏁版嵁
+ sql = @"select menucode,menuname,menu_seq,imgurl,'0' as flag,parent_id,is_show
+ from TMenu where is_show='Y' and Type=@usertype order by CAST(menu_seq as int) ASC";
+ dynamicParams.Add("@usertype", usertype);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ string[] codes = codeString.Split(',');
+ // 浣跨敤lambda琛ㄨ揪寮忔煡璇㈠搴旂埗绾х紪鐮佺殑鐖剁骇鑿滃崟鏁版嵁娣诲姞鍒癓ist
+ List<TreeOne> parentMenus = data0.AsEnumerable()
+ .Where(row => codes.Contains(row.Field<string>("menucode")))
+ .Select(row => row.Field<string>("parent_id"))
+ .Distinct()
+ .Select(parentMenuCode => data0.AsEnumerable()
+ .FirstOrDefault(row => row.Field<string>("menucode") == parentMenuCode))
+ .Where(row => row != null).Select(row => new TreeOne
+ {
+ code = row.Field<string>("menucode"),
+ name = row.Field<string>("menuname"),
+ seq= row.Field<int>("menu_seq"),
+ flag = "0",
+ imgurl = fileip + row.Field<string>("imgurl"),
+ is_show = row.Field<string>("is_show")
+ }).ToList(); //.CopyToDataTable();
+ //娣诲姞瀛愯彍鍗曟暟鎹�
+ for (int i = 0; i < parentMenus.Count; i++)
+ {
+ parentMenus[i].children = data0.AsEnumerable().Where(row => codes.Contains(row.Field<string>("menucode")) && row.Field<string>("parent_id") == parentMenus[i].code)
+ .Select(row => new TreeTwo
+ {
+ code = row.Field<string>("menucode"),
+ name = row.Field<string>("menuname"),
+ seq = row.Field<int>("menu_seq"),
+ flag = "0",
+ imgurl = fileip + row.Field<string>("imgurl"),
+ buttoncode = items.Where(m => m.MenuCode == row.Field<string>("menucode")).Select(m => m.ButtonCode).FirstOrDefault(),
+ datacode = items.Where(m => m.MenuCode == row.Field<string>("menucode")).Select(m => m.DataCode).FirstOrDefault(),
+ is_show = row.Field<string>("is_show")
+ }).ToList();
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = parentMenus;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "绯荤粺鏈缃彍鍗曡祫鏂�,璇疯仈绯荤鐞嗗憳!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠璐﹀彿瀵瑰簲瑙掕壊鏈缃姛鑳芥潈闄�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[淇敼瀵嗙爜]
+ public static ToMessage UpdateUserPassword(User us, string password, string newpassword)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+
+ sql = @"select * from [dbo].[TUser] where usercode=@usercode and password=@password";
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@password", password);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "杈撳叆鐨勫瘑鐮佷笉姝g‘,璇烽噸鏂拌緭鍏ワ紒";
+ mes.data = null;
+ }
+ else
+ {
+ //淇敼瀵嗙爜
+ sql = @"update [dbo].[TUser] set password=@newpassword where usercode=@usercode and password=@password";
+ list.Add(new { str = sql, parm = new { usercode = us.usercode, password = password, newpassword = newpassword } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鏃ュ織
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗瘑鐮�", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼瀵嗙爜鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼瀵嗙爜澶辫触!";
+ mes.data = null;
+ }
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐧诲嚭]
+ public static ToMessage LoginOut(User us)
+ {
+ RedisCommon redis = new RedisCommon();
+ try
+ {
+ //鍒犻櫎redis
+ redis.KeyDelete(Enterprise + "LoginUserID" + us.usertype + us.usercode);
+ //鍐欏叆鏃ュ織
+ LogHelper.DbOperateLog(us.usercode, "閫�鍑�", "閫�鍑轰簡绯荤粺", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鐧诲嚭鎴愬姛!";
+ mes.data = null;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀵嗙爜閲嶇疆]
+ public static ToMessage ResettUserPassword(User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+
+ //閲嶇疆瀵嗙爜
+ sql = @"update [dbo].[TUser] set password=@newpassword where usercode=@usercode and username=@username";
+ list.Add(new { str = sql, parm = new { usercode = us.usercode, username = us.username, newpassword = "123456" } });
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "閲嶇疆", "閲嶇疆浜嗗瘑鐮�", us.usertype);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "閲嶇疆瀵嗙爜鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "閲嶇疆瀵嗙爜澶辫触!";
+ mes.data = null;
+ }
+
+ return mes;
+ }
+ #endregion
+
+ #region[App鐧诲綍鏌ヨ瀹夌伅鍛煎彨淇℃伅]
+ public static ToMessage LoginAppAnDonMessage(string rid, string usercode, string username, string usertype, string stu_torgcode, string stu_torgtypecode)
+ {
+ var sql = "";
+ string search = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ switch (stu_torgtypecode)
+ {
+ case "":
+ search += "and T.description=@description ";
+ dynamicParams.Add("@description", "W");
+ break;
+ case "D":
+ search += "and child.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and T.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ sql = @"select B.eqp_code,E.name as eqp_name,B.wkshp_code,T.org_name as wkshp_name,
+ A.type as typecode,D.name as typename,B.start_user,B.start_date
+ from TAnDnMessagePush A
+ inner join TAnDon_Task_Info B on A.m_id=B.id
+ left join TEqpInfo E on B.eqp_code=E.code
+ left join TOrganization T on B.wkshp_code=T.org_code
+ left join TAnDonType D on A.type=d.code
+ left join TUser U on A.resp_user=U.usercode
+ left join TOrganization as child on T.parent_id=child.id
+ where A.resp_user=@usercode and B.status='START' and U.rid=@rid " + search;
+ dynamicParams.Add("@usercode", usercode);
+ dynamicParams.Add("@rid", rid);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[App鐗堟湰鍗囩骇鎺ュ彛]
+ public static ToMessage AppUpgrade()
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鏌ヨ鎺у埗鍗囩骇琛ㄧ増鏈暟鎹�
+ sql = @"select * from TSystemApp";
+ var data1 = DapperHelper.selecttable(sql);
+ AppVersion vn = new AppVersion();
+ vn.path = data1.Rows[0]["path"].ToString();
+ vn.version = data1.Rows[0]["version"].ToString();
+ vn.dispyversion = "";
+ vn.activeversion = data1.Rows[0]["activeversion"].ToString();
+ vn.mustupgrade = data1.Rows[0]["mustupgrade"].ToString();
+ list.Add(vn);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/MouldManagerDAL.cs b/VueWebCoreApi/DLL/DAL/MouldManagerDAL.cs
new file mode 100644
index 0000000..769a0b6
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/MouldManagerDAL.cs
@@ -0,0 +1,4548 @@
+锘縰sing Dapper;
+using Microsoft.AspNetCore.Http;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.MouldSearch;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class MouldManagerDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+ #region[妯″叿娓呭崟鍒楄〃鏌ヨ]
+ public static ToMessage MouldMangerSearch(string mouldstaus, string onstate, string mouldcode, string mouldname, string mouldspec, string createuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldstaus != "" && mouldstaus != null)
+ {
+ search += "and A.status=@mouldstaus ";
+ dynamicParams.Add("@mouldstaus", mouldstaus);
+ }
+ if (onstate != "" && onstate != null)
+ {
+ search += "and A.usestatus=@onstate ";
+ dynamicParams.Add("@onstate", onstate);
+ }
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and A.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and A.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (createuser != "" && createuser != null)
+ {
+ search += "and U.username like '%'+@createuser+'%' ";
+ dynamicParams.Add("@createuser", createuser);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and A.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.status,A.usestatus,A.code,A.name,A.spec,A.warehousecode,S.name as warehousename,A.location_code,L.name as location_name,
+ A.surp_life,(select isnull(sum(usecount_life),0) from TMould_UpDownReord R where R.mould_code=A.code) as serlife,
+ A.resi_life,(case when isnull(M.mouldcode,'')='' then 'N' else 'Y' end) as is_part,
+ STUFF((SELECT ',' + B.partcode
+ from TMouldInfoPart B
+ where A.code = B.mouldcode
+ FOR XML PATH('')), 1, 1, '') AS partcode,
+ A.lm_user as usercode,U.username,A.lm_date
+ from TMouldInfo A
+ left join TSecStck S on A.warehousecode=S.code
+ left join TSecLoca L on A.location_code=L.code
+ left join (
+ select distinct mouldcode from TMouldInfoPart
+ ) M on A.code=M.mouldcode
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鏂板缂栬緫]
+ public static ToMessage AddUpdateMouldManger(string mouldcode, string mouldname, string mouldspec,string warehousecode,string location_code, string surplife, string resilife, string status, string mouldpart, string opertype, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (opertype == "Add")
+ {
+ //鍐欏叆妯″叿娓呭崟琛�
+ sql = @"insert into TMouldInfo(code,name,spec,status,surp_life,resi_life,lm_user,lm_date,warehousecode,location_code)
+ values(@code,@name,@spec,@status,@surp_life,@resi_life,@lm_user,@lm_date,@warehousecode,@location_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = mouldcode,
+ name = mouldname,
+ spec = mouldspec,
+ status = status,
+ surp_life = surplife,
+ resi_life = resilife,
+ warehousecode=warehousecode,
+ location_code=location_code,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //鍐欏叆妯″叿鍏宠仈浜у搧琛�
+ List<string> mouldParts = JsonConvert.DeserializeObject<List<string>>(mouldpart);
+ for (int i = 0; i < mouldParts.Count; i++)
+ {
+ sql = @"insert into TMouldInfoPart(mouldcode,partcode,lm_user,lm_date)
+ values(@mouldcode,@partcode,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mouldcode = mouldcode,
+ partcode = mouldParts[i].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ //淇敼妯″叿娓呭崟琛�
+ sql = @"update TMouldInfo set name=@name,spec=@spec,status=@status,
+ surp_life=@surp_life,resi_life=@resi_life,lm_user=@lm_user,lm_date=@lm_date,warehousecode=@warehousecode,location_code=@location_code where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = mouldcode,
+ name = mouldname,
+ spec = mouldspec,
+ status = status,
+ surp_life = surplife,
+ resi_life = resilife,
+ warehousecode = warehousecode,
+ location_code = location_code,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //鍒犻櫎妯″叿鍏宠仈浜у搧琛�
+ sql = @"delete from TMouldInfoPart where mouldcode=@mouldcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mouldcode = mouldcode
+ }
+ });
+ //鍐欏叆妯″叿鍏宠仈浜у搧琛�
+ List<string> mouldParts = JsonConvert.DeserializeObject<List<string>>(mouldpart);
+ for (int i = 0; i < mouldParts.Count; i++)
+ {
+ sql = @"insert into TMouldInfoPart(mouldcode,partcode,lm_user,lm_date)
+ values(@mouldcode,@partcode,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mouldcode = mouldcode,
+ partcode = mouldParts[i].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鏌ョ湅灞ュ巻]
+ public static ToMessage MoldResumeSearch(string mouldcode, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ dynamicParams.Add("@mouldcode", mouldcode);
+ if (opendate != "" && opendate != null)
+ {
+ search += "and AA.operdate between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select top 100 percent AA.*,U.username as operusername from (
+ select '鐐规' as opertype,chk_user as operuser,chk_date as operdate,chk_result as operresult
+ from TMouldchk_Proc_Main where mould_code=@mouldcode
+ union all
+ select '淇濆吇' as opertype,maint_user as operuser,maint_date as operdate,maint_result as operresult
+ from TMouldmaint_Proc_Main where mould_code=@mouldcode
+ union all
+ select '寰呯淮淇�' as opertype,request_person as operuser,request_date as operdate,'缁翠慨鐢宠' as operresult
+ from TMould_RepairRequest where mould_code=@mouldcode
+ union all
+ select '宸茬淮淇�' as opertype,repair_person as operuser,repair_date as operdate,'缁翠慨瀹屾垚' as operresult
+ from TMould_RepairRequest A
+ inner join TMould_Repair B on A.docu_code=B.source_wo
+ where A.mould_code=@mouldcode and B.repair_person<>''
+ union all
+ select '宸查獙璇�' as opertype,verify_person as operuser,verify_date as operdate,B.verify_result as operresult
+ from TMould_RepairRequest A
+ inner join TMould_Repair B on A.docu_code=B.source_wo
+ where A.mould_code=@mouldcode and B.verify_person<>''
+ union all
+ select '宸蹭笂鏈�' as opertype,lm_user as operuser,lm_date as operdate,eqp_code as operresult
+ from TMould_UpDownReord where mould_code=@mouldcode and type='UP'
+ union all
+ select '宸蹭笅鏈�' as opertype,lm_user as operuser,lm_date as operdate,eqp_code as operresult
+ from TMould_UpDownReord where mould_code=@mouldcode and type='DOWN'
+ union all
+ select '宸插叆搴�' as opertype,lm_user as operuser,lm_date as operdate,warehouse_code as operresult
+ from TMould_InOutReord where mould_code=@mouldcode and type='IN'
+ union all
+ select '宸插嚭搴�' as opertype,lm_user as operuser,lm_date as operdate,warehouse_code as operresult
+ from TMould_InOutReord where mould_code=@mouldcode and type='OUT'
+ union all
+ select '宸插鍊�' as opertype,lm_user as operuser,lm_date as operdate,description as operresult
+ from TMould_LendOutReord where mould_code=@mouldcode and type='OUT'
+ union all
+ select '宸插綊杩�' as opertype,lm_user as operuser,lm_date as operdate,description as operresult
+ from TMould_LendOutReord where mould_code=@mouldcode and type='IN'
+ ) as AA
+ left join TUser U on AA.operuser=U.usercode
+ where 1=1 " + search+" order by AA.operdate desc ";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿娓呭崟鍒犻櫎]
+ public static ToMessage DeleteMouldManger(string mouldcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇妯″叿鏄惁瀛樺湪鐐规璁板綍銆佷繚鍏汇�佺淮淇�佷笂涓嬫満銆佸鍊熷綊杩樸�佸嚭鍏ュ簱璁板綍,涓嶅厑璁稿垹闄�
+ sql = @"select mould_code from TMouldchk_Proc_Main where mould_code=@devicecode
+ union all
+ select mould_code from TMouldmaint_Proc_Main where mould_code=@devicecode
+ union all
+ select mould_code from TMould_RepairRequest where mould_code=@devicecode
+ union all
+ select mould_code from TMould_UpDownReord where mould_code=@devicecode
+ union all
+ select mould_code from TMould_LendOutReord where mould_code=@devicecode
+ union all
+ select mould_code from TMould_InOutReord where mould_code=@devicecode";
+ dynamicParams.Add("@devicecode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠妯″叿瀛樺湪鎿嶄綔璁板綍,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍒犻櫎妯″叿娓呭崟琛�
+ sql = @"delete TMouldInfo where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ //鍒犻櫎妯″叿鍏宠仈浜у搧琛�
+ sql = @"delete TMouldInfoPart where mouldcode=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ //鍒犻櫎妯″叿缁戝畾鐐规鏍囧噯琛�
+ sql = @"delete TMouldchk_Mould where mould_code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ //鍒犻櫎妯″叿缁戝畾淇濆吇鏍囧噯琛�
+ sql = @"delete TMouldmai_Mould where mould_code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规椤瑰垪琛ㄦ煡璇
+ public static ToMessage MouldCheckItemSearch(string checkitemcode, string checkitemname, string checkdescr, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (checkitemcode != "" && checkitemcode != null)
+ {
+ search += "and A.code like '%'+@checkitemcode+'%' ";
+ dynamicParams.Add("@checkitemcode", checkitemcode);
+ }
+ if (checkitemname != "" && checkitemname != null)
+ {
+ search += "and A.name like '%'+@checkitemname+'%' ";
+ dynamicParams.Add("@checkitemname", checkitemname);
+ }
+ if (checkdescr != "" && checkdescr != null)
+ {
+ search += "and A.description like '%'+@checkdescr+'%' ";
+ dynamicParams.Add("@checkdescr", checkdescr);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,U.username as lm_user,A.lm_date
+ from TMouldchk_Item A
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规椤规柊澧炵紪杈慮
+ public static ToMessage AddUpdateMouldCheckItem(string checkitemid, string checkitemcode, string checkitemname, string checkitemdescr, User us, string opertype)
+ {
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (opertype == "Add")
+ {
+ var sql = @"insert into TMouldchk_Item(code,name,description,lm_user,lm_date)
+ values(@checkitemcode,@checkitemname,@checkitemdescr,@usercode,@CreateDate)";
+ dynamicParams.Add("@checkitemcode", checkitemcode);
+ dynamicParams.Add("@checkitemname", checkitemname);
+ dynamicParams.Add("@checkitemdescr", checkitemdescr);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "妯″叿鐐规椤�:" + checkitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ var sql = @"update TMouldchk_Item set name=@checkitemname,description=@checkitemdescr,
+ lm_user=@usercode,lm_date=@CreateDate
+ where id=@checkitemid";
+ dynamicParams.Add("@checkitemid", checkitemid);
+ dynamicParams.Add("@checkitemname", checkitemname);
+ dynamicParams.Add("@checkitemdescr", checkitemdescr);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "妯″叿鐐规椤�:" + checkitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规椤瑰垹闄
+ public static ToMessage DeleteMouldCheckItem(string checkitemcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇鐐规鏍囧噯椤圭洰鏄惁鏈夊叧鑱旂偣妫�鏍囧噯,涓嶅厑璁稿垹闄�
+ sql = @"select * from TMouldchk_Deta
+ where code=@checkitemcode";
+ dynamicParams.Add("@checkitemcode", checkitemcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鐐规椤圭洰宸插叧鑱旀爣鍑�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍒犻櫎鐐规椤圭洰
+ sql = @"delete TMouldchk_Item where code=@checkitemcode";
+ list.Add(new { str = sql, parm = new { checkitemcode = checkitemcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "妯″叿鐐规椤�:" + checkitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规鏍囧噯鍒楄〃鏌ヨ]
+ public static ToMessage DeviceCheckStandArdSearch(string checkstandcode, string checkstandname, string checkstandescr, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (checkstandcode != "" && checkstandcode != null)
+ {
+ search += "and A.code like '%'+@checkstandcode+'%' ";
+ dynamicParams.Add("@checkstandcode", checkstandcode);
+ }
+ if (checkstandname != "" && checkstandname != null)
+ {
+ search += "and A.name like '%'+@checkstandname+'%' ";
+ dynamicParams.Add("@checkstandname", checkstandname);
+ }
+ if (checkstandescr != "" && checkstandescr != null)
+ {
+ search += "and A.iscontr=@checkstandescr ";
+ dynamicParams.Add("@checkstandescr", checkstandescr);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,A.is_checkmould,U.username as lm_user,A.lm_date
+ from TMouldchk_Main A
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ public static ToMessage ViewMouldCheckStanedSearch(string checkstand_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇妯″叿鐐规鏍囧噯淇℃伅
+ sql = @"select code,name,description
+ from TMouldchk_Main
+ where code=@checkstand_code";
+ dynamicParams.Add("@checkstand_code", checkstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ RoutEdit rout = new RoutEdit();
+ if (data.Rows.Count > 0)
+ {
+ rout.code = data.Rows[0]["CODE"].ToString();
+ rout.name = data.Rows[0]["NAME"].ToString();
+ rout.description = data.Rows[0]["DESCRIPTION"].ToString();
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犵偣妫�鏍囧噯淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+ //鏍规嵁妯″叿鐐规鏍囧噯缂栫爜鑾峰彇鍏宠仈鐨勬楠岄」鐩俊鎭�
+ sql = @"select B.code,B.name,A.chkdesc from TMouldchk_Deta A
+ left join TMouldchk_Item B on A.code=B.code
+ where A.mouldchk_main_code=@checkstaned_code order by A.seq asc";
+ dynamicParams.Add("@checkstaned_code", rout.code);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ rout.Data = data0;
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = rout;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鏂板缂栬緫]
+ public static ToMessage AddUpdateMouldCheckStandArd(string opertype, RoutEdit json, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (opertype == "Add")
+ {
+ //鏂板妯″叿鐐规鏍囧噯涓昏〃
+ sql = @"insert into TMouldchk_Main(code,name,description,lm_user,lm_date) values(@code,@name,@descr,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { code = json.code, name = json.name, descr = json.description, lm_user = us.usercode, lm_date = DateTime.Now.ToString() } });
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ //鏂板妯″叿鐐规鏍囧噯鍏宠仈鐐规椤瑰瓙琛�
+ sql = @"insert TMouldchk_Deta (seq,code,name,mouldchk_main_code,chkdesc,lm_user,lm_date)
+ values(@checkitem_seq,@checkitem_code,@checkitem_name,@mouldchk_main_code,@chkdesc,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checkitem_seq = Convert.ToInt32(json.Data.Rows[i]["CHECKITEM_SEQ"].ToString()),
+ checkitem_code = json.Data.Rows[i]["CHECKITEM_CODE"].ToString(),
+ checkitem_name = json.Data.Rows[i]["CHECKITEM_NAME"].ToString(),
+ mouldchk_main_code = json.code,
+ chkdesc = json.Data.Rows[i]["CHECKITEM_DESCR"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "妯″叿鐐规鏍囧噯:" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ //鍒犻櫎鐐规鏍囧噯鍏宠仈鐐规椤圭洰瀛愯〃
+ sql = @"delete from TMouldchk_Deta where mouldchk_main_code=@checkstaned_code";
+ list.Add(new { str = sql, parm = new { checkstaned_code = json.code } });
+ //淇敼鐐规鏍囧噯涓昏〃
+ sql = @"update TMouldchk_Main set name=@checkstaned_name,description=@checkstaned_desc where code=@checkstaned_code";
+ list.Add(new { str = sql, parm = new { checkstaned_code = json.code, checkstaned_name = json.name, checkstaned_desc = json.description } });
+ //鏂板鐐规鏍囧噯鍏宠仈鐐规椤圭洰瀛愯〃
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ sql = @"insert TMouldchk_Deta (seq,code,name,mouldchk_main_code,chkdesc,lm_user,lm_date)
+ values(@checkitem_seq,@checkitem_code,@checkitem_name,@mouldchk_main_code,@chkdesc,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checkitem_seq = Convert.ToInt32(json.Data.Rows[i]["CHECKITEM_SEQ"].ToString()),
+ checkitem_code = json.Data.Rows[i]["CHECKITEM_CODE"].ToString(),
+ checkitem_name = json.Data.Rows[i]["CHECKITEM_NAME"].ToString(),
+ mouldchk_main_code = json.code,
+ chkdesc = json.Data.Rows[i]["CHECKITEM_DESCR"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "妯″叿鐐规鏍囧噯:" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鍒犻櫎]
+ public static ToMessage DeleteMouldCheckStaned(string checkstand_code, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TMouldchk_Proc_Main where mouldchkmain_code=@checkstand_code";
+ dynamicParams.Add("@checkstand_code", checkstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鐐规鏍囧噯宸茬敓鎴愮偣妫�璁板綍,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎妯″叿鐐规鏍囧噯涓昏〃
+ sql = @"delete TMouldchk_Main where code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ //鍒犻櫎妯″叿鐐规鏍囧噯鍏宠仈鐐规椤圭洰瀛愯〃
+ sql = @"delete TMouldchk_Deta where mouldchk_main_code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ //鍒犻櫎妯″叿鐐规鏍囧噯鍏宠仈妯″叿琛�
+ sql = @"delete TMouldchk_Mould where mouldchkmain_code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "妯″叿鐐规鏍囧噯:" + checkstand_code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "璁惧鐐规鏍囧噯鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧鐐规鏍囧噯鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鍏宠仈妯″叿鏌ヨ]
+ public static ToMessage CheckStanedAssociationMould(string checkstand_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from(
+ select AA.code,AA.name,'M' as type,(case when BB.mouldchkmain_code is null then 'N' else 'Y' end) flag
+ from(
+ select A.code,A.name,'' as mouldchkmain_code
+ from TMouldInfo A
+ where A.status='Y'
+ ) as AA
+ left join (
+ select A.code,A.name,B.mouldchkmain_code
+ from TMouldInfo A
+ inner join TMouldchk_Mould B on A.code=B.mould_code
+ where B.mouldchkmain_code=@checkstand_code and A.status='Y'
+ ) as BB on AA.code=BB.code
+ ) as CC";
+ dynamicParams.Add("@checkstand_code", checkstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳ā鍏疯祫鏂�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [妯″叿鐐规鏍囧噯鍏宠仈妯″叿鎻愪氦]
+ public static ToMessage SaveCheckStanedAssociationMould(string checkstand_code, User us, List<ObjectData> json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ if (json == null || json.Count <= 0)
+ {
+ //娓呴櫎妯″叿鐐规鏍囧噯鍏宠仈妯″叿琛ㄦ暟鎹�
+ sql = @"delete TMouldchk_Mould where mouldchkmain_code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ //鏍囪妯″叿鐐规鏍囧噯琛ㄥ叧鑱旀ā鍏锋爣璇�
+ sql = @"update TMouldchk_Main set is_checkmould='N' where code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ }
+ else
+ {
+ //娓呴櫎妯″叿鐐规鏍囧噯鍏宠仈妯″叿琛ㄦ暟鎹�
+ sql = @"delete TMouldchk_Mould where mouldchkmain_code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ //寰幆鍐欏叆妯″叿鐐规鏍囧噯鍏宠仈妯″叿琛�
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"insert into TMouldchk_Mould(mouldchkmain_code,mould_code,lm_user,lm_date) values(@checkstand_code,@mould_code,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mould_code = json[i].code,
+ checkstand_code = checkstand_code,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鏍囪妯″叿鐐规鏍囧噯琛ㄥ叧鑱旀ā鍏锋爣璇�
+ sql = @"update TMouldchk_Main set is_checkmould='Y' where code=@checkstand_code";
+ list.Add(new { str = sql, parm = new { checkstand_code = checkstand_code } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿鐐规鏍囧噯鍏宠仈妯″叿", "妯″叿鐐规鏍囧噯:" + checkstand_code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇椤瑰垪琛ㄦ煡璇
+ public static ToMessage MouldMaiItemSearch(string maiitemcode, string maiitemname, string maidescr, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (maiitemcode != "" && maiitemcode != null)
+ {
+ search += "and A.code like '%'+@maiitemcode+'%' ";
+ dynamicParams.Add("@maiitemcode", maiitemcode);
+ }
+ if (maiitemname != "" && maiitemname != null)
+ {
+ search += "and A.name like '%'+@maiitemname+'%' ";
+ dynamicParams.Add("@maiitemname", maiitemname);
+ }
+ if (maidescr != "" && maidescr != null)
+ {
+ search += "and A.description like '%'+@maidescr+'%' ";
+ dynamicParams.Add("@maidescr", maidescr);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,U.username as lm_user,A.lm_date
+ from TMouldmai_Item A
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤规柊澧炵紪杈慮
+ public static ToMessage AddUpdateMouldMaiItem(string maiitemid, string maiitemcode, string maiitemname, string maiitemdescr, User us, string opertype)
+ {
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (opertype == "Add")
+ {
+ var sql = @"insert into TMouldmai_Item(code,name,description,lm_user,lm_date)
+ values(@maiitemcode,@maiitemname,@maiitemdescr,@usercode,@CreateDate)";
+ dynamicParams.Add("@maiitemcode", maiitemcode);
+ dynamicParams.Add("@maiitemname", maiitemname);
+ dynamicParams.Add("@maiitemdescr", maiitemdescr);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "妯″叿淇濆吇椤�:" + maiitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ var sql = @"update TMouldmai_Item set name=@maiitemname,description=@maiitemdescr,
+ lm_user=@usercode,lm_date=@CreateDate
+ where id=@maiitemid";
+ dynamicParams.Add("@maiitemid", maiitemid);
+ dynamicParams.Add("@maiitemname", maiitemname);
+ dynamicParams.Add("@maiitemdescr", maiitemdescr);
+ dynamicParams.Add("@usercode", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "妯″叿淇濆吇椤�:" + maiitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇椤瑰垹闄
+ public static ToMessage DeleteMouldMaiItem(string maiitemcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍒ゆ柇淇濆吇鏍囧噯椤圭洰鏄惁鏈夊叧鑱斾繚鍏绘爣鍑�,涓嶅厑璁稿垹闄�
+ sql = @"select * from TMouldmai_Deta
+ where code=@maiitemcode";
+ dynamicParams.Add("@maiitemcode", maiitemcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠淇濆吇椤圭洰宸插叧鑱旀爣鍑�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍒犻櫎淇濆吇椤圭洰
+ sql = @"delete TMouldmai_Item where code=@maiitemcode";
+ list.Add(new { str = sql, parm = new { maiitemcode = maiitemcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "妯″叿淇濆吇椤�:" + maiitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇鏍囧噯鍒楄〃鏌ヨ]
+ public static ToMessage MouldRepairStandArdSearch(string repairstandcode, string repairstandname, string repairstandescr, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (repairstandcode != "" && repairstandcode != null)
+ {
+ search += "and A.code like '%'+@repairstandcode+'%' ";
+ dynamicParams.Add("@repairstandcode", repairstandcode);
+ }
+ if (repairstandname != "" && repairstandname != null)
+ {
+ search += "and A.name like '%'+@repairstandname+'%' ";
+ dynamicParams.Add("@repairstandname", repairstandname);
+ }
+ if (repairstandescr != "" && repairstandescr != null)
+ {
+ search += "and A.iscontr=@repairstandescr ";
+ dynamicParams.Add("@repairstandescr", repairstandescr);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.code,A.name,A.description,A.is_repairmould,U.username as lm_user,A.lm_date
+ from TMouldmai_Main A
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯缂栬緫/鏌ョ湅鑾峰彇鏁版嵁]
+ public static ToMessage ViewMouldRepairStanedSearch(string repairstand_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇妯″叿淇濆吇鏍囧噯淇℃伅
+ sql = @"select code,name,description
+ from TMouldmai_Main
+ where code=@repairstand_code";
+ dynamicParams.Add("@repairstand_code", repairstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ RoutEdit rout = new RoutEdit();
+ if (data.Rows.Count > 0)
+ {
+ rout.code = data.Rows[0]["CODE"].ToString();
+ rout.name = data.Rows[0]["NAME"].ToString();
+ rout.description = data.Rows[0]["DESCRIPTION"].ToString();
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犵偣妫�鏍囧噯淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+ //鏍规嵁妯″叿淇濆吇鏍囧噯缂栫爜鑾峰彇鍏宠仈鐨勬楠岄」鐩俊鎭�
+ sql = @"select B.code,B.name,A.chkdesc from TMouldmai_Deta A
+ left join TMouldchk_Item B on A.code=B.code
+ where A.mouldmai_main_code=@repairstand_code order by A.seq asc";
+ dynamicParams.Add("@repairstand_code", rout.code);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ rout.Data = data0;
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = rout;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯鏂板缂栬緫]
+ public static ToMessage AddUpdateMouldRepairStandArd(string opertype, RoutEdit json, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (opertype == "Add")
+ {
+ //鏂板妯″叿淇濆吇鏍囧噯涓昏〃
+ sql = @"insert into TMouldmai_Main(code,name,description,lm_user,lm_date) values(@code,@name,@descr,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { code = json.code, name = json.name, descr = json.description, lm_user = us.usercode, lm_date = DateTime.Now.ToString() } });
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ //鏂板妯″叿淇濆吇鏍囧噯鍏宠仈淇濆吇椤瑰瓙琛�
+ sql = @"insert TMouldmai_Deta (seq,code,name,mouldmai_main_code,chkdesc,lm_user,lm_date)
+ values(@checkitem_seq,@checkitem_code,@checkitem_name,@mouldmai_main_code,@chkdesc,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checkitem_seq = Convert.ToInt32(json.Data.Rows[i]["REPAIRITEM_SEQ"].ToString()),
+ checkitem_code = json.Data.Rows[i]["REPAIRITEM_CODE"].ToString(),
+ checkitem_name = json.Data.Rows[i]["REPAIRITEM_NAME"].ToString(),
+ mouldmai_main_code = json.code,
+ chkdesc = json.Data.Rows[i]["REPAIRITEM_DESCR"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "妯″叿淇濆吇鏍囧噯:" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ //鍒犻櫎淇濆吇鏍囧噯鍏宠仈淇濆吇椤圭洰瀛愯〃
+ sql = @"delete from TMouldmai_Deta where mouldmai_main_code=@repairstaned_code";
+ list.Add(new { str = sql, parm = new { repairstaned_code = json.code } });
+ //淇敼淇濆吇鏍囧噯涓昏〃
+ sql = @"update TMouldmai_Main set name=@checkstaned_name,description=@checkstaned_desc where code=@repairstaned_code";
+ list.Add(new { str = sql, parm = new { repairstaned_code = json.code, checkstaned_name = json.name, checkstaned_desc = json.description } });
+ //鏂板淇濆吇鏍囧噯鍏宠仈淇濆吇椤圭洰瀛愯〃
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ sql = @"insert TMouldmai_Deta (seq,code,name,mouldmai_main_code,chkdesc,lm_user,lm_date)
+ values(@checkitem_seq,@checkitem_code,@checkitem_name,@mouldmai_main_code,@chkdesc,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checkitem_seq = Convert.ToInt32(json.Data.Rows[i]["REPAIRITEM_SEQ"].ToString()),
+ checkitem_code = json.Data.Rows[i]["REPAIRITEM_CODE"].ToString(),
+ checkitem_name = json.Data.Rows[i]["REPAIRITEM_NAME"].ToString(),
+ mouldmai_main_code = json.code,
+ chkdesc = json.Data.Rows[i]["REPAIRITEM_DESCR"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "妯″叿淇濆吇鏍囧噯:" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇鏍囧噯鍒犻櫎]
+ public static ToMessage DeleteMouldRepairStaned(string repairstand_code, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TMouldmaint_Proc_Main where mouldmaint_code=@repairstand_code";
+ dynamicParams.Add("@repairstand_code", repairstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠淇濆吇鏍囧噯宸茬敓鎴愮偣妫�璁板綍,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎妯″叿淇濆吇鏍囧噯涓昏〃
+ sql = @"delete TMouldmai_Main where code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ //鍒犻櫎妯″叿淇濆吇鏍囧噯鍏宠仈淇濆吇椤圭洰瀛愯〃
+ sql = @"delete TMouldmai_Deta where mouldmai_main_code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ //鍒犻櫎妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿琛�
+ sql = @"delete TMouldmai_Mould where mouldmaimain_code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "妯″叿淇濆吇鏍囧噯:" + repairstand_code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "妯″叿淇濆吇鏍囧噯鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "妯″叿淇濆吇鏍囧噯鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规鏍囧噯鍏宠仈妯″叿鏌ヨ]
+ public static ToMessage RepairStanedAssociationMould(string repairstand_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from(
+ select AA.code,AA.name,'M' as type,(case when BB.mouldmaimain_code is null then 'N' else 'Y' end) flag
+ from(
+ select A.code,A.name,'' as mouldmaimain_code
+ from TMouldInfo A
+ where A.status='Y'
+ ) as AA
+ left join (
+ select A.code,A.name,B.mouldmaimain_code
+ from TMouldInfo A
+ inner join TMouldmai_Mould B on A.code=B.mould_code
+ where B.mouldmaimain_code=@repairstand_code and A.status='Y'
+ ) as BB on AA.code=BB.code
+ ) as CC";
+ dynamicParams.Add("@repairstand_code", repairstand_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳ā鍏疯祫鏂�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [妯″叿鐐规鏍囧噯鍏宠仈妯″叿鎻愪氦]
+ public static ToMessage SaveRepairStanedAssociationMould(string repairstand_code, User us, List<ObjectData> json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ if (json == null || json.Count <= 0)
+ {
+ //娓呴櫎妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿琛ㄦ暟鎹�
+ sql = @"delete TMouldmai_Mould where mouldmaimain_code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ //鏍囪妯″叿淇濆吇鏍囧噯琛ㄥ叧鑱旀ā鍏锋爣璇�
+ sql = @"update TMouldmai_Main set is_repairmould='N' where code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ }
+ else
+ {
+ //娓呴櫎妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿琛ㄦ暟鎹�
+ sql = @"delete TMouldmai_Mould where mouldmaimain_code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ //寰幆鍐欏叆妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿琛�
+ for (int i = 0; i < json.Count; i++)
+ {
+ sql = @"insert into TMouldmai_Mould(mouldmaimain_code,mould_code,lm_user,lm_date) values(@repairstand_code,@mould_code,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mould_code = json[i].code,
+ repairstand_code = repairstand_code,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鏍囪妯″叿淇濆吇鏍囧噯琛ㄥ叧鑱旀ā鍏锋爣璇�
+ sql = @"update TMouldmai_Main set is_repairmould='Y' where code=@repairstand_code";
+ list.Add(new { str = sql, parm = new { repairstand_code = repairstand_code } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿淇濆吇鏍囧噯鍏宠仈妯″叿", "妯″叿淇濆吇鏍囧噯:" + repairstand_code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规,鎵弿妯″叿浜岀淮鐮乚
+ public static ToMessage CheckScanMouldQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲妯″叿淇℃伅
+ sql = @"select A.code,A.name,A.spec
+ from TMouldInfo A
+ where A.code=@mouldcode and A.status='Y'";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿缂栫爜涓嶅瓨鍦ㄦ垨涓嶅彲鐢�!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规,鎵弿妯″叿浜岀淮鐮佹煡鎵剧偣妫�鏍囧噯]
+ public static ToMessage CheckScanMouldTemp(string mouldcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲妯″叿鐐规鏍囧噯
+ sql = @"select M.code,M.name from TMouldchk_Mould E
+ inner join TMouldchk_Main M on E.mouldchkmain_code=M.code
+ where E.mould_code=@mouldcode order by M.lm_date desc";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鏈寚瀹氱偣妫�鏍囧噯!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规,閫夋嫨鎵爜妯″叿銆佺偣妫�鏍囧噯甯﹀嚭鐐规椤筣
+ public static ToMessage SelectScanMouldQrCodeItem(string mouldcode, string checktempcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲妯″叿鍏宠仈鐨勭偣妫�椤圭洰
+ sql = @"select S.seq,S.code,S.name,S.chkdesc
+ from TMouldchk_Mould A
+ inner join TMouldchk_Main B on A.mouldchkmain_code=B.code
+ inner join TMouldchk_Deta S on B.code=S.mouldchk_main_code
+ where A.mould_code=@mouldcode and B.code=@checktempcode
+ order by S.seq asc";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ dynamicParams.Add("@checktempcode", checktempcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鏈缃偣妫�鏍囧噯缁戝畾鐐规椤圭洰!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规銆佹彁浜や繚瀛榏
+ public static ToMessage MouldCheckSave(string menucode, User us, AppDevicecCheck json)
+ {
+ var sql = "";
+ string djwo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncodeJob.EncodingSeach(menucode); //APP绔ā鍏风偣妫�鐢熸垚鍗曞彿
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ djwo = wo[0].ToString(); //鑾峰彇鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ if (json == null || json.children.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鐐规椤逛俊鎭笉鑳戒负绌�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍐欏叆鐐规璁板綍涓昏〃
+ sql = @"insert into TMouldchk_Proc_Main(djwo,mould_code,mouldchkmain_code,chk_user,chk_date,chk_result)
+ values(@djwo,@mould_code,@mouldchkmain_code,@lm_user,@lm_date,@chk_result)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ djwo = djwo,
+ mould_code = json.code,
+ mouldchkmain_code = json.standcode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ chk_result = json.result
+ }
+ });
+ //寰幆鍐欏叆鐐规璁板綍瀛愯〃
+ for (int i = 0; i < json.children.Count; i++)
+ {
+ sql = @"insert into TMouldchk_Proc_Deta(seq,m_id,mouldchkdeta_code,result,chk_value,lm_user,lm_date)
+ values(@seq,CONVERT(INT,IDENT_CURRENT('TMouldchk_Proc_Main')),@mouldchkdeta_code,@result,@chk_value,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ seq = json.children[i].seq,
+ mouldchkdeta_code = json.children[i].itemcode,
+ result = json.children[i].result,
+ chk_value = json.children[i].value,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ }); ;
+ }
+ //鏇存柊鍗曟嵁娴佹按鍙�
+ List<object> list1 = SeachEncodeJob.StrEncodingUpdate(menucode, numvalue);
+ list.Add(list1[0]);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿鐐规", "妯″叿:" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鐐规鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鐐规澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇,鎵弿妯″叿浜岀淮鐮乚
+ public static ToMessage RepairScanMouldQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇妯″叿淇℃伅
+ sql = @"select A.code,A.name,A.spec
+ from TMouldInfo A
+ where A.code=@mouldcode and A.status='Y' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿缂栫爜涓嶅瓨鍦ㄦ垨涓嶅彲鐢�!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,鎵弿妯″叿浜岀淮鐮佹煡鎵句繚鍏绘爣鍑哴
+ public static ToMessage RepairScanMouldTemp(string mouldcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲妯″叿淇濆吇鏍囧噯
+ sql = @"select M.code,M.name from TMouldmai_Mould E
+ inner join TMouldchk_Main M on E.mouldmaimain_code=M.code
+ where E.mould_code=@mouldcode order by M.lm_date desc";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鏈寚瀹氫繚鍏绘爣鍑�!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,閫夋嫨鎵爜妯″叿鍒楄〃甯﹀嚭淇濆吇椤筣
+ public static ToMessage RepairSelectScanMouldQrCodeItem(string mouldcode, string repartempcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇瀵瑰簲妯″叿鍏宠仈鐨勪繚鍏婚」鐩�
+ sql = @"select S.seq,S.code,S.name,S.chkdesc
+ from TMouldmai_Mould A
+ inner join TMouldmai_Main B on A.mouldmaimain_code=B.code
+ inner join TMouldmai_Deta S on B.code=S.mouldmai_main_code
+ where A.mould_code=@mouldcode and B.code=@repartempcode
+ order by S.seq asc";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ dynamicParams.Add("@repartempcode", repartempcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鏈缃繚鍏绘爣鍑嗙粦瀹氫繚鍏婚」鐩�!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇,鎻愪氦淇濆瓨]
+ public static ToMessage MouldRepairSave(string menucode, User us, AppDevicecCheck json)
+ {
+ var sql = "";
+ string bywo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncodeJob.EncodingSeach(menucode); //APP绔ā鍏蜂繚鍏荤敓鎴愬崟鍙�
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ bywo = wo[0].ToString(); //鑾峰彇鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ if (json == null || json.children.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇濆吇椤逛俊鎭笉鑳戒负绌�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍐欏叆淇濆吇璁板綍涓昏〃
+ sql = @"insert into TMouldmaint_Proc_Main(bywo,mould_code,mouldmaint_code,maint_result,maint_user,maint_date)
+ values(@bywo,@mould_code,@mouldmaint_code,@maint_result,@maint_user,@maint_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ bywo = bywo,
+ mould_code = json.code,
+ mouldmaint_code = json.standcode,
+ maint_user = us.usercode,
+ maint_date = DateTime.Now.ToString(),
+ maint_result = json.result
+ }
+ });
+ //寰幆鍐欏叆淇濆吇璁板綍瀛愯〃
+ for (int i = 0; i < json.children.Count; i++)
+ {
+ sql = @"insert into TMouldmaint_Proc_Deta(seq,m_id,mouldmaideta_code,result,maint_value,lm_user,lm_date)
+ values(@seq,CONVERT(INT,IDENT_CURRENT('TMouldmaint_Proc_Main')),@mouldmaideta_code,@result,@maint_value,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ seq = json.children[i].seq,
+ mouldmaideta_code = json.children[i].itemcode,
+ result = json.children[i].result,
+ maint_value = json.children[i].value,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ }); ;
+ }
+ //鏇存柊鍗曟嵁娴佹按鍙�
+ List<object> list1 = SeachEncodeJob.StrEncodingUpdate(menucode, numvalue);
+ list.Add(list1[0]);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿淇濆吇", "妯″叿:" + json.code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇濆吇鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇濆吇澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿淇℃伅鏌ヨ,鎵弿妯″叿浜岀淮鐮乚
+ public static ToMessage ScanMouldQrCodeMessageData(string mouldcode)
+ {
+ string sql = "", search = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += " where code=@mouldcode ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ //鏌ユ壘妯″叿淇℃伅
+ sql = @"select code,name,spec
+ from TMouldInfo"+search;
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dt;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤鏁版嵁鎴栨棤鏁堢殑妯″叿浜岀淮鐮佷俊鎭�!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇℃伅鏌ヨ鏄庣粏]
+ public static ToMessage ScanMouldQrCodeMessageSubData(string mouldcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<MouldMessage> list = new List<MouldMessage>();
+ try
+ {
+ //鏌ユ壘妯″叿淇℃伅
+ MouldMessage moud = new MouldMessage();
+ sql = @"select code,name,spec,surp_life,resi_life,status,usestatus
+ from TMouldInfo where code=@mouldcode";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+
+ moud.mouldcode = dt.Rows[0]["code"].ToString();
+ moud.mouldname = dt.Rows[0]["name"].ToString();
+ moud.mouldspec = dt.Rows[0]["spec"].ToString();
+ moud.surp_life = dt.Rows[0]["surp_life"].ToString();
+ moud.resi_life = dt.Rows[0]["resi_life"].ToString();
+ moud.status = dt.Rows[0]["status"].ToString();
+ moud.usestatus = dt.Rows[0]["usestatus"].ToString();
+ //鏌ヨ鏈�杩戜竴娆$偣妫�璁板綍
+ sql = @"select top 1 chk_date from TMouldchk_Proc_Main where mould_code=@mouldcode order by chk_date desc";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ moud.checkdate = dt0.Rows[0]["chk_date"].ToString();
+ }
+ //鏌ヨ鏈�杩戜竴娆′繚鍏昏褰�
+ sql = @"select top 1 maint_date from TMouldmaint_Proc_Main where mould_code=@mouldcode order by maint_date desc";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt1.Rows.Count > 0)
+ {
+ moud.maintdate = dt1.Rows[0]["maint_date"].ToString();
+ }
+
+ //鏌ヨ鍏宠仈浜у搧
+ moud.children = new List<RelatedProduct>();
+ sql = @"select P.partcode,M.partname,M.partspec
+ from TMouldInfoPart P
+ left join TMateriel_Info M on P.partcode=M.partcode
+ where P.mouldcode=@mouldcode";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt2 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt2.Rows.Count > 0)
+ {
+ for (int i = 0; i < dt2.Rows.Count; i++)
+ {
+ RelatedProduct mousb = new RelatedProduct();
+ mousb.partcode = dt2.Rows[i]["partcode"].ToString();
+ mousb.partname = dt2.Rows[i]["partname"].ToString();
+ mousb.partspec = dt2.Rows[i]["partspec"].ToString();
+ moud.children.Add(mousb);
+ }
+ }
+ list.Add(moud);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤鏁版嵁鎴栨棤鏁堢殑妯″叿浜岀淮鐮佷俊鎭�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨鐢宠,鎵弿妯″叿浜岀淮鐮乚
+ public static ToMessage MaintainScanMouldApplyQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠妯″叿褰撳墠浣跨敤鐘舵��
+ sql = @"select * from TMouldInfo where code=@mouldcode";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ switch (dt.Rows[0]["usestatus"].ToString())
+ {
+ case "0": //鍦ㄥ簱
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鍦ㄥ簱鐘舵��,璇峰厛鍑哄簱鎿嶄綔!";
+ mes.data = null;
+ return mes;
+ case "2": //涓婃満
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿涓婃満鐘舵��,璇峰厛涓嬫満鎿嶄綔!";
+ mes.data = null;
+ return mes;
+ case "7": //澶栧��
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿澶栧�熺姸鎬�,璇峰厛褰掕繕鎿嶄綔!";
+ mes.data = null;
+ return mes;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳晥鐨勬ā鍏蜂簩缁寸爜淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鑾峰彇褰撳墠鎵爜妯″叿鏄惁瀛樺湪宸茬敵璇锋垨宸茬淮淇姸鎬佹暟鎹�
+ sql = @"select * from TMould_RepairRequest where mould_code=@mouldcode and status<>'CONFIR'";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ //鏌ョ湅缁翠慨璁板綍閲岄潰鏄惁鏈夊凡鐢宠鏈淮淇強缁翠慨纭鐨勬暟鎹�
+ var rows = data0.AsEnumerable().Where(item => item["STATUS"].ToString().Equals("REPA")).ToArray();
+ if (rows.Length > 0)
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿宸茬淮淇敵璇�,寰呯淮淇�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿宸茬淮淇�,寰呯‘璁ら獙璇�!";
+ mes.data = null;
+ }
+ }
+ else
+ {
+ //鑾峰彇瀵瑰簲妯″叿淇℃伅
+ sql = @"select A.code,A.name,A.spec,A.surp_life,A.resi_life
+ from TMouldInfo A
+ where A.code=@mouldcode and A.status='Y' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿缂栫爜涓嶅瓨鍦ㄦ垨涓嶅彲鐢�!";
+ mes.data = data;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨鐢宠,鎻愪氦淇濆瓨]
+ public static ToMessage MaintainScanMouldApplySave(string menucode, string mouldcode, string faultsourcecode, string faultdescr, User us, IFormFileCollection files)
+ {
+ var sql = "";
+ string sqwo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncodeJob.EncodingSeach(menucode); //APP绔ā鍏风淮淇敵璇风敓鎴愬崟鍙�
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ sqwo = wo[0].ToString(); //鑾峰彇鐢宠缁翠慨鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ //缁翠慨鐢宠涓婁紶鍥剧墖
+ if (files != null && files.Count > 0)
+ {
+ for (int i = 0; i < files.Count; i++)
+ {
+ IFormFile file = files[i];
+ string imgName = "SQ" + DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString();
+ string filePath = "wwwroot/MouldRecordImage/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻枃浠跺湴鍧�)
+ string filePath1 = "MouldRecordImage/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻暟鎹〃鍦板潃)
+
+ // 鐢熸垚鏂囦欢鍚�
+ //var fileName = "SQ" + DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString() + Path.GetExtension(files[i].FileName);
+
+ // 鎷兼帴鏂囦欢淇濆瓨璺緞
+ //var filePath = Path.Combine("wwwroot/MouldRecordImage", fileName);
+
+ // 淇濆瓨鏂囦欢var stream = new FileStream(filePath, FileMode.Create)
+ using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ files[i].CopyTo(stream);
+ }
+ //寰幆鍐欑淮淇褰曞搴斿浘鐗囪〃
+ sql = @"insert into TMould_RepairImage(source_wo,wo_type,img1url)
+ values(@source_wo,@wo_type,@img1url)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ source_wo = sqwo,
+ wo_type = "REPA",
+ img1url = filePath1
+ }
+ });
+ }
+ }
+ //鍐欏叆缁翠慨鐢宠璁板綍琛�
+ sql = @"insert into TMould_RepairRequest(docu_code,docu_date,status,mould_code,request_person,request_date,failure_descript,source)
+ values(@docu_code,@docu_date,@status,@mould_code,@request_person,@request_date,@failure_descript,@source)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ docu_code = sqwo,
+ docu_date = DateTime.Now.ToString(),
+ status = "REPA",
+ mould_code = mouldcode,
+ request_person = us.usercode,
+ request_date = DateTime.Now.ToString(),
+ failure_descript = faultdescr,
+ source = faultsourcecode
+ }
+ });
+ //鍥炲啓妯″叿娓呭崟,妯″叿鐘舵��(鏁呴殰)銆佷娇鐢ㄧ姸鎬�(寰呯淮淇�)
+ sql = @"update TMouldInfo set status='N',usestatus='4' where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ //鏇存柊鍗曟嵁娴佹按鍙�
+ List<object> list1 = SeachEncodeJob.StrEncodingUpdate(menucode, numvalue);
+ list.Add(list1[0]);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿缁翠慨鐢宠", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缁翠慨鐢宠鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缁翠慨鐢宠澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿寰呯淮淇俊鎭垪琛╙
+ public static ToMessage RepairScanMouldQrCodeDataList(string mouldcode)
+ {
+ string sql = "", search = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and B.code=@mouldcode ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ //鑾峰彇妯″叿缁翠慨鍒楄〃宸茬敵璇锋湭缁翠慨鐨勬暟鎹�
+ sql = @"select A.docu_code,B.code as mouldcode,B.name as mouldname,B.spec as mouldspec,B.surp_life,B.resi_life,
+ A.request_person,U.username as request_name,A.request_date,
+ (case when A.source='A' then '鐐规' when A.source='B' then '淇濆吇' when A.source='D' then '鎵嬪伐' end) as source,
+ A.failure_descript
+ from TMould_RepairRequest A
+ inner join TMouldInfo B on A.mould_code=B.code
+ left join TUser U on A.request_person=U.usercode
+ where A.status='REPA' " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤缁翠慨鐢宠璁板綍!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨鎻愪氦]
+ public static ToMessage RepairScanMouldSave(string menucode, string docu_code, string mouldcode, string faultdescr, string is_stoprepair, string repaircontent, User us, IFormFileCollection files)
+ {
+ var sql = "";
+ string wxwo = "", numvalue = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ mes = SeachEncodeJob.EncodingSeach(menucode); //APP绔ā鍏风淮淇敓鎴愬崟鍙�
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ else
+ {
+ List<string> wo = (List<string>)mes.data;
+ wxwo = wo[0].ToString(); //鑾峰彇鍗曞彿
+ numvalue = wo[1].ToString(); //鑾峰彇娴佹按鍙�
+ }
+ //缁翠慨鐢宠涓婁紶鍥剧墖
+ if (files != null && files.Count > 0)
+ {
+ for (int i = 0; i < files.Count; i++)
+ {
+ IFormFile file = files[i];
+ string imgName = "WX" + DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString();
+ string filePath = "wwwroot/MouldRecordImage/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻枃浠跺湴鍧�)
+ string filePath1 = "MouldRecordImage/" + imgName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻暟鎹〃鍦板潃)
+ // 鐢熸垚鏂囦欢鍚�
+ //var fileName = "WX" + DateTime.Now.ToString("yyyyMMddhhmmss") + i.ToString() + Path.GetExtension(files[i].FileName);
+
+ // 鎷兼帴鏂囦欢淇濆瓨璺緞
+ //var filePath = Path.Combine("wwwroot/MouldRecordImage", fileName);
+
+ // 淇濆瓨鏂囦欢var stream = new FileStream(filePath, FileMode.Create)
+ using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ files[i].CopyTo(stream);
+ }
+ //寰幆鍐欑淮淇褰曞搴斿浘鐗囪〃
+ sql = @"insert into TMould_RepairImage(source_wo,wo_type,img1url)
+ values(@source_wo,@wo_type,@img1url)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ source_wo = wxwo,
+ wo_type = "COMP",
+ img1url = filePath1
+ }
+ });
+ }
+ }
+ //鍐欏叆缁翠慨璁板綍琛�
+ sql = @"insert into TMould_Repair(repair_code,docu_date,status,mould_code,repair_person,repair_date,repair_content,failure_descript,is_shutdown,source_wo)
+ values(@repair_code,@docu_date,@status,@mould_code,@repair_person,@repair_date,@repair_content,@failure_descript,@is_shutdown,@source_wo)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_code = wxwo,
+ docu_date = DateTime.Now.ToString(),
+ status = "COMP",
+ mould_code = mouldcode,
+ repair_person = us.usercode,
+ repair_date = DateTime.Now.ToString(),
+ repair_content = repaircontent,
+ failure_descript = faultdescr,
+ is_shutdown = is_stoprepair,
+ source_wo = docu_code
+ }
+ });
+ //鏇存柊缁翠慨鐢宠鍗曠姸鎬�
+ sql = @"update TMould_RepairRequest set status=@status where docu_code=@docu_code and mould_code=@mouldcode";
+ list.Add(new { str = sql, parm = new { docu_code = docu_code, mouldcode = mouldcode, status = "COMP" } });
+ //鍥炲啓妯″叿娓呭崟,浣跨敤鐘舵��(宸茬淮淇�)
+ sql = @"update TMouldInfo set usestatus='5' where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ //鏇存柊鍗曟嵁娴佹按鍙�
+ List<object> list1 = SeachEncodeJob.StrEncodingUpdate(menucode, numvalue);
+ list.Add(list1[0]);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿缁翠慨", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缁翠慨鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缁翠慨澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨寰呴獙璇佸垪琛╙
+ public static ToMessage RepairVerificationScanMouldData(string mouldcode)
+ {
+ string sql = "", search = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and B.code=@mouldcode ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ //鑾峰彇妯″叿缁翠慨鍒楄〃宸茬淮淇殑鏁版嵁
+ sql = @"select A.repair_code,B.code as mouldcode,B.name as mouldname,B.spec as mouldspec,B.surp_life,B.resi_life,
+ A.repair_person,U.username as repair_name,A.repair_date,A.is_shutdown,
+ A.failure_descript
+ from TMould_Repair A
+ inner join TMouldInfo B on A.mould_code=B.code
+ left join TUser U on A.repair_person=U.usercode
+ where A.status='COMP' " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤缁翠慨璁板綍!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨寰呴獙璇佽鎯呬俊鎭痌
+ public static ToMessage RepairVerificationScanMouldDataSub(string repair_code, string mouldcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<string, object> dict = new Dictionary<string, object>();
+ try
+ {
+ //鏍规嵁璁炬ā鍏风紪鐮佽幏鍙栫淮淇鎯�
+ sql = @"select repair_code,failure_descript,is_shutdown,repair_content,repair_part
+ from TMould_Repair
+ where repair_code=@repair_code and mould_code=@mouldcode";
+ dynamicParams.Add("@repair_code", repair_code);
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ dict.Add("failure_descript", data.Rows[0]["failure_descript"].ToString()); //鏁呴殰鎻忚堪
+
+ //鑾峰彇鏁呴殰涓婁紶鍥剧墖
+ sql = @"select img1url from TMould_RepairImage where source_wo=@source_wo and wo_type='COMP'";
+ dynamicParams.Add("@source_wo", data.Rows[0]["repair_code"].ToString());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ dict.Add("failure_descriptimg", data0); //鏁呴殰涓婁紶鍥剧墖
+ }
+ dict.Add("repair_content", data.Rows[0]["repair_content"].ToString()); //缁翠慨鍐呭
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dict;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤缁翠慨璁板綍!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨楠岃瘉鎻愪氦]
+ public static ToMessage RepairVerificationScanMouldSave(string repairwo, string mouldcode, string result, string surp_life, User us)
+ {
+ var sql = ""; decimal surplife = 0;
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //楠岃瘉缁撴灉涓篛K涓旈獙璇佸悗鐨勫墿浣欏鍛�>0
+ if (result == "OK" && decimal.Parse(surp_life) > 0)
+ {
+ surplife = decimal.Parse(surp_life);
+ }
+ //鏍规嵁妯″叿缁翠慨鍗曟煡鎵炬簮鍗�(缁翠慨鐢宠鍗�)
+ sql = @"select source_wo from TMould_Repair where repair_code=@repairwo";
+ dynamicParams.Add("@repairwo", repairwo);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //鏇存柊璁惧缁翠慨璁板綍楠岃瘉浜哄憳銆侀獙璇佹椂闂淬�侀獙璇佺粨鏋溿�侀獙璇佺姸鎬�
+ sql = @"update TMould_Repair set status=@status,is_verifi=@is_verifi,verify_result=@verify_result,verify_person=@verify_person,verify_date=@verify_date,verify_surplife=@verify_surplife
+ where repair_code=@repair_code and mould_code=@mould_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ status = "CONFIR",
+ is_verifi = "Y",
+ verify_result = result,
+ verify_person = us.usercode,
+ verify_date = DateTime.Now.ToString(),
+ repair_code = repairwo,
+ mould_code = mouldcode,
+ verify_surplife = surplife
+ }
+ });
+ //鏇存柊缁翠慨鐢宠鍗曠姸鎬�
+ sql = @"update TMould_RepairRequest set status=@status where docu_code=@docu_code and mould_code=@mouldcode";
+ list.Add(new { str = sql, parm = new { docu_code = data.Rows[0]["source_wo"].ToString(), mouldcode = mouldcode, status = "CONFIR" } });
+ if (result == "OK")
+ {
+
+ if (surplife > 0)
+ {
+ //鍥炲啓妯″叿娓呭崟,妯″叿鐘舵��(姝e父),浣跨敤鐘舵��(宸茬淮淇�),鍓╀綑瀵垮懡(娆�)
+ sql = @"update TMouldInfo set status='Y',usestatus='6',resi_life=@resi_life where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode, resi_life = surp_life } });
+ }
+ else
+ {
+ //鍥炲啓妯″叿娓呭崟,妯″叿鐘舵��(姝e父),浣跨敤鐘舵��(宸茬淮淇�)
+ sql = @"update TMouldInfo set status='Y',usestatus='6' where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ }
+ }
+ else
+ {
+ //鍥炲啓妯″叿娓呭崟,妯″叿鐘舵��(鏁呴殰),浣跨敤鐘舵��(宸茬淮淇�)
+ sql = @"update TMouldInfo set status='N',usestatus='6' where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿缁翠慨楠岃瘉", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缁翠慨楠岃瘉鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缁翠慨楠岃瘉澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿涓婃満,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldUpQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠妯″叿褰撳墠浣跨敤鐘舵��
+ sql = @"select code,name,spec,status,usestatus,surp_life,resi_life
+ from TMouldInfo where code=@mouldcode";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ if (dt.Rows[0]["status"].ToString() == "Y")
+ {
+ switch (dt.Rows[0]["usestatus"].ToString())
+ {
+ case "0": //鍦ㄥ簱
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鍦ㄥ簱鐘舵��,涓嶇鍚堜笂鏈烘搷浣�!";
+ mes.data = null;
+ return mes;
+ case "2": //涓婃満
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿涓婃満鐘舵��,涓嶇鍚堜笂鏈烘搷浣�!";
+ mes.data = null;
+ return mes;
+ case "7": //澶栧��
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿澶栧�熺姸鎬�,涓嶇鍚堜笂鏈烘搷浣�!";
+ mes.data = null;
+ return mes;
+ default:
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dt;
+ break;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "妯″叿鏁呴殰鎴栫淮淇腑,涓嶅厑璁镐笂鏈�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳晥鐨勬ā鍏蜂簩缁寸爜淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿涓婃満,閫夋嫨鏈笂妯¤澶嘳
+ public static ToMessage MouldEqpPermissions()
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select code,name from TEqpInfo where enable='Y' and code not in
+ (
+ select distinct eqp_code from TMould_UpDownReord where is_up='Y'
+ )";
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿涓婃満鎻愪氦]
+ public static ToMessage MouldUpSave(string mouldcode, string eqp_code, string description, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍐欏叆涓婁笅鏈烘満璁板綍琛�(涓婃満鎿嶄綔)
+ sql = @"insert into TMould_UpDownReord(mould_code,type,eqp_code,description,is_up,lm_user,lm_date)
+ values(@mould_code,@type,@eqp_code,@description,@is_up,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mould_code = mouldcode,
+ type = "UP",
+ eqp_code = eqp_code,
+ description = description,
+ is_up = "Y",
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //鍥炲啓妯″叿娓呭崟,浣跨敤鐘舵��(涓婃満)
+ sql = @"update TMouldInfo set usestatus='2' where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿涓婃満", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "妯″叿涓婃満鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "妯″叿涓婃満澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿涓嬫満,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldDownQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠妯″叿褰撳墠浣跨敤鐘舵��
+ sql = @"select * from TMouldInfo where code=@mouldcode ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ if (dt.Rows[0]["status"].ToString() == "Y")
+ {
+ //鍒ゆ柇褰撳墠妯″叿鏄惁鍦ㄤ笂鏈虹姸鎬�
+ sql = @"select A.mould_code,M.name as mould_name,M.spec as mould_spec,
+ M.surp_life,M.resi_life,A.eqp_code,E.name as eqp_name
+ from TMould_UpDownReord A
+ left join TMouldInfo M on A.mould_code=M.code
+ left join TEqpInfo E on A.eqp_code=E.code
+ where A.mould_code=@mouldcode and A.is_up='Y'";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鏈笂鏈�,涓嶇鍚堜笅鏈烘搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "妯″叿鏁呴殰鎴栫淮淇腑,涓嶇鍚堜笅鏈烘搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳晥鐨勬ā鍏蜂簩缁寸爜淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿涓嬫満鎻愪氦]
+ public static ToMessage MouldDownSave(string mouldcode, string eqp_code, string usecount_life, string description, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍐欏叆涓婁笅鏈烘満璁板綍琛�(涓嬫満鎿嶄綔)
+ sql = @"insert into TMould_UpDownReord(mould_code,type,usecount_life,eqp_code,description,is_up,lm_user,lm_date)
+ values(@mould_code,@type,@usecount_life,@eqp_code,@description,@is_up,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mould_code = mouldcode,
+ type = "DOWN",
+ usecount_life = decimal.Parse(usecount_life),
+ eqp_code = eqp_code,
+ description = description,
+ is_up = "N",
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //鍥炲啓涓婃満璁板綍涓婃満鏍囪瘑(娓呴櫎)
+ sql = @"update TMould_UpDownReord set is_up='N' where mould_code=@mouldcode and eqp_code=@eqp_code";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode, eqp_code = eqp_code } });
+ //鍥炲啓妯″叿娓呭崟
+ if (decimal.Parse(usecount_life) > 0)
+ {
+ //鍥炲啓妯″叿娓呭崟,浣跨敤鐘舵��(涓嬫満),鍓╀綑瀵垮懡
+ sql = @"update TMouldInfo set usestatus='3',resi_life=resi_life-@resi_life where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode, resi_life = decimal.Parse(usecount_life) } });
+ }
+ else
+ {
+ //鍥炲啓妯″叿娓呭崟,浣跨敤鐘舵��(涓嬫満)
+ sql = @"update TMouldInfo set usestatus='3' where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿涓嬫満", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "妯″叿涓嬫満鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "妯″叿涓嬫満澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿澶栧��,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldLendOutQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠妯″叿褰撳墠浣跨敤鐘舵��
+ sql = @"select code,name,spec,status,usestatus,surp_life,resi_life
+ from TMouldInfo where code=@mouldcode";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ if (dt.Rows[0]["status"].ToString() == "Y")
+ {
+ switch (dt.Rows[0]["usestatus"].ToString())
+ {
+ case "0": //鍦ㄥ簱
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鍦ㄥ簱鐘舵��,涓嶇鍚堝鍊熸搷浣�!";
+ mes.data = null;
+ return mes;
+ case "2": //涓婃満
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿涓婃満鐘舵��,涓嶇鍚堝鍊熸搷浣�!";
+ mes.data = null;
+ return mes;
+ case "7": //澶栧��
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿澶栧�熺姸鎬�,涓嶇鍚堝鍊熸搷浣�!";
+ mes.data = null;
+ return mes;
+ default:
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dt;
+ break;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "妯″叿鏁呴殰鎴栫淮淇腑,涓嶅厑璁稿鍊�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳晥鐨勬ā鍏蜂簩缁寸爜淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿澶栧�熸彁浜
+ public static ToMessage MouldLendOutSave(string mouldcode, string description, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍐欏叆澶栧�熷綊杩樿褰曡〃(澶栧�熸搷浣�)
+ sql = @"insert into TMould_LendOutReord(mould_code,type,description,is_ledout,lm_user,lm_date)
+ values(@mould_code,@type,@description,@is_ledout,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mould_code = mouldcode,
+ type = "OUT",
+ description = description,
+ is_ledout = "Y",
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //鍥炲啓妯″叿娓呭崟,浣跨敤鐘舵��(澶栧��)
+ sql = @"update TMouldInfo set usestatus='7' where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿澶栧��", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "妯″叿澶栧�熸垚鍔�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "妯″叿澶栧�熷け璐�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿褰掕繕,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldReturnQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠妯″叿褰撳墠浣跨敤鐘舵��
+ sql = @"select * from TMouldInfo where code=@mouldcode ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ if (dt.Rows[0]["status"].ToString() == "Y")
+ {
+ //鍒ゆ柇褰撳墠妯″叿鏄惁鍦ㄥ鍊熺姸鎬�
+ sql = @"select A.mould_code,M.name as mould_name,M.spec as mould_spec,
+ M.surp_life,M.resi_life
+ from TMould_LendOutReord A
+ left join TMouldInfo M on A.mould_code=M.code
+ where A.mould_code=@mouldcode and A.is_ledout='Y'";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鏈鍊�,涓嶇鍚堝綊杩樻搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "妯″叿鏁呴殰鎴栫淮淇腑,涓嶇鍚堝綊杩樻搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳晥鐨勬ā鍏蜂簩缁寸爜淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿褰掕繕鎻愪氦]
+ public static ToMessage MouldReturnSave(string mouldcode, string description, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍐欏叆妯″叿澶栧�熻褰曡〃(涓嬫満鎿嶄綔)
+ sql = @"insert into TMould_LendOutReord(mould_code,type,description,is_ledout,lm_user,lm_date)
+ values(@mould_code,@type,@description,@is_ledout,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mould_code = mouldcode,
+ type = "IN",
+ description = description,
+ is_ledout = "N",
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //鍥炲啓妯″叿澶栧�熻褰曡〃澶栧�熸爣璇�(娓呴櫎)
+ sql = @"update TMould_LendOutReord set is_ledout='N' where mould_code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+
+ //鍥炲啓妯″叿娓呭崟,浣跨敤鐘舵��(褰掕繕)
+ sql = @"update TMouldInfo set usestatus='8' where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿褰掕繕", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "妯″叿褰掕繕鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "妯″叿褰掕繕澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿鍏ュ簱,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldInWareHouseQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠妯″叿褰撳墠浣跨敤鐘舵��
+ sql = @"select code,name,spec,status,usestatus,surp_life,resi_life
+ from TMouldInfo where code=@mouldcode";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ if (dt.Rows[0]["status"].ToString() == "Y")
+ {
+ switch (dt.Rows[0]["usestatus"].ToString())
+ {
+ case "0": //鍦ㄥ簱
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鍦ㄥ簱鐘舵��,涓嶇鍚堝叆搴撴搷浣�!";
+ mes.data = null;
+ return mes;
+ case "2": //涓婃満
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿涓婃満鐘舵��,涓嶇鍚堝叆搴撴搷浣�!";
+ mes.data = null;
+ return mes;
+ case "7": //澶栧��
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿澶栧�熺姸鎬�,涓嶇鍚堝叆搴撴搷浣�!";
+ mes.data = null;
+ return mes;
+ default:
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dt;
+ break;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "妯″叿鏁呴殰鎴栫淮淇腑,涓嶅厑璁稿叆搴撴搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳晥鐨勬ā鍏蜂簩缁寸爜淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鍏ュ簱鎻愪氦]
+ public static ToMessage MouldInWareHouseSave(string mouldcode, string warehousecode,string locationcode, string description, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍐欏叆妯″叿鍑哄叆搴撹褰曡〃(鍏ュ簱鎿嶄綔)
+ sql = @"insert into TMould_InOutReord(mould_code,type,warehouse_code,location_code,description,lm_user,lm_date)
+ values(@mould_code,@type,@warehouse_code,@location_code,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mould_code = mouldcode,
+ type = "IN",
+ warehouse_code = warehousecode,
+ location_code = locationcode,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ //鍥炲啓妯″叿娓呭崟,浣跨敤鐘舵��(鍏ュ簱),浠撳簱缂栫爜
+ sql = @"update TMouldInfo set usestatus='0',warehousecode=@warehousecode,location_code=@location_code where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode, warehousecode = warehousecode, location_code = locationcode } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿鍏ュ簱", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "妯″叿鍏ュ簱鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "妯″叿鍏ュ簱澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿鍑哄簱,鎵弿妯″叿缂栫爜]
+ public static ToMessage MouldOutWareHouseQrCodeData(string mouldcode)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠妯″叿褰撳墠浣跨敤鐘舵��
+ sql = @"select * from TMouldInfo where code=@mouldcode ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ if (dt.Rows[0]["status"].ToString() == "Y")
+ {
+ //鍒ゆ柇褰撳墠妯″叿鏄惁鍦ㄥ鍊熺姸鎬�
+ sql = @"select M.code as mould_code,M.name as mould_name,M.spec as mould_spec,
+ M.surp_life,M.resi_life,M.warehousecode,C.name as warehousename,M.location_code,L.name as location_name
+ from TMouldInfo M
+ left join TSecStck C on M.warehousecode=C.code
+ left join TSecLoca L on M.location_code=L.code
+ where M.code=@mouldcode and M.usestatus='0'";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠妯″叿鏈湪搴�,涓嶇鍚堝嚭搴撴搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "妯″叿鏁呴殰鎴栫淮淇腑,涓嶇鍚堝嚭搴撴搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏃犳晥鐨勬ā鍏蜂簩缁寸爜淇℃伅!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鍑哄簱鎻愪氦]
+ public static ToMessage MouldOutWareHouseSave(string mouldcode, string warehousecode,string locationcode, string description, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //鍐欏叆妯″叿鍑哄叆搴撹褰曡〃(鍑哄簱鎿嶄綔)
+ sql = @"insert into TMould_InOutReord(mould_code,type,warehouse_code,location_code,description,lm_user,lm_date)
+ values(@mould_code,@type,@warehouse_code,@location_code,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mould_code = mouldcode,
+ type = "OUT",
+ warehouse_code = warehousecode,
+ location_code= locationcode,
+ description = description,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ //鍥炲啓妯″叿娓呭崟,浣跨敤鐘舵��(鍑哄簱),娓呴櫎浠撳簱缂栫爜
+ sql = @"update TMouldInfo set usestatus='1',warehousecode=@warehousecode,location_code=@location_code where code=@mouldcode";
+ list.Add(new { str = sql, parm = new { mouldcode = mouldcode, warehousecode ="", location_code="" } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "妯″叿鍑哄簱", "妯″叿:" + mouldcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "妯″叿鍑哄簱鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "妯″叿鍑哄簱澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿鐐规璁板綍鏌ヨ]
+ public static ToMessage MouldCheckTakeSearch(string mouldcode, string mouldname, string mouldspec, string stanedcode, string stanedname, string checkuser, string checkopendate, string checkclosedate,string checkrequest, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and E.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and E.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (stanedcode != "" && stanedcode != null)
+ {
+ search += "and M.code like '%'+@stanedcode+'%' ";
+ dynamicParams.Add("@stanedcode", stanedcode);
+ }
+ if (stanedname != "" && stanedname != null)
+ {
+ search += "and M.name like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@stanedname", stanedname);
+ }
+ if (checkuser != "" && checkuser != null)
+ {
+ search += "and U.username like '%'+@checkuser+'%' ";
+ dynamicParams.Add("@checkuser", checkuser);
+ }
+ if (checkrequest != "" && checkrequest != null)
+ {
+ search += "and A.chk_result=@checkrequest ";
+ dynamicParams.Add("@checkrequest", checkrequest);
+ }
+ if (checkopendate != "" && checkopendate != null)
+ {
+ search += "and A.chk_date between @checkopendate and @checkclosedate ";
+ dynamicParams.Add("@checkopendate", checkopendate + " 00:00:00");
+ dynamicParams.Add("@checkclosedate", checkclosedate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.djwo,A.mould_code,E.name as mould_name,E.spec as mould_spec,M.code as stanedcode,M.name as stanedname,
+ U.username as chk_user,A.chk_result,A.chk_date
+ from TMouldchk_Proc_Main A
+ left join TMouldInfo E on A.mould_code=E.code
+ left join TMouldchk_Main M on A.mouldchkmain_code=M.code
+ left join TUser U on A.chk_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage MouldCheckSubTakeSearch(string id)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select A.seq,T.code as itemcode,T.name as itemname,A.result,A.chk_value,A.remark
+ from TMouldchk_Proc_Deta A
+ left join TMouldchk_Item T on A.mouldchkdeta_code=T.code
+ where A.m_id=@id";
+ dynamicParams.Add("@id", id);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鐐规璁板綍瀵煎嚭]
+ public static ToMessage MouldCheckTakeOutExcel(string mouldcode, string mouldname, string mouldspec, string stanedcode, string stanedname, string checkuser, string checkopendate, string checkclosedate,string checkrequest)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and E.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and E.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (stanedcode != "" && stanedcode != null)
+ {
+ search += "and M.code like '%'+@stanedcode+'%' ";
+ dynamicParams.Add("@stanedcode", stanedcode);
+ }
+ if (stanedname != "" && stanedname != null)
+ {
+ search += "and M.name like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@stanedname", stanedname);
+ }
+ if (checkuser != "" && checkuser != null)
+ {
+ search += "and U.username like '%'+@checkuser+'%' ";
+ dynamicParams.Add("@checkuser", checkuser);
+ }
+ if (checkrequest != "" && checkrequest != null)
+ {
+ search += "and A.chk_result=@checkrequest ";
+ dynamicParams.Add("@checkrequest", checkrequest);
+ }
+ if (checkopendate != "" && checkopendate != null)
+ {
+ search += "and A.chk_date between @checkopendate and @checkclosedate ";
+ dynamicParams.Add("@checkopendate", checkopendate + " 00:00:00");
+ dynamicParams.Add("@checkclosedate", checkclosedate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN A.djwo
+ ELSE ''END AS '鐐规鍗曞彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN A.mould_code
+ ELSE ''END AS '妯″叿缂栧彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN E.name
+ ELSE ''END AS '妯″叿鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN E.spec
+ ELSE ''END AS '瑙勬牸鍨嬪彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN A.mouldchkmain_code
+ ELSE ''END AS '鐐规鏍囧噯缂栫爜',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN M.name
+ ELSE ''END AS '鐐规鏍囧噯鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN U.username
+ ELSE ''END AS '妫�楠屼汉鍛�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN A.chk_result
+ ELSE ''END AS '妫�楠岀粨鏋�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.djwo ORDER BY B.mouldchkdeta_code) = 1 THEN A.chk_date
+ END AS '妫�楠屾椂闂�',
+ B.seq as '鐐规閮ㄤ綅搴忓彿',H.code '鐐规閮ㄤ綅缂栫爜',H.name '鐐规閮ㄤ綅鍚嶇О',B.result '鐐规缁撴灉',B.chk_value '鏁板��',B.remark '澶囨敞'
+ from TMouldchk_Proc_Main A
+ left join TMouldchk_Proc_Deta B on A.id=B.m_id
+ left join TMouldInfo E on A.mould_code=E.code
+ left join TMouldchk_Main M on A.mouldchkmain_code=M.code
+ left join TMouldchk_Item H on B.mouldchkdeta_code=H.code
+ left join TUser U on A.chk_user=U.usercode
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "妯″叿鐐规璁板綍鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿淇濆吇璁板綍鏌ヨ]
+ public static ToMessage MouldRepairTakeSearch(string mouldcode, string mouldname, string mouldspec, string stanedcode, string stanedname, string repairuser, string repairopendate, string repairclosedate, string repairresult, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and E.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and E.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (stanedcode != "" && stanedcode != null)
+ {
+ search += "and M.code like '%'+@stanedcode+'%' ";
+ dynamicParams.Add("@stanedcode", stanedcode);
+ }
+ if (stanedname != "" && stanedname != null)
+ {
+ search += "and M.name like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@stanedname", stanedname);
+ }
+ if (repairuser != "" && repairuser != null)
+ {
+ search += "and U.username like '%'+@repairuser+'%' ";
+ dynamicParams.Add("@repairuser", repairuser);
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and A.maint_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+ if (repairresult != "" && repairresult != null)
+ {
+ search += "and A.maint_result=@repairresult ";
+ dynamicParams.Add("@repairresult", repairresult);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id,A.bywo,A.mould_code,E.name as mould_name,E.spec as mould_spec,M.code as stanedcode,M.name as stanedname,
+ U.username as maint_user,A.maint_result,A.maint_date
+ from TMouldmaint_Proc_Main A
+ left join TMouldInfo E on A.mould_code=E.code
+ left join TMouldmai_Main M on A.mouldmaint_code=M.code
+ left join TUser U on A.maint_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage MouldRepairSubTakeSearch(string id)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select A.seq,T.code as itemcode,T.name as itemname,A.result,A.maint_value,A.remark
+ from TMouldmaint_Proc_Deta A
+ left join TMouldmai_Item T on A.mouldmaideta_code=T.code
+ where A.m_id=@id";
+ dynamicParams.Add("@id", id);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿淇濆吇璁板綍瀵煎嚭]
+ public static ToMessage MouldRepairTakeOutExcel(string mouldcode, string mouldname, string mouldspec, string stanedcode, string stanedname, string repairuser, string repairopendate, string repairclosedate, string repairresult)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and E.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and E.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (stanedcode != "" && stanedcode != null)
+ {
+ search += "and M.code like '%'+@stanedcode+'%' ";
+ dynamicParams.Add("@stanedcode", stanedcode);
+ }
+ if (stanedname != "" && stanedname != null)
+ {
+ search += "and M.name like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@stanedname", stanedname);
+ }
+ if (repairuser != "" && repairuser != null)
+ {
+ search += "and U.username like '%'+@repairuser+'%' ";
+ dynamicParams.Add("@repairuser", repairuser);
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and A.maint_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+ if (repairresult != "" && repairresult != null)
+ {
+ search += "and A.maint_result=@repairresult ";
+ dynamicParams.Add("@repairresult", repairresult);
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.mouldmaideta_code) = 1 THEN A.bywo
+ ELSE ''END AS '淇濆吇鍗曞彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.mouldmaideta_code) = 1 THEN A.mould_code
+ ELSE ''END AS '妯″叿缂栫爜',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.mouldmaideta_code) = 1 THEN E.name
+ ELSE ''END AS '妯″叿鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.mouldmaideta_code) = 1 THEN E.spec
+ ELSE ''END AS '瑙勬牸鍨嬪彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.mouldmaideta_code) = 1 THEN A.mouldmaint_code
+ ELSE ''END AS '淇濆吇鏍囧噯缂栫爜',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.mouldmaideta_code) = 1 THEN M.name
+ ELSE ''END AS '淇濆吇鏍囧噯鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.mouldmaideta_code) = 1 THEN U.username
+ ELSE ''END AS '淇濆吇浜哄憳',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.bywo ORDER BY B.mouldmaideta_code) = 1 THEN A.maint_result
+ ELSE ''END AS '淇濆吇缁撴灉',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.maint_date ORDER BY B.mouldmaideta_code) = 1 THEN A.maint_date
+ END AS '淇濆吇鏃堕棿',
+ B.seq as '淇濆吇閮ㄤ綅搴忓彿',H.code '淇濆吇閮ㄤ綅缂栫爜',H.name '淇濆吇閮ㄤ綅鍚嶇О',B.result '淇濆吇缁撴灉',B.maint_value '鏁板��',B.remark '澶囨敞'
+ from TMouldmaint_Proc_Main A
+ left join TMouldmaint_Proc_Deta B on A.id=B.m_id
+ left join TMouldInfo E on A.mould_code=E.code
+ left join TMouldmai_Main M on A.mouldmaint_code=M.code
+ left join TMouldmai_Item H on B.mouldmaideta_code=H.code
+ left join TUser U on A.maint_user=U.usercode
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "妯″叿淇濆吇璁板綍鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿缁翠慨璁板綍鏌ヨ]
+ public static ToMessage MouldUpdateSearch(string mouldcode, string mouldname, string mouldspec, string reportuser, string repairuser, string vrifcatuser, string reportopendate, string reportclosedate, string repairopendate, string repairclosedate, string vrifcatopendate, string vrifcatclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and E.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and E.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and U.username like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (repairuser != "" && repairuser != null)
+ {
+ search += "and R.username like '%'+@repairuser+'%' ";
+ dynamicParams.Add("@repairuser", repairuser);
+ }
+ if (vrifcatuser != "" && vrifcatuser != null)
+ {
+ search += "and V.username like '%'+@vrifcatuser+'%' ";
+ dynamicParams.Add("@vrifcatuser", vrifcatuser);
+ }
+ if (reportopendate != "" && reportopendate != null)
+ {
+ search += "and B.request_date between @reportopendate and @reportclosedate ";
+ dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00");
+ dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59");
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and A.repair_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+ if (vrifcatopendate != "" && vrifcatopendate != null)
+ {
+ search += "and A.verify_date between @vrifcatopendate and @vrifcatclosedate ";
+ dynamicParams.Add("@vrifcatopendate", vrifcatopendate + " 00:00:00");
+ dynamicParams.Add("@vrifcatclosedate", vrifcatclosedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.repair_code,A.mould_code,E.name as mould_name,E.spec as mould_spec,U.username as request_person,B.request_date,
+ R.username as repair_person,A.repair_date,CAST(datediff(minute, B.request_date,A.repair_date)/60.0 AS decimal(9,1)) as cycleDate,
+ V.username as verify_person,A.verify_date,(case when A.verify_result='OK' then '閫氳繃' when A.verify_result='NG' then '涓嶉�氳繃' end)as verify_result
+ from TMould_Repair A
+ left join TMould_RepairRequest B on A.source_wo=B.docu_code
+ left join TMouldInfo E on A.mould_code=E.code
+ left join TUser U on B.request_person=U.usercode
+ left join TUser R on A.repair_person=R.usercode
+ left join TUser V on A.verify_person=V.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨璁板綍鏄庣粏鏌ヨ]
+ public static ToMessage MouldUpdateSubSearch(string repair_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<object, object> Dict = new Dictionary<object, object>();
+ try
+ {
+ //鑾峰彇妯″叿鎶ヤ慨鐢宠鏁版嵁
+ sql = @"select B.docu_code,
+ (
+ case when B.source='A' then '妯″叿鐐规'
+ when B.source='B' then '妯″叿淇濆吇'
+ when B.source='C' then '鎵嬪伐'
+ end
+ ) as source,B.failure_descript
+ from TMould_Repair A
+ left join TMould_RepairRequest B on A.source_wo=B.docu_code
+ where A.repair_code=@repair_code";
+ dynamicParams.Add("@repair_code", repair_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ DeviceReport report = new DeviceReport();
+ report.faultsource = data.Rows[0]["source"].ToString();
+ report.faultdescr = data.Rows[0]["failure_descript"].ToString();
+ //鑾峰彇妯″叿鎶ヤ慨鐢宠鍥剧墖鏁版嵁
+ sql = @"select M.img1url from TMould_Repair A
+ left join TMould_RepairRequest B on A.source_wo=B.docu_code
+ left join TMould_RepairImage M on B.docu_code=M.source_wo
+ where A.repair_code=@repair_code and M.wo_type='REPA'";
+ dynamicParams.Add("@repair_code", repair_code);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ report.faultimage = data0;
+ Dict.Add("data1", report);
+
+ //鑾峰彇妯″叿缁翠慨鏁版嵁
+ sql = @"select A.failure_descript,A.is_shutdown,A.repair_content,A.repair_part
+ from TMould_Repair A
+ left join TMould_RepairRequest B on A.source_wo=B.docu_code
+ where A.repair_code=@repair_code";
+ dynamicParams.Add("@repair_code", repair_code);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ DeviceRepair repair = new DeviceRepair();
+ repair.faultdescr = data1.Rows[0]["failure_descript"].ToString();
+ repair.isstoprepair = data1.Rows[0]["is_shutdown"].ToString();
+ repair.repaircontent = data1.Rows[0]["repair_content"].ToString();
+ repair.repairpart = data1.Rows[0]["repair_part"].ToString();
+ //鑾峰彇妯″叿缁翠慨鍥剧墖鏁版嵁
+ sql = @"select M.img1url from TMould_Repair A
+ left join TMould_RepairImage M on A.repair_code=M.source_wo
+ where A.repair_code=@repair_code and M.wo_type='COMP'";
+ dynamicParams.Add("@repair_code", repair_code);
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ repair.repairimage = data3;
+ Dict.Add("data2", repair);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = Dict;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿缁翠慨璁板綍瀵煎嚭]
+ public static ToMessage MouldUpdateSearch(string mouldcode, string mouldname, string mouldspec, string reportuser, string repairuser, string vrifcatuser, string reportopendate, string reportclosedate, string repairopendate, string repairclosedate, string vrifcatopendate, string vrifcatclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and E.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and E.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and U.username like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (repairuser != "" && repairuser != null)
+ {
+ search += "and R.username like '%'+@repairuser+'%' ";
+ dynamicParams.Add("@repairuser", repairuser);
+ }
+ if (vrifcatuser != "" && vrifcatuser != null)
+ {
+ search += "and V.username like '%'+@vrifcatuser+'%' ";
+ dynamicParams.Add("@vrifcatuser", vrifcatuser);
+ }
+ if (reportopendate != "" && reportopendate != null)
+ {
+ search += "and B.request_date between @reportopendate and @reportclosedate ";
+ dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00");
+ dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59");
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and A.repair_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+ if (vrifcatopendate != "" && vrifcatopendate != null)
+ {
+ search += "and A.verify_date between @vrifcatopendate and @vrifcatclosedate ";
+ dynamicParams.Add("@vrifcatopendate", vrifcatopendate + " 00:00:00");
+ dynamicParams.Add("@vrifcatclosedate", vrifcatclosedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.repair_code as '缁翠慨鍗曞彿',A.mould_code as '妯″叿缂栫爜',E.name as '妯″叿鍚嶇О',E.spec as '瑙勬牸鍨嬪彿',
+ U.username as '鎶ヤ慨浜哄憳',B.request_date as '鎶ヤ慨鏃堕棿',R.username as '缁翠慨浜哄憳',A.repair_date as '缁翠慨鏃堕棿',
+ CAST(datediff(minute, B.request_date,A.repair_date)/60.0 AS decimal(9,1)) as '缁翠慨鏃堕暱',
+ V.username as '楠岃瘉浜哄憳',A.verify_date as '楠岃瘉鏃堕棿',(case when A.verify_result='OK' then '閫氳繃' when A.verify_result='NG' then '涓嶉�氳繃' end) as '楠岃瘉缁撴灉'
+ from TMould_Repair A
+ left join TMould_RepairRequest B on A.source_wo=B.docu_code
+ left join TMouldInfo E on A.mould_code=E.code
+ left join TUser U on B.request_person=U.usercode
+ left join TUser R on A.repair_person=R.usercode
+ left join TUser V on A.verify_person=V.usercode
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "妯″叿缁翠慨璁板綍鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿涓婁笅鏈鸿褰曟煡璇
+ public static ToMessage MouldUpDownMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string devicecode, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and M.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and M.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (type != "" && type != null)
+ {
+ search += "and A.type=@type ";
+ dynamicParams.Add("@type", type);
+ }
+ if (devicecode != "" && devicecode != null)
+ {
+ search += "and A.eqp_code=@devicecode ";
+ dynamicParams.Add("@devicecode", devicecode);
+ }
+ if (operuser != "" && operuser != null)
+ {
+ search += "and U.username like '%'+@operuser+'%' ";
+ dynamicParams.Add("@operuser", operuser);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and A.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.mould_code,M.name as mould_name,M.spec as mould_spec,
+ (case when A.type='UP' then '涓婃満' else '涓嬫満' end) as type,A.usecount_life,
+ A.eqp_code,E.name as eqp_name,U.username as lm_user,A.lm_date
+ from TMould_UpDownReord A
+ left join TMouldInfo M on A.mould_code=M.code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿涓婁笅鏈鸿瀵煎嚭Excel]
+ public static ToMessage MouldUpDownMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string devicecode, string operuser, string opendate, string closedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and M.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and M.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (type != "" && type != null)
+ {
+ search += "and A.type=@type ";
+ dynamicParams.Add("@type", type);
+ }
+ if (devicecode != "" && devicecode != null)
+ {
+ search += "and A.eqp_code=@devicecode ";
+ dynamicParams.Add("@devicecode", devicecode);
+ }
+ if (operuser != "" && operuser != null)
+ {
+ search += "and U.username like '%'+@operuser+'%' ";
+ dynamicParams.Add("@operuser", operuser);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and A.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.mould_code as '妯″叿缂栫爜',M.name as '妯″叿鍚嶇О',M.spec as '妯″叿瑙勬牸',
+ (case when A.type='UP' then '涓婃満' else '涓嬫満' end) as '鎿嶄綔绫诲瀷',A.usecount_life as '鏈浣跨敤',
+ A.eqp_code as '璁惧缂栫爜',E.name as '璁惧鍚嶇О',U.username as '鎿嶄綔浜哄憳',A.lm_date as '鎿嶄綔鏃堕棿'
+ from TMould_UpDownReord A
+ left join TMouldInfo M on A.mould_code=M.code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "妯″叿涓婁笅鏈鸿褰曟姤琛�");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿鍊熻繕璁板綍鏌ヨ]
+ public static ToMessage MouldCirculateMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and M.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and M.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (type != "" && type != null)
+ {
+ search += "and A.type=@type ";
+ dynamicParams.Add("@type", type);
+ }
+ if (operuser != "" && operuser != null)
+ {
+ search += "and U.username like '%'+@operuser+'%' ";
+ dynamicParams.Add("@operuser", operuser);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and A.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.mould_code,M.name as mould_name,M.spec as mould_spec,
+ (case when A.type='OUT' then '澶栧��' else '褰掕繕' end) as type,
+ A.description,U.username as lm_user,A.lm_date
+ from TMould_LendOutReord A
+ left join TMouldInfo M on A.mould_code=M.code
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鍊熻繕璁板綍瀵煎嚭]
+ public static ToMessage MouldCirculateMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string operuser, string opendate, string closedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and M.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and M.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (type != "" && type != null)
+ {
+ search += "and A.type=@type ";
+ dynamicParams.Add("@type", type);
+ }
+ if (operuser != "" && operuser != null)
+ {
+ search += "and U.username like '%'+@operuser+'%' ";
+ dynamicParams.Add("@operuser", operuser);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and A.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.mould_code as '妯″叿缂栫爜',M.name as '妯″叿鍚嶇О',M.spec as '瑙勬牸鍨嬪彿',
+ (case when A.type='OUT' then '澶栧��' else '褰掕繕' end) as '鎿嶄綔绫诲瀷',
+ A.description as '鎻忚堪',U.username as '鎿嶄綔浜哄憳',A.lm_date as '鎿嶄綔鏃堕棿'
+ from TMould_LendOutReord A
+ left join TMouldInfo M on A.mould_code=M.code
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "妯″叿鍊熻繕璁板綍鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[妯″叿鍑哄叆搴撹褰曟煡璇
+ public static ToMessage MouldInOutMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string warehousecode, string locationcode, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and M.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and M.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (type != "" && type != null)
+ {
+ search += "and A.type=@type ";
+ dynamicParams.Add("@type", type);
+ }
+ if (warehousecode != "" && warehousecode != null)
+ {
+ search += "and A.warehouse_code=@warehousecode ";
+ dynamicParams.Add("@warehousecode", warehousecode);
+ }
+ if (locationcode != "" && locationcode != null)
+ {
+ search += "and A.location_code=@locationcode ";
+ dynamicParams.Add("@locationcode", locationcode);
+ }
+ if (operuser != "" && operuser != null)
+ {
+ search += "and U.username like '%'+@operuser+'%' ";
+ dynamicParams.Add("@operuser", operuser);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and A.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.mould_code,M.name as mould_name,M.spec as mould_spec,A.warehouse_code,S.name as warehouse_name,
+ A.location_code,L.name as location_name,(case when A.type='OUT' then '鍑哄簱' else '鍏ュ簱' end) as type,
+ A.description,U.username as lm_user,A.lm_date
+ from TMould_InOutReord A
+ left join TMouldInfo M on A.mould_code=M.code
+ left join TSecStck S on A.warehouse_code=S.code
+ left join TSecLoca L on A.location_code=L.code
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[妯″叿鍑哄叆搴撹褰曞鍑篯
+ public static ToMessage MouldInOutMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string warehousecode, string locationcode, string operuser, string opendate, string closedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mouldcode != "" && mouldcode != null)
+ {
+ search += "and A.mould_code like '%'+@mouldcode+'%' ";
+ dynamicParams.Add("@mouldcode", mouldcode);
+ }
+ if (mouldname != "" && mouldname != null)
+ {
+ search += "and M.name like '%'+@mouldname+'%' ";
+ dynamicParams.Add("@mouldname", mouldname);
+ }
+ if (mouldspec != "" && mouldspec != null)
+ {
+ search += "and M.spec like '%'+@mouldspec+'%' ";
+ dynamicParams.Add("@mouldspec", mouldspec);
+ }
+ if (type != "" && type != null)
+ {
+ search += "and A.type=@type ";
+ dynamicParams.Add("@type", type);
+ }
+ if (warehousecode != "" && warehousecode != null)
+ {
+ search += "and A.warehouse_code=@warehousecode ";
+ dynamicParams.Add("@warehousecode", warehousecode);
+ }
+ if (locationcode != "" && locationcode != null)
+ {
+ search += "and A.location_code=@locationcode ";
+ dynamicParams.Add("@locationcode", locationcode);
+ }
+ if (operuser != "" && operuser != null)
+ {
+ search += "and U.username like '%'+@operuser+'%' ";
+ dynamicParams.Add("@operuser", operuser);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and A.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.mould_code as 妯″叿缂栫爜,M.name as 妯″叿鍚嶇О,M.spec as 瑙勬牸鍨嬪彿,A.warehouse_code as 浠撳簱缂栫爜,S.name as 浠撳簱鍚嶇О,
+ A.location_code as 搴撲綅缂栫爜,L.name as 搴撲綅鍚嶇О,(case when A.type='OUT' then '鍑哄簱' else '鍏ュ簱' end) as 鎿嶄綔绫诲瀷,
+ A.description as 鎻忚堪,U.username as 鎿嶄綔浜�,A.lm_date as 鎿嶄綔鏃堕棿
+ from TMould_InOutReord A
+ left join TMouldInfo M on A.mould_code=M.code
+ left join TSecStck S on A.warehouse_code=S.code
+ left join TSecLoca L on A.location_code=L.code
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "妯″叿鍑哄叆搴撹褰曟姤琛�");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/ProductModelDAL.cs b/VueWebCoreApi/DLL/DAL/ProductModelDAL.cs
new file mode 100644
index 0000000..180b3d3
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/ProductModelDAL.cs
@@ -0,0 +1,1292 @@
+锘縰sing Dapper;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.UnitMaterial;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class ProductModelDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[璁¢噺鍗曚綅缁勪俊鎭痌
+ public static ToMessage TUnitGroup()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁¢噺鍗曚綅缁勪俊鎭�
+ sql = @"select code,name,'1' as isGroup,data_sources from TUnitGroup ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ LogHelper.OperateLog("999", "鏌ヨ", "璁¢噺鍗曚綅缁勬煡璇㈡暟鎹负锛�" + JsonConvert.SerializeObject(data), "PC");
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅淇℃伅鍒楄〃]
+ public static ToMessage TUnitData(string tunittype, string tunitgroupcode, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sql = "";
+ IEnumerable<object> data;
+ try
+ {
+ if (tunittype == "" || tunittype == null)
+ {
+ sql = @"select AA.code,AA.name,U.username as lm_user,AA.lm_date,AA.isGroup,AA.idunitgroup,AA.data_sources
+ from(
+ select code,name,lm_user,lm_date,isGroup,idunitgroup,data_sources
+ from TUnit T
+ where T.isGroup='0'
+ union all
+ select code,name,lm_user,lm_date,'1' as isGroup,code as idunitgroup,data_sources
+ from TUnitGroup
+ ) as AA
+ left join TUser U on AA.lm_user=U.usercode ";
+ }
+ if (tunittype == "S") //鍗曡閲�
+ {
+ sql = @"select T.code,T.name,U.username as lm_user,T.lm_date,T.isGroup,T.idunitgroup,T.data_sources
+ from TUnit T
+ left join TUser U on T.lm_user=U.usercode
+ where T.isSingleUnit='1' and T.isGroup='0'";
+ }
+ if (tunittype == "M" && (tunitgroupcode == "" || tunitgroupcode == null)) //澶氳閲�,涓斿璁¢噺缁勭紪鐮佷负绌�
+ {
+ sql = @"select T.code,T.name,U.usercode as lm_user,T.lm_date,'1' as isGroup,T.code as idunitgroup,T.data_sources
+ from TUnitGroup T
+ left join TUser U on T.lm_user=U.usercode";
+ }
+ if (tunittype == "M" && (tunitgroupcode != "" && tunitgroupcode != null)) //澶氳閲�,涓斿璁¢噺缁勭紪鐮佷笉涓虹┖
+ {
+ sql = @"select T.code,T.name,T.isMainUnit,T.changeRate,T.rateDescription,U.username as lm_user,T.lm_date,T.isGroup,T.idunitgroup,T.data_sources
+ from TUnit T
+ left join TUser U on T.lm_user=U.usercode
+ where T.isSingleUnit='0' and T.isGroup='1' and T.idunitgroup=@tunitgroupcode";
+ dynamicParams.Add("@tunitgroupcode", tunitgroupcode);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ LogHelper.OperateLog("999", "鏌ヨ", "鏌ヨ浜嗚閲忓崟浣�", "PC");
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅缂栬緫鑾峰彇缁勬槑缁哴
+ public static ToMessage TUnitGroupProject(string unitcode, string isgroup, User us)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sql = "";
+ try
+ {
+ //鑾峰彇璁¢噺鍗曚綅缁勫搴旂殑璁¢噺鍗曚綅淇℃伅
+ sql = @"select code,name,isMainUnit,changeRate,rateDescription,lm_user,lm_date,data_sources
+ from TUnit where isSingleUnit='0' and isGroup=@isgroup and idunitgroup=@tunitgroupcode ";
+ dynamicParams.Add("@isGroup", isgroup);
+ dynamicParams.Add("@tunitgroupcode", unitcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅鏂板銆佺紪杈戜繚瀛榏
+ public static ToMessage AddUpdateTUnit(string menucode, string data_sources, string tunittype, string tunitgroupcode, string OperType, List<Unit> listjson, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ //鑾峰彇璁¢噺鍗曚綅缂栫爜
+ mes = SeachEncodeJob.EncodingSeach(menucode);
+ if (mes.code == "300")
+ {
+ return mes;
+ }
+ if (tunittype == "S") //鍗曡閲�
+ {
+ sql = @"select * from TUnit where isGroup='0' and name=@name";
+ dynamicParams.Add("@name", listjson[0].unitname);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁¢噺鍗曚綅鐨勫悕绉颁笉鑳介噸澶�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (tunittype == "M")//澶氳閲�
+ {
+ sql = @"select * from TUnitGroup where name=@name";
+ dynamicParams.Add("@name", listjson[0].unitname);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁¢噺鍗曚綅缁勭殑鍚嶇О涓嶈兘閲嶅,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍐欏叆璁¢噺鍗曚綅缁�
+ sql = @"insert into TUnitGroup(code,name,lm_user,lm_date,data_sources)
+ values(@code,@name,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = ((List<string>)mes.data)[0].ToString(),
+ name = listjson[0].unitname,
+ data_sources = data_sources,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ for (int i = 0; i < listjson[0].children.Count; i++)
+ {
+ //鍐欏叆璁¢噺鍗曚綅
+ sql = @"insert into TUnit(code,name,isMainUnit,changeRate,rateDescription,isSingleUnit,disabled,idunitgroup,isGroup,data_sources,lm_user,lm_date)
+ values(@code,@name,@isMainUnit,@changeRate,@rateDescription,@isSingleUnit,@disabled,@idunitgroup,@isGroup,@data_sources,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = tunittype == "S" ? ((List<string>)mes.data)[0].ToString() : listjson[0].children[i].unitcode,
+ name = listjson[0].children[i].unitname,
+ isMainUnit = listjson[0].children[i].isMainUnit,
+ changeRate = listjson[0].children[i].changeRate,
+ rateDescription = listjson[0].children[i].rateDescription,
+ isSingleUnit = listjson[0].children[i].isSingleUnit,
+ disabled = listjson[0].children[i].disabled,
+ idunitgroup = ((List<string>)mes.data)[0].ToString(),
+ isGroup = listjson[0].children[i].isGroup,
+ data_sources = data_sources,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鍥炲啓缂栫爜瑙勫垯琛�
+ list.AddRange(SeachEncodeJob.StrEncodingUpdate(menucode, ((List<string>)mes.data)[1].ToString()));
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗚閲忓崟浣嶏細"+ tunittype == "S" ? ((List<string>)mes.data)[0].ToString() : string.Join(",", listjson[0].children.Select(m => m.unitcode)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ if (tunittype == "S") //鍗曡閲�
+ {
+ sql = @"select * from TUnit where isGroup='0' and code<>@code and name=@name";
+ dynamicParams.Add("@code", listjson[0].unitcode);
+ dynamicParams.Add("@name", listjson[0].unitname);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁¢噺鍗曚綅鐨勫悕绉颁笉鑳介噸澶�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鏇存柊璁¢噺鍗曚綅(鍗曡閲�)
+ sql = @"update TUnit set name=@name,lm_user=@lm_user,lm_date=@lm_date
+ where code=@code and isSingleUnit=@isSingleUnit and isGroup=@isGroup";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = listjson[0].children[0].unitcode,
+ name = listjson[0].children[0].unitname,
+ isSingleUnit = listjson[0].children[0].isSingleUnit,
+ isGroup = listjson[0].children[0].isGroup,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ }
+ if (tunittype == "M")//澶氳閲�
+ {
+ sql = @"select * from TUnitGroup where code<>@code and name=@name";
+ dynamicParams.Add("@code", listjson[0].unitcode);
+ dynamicParams.Add("@name", listjson[0].unitname);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁¢噺鍗曚綅缁勭殑鍚嶇О涓嶈兘閲嶅,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //淇敼璁¢噺鍗曚綅缁�
+ sql = @"update TUnitGroup set name=@name,lm_user=@lm_user,lm_date=@lm_date where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = listjson[0].unitcode,
+ name = listjson[0].unitname,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ //鍒犻櫎璁¢噺鍗曚綅缁勬槑缁�(浠庤閲忓崟浣嶈〃鍒犻櫎)
+ sql = @"delete TUnit where idunitgroup=@idunitgroup";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ idunitgroup = tunitgroupcode
+ }
+ });
+ for (int i = 0; i < listjson[0].children.Count; i++)
+ {
+ //鍐欏叆璁¢噺鍗曚綅
+ sql = @"insert into TUnit(code,name,isMainUnit,changeRate,rateDescription,isSingleUnit,disabled,idunitgroup,isGroup,data_sources,lm_user,lm_date)
+ values(@code,@name,@isMainUnit,@changeRate,@rateDescription,@isSingleUnit,@disabled,@idunitgroup,@isGroup,@data_sources,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = listjson[0].children[i].unitcode,
+ name = listjson[0].children[i].unitname,
+ isMainUnit = listjson[0].children[i].isMainUnit,
+ changeRate = listjson[0].children[i].changeRate,
+ rateDescription = listjson[0].children[i].rateDescription,
+ isSingleUnit = listjson[0].children[i].isSingleUnit,
+ disabled = listjson[0].children[i].disabled,
+ idunitgroup = listjson[0].children[i].idunitgroup,
+ isGroup = listjson[0].children[i].isGroup,
+ data_sources = listjson[0].children[i].data_sources,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗚閲忓崟浣嶏細" + tunittype == "S" ? ((List<string>)mes.data)[0].ToString() : string.Join(",", listjson[0].children.Select(m => m.unitcode)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁¢噺鍗曚綅鍒犻櫎]
+ public static ToMessage DeleteTUnit(string data_sources, string tunittype, string tunitgroupcode, string tunitcode, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (tunittype == "S") //鍗曡閲�
+ {
+ sql = @"select * from TMateriel_Info where isSingleUnit='1' and idunit=@idunit";
+ dynamicParams.Add("@idunit", tunitcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍗曡閲忓崟浣嶅凡琚娇鐢�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎璁¢噺鍗曚綅
+ sql = @"delete TUnit where isSingleUnit='1' and isGroup='0' and code=@code and data_sources=@data_sources";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = tunitcode,
+ data_sources = data_sources
+ }
+ });
+ }
+ if (tunittype == "M" && (tunitgroupcode != "" || tunitgroupcode != null) && (tunitcode == "" || tunitcode == null)) //澶氳閲�,涓斿璁¢噺缁勭紪鐮佷笉涓虹┖,鏄庣粏缂栫爜涓虹┖
+ {
+ sql = @"select * from TUnit T
+ inner join TMateriel_Info M on T.idunitgroup=M.idunitgroup and T.code=M.idunit
+ where T.isSingleUnit='0' and T.idunitgroup=@idunitgroup";
+ dynamicParams.Add("@idunitgroup", tunitgroupcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶氳閲忓崟浣嶇粍涓湁璁¢噺鍗曚綅琚娇鐢�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎澶氳閲忓崟浣嶇粍
+ sql = @"delete TUnitGroup where code=@code and data_sources=@data_sources";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = tunitgroupcode,
+ data_sources = data_sources
+ }
+ });
+ //鍒犻櫎澶氳閲忓崟浣嶇粍涓嬫墍鏈夎閲忓崟浣�
+ sql = @"delete TUnit where isSingleUnit='0' and isGroup='1' and idunitgroup=@idunitgroup and data_sources=@data_sources";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ idunitgroup = tunitgroupcode,
+ data_sources = data_sources
+ }
+ });
+ }
+ if (tunittype == "M" && (tunitgroupcode != "" && tunitgroupcode != null) && (tunitcode != "" || tunitcode != null)) //澶氳閲�,涓斿璁¢噺缁勭紪鐮佷笉涓虹┖,鏄庣粏缂栫爜涓嶄负绌�
+ {
+ sql = @"select * from TUnit T
+ inner join TMateriel_Info M on T.idunitgroup=M.idunitgroup and T.code=M.idunit
+ where T.isSingleUnit='0' and M.isSingleUnit='0' and T.idunitgroup=@idunitgroup and T.code=@idunit";
+ dynamicParams.Add("@idunitgroup", tunitgroupcode);
+ dynamicParams.Add("@idunit", tunitcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶氳閲忓崟浣嶅凡琚娇鐢�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎澶氳閲忓崟浣嶇粍涓嬫寚瀹氳閲忓崟浣�
+ sql = @"delete TUnit where isSingleUnit='0' and isGroup='1' and idunitgroup=@idunitgroup and code=@code and data_sources=@data_sources";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ idunitgroup = tunitgroupcode,
+ code = tunitcode,
+ data_sources = data_sources
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗚閲忓崟浣嶏細" + tunittype == "S" ? tunitcode : tunittype == "M"&& (tunitgroupcode != "" || tunitgroupcode != null) && (tunitcode == "" || tunitcode == null)? tunitgroupcode: tunitgroupcode+"-->"+tunitcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[瀛樿揣鍒嗙被淇℃伅]
+ public static ToMessage TMaterielClassTree()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇瀛樿揣鍒嗙被淇℃伅
+ sql = @"select code,name,idparent,data_sources from TMateriel_Class ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ //LogHelper.OperateLog("999", "鏌ヨ", "瀛樿揣鍒嗙被鏌ヨ鏁版嵁涓猴細" + JsonConvert.SerializeObject(data), "PC");
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀛樿揣鍒嗙被鏂板/缂栬緫鎻愪氦]
+ public static ToMessage TMaterielClassTreeAddUpdate(string data_sources, string inventoryclasscode, string inventoryclassname, string parentcode, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (parentcode != "" || parentcode != null) //瀛樿揣鍒嗙被涓婄骇缂栫爜涓虹┖
+ {
+ sql = @"select * from TMateriel_Info where idinventoryclass=@parentcode";
+ dynamicParams.Add("@parentcode", parentcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀛樿揣鍒嗙被涓婄骇涓嶈兘鏄凡鏈夊瓨璐х殑鍒嗙被锛岃閲嶆柊杈撳叆锛�";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (OperType == "Add")
+ {
+ //鍒ゆ柇瀛樿揣鍒嗙被缂栫爜鏄惁閲嶅
+ sql = @"select * from TMateriel_Class where code=@inventoryclasscode";
+ dynamicParams.Add("@inventoryclasscode", inventoryclasscode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀛樿揣鍒嗙被缂栫爜宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇瀛樿揣鍒嗙被鍚嶇О鏄惁閲嶅
+ sql = @"select * from TMateriel_Class where name=@inventoryclassname";
+ dynamicParams.Add("@inventoryclassname", inventoryclassname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀛樿揣鍒嗙被鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍐欏叆瀛樿揣鍒嗙被
+ sql = @"insert into TMateriel_Class(code,name,idparent,lm_user,lm_date,data_sources)
+ values(@code,@name,@idparent,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = inventoryclasscode,
+ name = inventoryclassname,
+ idparent = parentcode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗瓨璐у垎绫�:"+ inventoryclasscode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇瀛樿揣鍒嗙被鍚嶇О鏄惁閲嶅
+ sql = @"select * from TMateriel_Class where code<>@inventoryclasscode and name=@inventoryclassname";
+ dynamicParams.Add("@inventoryclasscode", inventoryclasscode);
+ dynamicParams.Add("@inventoryclassname", inventoryclassname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀛樿揣鍒嗙被鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鏇存柊瀛樿揣鍒嗙被
+ sql = @"update TMateriel_Class set name=@name,idparent=@idparent,lm_user=@lm_user,lm_date=@lm_date where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = inventoryclasscode,
+ name = inventoryclassname,
+ idparent = parentcode,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗瓨璐у垎绫�:"+ inventoryclasscode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀛樿揣鍒嗙被鍒犻櫎]
+ public static ToMessage TMaterielClassTreeDelete(string inventoryclasscode, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string[] classcode = Array.ConvertAll<string, string>(inventoryclasscode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ //鍒ゆ柇瀛樿揣鍒嗙被鏄惁琚瓨璐т俊鎭紩鐢�
+ sql = @"select * from TMateriel_Info where idinventoryclass in @inventoryclasscode";
+ dynamicParams.Add("@inventoryclasscode", classcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠瀛樿揣鍒嗙被鎴栦笅绾ц寮曠敤涓嶅厑璁稿垹闄わ紒";
+ mes.data = null;
+ return mes;
+ }
+ //鏇存柊瀛樿揣鍒嗙被
+ sql = @"delete TMateriel_Class where code in @code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = classcode
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗瓨璐у垎绫�"+classcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[瀛樿揣淇℃伅鍒楄〃]
+ public static ToMessage TMaterielData(string inventoryclasscode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "", sql = "";
+ IEnumerable<object> data;
+ try
+ {
+ if (inventoryclasscode != "" && inventoryclasscode != null)
+ {
+ string[] classcode = Array.ConvertAll<string, string>(inventoryclasscode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ search += "and M.idinventoryclass in @classcode ";
+ dynamicParams.Add("@classcode", classcode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and M.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and M.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and M.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ sql = @"select M.partcode,M.partname,M.partspec,M.idunit as idunitcode,T.name as idunitname,M.idunitgroup as idunitgroupcode,G.name as idunitgroupname,
+ M.isSingleUnit,M.idSubUnitByReport as idSubUnitByReportcode,R.name as idSubUnitByReportname,M.idUnitByStock as idUnitByStockcode,K.name as idUnitByStockname,
+ M.idUnitByPurchase as idUnitByPurchasecode,P.name as idUnitByPurchasename,M.idUnitBySale as idUnitBySalecode,S.name as idUnitBySalename,
+ M.idunitbymanufacture as idunitbymanufacturecode,F.name as idunitbymanufacturename,M.idinventoryclass as idinventoryclasscode,C.name as idinventoryclassname,
+ M.isPurchase,M.isSale,M.isMadeSelf,M.isMaterial,M.isMadeRequest,M.idwarehouse as idwarehousecode,H.name as idwarehousename,M.lowQuantity,M.topQuantity,M.safeQuantity,
+ M.status,U.username as lm_user,M.lm_date,M.data_sources,M.is_retdproc,M.default_route,M.priuserdefnvc1,M.priuserdefnvc2,M.priuserdefnvc3,M.priuserdefnvc4,M.priuserdefnvc5,M.priuserdefnvc6
+ from TMateriel_Info M
+ left join TUnit T on M.idunit=T.code
+ left join TUnit R on M.idSubUnitByReport=R.code
+ left join TUnit K on M.idUnitByStock=K.code
+ left join TUnit P on M.idUnitByPurchase=P.code
+ left join TUnit S on M.idUnitBySale=S.code
+ left join TUnit F on M.idunitbymanufacture=F.code
+ left join TMateriel_Class C on M.idinventoryclass=C.code
+ left join TUnitGroup G on M.idunitgroup=G.code
+ left join TSecStck H on M.idwarehouse=H.code
+ left join TUser U on M.lm_user=U.usercode
+ where 1=1 " + search;
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀛樿揣淇℃伅鏂板/缂栬緫淇濆瓨]
+ public static ToMessage TMaterielAddUpdate(string data_sources, string partcode, string partname, string partspec, string inventoryclasscode, string unittypcode, string unitcode, string unitsubcode, string idSubUnitByReport, string idUnitByStock, string idUnitByPurchase, string idUnitBySale, string idunitbymanufacture, string isPurchase, string isSale, string isMadeSelf, string isMaterial, string isMadeRequest, string idwarehouse, string status, string OperType, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (OperType == "Add")
+ {
+ //鍒ゆ柇瀛樿揣妗f缂栫爜鏄惁閲嶅
+ sql = @"select * from TMateriel_Info where partcode=@partcode";
+ dynamicParams.Add("@partcode", partcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀛樿揣妗f缂栫爜宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇瀛樿揣妗f鍚嶇О鏄惁閲嶅
+ //sql = @"select * from TMateriel_Info where partname=@partname";
+ //dynamicParams.Add("@partname", partname);
+ //var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ //if (data1.Rows.Count > 0)
+ //{
+ // mes.code = "300";
+ // mes.count = 0;
+ // mes.message = "瀛樿揣妗f鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ // mes.data = null;
+ // return mes;
+ //}
+ //鍒ゆ柇瀛樿揣妗f瑙勬牸鏄惁閲嶅
+ //sql = @"select * from TMateriel_Info where partspec=@partspec";
+ //dynamicParams.Add("@partspec", partspec);
+ //var data2 = DapperHelper.selectdata(sql, dynamicParams);
+ //if (data2.Rows.Count > 0)
+ //{
+ // mes.code = "300";
+ // mes.count = 0;
+ // mes.message = "瀛樿揣妗f瑙勬牸宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ // mes.data = null;
+ // return mes;
+ //}
+ //鍐欏叆瀛樿揣鍒嗙被
+ sql = @"insert into TMateriel_Info(partcode,partname,partspec,idunit,idunitgroup,isSingleUnit,idSubUnitByReport,idUnitByStock,idUnitByPurchase,idUnitBySale,idunitbymanufacture,
+ idinventoryclass,isPurchase,isSale,isMadeSelf,isMaterial,isMadeRequest,idwarehouse,status,lm_user,lm_date,data_sources)
+ values(@partcode,@partname,@partspec,@idunit,@idunitgroup,@isSingleUnit,@idSubUnitByReport,@idUnitByStock,@idUnitByPurchase,@idUnitBySale,@idunitbymanufacture,
+ @idinventoryclass,@isPurchase,@isSale,@isMadeSelf,@isMaterial,@isMadeRequest,@idwarehouse,@status,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode=partcode,
+ partname=partname,
+ partspec=partspec,
+ idunit=unittypcode=="1"?unitcode:unitsubcode,
+ idunitgroup = unittypcode == "0"?"1":"0",
+ isSingleUnit= unittypcode,
+ idSubUnitByReport=idSubUnitByReport,
+ idUnitByStock= idUnitByStock,
+ idUnitByPurchase= idUnitByPurchase,
+ idUnitBySale= idUnitBySale,
+ idunitbymanufacture= idunitbymanufacture,
+ idinventoryclass= inventoryclasscode,
+ isPurchase= isPurchase,
+ isSale= isSale,
+ isMadeSelf= isMadeSelf,
+ isMaterial= isMaterial,
+ isMadeRequest= isMadeRequest,
+ idwarehouse= idwarehouse,
+ status= status,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗瓨璐ф。妗�:"+ partcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (OperType == "Update")
+ {
+ //鍒ゆ柇瀛樿揣妗f鍚嶇О鏄惁閲嶅
+ sql = @"select * from TMateriel_Info where partcode<>@partcode and partname=@partname";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@partname", partname);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀛樿揣妗f鍚嶇О宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇瀛樿揣妗f鍚嶇О鏄惁閲嶅
+ //sql = @"select * from TMateriel_Info where partcode<>@partcode and partspec=@partspec";
+ //dynamicParams.Add("@partcode", partcode);
+ //dynamicParams.Add("@partspec", partspec);
+ //var data2 = DapperHelper.selectdata(sql, dynamicParams);
+ //if (data2.Rows.Count > 0)
+ //{
+ // mes.code = "300";
+ // mes.count = 0;
+ // mes.message = "瀛樿揣妗f瑙勬牸鍨嬪彿宸插瓨鍦�,璇烽噸鏂拌緭鍏�!";
+ // mes.data = null;
+ // return mes;
+ //}
+ //鏇存柊瀛樿揣鍒嗙被
+ sql = @"update TMateriel_Info set partname=@partname,partspec=@partspec,idunit=@idunit,idunitgroup=@idunitgroup,isSingleUnit=@isSingleUnit,idSubUnitByReport=@idSubUnitByReport,idUnitByStock=@idUnitByStock,
+ idUnitByPurchase=@idUnitByPurchase,idUnitBySale=@idUnitBySale,idunitbymanufacture=@idunitbymanufacture,idinventoryclass=@idinventoryclass,isPurchase=@isPurchase,isSale=@isSale,isMadeSelf=@isMadeSelf,
+ isMaterial=@isMaterial,isMadeRequest=@isMadeRequest,idwarehouse=@idwarehouse,status=@status,lm_user=@lm_user,lm_date=@lm_date where partcode=@partcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = partcode,
+ partname = partname,
+ partspec = partspec,
+ idunit = unittypcode == "1" ? unitcode : unitsubcode,
+ idunitgroup = unittypcode == "0" ? "1" : "0",
+ isSingleUnit = unittypcode,
+ idSubUnitByReport = idSubUnitByReport,
+ idUnitByStock = idUnitByStock,
+ idUnitByPurchase = idUnitByPurchase,
+ idUnitBySale = idUnitBySale,
+ idunitbymanufacture = idunitbymanufacture,
+ idinventoryclass = inventoryclasscode,
+ isPurchase = isPurchase,
+ isSale = isSale,
+ isMadeSelf = isMadeSelf,
+ isMaterial = isMaterial,
+ isMadeRequest = isMadeRequest,
+ idwarehouse = idwarehouse,
+ status = status,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗瓨璐ф。妗�:"+ partcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀛樿揣淇℃伅鍒犻櫎]
+ public static ToMessage TMaterielDelete(string data_sources, string partcode, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇瀛樿揣妗f鏄惁琚鍗曞紩鐢�
+ sql = @"select * from TKimp_Ewo where materiel_code=@partcode";
+ dynamicParams.Add("@partcode", partcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠瀛樿揣鍒嗗凡琚紩鐢╗鐢熶骇璁㈠崟]涓嶅厑璁稿垹闄わ紒";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇瀛樿揣妗f鏄惁琚伐鍗曞紩鐢�
+ sql = @"select * from TK_Wrk_Man where materiel_code=@partcode";
+ dynamicParams.Add("@partcode", partcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠瀛樿揣宸茶寮曠敤[鐢熶骇宸ュ崟]涓嶅厑璁稿垹闄わ紒";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎瀛樿揣妗f
+ sql = @"delete TMateriel_Info where partcode=@partcode and data_sources=@data_sources";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = partcode,
+ data_sources= data_sources
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗瓨璐ф。妗�:"+partcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎鎴栧伐搴�)鏌ヨ]
+ public static ToMessage TMaterielFileAssociationRoute(string partcode,User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<MaterialRout> list = new List<MaterialRout>();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ //鑾峰彇宸ヨ壓璺嚎闆嗗悎(鍖呭惈鐗╂枡缁戝畾宸ヨ壓璺嚎鏍囪瘑)
+ sql = @"select distinct A.code as routecode,A.name as routename,(case when B.route_code is null then 'N' else 'Y' end) flag from TFlw_Rout A
+ left join (
+ select distinct route_code from TMateriel_Route where materiel_code=@partcode and is_delete<>'1'
+ ) B
+ on A.code=B.route_code
+ where A.is_delete='0' and A.enable='Y'";
+ dynamicParams.Add("@partcode", partcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ MaterialRout rout = new MaterialRout();
+ rout.code = dt.Rows[i]["ROUTECODE"].ToString();
+ rout.name = dt.Rows[i]["ROUTENAME"].ToString();
+ rout.flag = dt.Rows[i]["FLAG"].ToString();
+
+ //鏍规嵁宸ヨ壓璺嚎缂栫爜鑾峰彇鍏宠仈鐨勫伐搴忎俊鎭�
+ sql = @"select A.seq,B.stepcode,B.stepname,B.enable from TFlw_Rtdt A
+ inner join TStep B on A.step_code=B.stepcode
+ where A.rout_code=@route_code and B.is_delete<>'1' order by A.seq asc";
+ dynamicParams.Add("@route_code", rout.code);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ rout.Data = data0;
+ list.Add(rout);
+
+ }
+ mes.data = list;
+ }
+ else //宸ュ簭鐗�
+ {
+ //閫氳繃浜у搧缂栫爜鏌ユ壘鍏宠仈鐨勫伐搴忎俊鎭�
+ sql = @"select A.step_seq,A.step_code,S.stepname as step_name,A.isbott,A.isend
+ from (
+ select materiel_code,step_seq,step_code,isbott,isend from TMateriel_Step
+ where materiel_code=@partcode
+ ) as A
+ left join TStep S on A.step_code=S.stepcode";
+ dynamicParams.Add("@partcode", partcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.data = data;
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀛樿揣妗f鍏宠仈宸ヨ壓(宸ヨ壓璺嚎鎴栧伐搴�)鎻愪氦]
+ public static ToMessage SaveTMaterielFile(User us, List<MaterialCraftsSave> json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ if (json == null || json.Count <= 0)
+ {
+ //娓呴櫎鐗╂枡鍏宠仈宸ヨ壓璺嚎琛ㄦ暟鎹�
+ sql = @"delete TMateriel_Route where materiel_code=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode } });
+ //鏍囪鐗╂枡琛ㄥ叧鑱斿伐鑹鸿矾绾挎爣璇�
+ sql = @"update TMateriel_Info set is_retdproc='N',default_route='' where partcode=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode } });
+ //娓呴櫎鑺傛媿宸ヤ环琛ㄥ搴旀暟鎹�
+ sql = @"delete TPrteEqp_Stad where materiel_code=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode } });
+ }
+ else
+ {
+ //娓呴櫎瀛樿揣鍏宠仈宸ヨ壓璺嚎琛ㄦ暟鎹�
+ sql = @"delete TMateriel_Route where materiel_code=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode } });
+ //寰幆鍐欏叆瀛樿揣鍏宠仈宸ヨ壓璺嚎琛�
+ for (int i = 0; i < json[0].children.Count; i++)
+ {
+ sql = @"insert into TMateriel_Route(materiel_code,route_code,lm_user,lm_date) values(@materiel_code,@route_code,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ materiel_code = json[0].partcode,
+ route_code = json[0].children[i].code,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鏍囪鐗╂枡琛ㄥ叧鑱斿伐鑹鸿矾绾挎爣璇�
+ sql = @"update TMateriel_Info set is_retdproc='Y',default_route=@defaultroute_code where partcode=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode, defaultroute_code = json[0].defaultroute_code } });
+
+ //娓呴櫎鑺傛媿宸ヤ环琛ㄥ綋鍓嶄骇鍝佸搴斿伐鑹鸿矾绾夸笉鍖呭惈姝ゆ璁剧疆鐨勫叾瀹冩暟鎹�
+ //string鍒嗗壊杞瑂tring[]
+ string[] routcode = Array.ConvertAll<string, string>(string.Join(",", json[0].children.Select(s => s.code)).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString());
+ sql = @"delete TPrteEqp_Stad where materiel_code=@partcode and route_code not in @routecode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode, routecode= routcode } });
+ }
+ }
+ else //宸ュ簭鐗�
+ {
+ if (json == null || json.Count <= 0)
+ {
+ //娓呴櫎鐗╂枡鍏宠仈宸ヨ壓璺嚎琛ㄦ暟鎹�
+ sql = @"delete TMateriel_Step where materiel_code=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode } });
+ //鏍囪鐗╂枡琛ㄥ叧鑱斿伐鑹鸿矾绾挎爣璇�
+ sql = @"update TMateriel_Info set is_retdproc='N',default_route='' where partcode=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode } });
+ //娓呴櫎鑺傛媿宸ヤ环琛ㄥ搴旀暟鎹�
+ sql = @"delete TPrteEqp_Stad where materiel_code=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode } });
+ }
+ else
+ {
+ //娓呴櫎瀛樿揣鍏宠仈宸ヨ壓璺嚎琛ㄦ暟鎹�
+ sql = @"delete TMateriel_Step where materiel_code=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode } });
+ //寰幆鍐欏叆瀛樿揣鍏宠仈宸ヨ壓璺嚎琛�
+ for (int i = 0; i < json[0].children.Count; i++)
+ {
+ sql = @"insert into TMateriel_Step(materiel_code,step_seq,step_code,isbott,isend,lm_user,lm_date)
+ values(@materiel_code,@step_seq,@step_code,@isbott,@isend,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ materiel_code = json[0].partcode,
+ step_seq = json[0].children[i].seq,
+ step_code = json[0].children[i].code,
+ isbott = json[0].children[i].isbott,
+ isend = json[0].children[i].isend,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鏍囪鐗╂枡琛ㄥ叧鑱斿伐鑹鸿矾绾挎爣璇�
+ sql = @"update TMateriel_Info set is_retdproc='Y',default_route=@defaultroute_code where partcode=@partcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode, defaultroute_code = json[0].defaultroute_code } });
+
+ //娓呴櫎鑺傛媿宸ヤ环琛ㄥ綋鍓嶄骇鍝佸搴斿伐搴忎笉鍖呭惈姝ゆ璁剧疆鐨勫叾瀹冩暟鎹�
+ //string鍒嗗壊杞瑂tring[]
+ string[] stepcode = Array.ConvertAll<string, string>(string.Join(",", json[0].children.Select(s => s.code)).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString());
+ sql = @"delete TPrteEqp_Stad where materiel_code=@partcode and step_code not in @stepcode";
+ list.Add(new { str = sql, parm = new { partcode = json[0].partcode, stepcode = stepcode } });
+ }
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "瀛樿揣鍏宠仈宸ヨ壓", "浜у搧锛�"+json[0].partcode+"鍏宠仈浜嗗伐鑹�:" + string.Join(",", json[0].children.Select(s => s.code)), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[宸ュ崟浜у搧淇℃伅涓嬫媺妗嗘煡璇
+ public static ToMessage PartSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇鐗╂枡鏁版嵁
+ sql = @"select M.partcode,M.partname,M.partspec,M.idunit as uom_code,T.name as uom_name,
+ M.idunitgroup as stocktype_code,D.name as stocktype_name,
+ M.idwarehouse as stck_code,S.name as stck_name,M.default_route
+ from TMateriel_Info M
+ left join TUnit T on M.idunit=T.code
+ left join TUnitGroup D on M.idunitgroup=D.code
+ left join TSecStck S on M.idwarehouse=S.code ";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/ProductionManagementDAL.cs b/VueWebCoreApi/DLL/DAL/ProductionManagementDAL.cs
new file mode 100644
index 0000000..643c8ed
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/ProductionManagementDAL.cs
@@ -0,0 +1,4813 @@
+锘縰sing Dapper;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class ProductionManagementDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[鑾峰彇鍗曟嵁鍙穄
+ public static ToMessage ProductInHouseOrderCodeSearch(string rightcode)
+ {
+ try
+ {
+ mes = SeachEncodeJob.EncodingSeach(rightcode);
+ return mes;
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+
+ #region[MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ]
+ public static ToMessage MesBadOrderSearch(string mesordercode, string sourceorder, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mesordercode != "" && mesordercode != null)
+ {
+ search += "and A.wo_code like '%'+@mesordercode+'%' ";
+ dynamicParams.Add("@mesordercode", mesordercode);
+ }
+ if (sourceorder != "" && sourceorder != null)
+ {
+ search += "and A.m_po like '%'+@sourceorder+'%' ";
+ dynamicParams.Add("@sourceorder", sourceorder);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and B.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (createdate != "" && createdate != null)
+ {
+ search += "and CONVERT(varchar(100),A.lm_date,23)=@createdate ";
+ dynamicParams.Add("@createdate", createdate);
+ }
+ if (creatuser != "" && creatuser != null)
+ {
+ search += "and U.username like '%'+@creatuser+'%' ";
+ dynamicParams.Add("@creatuser", creatuser);
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
+ A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,U.username as lm_user,A.lm_date,S.bad_qty
+ from TK_Wrk_Man A
+ left join (select wo_code,sum(bad_qty) as bad_qty from TK_Wrk_Step where bad_qty>0 group by wo_code) S on A.wo_code=S.wo_code
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TOrganization C on A.wkshp_code=C.org_code
+ left join T_Sec_Stck D on A.stck_code=D.code
+ left join TFlw_Rout E on A.route_code=E.code
+ left join T_Sec_Stck F on A.stck_code=F.code
+ left join TUser U on A.lm_user=U.usercode
+ where A.is_delete<>'1' and A.status='START' and A.wotype='PO' and S.bad_qty>0 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜у搧缂栫爜鏌ユ壘宸ヨ壓璺嚎涓嬫媺鎺ュ彛]
+ public static ToMessage PartSelectRoute(string partcode, string wkshopcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇杞﹂棿涓嬫媺妗嗘暟鎹�
+ sql = @"select R.code,R.name,A.default_route from TMateriel_Info A
+ inner join TMateriel_Route M on A.partcode=M.materiel_code
+ inner join TFlw_Rout R on M.route_code=R.code
+ where A.partcode=@partcode and M.torg_code=@torg_code";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@torg_code", wkshopcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ヨ壓璺嚎鏌ユ壘杞﹂棿涓嬫媺鎺ュ彛]
+ public static ToMessage RouteSelectWkshop(string stu_torgcode, string stu_torgtypecode, string partcode)
+ {
+ string sql = "";
+ string search = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ switch (stu_torgtypecode)
+ {
+ case "":
+ break;
+ case "D":
+ search += "and L.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and F.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ //鑾峰彇杞﹂棿涓嬫媺妗嗘暟鎹�
+ sql = @"select distinct F.org_code,F.org_name from TMateriel_Route M
+ inner join TFlw_Rtdt B on M.route_code=B.rout_code
+ inner join TStep C on B.step_code=C.stepcode
+ inner join TFlw_Rteqp D on C.stepcode=D.step_code
+ inner join TEqpInfo E on D.eqp_code=E.code
+ left join TOrganization F on E.wksp_code=F.org_code
+ left join TOrganization L on F.parent_id=L.id
+ where M.materiel_code=@partcode and E.enable='Y' " + search;
+ dynamicParams.Add("@partcode", partcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏍规嵁閫夋嫨宸ヨ壓璺嚎鏌ョ湅宸ュ簭鎺ュ彛]
+ public static ToMessage SelectRouteStep(string routecode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇宸ヨ壓璺嚎瀵瑰簲宸ュ簭淇℃伅
+ sql = @"select A.seq,T.stepcode,T.stepname,T.flwtype,T.descr from TFlw_Rtdt A
+ left join TStep T on A.step_code=T.stepcode
+ where A.rout_code=@partcode ";
+ dynamicParams.Add("@partcode", routecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region銆愮敓浜х鐞嗐�佸伐鍗曟柊澧炪�佺紪杈戞椂,閫夋嫨鎺掔▼鏄椂鑾峰彇鐗╂枡娓呭崟鐗堟湰鍙枫��
+ public static ToMessage JobCreationSonAddVison(string partnumber)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @" select id,version from TBom_Main where materiel_code=@partnumber and status='Y' order by version desc ";
+ dynamicParams.Add("@partnumber", partnumber);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ崟娲惧彂閫夋嫨宸ヨ壓璺嚎鎴栭�夋嫨鐢熶骇杞﹂棿鏃跺垽鏂粦瀹氭潯浠禲
+ public static ToMessage SelectRouteOrWkshop(string partcode, string routecode, string wkshopcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ mes.code = "200";
+ mes.message = "";
+ mes.data = null;
+ //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鏄惁閮芥湁鍏宠仈宸ヤ綔绔�
+ sql = @"select B.step_code,C.eqp_code from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ left join TFlw_Rteqp C on B.step_code=C.step_code
+ where A.code=@routecode and A.torg_code=@wkshopcode";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@routecode", routecode);
+ var dtck = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dtck.Rows.Count; i++)
+ {
+ if (dtck.Rows[i].IsNull("eqp_code"))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ヨ壓璺嚎瀵瑰簲宸ュ簭銆�" + dtck.Rows[i]["step_code"].ToString() + "銆戯紝鏈叧鑱旇澶囷紝璇峰叧鑱旀墍鏈夊伐搴忓搴旇澶�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ //鍒ゆ柇宸ヤ綔绔�(璁惧)鏄惁鍙敤
+ sql = @"select B.step_code from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ where A.code=@routecode and A.torg_code=@wkshopcode";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@routecode", routecode);
+ var dtck1 = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dtck1.Rows.Count; i++)
+ {
+ //宸ュ簭鏌ユ壘璁惧
+ sql = @"select E.code,E.name,E.enable
+ from TFlw_Rteqp C
+ left join TEqpInfo E on C.eqp_code=E.code
+ where C.step_code=@step_code and C.torg_code=@wkshopcode";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@step_code", dtck1.Rows[i]["step_code"].ToString());
+ var dtck2 = DapperHelper.selectdata(sql, dynamicParams);
+ int query = dtck2.AsEnumerable().Where<DataRow>(a => a["enable"].ToString() == "N").Count();
+ if (dtck2.Rows.Count == query)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ヨ壓璺嚎瀵瑰簲宸ュ簭銆�" + dtck.Rows[i]["step_code"].ToString() + "銆戯紝璁惧涓嶅彲鐢�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ //鍒ゆ柇宸ヨ壓璺嚎瀵瑰簲宸ュ簭鍏宠仈鐨勫伐浣滅珯鏄惁鏈夎缃妭鎷嶅伐浠�
+ sql = @"select AA.step_code,AA.eqp_code,AA.flwtype,S.unprice from (
+ select A.code,B.step_code,C.eqp_code,S.flwtype from TFlw_Rout A
+ inner join TFlw_Rtdt B on A.code=B.rout_code
+ left join TFlw_Rteqp C on B.step_code=C.step_code
+ left join TStep S on B.step_code=S.stepcode
+ where A.code=@route_code and A.torg_code=@wkshopcode
+ ) as AA
+ left join (select * from TPrteEqp_Stad where materiel_code=@partcode and route_code=@route_code and wkspcode=@wkshopcode) as S on
+ AA.code=S.route_code and AA.step_code=S.step_code and AA.eqp_code=S.eqp_code";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@route_code", routecode);
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ var dtc = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < dtc.Rows.Count; i++)
+ {
+ if (dtc.Rows[i]["flwtype"].ToString() == "Z") //鍒ゆ柇宸ュ簭鏄惁涓鸿嚜鍒�
+ {
+ if (dtc.Rows[i].IsNull("unprice") || decimal.Parse(dtc.Rows[i]["unprice"].ToString()) == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鑺傛媿宸ヤ环涓細褰撳墠浜у搧銆�" + partcode + "銆戯紝瀵瑰簲宸ヨ壓璺嚎銆�" + routecode + "銆戞湭璁剧疆(鎴栨湭璁剧疆鍏�)鎴栧伐浠峰皬浜庣瓑浜�0!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+ public static ToMessage AddMesOrderCodeSearch()
+ {
+ string sql = "";
+ string wo_code = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇鍗曟嵁鍙�
+ sql = @"SELECT 'SGPO'+CONVERT(varchar(12) , getdate(), 112 )+'_'+cast(isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0)+1 as varchar) as numct
+ FROM TK_Wrk_Man where wo_code like '%SGPO%'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.Rows[0]["numct"].ToString();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
+ public static ToMessage AddUpdateMesOrder(string mesorderstus, string sourceorder, string ordertype, string mesordercode, string partcode, string mesqty, string routecode, string wkshopcode, string planstartdate, string planenddate, string orderlev, string username, string opertype, string is_aps, string bom_id)
+ {
+ string sql = "", wo_status = "", wrk_status = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ //鑾峰彇宸ヨ壓璺嚎棣栭亾宸ュ簭ID
+ sql = @"select distinct B.id from TFlw_Rout A
+ left join TFlw_Rtdt B on A.code=B.rout_code and b.first_choke='Y'
+ where A.code=@routecode";
+ dynamicParams.Add("@routecode", routecode);
+ var dtck = DapperHelper.selectdata(sql, dynamicParams);
+ if (dtck.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟瀵瑰簲宸ヨ壓璺嚎娌℃湁缁戝畾宸ュ簭!";
+ mes.data = null;
+ return mes;
+ }
+
+ if (opertype == "Add")
+ {
+ if (is_aps == "Y") //鏄惁鎺掔▼(鏄�)
+ {
+ //鍒ゆ柇鐗╂枡娓呭崟
+ sql = "select id from TBom_Main where materiel_code=@partcode and status='Y' and id=@bom_id";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@bom_id", bom_id);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟瀵瑰簲鐨勪骇鍝佹病鏈夊缓绔婤OM鎴朆OM鏈鏍革紒";
+ mes.data = null;
+ return mes;
+ }
+ //澧炲姞宸ュ崟鐢ㄦ枡琛紙瀛愪欢锛�
+ sql = @"insert into TK_Wrk_Allo(wo_code, seq, materiel_code, basqty, qty,bom_id,materieltype,stck_code,stopfeed,base_quantity,loss_quantity,m_quantity)
+ select @wocode,A.seq,A.smateriel_code,A.total_quantity,(convert(decimal(18, 0), @uomqty)*A.Base_Quantity*(1+A.LOSS_QUANTITY/100))/C.quantity,
+ A.m_id,A.pn_type,'','N',A.base_quantity,A.loss_quantity,C.quantity
+ from TBom_Deta A left join TBom_Main C on A.m_Id=C.id
+ left join TMateriel_Info B on A.smateriel_code = B.partcode
+ where A.m_id=@bom_id";
+ list.Add(new { str = sql, parm = new { wocode = mesordercode, uomqty = mesqty, bom_id = bom_id } });
+
+ wo_status = "NOSCHED";
+ wrk_status = "NOSCHED";
+ }
+ else //鍚�
+ {
+ wo_status = "ALLO";
+ wrk_status = "ALLO";
+ }
+ //鍐欏叆宸ュ崟琛�
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,plan_startdate,plan_enddate,route_code,stck_code,lm_user,lm_date,materiel_code,m_po,piroque,isaps)
+ values(@mesordercode,@wotype,@mesorderstus,@wkshopcode,@mesqty,@planstartdate,@planenddate,@routecode,@stck_code,@username,@CreateDate,@materiel_code,@m_po,@orderlev,@isaps)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ wotype = ordertype,
+ m_po = sourceorder,
+ mesorderstus = wo_status, //鍗曟嵁鐘舵��
+ wkshopcode = wkshopcode,
+ mesqty = mesqty,
+ planstartdate = planstartdate,
+ planenddate = planenddate,
+ routecode = routecode,
+ stck_code = "",
+ username = username,
+ CreateDate = DateTime.Now.ToString(),
+ materiel_code = partcode,
+ orderlev = orderlev,
+ isaps = is_aps
+ }
+ });
+ //鍐欏叆宸ュ簭浠诲姟琛�
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,plan_qty,plan_startdate,plan_enddate,status,isbott,isend,route_code,lm_user,lm_date)
+ select @mesordercode as wo_code,A.seq,A.step_code,@mesqty as plan_qty,@planstartdate as plan_startdate,@planenddate as plan_enddate,@status as status,
+ A.first_choke,A.last_choke,A.rout_code,@username,@CreateDate
+ from TFlw_Rtdt A
+ left join TStep B on A.step_code=B.stepcode
+ left join TFlw_Rout C on A.rout_code=C.code
+ where A.rout_code=@routecode
+ and B.is_delete<>'1' and C.enable='Y' and C.is_delete<>'1'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ mesqty = mesqty,
+ planstartdate = planstartdate,
+ planenddate = planenddate,
+ routecode = routecode,
+ status = wrk_status, //宸ュ簭鐘舵��
+ username = username,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ //鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
+ select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
+ S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+ from TFlw_Rtdt A
+ inner join TFlw_Rteqp C on A.step_code=C.step_code
+ inner join (select * from TPrteEqp_Stad where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ materiel_code = partcode,
+ routecode = routecode
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "MES宸ュ崟鏂板缓娲惧彂鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "MES宸ュ崟鏂板缓娲惧彂澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ if (is_aps == "Y") //鏄惁鎺掔▼(鏄�)
+ {
+ //鍒ゆ柇鐗╂枡娓呭崟
+ sql = "select id from TBom_Main where materiel_code=@partcode and status='Y' and id=@bom_id";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@bom_id", bom_id);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟瀵瑰簲鐨勪骇鍝佹病鏈夊缓绔婤OM鎴朆OM鏈鏍革紒";
+ mes.data = null;
+ return mes;
+ }
+ //澧炲姞宸ュ崟鐢ㄦ枡琛紙瀛愪欢锛�
+ sql = @"insert into TK_Wrk_Allo(wo_code, seq, materiel_code, basqty, qty,bom_id,materieltype,stck_code,stopfeed,base_quantity,loss_quantity,m_quantity)
+ select @wocode,A.seq,A.smateriel_code,A.total_quantity,(convert(decimal(18, 0), @uomqty)*A.Base_Quantity*(1+A.LOSS_QUANTITY/100))/C.quantity,
+ A.m_id,A.pn_type,'','N',A.base_quantity,A.loss_quantity,C.quantity
+ from TBom_Deta A left join TBom_Main C on A.m_Id=C.id
+ left join TMateriel_Info B on A.smateriel_code = B.partcode
+ where A.m_id=@bom_id";
+ list.Add(new { str = sql, parm = new { wocode = mesordercode, uomqty = mesqty, bom_id = bom_id } });
+
+ wo_status = "NOSCHED";
+ wrk_status = "NOSCHED";
+ }
+ else //鍚�
+ {
+ wo_status = "ALLO";
+ wrk_status = "ALLO";
+ }
+ sql = @"update TK_Wrk_Man set route_code=@routecode,wkshp_code=@wkshopcode,plan_startdate=@planstartdate,plan_enddate=@planenddate,status=@status,piroque=@orderlev,lm_user=@username,lm_date=@CreateDate,isaps=@isaps where wo_code=@mesordercode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ wkshopcode = wkshopcode,
+ planstartdate = planstartdate,
+ planenddate = planenddate,
+ status = wo_status,
+ routecode = routecode,
+ username = username,
+ CreateDate = DateTime.Now.ToString(),
+ orderlev = orderlev,
+ isaps = is_aps
+ }
+ });
+ //鍐欏叆宸ュ簭浠诲姟琛�
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,plan_qty,plan_startdate,plan_enddate,status,isbott,isend,route_code,lm_user,lm_date)
+ select @mesordercode as wo_code,A.seq,A.step_code,@mesqty as plan_qty,@planstartdate as plan_startdate,@planenddate as plan_enddate,@status as status,
+ A.first_choke,A.last_choke,A.rout_code,@username,@CreateDate
+ from TFlw_Rtdt A
+ left join TStep B on A.step_code=B.stepcode
+ left join TFlw_Rout C on A.rout_code=C.code
+ where A.rout_code=@routecode
+ and B.is_delete<>'1' and C.enable='Y' and C.is_delete<>'1'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ mesqty = mesqty,
+ planstartdate = planstartdate,
+ planenddate = planenddate,
+ status = wo_status,
+ username = username,
+ routecode = routecode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ //鍒犻櫎宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"delete TWoPrteEqp_Stad where wo=@mesordercode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode
+ }
+ });
+ //鍐欏叆宸ュ崟宸ヨ壓璺嚎宸ュ簭宸ヤ环澶嶅埗琛�
+ sql = @"insert into TWoPrteEqp_Stad(wo,materiel_code,eqp_code,stand_value,opc_conver,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,torg_code,is_delete,step_code)
+ select distinct @mesordercode as wo,S.materiel_code,S.eqp_code,S.stand_value,S.opc_conver,S.route_code,S.unprice,
+ S.eqp_value,S.cavity_qty,S.wkspcode,S.lm_user,S.lm_date,S.torg_code,S.is_delete,S.step_code
+ from TFlw_Rtdt A
+ inner join TFlw_Rteqp C on A.step_code=C.step_code
+ inner join (select * from TPrteEqp_Stad where materiel_code=@materiel_code and route_code=@routecode) as S on C.step_code=S.step_code and C.eqp_code=S.eqp_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mesordercode = mesordercode,
+ materiel_code = partcode,
+ routecode = routecode
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鍒犻櫎]
+ public static ToMessage DeleteMesOrder(string souceid, string wocode, string m_po, string orderqty)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇宸ュ崟鏄惁涓烘湭寮�濮嬬姸鎬佹垨鑰呭凡娲惧彂鎴栧緟鎺掔▼鐘舵��(婊¤冻鍏朵腑涓�绉嶉兘鍙垹闄わ紝鍚﹀垯涓嶅厑璁稿垹闄�)
+ sql = @"select * from TK_Wrk_Man where wo_code=@wocode and status in('NEW','ALLO','NOSCHED')";
+ dynamicParams.Add("@wocode", wocode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ if (m_po != "" && m_po != null)
+ {
+ //鏌ヨ鐢熶骇璁㈠崟琛ㄦ暟鎹�
+ sql = @"select * from TKimp_Ewo where wo=@m_po and id=@souceid";
+ dynamicParams.Add("@m_po", m_po);
+ dynamicParams.Add("@souceid", souceid);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ decimal relse_qty = decimal.Parse(data0.Rows[0]["RELSE_QTY"].ToString());//浠ヤ笅鍗曟暟閲�
+ if ((relse_qty - decimal.Parse(orderqty)) == 0) //鍏ㄩ儴鎾ら攢 璁㈠崟鐘舵�佸洖鍐欐湭寮�濮�,宸蹭笅鍗曟暟閲忎负0
+ {
+ //鍥炲啓璁㈠崟琛ㄧ姸鎬佸強宸蹭笅鍗曟暟閲�
+ sql = @"update TKimp_Ewo set status='NEW',relse_qty=0 where wo=@m_po and id=@souceid";
+ list.Add(new { str = sql, parm = new { m_po = m_po, souceid = souceid } });
+ }
+ else
+ {
+ //鍥炲啓璁㈠崟琛ㄧ姸鎬佸強宸蹭笅鍗曟暟閲�
+ sql = @"update TKimp_Ewo set status='CREATING',relse_qty=relse_qty-@orderqty where wo=@m_po and id=@souceid";
+ list.Add(new { str = sql, parm = new { m_po = m_po, souceid = souceid, orderqty = decimal.Parse(orderqty) } });
+ }
+ }
+ //鍒犻櫎宸ュ崟宸ュ簭琛�
+ sql = @"delete TK_Wrk_Step where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+
+ //鍒犻櫎鍔犲伐鍗曠敤鏂欒〃(瀛愪欢)
+ sql = @"delete TK_Wrk_Allo where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+
+ //鍒犻櫎宸ュ崟琛�
+ sql = @"update TK_Wrk_Man set is_delete='1' where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟鎵ц涓垨宸插叧闂紝涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鍏抽棴]
+ public static ToMessage ClosedMesOrder(string username, string wocode, string m_po)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍏抽棴宸ュ崟瀵瑰簲宸ュ簭浠诲姟
+ sql = @"update TK_Wrk_Step set status='CLOSED' where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+ //鍥炲啓宸ュ崟琛ㄧ姸鎬佷负(鍏抽棴)
+ sql = @"update TK_Wrk_Man set status='CLOSED',closeuser=@username,closedate=@closedate where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode, username = username, closedate = DateTime.Now.ToString() } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "宸ュ崟鍏抽棴鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟鍏抽棴澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ョ湅宸ュ簭浠诲姟]
+ public static ToMessage SearchWorkStep(string wo_code)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇宸ュ簭浠诲姟淇℃伅
+ sql = @"select A.wo_code,P.partcode,P.partname,P.partspec,A.seq,B.stepcode,B.stepname,A.plan_qty,A.good_qty,A.ng_qty from TK_Wrk_Step A
+ left join TStep B on A.step_code=B.stepcode
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TMateriel_Info P on M.materiel_code=P.partcode
+ where A.wo_code=@wo_code order by A.seq";
+ dynamicParams.Add("@wo_code", wo_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇褰撳墠宸ュ簭瀵瑰簲鐨勮澶�(鑷埗)]
+ public static ToMessage MesOrderStepEqpSearch(string orderstepqrcode)
+ {
+ var sql = "";
+ string search = "";//瀹氫箟涓�涓煡璇㈠弬鏁�,鏌ヨ鏉′欢鏈夊墠绔紶鍏�
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ }
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭灞炴��
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "W")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓哄鍗忓伐搴忎换鍔�,璇峰墠寰�澶栧崗鎿嶄綔椤电鎵ц!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭璁惧(鑷埗宸ュ簭)
+ sql = @"select B.eqp_code,E.name as eqp_name from TK_Wrk_Step A
+ inner join TFlw_Rteqp B on A.step_code=B.step_code
+ left join TEqpInfo E on B.eqp_code=E.code
+ where B.style='E' and A.wo_code=@ordercode and A.step_code=@stepcode
+ order by B.eqp_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟鏃犲彲鎵ц璁惧!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇褰撳墠宸ュ簭瀵瑰簲鐨勪緵鏂�(澶栧崗)]
+ public static ToMessage MesOrderWxStepEqpSearch(string orderstepqrcode)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ }
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭灞炴��
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "Z")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓鸿嚜鍒跺伐搴忎换鍔�,璇峰墠寰�鑷埗鎿嶄綔椤电鎵ц!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭澶栧崗渚涙柟(澶栧崗宸ュ簭)
+ sql = @"select B.eqp_code as customercode,C.name as customername from TK_Wrk_Step A
+ inner join TFlw_Rteqp B on A.step_code=B.step_code
+ left join TCustomer C on B.eqp_code=C.code
+ where B.style='W' and A.wo_code=@ordercode and A.step_code=@stepcode
+ order by B.eqp_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭鏃犲彲鎵ц澶栧崗渚涙柟!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)]
+ public static ToMessage MesOrderStepSearch(string stu_torgcode, string stu_torgtypecode, string orderstepqrcode, int startNum, int endNum, string prop, string order)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ var total = 0; //鎬绘潯鏁�
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+
+ if (ordercode != "" && stepcode == null) //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂负绌�
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ }
+ if (ordercode != "" && stepcode != "") //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂笉涓虹┖
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ search += "and S.stepcode=@stepcode ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ }
+ //else
+ //{
+ // mes.code = "300";
+ // mes.count = 0;
+ // mes.message = "浜岀淮鐮佷俊鎭负绌�!";
+ // mes.data = null;
+ // return mes;
+ //}
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭灞炴��
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "W")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓哄鍗忓伐搴忎换鍔�,璇峰墠寰�澶栧崗鎿嶄綔椤电鎵ц!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ switch (stu_torgtypecode)
+ {
+ case "":
+ break;
+ case "D":
+ search += "and L.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and F.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟(鑷埗宸ュ簭)
+ sql = @"select A.status,A.wo_code,B.route_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend,
+ S.stepcode,S.stepname,S.descr,A.plan_qty,A.good_qty,A.ng_qty,A.bad_qty,A.plan_startdate,A.plan_enddate,B.lm_date
+ from TK_Wrk_Step A
+ left join TK_Wrk_Man B on A.wo_code=B.wo_code
+ left join TMateriel_Info M on B.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TOrganization F on B.wkshp_code=F.org_code
+ left join TOrganization L on F.parent_id=L.id
+ where A.status in('ALLO','START') and S.flwtype='Z' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ if (data.ToList().Count > 0)
+ {
+ mes.code = "200";
+ mes.count = total;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.ToList();
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犲彲鎵ц鐨勭敓浜т换鍔�,浠诲姟宸插畬鎴愭垨宸插叧闂�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(澶栧崗)]
+ public static ToMessage MesOrderWxStepSearch(string stu_torgcode, string stu_torgtypecode, string orderstepqrcode, int startNum, int endNum, string prop, string order)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ var total = 0; //鎬绘潯鏁�
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ if (ordercode != "" && stepcode == null) //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂负绌�
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ }
+ if (ordercode != "" && stepcode != "") //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂笉涓虹┖
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ search += "and S.stepcode=@stepcode ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ }
+ //else
+ //{
+ // mes.code = "300";
+ // mes.count = 0;
+ // mes.message = "浜岀淮鐮佷俊鎭负绌�!";
+ // mes.data = null;
+ // return mes;
+ //}
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭灞炴��
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "Z")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓鸿嚜鍒跺伐搴忎换鍔�,璇峰墠寰�鑷埗鎿嶄綔椤电鎵ц!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ switch (stu_torgtypecode)
+ {
+ case "":
+ break;
+ case "D":
+ search += "and L.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and F.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟(澶栧崗宸ュ簭)
+ sql = @"select A.status,A.wo_code,B.route_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend,
+ S.stepcode,S.stepname,S.descr,A.plan_qty,A.good_qty,A.ng_qty,A.bad_qty,A.plan_startdate,A.plan_enddate,B.lm_date
+ from TK_Wrk_Step A
+ left join TK_Wrk_Man B on A.wo_code=B.wo_code
+ left join TMateriel_Info M on B.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TOrganization F on B.wkshp_code=F.org_code
+ left join TOrganization L on F.parent_id=L.id
+ where A.status in('ALLO','START') and S.flwtype='W' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ if (data.ToList().Count > 0)
+ {
+ mes.code = "200";
+ mes.count = total;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.ToList();
+ return mes;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犲彲鎵ц鐨勭敓浜т换鍔�,浠诲姟宸插畬鎴愭垨宸插叧闂�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇)]
+ public static ToMessage MesOrderNgStepSearch(string stu_torgcode, string stu_torgtypecode, string orderstepqrcode, int startNum, int endNum, string prop, string order)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ var total = 0; //鎬绘潯鏁�
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ if (ordercode != "" && stepcode == null) //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂负绌�
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ }
+ if (ordercode != "" && stepcode != "") //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂笉涓虹┖
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ search += "and S.stepcode=@stepcode ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ }
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭浠诲姟
+ sql = @"select * from TK_Wrk_Step where step_code=@stepcode and wo_code=@ordercode";
+ dynamicParams.Add("@stepcode", stepcode);
+ dynamicParams.Add("@ordercode", ordercode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�,鏃犳晥鏉$爜!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ switch (stu_torgtypecode)
+ {
+ case "":
+ break;
+ case "D":
+ search += "and L.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and F.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟,涓斾笉鑹暟閲忓ぇ浜�0
+ sql = @"select A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isend,
+ S.stepcode,S.stepname,S.descr,A.plan_qty,A.good_qty,A.ng_qty,A.bad_qty,B.lm_date
+ from TK_Wrk_Step A
+ left join TK_Wrk_Man B on A.wo_code=B.wo_code
+ left join TMateriel_Info M on B.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TOrganization F on B.wkshp_code=F.org_code
+ left join TOrganization L on F.parent_id=L.id
+ where A.status in('ALLO','START') and A.ng_qty>0 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ if (data.ToList().Count > 0)
+ {
+ mes.code = "200";
+ mes.count = total;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.ToList();
+ return mes;
+ }
+ else
+ {
+ mes.code = "301";
+ mes.count = 0;
+ mes.message = "鏃犲彲鎵ц鐨勭敓浜т换鍔�,浠诲姟宸插畬鎴愭垨宸插叧闂�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇鏄庣粏)]
+ public static ToMessage MesOrderNgSubStepSearch(string orderstepqrcode)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ var dynamicParams1 = new DynamicParameters();
+ Dictionary<string, object> list = new Dictionary<string, object>();
+ ScanStartReportData rt = new ScanStartReportData();
+ var total = 0; //鎬绘潯鏁�
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忎簩缁寸爜!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ }
+ //1.鏍规嵁宸ュ崟+宸ュ簭鏌ユ壘褰撳墠宸ュ簭鏄惁棣栭亾宸ュ簭
+ sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.seq,T.flwtype,T.descr,A.status,A.plan_qty,A.good_qty,A.ng_qty,A.bad_qty,A.isbott,A.isend
+ from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TMateriel_Info P on M.materiel_code=P.partcode
+ where A.wo_code=@ordercode and A.step_code=@stepcode";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //宸ュ崟鍙�
+ rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //浜у搧缂栫爜
+ rt.partname = data.Rows[0]["PARTNAME"].ToString(); //浜у搧鍚嶇О
+ rt.partspec = data.Rows[0]["PARTSPEC"].ToString(); //浜у搧瑙勬牸
+ rt.stepcode = data.Rows[0]["STEPCODE"].ToString(); //宸ュ簭缂栫爜
+ rt.stepname = data.Rows[0]["STEPNAME"].ToString(); //宸ュ簭鍚嶇О
+ rt.stepdesc = data.Rows[0]["DESCR"].ToString(); //宸ュ簭鎻忚堪
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟鏁伴噺
+ rt.noreportqty = decimal.Parse(data.Rows[0]["GOOD_QTY"].ToString()); //鎶ュ伐鏁伴噺
+ rt.noputqty = decimal.Parse(data.Rows[0]["NG_QTY"].ToString()); //涓嶈壇鏁伴噺
+ string isend = data.Rows[0]["ISEND"].ToString();//鏈亾宸ュ簭
+ rt.seq = data.Rows[0]["SEQ"].ToString();//宸ュ簭搴忓彿
+
+ //鑾峰彇褰撳墠宸ュ簭涓嬮亾宸ュ簭
+ sql = @"select A.isbott,A.isend,T.stepcode,T.stepname from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq+1 ";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["SEQ"].ToString()));
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0) //鏈変笅閬撳伐搴�
+ {
+ rt.nextstepcode = dt0.Rows[0]["STEPCODE"].ToString();//涓嬮亾宸ュ簭缂栫爜
+ rt.nextstepname = dt0.Rows[0]["STEPNAME"].ToString();//涓嬮亾宸ュ簭鍚嶇О
+ }
+ if (isend == "Y") //褰撳墠宸ュ簭鏄湯閬撳伐搴�
+ {
+ rt.nextstepcode = "";//璧嬬┖
+ rt.nextstepname = "";//璧嬬┖
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鎵爜宸ュ簭浠诲姟涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭鎶ュ伐(鏀舵枡)璁板綍,涓斾笉鑹暟閲忓ぇ浜�0
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_MesReportDefectHandleSelect";
+ dynamicParams1.Add("@ordercode", ordercode);
+ dynamicParams1.Add("@stepcode", stepcode);
+ DataTable dt = DapperHelper.selectProcedure(sql, dynamicParams1);
+ if (dt.Rows.Count > 0)
+ {
+ list.Add("data1", rt);
+ list.Add("data2", dt);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犲彲鎵ц鐨勭敓浜т换鍔�,浠诲姟宸插畬鎴愭垨宸插叧闂�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [鐢熶骇寮�鎶ュ伐锛氬紑宸�(寮�濮�/鎶ュ伐)/澶栧崗鍙戞枡鏃舵潯浠跺垽鏂強鏁版嵁杩斿洖鎺ュ彛]
+ public static ToMessage MesOrderStepStart(string OperType, string stu_torgcode, string SelectType, string orderstepqrcode)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string serialnumber = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忔潯鐮�!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ switch (OperType)
+ {
+ case "ZZ":
+ mes = ScanStartReport.ZZEncodingSeach(ordercode, stepcode);
+ break;
+ case "WX":
+ mes = ScanStartReport.WXEncodingSeach(SelectType, ordercode, stepcode);
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浜岀淮鐮佷俊鎭负绌�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氬紑宸ユ椂鑾峰彇璁惧涓嬫媺鍒楄〃]
+ public static ToMessage MesOrderStepStartSelectEqp(string orderstepqrcode)
+ {
+ string sql = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浜岀淮鐮佷俊鎭负绌�!";
+ mes.data = null;
+ return mes;
+ }
+ //鑾峰彇宸ュ簭鍏宠仈鐨勮澶�
+ sql = @"select B.code,B.name from TK_Wrk_Man M
+ inner join TFlw_Rtdt R on M.route_code=R.rout_code
+ inner join TFlw_Rteqp A on R.step_code=A.step_code
+ left join TEqpInfo B on A.eqp_code=B.code
+ where A.style='E' and M.wo_code=@wo_code and A.step_code=@stepcode and B.enable='Y'";
+ dynamicParams.Add("@wo_code", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氭姤宸ユ椂鑾峰彇鐢熶骇鐝粍涓嬫媺妗哴
+ public static ToMessage MesOrderStepReportSelectUserGroup(string stu_torgcode, string stu_torgtypecode, string wkshopcode)
+ {
+ string sql = "";
+ string search = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.torg_code=@workShop ";
+ dynamicParams.Add("@workShop", wkshopcode);
+ }
+ else
+ {
+ switch (stu_torgtypecode)
+ {
+ case "":
+ search += "and T.description=@description ";
+ dynamicParams.Add("@description", "W");
+ break;
+ case "D":
+ search += "and L.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ }
+ }
+ //鑾峰彇鐢ㄦ埛缁�
+ sql = @"select group_code,group_name from TGroup A
+ left join TOrganization T on A.torg_code=T.org_code
+ left join TOrganization as L on T.parent_id=L.id
+ where 1=1 " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氭牴鎹敓浜х彮缁勬煡鎵句汉鍛樺垪琛╙
+ public static ToMessage MesOrderGroupSelectUser(string stu_torgcode, string usergroupcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鐝粍鑾峰彇浜哄憳鍒楄〃
+ sql = @"select usercode,username,payrate from TUser where stu_torgcode=@stu_torgcode and usergroup_code=@usergroupcode and is_delete<>'1'";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ dynamicParams.Add("@usergroupcode", usergroupcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氫汉鍛樹笅鎷夊垪琛╙
+ public static ToMessage MesOrderSelectUser(string usercode)
+ {
+ string sql = "";
+ string search = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (usercode != "" && usercode != null) //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂负绌�
+ {
+ search += "and usercode=@usercode ";
+ dynamicParams.Add("@usercode", usercode);
+ }
+ //鐝粍鑾峰彇浜哄憳鍒楄〃
+ sql = @"select usercode,username,payrate from TUser where is_delete<>'1' and usercode<>'9999'" + search;
+ dynamicParams.Add("@usercode", usercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐锛氬彂鏂�/鏀舵枡鏃惰幏鍙栧鍗忎笅鎷夊垪琛╙
+ public static ToMessage MesOrderStepSelectWX(string orderstepqrcode)
+ {
+ string sql = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浜岀淮鐮佷俊鎭负绌�!";
+ mes.data = null;
+ return mes;
+ }
+ //鑾峰彇澶栧崗涓嬫媺妗�
+ sql = @"select C.code,C.name from TFlw_Rteqp A
+ left join TCustomer C on A.eqp_code=C.code
+ where A.step_code=@stepcode and A.style='W'";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鎶ュ伐锛氭姤宸�/澶栧崗鏀舵枡 鑾峰彇涓嶈壇鍘熷洜涓嬫媺鍒楄〃]
+ public static ToMessage MesOrderStepSelectCause(string orderstepqrcode)
+ {
+ string sql = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浜岀淮鐮佷俊鎭负绌�!";
+ mes.data = null;
+ return mes;
+ }
+ //鑾峰彇宸ュ簭鍏宠仈缂洪櫡
+ sql = @"select B.code,B.name from TDefect_Step A
+ left join TDefect B on A.defect_code=B.code
+ where A.step_code=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,寮�宸�(寮�濮�)鎻愪氦]
+ public static ToMessage SavaMesOrderStepStart(string mesordercode, string partcode, string stepseq, string stepcode, string eqpcode, string taskqty, string startqty, string username)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ list.Clear();
+ //鍒ゆ柇鏄惁鏈夊紑宸ヨ褰�
+ sql = @"select * from TK_Wrk_Record where wo_code=@wo_code and step_code=@step_code and style='S'";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟宸插紑宸�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鍐欏叆寮�鎶ュ伐璁板綍琛�
+ sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,eqp_code,materiel_code,open_person,open_time,task_qty,start_qty,style,lm_user,lm_date)
+ values(@mesordercode,@stepseq,@stepcode,@eqpcode,@partcode,@username,@opentime,@taskqty,@startqty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, eqpcode = eqpcode, partcode = partcode, username = username, opentime = date, taskqty = taskqty, startqty = startqty, style = "S", lm_user = username, lm_date = date } });
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄧ姸鎬佷负START: 寮�宸�
+ sql = @"update TK_Wrk_Step set status='START' where wo_code=@mesordercode and step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode } });
+
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄧ姸鎬佷负宸插紑宸�
+ sql = @"update TK_Wrk_Step set status='START' where wo_code=@mesordercode and step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode } });
+ //鍥炲啓宸ュ崟琛ㄧ姸鎬佷负锛� 寮�宸ワ細START
+ sql = @"update TK_Wrk_Man set status='START' where wo_code=@mesordercode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "寮�宸ユ垚鍔�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "寮�宸ュけ璐�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鎶ュ伐鎻愪氦]
+ public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode, string eqpcode, string inbarcode, string reckway, string usergroupcode, string reportuser, string taskqty, string startqty, string reportqty, string ngqty, string badcode, string remarks, string username)
+ {
+ var sql = "";
+ //string[] arra = new string[] { };
+ string[] arra1 = new string[] { };
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ //鑾峰彇鎶ュ伐浜哄憳銆佸垎閰嶆瘮渚�
+ JArray arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(reportuser);
+ if (ngqty != "" || ngqty != "0")
+ {
+ //鎴彇涓嶈壇鍘熷洜
+ arra1 = badcode.Split(';');
+ }
+
+ list.Clear();
+ //鍒ゆ柇鏄惁鏈夋姤宸ヨ褰�(鏈夛細淇敼 鏃狅細鏂板)
+ sql = @"select * from TK_Wrk_Record where wo_code=@wo_code and step_code=@step_code and style='B'";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //鑾峰彇寮�宸ヨ褰曠殑榛樿閫変腑鐨勮澶�(浜х嚎)涓庢姤宸ユ椂鐨勮澶囦骇绾垮仛瀵规瘮鍒ゆ柇
+ sql = @"select A.eqp_code,B.name from TK_Wrk_Record A
+ inner join TEqpInfo B on A.eqp_code=B.code
+ where A.wo_code=@wo_code and A.step_code=@step_code and A.style='S'";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ var da = DapperHelper.selectdata(sql, dynamicParams);
+ if (da.Rows[0]["EQP_CODE"].ToString() != eqpcode)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鎶ュ伐浜х嚎搴斾负锛�" + da.Rows[0]["NAME"].ToString() + "!";
+ mes.data = null;
+ return mes;
+ }
+ if (data.Rows.Count > 0)
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_Record')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆寮�鎶ュ伐璁板綍琛�
+ sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,eqp_code,materiel_code,task_qty,start_qty,good_qty,ng_qty,style,lm_user,lm_date,inbarcode)
+ values(@mesordercode,@stepseq,@stepcode,@eqpcode,@partcode,@taskqty,@startqty,@reportqty,@ngqty,@style,@lm_user,@lm_date,@inbarcode)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, eqpcode = eqpcode, partcode = partcode, taskqty = taskqty, startqty = startqty, reportqty = reportqty, ngqty = ngqty, style = "B", lm_user = username, lm_date = date, inbarcode = inbarcode } });
+
+ //鍐欏叆瀛愯〃
+ for (int i = 0; i < arra.Count; i++)
+ {
+ sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,report_person,report_date,report_qty,reckway,usergroup_code,ratio,ng_qty,style,lm_user,lm_date)
+ values(@m_id,@eqp_code,@report_person,@report_date,@report_qty,@reckway,@usergroup_code,@ratio,@ng_qty,@style,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(dt.Rows[0]["ID"].ToString()),
+ eqp_code = eqpcode,
+ report_person = arra[i]["usercode"].ToString(),
+ report_date = date,
+ report_qty = reportqty,
+ reckway = reckway,
+ usergroup_code = usergroupcode,
+ ratio = decimal.Parse(arra[i]["ratio"].ToString()),
+ ng_qty = ngqty,
+ style = "B",
+ lm_user = username,
+ lm_date = date
+ }
+ });
+
+ }
+ if (badcode != "" && ngqty != "0")
+ {
+ //鍐欏叆缂洪櫡璁板綍琛�
+ for (int i = 0; i < arra1.Length; i++)
+ {
+ sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,remarks,style,lm_user,lm_date)
+ values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@remarks,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], remarks = remarks, style = "B", lm_user = username, lm_date = date } });
+
+ }
+ }
+ ////淇敼鎶ュ伐璁板綍
+ //sql = @"update TK_Wrk_Record set good_qty=good_qty+@reportqty,ng_qty=ng_qty+@ngqty,
+ // lm_user=@username,lm_date=@CreateDate where wo_code=@mesordercode and step_code=@stepcode and style='B'";
+ //list.Add(new { str = sql, parm = new { reportqty = decimal.Parse(reportqty), ngqty = decimal.Parse(ngqty), mesordercode = mesordercode, stepcode = stepcode, username = username, CreateDate = date } });
+ ////鍐欏叆瀛愯〃
+ //for (int i = 0; i < arra.Length; i++)
+ //{
+ // sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,report_person,report_date,report_qty,usergroup_code,ng_qty,style,lm_user,lm_date)
+ // values(@m_id,@eqp_code,@report_person,@report_date,@report_qty,@usergroup_code,@ng_qty,@style,@lm_user,@lm_date)";
+ // list.Add(new { str = sql, parm = new { m_id = int.Parse(data.Rows[0]["ID"].ToString()), eqp_code = eqpcode, report_person = arra[i], report_date = date, report_qty = reportqty, usergroup_code = usergroupcode, ng_qty = ngqty, style = "B", lm_user = username, lm_date = date } });
+
+ //}
+ //if (badcode != "" && ngqty != "0")
+ //{
+ // //鍐欏叆缂洪櫡璁板綍琛�
+ // for (int i = 0; i < arra1.Length; i++)
+ // {
+ // sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,style,lm_user,lm_date)
+ // values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@style,@lm_user,@lm_date)";
+ // list.Add(new { str = sql, parm = new { record_id = int.Parse(data.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], style = "B", lm_user = username, lm_date = date } });
+
+ // }
+ //}
+ }
+ else
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_Record')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆寮�鎶ュ伐璁板綍琛�
+ sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,eqp_code,materiel_code,task_qty,start_qty,good_qty,ng_qty,style,lm_user,lm_date,inbarcode)
+ values(@mesordercode,@stepseq,@stepcode,@eqpcode,@partcode,@taskqty,@startqty,@reportqty,@ngqty,@style,@lm_user,@lm_date,@inbarcode)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, eqpcode = eqpcode, partcode = partcode, taskqty = taskqty, startqty = startqty, reportqty = reportqty, ngqty = ngqty, style = "B", lm_user = username, lm_date = date, inbarcode = inbarcode } });
+
+ //鍐欏叆瀛愯〃
+ for (int i = 0; i < arra.Count; i++)
+ {
+ sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,report_person,report_date,report_qty,reckway,usergroup_code,ratio,ng_qty,style,lm_user,lm_date)
+ values(@m_id,@eqp_code,@report_person,@report_date,@report_qty,@reckway,@usergroup_code,@ratio,@ng_qty,@style,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(dt.Rows[0]["ID"].ToString()),
+ eqp_code = eqpcode,
+ report_person = arra[i]["usercode"].ToString(),
+ report_date = date,
+ report_qty = reportqty,
+ reckway = reckway,
+ usergroup_code = usergroupcode,
+ ratio = decimal.Parse(arra[i]["ratio"].ToString()),
+ ng_qty = ngqty,
+ style = "B",
+ lm_user = username,
+ lm_date = date
+ }
+ });
+
+ }
+ if (badcode != "" && ngqty != "0")
+ {
+ //鍐欏叆缂洪櫡璁板綍琛�
+ for (int i = 0; i < arra1.Length; i++)
+ {
+ sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,remarks,style,lm_user,lm_date)
+ values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@remarks,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], remarks = remarks, style = "B", lm_user = username, lm_date = date } });
+
+ }
+ }
+ }
+
+
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ sql = @"update TK_Wrk_Step set good_qty=good_qty+@reportqty,ng_qty=ng_qty+@ngqty where wo_code=@mesordercode and step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, reportqty = reportqty, ngqty = ngqty } });
+
+ //鍥炲啓宸ュ崟琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ //sql = @"update TK_Wrk_Man set good_qty=good_qty+@reportqty,ng_qty=ng_qty+@ngqty where wo_code=@mesordercode";
+ //list.Add(new { str = sql, parm = new { mesordercode = mesordercode, reportqty = reportqty, ngqty = ngqty } });
+
+ //鍐欏叆ERP鍏ュ簱鍗�
+
+ //鍒ゆ柇鏄惁鏈亾宸ュ簭瀹屽伐鎶ュ伐(鑷姩鍏抽棴宸ュ崟鍙婂伐搴忎换鍔�)
+ //list = AutosCloseOrder.AutosColseOrderReport(list,mesordercode, partcode, stepseq,stepcode,reportqty,ngqty);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鍙戞枡鎻愪氦]
+ public static ToMessage SavaMesOrderStepOut(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string outuser, string taskqty, string fqty, string username)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ list.Clear();
+ //鍒ゆ柇鏄惁鏈夊彂鏂欒褰�(鏈�(鍚屽伐鍗�+宸ュ簭+澶栧崗渚涙柟淇敼) 鏃狅細鏂板)
+ sql = @"select * from TK_Wrk_OutRecord where wo_code=@wo_code and step_code=@step_code and wx_code=@wx_code and style='F'";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ dynamicParams.Add("@wx_code", wxcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ //淇敼鍙戞枡璁板綍
+ sql = @"update TK_Wrk_OutRecord set fqty=fqty+@fqty,lm_user=@username,lm_date=@CreateDate
+ where wo_code=@mesordercode and step_code=@stepcode and wx_code=@wx_code and style='F'";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, wx_code = wxcode, fqty = decimal.Parse(fqty), username = username, CreateDate = date } });
+ //鍐欏叆瀛愯〃
+ sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,out_person,out_time,fqty,style,lm_user,lm_date)
+ values(@m_id,@wx_code,@out_person,@out_time,@fqty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { m_id = int.Parse(data.Rows[0]["ID"].ToString()), wx_code = wxcode, out_person = outuser, out_time = date, fqty = fqty, style = 'F', lm_user = username, lm_date = date } });
+ }
+ else
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_OutRecord')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆澶栧崗璁板綍涓昏〃
+ sql = @"insert into TK_Wrk_OutRecord(wo_code,step_seq,step_code,wx_code,materiel_code,style,fqty,lm_user,lm_date)
+ values(@mesordercode,@stepseq,@stepcode,@wx_code,@partcode,@style,@fqty,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, wx_code = wxcode, partcode = partcode, style = 'F', fqty = fqty, lm_user = username, lm_date = date } });
+
+ //鍐欏叆瀛愯〃
+ sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,out_person,out_time,fqty,style,lm_user,lm_date)
+ values(@m_id,@wx_code,@out_person,@out_time,@fqty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { m_id = int.Parse(dt.Rows[0]["ID"].ToString()), wx_code = wxcode, out_person = outuser, out_time = date, fqty = fqty, style = 'F', lm_user = username, lm_date = date } });
+ }
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄧ姸鎬佷负START: 寮�宸�
+ sql = @"update TK_Wrk_Step set status='START' where wo_code=@mesordercode and step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode } });
+
+
+ //鍥炲啓宸ュ崟琛ㄧ姸鎬佷负锛� 寮�宸ワ細START
+ sql = @"update TK_Wrk_Man set status='START' where wo_code=@mesordercode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍙戞枡鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍙戞枡澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐, 鏀舵枡鎻愪氦]
+ public static ToMessage SavaMesOrderStepIn(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string inbarcode, string inuser, string taskqty, string sqty, string ngqty, string badcode, string remarks, string username)
+ {
+ var sql = "";
+ string[] arra1 = new string[] { };
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ //鎴彇涓嶈壇鍘熷洜
+ if (ngqty != "" || ngqty != "0")
+ {
+ //鎴彇涓嶈壇鍘熷洜
+ arra1 = badcode.Split(';');
+ }
+
+ list.Clear();
+ //鍒ゆ柇鏄惁鏈夋敹鏂欒褰�(鏈夛細锛堝悓宸ュ崟+宸ュ簭+澶栧崗渚涙柟淇敼锛� 鏃狅細鏂板)
+ sql = @"select * from TK_Wrk_OutRecord where wo_code=@wo_code and step_code=@step_code and wx_code=@wx_code and style='S'";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ dynamicParams.Add("@wx_code", wxcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //鑾峰彇鍙戞枡璁板綍鐨勯粯璁ら�変腑鐨勫鍗忎緵搴斿晢涓庢敹鏂欐椂鐨勫鍗忎緵搴斿晢鍋氬姣斿垽鏂�
+ sql = @"select A.wx_code,B.name,A.fqty from TK_Wrk_OutRecord A
+ inner join TCustomer B on A.wx_code=B.code
+ where A.wo_code=@wo_code and A.step_code=@step_code and wx_code=@wx_code and A.style='F' ";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ dynamicParams.Add("@wx_code", wxcode);
+ var da = DapperHelper.selectdata(sql, dynamicParams);
+ if (da.Rows.Count <= 0)
+ {
+ sql = @"select A.wx_code,B.name,A.fqty from TK_Wrk_OutRecord A
+ inner join TCustomer B on A.wx_code=B.code
+ where A.wo_code=@wo_code and A.step_code=@step_code and A.style='F' ";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ var da1 = DapperHelper.selectdata(sql, dynamicParams);
+ var dr = da1.AsEnumerable().ToList().Select(x => x.Field<string>("NAME")).ToList();
+ string wxstring = (string.Join(",", dr.Select(x => x.ToString()).ToArray()));
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡澶栧崗渚涙柟涓庡彂鏂欏鍗忎緵搴斿晢涓嶅尮閰�,搴斾负锛氥��" + wxstring + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ if ((decimal.Parse(sqty) + decimal.Parse(ngqty)) > decimal.Parse(da.Rows[0]["FQTY"].ToString())) //鏀舵枡鏁伴噺+涓嶈壇鏁伴噺>鍙戞枡鏁伴噺
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺,涓嶈兘澶т簬鍙戞枡鏁伴噺:" + da.Rows[0]["FQTY"].ToString() + "!";
+ mes.data = null;
+ return mes;
+ }
+ //if (da.Rows[0]["WX_CODE"].ToString() != wxcode)
+ //{
+ // mes.code = "300";
+ // mes.count = 0;
+ // mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡澶栧崗渚涙柟搴斾负锛�" + da.Rows[0]["NAME"].ToString() + "!";
+ // mes.data = null;
+ // return mes;
+ //}
+ if (data.Rows.Count > 0)
+ {
+ decimal sum_sqty = data.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum(); //鑾峰彇鍚屽崟鍙�,鍚屽伐搴�,鍚屽鍗忎緵搴斿晢鏀舵枡鎬绘暟閲�
+ decimal sum_fqty = da.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum(); //鑾峰彇鍚屽崟鍙�,鍚屽伐搴�,鍚屽鍗忎緵搴斿晢鍙戞枡鎬绘暟閲�
+ if ((sum_sqty + decimal.Parse(sqty) + decimal.Parse(ngqty)) > sum_fqty) //宸叉敹鏂欐�绘暟+褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺>鎬诲彂鏂欐暟閲�
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺,涓嶈兘澶т簬寰呮敹鏁伴噺:" + (sum_fqty - sum_sqty) + "!";
+ mes.data = null;
+ return mes;
+ }
+
+
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_OutRecord')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆澶栧崗璁板綍涓昏〃
+ sql = @"insert into TK_Wrk_OutRecord(wo_code,step_seq,step_code,wx_code,materiel_code,style,sqty,ng_qty,lm_user,lm_date,inbarcode)
+ values(@mesordercode,@stepseq,@stepcode,@wx_code,@partcode,@style,@sqty,@ngqty,@lm_user,@lm_date,@inbarcode)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, wx_code = wxcode, partcode = partcode, style = 'S', sqty = sqty, ngqty = ngqty, lm_user = username, lm_date = date, inbarcode = inbarcode } });
+
+ //鍐欏叆澶栧崗璁板綍瀛愯〃
+ sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,in_person,in_time,sqty,ng_qty,style,lm_user,lm_date)
+ values(@m_id,@wxcode,@in_person,@in_time,@sqty,@ng_qty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { m_id = int.Parse(dt.Rows[0]["ID"].ToString()), wxcode = wxcode, in_person = inuser, in_time = date, sqty = sqty, ng_qty = ngqty, style = "S", lm_user = username, lm_date = date } });
+
+ if (badcode != "" && ngqty != "0")
+ {
+ //鍐欏叆缂洪櫡璁板綍琛�
+ for (int i = 0; i < arra1.Length; i++)
+ {
+ sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,remarks,style,lm_user,lm_date)
+ values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@remarks,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], remarks = remarks, style = "S", lm_user = username, lm_date = date } });
+
+ }
+ }
+
+
+ ////淇敼澶栧崗璁板綍涓昏〃
+ //sql = @"update TK_Wrk_OutRecord set sqty=sqty+@sqty,ng_qty=ng_qty+@ngqty,lm_user=@username,lm_date=@CreateDate
+ // where wo_code=@mesordercode and step_code=@stepcode and wx_code=@wx_code and style='S'";
+ //list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, wx_code = wxcode, sqty = decimal.Parse(sqty), ngqty = decimal.Parse(ngqty), username = username, CreateDate = date } });
+ ////鍐欏叆澶栧崗璁板綍瀛愯〃
+ //sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,in_person,in_time,sqty,ng_qty,style,lm_user,lm_date)
+ // values(@m_id,@wx_code,@in_person,@in_time,@sqty,@ngqty,@style,@lm_user,@lm_date)";
+ //list.Add(new { str = sql, parm = new { m_id = int.Parse(data.Rows[0]["ID"].ToString()), wx_code = wxcode, in_person = inuser, in_time = date, sqty = sqty, ngqty = ngqty, style = 'S', lm_user = username, lm_date = date } });
+
+ //if (badcode != "" && ngqty != "0")
+ //{
+ // //鍐欏叆缂洪櫡璁板綍琛�
+ // for (int i = 0; i < arra1.Length; i++)
+ // {
+ // sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,style,lm_user,lm_date)
+ // values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@style,@lm_user,@lm_date)";
+ // list.Add(new { str = sql, parm = new { record_id = int.Parse(data.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], style = "S", lm_user = username, lm_date = date } });
+
+ // }
+ //}
+ }
+ else
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_OutRecord')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆澶栧崗璁板綍涓昏〃
+ sql = @"insert into TK_Wrk_OutRecord(wo_code,step_seq,step_code,wx_code,materiel_code,style,sqty,ng_qty,lm_user,lm_date,inbarcode)
+ values(@mesordercode,@stepseq,@stepcode,@wx_code,@partcode,@style,@sqty,@ngqty,@lm_user,@lm_date,@inbarcode)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, wx_code = wxcode, partcode = partcode, style = 'S', sqty = sqty, ngqty = ngqty, lm_user = username, lm_date = date, inbarcode = inbarcode } });
+
+ //鍐欏叆澶栧崗璁板綍瀛愯〃
+ sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,in_person,in_time,sqty,ng_qty,style,lm_user,lm_date)
+ values(@m_id,@wxcode,@in_person,@in_time,@sqty,@ng_qty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { m_id = int.Parse(dt.Rows[0]["ID"].ToString()), wxcode = wxcode, in_person = inuser, in_time = date, sqty = sqty, ng_qty = ngqty, style = "S", lm_user = username, lm_date = date } });
+
+ if (badcode != "" && ngqty != "0")
+ {
+ //鍐欏叆缂洪櫡璁板綍琛�
+ for (int i = 0; i < arra1.Length; i++)
+ {
+ sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_code,remarks,style,lm_user,lm_date)
+ values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_code,@remarks,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = ngqty, defect_code = arra1[i], remarks = remarks, style = "S", lm_user = username, lm_date = date } });
+
+ }
+ }
+ }
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ sql = @"update TK_Wrk_Step set good_qty=good_qty+@sqty,ng_qty=ng_qty+@ngqty where wo_code=@mesordercode and step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, sqty = sqty, ngqty = ngqty } });
+
+ //鍥炲啓宸ュ崟琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ //sql = @"update TK_Wrk_Man set good_qty=good_qty+@sqty,ng_qty=ng_qty+@ngqty where wo_code=@mesordercode";
+ //list.Add(new { str = sql, parm = new { mesordercode = mesordercode, sqty = sqty, ngqty = ngqty } });
+
+ ////鍐欏叆ERP鍏ュ簱鍗�
+
+ //鍒ゆ柇鏄惁鏈亾宸ュ簭瀹屽伐鎶ュ伐(鑷姩鍏抽棴宸ュ崟鍙婂伐搴忎换鍔�)
+ //list = AutosCloseOrder.AutosColseOrderReport(list, mesordercode, partcode, stepseq, stepcode, sqty, ngqty);
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏀舵垚鍔�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏀舵枡澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion'
+
+ #region[涓嶈壇澶勭悊,鎻愪氦]
+ public static ToMessage EditOrderNgStepSeave(ReportDefectHandle json, string username)
+ {
+ var sql = "";
+ string[] arra1 = new string[] { };
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ decimal sumrepair_qty = 0, sumbad_qty = 0; //绱缁翠慨鏁伴噺銆佺疮璁℃姤搴熸暟閲�
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ list.Clear();
+
+
+ //寰幆json鏁版嵁
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ //鑷埗宸ュ簭
+ if (json.Data.Rows[i]["STYLE"].ToString() == "Z")
+ {
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曞瓙琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_RecordSub set report_qty=report_qty+@repair_qty,ng_qty=ng_qty-@repair_qty-@bad_qty,bad_qty=bad_qty+@bad_qty
+ where m_id=@m_id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json.Data.Rows[i]["ID"].ToString()),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ bad_qty = decimal.Parse(json.Data.Rows[i]["BAD_QTY"].ToString())
+ }
+ });
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_Record set good_qty=good_qty+@repair_qty,ng_qty=ng_qty-@repair_qty-@bad_qty,bad_qty=bad_qty+@bad_qty
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ bad_qty = decimal.Parse(json.Data.Rows[i]["BAD_QTY"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ step_code = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ id = int.Parse(json.Data.Rows[i]["ID"].ToString())
+ }
+ });
+ //鍐欏叆鎶ュ伐缂洪櫡澶勭悊璁板綍琛�
+ sql = @"insert into CSR_WorkRecord_DefectHandle(record_subid,wo_code,partnumber,step_seq,step_code,repair_qty,bad_qty,defect_code,style,lm_user,lm_date)
+ values(@record_subid,@wo_code,@partcode,@stepseq,@stepcode,@repair_qty,@bad_qty,@defect_code,@style,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ record_subid = int.Parse(json.Data.Rows[i]["M_ID"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ partcode = json.Data.Rows[i]["MATERIEL_CODE"].ToString(),
+ stepseq = json.Data.Rows[i]["SEQ"].ToString(),
+ stepcode = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ bad_qty = decimal.Parse(json.Data.Rows[i]["BAD_QTY"].ToString()),
+ defect_code = json.Data.Rows[i]["DEFECT_CODE"].ToString(),
+ style = "B",
+ lm_user = username,
+ lm_date = date
+ }
+ });
+
+ sumrepair_qty = sumrepair_qty + decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString());
+ sumbad_qty = sumbad_qty + decimal.Parse(json.Data.Rows[i]["BAD_QTY"].ToString());
+ }
+ //澶栧崗宸ュ簭
+ if (json.Data.Rows[i]["STYLE"].ToString() == "S")
+ {
+ //鍥炲啓瀵瑰簲鐨勬敹鏂欒褰曞瓙琛ㄦ敹鏂欐暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_OutRecordSub set sqty=sqty+@repair_qty,ng_qty=ng_qty-@repair_qty-@bad_qty,bad_qty=bad_qty+@bad_qty
+ where m_id=@m_id and style='S'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json.Data.Rows[i]["ID"].ToString()),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ bad_qty = decimal.Parse(json.Data.Rows[i]["BAD_QTY"].ToString())
+ }
+ });
+ //鍥炲啓瀵瑰簲鐨勬敹鏂欒褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_OutRecord set sqty=sqty+@repair_qty,ng_qty=ng_qty-@repair_qty-@bad_qty,bad_qty=bad_qty+@bad_qty
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='S'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ bad_qty = decimal.Parse(json.Data.Rows[i]["BAD_QTY"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ step_code = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ id = int.Parse(json.Data.Rows[i]["ID"].ToString())
+ }
+ });
+ //鍐欏叆鎶ュ伐缂洪櫡澶勭悊璁板綍琛�
+ sql = @"insert into CSR_WorkRecord_DefectHandle(record_subid,wo_code,partnumber,step_seq,step_code,repair_qty,bad_qty,defect_code,style,lm_user,lm_date)
+ values(@record_subid,@wo_code,@partcode,@stepseq,@stepcode,@repair_qty,@bad_qty,@defect_code,@style,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ record_subid = int.Parse(json.Data.Rows[i]["M_ID"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ partcode = json.Data.Rows[i]["MATERIEL_CODE"].ToString(),
+ stepseq = json.Data.Rows[i]["SEQ"].ToString(),
+ stepcode = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ bad_qty = decimal.Parse(json.Data.Rows[i]["BAD_QTY"].ToString()),
+ defect_code = json.Data.Rows[i]["DEFECT_CODE"].ToString(),
+ style = "S",
+ lm_user = username,
+ lm_date = date
+ }
+ });
+ sumrepair_qty = sumrepair_qty + decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString());
+ sumbad_qty = sumbad_qty + decimal.Parse(json.Data.Rows[i]["BAD_QTY"].ToString());
+ }
+ }
+
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ sql = @"update TK_Wrk_Step set good_qty=good_qty+@sumrepair_qty,ng_qty=ng_qty-@sumrepair_qty-@sumbad_qty,bad_qty=bad_qty+@sumbad_qty where wo_code=@wo_code and step_code=@stepcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json.Data.Rows[0]["WO_CODE"].ToString(),
+ stepcode = json.Data.Rows[0]["STEP_CODE"].ToString(),
+ sumrepair_qty = sumrepair_qty,
+ sumbad_qty = sumbad_qty
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[宸ュ簭妫�楠屾壂鐮佽幏鍙栦换鍔′俊鎭痌
+ public static ToMessage MesOrderStepCheckSearch(string stu_torgcode, string orderstepqrcode, string checktype)
+ {
+ var sql = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<string, object> list = new Dictionary<string, object>();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忔潯鐮�!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ //鍒ゆ柇褰撳墠宸ュ崟鏄惁鍏抽棴
+ sql = @"select * from TK_Wrk_Man where wo_code=@ordercode and wkshp_code=@stu_torgcode and status='CLOSED'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ var da0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (da0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟宸插叧闂�,涓嶅厑璁告楠屾搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //0.鍒ゆ柇褰撳墠宸ュ崟鎵�灞炶溅闂存槸鍚︿负褰撳墠鐧诲綍浜哄憳杞﹂棿
+ sql = @"select * from TK_Wrk_Man where wo_code=@ordercode and wkshp_code=@stu_torgcode";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ var da1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (da1.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "涓嶆槸鏈溅闂寸敓浜т换鍔�,涓嶅厑璁告楠屾搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //閫氳繃鎵弿浜岀淮鐮佷俊鎭煡鎵句换鍔′俊鎭�
+ sql = @"select A.wo_code,A.good_qty,M.partcode,M.partname,M.partspec,M.stocktype_code,S.stepcode,S.stepname
+ from TK_Wrk_Step A
+ inner join TK_Wrk_Man P on A.wo_code=P.wo_code
+ left join TMateriel_Info M on P.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ where A.wo_code=@wo_code and A.step_code=@stepcode";
+ dynamicParams.Add("@wo_code", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ if (decimal.Parse(data.Rows[0]["good_qty"].ToString()) > 0)
+ {
+ //鑾峰彇缁戝畾鐨勮川妫�鏂规銆佹娊鏍锋柟寮忋�佹牱鏈暟
+ sql = @"select code as checkstandcode,name as checkstandname,sampmethod,sampscare
+ from TStepCheckStandard
+ where (PATINDEX('%,' + RTRIM(@partcode) + ',%',',' + suitpart + ',')>0 or PATINDEX('%,' + RTRIM(@stocktype_code) + ',%',',' + suitpart + ',')>0)
+ and checktype=@checktype and stepcode=@stepcode ";
+ dynamicParams.Add("@partcode", data.Rows[0]["partcode"].ToString());//鐗╂枡缂栫爜
+ dynamicParams.Add("@stepcode", stepcode);//宸ュ簭缂栫爜
+ dynamicParams.Add("@stocktype_code", data.Rows[0]["stocktype_code"].ToString());//瀛樿揣绫诲瀷缂栫爜
+ dynamicParams.Add("@checktype", checktype);//妫�楠岀被鍨�
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ list.Add("labcont", data);
+ list.Add("chekstand", data1);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠浜у搧銆�" + data.Rows[0]["partname"].ToString() + "銆�,瀵瑰簲宸ュ簭銆�" + data.Rows[0]["stepname"].ToString() + "銆戯紝鏈寚瀹氳川妫�鏂规!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟鏃犳姤宸ヤ骇鍑�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鐢熶骇浠诲姟涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浜岀淮鐮佷俊鎭负绌�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠屾牴鎹�夋嫨鐨勬楠屾柟妗堟煡鎵炬楠岄」鐩甝
+ public static ToMessage MesOrderStepCheckItemList(string checkstandcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //璐ㄦ鏂规缂栫爜鑾峰彇妫�楠岄」
+ sql = @"select A.stepcheckitem_seq, B.code,B.name,A.required,A.numberjudge,A.unit,A.decimalnum,
+ A.standvalue,A.uppervalue,A.lowervalue,A.stepcheckitem_desc
+ from TStepCheckStandardSub A
+ left join TStepCheckItem B on A.stepcheckitem_code=B.code
+ where A.stepstaned_code=@checkstandcode
+ order by A.stepcheckitem_seq";
+ dynamicParams.Add("@checkstandcode", checkstandcode);//璐ㄦ鏂规缂栫爜
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠璐ㄦ鏂规鏃犳楠岄」!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠�,鎻愪氦]
+ public static ToMessage SaveMesOrderStepCheckItem(string stu_torgcode, string wocode, string partcode, string stepcode, string checkstandcode, string check_type, string sampmethod, string qualitystatus, string labqty, string sampleqty, string goodqty, string ngqty, string checkitemcont, string username)
+ {
+ var sql = "";
+ string checktypename = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string datetime = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ //鑾峰彇妫�楠岄」鐩俊鎭�
+ JArray arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(checkitemcont);
+ list.Clear();
+
+ //鍐欏叆妫�楠岃褰曚富琛�
+ sql = @"insert into TStepCheckRecord(wo_code,partcode,step_code,checkstaned_code,check_user,check_type,check_typename,sampmethod,check_result,check_qty,good_qty,ng_qty,lm_user,lm_date,torg_code)
+ values(@wo_code,@partcode,@step_code,@checkstaned_code,@check_user,@check_type,@check_typename,@sampmethod,@check_result,@check_qty,@good_qty,@ng_qty,@lm_user,@lm_date,@torg_code)";
+ switch (check_type)
+ {
+ case "FirstCheck":
+ checktypename = "棣栨";
+ break;
+ case "PatroCheck":
+ checktypename = "宸℃";
+ break;
+ case "EndCheck":
+ checktypename = "瀹屽伐妫�楠�";
+ break;
+ default:
+ break;
+ }
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wocode,
+ partcode = partcode,
+ step_code = stepcode,
+ checkstaned_code = checkstandcode,
+ check_user = username,
+ check_type = check_type,
+ check_typename = checktypename,
+ sampmethod = sampmethod,
+ check_result = qualitystatus,
+ check_qty = decimal.Parse(sampleqty),
+ good_qty = decimal.Parse(goodqty),
+ ng_qty = decimal.Parse(ngqty),
+ lm_user = username,
+ lm_date = datetime,
+ torg_code = stu_torgcode
+ }
+ });
+ //鍐欏叆妫�楠岃褰曞瓙琛�
+ for (int j = 0; j < arra.Count; j++)
+ {
+ sql = @"insert into TStepCheckRecordSub(m_id,checknum,checkitem_seq,checkitem_code,checkitem_name,checkitem_descr,check_value,check_result,lm_user,lm_date,torg_code)
+ values(CONVERT(INT,IDENT_CURRENT('TStepCheckRecord')),@checknum,@checkiem_seq,@checkitem_code,@checkitem_name,@checkitem_descr,@check_value,@check_result,@lm_user,@lm_date,@torg_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checknum = arra[j]["checknum"].ToString(),
+ checkiem_seq = arra[j]["checkiem_seq"].ToString(),
+ checkitem_code = arra[j]["checkitem_code"].ToString(),
+ checkitem_name = arra[j]["checkitem_name"].ToString(),
+ checkitem_descr = arra[j]["checkitem_descr"].ToString(),
+ check_value = arra[j]["check_value"].ToString(),
+ check_result = arra[j]["check_result"].ToString(),
+ lm_user = username,
+ lm_date = datetime,
+ torg_code = stu_torgcode
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+
+ #region[MES宸ュ崟鎵归噺鍏抽棴鏌ヨ]
+ public static ToMessage MesOrderBitchClosedSearch(string stu_torgcode, string stu_torgtypecode, string mesorderstus, string mesordercode, string sourceorder, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ switch (stu_torgtypecode)
+ {
+ case "":
+ break;
+ case "D":
+ search += "and L.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ case "W":
+ search += "and C.org_code=@stu_torgcode ";
+ dynamicParams.Add("@stu_torgcode", stu_torgcode);
+ break;
+ default:
+ break;
+ }
+ if (mesorderstus != "" && mesorderstus != null)
+ {
+ search += "and A.status=@mesorderstus ";
+ dynamicParams.Add("@mesorderstus", mesorderstus);
+ }
+ if (mesordercode != "" && mesordercode != null)
+ {
+ search += "and A.wo_code like '%'+@mesordercode+'%' ";
+ dynamicParams.Add("@mesordercode", mesordercode);
+ }
+ if (sourceorder != "" && sourceorder != null)
+ {
+ search += "and A.m_po like '%'+@sourceorder+'%' ";
+ dynamicParams.Add("@sourceorder", sourceorder);
+ }
+ if (ordertype != "" && ordertype != null)
+ {
+ search += "and A.wotype like '%'+@ordertype+'%' ";
+ dynamicParams.Add("@ordertype", ordertype);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and B.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (createdate != "" && createdate != null)
+ {
+ search += "and CONVERT(varchar(100),A.lm_date,23)=@createdate ";
+ dynamicParams.Add("@createdate", createdate);
+ }
+ if (creatuser != "" && creatuser != null)
+ {
+ search += "and U.username like '%'+@creatuser+'%' ";
+ dynamicParams.Add("@creatuser", creatuser);
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.org_name as wkshp_name,
+ A.route_code,E.name as route_name,A.stck_code,F.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,U.username as lm_user,A.lm_date
+ ,(select sum(S.good_qty) from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as good_qty
+ ,(select sum(S.ng_qty) from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as ng_qty
+ ,(select sum(S.bad_qty) from TK_Wrk_Step S where S.wo_code=A.wo_code and S.isend='Y') as bad_qty
+ from TK_Wrk_Man A
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TOrganization C on A.wkshp_code=C.org_code
+ left join T_Sec_Stck D on A.stck_code=D.code
+ left join TFlw_Rout E on A.route_code=E.code
+ left join T_Sec_Stck F on A.stck_code=F.code
+ left join TUser U on A.lm_user=U.usercode
+ left join TOrganization L on C.parent_id=L.id
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺鍏抽棴鎻愪氦]
+ public static ToMessage MesOrderBitchClosedSeave(string username, DataTable dt)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ //鍏抽棴宸ュ崟瀵瑰簲宸ュ簭浠诲姟
+ sql = @"update TK_Wrk_Step set status='CLOSED' where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = dt.Rows[i]["WO_CODE"].ToString() } });
+ //鍥炲啓宸ュ崟琛ㄧ姸鎬佷负(鍏抽棴)
+ sql = @"update TK_Wrk_Man set status='CLOSED',closeuser=@username,closedate=@closedate where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = dt.Rows[i]["WO_CODE"].ToString(), username = username, closedate = DateTime.Now.ToString() } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "宸ュ崟鍏抽棴鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟鍏抽棴澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺鍙嶅叧闂璢
+ public static ToMessage MesOrderBitchAntiClosedSeave(string username, DataTable dt)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ for (int i = 0; i < dt.Rows.Count; i++)
+ {
+ //鍏抽棴宸ュ崟瀵瑰簲宸ュ簭浠诲姟
+ sql = @"update TK_Wrk_Step set status='START' where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = dt.Rows[i]["WO_CODE"].ToString() } });
+ //鍥炲啓宸ュ崟琛ㄧ姸鎬佷负(鍏抽棴)
+ sql = @"update TK_Wrk_Man set status='START',closeuser=@username,closedate=@closedate where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = dt.Rows[i]["WO_CODE"].ToString(), username = username, closedate = DateTime.Now.ToString() } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "宸ュ崟鍏抽棴鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟鍏抽棴澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[浜ц兘瑙勫垝璁剧疆鏌ヨ]
+ public static ToMessage CapacityPlanningSetupSearch()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"select code,name,wktme1_start,wktme2_start,wktme3_start,wktme4_start,wktme5_start,
+ lm_user,lm_date,duration
+ from TBas_wkshift_info";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝璁剧疆鏂板]
+ public static ToMessage CapacityPlanningSetupAddUpdate(string username, List<CapacityPlanningSetup> objs)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇缂栫爜鏄惁閲嶅
+ sql = @"select * from TBas_wkshift_info where code=@code";
+ dynamicParams.Add("@code", objs[0].CapSetupCode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缂栫爜宸插瓨鍦�,涓嶈兘閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇鍚嶇О鏄惁閲嶅
+ sql = @"select * from TBas_wkshift_info where name=@name";
+ dynamicParams.Add("@name", objs[0].CapSetupName);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍚嶇О宸插瓨鍦�,涓嶈兘閲嶅!";
+ mes.data = null;
+ return mes;
+ }
+ list.Clear();
+ //寰幆鍐欏叆璁惧绫诲瀷琛�
+ for (int i = 0; i < objs.Count; i++)
+ {
+ sql = @"insert into TBas_wkshift_info(code, name, wktme1_start, wktme2_start, wktme3_start, wktme4_start, wktme5_start, lm_user, lm_date, duration)
+ values(@code,@name,@wktme1_start,@wktme2_start,@wktme3_start,@wktme4_start,@wktme5_start,@lm_user,@lm_date,@duration)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = objs[i].CapSetupCode,
+ name = objs[i].CapSetupName,
+ wktme1_start = objs[i].OneStartDate,
+ wktme2_start = objs[i].TwoStartDate,
+ wktme3_start = objs[i].ThreeStartDate,
+ wktme4_start = objs[i].FourStartDate,
+ wktme5_start = objs[i].FiveStartDate,
+ lm_user = username,
+ lm_date = DateTime.Now.ToString(),
+ duration = objs[i].Duration
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝鏂规璁剧疆鍒犻櫎]
+ public static ToMessage CapacityPlanningSetupDelete(string username, string capsetupcode)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇鏂规鏄惁琚紩鐢�
+ sql = @"select * from TWkm_capac_plan where wkshift_code=@capsetupcode";
+ dynamicParams.Add("@capsetupcode", capsetupcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触锛�,璇ユ柟妗堝凡缁忚浜ц兘瑙勫垝璧勬簮寮曠敤!";
+ mes.data = null;
+ return mes;
+ }
+ list.Clear();
+ //鍒犻櫎鏂规
+
+ sql = @"delete TBas_wkshift_info where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = capsetupcode
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝鏌ヨ]
+ public static ToMessage CapacityPlanningSearch(string workshop, string devicetype, string stustype, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (workshop != "" && workshop != null)
+ {
+ search += "and A.wksp_code=@workshop ";
+ dynamicParams.Add("@workshop", workshop);
+ }
+ if (devicetype != "" && devicetype != null)
+ {
+ search += "and A.code=@devicetype ";
+ dynamicParams.Add("@devicetype", devicetype);
+ }
+ if (stustype != "" && stustype != null)
+ {
+ search += "and B.enable=@stustype ";
+ dynamicParams.Add("@stustype", stustype);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select
+ B.id CaptPlanId,
+ A.wksp_code CaptPlanWorkShopid,
+ C.org_name CaptPlanWorkShop,
+ A.code CaptPlanDeviceTypeid,
+ A.name CaptPlanDeviceType,
+ A.ClassType CaptPlanType,
+ E.aa CaptPlanShopCalendar,
+ E.RR CaptPlanShopMaxDate,
+ E.TT CaptPlanShopCalendarList,
+ B.wkshift_code CaptPlanWorkShiftCode,
+ D.name CaptPlanWorkShift,
+ D.duration CaptPlanDuration,
+ B.lm_date CaptPlanDate,
+ B.ENABLE CaptPlanStus,
+ G.username CaptPlanUser
+ FROM(
+ select distinct B.wksp_code,A.code,A.name,'D' ClassType from TEqpType A
+ left join TEqpInfo B on A.code=B.eqptype_code
+ left join TFlw_Rteqp C on B.code=C.eqp_code
+ left join TFlw_Rtdt D on C.step_code=D.step_code
+ where D.first_choke='Y' --order by A.code
+ )A
+ left join TOrganization C on A.wksp_code=C.org_code
+ left join TWkm_capac_plan B ON A.wksp_code=B.wkshop and A.code=B.eqp_typecode
+ left join TBas_wkshift_info D on B.wkshift_code=D.code
+ left join TUser G on B.lm_user=G.usercode
+ left join (
+ select m_id,
+ min(CONVERT(varchar(100), wkdate, 23))+'~'+max(CONVERT(varchar(100), wkdate, 23)) aa,
+ max(CONVERT(varchar(100), wkdate, 23))RR,
+ STUFF((
+ SELECT ',' + CONVERT(varchar(100),t1.wkdate, 23)
+ FROM TWkm_capac_plan_sub t1
+ WHERE t1.m_id = t0.m_id
+ ORDER BY t1.m_id
+ FOR XML PATH('')), 1, LEN(','), '') AS TT
+ FROM TWkm_capac_plan_sub t0 where CONVERT(varchar(100), wkdate, 23)>=CONVERT(varchar(100),getdate(), 23)
+ GROUP BY t0.m_id
+ ) E on B.id=E.m_id
+ where C.description='W' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝榛樿鏂规淇濆瓨鎻愪氦]
+ public static ToMessage CapacityPlanSubmit(string type, string captplanid, string wkshopcode, string capunitcode, string capsetupcode, string captplantype, string username)
+ {
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (type == "Add")
+ {
+ var sql = @"insert into TWkm_capac_plan(wkshop, eqp_typecode, wkshift_code, enable, lm_user, lm_date,classtype)
+ values(@wkshop,@eqp_typecode,@wkshift_code,@enable,@lm_user,@lm_date,@classtype)";
+ dynamicParams.Add("@wkshop", wkshopcode);
+ dynamicParams.Add("@eqp_typecode", capunitcode);
+ dynamicParams.Add("@wkshift_code", capsetupcode);
+ dynamicParams.Add("@enable", "Y");
+ dynamicParams.Add("@lm_user", username);
+ dynamicParams.Add("@lm_date", DateTime.Now.ToString());
+ dynamicParams.Add("@classtype", captplantype);
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (type == "Update")
+ {
+ var sql = @"update TWkm_capac_plan set wkshift_code=@wkshift_code,lm_user=@username,lm_date=@CreateDate where id=@captplanid";
+ dynamicParams.Add("@captplanid", captplanid);
+ dynamicParams.Add("@wkshift_code", capsetupcode);
+ dynamicParams.Add("@username", username);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝鐐瑰嚮鏃ュ巻缁勪欢鏌ユ壘宸插叧鑱旂殑鏃ユ湡鏂规]
+ public static ToMessage CapacityPlanningCalendar(string captplanid)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<CapaPlan> list = new List<CapaPlan>();
+ try
+ {
+ sql = @"select CONVERT(varchar(100), wkdate, 23) DataTime,wkshift_code from TWkm_capac_plan_sub where m_id=@captplanid";
+ dynamicParams.Add("@captplanid", captplanid);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ string DataTime = data.Rows[i]["DataTime"].ToString();//鏃ユ湡
+ string key = data.Rows[i]["wkshift_code"].ToString(); //鏂规缂栫爜
+ CapaPlan cmp = new CapaPlan();
+ cmp.name = DataTime;
+ cmp.key = key;
+ list.Add(cmp);
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝鏃ュ巻鍙屽嚮鏃跺甫鍑哄搴旂殑鏂规]
+ public static ToMessage CapacityPlanningOnclickSelect(string captplanid, string datetime)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<CapacityPlanSect> list = new List<CapacityPlanSect>();
+ try
+ {
+ sql = @"select distinct AA.code,AA.name,(case when AA.Stus is null then 'N' else 'Y' end) flag
+ from
+ (
+ select A.code,A.name,B.wkshift_code Stus from TBas_wkshift_info A
+ left join TWkm_capac_plan_sub B on A.code= B.wkshift_code and B.m_id=@captplanid and CONVERT(varchar(100), wkdate, 23)=@datetime
+ ) AA order by code";
+ dynamicParams.Add("@captplanid", captplanid);
+ dynamicParams.Add("@datetime", datetime);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ for (int i = 0; i < data.Rows.Count; i++)
+ {
+ string code = data.Rows[i]["code"].ToString();//鏂规缂栫爜
+ string name = data.Rows[i]["name"].ToString();//鏂规鍚嶇О
+ string flag = data.Rows[i]["flag"].ToString(); //閫変腑鏂规鏍囪瘑
+ CapacityPlanSect cmp = new CapacityPlanSect();
+ cmp.CapCode = code;
+ cmp.CapName = name;
+ cmp.CapStus = flag;
+ cmp.list = new List<object>();
+
+ string sql1 = @"select wktme1_start,wktme2_start,wktme3_start,wktme4_start,wktme5_start from TBas_wkshift_info where code=@code";
+ dynamicParams.Add("@code", code);
+ var db = DapperHelper.selectdata(sql1, dynamicParams);
+
+ for (int j = 0; j < db.Columns.Count; j++) //鏃堕棿娈�
+ {
+ if (db.Rows[0][j].ToString().Trim() != null && db.Rows[0][j].ToString().Trim() != "")
+ {
+ cmp.list.Add(db.Rows[0][j].ToString());
+ }
+ }
+ list.Add(cmp);
+ }
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜ц兘瑙勫垝宸ヤ綔鏃ュ巻閫夋嫨鎻愪氦]
+ public static ToMessage CapacityPlanningGivePlanSubmit(string captplanid, string wkshopcode, string capunitcode, string capsetupcode, string captplantype, List<CapaPlan> objs, string type, string username)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ if (capsetupcode == "" || capsetupcode == null)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "榛樿鏂规閫夋嫨涓嶈兘涓虹┖!";
+ mes.data = null;
+ return mes;
+ }
+ if (objs.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ヤ綔鏃ュ巻閫夋嫨涓嶈兘涓虹┖!";
+ mes.data = null;
+ return mes;
+ }
+ if (type == "Add")
+ {
+ for (int i = 0; i < objs.Count; i++)
+ {
+ sql = @"insert into TWkm_capac_plan_sub(m_id, wkdate,wkshift_code)
+ values(@m_id,@wkdate,@wkshift_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = captplanid,
+ wkdate = objs[i].name,
+ wkshift_code = objs[i].key
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ if (type == "Update")
+ {
+ //瀹氫箟涓や釜鏁扮粍鐢ㄦ潵瀵规瘮淇敼鍓嶅悗鏃ユ湡鍙婃柟妗堢殑鍙樺寲
+ List<CapaPlan> ids = new List<CapaPlan>();
+ List<CapaPlan> ids1 = new List<CapaPlan>();
+ for (int i = 0; i < objs.Count; i++)
+ {
+ ids.Add(objs[i]);
+ }
+
+ //鏍规嵁id鏌ユ壘鏃ュ巻鏃堕棿
+ string sql2 = @"select CONVERT(varchar(100), wkdate, 23) wkdate,wkshift_code from TWkm_capac_plan_sub where m_id=@m_id";
+ dynamicParams.Add("@m_id", captplanid);
+ var dt2 = DapperHelper.selectdata(sql2, dynamicParams);
+ if (dt2.Rows.Count > 0)
+ {
+ for (int k = 0; k < dt2.Rows.Count; k++)
+ {
+ CapaPlan ids2 = new CapaPlan();
+ ids2.name = dt2.Rows[k]["wkdate"].ToString();
+ ids2.key = dt2.Rows[k]["wkshift_code"].ToString();
+ ids1.Add(ids2);
+ }
+ }
+
+ List<CapaPlan> list3 = ids.Except(ids1).ToList(); //琛ㄧずids涓摢浜涘�兼槸ids1涓墍涓嶅瓨鍦ㄧ殑;
+ List<CapaPlan> list4 = ids1.Except(ids).ToList(); //琛ㄧずids1涓摢浜涘�兼槸ids涓墍涓嶅瓨鍦ㄧ殑;
+ list4 = list3.Union(list4).ToList();
+ //鏌ユ壘鍏抽敭宸ュ簭璁惧銆佸伐浣嶇兢缁勭殑鎵�鏈夎澶�
+ string sql3 = @"select distinct A.code,A.name from TEqpInfo A
+ left join TFlw_Rteqp B on A.code=B.eqp_code
+ left join TFlw_Rtdt D on B.step_code=D.step_code
+ where A.wksp_code=@wkshopcode and D.first_choke='Y' order by A.code";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ var dt3 = DapperHelper.selectdata(sql3, dynamicParams);
+ if (list4.Count > 0) //濡傛灉鏃ユ湡鏈夊彉鍔�
+ {
+ if (dt3.Rows.Count > 0)
+ {
+ for (int m = 0; m < list4.Count; m++)
+ {
+ for (int n = 0; n < dt3.Rows.Count; n++)
+ {
+ string sql4 = @"select A.wo_code,A.eqp_code,A.Time_Start,A.time_end,
+ (case B.Status when 'SCHED' then '宸叉帓绋�' when 'ALLOC' then '宸叉淳鍙�' when 'START' then '宸插紑宸�' end ) status
+ from TK_Wrk_EqpAps A
+ left join TK_Wrk_Man B on A.wo_code=B.wo_code
+ left join TEqpInfo C on A.eqp_code=C.code
+ where CONVERT(varchar(100), time_start, 23)=@time_start and A.eqp_code=@eqp_code and B.isaps='Y' and B.status IN('SCHED','ALLOC','START')";
+ dynamicParams.Add("@time_start", list4[m].name);
+ dynamicParams.Add("@eqp_code", dt3.Rows[n]["CODE"]);
+ var dt4 = DapperHelper.selectdata(sql4, dynamicParams);
+ if (dt4.Rows.Count > 0)
+ {
+ for (int g = 0; g < dt4.Rows.Count; g++)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼澶辫触锛�,鏃ユ湡锛�" + dt4.Rows[g]["TIME_START"] + "鏈夈��" + dt4.Rows[g]["STATUS"] + "銆戝伐鍗曪細" + dt4.Rows[g]["WO_CODE"] + "";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ }
+ }
+ //鏇存柊鎺掍骇鐢熶骇璧勬簮涓昏〃
+ sql = @"update TWkm_capac_plan set wkshift_code=@wkshift_code,classtype=@classtype,lm_user=@lm_user,lm_date=@lm_time where id=@id";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ id = captplanid,
+ wkshift_code = capsetupcode,
+ classtype = captplantype,
+ lm_user = username,
+ lm_time = DateTime.Now.ToString()
+ }
+ });
+ //鍒犻櫎鎺掍骇鐢熶骇璧勬簮瀛愯〃
+ sql = @"delete TWkm_capac_plan_sub where m_id=@id";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ id = captplanid
+ }
+ });
+ //寰幆鍐欏叆鎺掍骇鐢熶骇璧勬簮瀛愯〃
+ for (int i = 0; i < objs.Count; i++)
+ {
+ sql = @"insert into TWkm_capac_plan_sub(m_id,wkdate,wkshift_code) values(@m_id,@wkdate,@wkshift_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = captplanid,
+ wkdate = objs[i].name,
+ wkshift_code = objs[i].key
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[鑷姩鎺掔▼宸ュ崟鏌ヨ]
+ public static ToMessage AdvancedSchedulingSearch(string workshop, string wocode, string partcode, string partname, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (workshop != "" && workshop != null)
+ {
+ search += "and A.wkshp_code=@workshop ";
+ dynamicParams.Add("@workshop", workshop);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and A.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and C.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select
+ A.id AdvaScheId,
+ A.status AdvaScheStus,
+ A.wo_code AdvaScheWorkCode,
+ A.wkshp_code AdvaScheWorkShopid,
+ M.org_name AdvaScheWorkShop,
+ A.materiel_code AdvaSchePartNumber,
+ C.partname AdvaSchePartName,
+ C.partspec AdvaSchePartSpec,
+ D.name AdvaSchePartModel,
+ A.plan_qty AdvaScheQty,
+ U.name AdvaScheUom,
+ isnull(E.sched_qty,0) AdvaScheYPQty,
+ CONVERT(varchar(100), A.saleOrderDeliveryDate, 23) AdvaScheEndDate,
+ convert(varchar(20),isnull(E.sched_qty,0))+'/'+convert(varchar(20),isnull(A.plan_qty,0)) AdvaScheSpeed,
+ A.route_code AdvaScheRoutid,
+ F.name AdvaScheRoutName,
+ E.step_code AdvaScheBotProcid,
+ G.stepname AdvaScheBotProcName,
+ CONVERT(varchar(100), H.maxtime, 23) AdvaSchePCEndDate,
+ CONVERT(varchar(100), H.mintime, 23) AdvaSchePCStartDate,
+ (case when CONVERT(varchar(100), H.maxtime, 23)<=CONVERT(varchar(100), E.plan_enddate, 23) then 'Y' when H.MAXTime is null then 'Y' else 'N' end) Flag,
+ (case when A.PiroQue='1' then '鐗规��' when A.PiroQue='2' then '绱ф��' when A.PiroQue='3' then '姝e父' end) AdvaSchePiroQue
+ from TK_Wrk_Man A
+ left join TMateriel_Info C on C.partcode= A.materiel_code
+ left join T_Dict D on C.stocktype_code= d.code
+ left join TK_Wrk_Step E on E.wo_code=A.wo_code
+ left join TFlw_Rout F on A.route_code=F.code
+ left join TStep G on E.step_code=G.stepcode
+ left join (select wo_code, max(TIME_END) MAXTime,min(time_start) MINTime from TK_Wrk_EqpAps group by wo_code) H on A.wo_code=H.wo_code
+ left join TUom U on C.uom_code=U.code
+ left join TOrganization M on A.wkshp_code=M.org_code
+ where E.isbott = 'Y' and A.status='NOSCHED' and A.isaps='Y' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鎺掍骇璁惧淇℃伅]
+ public static List<AdvancedSchedulingDevice> OnclickAdvancedSchedulingDevice(string wocode, string wkshpcode, string partcode, string startdate, string enddate, ref ToMessage mes)
+ {
+ string sql = "", sql0 = "";
+ var dynamicParams = new DynamicParameters();
+ List<AdvancedSchedulingDevice> list = new List<AdvancedSchedulingDevice>();
+ DataTable dt, dt1;
+
+ DateTime beginDate = Convert.ToDateTime(startdate);
+ DateTime endDate = DateTime.Parse(enddate);
+ try
+ {
+ if (beginDate > endDate)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瑕佹眰浜や粯鏃堕棿涓嶈兘灏忎簬褰撳墠绯荤粺鏃堕棿锛�";
+ mes.data = null;
+ return list;
+ }
+ bool IsCap = false; //鏄惁璁剧疆浜ц兘
+ //閫氳繃宸ュ崟鏌ユ壘瀵瑰簲杞﹂棿宸ヨ壓璺嚎涓嬪叧閿伐搴忔墍鍏宠仈鐨勮澶囨槸鍚﹀彲鐢�
+ sql = @"select distinct C.eqp_code ,D.Enable from TK_Wrk_Man A
+ left join TFlw_Rout K on A.route_code=K.code
+ left join TFlw_Rtdt B on K.code=B.rout_code and B.first_choke='Y'
+ left join TFlw_Rteqp C on B.step_code= C.step_code
+ left join TEqpInfo D on C.eqp_code=D.code
+ where A.wo_code=@wocode and A.materiel_code=@partcode and D.wksp_code=@wkshpcode";
+ dynamicParams.Add("@wocode", wocode);
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@wkshpcode", wkshpcode);
+ var dt_0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt_0.Rows.Count > 0)
+ {
+ int cout = dt_0.Rows.Count;
+ int num = 0;
+ for (int m = 0; m < dt_0.Rows.Count; m++)
+ {
+ if (dt_0.Rows[m]["Enable"].ToString() == "N")
+ {
+ num = num + 1;
+ }
+ }
+ if (num == cout)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧涓嶅彲鐢紒";
+ mes.data = null;
+ return list;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ヨ壓璺嚎鏈叧鑱旇澶囷紒";
+ mes.data = null;
+ return list;
+ }
+
+ //閫氳繃宸ュ崟鏌ユ壘宸ヨ壓璺嚎瀵瑰簲鍏抽敭宸ュ簭鎵�鍏宠仈鐨勮澶囨墍灞炶溅闂�
+ sql0 = @"select distinct D.wksp_code from TK_Wrk_Man A
+ left join TFlw_Rout K on A.route_code=K.code
+ left join TFlw_Rtdt B on K.code=B.rout_code and B.first_choke='Y'
+ left join TFlw_Rteqp C on B.step_code= C.step_code
+ left join TEqpInfo D on C.eqp_code=D.code
+ where A.wo_code=@wocode and A.materiel_code=@partcode ";
+ dynamicParams.Add("@wocode", wocode);
+ dynamicParams.Add("@partcode", partcode);
+ var dt0 = DapperHelper.selectdata(sql0, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ string sy = "0";
+ for (int i = 0; i < dt0.Rows.Count; i++)
+ {
+ if (dt0.Rows[i]["WKSP_CODE"].ToString() == wkshpcode) //宸ュ崟鍒涘缓杞﹂棿鏄惁绛変簬鎺掍骇璁惧 杞﹂棿
+ {
+ sy = "1";
+ break;
+ }
+ else
+ {
+ sy = "0";
+ }
+ }
+ if (sy == "0")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎺掍骇璁惧杞﹂棿涓庡伐鍗曞垱寤虹殑杞﹂棿涓嶅悓锛�";
+ mes.data = null;
+ return list;
+ }
+ else
+ {
+ List<APSList> listData = SchedulingMethod.SchedulingMethodTF(wocode, wkshpcode, partcode);
+ for (DateTime date = beginDate; date <= endDate; date = date.AddDays(1))
+ {
+ AdvancedSchedulingDevice tbj = new AdvancedSchedulingDevice();
+ tbj.YearDate = date.ToString("yyyy-MM-dd");
+ tbj.children = new List<AdvancedSchedulingDeviceCont>();
+ for (int j = 0; j < listData.Count; j++)
+ {
+ if (listData[j].AdvaDevicCropMob.ToString() == "0" || listData[j].AdvaDevicRhythm.ToString() == "")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎺掔▼璁惧" + listData[j].eqp_id.ToString() + "绋煎姩鐜囦笉鑳戒负0鎴栦负绌猴紒";
+ mes.data = null;
+ return list;
+ }
+ if (listData[j].AdvaDevicRhythm.ToString() == "0" || listData[j].AdvaDevicRhythm.ToString() == "")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎺掔▼璁惧" + listData[j].eqp_id.ToString() + "鏈缃妭鎷嶏紒";
+ mes.data = null;
+ return list;
+ }
+ string sql1 = @"select wktme1_start,wktme2_start,wktme3_start,wktme4_start,wktme5_start,G.name
+ from TWkm_capac_plan E
+ left join TWkm_capac_plan_sub F on E.id=F.m_id
+ left join TBas_wkshift_info G on F.wkshift_code=G.code
+ where E.wkshop=@wkshop and E.eqp_typecode=@eqp_typecode and E.ClassType=@classtype
+ and CONVERT(varchar(100), F.wkdate, 23)=@wkdate and E.enable='Y'";
+ dynamicParams.Add("@wkshop", wkshpcode);
+ dynamicParams.Add("@eqp_typecode", listData[j].Style.ToString());
+ dynamicParams.Add("@classtype", listData[j].ClassType.ToString());
+ dynamicParams.Add("@wkdate", date.ToString("yyyy-MM-dd"));
+ dt1 = DapperHelper.selectdata(sql1, dynamicParams);
+
+ AdvancedSchedulingDeviceCont tbjson = new AdvancedSchedulingDeviceCont();
+ tbjson.AdvaDevicNumber = listData[j].eqp_id.ToString();
+ tbjson.AdvaDevicName = listData[j].name.ToString();
+ tbjson.AdvaDevicCropMob = listData[j].AdvaDevicCropMob.ToString(); //绋煎姩鐜�
+ tbjson.AdvaDevicRhythm = listData[j].AdvaDevicRhythm.ToString(); //鐢熶骇鑺傛媿
+ if (dt1.Rows.Count > 0)
+ {
+ tbjson.OneStartDate = dt1.Rows[0]["wktme1_start"].ToString();
+ tbjson.TwoStartDate = dt1.Rows[0]["wktme2_start"].ToString();
+ tbjson.ThreeStartDate = dt1.Rows[0]["wktme3_start"].ToString();
+ tbjson.FourStartDate = dt1.Rows[0]["wktme4_start"].ToString();
+ tbjson.FiveStartDate = dt1.Rows[0]["wktme5_start"].ToString();
+ tbj.children.Add(tbjson);
+ IsCap = true;
+ }
+ else
+ {
+
+ tbjson.OneStartDate = "";
+ tbjson.TwoStartDate = "";
+ tbjson.ThreeStartDate = "";
+ tbjson.FourStartDate = "";
+ tbjson.FiveStartDate = "";
+ tbj.children.Add(tbjson);
+ }
+ }
+
+ list.Add(tbj);
+ }
+ if (list.Select(p => p.children).ToList().Count > 0)
+ {
+ int one = list.Where(t => t.children.Select(s => s.OneStartDate).Any(x => x != "")).ToList().Count;
+ int two = list.Where(t => t.children.Select(s => s.TwoStartDate).Any(x => x != "")).ToList().Count;
+ int three = list.Where(t => t.children.Select(s => s.ThreeStartDate).Any(x => x != "")).ToList().Count;
+ int four = list.Where(t => t.children.Select(s => s.FourStartDate).Any(x => x != "")).ToList().Count;
+ int five = list.Where(t => t.children.Select(s => s.FiveStartDate).Any(x => x != "")).ToList().Count;
+ if (one <= 0 && two <= 0 && three <= 0 && four <= 0 && five <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟鍔犲伐浜у搧瀵瑰簲宸ヨ壓璺嚎璁惧鏈缃骇鑳芥垨鏈缃敓浜ц妭鎷嶏紒";
+ mes.data = null;
+ }
+ }
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧娌℃湁鍏宠仈杞﹂棿锛�";
+ mes.data = null;
+ }
+ return list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return list;
+ }
+ #endregion
+
+ #region[璁惧宸叉帓绋嬩俊鎭痌
+ public static DataTable AlreadyScheduling(string wocode, string wkshpcode, string partcode, string botproccode, string startdate, string enddate)
+ {
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ try
+ {
+ List<APSList> listData = SchedulingMethod.SchedulingMethodTF(wocode, wkshpcode, partcode);
+ string[] empIds = listData.Select(a => a.eqp_id).ToArray();
+ string str = string.Join(",", empIds);
+ string[] s1 = Array.ConvertAll<string, string>(str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ //string s1 = string.Format("'{0}'", str.Replace(",", "','"));
+
+ string sql = @"select B.wo_code, B.eqp_code,B.time_start,B.time_end, 'S' status , B.alloc_qty,D.partcode as part_code,D.partname as part_name,T.name as uom_name
+ from TK_Wrk_EqpAps B
+ left join TK_Wrk_Man C on B.wo_code=C.wo_code
+ left join TMateriel_Info D on C.materiel_code=D.partcode
+ left join TUom T on D.uom_code=T.code
+ where B.eqp_code in @eqpcode
+ and convert(varchar(100),B.Time_Start,21)>=@startdate and convert(varchar(100),B.Time_End,21)<=@enddate order by time_end";
+ dt = DapperHelper.selectlist(sql, new { eqpcode = s1.ToArray(), startdate = startdate + " 00:00:00", enddate = enddate + " 23:59:59" });
+ //dynamicParams.Add("@s1", new { shopcode = s1.ToArray() });
+ //dynamicParams.Add("@startdate", startdate + " 00:00:00");
+ //dynamicParams.Add("@enddate", enddate + " 23:59:59");
+ //var dt_0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt == null || dt.Rows.Count == 0)
+ {
+ return null;
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+
+ return dt;
+ }
+ #endregion
+
+ #region[NEW鎺掍骇璁惧淇℃伅]
+ public static List<AdvancedSchedulingDevice> NewOnclickAdvancedSchedulingDevice(List<ApsOrderSerch> json, ref ToMessage mes)
+ {
+ string sql = "", sql0 = "";
+ var dynamicParams = new DynamicParameters();
+ List<AdvancedSchedulingDevice> list = new List<AdvancedSchedulingDevice>();
+ DataTable dt, dt1;
+ //List<ApsOrderSerch> json = new List<ApsOrderSerch>();
+ try
+ {
+ for (int w = 0; w < json.Count; w++)
+ {
+
+
+ DateTime beginDate = Convert.ToDateTime(json[w].startdate);
+ DateTime endDate = DateTime.Parse(json[w].enddate);
+ if (beginDate > endDate)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瑕佹眰浜や粯鏃堕棿涓嶈兘灏忎簬褰撳墠绯荤粺鏃堕棿锛�";
+ mes.data = null;
+ return list;
+ }
+ bool IsCap = false; //鏄惁璁剧疆浜ц兘
+ //閫氳繃宸ュ崟鏌ユ壘瀵瑰簲杞﹂棿宸ヨ壓璺嚎涓嬪叧閿伐搴忔墍鍏宠仈鐨勮澶囨槸鍚﹀彲鐢�
+ sql = @"select distinct C.eqp_code ,D.Enable from TK_Wrk_Man A
+ left join TFlw_Rout K on A.route_code=K.code
+ left join TFlw_Rtdt B on K.code=B.rout_code and B.first_choke='Y'
+ left join TFlw_Rteqp C on B.step_code= C.step_code
+ left join TEqpInfo D on C.eqp_code=D.code
+ where A.wo_code=@wocode and A.materiel_code=@partcode and D.wksp_code=@wkshpcode";
+ dynamicParams.Add("@wocode", json[w].wocode);
+ dynamicParams.Add("@partcode", json[w].partcode);
+ dynamicParams.Add("@wkshpcode", json[w].wkshpcode);
+ var dt_0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt_0.Rows.Count > 0)
+ {
+ int cout = dt_0.Rows.Count;
+ int num = 0;
+ for (int m = 0; m < dt_0.Rows.Count; m++)
+ {
+ if (dt_0.Rows[m]["Enable"].ToString() == "N")
+ {
+ num = num + 1;
+ }
+ }
+ if (num == cout)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧涓嶅彲鐢紒";
+ mes.data = null;
+ return list;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ヨ壓璺嚎鏈叧鑱旇澶囷紒";
+ mes.data = null;
+ return list;
+ }
+
+ //閫氳繃宸ュ崟鏌ユ壘宸ヨ壓璺嚎瀵瑰簲鍏抽敭宸ュ簭鎵�鍏宠仈鐨勮澶囨墍灞炶溅闂�
+ sql0 = @"select distinct D.wksp_code from TK_Wrk_Man A
+ left join TFlw_Rout K on A.route_code=K.code
+ left join TFlw_Rtdt B on K.code=B.rout_code and B.first_choke='Y'
+ left join TFlw_Rteqp C on B.step_code= C.step_code
+ left join TEqpInfo D on C.eqp_code=D.code
+ where A.wo_code=@wocode and A.materiel_code=@partcode ";
+ dynamicParams.Add("@wocode", json[w].wocode);
+ dynamicParams.Add("@partcode", json[w].partcode);
+ var dt0 = DapperHelper.selectdata(sql0, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ string sy = "0";
+ for (int i = 0; i < dt0.Rows.Count; i++)
+ {
+ if (dt0.Rows[i]["WKSP_CODE"].ToString() == json[w].wkshpcode) //宸ュ崟鍒涘缓杞﹂棿鏄惁绛変簬鎺掍骇璁惧 杞﹂棿
+ {
+ sy = "1";
+ break;
+ }
+ else
+ {
+ sy = "0";
+ }
+ }
+ if (sy == "0")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎺掍骇璁惧杞﹂棿涓庡伐鍗曞垱寤虹殑杞﹂棿涓嶅悓锛�";
+ mes.data = null;
+ return list;
+ }
+ else
+ {
+ List<APSList> listData = SchedulingMethod.SchedulingMethodTF(json[w].wocode, json[w].wkshpcode, json[w].partcode);
+ for (DateTime date = beginDate; date <= endDate; date = date.AddDays(1))
+ {
+ AdvancedSchedulingDevice tbj = new AdvancedSchedulingDevice();
+ tbj.wo_code = json[w].wocode;
+ tbj.YearDate = date.ToString("yyyy-MM-dd");
+ tbj.children = new List<AdvancedSchedulingDeviceCont>();
+ for (int j = 0; j < listData.Count; j++)
+ {
+ if (listData[j].AdvaDevicCropMob.ToString() == "0" || listData[j].AdvaDevicRhythm.ToString() == "")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎺掔▼璁惧" + listData[j].eqp_id.ToString() + "绋煎姩鐜囦笉鑳戒负0鎴栦负绌猴紒";
+ mes.data = null;
+ return list;
+ }
+ if (listData[j].AdvaDevicRhythm.ToString() == "0" || listData[j].AdvaDevicRhythm.ToString() == "")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎺掔▼璁惧" + listData[j].eqp_id.ToString() + "鏈缃妭鎷嶏紒";
+ mes.data = null;
+ return list;
+ }
+ string sql1 = @"select wktme1_start,wktme2_start,wktme3_start,wktme4_start,wktme5_start,G.name
+ from TWkm_capac_plan E
+ left join TWkm_capac_plan_sub F on E.id=F.m_id
+ left join TBas_wkshift_info G on F.wkshift_code=G.code
+ where E.wkshop=@wkshop and E.eqp_typecode=@eqp_typecode and E.ClassType=@classtype
+ and CONVERT(varchar(100), F.wkdate, 23)=@wkdate and E.enable='Y'";
+ dynamicParams.Add("@wkshop", json[w].wkshpcode);
+ dynamicParams.Add("@eqp_typecode", listData[j].Style.ToString());
+ dynamicParams.Add("@classtype", listData[j].ClassType.ToString());
+ dynamicParams.Add("@wkdate", date.ToString("yyyy-MM-dd"));
+ dt1 = DapperHelper.selectdata(sql1, dynamicParams);
+
+ AdvancedSchedulingDeviceCont tbjson = new AdvancedSchedulingDeviceCont();
+ tbjson.AdvaDevicNumber = listData[j].eqp_id.ToString();
+ tbjson.AdvaDevicName = listData[j].name.ToString();
+ tbjson.AdvaDevicCropMob = listData[j].AdvaDevicCropMob.ToString(); //绋煎姩鐜�
+ tbjson.AdvaDevicRhythm = listData[j].AdvaDevicRhythm.ToString(); //鐢熶骇鑺傛媿
+ if (dt1.Rows.Count > 0)
+ {
+ tbjson.OneStartDate = dt1.Rows[0]["wktme1_start"].ToString();
+ tbjson.TwoStartDate = dt1.Rows[0]["wktme2_start"].ToString();
+ tbjson.ThreeStartDate = dt1.Rows[0]["wktme3_start"].ToString();
+ tbjson.FourStartDate = dt1.Rows[0]["wktme4_start"].ToString();
+ tbjson.FiveStartDate = dt1.Rows[0]["wktme5_start"].ToString();
+ tbj.children.Add(tbjson);
+ IsCap = true;
+ }
+ else
+ {
+
+ tbjson.OneStartDate = "";
+ tbjson.TwoStartDate = "";
+ tbjson.ThreeStartDate = "";
+ tbjson.FourStartDate = "";
+ tbjson.FiveStartDate = "";
+ tbj.children.Add(tbjson);
+ }
+ }
+
+ list.Add(tbj);
+ }
+ if (list.Select(p => p.children).ToList().Count > 0)
+ {
+ int one = list.Where(t => t.children.Select(s => s.OneStartDate).Any(x => x != "")).ToList().Count;
+ int two = list.Where(t => t.children.Select(s => s.TwoStartDate).Any(x => x != "")).ToList().Count;
+ int three = list.Where(t => t.children.Select(s => s.ThreeStartDate).Any(x => x != "")).ToList().Count;
+ int four = list.Where(t => t.children.Select(s => s.FourStartDate).Any(x => x != "")).ToList().Count;
+ int five = list.Where(t => t.children.Select(s => s.FiveStartDate).Any(x => x != "")).ToList().Count;
+ if (one <= 0 && two <= 0 && three <= 0 && four <= 0 && five <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟鍔犲伐浜у搧瀵瑰簲宸ヨ壓璺嚎璁惧鏈缃骇鑳芥垨鏈缃敓浜ц妭鎷嶏紒";
+ mes.data = null;
+ }
+ }
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁惧娌℃湁鍏宠仈杞﹂棿锛�";
+ mes.data = null;
+ }
+ }
+ return list;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return list;
+ }
+ #endregion
+
+ #region[New璁惧宸叉帓绋嬩俊鎭痌
+ public static List<DataTable> NewAlreadyScheduling(List<ApsOrderSerch> json)
+ {
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<DataTable> list = new List<DataTable>();
+ try
+ {
+ for (int i = 0; i < json.Count; i++)
+ {
+ List<APSList> listData = SchedulingMethod.SchedulingMethodTF(json[i].wocode, json[i].wkshpcode, json[i].partcode);
+ string[] empIds = listData.Select(a => a.eqp_id).ToArray();
+ string str = string.Join(",", empIds);
+ string[] s1 = Array.ConvertAll<string, string>(str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ //string s1 = string.Format("'{0}'", str.Replace(",", "','"));
+
+ string sql = @"select B.wo_code, B.eqp_code,B.time_start,B.time_end, 'S' status , B.alloc_qty,D.partcode as part_code,D.partname as part_name,T.name as uom_name
+ from TK_Wrk_EqpAps B
+ left join TK_Wrk_Man C on B.wo_code=C.wo_code
+ left join TMateriel_Info D on C.materiel_code=D.partcode
+ left join TUom T on D.uom_code=T.code
+ where B.eqp_code in @eqpcode
+ and convert(varchar(100),B.Time_Start,21)>=@startdate and convert(varchar(100),B.Time_End,21)<=@enddate order by time_end";
+ dt = DapperHelper.selectlist(sql, new { eqpcode = s1.ToArray(), startdate = json[i].startdate + " 00:00:00", enddate = json[i].enddate + " 23:59:59" });
+ //dynamicParams.Add("@s1", new { shopcode = s1.ToArray() });
+ //dynamicParams.Add("@startdate", startdate + " 00:00:00");
+ //dynamicParams.Add("@enddate", enddate + " 23:59:59");
+ //var dt_0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt == null || dt.Rows.Count == 0)
+ {
+ return null;
+ }
+ list.Add(dt);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
+
+ return list;
+ }
+ #endregion
+
+ #region[鎺掔▼鏁版嵁鎻愪氦]
+ public static ToMessage SubmitAlreadyScheduling(string username, string wocode, string botprocecode, List<AlreadyScheduling> objs)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string maxTime = objs.Max(t => Convert.ToDateTime(t.AlreEndDate).ToString("yyyy-MM-dd HH:mm")); //鏈�澶у��
+ string minTime = objs.Min(t => Convert.ToDateTime(t.AlreEndDate).ToString("yyyy-MM-dd HH:mm")); //鏈�灏忓��
+ sql = @"select
+ A.id, A.status,
+ '0' BottFrointv, convert(varchar(100),B.plan_enddate-0,21) Plan_end ,
+ convert(varchar(100),B.plan_startdate+0,21) plan_start
+ from TK_Wrk_Step A
+ left join TK_Wrk_Man B on A.wo_code=B.wo_code
+ where A.wo_code=@wocode and A.step_code=@botprocecode and A.isbott='Y'";
+ dynamicParams.Add("@wocode", wocode);
+ dynamicParams.Add("@botprocecode", botprocecode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ string ID = dt.Rows[0]["ID"].ToString(); // mes_tk_wrk_step 琛� 鐡跺緞宸ュ簭琛孖D
+ string status = dt.Rows[0]["STATUS"].ToString();
+ Decimal nm = 0; //鐡跺緞宸ュ簭鐨勫墠缃ぉ鏁�
+ Decimal nn = Decimal.Parse(dt.Rows[0]["BottFrointv"].ToString()); //鐡跺緞宸ュ簭鐨勫悗缃ぉ鏁�
+ if (status != "NEW" && status != "SCHED" && status != "NOSCHED") //宸ュ簭浠诲姟鐨勭姸鎬佸凡缁忔淳鍙戯紙瀹℃牳锛�
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鎺掔▼浠诲姟宸茬粡娲惧彂,鎻愪氦鍙栨秷锛�";
+ mes.data = null;
+ return mes;
+ }
+ if (status == "SCHED") //宸ュ簭浠诲姟鐨勭姸鎬佸凡缁忔帓绋�
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鎺掔▼浠诲姟宸茬粡鎺掔▼,鎻愪氦鍙栨秷锛�";
+ mes.data = null;
+ return mes;
+ }
+
+ list.Clear();
+ //鎸夊伐鍗曞垹闄よ澶囦换鍔¤〃(鏃ヤ换鍔¤〃锛�
+ sql = @"delete TK_Wrk_EqpAps where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+ //鎸夊伐鍗曞垹闄よ澶囦换鍔¤〃(姹囨�昏〃锛�
+ sql = @"delete TK_Wrk_EqpApsSum where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+ //鎸夊伐鍗曞垹闄よ澶囦换鍔¤〃(姹囨�昏〃锛夌墿鏂欒〃
+ sql = @"delete TK_Wrk_EqpSum_Allo where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+
+ float n = 0; //绱鎺掍骇鎬绘暟
+
+ for (int i = 0; i < objs.Count; i++) //寰幆娣诲姞姣忎釜璁惧鐨勬満鍙颁换鍔�
+ {
+ sql = @"insert into TK_Wrk_EqpAps (wo_code,step_taid,eqp_code,time_start,time_end,alloc_qty,status)
+ values(@wo_code,@step_taid,@eqp_code,@time_start,@time_end,@alloc_qty,@status)";
+ list.Add(new { str = sql, parm = new { wo_code = wocode, step_taid = ID, eqp_code = objs[i].AlreDevicNumber, time_start = objs[i].AlreStartDate, time_end = objs[i].AlreEndDate, alloc_qty = objs[i].AlreQty, status = "NEW" } });
+ n = n + float.Parse(objs[i].AlreQty.ToString());
+ }
+
+ bool aa = DapperHelper.DoTransaction(list); //鎻愪氦璁惧浠诲姟
+ if (!aa)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍏堥鎺�,鍐嶇偣鍑绘彁浜わ紒";
+ mes.data = null;
+ return mes;
+ }
+ list.Clear();
+ //鐢熸垚璁惧浠诲姟姹囨�昏〃 锛堟牴鎹澶囨棩浠诲姟琛級
+ sql = "select distinct eqp_code from TK_Wrk_EqpAps where wo_code=@wocode";
+ dynamicParams.Add("@wocode", wocode);
+ var dt1 = DapperHelper.selectdata(sql, dynamicParams);
+
+ for (int i = 0; i < dt1.Rows.Count; i++)
+ {
+ sql = @"insert into TK_Wrk_EqpApsSum (wo_code,eqp_code,step_taid,p_date, t_date, qty,status)
+ select min(wo_code),min(eqp_code),min(step_taid),min(time_start),max(time_end),sum(Alloc_Qty),'NEW' from TK_Wrk_EqpAps
+ where wo_code=@wocode and eqp_code=@eqp_code";
+ list.Add(new { str = sql, parm = new { wocode = wocode, eqp_code = dt1.Rows[i]["EQP_CODE"].ToString() } });
+ }
+
+ bool aa1 = DapperHelper.DoTransaction(list); //鎻愪氦璁惧浠诲姟
+ if (!aa1)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鐢熸垚璁惧浠诲姟姹囨�昏〃鍑洪敊锛屾帓浜уけ璐ワ紒";
+ mes.data = null;
+ return mes;
+ }
+ list.Clear();
+ //鍐欏叆璁惧浠诲姟(姹囨�昏〃)鐢ㄦ枡 璁″垝鏁伴噺*瀛愪欢鍩烘湰鐢ㄩ噺*锛�1+鎹熻�楃巼锛�/姣嶄欢鍩烘湰鐢ㄩ噺
+ sql = @"insert into TK_Wrk_EqpSum_Allo(m_id, seq, materiel_code, qty,wo_code,materieltype)
+ select A.id M_id, B.seq,B.materiel_code,(round(A.qty,2)*BE.Base_Quantity*(1+BE.LOSS_QUANTITY/100))/BM.quantity qty,A.wo_code,B.materieltype
+ from TK_Wrk_EqpApsSum A
+ left join TK_Wrk_Allo B on A.Wo_Code= B.Wo_Code
+ left join TBom_Deta BE ON B.bom_id=BE.m_id and B.materiel_code=BE.smateriel_code
+ left join TBom_Main BM on BE.m_Id=BM.id where A.wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+
+ //鏇存柊 宸ュ簭浠诲姟鍗曠殑銆愮摱寰勫伐搴忋�� 鎺掍骇棰勫紑宸ユ棩鏈熴�佹帓浜ч瀹屽伐鏃ユ湡銆佺姸鎬侊細NEW===>SCHED 銆佸凡鎺掍骇鏁伴噺
+ sql = @"update TK_Wrk_Step set plan_startdate =convert(varchar(100),@plan_startdate,21), plan_enddate =convert(varchar(100),@plan_enddate,21), status = 'SCHED', sched_qty =@sched_qty where id =@id";
+ list.Add(new { str = sql, parm = new { plan_startdate = minTime, plan_enddate = maxTime, sched_qty = n, id = ID } });
+
+ //宸ュ崟宸ュ簭鐨勨�滆鍒掑紑鏈烘棩鏈� = 鐡跺緞宸ュ簭鐨勯寮�宸ユ棩鏈� - 鐡跺緞宸ュ簭鐨勫墠缃棩鏈燂級 涓诲伐鍗曪細璁″垝瀹屽伐鏃ユ湡 = 鐡跺緞宸ュ簭鐨勯瀹屽伐鏃ユ湡 + 鐡跺緞宸ュ簭鐨勫悗缃棩鏈�
+ sql = @"update TK_Wrk_Step set plan_startdate =convert(varchar(100),@plan_startdate,21), plan_enddate =convert(varchar(100),@plan_enddate,21), status = 'SCHED', sched_qty =@sched_qty where wo_code =@wocode and isbott='N'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ plan_startdate = Convert.ToDateTime(minTime).AddDays(Convert.ToDouble(-nm)).ToString("yyyy-MM-dd"),
+ plan_enddate = Convert.ToDateTime(maxTime).AddDays(Convert.ToDouble(nn)).ToString("yyyy-MM-dd"),
+ sched_qty = n,
+ wocode = wocode
+ }
+ });
+ //涓诲伐鍗曠殑鈥滆鍒掑紑鏈烘棩鏈� = 鐡跺緞宸ュ簭鐨勯寮�宸ユ棩鏈� - 鐡跺緞宸ュ簭鐨勫墠缃棩鏈燂級 涓诲伐鍗曪細璁″垝瀹屽伐鏃ユ湡 = 鐡跺緞宸ュ簭鐨勯瀹屽伐鏃ユ湡 + 鐡跺緞宸ュ簭鐨勫悗缃棩鏈�
+ sql = @"update TK_Wrk_Man set status='SCHED',plan_startdate =convert(varchar(100),@plan_startdate,21), plan_enddate =convert(varchar(100),@plan_enddate,21), exchag='Y',allocfag='N' where wo_code =@wocode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ plan_startdate = Convert.ToDateTime(minTime).AddDays(Convert.ToDouble(-nm)).ToString("yyyy-MM-dd"),
+ plan_enddate = Convert.ToDateTime(maxTime).AddDays(Convert.ToDouble(nn)).ToString("yyyy-MM-dd"),
+ sched_qty = n,
+ wocode = wocode
+ }
+ });
+ bool aa2 = DapperHelper.DoTransaction(list); //鎻愪氦璁惧浠诲姟
+ if (aa2)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎻愪氦鎺掔▼鎴愬姛锛�";
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎻愪氦鎺掔▼澶辫触锛�";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇鍏ュ簱鏉$爜琛ユ墦]
+ public static ToMessage ProductInHouseLabCode(string ordercode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇鏈亾宸ュ簭鎶ュ伐鏉$爜鏁版嵁
+ sql = @"select * from(
+ select A.inbarcode,A.wo_code,P.partcode,P.partname,P.partspec,
+ A.good_qty,U.username,A.lm_date
+ from TK_Wrk_Record A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TMateriel_Info P on A.materiel_code=P.partcode
+ inner join TUser U on A.lm_user=U.usercode
+ where A.style='B' and S.isend='Y' and A.good_qty>0
+ union all
+ select A.inbarcode,A.wo_code,P.partcode,P.partname,P.partspec,
+ A.sqty as sqty,U.username,A.lm_date
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TMateriel_Info P on A.materiel_code=P.partcode
+ inner join TUser U on A.lm_user=U.usercode
+ where A.style='S' and S.isend='Y' and A.sqty>0
+ ) as AA where AA.wo_code=@ordercode";
+ dynamicParams.Add("@ordercode", ordercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱閫氳繃杞﹂棿鏌ユ壘鐢熶骇璁㈠崟]
+ public static ToMessage ProductInHouseWkshopOrder(string ordertype, string wkshopcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (ordertype == "Y") //鏈夋簮鍗�
+ {
+ sql = @"select distinct AA.ordercode from (
+ select A.m_po as ordercode
+ from TK_Wrk_Man A
+ inner join TK_Wrk_Step B on A.wo_code=B.wo_code
+ inner join TK_Wrk_Record S on B.wo_code=S.wo_code and B.step_code=S.step_code
+ where S.style='B' and B.isend='Y' and A.m_po<>'' and S.good_qty>0 and S.good_qty>isnull(S.inhouseqty,0) and A.wkshp_code=@wkshopcode
+ union all
+ select A.m_po as ordercode
+ from TK_Wrk_Man A
+ inner join TK_Wrk_Step B on A.wo_code=B.wo_code
+ inner join TK_Wrk_OutRecord S on B.wo_code=S.wo_code and B.step_code=S.step_code
+ where S.style='S' and B.isend='Y' and A.m_po<>'' and S.sqty>0 and S.sqty>isnull(S.inhouseqty,0) and A.wkshp_code=@wkshopcode
+ ) as AA";
+ }
+ if (ordertype == "N")
+ {
+ sql = @"select distinct AA.ordercode from (
+ select A.wo_code as ordercode
+ from TK_Wrk_Man A
+ inner join TK_Wrk_Step B on A.wo_code=B.wo_code
+ inner join TK_Wrk_Record S on B.wo_code=S.wo_code and B.step_code=S.step_code
+ where S.style='B' and B.isend='Y' and A.m_po='' and S.good_qty>0 and S.good_qty>isnull(S.inhouseqty,0) and A.wkshp_code=@wkshopcode
+ union all
+ select A.wo_code as ordercode
+ from TK_Wrk_Man A
+ inner join TK_Wrk_Step B on A.wo_code=B.wo_code
+ inner join TK_Wrk_OutRecord S on B.wo_code=S.wo_code and B.step_code=S.step_code
+ where S.style='S' and B.isend='Y' and A.m_po='' and S.sqty>0 and S.sqty>isnull(S.inhouseqty,0) and A.wkshp_code=@wkshopcode
+ ) as AA";
+ }
+
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱淇℃伅鏌ヨ]
+ public static ToMessage ProductInHouseOrderSearch(string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec, string startorderdate, string endorderdate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (erpordercode != "" && erpordercode != null)
+ {
+ search += "and AA.m_po like '%'+@erpordercode+'%' ";
+ dynamicParams.Add("@erpordercode", erpordercode);
+ }
+ if (mesordercode != "" && mesordercode != null)
+ {
+ search += "and AA.wo_code like '%'+@mesordercode+'%' ";
+ dynamicParams.Add("@mesordercode", mesordercode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (startorderdate != "" && startorderdate != null)
+ {
+ search += "and AA.lm_date between @startorderdate and @endorderdate ";
+ dynamicParams.Add("@opencheckdate", startorderdate + " 00:00:00");
+ dynamicParams.Add("@endorderdate", endorderdate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname,
+ A.step_code,E.wkshp_id,M.wkshp_code,stck_id,K.code as stockcode,k.name as stockname,
+ E.saleOrderqty,E.qty,M.plan_qty,A.good_qty,isnull(A.inhouseqty,0) as inhouseqty,A.good_qty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style
+ from TK_Wrk_Record A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TK_Wrk_Man M on S.wo_code=M.wo_code
+ inner join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TKimp_Ewo E on M.sourceid=E.id
+ left join T_Sec_Stck K on E.stck_code=K.code
+ where A.style='B' and S.isend='Y' and A.good_qty>0
+ union all
+ select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname,
+ A.step_code,E.wkshp_id,M.wkshp_code,stck_id,K.code as stockcode,k.name as stockname,
+ E.saleOrderqty,E.qty,M.plan_qty,A.sqty as sqty,isnull(A.inhouseqty,0) as inhouseqty,A.sqty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TK_Wrk_Man M on S.wo_code=M.wo_code
+ inner join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TKimp_Ewo E on M.sourceid=E.id
+ left join T_Sec_Stck K on E.stck_code=K.code
+ where A.style='S' and S.isend='Y' and A.sqty>0
+ ) as AA where AA.good_qty>AA.inhouseqty " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱鎻愪氦]
+ public static ToMessage ProductInHouseOrderSeave(string username, JObject obj)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ var dynamicParams1 = new DynamicParameters();
+ try
+ {
+ string sub = obj["sub"].ToString();//鏄庣粏
+ string subsum = obj["subsum"].ToString();//姹囨��
+ //鑾峰彇鎶ュ伐鏄庣粏
+ JArray sub_arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(sub);
+ //鑾峰彇姹囨��
+ JArray subsum_arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(subsum);
+
+ //鍥炲啓鎶ュ伐璁板綍涓昏〃銆佸伐鍗曞伐搴忚〃宸插叆搴撴暟閲忋�佸啓鍏ES搴撳瓨琛�
+ for (int i = 0; i < sub_arra.Count; i++)
+ {
+ if (sub_arra[i]["style"].ToString() == "B")
+ {
+ //鍥炲啓鎶ュ伐璁板綍涓昏〃鐨勫叆搴撴暟閲�
+ sql = @"update TK_Wrk_Record set inhouseqty=inhouseqty+@stinhouseqty where inbarcode=@inbarcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ stinhouseqty = decimal.Parse(sub_arra[i]["stinhouseqty"].ToString()),
+ inbarcode = sub_arra[i]["inbarcode"].ToString()
+ }
+ });
+ }
+ if (sub_arra[i]["style"].ToString() == "S")
+ {
+ //鍥炲啓澶栧崗鏀舵枡璁板綍涓昏〃鐨勫叆搴撴暟閲�
+ sql = @"update TK_Wrk_OutRecord set inhouseqty=inhouseqty+@stinhouseqty where inbarcode=@inbarcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ stinhouseqty = decimal.Parse(sub_arra[i]["stinhouseqty"].ToString()),
+ inbarcode = sub_arra[i]["inbarcode"].ToString()
+ }
+ });
+ }
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄦ湯閬撳伐搴忓凡鍏ュ簱鏁伴噺
+ sql = @"update TK_Wrk_Step set inhouseqty=inhouseqty+@stinhouseqty where wo_code=@wo_code and step_code=@step_code and isend='Y'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ stinhouseqty = decimal.Parse(sub_arra[i]["stinhouseqty"].ToString()),
+ wo_code = sub_arra[i]["wo_code"].ToString(),
+ step_code = sub_arra[i]["step_code"].ToString()
+ }
+ });
+ //鍐欏叆MES搴撳瓨琛�
+ sql = @"insert into TK_WMS_Stock(hbillno,labcode,materiel_code,storehouse_code,qty,lm_user,lm_date)
+ values(@hbillno,@labcode,@materiel_code,@storehouse_code,@qty,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ hbillno = obj["head"]["hbillno"].ToString(),
+ labcode = sub_arra[i]["inbarcode"].ToString(),
+ materiel_code = sub_arra[i]["partcode"].ToString(),
+ storehouse_code = sub_arra[i]["stockcode"].ToString(),
+ qty = decimal.Parse(sub_arra[i]["stinhouseqty"].ToString()),
+ lm_user = username,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鍐橫ES鍏ュ簱璁板綍涓昏〃
+ sql = @"insert into TK_WMS_Inwh_Main(docu_typecode,hbillno,hsoucenillnoid,hsoucenillno,saleorderid,saleordercode,status,wkshpcode,lm_user,lm_date)
+ values(@docu_typecode,@hbillno,@hsoucenillnoid,@hsoucenillno,@saleorderid,@saleordercode,@status,@wkshpcode,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ docu_typecode = "1202",
+ hbillno = obj["head"]["hbillno"].ToString(),
+ hsoucenillnoid = obj["head"]["sourceVoucherId"].ToString(),
+ hsoucenillno = obj["head"]["sourceVoucherCode"].ToString(),
+ saleorderid = obj["head"]["saleOrderId"].ToString(),
+ saleordercode = obj["head"]["saleOrderCode"].ToString(),
+ status = "NEW",
+ wkshpcode = obj["head"]["wkshpcode"].ToString(),
+ lm_user = username,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ //鑾峰彇ERP鍏ュ簱琛╯ql
+ //DataTable dt = DapperHelper.lissql("h_p_MesInErpProductWareHous");
+ //鍐欏叆ERP鍏ュ簱璁板綍涓昏〃
+ //sql = @"" + dt.Rows[0]["cname"].ToString() + "";
+ //list.Add(new
+ //{
+ // str = sql,
+ // parm = new
+ // {
+ // code = obj["head"]["hbillno"].ToString(),
+ // sourceVoucherId = obj["head"]["sourceVoucherId"].ToString(),
+ // sourceVoucherCode = obj["head"]["sourceVoucherCode"].ToString(),
+ // saleOrderId = obj["head"]["saleOrderId"].ToString(),
+ // saleOrderCode = obj["head"]["saleOrderCode"].ToString(),
+ // rdDirectionFlag = obj["head"]["rdDirectionFlag"].ToString(),
+ // makerid = obj["head"]["makerid"].ToString(),
+ // maker = obj["head"]["maker"].ToString(),
+ // accountingyear = obj["head"]["accountingyear"].ToString(),
+ // VoucherYear = obj["head"]["VoucherYear"].ToString(),
+ // VoucherPeriod = obj["head"]["VoucherPeriod"].ToString(),
+ // ManufactureOrderCode = obj["head"]["ManufactureOrderCode"].ToString(),
+ // idbusitype = obj["head"]["idbusitype"].ToString(),
+ // iddepartment = obj["head"]["iddepartment"].ToString(),
+ // idrdstyle = obj["head"]["idrdstyle"].ToString(),
+ // idwarehouse = obj["head"]["idwarehouse"].ToString(),
+ // voucherState = obj["head"]["voucherState"].ToString(),
+ // idvouchertype = obj["head"]["idvouchertype"].ToString(),
+ // voucherdate = obj["head"]["voucherdate"].ToString(),
+ // madedate = obj["head"]["madedate"].ToString(),
+ // createdtime = obj["head"]["createdtime"].ToString(),
+ // DataSource = obj["head"]["DataSource"].ToString(),
+ // idsourcevouchertype= obj["head"]["idsourcevouchertype"].ToString()
+
+ // }
+ //});
+ //鍐欏叆ERP銆丮ES鍏ュ簱璁板綍瀛愯〃
+ for (int j = 0; j < subsum_arra.Count; j++)
+ {
+ //鍐欏叆ERP鍏ュ簱璁板綍瀛愯〃
+ //sql = @"" + dt.Rows[1]["cname"].ToString() + "";
+ //list.Add(new
+ //{
+ // str = sql,
+ // parm = new
+ // {
+ // code = subsum_arra[j]["code"].ToString(),
+ // arrivalQuantity = subsum_arra[j]["arrivalQuantity"].ToString(),
+ // quantity = subsum_arra[j]["quantity"].ToString(),
+ // compositionQuantity = subsum_arra[j]["compositionQuantity"].ToString(),
+ // baseQuantity = subsum_arra[j]["baseQuantity"].ToString(),
+ // sourceVoucherId = subsum_arra[j]["sourceVoucherId"].ToString(),
+ // sourceVoucherCode = subsum_arra[j]["sourceVoucherCode"].ToString(),
+ // sourceVoucherDetailId = subsum_arra[j]["sourceVoucherDetailId"].ToString(),
+ // idsourcevouchertype = subsum_arra[j]["idsourcevouchertype"].ToString(),
+ // saleOrderId = subsum_arra[j]["saleOrderId"].ToString(),
+ // saleOrderCode = subsum_arra[j]["saleOrderCode"].ToString(),
+ // saleOrderDetailId = subsum_arra[j]["saleOrderDetailId"].ToString(),
+ // ManufactureOrderId = subsum_arra[j]["ManufactureOrderId"].ToString(),
+ // ManufactureOrderCode = subsum_arra[j]["ManufactureOrderCode"].ToString(),
+ // ManufactureOrderDetailId = subsum_arra[j]["ManufactureOrderDetailId"].ToString(),
+ // idbusiTypeByMergedFlow = subsum_arra[j]["idbusiTypeByMergedFlow"].ToString(),
+ // idinventory = subsum_arra[j]["idinventory"].ToString(),
+ // idbaseunit = subsum_arra[j]["idbaseunit"].ToString(),
+ // idunit = subsum_arra[j]["idunit"].ToString(),
+ // idwarehouse = subsum_arra[j]["idwarehouse"].ToString(),
+ // SourceVoucherIdByMergedFlow = subsum_arra[j]["SourceVoucherIdByMergedFlow"].ToString(),
+ // SourceVoucherCodeByMergedFlow = subsum_arra[j]["SourceVoucherCodeByMergedFlow"].ToString(),
+ // SourceVoucherDetailIdByMergedFlow = subsum_arra[j]["SourceVoucherDetailIdByMergedFlow"].ToString(),
+ // idsourceVoucherTypeByMergedFlow = subsum_arra[j]["idsourceVoucherTypeByMergedFlow"].ToString(),
+ // createdtime = subsum_arra[j]["createdtime"].ToString(),
+ // DataSource = subsum_arra[j]["DataSource"].ToString()
+ // }
+ //});
+ //鍐欏叆ERP鐜板瓨閲忔煡璇㈣〃
+ //sql = @"" + dt.Rows[2]["cname"].ToString() + "";
+ //list.Add(new
+ //{
+ // str = sql,
+ // parm = new
+ // {
+ // idinventory = subsum_arra[j]["idinventory"].ToString(),
+ // idwarehouse = subsum_arra[j]["idwarehouse"].ToString(),
+ // propertyName = "ProductForReceive",
+ // baseQuantity= subsum_arra[j]["quantity"].ToString(),
+ // IdMarketingOrgan="1",
+ // idbaseunit= subsum_arra[j]["idbaseunit"].ToString(),
+ // updated= DateTime.Now.ToString(),
+ // isCarriedForwardOut ="0",
+ // isCarriedForwardIn = "0"
+ // }
+ //});
+
+
+
+ //鍐欏叆MES鍏ュ簱璁板綍瀛愯〃
+ sql = @"insert into TK_WMS_Inwh_Sub(hbillno,rownumber,materiel_code,storehouse_code,qty)
+ values(@hbillno,@rownumber,@materiel_code,@storehouse_code,@qty)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ hbillno = obj["head"]["hbillno"].ToString(),
+ rownumber = subsum_arra[j]["rownumber"].ToString(),
+ materiel_code = subsum_arra[j]["materiel_code"].ToString(),
+ storehouse_code = subsum_arra[j]["warehouse"].ToString(),
+ qty = decimal.Parse(subsum_arra[j]["quantity"].ToString())
+ }
+ });
+ }
+ //鏇存柊鍗曟嵁娴佹按鍙�
+ List<object> list1 = SeachEncodeJob.StrEncodingUpdate(obj["head"]["rightcode"].ToString(), obj["head"]["incbit"].ToString());
+ list.Add(list1[0]);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐢熶骇鍏ュ簱鎵弿鏉$爜]
+ public static ToMessage MesAppProductInHouseOrderBarCodeSearch(string labcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇鏉$爜鏄惁瀛樺湪
+ sql = @"select distinct AA.inbarcode from (
+ select A.inbarcode
+ from TK_Wrk_Record A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ where A.style='B' and S.isend='Y' and A.good_qty>0 and A.inbarcode=@labcode
+ union all
+ select A.inbarcode
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ where A.style='S' and S.isend='Y' and A.sqty>0 and A.inbarcode=@labcode
+ ) as AA";
+ dynamicParams.Add("@labcode", labcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.message = "鏃犳晥鏉$爜!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇鏉$爜鏄惁瀛樺彲鐢�
+ sql = @"select distinct AA.inbarcode,AA.good_qty,AA.inhouseqty from (
+ select A.inbarcode,sum(A.good_qty) as good_qty,sum(isnull(A.inhouseqty,0)) as inhouseqty
+ from TK_Wrk_Record A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ where A.style='B' and S.isend='Y' and A.good_qty>0 and A.inbarcode=@labcode
+ group by A.inbarcode
+ union all
+ select A.inbarcode,sum(A.sqty) as good_qty,sum(isnull(A.inhouseqty,0)) as inhouseqty
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ where A.style='S' and S.isend='Y' and A.sqty>0 and A.inbarcode=@labcode
+ group by A.inbarcode
+ ) as AA where AA.good_qty>AA.inhouseqty ";
+ dynamicParams.Add("@labcode", labcode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠鏉$爜宸插叆搴�!";
+ mes.data = null;
+ return mes;
+ }
+
+ //鏍规嵁閲囪喘璁㈠崟鍙锋煡璇㈢墿鏂欎俊鎭紝渚涘簲鍟嗕俊鎭�
+ sql = @"select * from(
+ select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname,
+ A.step_code,E.wkshp_id,M.wkshp_code,stck_id,K.code as stockcode,k.name as stockname,
+ E.saleOrderqty,E.qty,M.plan_qty,A.good_qty,isnull(A.inhouseqty,0) as inhouseqty,A.good_qty-isnull(A.inhouseqty,0) as stinhouseqty,A.lm_date,A.style
+ from TK_Wrk_Record A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TK_Wrk_Man M on S.wo_code=M.wo_code
+ inner join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TKimp_Ewo E on M.sourceid=E.id
+ left join T_Sec_Stck K on E.stck_code=K.code
+ where A.style='B' and S.isend='Y' and A.good_qty>0 and A.inbarcode=@labcode
+ union all
+ select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname,
+ A.step_code,E.wkshp_id,M.wkshp_code,stck_id,K.code as stockcode,k.name as stockname,
+ E.saleOrderqty,E.qty,M.plan_qty,A.sqty as sqty,isnull(A.inhouseqty,0) as inhouseqty,A.sqty-isnull(A.inhouseqty,0) as stinhouseqty,A.lm_date,A.style
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TK_Wrk_Man M on S.wo_code=M.wo_code
+ inner join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TKimp_Ewo E on M.sourceid=E.id
+ left join T_Sec_Stck K on E.stck_code=K.code
+ where A.style='S' and S.isend='Y' and A.sqty>0 and A.inbarcode=@labcode
+ ) as AA where AA.good_qty>AA.inhouseqty";
+ dynamicParams.Add("@labcode", labcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鏆傛棤鐗╂枡鏁版嵁!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/QualityManagementDAL.cs b/VueWebCoreApi/DLL/DAL/QualityManagementDAL.cs
new file mode 100644
index 0000000..662e98d
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/QualityManagementDAL.cs
@@ -0,0 +1,1266 @@
+锘縰sing Dapper;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class QualityManagementDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[璐ㄩ噺绠$悊,缂洪櫡瀹氫箟鏌ヨ鍒楄〃]
+ public static ToMessage DedectSearch(string defectcode, string defectname, string defectdescr, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (defectcode != "" && defectcode != null)
+ {
+ search += "and A.code like '%'+@defectcode+'%' ";
+ dynamicParams.Add("@defectcode", defectcode);
+ }
+ if (defectname != "" && defectname != null)
+ {
+ search += "and A.name like '%'+@defectname+'%' ";
+ dynamicParams.Add("@defectname", defectname);
+ }
+ if (defectdescr != "" && defectdescr != null)
+ {
+ search += "and A.description like '%'+@defectdescr+'%' ";
+ dynamicParams.Add("@defectdescr", defectdescr);
+ }
+
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.code,A.name,A.description,U.username as lm_user,A.lm_date from TDefect A
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+
+ #endregion
+
+ #region[璐ㄩ噺绠$悊锛岀己闄峰畾涔夋柊澧炪�佺紪杈戞彁浜
+ public static ToMessage AddUpdateDedect(string defectcode, string defectname, string defectdescr, string opertype, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (opertype == "Add")
+ {
+ //鍐欏叆缂洪櫡瀹氫箟瀹氫箟琛�
+ sql = @"insert into TDefect(code,name,description,is_step,lm_user,lm_date)
+ values(@defectcode,@defectname,@description,@is_step,@username,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ defectcode = defectcode,
+ defectname = defectname,
+ description = defectdescr,
+ is_step="N",
+ username = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "缂洪櫡缂栫爜:" + defectcode + "缂洪櫡鍚嶇О:" + defectname, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缂洪櫡瀹氫箟鏂板鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缂洪櫡瀹氫箟鏂板澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ sql = @"update TDefect set name=@defectname,description=@description,lm_user=@username,lm_date=@CreateDate where code=@defectcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ defectcode = defectcode,
+ defectname = defectname,
+ description = defectdescr,
+ username = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "缂洪櫡缂栫爜:" + defectcode + "缂洪櫡鍚嶇О:" + defectname, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缂洪櫡瀹氫箟淇敼鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缂洪櫡瀹氫箟淇敼澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璐ㄩ噺绠$悊锛岀己闄峰畾涔夊垹闄
+ public static ToMessage DeleteDedect(string defectcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from CSR_WorkRecord_Defect where defect_code=@defectcode";
+ dynamicParams.Add("@defectcode", defectcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠缂洪櫡椤瑰凡鐢熸垚鎶ュ伐缂洪櫡璁板綍,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+
+ sql = @"delete TDefect where code=@defectcode";
+ list.Add(new { str = sql, parm = new { defectcode = defectcode } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "缂洪櫡缂栫爜:" + defectcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "缂洪櫡鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "缂洪櫡鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠岄」鐩垪琛ㄦ煡璇
+ public static ToMessage StepCheckItemSearch(string itemcode, string itemname, string itemdescr, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (itemcode != "" && itemcode != null)
+ {
+ search += "and A.code like '%'+@itemcode+'%' ";
+ dynamicParams.Add("@itemcode", itemcode);
+ }
+ if (itemname != "" && itemname != null)
+ {
+ search += "and A.name like '%'+@itemname+'%' ";
+ dynamicParams.Add("@itemname", itemname);
+ }
+ if (itemdescr != "" && itemdescr != null)
+ {
+ search += "and A.descr like '%'+@itemdescr+'%' ";
+ dynamicParams.Add("@itemdescr", itemdescr);
+ }
+
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.code,A.name,A.descr,U.username as lm_user,A.lm_date from TStepCheckItem A
+ left join TUser U on A.lm_user=U.usercode
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岄」鐩柊澧炪�佺紪杈戞彁浜
+ public static ToMessage AddUpdateStepCheckItem(string checkitemcode, string checkitemname, string checkitemdescr, string opertype, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ if (opertype == "Add")
+ {
+ //鍐欏叆缂洪櫡瀹氫箟瀹氫箟琛�
+ sql = @"insert into TStepCheckItem(code,name,descr,lm_user,lm_date)
+ values(@checkitemcode,@checkitemname,@checkitemdescr,@username,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checkitemcode = checkitemcode,
+ checkitemname = checkitemname,
+ checkitemdescr = checkitemdescr,
+ username = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "宸ュ簭妫�楠岄」鐩�:" + checkitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "宸ュ簭妫�楠岄」鐩柊澧炴垚鍔�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ簭妫�楠岄」鐩柊澧炲け璐�!";
+ mes.data = null;
+ }
+ }
+ if (opertype == "Update")
+ {
+ sql = @"update TStepCheckItem set name=@checkitemname,descr=@checkitemdescr,lm_user=@username,lm_date=@CreateDate where code=@checkitemcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checkitemcode = checkitemcode,
+ checkitemname = checkitemname,
+ checkitemdescr = checkitemdescr,
+ username = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "宸ュ簭妫�楠岄」鐩�:" + checkitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "宸ュ簭妫�楠岄」鐩慨鏀规垚鍔�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ簭妫�楠岄」鐩慨鏀瑰け璐�!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岄」鐩垹闄
+ public static ToMessage DeleteStepCheckItem(string checkitemcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TStepCheckRecordSub where checkitem_code=@checkitemcode";
+ dynamicParams.Add("@checkitemcode", checkitemcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠妫�楠岄」椤瑰凡鐢熸垚妫�楠岃褰�,涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+
+ sql = @"delete TStepCheckItem where code=@checkitemcode";
+ list.Add(new { str = sql, parm = new { checkitemcode = checkitemcode } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "宸ュ簭妫�楠岄」鐩�:" + checkitemcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "宸ュ簭妫�楠屽垹闄ゆ垚鍔�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ簭妫�楠屽垹闄ゅけ璐�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[宸ュ簭璐ㄦ鏂规鍒楄〃鏌ヨ]
+ public static ToMessage QualityInspectionSearch(string qualityinsptcode, string qualityinsptname, string status, string checktype, string sampltype, string suitobject, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (qualityinsptcode != "" && qualityinsptcode != null)
+ {
+ search += "and AA.code like '%'+@qualityinsptcode+'%' ";
+ dynamicParams.Add("@qualityinsptcode", qualityinsptcode);
+ }
+ if (qualityinsptname != "" && qualityinsptname != null)
+ {
+ search += "and AA.name like '%'+@qualityinsptname+'%' ";
+ dynamicParams.Add("@qualityinsptname", qualityinsptname);
+ }
+ if (status != "" && status != null)
+ {
+ search += "and AA.status=@status ";
+ dynamicParams.Add("@status", status);
+ }
+ if (checktype != "" && checktype != null)
+ {
+ search += "and AA.checktype=@checktype ";
+ dynamicParams.Add("@checktype", checktype);
+ }
+ if (sampltype != "" && sampltype != null)
+ {
+ search += "and AA.sampmethod=@sampltype ";
+ dynamicParams.Add("@sampltype", sampltype);
+ }
+ if (suitobject != "" && suitobject != null)
+ {
+ search += "and AA.suitobject=@suitobject ";
+ dynamicParams.Add("@suitobject", suitobject);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select A.code,A.name,A.status,A.checktype,A.sampmethod,A.sampscare,A.suitobject,A.stepcode,S.stepname,A.descr,A.suitpart,A.lm_date,U.username,
+ case when A.suitobject='P' then
+ STUFF(( SELECT ';' + partname
+ FROM TMateriel_Info
+ where PATINDEX('%;' + RTRIM(TMateriel_Info.partcode) + ';%',';' + A.suitpart + ';')>0
+ FOR XML PATH('')), 1, 1,'')
+ when A.suitobject='PY'
+ then
+ STUFF(( SELECT ';' + name
+ FROM TMateriel_Class
+ where PATINDEX('%;' + RTRIM(TMateriel_Class.code) + ';%',';' + A.suitpart + ';')>0
+ FOR XML PATH('')), 1, 1,'')
+ end as suitpartname
+ from TStepCheckStandard A
+ left join TUser U on A.lm_user=U.usercode
+ left join TStep S on A.stepcode=S.stepcode
+ ) as AA
+ where " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏌ョ湅缂栬緫]
+ public static ToMessage QualityInspectionSeeEdit(string qualityinsptcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select A.stepcheckitem_seq,A.stepcheckitem_code,B.name as stepcheckitem_name,A.required,
+ A.numberjudge,A.unit,A.decimalnum,A.standvalue,A.uppervalue,A.lowervalue,A.stepcheckitem_desc
+ from TStepCheckStandardSub A
+ inner join TStepCheckItem B on A.stepcheckitem_code=B.code
+ where A.stepstaned_code=@qualityinsptcode";
+ dynamicParams.Add("@qualityinsptcode", qualityinsptcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏂板銆佺紪杈戣幏鍙栨楠岄」鐩笅鎷夊垪琛╙
+ public static ToMessage QualityStepCheckItemSelect()
+ {
+ string sql = "";
+ try
+ {
+ //鑾峰彇宸ュ簭鐐规椤圭洰鏁版嵁
+ sql = @"select code,name,descr from TStepCheckItem";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鏂板/缂栬緫鎻愪氦]
+ public static ToMessage QualityInspectionAddEditSave(string qualityinsptcode, string qualityinsptname, string status, string checktype, string sampmethod, string sampscare, string suitobject, string suitpart, string descr, string stepcode, string checkitem, string type, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ //鑾峰彇璐ㄦ鍒楄〃妫�楠岄」鐩暟鎹�
+ JArray arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(checkitem);
+ list.Clear();
+ switch (type)
+ {
+ case "Add": //鏂板
+ //鍐欏叆璐ㄦ鏂规涓昏〃
+ sql = @"insert into TStepCheckStandard(code,name,status,checktype,sampmethod,sampscare,suitobject,suitpart,stepcode,descr,lm_user,lm_date)
+ values(@code,@name,@status,@checktype,@sampmethod,@sampscare,@suitobject,@suitpart,@stepcode,@descr,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = qualityinsptcode,
+ name = qualityinsptname,
+ status = status,
+ checktype = checktype,
+ sampmethod = sampmethod,
+ sampscare = sampscare,
+ suitobject = suitobject,
+ suitpart = suitpart,
+ stepcode = stepcode,
+ descr = descr,
+ lm_user = us.usercode,
+ lm_date = date
+ }
+ });
+ //鍐欏叆璐ㄦ鏂规瀛愯〃
+ for (int i = 0; i < arra.Count; i++)
+ {
+ sql = @"insert into TStepCheckStandardSub(stepstaned_code,stepcheckitem_seq,stepcheckitem_code,required,numberjudge,unit,decimalnum,standvalue,uppervalue,lowervalue,stepcheckitem_desc,lm_user,lm_date)
+ values(@stepstaned_code,@stepcheckitem_seq,@stepcheckitem_code,@required,@numberjudge,@unit,@decimalnum,@standvalue,@uppervalue,@lowervalue,@stepcheckitem_desc,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ stepstaned_code = qualityinsptcode,
+ stepcheckitem_seq = Convert.ToInt32(arra[i]["stepcheckitem_seq"].ToString()),
+ stepcheckitem_code = arra[i]["stepcheckitem_code"].ToString(),
+ required = arra[i]["required"].ToString(),
+ numberjudge = arra[i]["numberjudge"].ToString(),
+ unit = arra[i]["unit"].ToString(),
+ decimalnum = arra[i]["decimalnum"].ToString(),
+ standvalue = arra[i]["standvalue"].ToString(),
+ uppervalue = arra[i]["uppervalue"].ToString(),
+ lowervalue = arra[i]["lowervalue"].ToString(),
+ stepcheckitem_desc = arra[i]["stepcheckitem_desc"].ToString(),
+ lm_user = us.usercode,
+ lm_date = date
+ }
+ });
+ }
+ break;
+ case "Update"://淇敼
+ //鍒ゆ柇鏄惁鐢熸垚妫�楠岃褰�(鍏ュ巶妫�楠�(InCheck) 鍑哄巶妫�楠�(OutCheck) FirstCheck锛堥妫�锛� PatroCheck(宸℃) EndCheck(瀹屽伐妫�))
+ sql = @"select * from TStepCheckRecord where checkstaned_code=@qualityinsptcode and check_type=@checktype";
+ dynamicParams.Add("@qualityinsptcode", qualityinsptcode);
+ dynamicParams.Add("@checktype", checktype);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼澶辫触,褰撳墠璐ㄦ鏂规宸茬敓鎴愬搴旀楠岃褰�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎璐ㄦ鏂规瀛愯〃
+ sql = @"delete from TStepCheckStandardSub where stepstaned_code=@code";
+ list.Add(new { str = sql, parm = new { code = qualityinsptcode } });
+ //淇敼璐ㄦ鏂规涓昏〃
+ sql = @"update TStepCheckStandard set name=@name,status=@status,checktype=@checktype,sampmethod=@sampmethod,sampscare=@sampscare,
+ suitobject=@suitobject,suitpart=@suitpart,stepcode=@stepcode,descr=@descr
+ where code=@code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = qualityinsptcode,
+ name = qualityinsptname,
+ status = status,
+ checktype = checktype,
+ sampmethod = sampmethod,
+ sampscare = sampscare,
+ suitobject = suitobject,
+ suitpart = suitpart,
+ stepcode = stepcode,
+ descr = descr,
+ }
+ });
+ //鏂板璐ㄦ鏂规瀛愯〃
+ for (int i = 0; i < arra.Count; i++)
+ {
+ sql = @"insert into TStepCheckStandardSub(stepstaned_code,stepcheckitem_seq,stepcheckitem_code,required,numberjudge,unit,decimalnum,standvalue,uppervalue,lowervalue,stepcheckitem_desc,lm_user,lm_date)
+ values(@stepstaned_code,@stepcheckitem_seq,@stepcheckitem_code,@required,@numberjudge,@unit,@decimalnum,@standvalue,@uppervalue,@lowervalue,@stepcheckitem_desc,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ stepstaned_code = qualityinsptcode,
+ stepcheckitem_seq = Convert.ToInt32(arra[i]["stepcheckitem_seq"].ToString()),
+ stepcheckitem_code = arra[i]["stepcheckitem_code"].ToString(),
+ required = arra[i]["required"].ToString(),
+ numberjudge = arra[i]["numberjudge"].ToString(),
+ unit = arra[i]["unit"].ToString(),
+ decimalnum = arra[i]["decimalnum"].ToString(),
+ standvalue = arra[i]["standvalue"].ToString(),
+ uppervalue = arra[i]["uppervalue"].ToString(),
+ lowervalue = arra[i]["lowervalue"].ToString(),
+ stepcheckitem_desc = arra[i]["stepcheckitem_desc"].ToString(),
+ lm_user = us.usercode,
+ lm_date = date
+ }
+ });
+ }
+ break;
+ default:
+ break;
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ switch (type)
+ {
+ case "Add": //鏂板
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "宸ュ簭璐ㄦ鏂规:" + qualityinsptcode, us.usertype);
+ break;
+ case "Update": //淇敼
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "宸ュ簭璐ㄦ鏂规:" + qualityinsptcode, us.usertype);
+ break;
+ default:
+ break;
+ }
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭璐ㄦ鏂规鍒犻櫎]
+ public static ToMessage QualityInspectionDelete(string qualityinsptcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇鏄惁鐢熸垚妫�楠岃褰�(鍏ュ巶妫�楠�(InCheck) 鍑哄巶妫�楠�(OutCheck) FirstCheck锛堥妫�锛� PatroCheck(宸℃) EndCheck(瀹屽伐妫�))
+ sql = @"select * from TStepCheckRecord where checkstaned_code=@qualityinsptcode";
+ dynamicParams.Add("@qualityinsptcode", qualityinsptcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触,褰撳墠璐ㄦ鏂规宸茬敓鎴愬搴旀楠岃褰�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒犻櫎璐ㄦ鏂规涓昏〃
+ sql = @"delete TStepCheckStandard where code=@code";
+ list.Add(new { str = sql, parm = new { code = qualityinsptcode } });
+ //鍒犻櫎璐ㄦ鏂规瀛愯〃
+ sql = @"delete TStepCheckStandardSub where stepstaned_code=@code";
+ list.Add(new { str = sql, parm = new { code = qualityinsptcode } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "璐ㄦ鏂规:" + qualityinsptcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "璐ㄦ鏂规鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璐ㄦ鏂规鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠屾壂鐮佽幏鍙栦换鍔′俊鎭痌
+ public static ToMessage MesOrderStepCheckSearch(string orderstepqrcode, string checktype)
+ {
+ var sql = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ Dictionary<string, object> list = new Dictionary<string, object>();
+ try
+ {
+ if (orderstepqrcode != "" && orderstepqrcode != null)
+ {
+ string[] arra = orderstepqrcode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璇锋壂鎻忓伐搴忔潯鐮�!";
+ mes.data = null;
+ return mes;
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ //0.鍒ゆ柇褰撳墠鏉$爜宸ュ簭浠诲姟涓嶅瓨鍦�
+ sql = @"select * from TK_Wrk_Step where wo_code=@ordercode and step_code=@step_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ var da1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (da1.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏉$爜,宸ュ簭浠诲姟涓嶅瓨鍦�,璇疯仈绯荤鐞嗗憳!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇褰撳墠宸ュ崟鏄惁鍏抽棴
+ sql = @"select * from TK_Wrk_Man where wo_code=@ordercode and status='CLOSED'";
+ dynamicParams.Add("@ordercode", ordercode);
+ var da0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (da0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟宸插叧闂�,涓嶅厑璁告楠屾搷浣�!";
+ mes.data = null;
+ return mes;
+ }
+ //閫氳繃鎵弿浜岀淮鐮佷俊鎭煡鎵句换鍔′俊鎭�
+ sql = @"select A.wo_code,A.good_qty,M.partcode,M.partname,M.partspec,M.idinventoryclass as stocktype_code,S.stepcode,S.stepname
+ from TK_Wrk_Step A
+ inner join TK_Wrk_Man P on A.wo_code=P.wo_code
+ left join TMateriel_Info M on P.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ where A.wo_code=@wo_code and A.step_code=@stepcode";
+ dynamicParams.Add("@wo_code", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ if (decimal.Parse(data.Rows[0]["good_qty"].ToString()) > 0)
+ {
+ //鑾峰彇缁戝畾鐨勮川妫�鏂规銆佹娊鏍锋柟寮忋�佹牱鏈暟
+ sql = @"select code as checkstandcode,name as checkstandname,sampmethod,sampscare
+ from TStepCheckStandard
+ where (PATINDEX('%,' + RTRIM(@partcode) + ',%',',' + suitpart + ',')>0 or PATINDEX('%,' + RTRIM(@stocktype_code) + ',%',',' + suitpart + ',')>0)
+ and checktype=@checktype and stepcode=@stepcode ";
+ dynamicParams.Add("@partcode", data.Rows[0]["partcode"].ToString());//鐗╂枡缂栫爜
+ dynamicParams.Add("@stepcode", stepcode);//宸ュ簭缂栫爜
+ dynamicParams.Add("@stocktype_code", data.Rows[0]["stocktype_code"].ToString());//瀛樿揣绫诲瀷缂栫爜
+ dynamicParams.Add("@checktype", checktype);//妫�楠岀被鍨�
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ list.Add("labcont", data);
+ list.Add("chekstand", data1);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠浜у搧銆�" + data.Rows[0]["partname"].ToString() + "銆�,瀵瑰簲宸ュ簭銆�" + data.Rows[0]["stepname"].ToString() + "銆戯紝鏈寚瀹氳川妫�鏂规!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟鏃犳姤宸ヤ骇鍑�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鐢熶骇浠诲姟涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "浜岀淮鐮佷俊鎭负绌�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠屾牴鎹�夋嫨鐨勬楠屾柟妗堟煡鎵炬楠岄」鐩甝
+ public static ToMessage MesOrderStepCheckItemList(string checkstandcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //璐ㄦ鏂规缂栫爜鑾峰彇妫�楠岄」
+ sql = @"select A.stepcheckitem_seq, B.code,B.name,A.required,A.numberjudge,A.unit,A.decimalnum,
+ A.standvalue,A.uppervalue,A.lowervalue,A.stepcheckitem_desc
+ from TStepCheckStandardSub A
+ left join TStepCheckItem B on A.stepcheckitem_code=B.code
+ where A.stepstaned_code=@checkstandcode
+ order by A.stepcheckitem_seq";
+ dynamicParams.Add("@checkstandcode", checkstandcode);//璐ㄦ鏂规缂栫爜
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠璐ㄦ鏂规鏃犳楠岄」!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠�,鎻愪氦]
+ public static ToMessage SaveMesOrderStepCheckItem(string wocode, string partcode, string stepcode, string checkstandcode, string check_type, string sampmethod, string qualitystatus, string labqty, string sampleqty, string goodqty, string ngqty, string checkitemcont, User us)
+ {
+ var sql = "";
+ string checktypename = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string datetime = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ //鑾峰彇妫�楠岄」鐩俊鎭�
+ JArray arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(checkitemcont);
+ list.Clear();
+
+ //鍐欏叆妫�楠岃褰曚富琛�
+ sql = @"insert into TStepCheckRecord(wo_code,partcode,step_code,checkstaned_code,check_user,check_type,check_typename,sampmethod,check_result,check_qty,good_qty,ng_qty,lm_user,lm_date)
+ values(@wo_code,@partcode,@step_code,@checkstaned_code,@check_user,@check_type,@check_typename,@sampmethod,@check_result,@check_qty,@good_qty,@ng_qty,@lm_user,@lm_date)";
+ switch (check_type)
+ {
+ case "FirstCheck":
+ checktypename = "棣栨";
+ break;
+ case "PatroCheck":
+ checktypename = "宸℃";
+ break;
+ case "EndCheck":
+ checktypename = "瀹屽伐妫�楠�";
+ break;
+ default:
+ break;
+ }
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wocode,
+ partcode = partcode,
+ step_code = stepcode,
+ checkstaned_code = checkstandcode,
+ check_user = us.usercode,
+ check_type = check_type,
+ check_typename = checktypename,
+ sampmethod = sampmethod,
+ check_result = qualitystatus,
+ check_qty = decimal.Parse(sampleqty),
+ good_qty = decimal.Parse(goodqty),
+ ng_qty = decimal.Parse(ngqty),
+ lm_user = us.usercode,
+ lm_date = datetime
+ }
+ });
+ //鍐欏叆妫�楠岃褰曞瓙琛�
+ for (int j = 0; j < arra.Count; j++)
+ {
+ sql = @"insert into TStepCheckRecordSub(m_id,checknum,checkitem_seq,checkitem_code,checkitem_name,checkitem_descr,check_value,check_result,lm_user,lm_date)
+ values(CONVERT(INT,IDENT_CURRENT('TStepCheckRecord')),@checknum,@checkiem_seq,@checkitem_code,@checkitem_name,@checkitem_descr,@check_value,@check_result,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ checknum = arra[j]["checknum"].ToString(),
+ checkiem_seq = arra[j]["checkiem_seq"].ToString(),
+ checkitem_code = arra[j]["checkitem_code"].ToString(),
+ checkitem_name = arra[j]["checkitem_name"].ToString(),
+ checkitem_descr = arra[j]["checkitem_descr"].ToString(),
+ check_value = arra[j]["check_value"].ToString(),
+ check_result = arra[j]["check_result"].ToString(),
+ lm_user = us.usercode,
+ lm_date = datetime
+ }
+ });
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[宸ュ簭妫�楠岃褰曞垪琛ㄦ煡璇
+ public static ToMessage StepCheckTableSearch(string wocode, string partcode, string partname, string partapec, string stepname, string standname, string checktype, string checkresult, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wocode != "" && wocode != null)
+ {
+ search += "and A.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partapec != "" && partapec != null)
+ {
+ search += "and B.partspec like '%'+@partapec+'%' ";
+ dynamicParams.Add("@partapec", partapec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and S.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (standname != "" && standname != null)
+ {
+ search += "and T.name like '%'+@standname+'%' ";
+ dynamicParams.Add("@standname", standname);
+ }
+ if (checktype != "" && checktype != null)
+ {
+ search += "and A.check_type=@checktype ";
+ dynamicParams.Add("@checktype", checktype);
+ }
+ if (checkresult != "" && checkresult != null)
+ {
+ search += "and A.check_result=@checkresult ";
+ dynamicParams.Add("@checkresult", checkresult);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�(棣栨銆佸贰妫�銆佸畬宸ユ楠�)
+ var sql = @"select A.id,A.wo_code,A.partcode,B.partname,B.partspec,A.step_code,S.stepname,A.checkstaned_code,T.name as checkstaned_name,A.check_user,
+ A.check_type,A.check_result,A.check_descr,A.check_qty,U.username as lm_user,A.lm_date
+ from TStepCheckRecord A
+ left join TMateriel_Info B on A.partcode=B.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TStepCheckStandard T on A.checkstaned_code=T.code
+ left join TUser U on A.check_user=U.usercode
+ where A.check_type in('FirstCheck','PatroCheck','EndCheck') " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岃褰曞垪琛ㄦ槑缁嗘煡璇
+ public static ToMessage StepCheckTableSubSearch(string id)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_WuLiuCheckSubSelect";
+ dynamicParams.Add("@checkid", id);
+ DataTable dt = DapperHelper.selectProcedure(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = dt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犳楠屾槑缁嗘暟鎹�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[宸ュ簭妫�楠岃褰曞鍑篯
+ public static ToMessage StepCheckTableOutExcel(string wocode, string partcode, string partname, string partapec, string stepname, string standname, string checktype, string checkresult, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wocode != "" && wocode != null)
+ {
+ search += "and A.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.partcode like '%'+@stanedname+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partapec != "" && partapec != null)
+ {
+ search += "and B.partspec like '%'+@partapec+'%' ";
+ dynamicParams.Add("@partapec", partapec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and S.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (standname != "" && standname != null)
+ {
+ search += "and T.name like '%'+@standname+'%' ";
+ dynamicParams.Add("@standname", standname);
+ }
+ if (checktype != "" && checktype != null)
+ {
+ search += "and A.check_type=@checktype ";
+ dynamicParams.Add("@checktype", checktype);
+ }
+ if (checkresult != "" && checkresult != null)
+ {
+ search += "and A.check_result=@checkresult ";
+ dynamicParams.Add("@checkresult", checkresult);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN A.wo_code
+ ELSE ''END AS '宸ュ崟鍙�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN M.partcode
+ ELSE ''END AS '浜у搧缂栫爜',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN M.partname
+ ELSE ''END AS '浜у搧鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN M.partspec
+ ELSE ''END AS '瑙勬牸鍨嬪彿',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN S.stepname
+ ELSE ''END AS '宸ュ簭鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN A.checkstaned_code
+ ELSE ''END AS '鏍囧噯缂栫爜',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN T.name
+ ELSE ''END AS '鏍囧噯鍚嶇О',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN U.username
+ ELSE ''END AS '妫�楠屼汉鍛�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN A.check_typename
+ ELSE ''END AS '妫�楠岀被鍨�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN A.check_result
+ ELSE ''END AS '妫�楠岀粨鏋�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN A.check_descr
+ ELSE ''END AS '妫�楠屾弿杩�',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN A.check_qty
+ END AS '鏍锋湰鏁伴噺',
+ CASE WHEN
+ ROW_NUMBER() OVER (PARTITION BY A.id ORDER BY B.id) = 1 THEN A.lm_date
+ END AS '妫�楠屾椂闂�',
+ B.checknum as 妫�楠屼欢娆�,B.checkitem_seq as '妫�楠岄」鐩簭鍙�',B.checkitem_code '妫�楠岄」鐩紪鐮�',B.checkitem_name '妫�楠岄」鐩悕绉�',B.checkitem_descr '妫�楠岄」鐩弿杩�',B.check_result '妫�楠岄」鐩粨鏋�',
+ C.standvalue as '鏍囧噯鍊�',C.uppervalue as '涓婇檺鍊�',C.lowervalue as '涓嬮檺鍊�',B.check_value as '瀹炴祴鍊�'
+ from TStepCheckRecord A
+ left join TStepCheckRecordSub B on A.id=B.m_id
+ left join TMateriel_Info M on A.partcode=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TStepCheckStandard T on A.checkstaned_code=T.code
+ left join TStepCheckStandardSub C on A.checkstaned_code=C.stepstaned_code and B.checkitem_code=C.stepcheckitem_code
+ left join TUser U on A.check_user=U.usercode
+ where A.check_type in('FirstCheck','PatroCheck','EndCheck') " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "宸ュ簭妫�楠岃褰�");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/ReportManagerDAL.cs b/VueWebCoreApi/DLL/DAL/ReportManagerDAL.cs
new file mode 100644
index 0000000..f82bbc3
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/ReportManagerDAL.cs
@@ -0,0 +1,1923 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class ReportManagerDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[鎶ュ伐璁板綍鍒楄〃鏁版嵁鏌ヨ鎺ュ彛]
+ public static ToMessage MesOrderStepReportSearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string stepname, string eqpcode, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wo_code != "" && wo_code != null)
+ {
+ search += "and AA.wo_code like '%'+@wo_code+'%' ";
+ dynamicParams.Add("@wo_code", wo_code);
+ }
+ if (partnumber != "" && partnumber != null)
+ {
+ search += "and AA.partnumber like '%'+@partnumber+'%' ";
+ dynamicParams.Add("@partnumber", partnumber);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and AA.eqp_code=@eqp_code ";
+ dynamicParams.Add("@eqp_code", eqpcode);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and AA.usercode like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (reportdateopendate != "" && reportdateopendate != null)
+ {
+ search += "and AA.report_date between @reportdateopendate and @reportdateclosedate ";
+ dynamicParams.Add("@reportdateopendate", reportdateopendate + " 00:00:00");
+ dynamicParams.Add("@reportdateclosedate", reportdateclosedate + " 23:59:59");
+ }
+
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鑷埗鎶ュ伐澶栧崗鏀舵枡鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from h_v_MesOrderStepReportSearch as AA where " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鎶ュ伐璁板綍鍒楄〃鏁版嵁瀵煎嚭]
+ public static ToMessage MesOrderStepReportExcelSearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string stepname, string eqpcode, string reportuser, string reportdateopendate, string reportdateclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wo_code != "" && wo_code != null)
+ {
+ search += "and AA.wo_code like '%'+@wo_code+'%' ";
+ dynamicParams.Add("@wo_code", wo_code);
+ }
+ if (partnumber != "" && partnumber != null)
+ {
+ search += "and AA.partnumber like '%'+@partnumber+'%' ";
+ dynamicParams.Add("@partnumber", partnumber);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and AA.eqp_code=@eqp_code ";
+ dynamicParams.Add("@eqp_code", eqpcode);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and AA.usercode like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (reportdateopendate != "" && reportdateopendate != null)
+ {
+ search += "and AA.report_date between @reportdateopendate and @reportdateclosedate ";
+ dynamicParams.Add("@reportdateopendate", reportdateopendate + " 00:00:00");
+ dynamicParams.Add("@reportdateclosedate", reportdateclosedate + " 23:59:59");
+ }
+
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鑷埗鎶ュ伐澶栧崗鏀舵枡鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select AA.wo_code as '宸ュ崟缂栧彿',AA.partnumber as '浜у搧缂栫爜',AA.partname as '浜у搧鍚嶇О',AA.partspec as '瑙勬牸鍨嬪彿',AA.wkshp_name as '杞﹂棿鍚嶇О',AA.task_qty as '浠诲姟鏁伴噺',
+ AA.stepname as '宸ュ簭鍚嶇О',(case when AA.steptype='Z' then '鑷埗' else '澶栧崗' end) as '宸ュ簭绫诲瀷',(case when AA.eqp_code is null then AA.eqp_name else AA.wx_name end) as '璁惧/渚涘簲鍟�',
+ AA.usergroup_name as '鎶ュ伐鐝粍',AA.username as '鎶ュ伐浜哄憳',AA.report_qty as '鍚堟牸鏁伴噺',AA.ng_qty as '涓嶈壇鏁伴噺',AA.laborbad_qty as '宸ュ簾鏁伴噺',AA.materielbad_qty as '鏂欏簾鏁伴噺',
+ AA.report_date as '鎶ュ伐鏃堕棿'
+ from h_v_MesOrderStepReportSearch as AA where " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "鎶ュ伐璁板綍鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐢熶骇杩涘害鎶ヨ〃]
+ public static ToMessage ProductionScheduleReportSearch(string wkshopcode, string status,string socode, string wocode, string partcode, string partname, string partspec, string opendate, string closedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (status != "" && status != null)
+ {
+ switch (status)
+ {
+ case "START":
+ search += "and AA.status='鎵ц涓�' ";
+ break;
+ case "CLOSED":
+ search += "and AA.status='宸插畬鎴�' ";
+ break;
+ default:
+ search += "and AA.status='鏈紑濮�' ";
+ break;
+ }
+ }
+ if (socode != "" && socode != null)
+ {
+ search += "and AA.saleOrderCode like '%'+@socode+'%' ";
+ dynamicParams.Add("@socode", socode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and AA.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and AA.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select top 100 percent AA.saleOrderCode,AA.m_po,AA.wkshp_code,AA.wkshp_name,AA.wo_code,AA.status,AA.lm_date,
+ AA.partcode,AA.partname,AA.partspec,AA.plan_qty,left(AA.concat_name,len(concat_name)-1) as concat_name
+ from (
+ select W.saleOrderCode,W.m_po,W.wo_code,W.wkshp_code,F.torg_name as wkshp_name,
+ case when W.status='START' then '鎵ц涓�' when W.status='CLOSED' then '宸插畬鎴�' else '鏈紑濮�' end as status,
+ W.lm_date,
+ P.partcode,P.partname,P.partspec,W.plan_qty,
+ (
+ select s.stepname+'/'+cast(cast(n.good_qty as decimal(18,2)) AS varchar(50))+','
+ from TK_Wrk_Step n
+ inner join TStep S on n.step_code=S.stepcode
+ where n.wo_code=W.wo_code for xml path('')
+ ) as concat_name
+ from TK_Wrk_Man W
+ left join TMateriel_Info P on W.materiel_code=p.partcode
+ left join TOrganization F on W.wkshp_code=F.torg_code
+ group by W.saleOrderCode,W.m_po,W.wo_code,W.wkshp_code,F.torg_name,W.status,W.lm_date,P.partcode,P.partname,P.partspec,W.plan_qty
+ ) as AA where AA.concat_name is not null " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇杩涘害鎶ヨ〃瀵煎嚭]
+ public static ToMessage ProductionScheduleReportExcelSearch(string wkshopcode, string status,string socode, string wocode,string partcode, string partname, string partspec, string opendate, string closedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (status != "" && status != null)
+ {
+ switch (status)
+ {
+ case "START":
+ search += "and AA.status='鎵ц涓�' ";
+ break;
+ case "CLOSED":
+ search += "and AA.status='宸插畬鎴�' ";
+ break;
+ default:
+ search += "and AA.status='鏈紑濮�' ";
+ break;
+ }
+ }
+ if (socode != "" && socode != null)
+ {
+ search += "and AA.saleOrderCode like '%'+@socode+'%' ";
+ dynamicParams.Add("@socode", socode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and AA.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (opendate != "" && opendate != null)
+ {
+ search += "and AA.lm_date between @opendate and @closedate ";
+ dynamicParams.Add("@opendate", opendate + " 00:00:00");
+ dynamicParams.Add("@closedate", closedate + " 23:59:59");
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+
+ var sql = @"select top 100 percent AA.saleOrderCode as 閿�鍞鍗曞彿,AA.m_po as 鐢熶骇璁㈠崟鍙�,AA.wkshp_code as 杞﹂棿缂栫爜,AA.wkshp_name as 杞﹂棿鍚嶇О,AA.wo_code as 鐢熶骇宸ュ崟鍙�,
+ AA.status as 宸ュ崟鐘舵��,AA.lm_date as 鍗曟嵁鏃ユ湡
+ AA.partcode as 浜у搧缂栫爜,AA.partname as 浜у搧鍚嶇О,AA.partspec as 浜у搧瑙勬牸,AA.plan_qty as 浠诲姟鏁伴噺,left(AA.concat_name,len(concat_name)-1) as 鐢熶骇杩涘害
+ from (
+ select W.saleOrderCode,W.m_po,W.wo_code,W.wkshp_code,F.torg_name as wkshp_name,
+ case when W.status='START' then '鎵ц涓�' when W.status='CLOSED' then '宸插畬鎴�' else '鏈紑濮�' end as status,
+ W.lm_date,
+ P.partcode,P.partname,P.partspec,W.plan_qty,
+ (
+ select s.stepname+'/'+cast(cast(n.good_qty as decimal(18,2)) AS varchar(50))+','
+ from TK_Wrk_Step n
+ inner join TStep S on n.step_code=S.stepcode
+ where n.wo_code=W.wo_code for xml path('')
+ ) as concat_name
+ from TK_Wrk_Man W
+ left join TMateriel_Info P on W.materiel_code=p.partcode
+ left join TOrganization F on W.wkshp_code=F.torg_code
+ group by W.saleOrderCode,W.m_po,W.wo_code,W.wkshp_code,F.torg_name,W.status,W.lm_date,P.partcode,P.partname,P.partspec,W.plan_qty
+ ) as AA
+ where where AA.concat_name is not null " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "鐢熶骇杩涘害鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ヨ]
+ public static ToMessage GroupSalaryReportSearch(string compute,string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec, string stepname, string groupcode, string username, string operopendate, string operclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (compute == "last") //鏈亾宸ュ簭
+ {
+ search += "and P.isend=@isend ";
+ dynamicParams.Add("@isend", "Y");
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and K.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (socode != "" && socode != null)
+ {
+ search += "and K.saleOrderCode like '%'+@socode+'%' ";
+ dynamicParams.Add("@socode", socode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and A.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and M.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and M.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and M.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and T.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (groupcode != "" && groupcode != null)
+ {
+ search += "and G.usergroupcode=@groupcode ";
+ dynamicParams.Add("@groupcode", groupcode);
+ }
+ if (username != "" && username != null)
+ {
+ search += "and U.username like '%'+@username+'%' ";
+ dynamicParams.Add("@username", username);
+ }
+ if (operopendate != "" && operopendate != null)
+ {
+ search += "and B.report_date between @operopendate and @operclosedate ";
+ dynamicParams.Add("@operopendate", operopendate + " 00:00:00");
+ dynamicParams.Add("@operclosedate", operclosedate + " 23:59:59");
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select distinct A.id,K.wkshp_code,F.torg_name as wkshp_name,K.saleOrderCode,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_quantity,A.task_qty,G.usergroupcode,G.usergroupname,A.good_qty,
+ isnull(A.step_price,0) as unprice,A.good_qty*isnull(A.step_price,0) as usermoney,U.username as lm_user,A.lm_date,B.report_date
+ from TK_Wrk_Record A
+ inner join TK_Wrk_RecordSub B on A.id=B.m_id
+ inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code
+ left join TK_Wrk_Man K on A.wo_code=K.wo_code
+ left join TGroup G on B.usergroup_code=G.usergroupcode
+ left join TMateriel_Info M on A.materiel_code=M.partcode
+ left join TStep T on A.step_code=T.stepcode
+ left join TUser U on A.lm_user=U.usercode
+ left join TOrganization F on K.wkshp_code=F.torg_code
+ where B.usergroup_code<>'' and A.style='B' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍鏌ョ湅鎶ュ伐浜哄憳]
+ public static ToMessage GroupSalaryReportSearchUser(string id)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇鎶ュ伐浜哄憳
+ sql = @"select S.report_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + S.report_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username
+ from TK_Wrk_RecordSub S
+ where m_id=@id";
+ dynamicParams.Add("@id", id);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐝粍宸ヨ祫鎶ヨ〃璁板綍瀵煎嚭]
+ public static ToMessage GroupSalaryReportExcelSearch(string compute,string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec, string stepname, string groupcode, string username, string operopendate, string operclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (compute == "last") //鏈亾宸ュ簭
+ {
+ search += "and P.isend=@isend ";
+ dynamicParams.Add("@isend", "Y");
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and K.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (socode != "" && socode != null)
+ {
+ search += "and K.saleOrderCode like '%'+@socode+'%' ";
+ dynamicParams.Add("@socode", socode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and A.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and M.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and M.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and M.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and T.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (groupcode != "" && groupcode != null)
+ {
+ search += "and G.usergroupcode=@groupcode ";
+ dynamicParams.Add("@groupcode", groupcode);
+ }
+ if (username != "" && username != null)
+ {
+ search += "and U.username like '%'+@username+'%' ";
+ dynamicParams.Add("@username", username);
+ }
+ if (operopendate != "" && operopendate != null)
+ {
+ search += "and B.report_date between @operopendate and @operclosedate ";
+ dynamicParams.Add("@operopendate", operopendate + " 00:00:00");
+ dynamicParams.Add("@operclosedate", operclosedate + " 23:59:59");
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select distinct K.wkshp_code as 杞﹂棿缂栫爜,F.torg_name as 杞﹂棿鍚嶇О,K.saleOrderCode as '閿�鍞崟鍙�',A.wo_code as 宸ュ崟缂栧彿,M.partcode as 浜у搧缂栫爜,M.partname as 浜у搧鍚嶇О,M.partspec as 浜у搧瑙勬牸,
+ T.stepcode as 宸ュ簭缂栫爜,T.stepname as 宸ュ簭鍚嶇О,P.plan_quantity as 浠诲姟鏁伴噺,A.task_qty as 鎬诲彲鎶ユ暟閲�,G.usergroupcode as 鐝粍缂栫爜,G.usergroupname as 鐝粍鍚嶇О,
+ A.good_qty as 鎶ュ伐鏁伴噺,isnull(A.step_price,0) as 宸ュ簭鍗曚环,A.good_qty*isnull(A.step_price,0) as 璁′欢宸ヨ祫,U.username as 鎿嶄綔浜哄憳,A.lm_date as 鎿嶄綔鏃堕棿,B.report_date as 鎶ュ伐鏃堕棿
+ from TK_Wrk_Record A
+ inner join TK_Wrk_RecordSub B on A.id=B.m_id
+ inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code
+ left join TK_Wrk_Man K on A.wo_code=K.wo_code
+ left join TGroup G on B.usergroup_code=G.usergroupcode
+ left join TMateriel_Info M on A.materiel_code=M.partcode
+ left join TStep T on A.step_code=T.stepcode
+ left join TUser U on A.lm_user=U.usercode
+ left join TOrganization F on K.wkshp_code=F.torg_code
+ where B.usergroup_code<>'' and A.style='B' " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "鐝粍璁′欢宸ヨ祫鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃]
+ public static ToMessage PeopleSalaryReportSearch(string compute,string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec,string stepcode, string stepname, string reportname, string reportopendate, string reportclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (compute == "last") //鏈亾宸ュ簭
+ {
+ search += "and AA.isend=@isend ";
+ dynamicParams.Add("@isend", "Y");
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (socode != "" && socode != null)
+ {
+ search += "and AA.saleOrderCode like '%'+@socode+'%' ";
+ dynamicParams.Add("@socode", socode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and AA.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepcode != "" && stepcode != null)
+ {
+ search += "and AA.step_code like '%'+@stepcode+'%' ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (reportname != "" && reportname != null)
+ {
+ search += "and AA.username like '%'+@reportname+'%' ";
+ dynamicParams.Add("@reportname", reportname);
+ }
+ if (reportopendate != "" && reportopendate != null)
+ {
+ search += "and AA.report_date between @reportopendate and @reportclosedate ";
+ dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00");
+ dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59");
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select M.wkshp_code,F.torg_name as wkshp_name,M.saleOrderCode,A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend,
+ K.plan_quantity,A.task_qty,B.report_qty,isnull(A.step_price,0) as step_price,(B.report_qty*isnull(A.step_price,0)) as moneys,
+ B.report_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.report_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.report_date
+ from TK_Wrk_Record A
+ inner join TK_Wrk_RecordSub B on A.id=B.m_id
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code=S.stepcode
+ left join TMateriel_Info P on A.materiel_code=P.partcode
+ left join TOrganization F on M.wkshp_code=F.torg_code
+ where A.style='B' and B.style='B' and B.payrate='S' and A.verify='Y' and B.usergroup_code=''
+ ) as AA
+ where " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃瀵煎嚭]
+ public static ToMessage PeopleSalaryReportSearch(string compute,string wkshopcode,string socode, string wocode, string partcode, string partname, string partspec, string stepcode, string stepname, string reportname, string reportopendate, string reportclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (compute == "last") //鏈亾宸ュ簭
+ {
+ search += "and AA.isend=@isend ";
+ dynamicParams.Add("@isend", "Y");
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (socode != "" && socode != null)
+ {
+ search += "and AA.saleOrderCode like '%'+@socode+'%' ";
+ dynamicParams.Add("@socode", socode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and AA.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepcode != "" && stepcode != null)
+ {
+ search += "and AA.step_code like '%'+@stepcode+'%' ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (reportname != "" && reportname != null)
+ {
+ search += "and AA.username like '%'+@reportname+'%' ";
+ dynamicParams.Add("@reportname", reportname);
+ }
+ if (reportopendate != "" && reportopendate != null)
+ {
+ search += "and AA.report_date between @reportopendate and @reportclosedate ";
+ dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00");
+ dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59");
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select AA.wkshp_code as 杞﹂棿缂栫爜,AA.wkshp_name as 杞﹂棿鍚嶇О,AA.saleOrderCode as '閿�鍞崟鍙�',AA.wo_code as '宸ュ崟鍙�',AA.partcode as '浜у搧缂栫爜',AA.partname '浜у搧鍚嶇О',AA.partspec as '瑙勬牸鍨嬪彿',AA.step_seq as '宸ュ簭搴忓彿',
+ AA.step_code as '宸ュ簭缂栫爜',AA.stepname as '宸ュ簭鍚嶇О',(case when AA.steptype='Z' then '鑷埗' else '澶栧崗' end) as '宸ュ簭绫诲瀷',AA.plan_quantity as '浠诲姟鏁伴噺',AA.task_qty as '鎬诲彲鎶ユ暟閲�',AA.report_qty as '鎶ュ伐鏁伴噺',
+ AA.step_price as '宸ュ簭鍗曚环',AA.moneys as '璁′欢宸ヨ祫',AA.usercode as '鎶ュ伐浜哄憳缂栧彿',AA.username as '鎶ュ伐浜哄憳鍚嶇О',AA.report_date as '鎶ュ伐鏃堕棿'
+ from(
+ select M.wkshp_code,F.torg_name as wkshp_name,M.saleOrderCode,A.wo_code,A.materiel_code as partcode,P.partname,P.partspec,A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,K.isend,
+ K.plan_quantity,A.task_qty,B.report_qty,isnull(A.step_price,0) as step_price,(B.report_qty*isnull(A.step_price,0)) as moneys,
+ B.report_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.report_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.report_date
+ from TK_Wrk_Record A
+ inner join TK_Wrk_RecordSub B on A.id=B.m_id
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code=S.stepcode
+ left join TMateriel_Info P on A.materiel_code=P.partcode
+ left join TOrganization F on M.wkshp_code=F.torg_code
+ where A.style='B' and B.style='B' and B.payrate='S' and A.verify='Y' and B.usergroup_code=''
+ ) as AA
+ where " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "浜哄憳宸ヨ祫鏄庣粏鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[濮斿鎶ヨ〃璁板綍鏌ヨ]
+ public static ToMessage OutSourceReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string suppername, string type, string receivopendate, string receivclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and P.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and A.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and M.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and M.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and M.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and S.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (suppername != "" && suppername != null)
+ {
+ search += "and C.name like '%'+@suppername+'%' ";
+ dynamicParams.Add("@suppername", suppername);
+ }
+ if (type != "" && type != null)
+ {
+ search += "and A.style=@type ";
+ dynamicParams.Add("@type", type);
+ switch (type)
+ {
+ case "F": //鍙戞枡
+ if (receivopendate != "" && receivopendate != null)
+ {
+ search += "and B.out_time between @receivopendate and @receivclosedate ";
+ dynamicParams.Add("@receivopendate", receivopendate + " 00:00:00");
+ dynamicParams.Add("@receivclosedate", receivclosedate + " 23:59:59");
+ }
+ break;
+ case "S": //鏀舵枡
+ if (receivopendate != "" && receivopendate != null)
+ {
+ search += "and B.in_time between @receivopendate and @receivclosedate ";
+ dynamicParams.Add("@receivopendate", receivopendate + " 00:00:00");
+ dynamicParams.Add("@receivclosedate", receivclosedate + " 23:59:59");
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select P.wkshp_code,G.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,C.code,C.name,(case when A.style='F' then '鍙戞枡' when A.style='S' then '鏀舵枡' end) as style,
+ A.fqty,A.sqty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,U.username as out_person,B.out_time,T.username as in_person,B.in_time
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_OutRecordSub B on A.id=B.m_id
+ left join TK_Wrk_Man P on A.wo_code=P.wo_code
+ left join TOrganization G on P.wkshp_code=G.torg_code
+ left join TMateriel_Info M on A.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TCustomer C on A.wx_code=C.code
+ left join TUser U on B.out_person=U.usercode
+ left join TUser T on B.in_person=T.usercode
+ where " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[濮斿鎶ヨ〃璁板綍瀵煎嚭]
+ public static ToMessage OutSourceReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string suppername, string type, string receivopendate, string receivclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and P.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and A.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and M.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and M.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and M.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and S.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (suppername != "" && suppername != null)
+ {
+ search += "and C.name like '%'+@suppername+'%' ";
+ dynamicParams.Add("@suppername", suppername);
+ }
+ if (type != "" && type != null)
+ {
+ search += "and A.style=@type ";
+ dynamicParams.Add("@type", type);
+ switch (type)
+ {
+ case "F": //鍙戞枡
+ if (receivopendate != "" && receivopendate != null)
+ {
+ search += "and B.out_time between @receivopendate and @receivclosedate ";
+ dynamicParams.Add("@receivopendate", receivopendate + " 00:00:00");
+ dynamicParams.Add("@receivclosedate", receivclosedate + " 23:59:59");
+ }
+ break;
+ case "S": //鏀舵枡
+ if (receivopendate != "" && receivopendate != null)
+ {
+ search += "and B.in_time between @receivopendate and @receivclosedate ";
+ dynamicParams.Add("@receivopendate", receivopendate + " 00:00:00");
+ dynamicParams.Add("@receivclosedate", receivclosedate + " 23:59:59");
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select P.wkshp_code as 杞﹂棿缂栫爜,G.torg_name as 杞﹂棿鍚嶇О,A.wo_code as '宸ュ崟缂栧彿',M.partcode as '浜у搧缂栫爜',M.partname as '浜у搧鍚嶇О',M.partspec as '浜у搧瑙勬牸',S.stepcode as '宸ュ簭缂栫爜',S.stepname as '宸ュ簭鍚嶇О',
+ C.code as '澶栧崗渚涙柟缂栫爜',C.name as '澶栧崗渚涙柟鍚嶇О',(case when A.style='F' then '鍙戞枡' when A.style='S' then '鏀舵枡' end) as '鎿嶄綔绫诲瀷',
+ A.fqty as '鍙戞枡鏁伴噺',A.sqty as '鏀舵枡鏁伴噺',A.ng_qty as '涓嶈壇鏁伴噺',A.laborbad_qty as '宸ュ簾鏁伴噺',A.materielbad_qty as '鏂欏簾鏁伴噺',U.username as '鍙戞枡浜哄憳',B.out_time as '鍙戞枡鏃堕棿',
+ T.username as '鏀舵枡浜哄憳',B.in_time as '鏀舵枡鏃堕棿'
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_OutRecordSub B on A.id=B.m_id
+ left join TK_Wrk_Man P on A.wo_code=P.wo_code
+ left join TOrganization G on P.wkshp_code=G.torg_code
+ left join TMateriel_Info M on A.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TCustomer C on A.wx_code=C.code
+ left join TUser U on B.out_person=U.usercode
+ left join TUser T on B.in_person=T.usercode
+ where " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "濮斿鎶ュ伐璁板綍鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[涓嶈壇鏄庣粏鎶ヨ〃]
+ public static ToMessage DefectDetailsReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string defectcode, string defectname, string reportname, string reportopendate, string reportclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and AA.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (defectcode != "" && defectcode != null)
+ {
+ search += "and AA.defect_code like '%'+@defectcode+'%' ";
+ dynamicParams.Add("@defectcode", defectcode);
+ }
+ if (defectname != "" && defectname != null)
+ {
+ search += "and AA.defect_name like '%'+@defectname+'%' ";
+ dynamicParams.Add("@defectname", defectname);
+ }
+ if (reportname != "" && reportname != null)
+ {
+ search += "and AA.lm_user like '%'+@reportname+'%' ";
+ dynamicParams.Add("@reportname", reportname);
+ }
+ if (reportopendate != "" && reportopendate != null)
+ {
+ search += "and AA.lm_date between @reportopendate and @reportclosedate ";
+ dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00");
+ dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select W.wkshp_code,G.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty,
+ A.defect_code,
+ STUFF((SELECT ',' + F.name
+ FROM TDefect F
+ WHERE CHARINDEX(',' + F.code + ',', ',' + A.defect_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS defect_name,
+ A.style,U.username as lm_user,A.lm_date
+ from CSR_WorkRecord_Defect A
+ inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code
+ left join TK_Wrk_Man W on A.wo_code=W.wo_code
+ left join TOrganization G on W.wkshp_code=G.torg_code
+ left join TMateriel_Info M on A.partnumber=M.partcode
+ left join TStep T on A.step_code=T.stepcode
+ left join TUser U on A.lm_user=U.usercode
+ ) as AA
+ where " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[涓嶈壇鏄庣粏鎶ヨ〃瀵煎嚭]
+ public static ToMessage DefectDetailsReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string defectcode, string defectname, string reportname, string reportopendate, string reportclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and AA.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (defectcode != "" && defectcode != null)
+ {
+ search += "and AA.defect_code like '%'+@defectcode+'%' ";
+ dynamicParams.Add("@defectcode", defectcode);
+ }
+ if (defectname != "" && defectname != null)
+ {
+ search += "and AA.defect_name like '%'+@defectname+'%' ";
+ dynamicParams.Add("@defectname", defectname);
+ }
+ if (reportname != "" && reportname != null)
+ {
+ search += "and AA.lm_user like '%'+@reportname+'%' ";
+ dynamicParams.Add("@reportname", reportname);
+ }
+ if (reportopendate != "" && reportopendate != null)
+ {
+ search += "and AA.lm_date between @reportopendate and @reportclosedate ";
+ dynamicParams.Add("@reportopendate", reportopendate + " 00:00:00");
+ dynamicParams.Add("@reportclosedate", reportclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select AA.wkshp_code as 杞﹂棿缂栫爜,AA.wkshp_name as 杞﹂棿鍚嶇О,AA.wo_code as 宸ュ崟缂栧彿,AA.partcode as 浜у搧缂栫爜,AA.partname as 浜у搧鍚嶇О,AA.partspec as 浜у搧瑙勬牸,AA.stepcode as 宸ュ簭缂栫爜,
+ AA.stepname as 宸ュ簭鍚嶇О,AA.plan_qty as 浠诲姟鏁伴噺,AA.defect_qty as 涓嶈壇鏁伴噺,AA.defect_code as 缂洪櫡浠g爜,AA.defect_name as 缂洪櫡鍚嶇О,
+ (case when AA.style='B' then '鎶ュ伐' when AA.style='S' then '鏀舵枡' end) as '鎿嶄綔绫诲瀷',AA.lm_user as 鎿嶄綔浜哄憳,AA.lm_date as 鎿嶄綔鏃堕棿
+ from(
+ select W.wkshp_code,G.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,P.plan_qty,A.defect_qty,
+ A.defect_code,
+ STUFF((SELECT ',' + F.name
+ FROM TDefect F
+ WHERE CHARINDEX(',' + F.code + ',', ',' + A.defect_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS defect_name,
+ A.style,U.username as lm_user,A.lm_date
+ from CSR_WorkRecord_Defect A
+ inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code
+ left join TK_Wrk_Man W on A.wo_code=W.wo_code
+ left join TOrganization G on W.wkshp_code=G.torg_code
+ left join TMateriel_Info M on A.partnumber=M.partcode
+ left join TStep T on A.step_code=T.stepcode
+ left join TUser U on A.lm_user=U.usercode
+ ) as AA
+ where " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "涓嶈壇鏄庣粏鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[缁翠慨鏄庣粏鎶ヨ〃]
+ public static ToMessage MaintenanceDetailsReportSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string style, string defectname, string repairname, string repairopendate, string repairclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and AA.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (style != "" && style != null)
+ {
+ search += "and AA.style=@style ";
+ dynamicParams.Add("@style", style);
+ }
+ if (defectname != "" && defectname != null)
+ {
+ search += "and AA.defect_name like '%'+@defectname+'%' ";
+ dynamicParams.Add("@defectname", defectname);
+ }
+ if (repairname != "" && repairname != null)
+ {
+ search += "and AA.lm_user like '%'+@repairname+'%' ";
+ dynamicParams.Add("@repairname", repairname);
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and AA.lm_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select AA.wkshp_code,AA.wkshp_name,AA.wo_code,AA.partcode,AA.partname,AA.partspec,AA.stepcode,AA.stepname,(case when AA.style='B' then '鎶ュ伐' when AA.style='S' then '鏀舵枡' end) as style,
+ AA.plan_qty,AA.repair_qty,AA.laborbad_qty,AA.materielbad_qty,AA.defect_code,AA.defect_name,AA.lm_user,AA.lm_date
+ from(
+ select W.wkshp_code,G.torg_name as wkshp_name,F.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,F.style,P.plan_qty,F.repair_qty,F.laborbad_qty,F.materielbad_qty,F.defect_code,
+ defect_name = STUFF(( SELECT ',' + T.name
+ FROM TDefect as T
+ where PATINDEX('%,' + RTRIM(T.code) + ',%',',' + F.defect_code + ',')>0
+ ORDER BY PATINDEX('%,' + RTRIM(T.code) + ',%',',' + F.defect_code + ',')
+ FOR XML PATH('')), 1, 1,''),U.username as lm_user,F.lm_date
+ from CSR_WorkRecord_DefectHandle as F
+ inner join TK_Wrk_Step P on F.wo_code=P.wo_code and F.step_code=P.step_code
+ left join TK_Wrk_Man W on F.wo_code=W.wo_code
+ left join TOrganization G on W.wkshp_code=G.torg_code
+ left join TMateriel_Info M on F.partnumber=M.partcode
+ left join TStep S on F.step_code=S.stepcode
+ left join TUser U on F.lm_user=U.usercode
+ ) as AA
+ where " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缁翠慨鏄庣粏鎶ヨ〃瀵煎嚭]
+ public static ToMessage MaintenanceDetailsReportExcelSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, string stepname, string style, string defectname, string repairname, string repairopendate, string repairclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ search += "and AA.wo_code like '%'+@wocode+'%' ";
+ dynamicParams.Add("@wocode", wocode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (style != "" && style != null)
+ {
+ search += "and AA.style=@style ";
+ dynamicParams.Add("@style", style);
+ }
+ if (defectname != "" && defectname != null)
+ {
+ search += "and AA.defect_name like '%'+@defectname+'%' ";
+ dynamicParams.Add("@defectname", defectname);
+ }
+ if (repairname != "" && repairname != null)
+ {
+ search += "and AA.lm_user like '%'+@repairname+'%' ";
+ dynamicParams.Add("@repairname", repairname);
+ }
+ if (repairopendate != "" && repairopendate != null)
+ {
+ search += "and AA.lm_date between @repairopendate and @repairclosedate ";
+ dynamicParams.Add("@repairopendate", repairopendate + " 00:00:00");
+ dynamicParams.Add("@repairclosedate", repairclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select AA.wkshp_code as 杞﹂棿缂栫爜,AA.wkshp_name as 杞﹂棿鍚嶇О,AA.wo_code as 宸ュ崟缂栧彿,AA.partcode as 浜у搧缂栫爜,AA.partname as 浜у搧鍚嶇О,AA.partspec as 浜у搧瑙勬牸,AA.stepcode as 宸ュ簭缂栫爜,AA.stepname as 宸ュ簭鍚嶇О,
+ (case when AA.style='B' then '鎶ュ伐' when AA.style='S' then '鏀舵枡' end) as 鎿嶄綔绫诲瀷,
+ AA.plan_qty as 浠诲姟鏁伴噺,AA.repair_qty as 缁翠慨鏁伴噺,AA.laborbad_qty as 宸ュ簾鏁伴噺,AA.materielbad_qty as 鏂欏簾鏁伴噺,AA.defect_name as 缂洪櫡鍚嶇О,AA.lm_user as 缁翠慨浜哄憳,AA.lm_date as 缁翠慨鏃堕棿
+ from(
+ select W.wkshp_code,G.torg_name as wkshp_name,F.wo_code,M.partcode,M.partname,M.partspec,S.stepcode,S.stepname,F.style,P.plan_qty,F.repair_qty,F.laborbad_qty,F.materielbad_qty,F.defect_code,
+ defect_name = STUFF(( SELECT ',' + T.name
+ FROM TDefect as T
+ where PATINDEX('%,' + RTRIM(T.code) + ',%',',' + F.defect_code + ',')>0
+ ORDER BY PATINDEX('%,' + RTRIM(T.code) + ',%',',' + F.defect_code + ',')
+ FOR XML PATH('')), 1, 1,''),U.username as lm_user,F.lm_date
+ from CSR_WorkRecord_DefectHandle as F
+ inner join TK_Wrk_Step P on F.wo_code=P.wo_code and F.step_code=P.step_code
+ left join TK_Wrk_Man W on F.wo_code=W.wo_code
+ left join TOrganization G on W.wkshp_code=G.torg_code
+ left join TMateriel_Info M on F.partnumber=M.partcode
+ left join TStep S on F.step_code=S.stepcode
+ left join TUser U on F.lm_user=U.usercode
+ ) as AA
+ where " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "缁翠慨鏄庣粏鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[瀹夌伅鎶ヨ〃鏄庣粏]
+ public static ToMessage AnDonReportDefinitSearch(string wkshopcode, string calltypecode, string calluser, string callopendate, string callclosedate, string eqpcode, string eqpname, string responduser, string respondopendate, string respondclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (calltypecode != "" && calltypecode != null)
+ {
+ search += "and A.type=@calltypecode ";
+ dynamicParams.Add("@calltypecode", calltypecode);
+ }
+ if (calluser != "" && calluser != null)
+ {
+ search += "and A.start_user like '%'+@calluser+'%' ";
+ dynamicParams.Add("@calluser", calluser);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code like '%'+@eqpcode+'%' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (eqpname != "" && eqpname != null)
+ {
+ search += "and E.name like '%'+@eqpname+'%' ";
+ dynamicParams.Add("@eqpname", eqpname);
+ }
+ if (responduser != "" && responduser != null)
+ {
+ search += "and A.resp_user like '%'+@responduser+'%' ";
+ dynamicParams.Add("@responduser", responduser);
+ }
+ if (callopendate != "" && callopendate != null)
+ {
+ search += "and A.start_date between @callopendate and @callclosedate ";
+ dynamicParams.Add("@callopendate", callopendate + " 00:00:00");
+ dynamicParams.Add("@callclosedate", callclosedate + " 23:59:59");
+ }
+ if (respondopendate != "" && respondopendate != null)
+ {
+ search += "and A.resp_date between @respondopendate and @respondclosedate ";
+ dynamicParams.Add("@respondopendate", respondopendate + " 00:00:00");
+ dynamicParams.Add("@respondclosedate", respondclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name,Y.name as typename,
+ A.start_user,A.start_date,A.resp_user,A.resp_date,
+ CAST(CAST(datediff(second,A.start_date,A.resp_date) / (60*60*24) AS INT) AS VARCHAR) + '澶�'
+ + CAST(CAST(datediff(second,A.start_date,A.resp_date) % 86400 / 3600 AS INT) AS VARCHAR) + '灏忔椂'
+ + CAST(CAST(datediff(second,A.start_date,A.resp_date) % 3600 / 60 AS INT) AS VARCHAR) + '鍒�'
+ + CAST(CAST(datediff(second,A.start_date,A.resp_date) % 60 AS INT) AS VARCHAR) + '绉�' AS respondcont,
+ (case when A.resp_user is null then '寰呭搷搴�' else '宸插搷搴�' end) as status
+ from TAnDon_Task_Info A
+ left join TOrganization T on A.wkshp_code=T.torg_code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TAnDonType Y on A.type=Y.code
+ where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅鎶ヨ〃鏄庣粏瀵煎嚭]
+ public static ToMessage AnDonReportDefinitExcelSearch(string wkshopcode, string calltypecode, string calluser, string callopendate, string callclosedate, string eqpcode, string eqpname, string responduser, string respondopendate, string respondclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (calltypecode != "" && calltypecode != null)
+ {
+ search += "and A.type=@calltypecode ";
+ dynamicParams.Add("@calltypecode", calltypecode);
+ }
+ if (calluser != "" && calluser != null)
+ {
+ search += "and A.start_user like '%'+@calluser+'%' ";
+ dynamicParams.Add("@calluser", calluser);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code like '%'+@eqpcode+'%' ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (eqpname != "" && eqpname != null)
+ {
+ search += "and E.name like '%'+@eqpname+'%' ";
+ dynamicParams.Add("@eqpname", eqpname);
+ }
+ if (responduser != "" && responduser != null)
+ {
+ search += "and A.resp_user like '%'+@responduser+'%' ";
+ dynamicParams.Add("@responduser", responduser);
+ }
+ if (callopendate != "" && callopendate != null)
+ {
+ search += "and A.start_date between @callopendate and @callclosedate ";
+ dynamicParams.Add("@callopendate", callopendate + " 00:00:00");
+ dynamicParams.Add("@callclosedate", callclosedate + " 23:59:59");
+ }
+ if (respondopendate != "" && respondopendate != null)
+ {
+ search += "and A.resp_date between @respondopendate and @respondclosedate ";
+ dynamicParams.Add("@respondopendate", respondopendate + " 00:00:00");
+ dynamicParams.Add("@respondclosedate", respondclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.wkshp_code as 杞﹂棿缂栫爜,T.torg_name as 杞﹂棿鍚嶇О,A.eqp_code as 璁惧缂栫爜,E.name as 璁惧鍚嶇О,Y.name as 鍛煎彨绫诲瀷,
+ A.start_user as 鍛煎彨浜�,A.start_date as 鍛煎彨鏃堕棿,A.resp_user as 鍝嶅簲浜�,A.resp_date as 鍝嶅簲鏃堕棿,
+ CAST(CAST(datediff(second,A.start_date,A.resp_date) / (60*60*24) AS INT) AS VARCHAR) + '澶�'
+ + CAST(CAST(datediff(second,A.start_date,A.resp_date) % 86400 / 3600 AS INT) AS VARCHAR) + '灏忔椂'
+ + CAST(CAST(datediff(second,A.start_date,A.resp_date) % 3600 / 60 AS INT) AS VARCHAR) + '鍒�'
+ + CAST(CAST(datediff(second,A.start_date,A.resp_date) % 60 AS INT) AS VARCHAR) + '绉�' AS 鍝嶅簲鏃堕暱,
+ (case when A.resp_user is null then '寰呭搷搴�' else '宸插搷搴�' end) as 鐘舵��
+ from TAnDon_Task_Info A
+ left join TOrganization T on A.wkshp_code=T.torg_code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TAnDonType Y on A.type=Y.code
+ where 1=1 " + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "瀹夌伅鏄庣粏鎶ヨ〃");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[瀹夌伅鎶ヨ〃姹囨�籡
+ public static ToMessage AnDonReportSumSearch(string wkshopcode, string eqpcode, string calltypecode, string callopendate, string callclosedate, string respondopendate, string respondclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code=@eqpcode ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (calltypecode != "" && calltypecode != null)
+ {
+ search += "and A.type=@calltypecode ";
+ dynamicParams.Add("@calltypecode", calltypecode);
+ }
+ if (callopendate != "" && callopendate != null)
+ {
+ search += "and A.start_date between @callopendate and @callclosedate ";
+ dynamicParams.Add("@callopendate", callopendate + " 00:00:00");
+ dynamicParams.Add("@callclosedate", callclosedate + " 23:59:59");
+ }
+ if (respondopendate != "" && respondopendate != null)
+ {
+ search += "and A.resp_date between @respondopendate and @respondclosedate ";
+ dynamicParams.Add("@respondopendate", respondopendate + " 00:00:00");
+ dynamicParams.Add("@respondclosedate", respondclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select top 100 percent T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name,Y.name as calltypename,
+ (select count(*) callcount from TAnDon_Task_Info AA where AA.wkshp_code=A.wkshp_code and AA.type=A.type) as callcount,
+ (select count(*) repondcount from TAnDon_Task_Info BB where BB.wkshp_code=A.wkshp_code and BB.type=A.type and BB.status='CLOSED') as repondcount,
+ (select ISNULL(SUM(CAST(DATEDIFF(ss, CC.start_date,CC.resp_date)/60 as INT)),0) from TAnDon_Task_Info CC where CC.wkshp_code=A.wkshp_code and CC.eqp_code=A.eqp_code and CC.type=A.type) as repondtime
+ from TAnDon_Task_Info A
+ left join TOrganization T on A.wkshp_code=T.torg_code
+ left join TAnDonType Y on A.type=Y.code
+ left join TEqpInfo E on A.eqp_code=E.code
+ where 1=1 " + search + " group by A.wkshp_code,T.torg_name,A.type,Y.name,A.eqp_code,E.name order by T.torg_name,A.eqp_code ";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[瀹夌伅鎶ヨ〃姹囨�诲鍑篯
+ public static ToMessage AnDonReportSumExcelSearch(string wkshopcode, string eqpcode, string calltypecode, string callopendate, string callclosedate, string respondopendate, string respondclosedate)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (eqpcode != "" && eqpcode != null)
+ {
+ search += "and A.eqp_code=@eqpcode ";
+ dynamicParams.Add("@eqpcode", eqpcode);
+ }
+ if (calltypecode != "" && calltypecode != null)
+ {
+ search += "and A.type=@calltypecode ";
+ dynamicParams.Add("@calltypecode", calltypecode);
+ }
+ if (callopendate != "" && callopendate != null)
+ {
+ search += "and A.start_date between @callopendate and @callclosedate ";
+ dynamicParams.Add("@callopendate", callopendate + " 00:00:00");
+ dynamicParams.Add("@callclosedate", callclosedate + " 23:59:59");
+ }
+ if (respondopendate != "" && respondopendate != null)
+ {
+ search += "and A.resp_date between @respondopendate and @respondclosedate ";
+ dynamicParams.Add("@respondopendate", respondopendate + " 00:00:00");
+ dynamicParams.Add("@respondclosedate", respondclosedate + " 23:59:59");
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select top 100 percent T.torg_name as 鐢熶骇杞﹂棿,E.name as 璁惧鍚嶇О,Y.name as 鍛煎彨绫诲瀷,
+ (select count(*) callcount from TAnDon_Task_Info AA where AA.wkshp_code=A.wkshp_code and AA.eqp_code=A.eqp_code and AA.type=A.type) as 鎬诲懠鍙鏁�,
+ (select count(*) repondcount from TAnDon_Task_Info BB where BB.wkshp_code=A.wkshp_code and BB.eqp_code=A.eqp_code and BB.type=A.type and BB.status='CLOSED') as 鎬诲搷搴旀鏁�,
+ (select ISNULL(SUM(CAST(DATEDIFF(ss, CC.start_date,CC.resp_date)/60 as INT)),0) from TAnDon_Task_Info CC where CC.wkshp_code=A.wkshp_code and CC.eqp_code=A.eqp_code and CC.type=A.type) 鎬诲搷搴旀椂闀�
+ from TAnDon_Task_Info A
+ left join TOrganization T on A.wkshp_code=T.torg_code
+ left join TAnDonType Y on A.type=Y.code
+ left join TEqpInfo E on A.eqp_code=E.code
+ where 1=1 " + search + " group by A.wkshp_code,T.torg_name,A.type,Y.name,A.eqp_code,E.name order by T.torg_name,A.eqp_code ";
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ data.TableName = "Table"; //璁剧疆DataTable鐨勫悕绉�
+ string msg = DownLoad.DataTableToExcel(data, "瀹夌伅姹囨�绘姤琛�");
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = msg;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[T+鍏ュ簱璁板綍琛ㄥご]
+ public static ToMessage InStorageRecordMainSearch(string hbillno, string username, string hbdateopendate, string hbdateclosedate, string userdateopendate, string userdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (hbillno != "" && hbillno != null)
+ {
+ search += "and hbillno like '%'+@hbillno+'%' ";
+ dynamicParams.Add("@hbillno", hbillno);
+ }
+ if (username != "" && username != null)
+ {
+ search += "and create_user like '%'+@username+'%' ";
+ dynamicParams.Add("@username", username);
+ }
+ if (hbdateopendate != "" && hbdateopendate != null)
+ {
+ search += "and hbdate between @hbdateopendate and @hbdateclosedate ";
+ dynamicParams.Add("@hbdateopendate", hbdateopendate + " 00:00:00");
+ dynamicParams.Add("@hbdateclosedate", hbdateclosedate + " 23:59:59");
+ }
+ if (userdateopendate != "" && userdateopendate != null)
+ {
+ search += "and create_date between @userdateopendate and @userdateclosedate ";
+ dynamicParams.Add("@userdateopendate", userdateopendate + " 00:00:00");
+ dynamicParams.Add("@userdateclosedate", userdateclosedate + " 23:59:59");
+ }
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select (case when docu_typecode='69' then '浜ф垚鍝佸叆搴�' end) as hbilltype,hbillno,hbdate,create_user,create_date
+ from TK_WMS_Inwh_Main where 1=1 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[T+鍏ュ簱璁板綍琛ㄤ綋]
+ public static ToMessage InStorageRecordSubSearch(string hbillno)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ dynamicParams.Add("@hbillno", hbillno);
+ //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select S.hbillno,S.rownumber,S.inbarcode,S.mo_id,S.mo_no,E.sbid,S.wocode,R.step_code,T.stepname,E.materiel_id,S.partcode,M.partname,M.partspec,
+ E.unitid,S.unitcode,E.unitname,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,K.name as stockname,
+ S.qty,S.salecode,S.style
+ from TK_WMS_Inwh_Sub S
+ left join TKimp_Ewo E on S.mo_no=E.wo and S.mo_id=E.woid and S.partcode=E.materiel_code
+ left join TK_Wrk_Record R on S.inbarcode=R.inbarcode
+ left join TStep T on R.step_code=T.stepcode
+ left join TMateriel_Info M on S.partcode=M.partcode
+ left join TSecStck K on COALESCE(M.idwarehouse, E.stck_code)=K.code
+ where S.style='B' and S.hbillno=@hbillno
+ union all
+ select S.hbillno,S.rownumber,S.inbarcode,S.mo_id,S.mo_no,E.sbid,S.wocode,O.step_code,T.stepname,E.materiel_id,S.partcode,M.partname,M.partspec,
+ E.unitid,S.unitcode,E.unitname,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,K.name as stockname,
+ S.qty,S.salecode,S.style
+ from TK_WMS_Inwh_Sub S
+ left join TKimp_Ewo E on S.mo_no=E.wo and S.mo_id=E.woid and S.partcode=E.materiel_code
+ left join TK_Wrk_OutRecord O on S.inbarcode=O.inbarcode
+ left join TStep T on O.step_code=T.stepcode
+ left join TMateriel_Info M on S.partcode=M.partcode
+ left join TSecStck K on COALESCE(M.idwarehouse, E.stck_code)=K.code
+ where S.style='S' and S.hbillno=@hbillno
+ ) as AA" + search;
+ DataTable data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[T+鍏ュ簱璁板綍鍒犻櫎]
+ public static ToMessage DeleteInStorageRecord(DataTable dt, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_TCloudDeleteInProductOrder";
+ dynamicParams.Add("@RecordSub", dbType: DbType.Object, value: dt);
+ // 娣诲姞杈撳嚭鍙傛暟
+ dynamicParams.Add("@StatusCode", dbType: DbType.Int32, direction: ParameterDirection.Output);
+ dynamicParams.Add("@Message", dbType: DbType.String, size: 255, direction: ParameterDirection.Output);
+ bool a = DapperHelper.IsProcedure(sql, dynamicParams);
+ // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+ var statusCode = dynamicParams.Get<int>("@StatusCode");
+ var message = dynamicParams.Get<string>("@Message");
+ if (a)
+ {
+ mes.code = statusCode.ToString();
+ mes.count = 0;
+ mes.message = message;
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = statusCode.ToString();
+ mes.count = 0;
+ mes.message = message;
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/SopManageMentDAL.cs b/VueWebCoreApi/DLL/DAL/SopManageMentDAL.cs
new file mode 100644
index 0000000..f2233ab
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/SopManageMentDAL.cs
@@ -0,0 +1,682 @@
+锘縰sing Dapper;
+using Microsoft.AspNetCore.Http;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class SopManageMentDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+ #region[绯荤粺璁剧疆,璁惧SOP鏌ヨ]
+ public static ToMessage DeviceSopSearch(string search, string check, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sech = "";
+ try
+ {
+ if (search != "" && search != null)
+ {
+ sech += "and concat(isnull(AA.eqptypecode,''),isnull(AA.eqptypename,''),isnull(AA.eqpcode,''),isnull(AA.eqpname,''),isnull(AA.filetypecode,''),isnull(AA.filetypename,''),isnull(AA.filename,''),isnull(AA.version,''),isnull(AA.username,'')) like '%'+@search+'%' ";
+ dynamicParams.Add("@search", search);
+ }
+ if (check == "Y")
+ {
+ sech += "and AA.rn=1 ";
+ dynamicParams.Add("@rn", 1);
+ }
+
+ if (sech == "")
+ {
+ sech = "and 1=1 ";
+ }
+ sech = sech.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select AA.id,AA.eqptypecode,AA.eqptypename,AA.eqpcode,AA.eqpname,AA.filetypecode,AA.filetypename,AA.filename,AA.version,AA.filepath,
+ AA.username,AA.lm_date,AA.rn from(
+ select top 100 A.id,A.eqptypecode,T.name as eqptypename,A.eqpcode,E.name as eqpname,A.filetypecode,
+ (case when A.filetypecode='P001' then '浣滀笟鎸囧涔�' when A.filetypecode='P002' then '妫�楠屾寚瀵间功' when A.filetypecode='P003' then '鍥剧焊' end) as filetypename,
+ A.filename,A.version,A.filepath,U.username,A.lm_date,
+ row_number() over(partition by A.eqptypecode,A.eqpcode,A.filetypecode order by replace(A.version,'V','') desc) rn
+ from TDeviceSop A
+ left join TEqpInfo E on A.eqpcode=E.code
+ left join TEqpType T on E.eqptype_code=T.code
+ left join TUser U on A.lm_user=U.usercode
+ ) as AA where " + sech + "";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,璁惧SOP鏂板]
+ public static ToMessage DeviceSopAddSeave(string eqptypecode, string device, string filename, string filetypecode, IFormFile file, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ if (file == null || file.Length <= 0)
+ {
+ mes.code = "300";
+ mes.message = "鏂囦欢涓嶈兘涓虹┖锛�";
+ }
+ else
+ {
+ //鑾峰彇涓婁紶鏂囦欢,缁勫悎瀛樺偍璺緞
+ string FileName = "SOP" + DateTime.Now.ToString("yyyyMMddhhmmss");
+ string filePath = "wwwroot/DeviceSopFile/" + FileName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻枃浠跺湴鍧�)
+ string filePath1 = "DeviceSopFile/" + FileName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻暟鎹〃鍦板潃)
+
+ // 淇濆瓨鏂囦欢var stream = new FileStream(filePath, FileMode.Create)
+ using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ file.CopyTo(stream);
+ }
+
+ //鑾峰彇璁惧闆嗗悎
+ string[] devicecode = Array.ConvertAll<string, string>(device.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ for (int i = 0; i < devicecode.Length; i++)
+ {
+ string version = "";
+ //鏌ヨ褰撳墠璁惧鏄惁瀛樺湪鍚屾枃浠剁被鍨嬬殑SOP鏂囦欢,瀛樺湪灏卞鍔犵増鏈彿
+ sql = @"select isnull(max(substring(version,charindex('V',version)+1,len(version)-charindex('V',version))),0)+1 as version
+ from TDeviceSop
+ where eqptypecode=@eqptypecode and eqpcode=@eqpcode and filetypecode=@filetypecode";
+ dynamicParams.Add("@eqptypecode", eqptypecode);
+ dynamicParams.Add("@eqpcode", devicecode[i].ToString());
+ dynamicParams.Add("@filetypecode", filetypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ version = "V" + data.Rows[0]["version"].ToString();
+ }
+ else
+ {
+ version = "V1";
+ }
+ //鍐欏叆璁惧SOP琛�
+ sql = @"insert into TDeviceSop(eqptypecode,eqpcode,filename,filetypecode,filepath,version,lm_user,lm_date)
+ values(@eqptypecode,@eqpcode,@filename,@filetypecode,@filepath,@version,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ eqptypecode = eqptypecode,
+ eqpcode = devicecode[i].ToString(),
+ filename = file.FileName,
+ filetypecode = filetypecode,
+ filepath = filePath1,
+ version = version,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板璁惧SOP", "SOP鏂囦欢:" + file.FileName + "璁惧:" + device.ToString(), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板璁惧SOP鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板璁惧SOP澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,璁惧SOP鍒犻櫎]
+ public static ToMessage DeviceSopDeleteSeave(string id, string eqpcode, string filepath, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ //鏌ヨ褰撳墠鏂囦欢鍑哄幓褰撳墠鍒犻櫎鐨�,鏄惁杩樿鍏朵粬寮曠敤
+ sql = @"select * from TDeviceSop where id<>@id and filepath=@filepath";
+ dynamicParams.Add("@id", id);
+ dynamicParams.Add("@filepath", filepath);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ // 鏋勫缓瀹屾暣鐨勬枃浠惰矾寰�
+ var filePath = Path.Combine("wwwroot", filepath);
+ // 鍒犻櫎鏂囦欢
+ System.IO.File.Delete(filePath);
+ }
+ sql = @"delete TDeviceSop where id=@id";
+ list.Add(new { str = sql, parm = new { id = id } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎璁惧SOP", "璁惧:" + eqpcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鏌ヨ]
+ public static ToMessage ProcessSopSearch(string search, string check, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sech = "";
+ try
+ {
+ if (search != "" && search != null)
+ {
+ sech += "and concat(isnull(AA.materielcode,''),isnull(AA.materielname,''),isnull(AA.routecode,''),isnull(AA.routename,''),isnull(AA.stepcode,''),isnull(AA.stepname,''),isnull(AA.filetypecode,''),isnull(AA.filetypename,''),isnull(AA.filename,''),isnull(AA.version,''),isnull(AA.username,'')) like '%'+@search+'%' ";
+ dynamicParams.Add("@search", search);
+ }
+ if (check == "Y")
+ {
+ sech += "and AA.rn=1 ";
+ dynamicParams.Add("@rn", 1);
+ }
+
+ if (sech == "")
+ {
+ sech = "and 1=1 ";
+ }
+ sech = sech.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select AA.id,AA.materielcode,AA.materielname,AA.routecode,AA.routename,AA.stepcode,AA.stepname,AA.filetypecode,AA.filetypename,AA.filename,AA.version,AA.filepath,
+ AA.username,AA.lm_date,AA.rn from(
+ select top 100 A.id,A.materielcode,M.partname as materielname,A.routecode,R.name as routename,A.stepcode,S.stepname,A.filetypecode,
+ (case when A.filetypecode='P001' then '浣滀笟鎸囧涔�' when A.filetypecode='P002' then '妫�楠屾寚瀵间功' when A.filetypecode='P003' then '鍥剧焊' end) as filetypename,
+ A.filename,A.version,A.filepath,U.username,A.lm_date,
+ row_number() over(partition by A.materielcode,A.routecode,A.stepcode,A.filetypecode order by replace(A.version,'V','') desc) rn
+ from TProcessSop A
+ left join TMateriel_Info M on A.materielcode=M.partcode
+ left join TFlw_Rout R on A.routecode=R.code
+ left join TStep S on A.stepcode=S.stepcode
+ left join TUser U on A.lm_user=U.usercode
+ ) as AA where " + sech + "";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP涓婁紶鑾峰彇鏈�澶х増鏈彿]
+ public static ToMessage ProcessSopMaxVersion(string partcode, string routecode, string stepcode, string filetypecode, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ string sech = "";
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //鎸夊伐鑹鸿矾绾挎ā寮�
+ {
+ sech += " and routecode=@routecode and stepcode=@stepcode";
+ dynamicParams.Add("@routecode", routecode);
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ else //宸ュ簭妯″紡
+ {
+ sech += " and stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ //鑾峰彇SOP鏂囦欢浣滀笟鏂囦欢涓婁紶鑾峰彇鏈�澶х増鏈彿
+ sql = @"select isnull(max(substring(version,charindex('V',version)+1,len(version)-charindex('V',version))),0)+1 as file_version
+ from TProcessSop where materielcode=@materielcode and filetypecode=@filetypecode "+sech;
+ dynamicParams.Add("@materielcode", partcode);
+ dynamicParams.Add("@filetypecode", filetypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鑾峰彇鐗堟湰鍙锋垚鍔�!";
+ mes.data = "V" + data.Rows[0]["file_version"].ToString();
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鑾峰彇鐗堟湰鍙峰け璐�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鏂板]
+ public static ToMessage ProcessSopAddSeave(string partcode, string routecode, string stepcode, string filename, string filetypecode, string version, IFormFile file, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ if (file == null || file.Length <= 0)
+ {
+ mes.code = "300";
+ mes.message = "鏂囦欢涓嶈兘涓虹┖锛�";
+ }
+ else
+ {
+ //鑾峰彇涓婁紶鏂囦欢,缁勫悎瀛樺偍璺緞
+ string FileName = "SOP" + DateTime.Now.ToString("yyyyMMddhhmmss");
+ string filePath = "wwwroot/ProcessSopFile/" + FileName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻枃浠跺湴鍧�)
+ string filePath1 = "ProcessSopFile/" + FileName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻暟鎹〃鍦板潃)
+
+ // 淇濆瓨鏂囦欢var stream = new FileStream(filePath, FileMode.Create)
+ using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ file.CopyTo(stream);
+ }
+ //鍐欏叆璁惧SOP琛�
+ sql = @"insert into TProcessSop(materielcode,routecode,stepcode,filetypecode,filename,filepath,version,lm_user,lm_date)
+ values(@materielcode,@routecode,@stepcode,@filetypecode,@filename,@filepath,@version,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ materielcode = partcode,
+ routecode = routecode,
+ stepcode = stepcode,
+ filetypecode = filetypecode,
+ filename = file.FileName,
+ filepath = filePath1,
+ version = version,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板宸ヨ壓SOP", "浜у搧锛�"+partcode+" SOP鏂囦欢:" + file.FileName + " 宸ヨ壓璺嚎:" + routecode ?? "" + " 宸ュ簭:" + stepcode.ToString(), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板宸ヨ壓SOP鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板宸ヨ壓SOP澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ヨ壓SOP鍒犻櫎]
+ public static ToMessage ProcessSopDeleteSeave(string id, string partcode, string routecode, string stepcode, string filepath, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ //鏌ヨ褰撳墠鏂囦欢鍑哄幓褰撳墠鍒犻櫎鐨�,鏄惁杩樿鍏朵粬寮曠敤
+ sql = @"select * from TProcessSop where id<>@id and filepath=@filepath";
+ dynamicParams.Add("@id", id);
+ dynamicParams.Add("@filepath", filepath);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ // 鏋勫缓瀹屾暣鐨勬枃浠惰矾寰�
+ var filePath = Path.Combine("wwwroot", filepath);
+ // 鍒犻櫎鏂囦欢
+ System.IO.File.Delete(filePath);
+ }
+ sql = @"delete TProcessSop where id=@id";
+ list.Add(new { str = sql, parm = new { id = id } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎宸ヨ壓SOP", "浜у搧:" + partcode+" SOP鏂囦欢鍦板潃锛�"+filepath+" 宸ヨ壓璺嚎:"+ routecode ?? "" + " 宸ュ簭:"+stepcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鏌ヨ]
+ public static ToMessage WrkOrderSearch(string search, string check, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string sech = "";
+ try
+ {
+ if (search != "" && search != null)
+ {
+ sech += "and concat(isnull(AA.wo,''),isnull(AA.materielcode,''),isnull(AA.materielname,''),isnull(AA.filetypecode,''),isnull(AA.filetypename,''),isnull(AA.filename,''),isnull(AA.version,''),isnull(AA.username,'')) like '%'+@search+'%' ";
+ dynamicParams.Add("@search", search);
+ }
+ if (check == "Y")
+ {
+ sech += "and AA.rn=1 ";
+ dynamicParams.Add("@rn", 1);
+ }
+
+ if (sech == "")
+ {
+ sech = "and 1=1 ";
+ }
+ sech = sech.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select AA.id,AA.wo,AA.materielcode,AA.materielname,AA.filetypecode,AA.filetypename,AA.filename,AA.version,AA.filepath,
+ AA.username,AA.lm_date,AA.rn from(
+ select top 100 A.id,A.wo,A.materielcode,M.partname as materielname,A.filetypecode,
+ (case when A.filetypecode='P001' then '浣滀笟鎸囧涔�' when A.filetypecode='P002' then '妫�楠屾寚瀵间功' when A.filetypecode='P003' then '鍥剧焊' end) as filetypename,
+ A.filename,A.version,A.filepath,U.username,A.lm_date,
+ row_number() over(partition by A.wo,A.materielcode,A.filetypecode order by replace(A.version,'V','') desc) rn
+ from TWrkOrderSop A
+ left join TMateriel_Info M on A.materielcode=M.partcode
+ left join TUser U on A.lm_user=U.usercode
+ ) as AA where " + sech + "";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP涓婁紶鑾峰彇鏈�澶х増鏈彿]
+ public static ToMessage WrkOrderSopMaxVersion(string wocode, string partcode, string filetypecode, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇SOP鏂囦欢浣滀笟鏂囦欢涓婁紶鑾峰彇鏈�澶х増鏈彿
+ sql = @"select isnull(max(substring(version,charindex('V',version)+1,len(version)-charindex('V',version))),0)+1 as file_version
+ from TWrkOrderSop where wo=@wo and materielcode=@materielcode and filetypecode=@filetypecode ";
+ dynamicParams.Add("@wo", wocode);
+ dynamicParams.Add("@materielcode", partcode);
+ dynamicParams.Add("@filetypecode", filetypecode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鑾峰彇鐗堟湰鍙锋垚鍔�!";
+ mes.data = "V" + data.Rows[0]["file_version"].ToString();
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "鑾峰彇鐗堟湰鍙峰け璐�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鏂板]
+ public static ToMessage WrkOrderSopAddSeave(string wocode, string partcode, string filename, string filetypecode, string version, IFormFile file, User us)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ if (file == null || file.Length <= 0)
+ {
+ mes.code = "300";
+ mes.message = "鏂囦欢涓嶈兘涓虹┖锛�";
+ }
+ else
+ {
+ //鑾峰彇涓婁紶鏂囦欢,缁勫悎瀛樺偍璺緞
+ string FileName = "SOP" + DateTime.Now.ToString("yyyyMMddhhmmss");
+ string filePath = "wwwroot/WrkOrderSopFile/" + FileName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻枃浠跺湴鍧�)
+ string filePath1 = "WrkOrderSopFile/" + FileName + file.FileName; //閫氳繃姝ゅ璞¤幏鍙栨枃浠跺悕(瀛樻暟鎹〃鍦板潃)
+
+ // 淇濆瓨鏂囦欢var stream = new FileStream(filePath, FileMode.Create)
+ using (var stream = new FileStream(filePath, FileMode.Create))
+ {
+ file.CopyTo(stream);
+ }
+ //鍐欏叆璁惧SOP琛�
+ sql = @"insert into TWrkOrderSop(wo,materielcode,filetypecode,filename,filepath,version,lm_user,lm_date)
+ values(@wo,@materielcode,@filetypecode,@filename,@filepath,@version,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo=wocode,
+ materielcode = partcode,
+ filetypecode = filetypecode,
+ filename = file.FileName,
+ filepath = filePath1,
+ version = version,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板宸ュ崟SOP", "宸ュ崟锛�" + wocode + "浜у搧锛�" + partcode + " SOP鏂囦欢:" + file.FileName, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏂板宸ュ崟SOP鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏂板宸ュ崟SOP澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[绯荤粺璁剧疆,宸ュ崟SOP鍒犻櫎]
+ public static ToMessage WrkOrderSopDeleteSeave(string id, string wocode, string partcode, string filepath, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ //鏌ヨ褰撳墠鏂囦欢鍑哄幓褰撳墠鍒犻櫎鐨�,鏄惁杩樿鍏朵粬寮曠敤
+ sql = @"select * from TWrkOrderSop where id<>@id and filepath=@filepath";
+ dynamicParams.Add("@id", id);
+ dynamicParams.Add("@filepath", filepath);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ // 鏋勫缓瀹屾暣鐨勬枃浠惰矾寰�
+ var filePath = Path.Combine("wwwroot", filepath);
+ // 鍒犻櫎鏂囦欢
+ System.IO.File.Delete(filePath);
+ }
+ sql = @"delete TWrkOrderSop where id=@id";
+ list.Add(new { str = sql, parm = new { id = id } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎宸ヨ壓SOP", "宸ュ崟:" + wocode + "浜у搧:" + partcode + " SOP鏂囦欢鍦板潃锛�" + filepath, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/SystemSettingDAL.cs b/VueWebCoreApi/DLL/DAL/SystemSettingDAL.cs
new file mode 100644
index 0000000..44eb014
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/SystemSettingDAL.cs
@@ -0,0 +1,427 @@
+锘縰sing Dapper;
+using Microsoft.AspNetCore.Http;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class SystemSettingDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+ #region[缂栫爜瑙勫垯鑾峰彇鍙缃殑鍔熻兘鑿滃崟淇℃伅]
+ public static ToMessage CodeMenuSelect()
+ {
+ string sql = "";
+ try
+ {
+ sql = @"with RecursiveCTE as (
+ select menucode, parent_id,menuname,menu_seq,Type
+ from TMenu
+ where is_codeview = 'Y'
+ union ALL
+ select e.menucode, e.parent_id, e.menuname,e.menu_seq,e.Type
+ from TMenu e
+ inner join RecursiveCTE r ON e.menucode = r.parent_id
+ )
+ select distinct menucode, parent_id, menuname,Type,menu_seq
+ from RecursiveCTE order by menucode, parent_id,Type,menu_seq";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犲彲璁剧疆鍔熻兘瑙勫垯!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯鏌ヨ]
+ public static ToMessage EncodingRules(string rightname, string prefix, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (rightname != "" && rightname != null)
+ {
+ search += "and A.menuname like '%'+@rightname+'%' ";
+ dynamicParams.Add("@rightname", rightname);
+ }
+ if (prefix != "" && prefix != null)
+ {
+ search += "and A.prefix like '%'+@prefix+'%' ";
+ dynamicParams.Add("@prefix", prefix);
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.menucode,A.menuname,A.prefix,A.filingdate,A.incbit,A.value,A.Type,U.usercode,U.username,A.lm_date
+ from TCodeRules A
+ left join TUser U on A.lm_user=U.usercode
+ where " + search + "";
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯缂栬緫淇濆瓨]
+ public static ToMessage SaveEncodingRules(string rightcode, string rightname, string prefix, string filingdate, string incbit, string type, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select menucode,value from TCodeRules where menucode=@rightcode and Type=@type";
+ dynamicParams.Add("@rightcode", rightcode);
+ dynamicParams.Add("@type", type);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ string value = data.Rows[0]["value"].ToString();
+ if (decimal.Parse(incbit) > value.Length)
+ {
+ decimal cnum = decimal.Parse(incbit) - value.Length;
+ for (int i = 0; i < cnum; i++)
+ {
+ value = "0" + value;
+ }
+ }
+ sql = @"update TCodeRules set prefix=@prefix,filingdate=@filingdate,incbit=@incbit,value=@value,lm_user=@lm_user,lm_date=@CreateDate where menucode=@menucode";
+ dynamicParams.Add("@prefix", prefix);
+ dynamicParams.Add("@filingdate", filingdate);
+ dynamicParams.Add("@incbit", incbit);
+ dynamicParams.Add("@value", value);
+ dynamicParams.Add("@lm_user", us.usercode);
+ dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
+ dynamicParams.Add("@menucode", rightcode);
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗙紪鐮佽鍒�", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ else
+ {
+ //棣栨鍐欏叆鍓嶆寜浣嶆暟琛ュ厖0
+ string value = "";
+ for (int i = 0; i < int.Parse(incbit); i++)
+ {
+ value = value + "0";
+ }
+ //鍐欏叆瑙勫垯琛�
+ sql = @"insert into TCodeRules(menucode,menuname,prefix,filingdate,incbit,value,lm_user,lm_date,Type)
+ values(@menucode,@menuname,@prefix,@filingdate,@incbit,@value,@lm_user,@lm_date,@type)";
+ dynamicParams.Add("@menucode", rightcode);
+ dynamicParams.Add("@menuname", rightname);
+ dynamicParams.Add("@prefix", prefix);
+ dynamicParams.Add("@filingdate", filingdate);
+ dynamicParams.Add("@incbit", incbit);
+ dynamicParams.Add("@value", value);
+ dynamicParams.Add("@lm_user", us.usercode);
+ dynamicParams.Add("@lm_date", DateTime.Now.ToString());
+ dynamicParams.Add("@type", type);
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗙紪鐮佽鍒�", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[缂栫爜瑙勫垯鍒犻櫎]
+ public static ToMessage DeleteEncodingRules(string menucode, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"delete TCodeRules where menucode=@menucode";
+ dynamicParams.Add("@menucode", menucode);
+ int cont = DapperHelper.SQL(sql, dynamicParams);
+ if (cont > 0)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗙紪鐮佽鍒�", us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�(姣忔鑾峰彇鏈�鏂�)]
+ public static ToMessage NewEncodingRules(string rightcode)
+ {
+ mes = SeachEncode.EncodingSeach(rightcode);
+ return mes;
+ }
+ #endregion
+
+ #region[鑾峰彇瑙勫垯鐢熸垚鐨勭紪鐮�(鍙湁浣跨敤鎵嶈幏鍙栨渶鏂�)]
+ public static ToMessage OnlyEncodingRules(string rightcode)
+ {
+ mes = SeachEncodeJob.EncodingSeach(rightcode);
+ return mes;
+ }
+ #endregion
+
+ #region[鍥炲啓瑙勫垯鐢熸垚鐨勭紪鐮�(浣跨敤淇濆瓨)]
+ public static ToMessage SaveOnlyEncodingRules(string rightcode, string incbit)
+ {
+ List<object> list = SeachEncodeJob.StrEncodingUpdate(rightcode, incbit);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熸垚鐗╂枡鏍囩鏉$爜(姣忔鑾峰彇鏈�鏂�,App鍙娇鐢�)]
+ public static ToMessage LabelBarCode(string rightcode, string partcode, string qty, string onelabqty)
+ {
+ mes = AppLableBarCode.EncodingSeach(rightcode, partcode, qty, onelabqty);
+ return mes;
+ }
+ #endregion
+
+ #region[App鐗堟湰鍗囩骇鎺ュ彛]
+ public static ToMessage AppUpgrade(string rid, string vision)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ List<AppVersion> obj = new List<AppVersion>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ sql = @"select * from TSystemAppUser where rid=@rid and appvesion=@vision";
+ dynamicParams.Add("@rid", rid);
+ dynamicParams.Add("@vision", vision);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0) //涓嶅瓨鍦�
+ {
+ //鍐欏叆鏈増鐢ㄦ埛鍏宠仈琛�
+ sql = @"insert into TSystemAppUser(rid,appvesion,lm_date)
+ values(@rid,@appvesion,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ rid = rid,
+ appvesion = vision,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ list.Clear();
+ }
+ //鏌ヨ鎺у埗鍗囩骇琛ㄧ増鏈暟鎹�
+ sql = @"select * from TSystemApp";
+ var data1 = DapperHelper.selecttable(sql);
+ AppVersion vn = new AppVersion();
+ vn.path = data1.Rows[0]["path"].ToString();
+ vn.version = data1.Rows[0]["version"].ToString();
+ vn.dispyversion = vision;
+ vn.activeversion = data1.Rows[0]["activeversion"].ToString();
+ vn.mustupgrade = data1.Rows[0]["mustupgrade"].ToString();
+ list.Add(vn);
+
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[绯荤粺璁剧疆,娴佺▼璁剧疆鎻愪氦]
+ public static ToMessage SaveSystemProcConfig(JObject systemjson, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ list.Clear();
+ sql = @"select * from TSystemProcConfig";
+ var data = DapperHelper.selecttable(sql);
+ if (data.Rows.Count <= 0) //涓嶅瓨鍦�
+ {
+ sql = @"insert into TSystemProcConfig(json,lm_user,lm_date)
+ values(@json,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ json = systemjson.ToString(Newtonsoft.Json.Formatting.None),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ else
+ {
+ sql = @"update TSystemProcConfig set json=@json,lm_user=@lm_user,lm_date=@lm_date";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ json = systemjson.ToString(Newtonsoft.Json.Formatting.None),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "绯荤粺娴佺▼璁剧疆", "娴佺▼璁剧疆json:" + systemjson.ToString(), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "娴佺▼璁剧疆鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "娴佺▼璁剧疆澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs b/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
new file mode 100644
index 0000000..7800cc4
--- /dev/null
+++ b/VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
@@ -0,0 +1,4687 @@
+锘縰sing Dapper;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text.Json;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Models.ErpOrder;
+using VueWebCoreApi.Models.InventoryModel;
+using VueWebCoreApi.Models.ReportVerify;
+using VueWebCoreApi.Models.UpdateReport;
+using VueWebCoreApi.Models.WorkData;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.DLL.DAL
+{
+ public class WorkOrderDAL
+ {
+ public static DataTable dt; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+ public static bool res; //瀹氫箟鍏ㄥ眬鍙橀噺dt
+
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
+ public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
+ public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
+
+
+ #region[ERP璁㈠崟鏌ヨ]
+ public static ToMessage ErpOrderSearch(string erporderstus, string wkshopcode, string erpordercode, string saleordercode, string partcode, string partname, string partspec, int startNum, string datatype, string paydatestartdate, string paydateenddate, string creatuser, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (erporderstus != "" && erporderstus != null)
+ {
+ search += "and A.status=@erporderstus ";
+ dynamicParams.Add("@erporderstus", erporderstus);
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (erpordercode != "" && erpordercode != null)
+ {
+ search += "and A.wo like '%'+@erpordercode+'%' ";
+ dynamicParams.Add("@erpordercode", erpordercode);
+ }
+ if (saleordercode != "" && saleordercode != null)
+ {
+ search += "and A.saleOrderCode like '%'+@saleordercode+'%' ";
+ dynamicParams.Add("@saleordercode", saleordercode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and B.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (paydatestartdate != "" && paydatestartdate != null)
+ {
+ switch (datatype)
+ {
+ case "PS":
+ search += "and A.planstartdate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ break;
+ case "PE":
+ search += "and A.planenddate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ break;
+ case "ED":
+ search += "and A.saleOrderDeliveryDate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ break;
+ default:
+ break;
+ }
+ }
+ if (creatuser != "" && creatuser != null)
+ {
+ search += "and U.username like '%'+@creatuser+'%' ";
+ dynamicParams.Add("@creatuser", creatuser);
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id, A.status,A.wo,A.materiel_code as partcode,B.partname,B.partspec,A.qty,A.relse_qty,A.wkshp_code,C.torg_name as wkshp_name,
+ A.stck_code,D.name as stck_name,A.saleOrderCode,A.saleOrderDeliveryDate,A.planstartdate,A.planenddate,U.username as createuser,A.createdate,A.sbid,A.clerkuser,
+ B.priuserdefnvc1,B.priuserdefnvc2,B.priuserdefnvc3,B.priuserdefnvc4,B.priuserdefnvc5,B.priuserdefnvc6
+ from TKimp_Ewo A
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TOrganization C on A.wkshp_code=C.torg_code
+ left join TSecStck D on A.stck_code=D.code
+ left join TUser U on A.createuser=U.usercode
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[ERP璁㈠崟涓嬭揪]
+ public static ToMessage MarkSaveErpOrder(string erporderid, string sbid, string erpordercode, string saleordercode, string partcode, string wkshopcode, string warehousecode, string erpqty, string markqty, string ordernum, string relse_qty, string saleOrderDeliveryDate, string paystartdate, string payenddate, string clerkuser, User us)
+ {
+ var sql = "";
+ string orderstatus = "", isstep = ""; //宸ュ崟鐘舵�併�佹槸鍚︾粦瀹氬伐鑹�
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ DataTable data0 = new DataTable();
+ try
+ {
+ list.Clear();
+ //鑾峰彇token涓祦绋嬮厤缃俊鎭�
+ JObject jsonObj = JObject.Parse(us.mesSetting);
+ var isroute = (string)jsonObj["route"].ToString().ToLower();// 鑾峰彇route閿殑鍊�
+ //鍒ゆ柇褰撳墠宸ヨ壓娴佺▼
+ if (isroute == "true")
+ {
+ //鑾峰彇褰撳墠鐗╂枡鐨勫伐鑹鸿矾绾垮伐鑹轰俊鎭�
+ sql = @"select M.default_route,T.seq,T.step_code,T.first_choke,T.last_choke,S.unprice
+ from TMateriel_Info M
+ inner join TFlw_Rtdt T on M.default_route=T.rout_code
+ left join TPrteEqp_Stad S on M.partcode=S.materiel_code and M.default_route=S.route_code and T.step_code=S.step_code
+ where partcode=@partcode";
+ dynamicParams.Add("@partcode", partcode);
+ data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ orderstatus = "ALLO";
+ isstep = "Y";
+ }
+ else
+ {
+ orderstatus = "NEW";
+ isstep = "N";
+ }
+ }
+ else
+ {
+ //鑾峰彇褰撳墠鐗╂枡鐨勫伐搴忓伐鑹轰俊鎭�
+ sql = @"select M.default_route,T.step_seq as seq,T.step_code,T.isbott as first_choke,T.isend as last_choke,S.unprice
+ from TMateriel_Info M
+ inner join TMateriel_Step T on M.partcode=T.materiel_code
+ left join TPrteEqp_Stad S on M.partcode=S.materiel_code and T.step_code=S.step_code
+ where partcode=@partcode";
+ dynamicParams.Add("@partcode", partcode);
+ data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ orderstatus = "ALLO";
+ isstep = "Y";
+ }
+ else
+ {
+ orderstatus = "NEW";
+ isstep = "N";
+ }
+ }
+
+ //鑾峰彇鎷嗗崟鏁伴噺:鍚戜笅鍙栨暣
+ decimal cdqty = Math.Floor(decimal.Parse(markqty) / decimal.Parse(ordernum));
+ //瀹氫箟绱涓嬪崟鏁伴噺
+ decimal sumqty = 0;
+ //瀹氫箟鏈�鏂扮敓鎴愮殑宸ュ崟鍙�
+ string wo = "";
+ //瀹氫箟宸ュ崟娴佹按鍙�
+ int num = 0;
+ //寰幆涓嬪崟鍗曟暟(鐢熸垚瀵瑰簲鍑犲紶MES宸ュ崟)
+ for (int i = 1; i <= Convert.ToInt32(ordernum); i++)
+ {
+ sumqty += cdqty;
+ //鑾峰彇鏈�澶у崟鎹彿
+ if (i == 1) //棣栧崟鑾峰彇宸ュ崟鍙�
+ {
+ sql = @"select isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0)+1 as worknumb
+ from TK_Wrk_Man where m_po=@erpordercode";
+ dynamicParams.Add("@erpordercode", erpordercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ num = Convert.ToInt32(data.Rows[0]["WORKNUMB"].ToString());
+ wo = erpordercode + "_" + num;
+ }
+ else
+ {
+ num = num + 1;
+ wo = erpordercode + "_" + num;
+ }
+ if (i == Convert.ToInt32(ordernum)) //鏈�鍚庝竴鍗曟椂
+ {
+ //鍐欏叆宸ュ崟琛�
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,route_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,plan_startdate,plan_enddate,data_sources,isstep,clerkuser)
+ values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@route_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@data_sources,@isstep,@clerkuser)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wo,
+ wotype = "PO",
+ status = orderstatus, //"NEW"
+ wkshp_code = wkshopcode,
+ plan_qty = cdqty + (decimal.Parse(markqty) - sumqty), //鏈崟涓嬪崟鏁伴噺=鍒囧垎鏁伴噺+(涓嬪崟鏁伴噺-绱鍒囧垎涓嬪崟鏁伴噺)
+ stck_code = warehousecode,
+ sbid = sbid,
+ materiel_code = partcode,
+ route_code = data0.Rows.Count <= 0 ? "" : data0.Rows[0]["default_route"].ToString(),
+ sourceid = erporderid,
+ m_po = erpordercode,
+ username = us.usercode,
+ CreateDate = DateTime.Now.ToString(),
+ saleOrderCode = saleordercode,
+ saleOrderDeliveryDate = Convert.ToDateTime(saleOrderDeliveryDate),
+ plan_startdate = Convert.ToDateTime(paystartdate),
+ plan_enddate = Convert.ToDateTime(payenddate),
+ data_sources = "ERP",
+ isstep = isstep, //鏄惁鍏宠仈宸ュ簭 "N"
+ clerkuser = clerkuser //閿�鍞鍗曚笟鍔″憳
+ }
+ });
+ //鍒ゆ柇鏄惁鍐欏叆宸ュ崟宸ュ簭琛�(褰撳墠宸ュ崟鐗╂枡鏄惁鎸囧畾浜嗗伐鑹�)
+ if (orderstatus == "ALLO" && isstep == "Y")
+ {
+ //鍐欏叆宸ュ崟宸ュ簭琛�
+ for (int j = 0; j < data0.Rows.Count; j++)
+ {
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,route_code,stepprice,plan_quantity,plan_qty,ratio,status,isbott,isend,lm_user,lm_date)
+ values(@wo_code,@seq,@step_code,@route_code,@stepprice,@plan_quantity,@plan_qty,@ratio,@status,@isbott,@isend,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wo,
+ seq = data0.Rows[j]["seq"].ToString(),
+ step_code = data0.Rows[j]["step_code"].ToString(),
+ route_code = data0.Rows[j]["default_route"].ToString(),
+ stepprice = decimal.Parse(data0.Rows[j]["unprice"].ToString() == "" || data0.Rows[j]["unprice"].ToString() == null ? "0" : data0.Rows[j]["unprice"].ToString()),
+ plan_quantity = cdqty + (decimal.Parse(markqty) - sumqty), //鏈崟涓嬪崟鏁伴噺=鍒囧垎鏁伴噺+(涓嬪崟鏁伴噺-绱鍒囧垎涓嬪崟鏁伴噺),
+ plan_qty = cdqty + (decimal.Parse(markqty) - sumqty), //鏈崟涓嬪崟鏁伴噺=鍒囧垎鏁伴噺+(涓嬪崟鏁伴噺-绱鍒囧垎涓嬪崟鏁伴噺),
+ ratio = 0,
+ status = orderstatus,
+ isbott = data0.Rows[j]["first_choke"].ToString(),
+ isend = data0.Rows[j]["last_choke"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ }
+ sumqty = sumqty + (decimal.Parse(markqty) - sumqty);
+ }
+ else
+ {
+
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,route_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,plan_startdate,plan_enddate,data_sources,isstep,clerkuser)
+ values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@route_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@data_sources,@isstep,@clerkuser)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wo,
+ wotype = "PO",
+ status = orderstatus, //"NEW"
+ wkshp_code = wkshopcode,
+ plan_qty = cdqty,
+ stck_code = warehousecode,
+ sbid = sbid,
+ materiel_code = partcode,
+ route_code = data0.Rows.Count <= 0 ? "" : data0.Rows[0]["default_route"].ToString(),
+ sourceid = erporderid,
+ m_po = erpordercode,
+ username = us.usercode,
+ CreateDate = DateTime.Now.ToString(),
+ saleOrderCode = saleordercode,
+ saleOrderDeliveryDate = Convert.ToDateTime(saleOrderDeliveryDate),
+ plan_startdate = Convert.ToDateTime(paystartdate),
+ plan_enddate = Convert.ToDateTime(payenddate),
+ data_sources = "ERP",
+ isstep = isstep,//鏄惁鍏宠仈宸ュ簭 "N"
+ clerkuser = clerkuser
+ }
+ });
+ //鍒ゆ柇鏄惁鍐欏叆宸ュ崟宸ュ簭琛�(褰撳墠宸ュ崟鐗╂枡鏄惁鎸囧畾浜嗗伐鑹�)
+ if (orderstatus == "ALLO" && isstep == "Y")
+ {
+ //鍐欏叆宸ュ崟宸ュ簭琛�
+ for (int j = 0; j < data0.Rows.Count; j++)
+ {
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,route_code,stepprice,plan_quantity,plan_qty,ratio,status,isbott,isend,lm_user,lm_date)
+ values(@wo_code,@seq,@step_code,@route_code,@stepprice,@plan_quantity,@plan_qty,@ratio,@status,@isbott,@isend,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wo,
+ seq = data0.Rows[j]["seq"].ToString(),
+ step_code = data0.Rows[j]["step_code"].ToString(),
+ route_code = data0.Rows[j]["default_route"].ToString(),
+ stepprice = decimal.Parse(data0.Rows[j]["unprice"].ToString() == "" || data0.Rows[j]["unprice"].ToString() == null ? "0" : data0.Rows[j]["unprice"].ToString()),
+ plan_quantity = cdqty + (decimal.Parse(markqty) - sumqty), //鏈崟涓嬪崟鏁伴噺=鍒囧垎鏁伴噺+(涓嬪崟鏁伴噺-绱鍒囧垎涓嬪崟鏁伴噺),
+ plan_qty = cdqty + (decimal.Parse(markqty) - sumqty), //鏈崟涓嬪崟鏁伴噺=鍒囧垎鏁伴噺+(涓嬪崟鏁伴噺-绱鍒囧垎涓嬪崟鏁伴噺),
+ ratio = 0,
+ status = orderstatus,
+ isbott = data0.Rows[j]["first_choke"].ToString(),
+ isend = data0.Rows[j]["last_choke"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ }
+ }
+ }
+ if (decimal.Parse(erpqty) == decimal.Parse(markqty) + decimal.Parse(relse_qty)) //濡傛灉ERP璁㈠崟=涓嬪崟鏁伴噺+宸蹭笅鍗曟暟閲�,鍒欐洿鏂癊RP璁㈠崟琛ㄧ姸鎬佷负CREATED:宸插垱寤�
+ {
+ sql = @"update TKimp_Ewo set status='CREATED',saleOrderDeliveryDate=@saleOrderDeliveryDate,relse_qty=relse_qty+@sumqty where wo=@wo and id=@erporderid";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo = erpordercode,
+ erporderid = erporderid,
+ sumqty = sumqty,
+ saleOrderDeliveryDate = Convert.ToDateTime(saleOrderDeliveryDate)
+ }
+ });
+ }
+ else //鏇存柊ERP璁㈠崟琛ㄧ姸鎬佷负CREATING:鍒涘缓涓�
+ {
+ sql = @"update TKimp_Ewo set status='CREATING',saleOrderDeliveryDate=@saleOrderDeliveryDate,relse_qty=relse_qty+@sumqty where wo=@wo and id=@erporderid";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo = erpordercode,
+ erporderid = erporderid,
+ sumqty = sumqty,
+ saleOrderDeliveryDate = Convert.ToDateTime(saleOrderDeliveryDate)
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "涓嬭揪", "涓嬭揪浜嗗伐鍗�:" + wo, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "涓嬭揪MES宸ュ崟鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "涓嬭揪MES宸ュ崟鎴愬姛澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[璁㈠崟鎵归噺涓嬭揪]
+ public static ToMessage MarkBatchSaveErpOrder(List<ErpOrderBatch> obj, User us)
+ {
+ var sql = "";
+ string orderstatus = "", isstep = ""; //宸ュ崟鐘舵�併�佹槸鍚︾粦瀹氬伐鑹�
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ DataTable data0 = new DataTable();
+ try
+ {
+ list.Clear();
+ string result = "";
+ //var groupedModels = obj.GroupBy(m => m.erpordercode);
+ var groupedModels = obj.GroupBy(s => s.erpordercode).Select(g => new { erpordercode = g.Key }).ToList();
+
+ //鑾峰彇token涓祦绋嬮厤缃俊鎭�
+ JObject jsonObj = JObject.Parse(us.mesSetting);
+ var isroute = (string)jsonObj["route"].ToString().ToLower();// 鑾峰彇route閿殑鍊�
+
+ foreach (var group in groupedModels)
+ {
+ string erpordercode = group.erpordercode;
+ int count = 1;
+ foreach (var model in obj.Where(s => s.erpordercode == erpordercode).ToList())
+ {
+ //鍒ゆ柇褰撳墠宸ヨ壓娴佺▼
+ if (isroute == "true")
+ {
+ //鑾峰彇褰撳墠鐗╂枡鐨勫伐鑹鸿矾绾垮伐鑹轰俊鎭�
+ sql = @"select M.default_route,T.seq,T.step_code,T.first_choke,T.last_choke,S.unprice
+ from TMateriel_Info M
+ inner join TFlw_Rtdt T on M.default_route=T.rout_code
+ left join TPrteEqp_Stad S on M.partcode=S.materiel_code and M.default_route=S.route_code and T.step_code=S.step_code
+ where partcode=@partcode";
+ dynamicParams.Add("@partcode", model.partcode);
+ data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ orderstatus = "ALLO";
+ isstep = "Y";
+ }
+ else
+ {
+ orderstatus = "NEW";
+ isstep = "N";
+ }
+ }
+ else
+ {
+ //鑾峰彇褰撳墠鐗╂枡鐨勫伐搴忓伐鑹轰俊鎭�
+ sql = @"select M.default_route,T.step_seq as seq,T.step_code,T.isbott as first_choke,T.isend as last_choke,S.unprice
+ from TMateriel_Info M
+ inner join TMateriel_Step T on M.partcode=T.materiel_code
+ left join TPrteEqp_Stad S on M.partcode=S.materiel_code and T.step_code=S.step_code
+ where partcode=@partcode";
+ dynamicParams.Add("@partcode", model.partcode);
+ data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ orderstatus = "ALLO";
+ isstep = "Y";
+ }
+ else
+ {
+ orderstatus = "NEW";
+ isstep = "N";
+ }
+ }
+
+ //鑾峰彇褰撳墠鏈�澶у伐鍗曞彿
+ sql = @"select isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0) as worknumb
+ from TK_Wrk_Man where m_po=@erpordercode";
+ dynamicParams.Add("@erpordercode", model.erpordercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ int num = Convert.ToInt32(data.Rows[0]["WORKNUMB"].ToString());
+ string wo = model.erpordercode + "_" + (num + count);
+ result += wo.ToString() + ",";
+ //鍐欏叆宸ュ崟琛�
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,stck_code,sbid,materiel_code,route_code,sourceid,m_po,lm_user,lm_date,saleOrderCode,saleOrderDeliveryDate,plan_startdate,plan_enddate,data_sources,isstep,clerkuser)
+ values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@stck_code,@sbid,@materiel_code,@route_code,@sourceid,@m_po,@username,@CreateDate,@saleOrderCode,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@data_sources,@isstep,@clerkuser)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wo,
+ wotype = "PO",
+ status = orderstatus, //"NEW"
+ wkshp_code = model.wkshopcode,
+ plan_qty = decimal.Parse(model.erpqty), //璁㈠崟鏁伴噺
+ stck_code = model.warehousecode,
+ sbid = model.sbid,
+ materiel_code = model.partcode,
+ route_code=data0.Rows.Count<=0?"": data0.Rows[0]["default_route"].ToString(),
+ sourceid = model.erporderid,
+ m_po = model.erpordercode,
+ username = us.usercode,
+ CreateDate = DateTime.Now.ToString(),
+ saleOrderCode = model.saleordercode,
+ saleOrderDeliveryDate = Convert.ToDateTime(model.saleOrderDeliveryDate),
+ plan_startdate = Convert.ToDateTime(model.paystartdate),
+ plan_enddate = Convert.ToDateTime(model.payenddate),
+ data_sources = "ERP",
+ isstep = isstep, //鏄惁鍏宠仈宸ュ簭 "N"
+ clerkuser = model.clerkuser //閿�鍞鍗曚笟鍔″憳
+ }
+ });
+ //鍒ゆ柇鏄惁鍐欏叆宸ュ崟宸ュ簭琛�(褰撳墠宸ュ崟鐗╂枡鏄惁鎸囧畾浜嗗伐鑹�)
+ if (orderstatus == "ALLO" && isstep == "Y")
+ {
+ //鍐欏叆宸ュ崟宸ュ簭琛�
+ for (int i = 0; i < data0.Rows.Count; i++)
+ {
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,route_code,stepprice,plan_quantity,plan_qty,ratio,status,isbott,isend,lm_user,lm_date)
+ values(@wo_code,@seq,@step_code,@route_code,@stepprice,@plan_quantity,@plan_qty,@ratio,@status,@isbott,@isend,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = wo,
+ seq = data0.Rows[i]["seq"].ToString(),
+ step_code = data0.Rows[i]["step_code"].ToString(),
+ route_code = data0.Rows[i]["default_route"].ToString(),
+ stepprice = decimal.Parse(data0.Rows[i]["unprice"].ToString()==""|| data0.Rows[i]["unprice"].ToString() ==null? "0":data0.Rows[i]["unprice"].ToString()),
+ plan_quantity = decimal.Parse(model.erpqty), //璁㈠崟鏁伴噺
+ plan_qty = decimal.Parse(model.erpqty), //璁㈠崟鏁伴噺
+ ratio = 0,
+ status = orderstatus,
+ isbott = data0.Rows[i]["first_choke"].ToString(),
+ isend = data0.Rows[i]["last_choke"].ToString(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ }
+ //鏇存柊璁㈠崟鐘舵��
+ sql = @"update TKimp_Ewo set status='CREATED',saleOrderDeliveryDate=@saleOrderDeliveryDate,relse_qty=relse_qty+@sumqty where wo=@wo and id=@erporderid";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo = model.erpordercode,
+ erporderid = model.erporderid,
+ sumqty = decimal.Parse(model.markqty),
+ saleOrderDeliveryDate = Convert.ToDateTime(model.saleOrderDeliveryDate)
+ }
+ });
+ count++;
+ }
+ }
+
+
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鎵归噺涓嬭揪", "鎵归噺涓嬭揪浜嗗伐鍗�:" + result.TrimEnd(','), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎵归噺涓嬭揪MES宸ュ崟鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎵归噺涓嬭揪MES宸ュ崟鎴愬姛澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[ERP璁㈠崟鍏抽棴]
+ public static ToMessage ClosedErpOrder(string erporderid, string erpordercode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TK_Wrk_Man where m_po=@erpordercode and status<> 'CLOSED'";
+ dynamicParams.Add("@erpordercode", erpordercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠璁㈠崟鏈変笅杈炬湭鍏抽棴鐨凪ES宸ュ崟,璁㈠崟涓嶅厑璁稿叧闂�,璇峰厛鍒犻櫎鎴栧叧闂浉鍏冲伐鍗�!";
+ mes.data = null;
+ }
+ else
+ {
+ //鍏抽棴璁㈠崟
+ sql = @"update TKimp_Ewo set status='CLOSED' where wo=@wo and id=@erporderid";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo = erpordercode,
+ erporderid = erporderid
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍏抽棴", "鍏抽棴浜嗚鍗�:" + erpordercode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "璁㈠崟鍏抽棴鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁㈠崟鍏抽棴澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[ERP璁㈠崟鍒犻櫎]
+ public static ToMessage DeleteErpOrder(string erporderid, string erpordercode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select * from TK_Wrk_Man where m_po=@erpordercode and sourceid=@erporderid and status<>'NEW'";
+ dynamicParams.Add("@erpordercode", erpordercode);
+ dynamicParams.Add("@erporderid", erporderid);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠璁㈠崟涓嬫湁宸ュ崟宸叉淳鍙戞垨宸插紑宸ユ垨宸插畬宸�(鍏抽棴),涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ //鍒犻櫎宸ュ崟
+ sql = @"delete TK_Wrk_Man where m_po=@wo and sourceid=@erporderid";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo = erpordercode,
+ erporderid = erporderid
+ }
+ });
+ //鍒犻櫎璁㈠崟
+ sql = @"delete TKimp_Ewo where wo=@wo and id=@erporderid";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo = erpordercode,
+ erporderid = erporderid
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ LogHelper.WriteLogData(aa.ToString());
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗚鍗�:" + erpordercode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "璁㈠崟鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "璁㈠崟鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[MES宸ュ崟鏌ヨ]
+ public static ToMessage MesOrderSearch(string mesorderstus, string wkshopcode, string mesordercode, string sourceorder, string saleordercode, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string datatype, string paydatestartdate, string paydateenddate, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mesorderstus != "" && mesorderstus != null)
+ {
+ search += "and A.status=@mesorderstus ";
+ dynamicParams.Add("@mesorderstus", mesorderstus);
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (mesordercode != "" && mesordercode != null)
+ {
+ search += "and A.wo_code like '%'+@mesordercode+'%' ";
+ dynamicParams.Add("@mesordercode", mesordercode);
+ }
+ if (sourceorder != "" && sourceorder != null)
+ {
+ search += "and A.m_po like '%'+@sourceorder+'%' ";
+ dynamicParams.Add("@sourceorder", sourceorder);
+ }
+ if (saleordercode != "" && saleordercode != null)
+ {
+ search += "and W.saleOrderCode like '%'+@saleordercode+'%' ";
+ dynamicParams.Add("@saleordercode", saleordercode);
+ }
+ if (ordertype != "" && ordertype != null)
+ {
+ search += "and A.wotype like '%'+@ordertype+'%' ";
+ dynamicParams.Add("@ordertype", ordertype);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and B.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (creatuser != "" && creatuser != null)
+ {
+ search += "and U.username like '%'+@creatuser+'%' ";
+ dynamicParams.Add("@creatuser", creatuser);
+ }
+ if (paydatestartdate != "" && paydatestartdate != null)
+ {
+ switch (datatype)
+ {
+ case "PS":
+ search += "and A.plan_startdate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ break;
+ case "PE":
+ search += "and A.plan_enddate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ break;
+ case "ED":
+ search += "and A.saleOrderDeliveryDate between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ break;
+ case "CT":
+ search += "and A.lm_date between @paydatestartdate and @paydateenddate ";
+ dynamicParams.Add("@paydatestartdate", paydatestartdate + " 00:00:00");
+ dynamicParams.Add("@paydateenddate", paydateenddate + " 23:59:59");
+ break;
+ default:
+ break;
+ }
+ }
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.route_code,B.default_route,R.name as route_name,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
+ A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources,A.isstep,A.clerkuser,
+ B.priuserdefnvc1,B.priuserdefnvc2,B.priuserdefnvc3,B.priuserdefnvc4,B.priuserdefnvc5,B.priuserdefnvc6,A.printcount
+ from TK_Wrk_Man A
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sbid=W.sbid
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TOrganization C on A.wkshp_code=C.torg_code
+ left join TSecStck D on A.stck_code=D.code
+ left join TUser U on A.lm_user=U.usercode
+ left join TOrganization L on C.parent_id=L.id
+ left join TFlw_Rout R on A.route_code=R.code
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES鎶ュ簾琛ュ崟宸ュ崟鏌ヨ]
+ public static ToMessage MesBadOrderSearch(string wkshopcode, string mesordercode, string sourceorder, string saleordercode, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (mesordercode != "" && mesordercode != null)
+ {
+ search += "and A.wo_code like '%'+@mesordercode+'%' ";
+ dynamicParams.Add("@mesordercode", mesordercode);
+ }
+ if (sourceorder != "" && sourceorder != null)
+ {
+ search += "and A.m_po like '%'+@sourceorder+'%' ";
+ dynamicParams.Add("@sourceorder", sourceorder);
+ }
+ if (saleordercode != "" && saleordercode != null)
+ {
+ search += "and W.saleOrderCode like '%'+@saleordercode+'%' ";
+ dynamicParams.Add("@saleordercode", saleordercode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and B.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (createdate != "" && createdate != null)
+ {
+ search += "and CONVERT(varchar(100),A.lm_date,23)=@createdate ";
+ dynamicParams.Add("@createdate", createdate);
+ }
+ if (creatuser != "" && creatuser != null)
+ {
+ search += "and U.username like '%'+@creatuser+'%' ";
+ dynamicParams.Add("@creatuser", creatuser);
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
+ A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,S.laborbad_qty,S.materielbad_qty,
+ B.priuserdefnvc1,B.priuserdefnvc2,B.priuserdefnvc3,B.priuserdefnvc4,B.priuserdefnvc5,B.priuserdefnvc6
+ from TK_Wrk_Man A
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code and A.sbid=W.sbid
+ left join (select wo_code,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty from TK_Wrk_Step where (laborbad_qty+materielbad_qty)>0 group by wo_code) S on A.wo_code=S.wo_code
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TOrganization C on A.wkshp_code=C.torg_code
+ left join TSecStck D on A.stck_code=D.code
+ left join TUser U on A.lm_user=U.usercode
+ where A.is_delete<>'1' and (S.laborbad_qty+S.materielbad_qty)>0 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佽幏鍙栧伐鍗曞彿]
+ public static ToMessage AddMesOrderCodeSearch()
+ {
+ string sql = "";
+ string wo_code = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇鍗曟嵁鍙�
+ sql = @"SELECT 'SGPO'+CONVERT(varchar(12) , getdate(), 112 )+'_'+cast(isnull(max(cast(substring(wo_code,charindex('_',wo_code)+1,len(wo_code)-charindex('_',wo_code)) as numeric)),0)+1 as varchar) as numct
+ FROM TK_Wrk_Man where wo_code like '%SGPO%'";
+ var data = DapperHelper.selecttable(sql);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.Rows[0]["numct"].ToString();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟缂栬緫鑾峰彇宸ュ簭鏁版嵁]
+ public static ToMessage UpdateMesOrderStepSearch(string sourceid, string sourcewo, string wocode, string data_sources)
+ {
+ string sql = ""; decimal canupdate_qty = 0;
+ var dynamicParams = new DynamicParameters();
+ Dictionary<object, object> dir = new Dictionary<object, object>();
+ try
+ {
+ if (data_sources == "ERP") //鏁版嵁鏉ユ簮ERP
+ {
+ //鏌ヨ璁㈠崟浠诲姟鎬绘暟
+ sql = @"select qty,relse_qty from TKimp_Ewo where id=@sourceid and wo=@sourcewo";
+ dynamicParams.Add("@sourceid", sourceid);
+ dynamicParams.Add("@sourcewo", sourcewo);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ //鏌ヨ褰撳墠宸ュ崟鍙慨鏀规暟閲�=璁㈠崟鎬绘暟-宸蹭笅杈惧伐鍗曟�绘暟
+ sql = @"select isnull(sum(plan_qty),0) as plan_qty from TK_Wrk_Man
+ where sourceid=@sourceid and m_po=@sourcewo and wo_code<>@wocode";
+ dynamicParams.Add("@sourceid", sourceid);
+ dynamicParams.Add("@sourcewo", sourcewo);
+ dynamicParams.Add("@wocode", wocode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //褰撳墠宸ュ崟鍙慨鏀规暟閲�=璁㈠崟鏁伴噺-闈炲綋鍓嶅伐鍗曟�讳笅杈惧伐鍗曟暟閲�
+ canupdate_qty = decimal.Parse(data0.Rows[0]["qty"].ToString()) - decimal.Parse(data.Rows[0]["plan_qty"].ToString());
+ }
+ if (data_sources == "MES") //鏁版嵁鏉ユ簮MES
+ {
+ if (sourceid == "" || sourceid == null) //鏃犳簮鍗�
+ {
+ //鏌ヨ褰撳墠宸ュ崟鍙慨鏀规暟閲�=宸ュ崟鎬绘暟
+ sql = @"select plan_qty from TK_Wrk_Man where wo_code=@wo_code";
+ dynamicParams.Add("@wo_code", wocode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //褰撳墠宸ュ崟鍙慨鏀规暟閲�=宸ュ崟鏁伴噺
+ canupdate_qty = decimal.Parse(data.Rows[0]["plan_qty"].ToString());
+ }
+ else //鏈夋簮鍗�(鎶ュ簾琛ュ崟)
+ {
+ //涓嶆帶鍒� 鏍囪瘑涓�-1
+ canupdate_qty = -1;
+ }
+ }
+ //鑾峰彇宸ュ簭淇℃伅
+ sql = @"select S.wo_code,S.seq,S.step_code,T.stepname,S.stepprice,S.ratio,(isnull(S.good_qty,0)+isnull(S.ng_qty,0)+isnull(S.laborbad_qty,0)+isnull(S.materielbad_qty,0)) as produceq_qty,
+ S.good_qty,S.ng_qty,S.laborbad_qty,S.materielbad_qty,S.plan_qty,(isnull(S.plan_quantity,0)-(isnull(S.good_qty,0)+isnull(S.ng_qty,0)+isnull(S.laborbad_qty,0)+isnull(S.materielbad_qty,0))) as delive_qty,S.isbott,S.isend
+ from TK_Wrk_Step S
+ left join TStep T on S.step_code=T.stepcode
+ where S.wo_code=@wocode order by S.seq ";
+ dynamicParams.Add("@wocode", wocode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ dir.Add("canupdate_qty", canupdate_qty);
+ dir.Add("stepdata", data1);
+ mes.code = "200";
+ mes.count = data1.Rows.Count;
+ mes.message = "鏌ヨ鎴愬姛";
+ mes.data = dir;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佺紪杈戞彁浜
+ public static ToMessage AddUpdateMesOrder(string operType, WorkList json, User us)
+ {
+ string sql = "", route_code = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ route_code = json.routecode;
+ }
+ else //宸ュ簭鐗�
+ {
+ route_code = null;
+ }
+ if (operType == "Add")
+ {
+ //鍐欏叆宸ュ崟琛�
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,lm_user,lm_date,materiel_code,route_code,sourceid,m_po,saleOrderDeliveryDate,plan_startdate,plan_enddate,piroque,isaps,data_sources,isstep)
+ values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@lm_user,@lm_date,@materiel_code,@route_code,@sourceid,@m_po,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@orderlev,@isaps,@data_sources,@isstep)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json.wocode,
+ wotype = json.wotype,
+ status = json.wostatus,
+ wkshp_code = json.wkshopcode,
+ plan_qty = json.woqty,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ materiel_code = json.partcode,
+ route_code = route_code,
+ sourceid = json.sourceid == "" ? null : json.sourceid, //鏃犳簮鍗曟椂璧嬪�糔ULL
+ m_po = json.sourcewo,
+ saleOrderDeliveryDate = json.deliverydate,
+ plan_startdate = json.paystartdate,
+ plan_enddate = json.payenddate,
+ orderlev = "3",//浼樺厛绾э細鐗圭骇锛�1锛� 绱ф�ワ紙2锛� 姝e父锛�3锛�
+ isaps = "N", //鏄惁鎺掍骇,榛樿N Y=鏄� N=鍚�
+ data_sources = json.data_sources,
+ isstep = json.isstep //鏄惁鍏宠仈宸ュ簭
+ }
+ });
+ //鍐欏叆宸ュ簭浠诲姟琛�
+ for (int i = 0; i < json.WorkListSub.Count; i++)
+ {
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,route_code,stepprice,plan_quantity,plan_qty,ratio,status,isbott,isend,lm_user,lm_date)
+ values(@wo_code,@seq,@step_code,@route_code,@stepprice,@plan_quantity,@plan_qty,@ratio,@status,@isbott,@isend,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json.wocode,
+ seq = json.WorkListSub[i].stepseq,
+ step_code = json.WorkListSub[i].stepcode,
+ route_code = route_code,
+ stepprice = json.WorkListSub[i].stepprice,
+ plan_quantity = json.woqty,
+ plan_qty = json.WorkListSub[i].sumqty,
+ ratio=json.WorkListSub[i].ratio,
+ status = json.wostatus,
+ isbott = json.WorkListSub[i].isbott,
+ isend = json.WorkListSub[i].isend,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗伐鍗�:" + json.wocode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "MES宸ュ崟鏂板缓鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "MES宸ュ崟鏂板缓澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (operType == "Update")
+ {
+ //淇敼宸ュ崟琛�
+ sql = @"update TK_Wrk_Man set wotype=@wotype,wkshp_code=@wkshp_code,plan_qty=@plan_qty,lm_user=@lm_user,lm_date=@lm_date,
+ materiel_code=@materiel_code,route_code=@route_code,sourceid=@sourceid,m_po=@m_po,saleOrderDeliveryDate=@saleOrderDeliveryDate,plan_startdate=@plan_startdate,plan_enddate=@plan_enddate,isstep=@isstep
+ where wo_code=@wo_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json.wocode,
+ wotype = json.wotype,
+ wkshp_code = json.wkshopcode,
+ plan_qty = json.woqty,
+ materiel_code = json.partcode,
+ route_code = route_code,
+ sourceid = json.sourceid == "" ? null : json.sourceid, //鏃犳簮鍗曟椂璧嬪�糔ULL
+ m_po = json.sourcewo,
+ saleOrderDeliveryDate = json.deliverydate,
+ plan_startdate = json.paystartdate,
+ plan_enddate = json.payenddate,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ isstep = json.isstep //鏄惁鍏宠仈宸ュ簭
+ }
+ });
+ //鍒犻櫎宸ュ崟宸ュ簭琛�
+ sql = @"delete TK_Wrk_Step where wo_code=@wo_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json.wocode
+ }
+ });
+ //鍐欏叆宸ュ崟宸ュ簭琛�
+ for (int i = 0; i < json.WorkListSub.Count; i++)
+ {
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,route_code,stepprice,plan_quantity,plan_qty,ratio,status,isbott,isend,lm_user,lm_date)
+ values(@wo_code,@seq,@step_code,@route_code,@stepprice,@plan_quantity,@plan_qty,@ratio,@status,@isbott,@isend,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json.wocode,
+ seq = json.WorkListSub[i].stepseq,
+ step_code = json.WorkListSub[i].stepcode,
+ route_code = route_code,
+ stepprice = json.WorkListSub[i].stepprice,
+ plan_quantity = json.woqty,
+ plan_qty = json.WorkListSub[i].sumqty,
+ ratio=json.WorkListSub[i].ratio,
+ status = json.wostatus,
+ isbott = json.WorkListSub[i].isbott,
+ isend = json.WorkListSub[i].isend,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鍒ゆ柇婧愬ご鍗曟嵁鏄惁鏉ユ簮ERP
+ if (json.data_sources == "ERP")
+ {
+ //鍒ゆ柇宸ュ崟淇敼鏁伴噺宸�兼槸鍚︿负0
+ if (json.difference != "0")
+ {
+ string staus = "";
+ //鏌ヨ璁㈠崟鎬绘暟,宸蹭笅杈炬暟閲�
+ sql = @"select qty,relse_qty from TKimp_Ewo where id=@sourceid and wo=@sourcewo";
+ dynamicParams.Add("@sourceid", json.sourceid);
+ dynamicParams.Add("@sourcewo", json.sourcewo);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ //褰撳墠宸ュ崟鍙慨鏀规暟閲�=璁㈠崟鏁伴噺-闈炲綋鍓嶅伐鍗曟�讳笅杈惧伐鍗曟暟閲�
+ decimal qty = decimal.Parse(data0.Rows[0]["qty"].ToString());//璁㈠崟鎬绘暟
+ decimal relse_qty = decimal.Parse(data0.Rows[0]["relse_qty"].ToString());//璁㈠崟宸蹭笅杈炬�绘暟
+ relse_qty = relse_qty + decimal.Parse(json.difference);//鏂扮殑涓嬭揪鏁伴噺=鍘熷涓嬭揪鏁伴噺+宸��(姝h礋)
+ if (qty == relse_qty)
+ {
+ staus = "CREATED"; //鍏ㄩ儴涓嬭揪
+ }
+ else
+ {
+ staus = "CREATING";//閮ㄥ垎涓嬭揪
+ }
+ //鏇存柊璁㈠崟琛ㄧ姸鎬併�佸凡涓嬭揪鏁伴噺
+ sql = @"update TKimp_Ewo set status=@status,relse_qty=@relse_qty where id=@sourceid and wo=@sourcewo";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ status = staus,
+ relse_qty = relse_qty,
+ sourceid = json.sourceid,
+ sourcewo = json.sourcewo
+ }
+ });
+ }
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗伐鍗�:" + json.wocode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺缁戝畾鑾峰彇宸ュ簭鏁版嵁]
+ public static ToMessage UpdateMesOrderStepListSearch(List<WorkStepList> worksteplist)
+ {
+ string sql = ""; decimal canupdate_qty = 0;
+ var dynamicParams = new DynamicParameters();
+ List<Dictionary<object, object>> dir = new List<Dictionary<object, object>>();
+ try
+ {
+ for (int i = 0; i < worksteplist.Count; i++)
+ {
+ // 鍒涘缓涓�涓柊鐨勫瓧鍏�
+ Dictionary<object, object> dict = new Dictionary<object, object>();
+
+ if (worksteplist[i].data_sources == "ERP") //鏁版嵁鏉ユ簮ERP
+ {
+
+ //鏌ヨ褰撳墠宸ュ崟鍙慨鏀规暟閲�=璁㈠崟鎬绘暟-宸蹭笅杈惧伐鍗曟�绘暟
+ sql = @"select isnull(plan_qty,0) as plan_qty from TK_Wrk_Man
+ where sourceid=@sourceid and m_po=@sourcewo and wo_code=@wocode";
+ dynamicParams.Add("@sourceid", worksteplist[i].sourceid);
+ dynamicParams.Add("@sourcewo", worksteplist[i].sourcewo);
+ dynamicParams.Add("@wocode", worksteplist[i].wocode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //褰撳墠宸ュ崟鏁伴噺
+ canupdate_qty = decimal.Parse(data.Rows[0]["plan_qty"].ToString());
+ }
+ if (worksteplist[i].data_sources == "MES") //鏁版嵁鏉ユ簮MES
+ {
+ if (worksteplist[i].sourceid == "" || worksteplist[i].sourceid == null) //鏃犳簮鍗�
+ {
+ //鏌ヨ褰撳墠宸ュ崟鍙慨鏀规暟閲�=宸ュ崟鎬绘暟
+ sql = @"select plan_qty from TK_Wrk_Man where wo_code=@wo_code";
+ dynamicParams.Add("@wo_code", worksteplist[i].wocode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //褰撳墠宸ュ崟宸ュ崟鏁伴噺
+ canupdate_qty = decimal.Parse(data.Rows[0]["plan_qty"].ToString());
+ }
+ else //鏈夋簮鍗�(鎶ュ簾琛ュ崟)
+ {
+ //涓嶆帶鍒� 鏍囪瘑涓�-1
+ canupdate_qty = -1;
+ }
+ }
+ //鑾峰彇宸ュ簭淇℃伅
+ sql = @"select S.wo_code,S.seq,S.step_code as stepcode,T.stepname,S.stepprice,S.ratio,(isnull(S.good_qty,0)+isnull(S.ng_qty,0)+isnull(S.laborbad_qty,0)+isnull(S.materielbad_qty,0)) as produceq_qty,
+ S.good_qty,S.ng_qty,S.laborbad_qty,S.materielbad_qty,S.plan_qty,(isnull(S.plan_quantity,0)-(isnull(S.good_qty,0)+isnull(S.ng_qty,0)+isnull(S.laborbad_qty,0)+isnull(S.materielbad_qty,0))) as delive_qty,S.isbott,S.isend
+ from TK_Wrk_Step S
+ left join TStep T on S.step_code=T.stepcode
+ where S.wo_code=@wocode order by S.seq ";
+ dynamicParams.Add("@wocode", worksteplist[i].wocode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+
+ // 鍚戝瓧鍏镐腑娣诲姞鏁版嵁
+ dict.Add("canupdate_qty", canupdate_qty);
+ dict.Add("stepdata", data1);
+ // 灏嗗瓧鍏告坊鍔犲埌鍒楄〃涓�
+ dir.Add(dict);
+ mes.code = "200";
+ mes.count = dir.Count;
+ mes.message = "鏌ヨ鎴愬姛";
+ mes.data = dir;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏂板銆佺紪杈戞壒閲忕粦瀹氭彁浜
+ public static ToMessage AddUpdateMesOrderList(string operType, List<WorkList> json, User us)
+ {
+ string sql = "", route_code = "";
+ var dynamicParams = new DynamicParameters();
+ List<object> list = new List<object>();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (!route) //宸ュ簭鐗�
+ {
+ route_code = null;
+ }
+ if (operType == "Add")
+ {
+ for (int i = 0; i < json.Count; i++)
+ {
+ route_code = json[i].routecode;
+ //鍐欏叆宸ュ崟琛�
+ sql = @"insert into TK_Wrk_Man(wo_code,wotype,status,wkshp_code,plan_qty,lm_user,lm_date,materiel_code,route_code,sourceid,m_po,saleOrderDeliveryDate,plan_startdate,plan_enddate,piroque,isaps,data_sources,isstep)
+ values(@wo_code,@wotype,@status,@wkshp_code,@plan_qty,@lm_user,@lm_date,@materiel_code,@route_code,@sourceid,@m_po,@saleOrderDeliveryDate,@plan_startdate,@plan_enddate,@orderlev,@isaps,@data_sources,@isstep)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json[i].wocode,
+ wotype = json[i].wotype,
+ status = json[i].wostatus,
+ wkshp_code = json[i].wkshopcode,
+ plan_qty = json[i].woqty,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ materiel_code = json[i].partcode,
+ route_code = route_code,
+ sourceid = json[i].sourceid == "" ? null : json[i].sourceid, //鏃犳簮鍗曟椂璧嬪�糔ULL
+ m_po = json[i].sourcewo,
+ saleOrderDeliveryDate = json[i].deliverydate,
+ plan_startdate = json[i].paystartdate,
+ plan_enddate = json[i].payenddate,
+ orderlev = "3",//浼樺厛绾э細鐗圭骇锛�1锛� 绱ф�ワ紙2锛� 姝e父锛�3锛�
+ isaps = "N", //鏄惁鎺掍骇,榛樿N Y=鏄� N=鍚�
+ data_sources = json[i].data_sources,
+ isstep = json[i].isstep //鏄惁鍏宠仈宸ュ簭
+ }
+ });
+ //鍐欏叆宸ュ簭浠诲姟琛�
+ for (int j = 0; j < json[i].WorkListSub.Count; j++)
+ {
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,route_code,stepprice,plan_quantity,plan_qty,ratio,status,isbott,isend,lm_user,lm_date)
+ values(@wo_code,@seq,@step_code,@route_code,@stepprice,@plan_quantity,@plan_qty,@ratio,@status,@isbott,@isend,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json[i].wocode,
+ seq = json[i].WorkListSub[j].stepseq,
+ step_code = json[i].WorkListSub[j].stepcode,
+ route_code = route_code,
+ stepprice = json[i].WorkListSub[j].stepprice,
+ plan_quantity = json[i].woqty,
+ plan_qty = json[i].WorkListSub[j].sumqty,
+ ratio=json[i].WorkListSub[j].ratio,
+ status = json[i].wostatus,
+ isbott = json[i].WorkListSub[j].isbott,
+ isend = json[i].WorkListSub[j].isend,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鏂板", "鏂板浜嗗伐鍗�:" + json[0].wocode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "MES宸ュ崟鏂板缓鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "MES宸ュ崟鏂板缓澶辫触!";
+ mes.data = null;
+ }
+ }
+ if (operType == "Update")
+ {
+ for (int i = 0; i < json.Count; i++)
+ {
+ route_code = json[i].routecode;
+ //淇敼宸ュ崟琛�
+ sql = @"update TK_Wrk_Man set wotype=@wotype,wkshp_code=@wkshp_code,plan_qty=@plan_qty,lm_user=@lm_user,lm_date=@lm_date,
+ materiel_code=@materiel_code,route_code=@route_code,sourceid=@sourceid,m_po=@m_po,saleOrderDeliveryDate=@saleOrderDeliveryDate,plan_startdate=@plan_startdate,plan_enddate=@plan_enddate,isstep=@isstep
+ where wo_code=@wo_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json[i].wocode,
+ wotype = json[i].wotype,
+ wkshp_code = json[i].wkshopcode,
+ plan_qty = json[i].woqty,
+ materiel_code = json[i].partcode,
+ route_code = route_code,
+ sourceid = json[i].sourceid == "" ? null : json[i].sourceid, //鏃犳簮鍗曟椂璧嬪�糔ULL
+ m_po = json[i].sourcewo,
+ saleOrderDeliveryDate = json[i].deliverydate,
+ plan_startdate = json[i].paystartdate,
+ plan_enddate = json[i].payenddate,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ isstep = json[i].isstep //鏄惁鍏宠仈宸ュ簭
+ }
+ });
+ //鍒犻櫎宸ュ崟宸ュ簭琛�
+ sql = @"delete TK_Wrk_Step where wo_code=@wo_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json[i].wocode
+ }
+ });
+ //鍐欏叆宸ュ崟宸ュ簭琛�
+ for (int j = 0; j < json[i].WorkListSub.Count; j++)
+ {
+ sql = @"insert into TK_Wrk_Step(wo_code,seq,step_code,route_code,stepprice,plan_quantity,plan_qty,ratio,status,isbott,isend,lm_user,lm_date)
+ values(@wo_code,@seq,@step_code,@route_code,@stepprice,@plan_quantity,@plan_qty,@ratio,@status,@isbott,@isend,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json[i].wocode,
+ seq = json[i].WorkListSub[j].stepseq,
+ step_code = json[i].WorkListSub[j].stepcode,
+ route_code = route_code,
+ stepprice = json[i].WorkListSub[j].stepprice,
+ plan_quantity = json[i].woqty,
+ plan_qty = json[i].WorkListSub[j].sumqty,
+ ratio=json[i].WorkListSub[j].ratio,
+ status = json[i].wostatus,
+ isbott = json[i].WorkListSub[j].isbott,
+ isend = json[i].WorkListSub[j].isend,
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鍒ゆ柇婧愬ご鍗曟嵁鏄惁鏉ユ簮ERP
+ if (json[i].data_sources == "ERP")
+ {
+ //鍒ゆ柇宸ュ崟淇敼鏁伴噺宸�兼槸鍚︿负0
+ if (json[i].difference != "0")
+ {
+ string staus = "";
+ //鏌ヨ璁㈠崟鎬绘暟,宸蹭笅杈炬暟閲�
+ sql = @"select qty,relse_qty from TKimp_Ewo where id=@sourceid and wo=@sourcewo";
+ dynamicParams.Add("@sourceid", json[i].sourceid);
+ dynamicParams.Add("@sourcewo", json[i].sourcewo);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ //褰撳墠宸ュ崟鍙慨鏀规暟閲�=璁㈠崟鏁伴噺-闈炲綋鍓嶅伐鍗曟�讳笅杈惧伐鍗曟暟閲�
+ decimal qty = decimal.Parse(data0.Rows[0]["qty"].ToString());//璁㈠崟鎬绘暟
+ decimal relse_qty = decimal.Parse(data0.Rows[0]["relse_qty"].ToString());//璁㈠崟宸蹭笅杈炬�绘暟
+ relse_qty = relse_qty + decimal.Parse(json[i].difference);//鏂扮殑涓嬭揪鏁伴噺=鍘熷涓嬭揪鏁伴噺+宸��(姝h礋)
+ if (qty == relse_qty)
+ {
+ staus = "CREATED"; //鍏ㄩ儴涓嬭揪
+ }
+ else
+ {
+ staus = "CREATING";//閮ㄥ垎涓嬭揪
+ }
+ //鏇存柊璁㈠崟琛ㄧ姸鎬併�佸凡涓嬭揪鏁伴噺
+ sql = @"update TKimp_Ewo set status=@status,relse_qty=@relse_qty where id=@sourceid and wo=@sourcewo";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ status = staus,
+ relse_qty = relse_qty,
+ sourceid = json[i].sourceid,
+ sourcewo = json[i].sourcewo
+ }
+ });
+ }
+ }
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "淇敼", "淇敼浜嗗伐鍗�:" + string.Join(",", json.Select(j => j.wocode.ToString())), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵撳嵃鏇存柊鎵撳嵃娆℃暟]
+ public static ToMessage UpdateMesOrderPrintCount(string wo_code)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鏇存柊宸ュ崟鎵撳嵃娆℃暟
+ sql = @"update TK_Wrk_Man set printcount=printcount+1 where wo_code=@wo_code";
+ list.Add(new { str = sql, parm = new { wo_code = wo_code } });
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏇存柊鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏇存柊澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[MES宸ュ崟鍒犻櫎]
+ public static ToMessage DeleteMesOrder(string souceid, string wocode, string m_po, string orderqty, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇宸ュ崟鏄惁涓烘湭寮�濮嬬姸鎬佹垨鑰呭凡娲惧彂鎴栧緟鎺掔▼鐘舵��(婊¤冻鍏朵腑涓�绉嶉兘鍙垹闄わ紝鍚﹀垯涓嶅厑璁稿垹闄�)
+ sql = @"select * from TK_Wrk_Man where wo_code=@wocode and status in('NEW','ALLO','NOSCHED')";
+ dynamicParams.Add("@wocode", wocode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ if (m_po != "" && m_po != null)
+ {
+ //鏌ヨ鐢熶骇璁㈠崟琛ㄦ暟鎹�
+ sql = @"select * from TKimp_Ewo where wo=@m_po and id=@souceid";
+ dynamicParams.Add("@m_po", m_po);
+ dynamicParams.Add("@souceid", souceid);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ decimal relse_qty = decimal.Parse(data0.Rows[0]["RELSE_QTY"].ToString());//浠ヤ笅鍗曟暟閲�
+ if ((relse_qty - decimal.Parse(orderqty)) == 0) //鍏ㄩ儴鎾ら攢 璁㈠崟鐘舵�佸洖鍐欐湭寮�濮�,宸蹭笅鍗曟暟閲忎负0
+ {
+ //鍥炲啓璁㈠崟琛ㄧ姸鎬佸強宸蹭笅鍗曟暟閲�
+ sql = @"update TKimp_Ewo set status='NEW',relse_qty=0 where wo=@m_po and id=@souceid";
+ list.Add(new { str = sql, parm = new { m_po = m_po, souceid = souceid } });
+ }
+ else
+ {
+ //鍥炲啓璁㈠崟琛ㄧ姸鎬佸強宸蹭笅鍗曟暟閲�
+ sql = @"update TKimp_Ewo set status='CREATING',relse_qty=relse_qty-@orderqty where wo=@m_po and id=@souceid";
+ list.Add(new { str = sql, parm = new { m_po = m_po, souceid = souceid, orderqty = decimal.Parse(orderqty) } });
+ }
+ }
+ //鍒犻櫎宸ュ崟宸ュ簭琛�
+ sql = @"delete TK_Wrk_Step where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+
+ //鍒犻櫎鍔犲伐鍗曠敤鏂欒〃(瀛愪欢)
+ //sql = @"delete TK_Wrk_Allo where wo_code=@wocode";
+ //list.Add(new { str = sql, parm = new { wocode = wocode } });
+
+ //鍒犻櫎宸ュ崟琛�
+ sql = @"delete TK_Wrk_Man where wo_code=@wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocode } });
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟鎵ц涓垨宸插叧闂紝涓嶅厑璁稿垹闄�!";
+ mes.data = null;
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍒犻櫎", "鍒犻櫎浜嗗伐鍗�:" + wocode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍒犻櫎鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍒犻櫎澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ユ壘鍘嗗彶寮曠敤鏈�鏂板伐搴忎俊鎭痌
+ public static ToMessage MesOrderNewStepContent(string wkshopcode, string routecode, string partcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ //MES宸ュ崟鏌ユ壘鍘嗗彶寮曠敤鏈�鏂板伐搴忎俊鎭�
+ sql = @"select S.wo_code,S.seq,S.step_code,T.stepname as step_name,S.stepprice,S.isbott,S.isend,S.ratio
+ from TK_Wrk_Step S
+ inner join (
+ select top 1 A.wo_code,A.route_code from TK_Wrk_Man A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.route_code=S.route_code
+ where A.materiel_code=@partcode and A.wkshp_code=@wkshopcode and A.route_code=@routecode
+ order by A.lm_date desc
+ ) as W on S.wo_code=W.wo_code and S.route_code=W.route_code
+ left join TStep T on S.step_code=T.stepcode
+ order by S.seq";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@routecode", routecode);
+ }
+ else
+ {
+ //MES宸ュ崟鏌ユ壘鍘嗗彶寮曠敤鏈�鏂板伐搴忎俊鎭�
+ sql = @"select S.wo_code,S.seq,S.step_code,T.stepname as step_name,S.stepprice,S.isbott,S.isend,S.ratio
+ from TK_Wrk_Step S
+ inner join (
+ select top 1 A.wo_code from TK_Wrk_Man A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code
+ where A.materiel_code=@partcode and A.wkshp_code=@wkshopcode
+ order by A.lm_date desc
+ ) as W on S.wo_code=W.wo_code
+ left join TStep T on S.step_code=T.stepcode
+ order by S.seq";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ dynamicParams.Add("@partcode", partcode);
+ }
+
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.count = data.Rows.Count;
+ mes.data = data;
+ mes.message = "鏌ヨ鎴愬姛!";
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ョ湅宸ュ崟SOP]
+ public static ToMessage MesOrderSopSearch(string wocode, string materielcode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇SOP鏂囦欢淇℃伅
+ sql = @"select filename,filepath,version from TWrkOrderSop
+ where wo=@wocode and materielcode=@materielcode
+ order by version";
+ dynamicParams.Add("@wocode", wocode);
+ dynamicParams.Add("@materielcode", materielcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.message = "褰撳墠宸ュ崟浜у搧鏆傛棤SOP鏂囦欢!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鏌ョ湅宸ヨ壓SOP]
+ public static ToMessage MesOrderProcessSopSearch(string materielcode, string routecode, string stepcode, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool route = dynObj.route;
+ if (route) //宸ヨ壓璺嚎鐗�
+ {
+ //鑾峰彇SOP鏂囦欢淇℃伅
+ sql = @"select filename,filepath,version from TProcessSop
+ where materielcode=@materielcode and routecode=@routecode and stepcode=@stepcode
+ order by version";
+ dynamicParams.Add("@materielcode", materielcode);
+ dynamicParams.Add("@routecode", routecode);
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ else
+ {
+ //鑾峰彇SOP鏂囦欢淇℃伅
+ sql = @"select filename,filepath,version from TProcessSop
+ where materielcode=@materielcode and stepcode=@stepcode
+ order by version";
+ dynamicParams.Add("@materielcode", materielcode);
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.count = data.Rows.Count;
+ mes.data = data;
+ mes.message = "鏌ヨ鎴愬姛!";
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[MES宸ュ崟娲惧彂鎻愪氦]
+ public static ToMessage MesOrderDistribution(string[] wocodelist, User us)
+ {
+ string sql = "";
+ List<object> list = new List<object>();
+ try
+ {
+ //鏇存柊宸ュ崟琛ㄧ姸鎬�
+ sql = @"update TK_Wrk_Man set status=@status,distributionuser=@distributionuser,distributiontime=@distributiontime where wo_code in @wocode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wocode = wocodelist,
+ status = "ALLO",
+ distributionuser=us.usercode,
+ distributiontime= DateTime.Now.ToString()
+ }
+ });
+ //鏇存柊宸ュ簭浠诲姟琛ㄧ姸鎬�
+ sql = @"update TK_Wrk_Step set status=@status where wo_code in @wocode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wocode = wocodelist,
+ status = "ALLO"
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "娲惧彂", "娲惧彂浜嗗伐鍗�:" + string.Join(",", wocodelist), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "MES宸ュ崟娲惧彂鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "MES宸ュ缓娲惧彂澶辫触!";
+ mes.data = null;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[宸ュ崟鍏抽棴鍒楄〃鏌ヨ]
+ public static ToMessage MesOrderClosedSearch(string mesorderstus, string wkshopcode, string mesordercode, string sourceorder, string saleordercode, string ordertype, string partcode, string partname, string partspec, int startNum, string creatuser, string createdate, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (mesorderstus == "CLOSED")
+ {
+ search += "and A.status=@mesorderstus ";
+ dynamicParams.Add("@mesorderstus", "CLOSED");
+ }
+ if (mesorderstus == "NOCLOSED")
+ {
+ search += "and A.status<>@mesorderstus ";
+ dynamicParams.Add("@mesorderstus", "CLOSED");
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and A.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (mesordercode != "" && mesordercode != null)
+ {
+ search += "and A.wo_code like '%'+@mesordercode+'%' ";
+ dynamicParams.Add("@mesordercode", mesordercode);
+ }
+ if (sourceorder != "" && sourceorder != null)
+ {
+ search += "and A.m_po like '%'+@sourceorder+'%' ";
+ dynamicParams.Add("@sourceorder", sourceorder);
+ }
+ if (saleordercode != "" && saleordercode != null)
+ {
+ search += "and W.saleOrderCode like '%'+@saleordercode+'%' ";
+ dynamicParams.Add("@saleordercode", saleordercode);
+ }
+ if (ordertype != "" && ordertype != null)
+ {
+ search += "and A.wotype like '%'+@ordertype+'%' ";
+ dynamicParams.Add("@ordertype", ordertype);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and A.materiel_code like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and B.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and B.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (createdate != "" && createdate != null)
+ {
+ search += "and CONVERT(varchar(100),A.lm_date,23)=@createdate ";
+ dynamicParams.Add("@createdate", createdate);
+ }
+ if (creatuser != "" && creatuser != null)
+ {
+ search += "and U.username like '%'+@creatuser+'%' ";
+ dynamicParams.Add("@creatuser", creatuser);
+ }
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select A.id, A.status,A.wotype,A.wo_code,A.materiel_code as partcode,B.partname,B.partspec,A.plan_qty,A.wkshp_code,C.torg_name as wkshp_name,
+ A.stck_code,D.name as stck_name,A.plan_startdate,A.plan_enddate,A.piroque,A.sourceid,A.m_po,A.saleOrderDeliveryDate,W.saleOrderCode,U.username as lm_user,A.lm_date,A.data_sources,
+ B.priuserdefnvc1,B.priuserdefnvc2,B.priuserdefnvc3,B.priuserdefnvc4,B.priuserdefnvc5,B.priuserdefnvc6
+ from TK_Wrk_Man A
+ left join TKimp_Ewo W on A.m_po=W.wo and A.materiel_code=W.materiel_code
+ left join TMateriel_Info B on A.materiel_code=B.partcode
+ left join TOrganization C on A.wkshp_code=C.torg_code
+ left join TSecStck D on A.stck_code=D.code
+ left join TUser U on A.lm_user=U.usercode
+ left join TOrganization L on C.parent_id=L.id
+ where A.is_delete<>'1' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[MES宸ュ崟鎵归噺鍏抽棴鎻愪氦]
+ public static ToMessage MesOrderBitchClosedSeave(User us, string[] wocodelist)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ for (int i = 0; i < wocodelist.Length; i++)
+ {
+ //鍏抽棴宸ュ崟瀵瑰簲宸ュ簭浠诲姟
+ sql = @"update TK_Wrk_Step set status='CLOSED' where wo_code in @wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocodelist } });
+ //鍥炲啓宸ュ崟琛ㄧ姸鎬佷负(鍏抽棴)
+ sql = @"update TK_Wrk_Man set status='CLOSED',closeuser=@username,closedate=@closedate where wo_code in @wocode";
+ list.Add(new { str = sql, parm = new { wocode = wocodelist, username = us.usercode, closedate = DateTime.Now.ToString() } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鍏抽棴", "鍏抽棴浜嗗伐鍗�:" + string.Join(",", wocodelist), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "宸ュ崟鍏抽棴鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "宸ュ崟鍏抽棴澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(鑷埗)]
+ public static ToMessage MesOrderStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ var total = 0; //鎬绘潯鏁�
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and B.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ string[] arra = wocode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+
+ if (ordercode != "" && (stepcode == null || stepcode == "")) //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂负绌�
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ }
+ if (ordercode != "" && stepcode != "") //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂笉涓虹┖
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ search += "and S.stepcode=@stepcode ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ }
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭灞炴��
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "W")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓哄鍗忓伐搴忎换鍔�,璇峰墠寰�澶栧崗鎿嶄綔椤电鎵ц!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and M.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and M.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and M.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟(鑷埗宸ュ簭)
+ sql = @"select A.id,A.status,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend,
+ S.stepcode,S.stepname,S.descr,A.plan_quantity,A.plan_qty,A.good_qty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,B.lm_date,
+ M.priuserdefnvc1,M.priuserdefnvc2,M.priuserdefnvc3,M.priuserdefnvc4,M.priuserdefnvc5,M.priuserdefnvc6
+ from TK_Wrk_Step A
+ left join TK_Wrk_Man B on A.wo_code=B.wo_code
+ left join TMateriel_Info M on B.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TOrganization T on B.wkshp_code=T.torg_code
+ where A.status in('ALLO','START') and S.flwtype='Z' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.count = total;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.ToList();
+ return mes;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(澶栧崗)]
+ public static ToMessage MesOrderWxStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ var total = 0; //鎬绘潯鏁�
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and B.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ string[] arra = wocode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+
+ if (ordercode != "" && (stepcode == null || stepcode == "")) //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂负绌�
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ }
+ if (ordercode != "" && stepcode != "") //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂笉涓虹┖
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ search += "and S.stepcode=@stepcode ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ }
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭灞炴��
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "Z")
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓鸿嚜鍒跺伐搴忎换鍔�,璇峰墠寰�鑷埗鎿嶄綔椤电鎵ц!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and M.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and M.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and M.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟(鑷埗宸ュ簭)
+ sql = @"select A.id,A.status,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend,
+ S.stepcode,S.stepname,S.descr,A.plan_quantity,A.plan_qty,A.good_qty,A.ng_qty,
+ (select isnull(sum(fqty),0) as fqty from TK_Wrk_OutRecord where wo_code=A.wo_code and step_code=A.step_code and style='F') as fqty,
+ A.laborbad_qty,A.materielbad_qty,A.plan_startdate,A.plan_enddate,B.lm_date,
+ M.priuserdefnvc1,M.priuserdefnvc2,M.priuserdefnvc3,M.priuserdefnvc4,M.priuserdefnvc5,M.priuserdefnvc6
+ from TK_Wrk_Step A
+ left join TK_Wrk_Man B on A.wo_code=B.wo_code
+ left join TMateriel_Info M on B.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TOrganization T on B.wkshp_code=T.torg_code
+ where A.status in('ALLO','START') and S.flwtype='W' " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.count = total;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.ToList();
+ return mes;
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇)]
+ public static ToMessage MesOrderNgStepSearch(string wkshopcode, string wocode, string partcode, string partname, string partspec, int startNum, int endNum, string prop, string order)
+ {
+ var sql = "";
+ string search = "";
+ string ordercode = "";
+ string stepcode = "";
+ var dynamicParams = new DynamicParameters();
+ var total = 0; //鎬绘潯鏁�
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and B.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wocode != "" && wocode != null)
+ {
+ string[] arra = wocode.Split(';');
+ if (arra.Length == 1) //宸ュ崟鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+ if (arra.Length == 2) //宸ュ崟鍙�+宸ュ簭鍙蜂簩缁寸爜
+ {
+ ordercode = arra[0]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ stepcode = arra[1]; //鑾峰彇鎸囧畾瀛楃涓插墠闈㈢殑瀛楃
+ }
+
+ if (ordercode != "" && (stepcode == null || stepcode == "")) //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂负绌�
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ }
+ if (ordercode != "" && stepcode != "") //宸ュ崟鍙蜂笉涓虹┖,宸ュ簭鍙蜂笉涓虹┖
+ {
+ search += "and A.wo_code=@ordercode ";
+ dynamicParams.Add("@ordercode", ordercode);
+ search += "and S.stepcode=@stepcode ";
+ dynamicParams.Add("@stepcode", stepcode);
+ }
+ }
+ if (stepcode != "")
+ {
+ //鏌ユ壘褰撳墠宸ュ簭浠诲姟
+ sql = @"select * from TK_Wrk_Step where step_code=@stepcode and wo_code=@ordercode";
+ dynamicParams.Add("@stepcode", stepcode);
+ dynamicParams.Add("@ordercode", ordercode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�,鏃犳晥鏉$爜!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and M.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and M.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and M.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭浠诲姟(鑷埗宸ュ簭)
+ sql = @"select A.id,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isend,
+ S.stepcode,S.stepname,S.descr,A.plan_quantity,A.plan_qty,A.good_qty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,B.lm_date,
+ M.priuserdefnvc1,M.priuserdefnvc2,M.priuserdefnvc3,M.priuserdefnvc4,M.priuserdefnvc5,M.priuserdefnvc6
+ from TK_Wrk_Step A
+ left join TK_Wrk_Man B on A.wo_code=B.wo_code
+ left join TMateriel_Info M on B.materiel_code=M.partcode
+ left join TStep S on A.step_code=S.stepcode
+ left join TOrganization T on B.wkshp_code=T.torg_code
+ where A.status in('ALLO','START') and A.ng_qty>0 " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.count = total;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.ToList();
+ return mes;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐鎵爜鑾峰彇宸ュ崟瀵瑰簲宸ュ簭浠诲姟(涓嶈壇鏄庣粏)]
+ public static ToMessage MesOrderNgSubStepSearch(string wocode, string stepcode)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ var dynamicParams1 = new DynamicParameters();
+ Dictionary<string, object> list = new Dictionary<string, object>();
+ ScanStartReportData rt = new ScanStartReportData();
+ try
+ {
+ //1.鏍规嵁宸ュ崟+宸ュ簭鏌ユ壘褰撳墠宸ュ簭鏄惁棣栭亾宸ュ簭
+ sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.seq,T.flwtype,T.descr,A.status,
+ A.plan_quantity,A.plan_qty,A.good_qty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,A.isbott,A.isend
+ from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TMateriel_Info P on M.materiel_code=P.partcode
+ where A.wo_code=@ordercode and A.step_code=@stepcode";
+ dynamicParams.Add("@ordercode", wocode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ rt.wo_code = data.Rows[0]["wo_code"].ToString(); //宸ュ崟鍙�
+ rt.partnumber = data.Rows[0]["partcode"].ToString(); //浜у搧缂栫爜
+ rt.partname = data.Rows[0]["partname"].ToString(); //浜у搧鍚嶇О
+ rt.partspec = data.Rows[0]["partspec"].ToString(); //浜у搧瑙勬牸
+ rt.stepcode = data.Rows[0]["stepcode"].ToString(); //宸ュ簭缂栫爜
+ rt.stepname = data.Rows[0]["stepname"].ToString(); //宸ュ簭鍚嶇О
+ rt.stepdesc = data.Rows[0]["descr"].ToString(); //宸ュ簭鎻忚堪
+ rt.planqty = decimal.Parse(data.Rows[0]["plan_qty"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.planquantity= decimal.Parse(data.Rows[0]["plan_quantity"].ToString()); //浠诲姟鏁伴噺
+ rt.noreportqty = decimal.Parse(data.Rows[0]["good_qty"].ToString()); //鎶ュ伐鏁伴噺
+ rt.noputqty = decimal.Parse(data.Rows[0]["ng_qty"].ToString()); //涓嶈壇鏁伴噺
+ string isend = data.Rows[0]["isend"].ToString();//鏈亾宸ュ簭
+ rt.seq = data.Rows[0]["seq"].ToString();//宸ュ簭搴忓彿
+
+ //鑾峰彇褰撳墠宸ュ簭涓嬮亾宸ュ簭
+ sql = @"select A.isbott,A.isend,T.stepcode,T.stepname from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq+1 ";
+ dynamicParams.Add("@ordercode", wocode);
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["seq"].ToString()));
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0) //鏈変笅閬撳伐搴�
+ {
+ rt.nextstepcode = dt0.Rows[0]["stepcode"].ToString();//涓嬮亾宸ュ簭缂栫爜
+ rt.nextstepname = dt0.Rows[0]["stepname"].ToString();//涓嬮亾宸ュ簭鍚嶇О
+ }
+ if (isend == "Y") //褰撳墠宸ュ簭鏄湯閬撳伐搴�
+ {
+ rt.nextstepcode = "";//璧嬬┖
+ rt.nextstepname = "";//璧嬬┖
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ //鏍规嵁鏉′欢鏌ヨ宸ュ崟宸ュ簭鎶ュ伐(鏀舵枡)璁板綍,涓斾笉鑹暟閲忓ぇ浜�0
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_MesReportDefectHandleSelect";
+ dynamicParams1.Add("@ordercode", wocode);
+ dynamicParams1.Add("@stepcode", stepcode);
+ DataTable dt = DapperHelper.selectProcedure(sql, dynamicParams1);
+ if (dt.Rows.Count > 0)
+ {
+ list.Add("data1", rt);
+ list.Add("data2", dt);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = list;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏃犲彲鎵ц鐨勭敓浜т换鍔�,浠诲姟宸插畬鎴愭垨宸插叧闂�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [鐢熶骇寮�鎶ュ伐锛氭姤宸�/澶栧崗(鍙戞枡/鏀舵枡)鏃舵潯浠跺垽鏂強鏁版嵁杩斿洖鎺ュ彛]
+ public static ToMessage MesOrderStepStart(string OperType, string SelectType, string wocode, string stepcode, User us)
+ {
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool isOrder = dynObj.isOrder;
+ switch (OperType)
+ {
+ case "ZZ":
+ if (isOrder) //鎸夊簭鐢熶骇
+ {
+ mes = ScanStartReport.ZZEncodingSeach(wocode, stepcode);
+ }
+ else //涓嶆寜搴忕敓浜�
+ {
+ mes = ScanStartReport.NoZZEncodingSeach(wocode, stepcode);
+ }
+ break;
+ case "WX":
+ if (isOrder) //鎸夊簭鏀跺彂鏂�
+ {
+ mes = ScanStartReport.WXEncodingSeach(SelectType, wocode, stepcode);
+ }
+ else //涓嶆寜搴忔敹鍙戞枡
+ {
+ mes = ScanStartReport.NoWXEncodingSeach(SelectType, wocode, stepcode);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鎶ュ伐鎻愪氦]
+ public static ToMessage SavaMesOrderStepReport(string mesordercode, string partcode, string stepseq, string stepcode, string stepprice, string eqpcode, string inbarcode, string reckway, string usergroupcode, string reportuser,string payrate, string taskqty, string startqty, string reportqty, List<ReportDefectList> defectobjs, string remarks, User us)
+ {
+ var sql = "";
+ decimal ngqty = 0;
+ string[] arra1 = new string[] { };
+ List<object> list0 = new List<object>();
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ //鑾峰彇鎶ュ伐浜哄憳銆佸垎閰嶆瘮渚�
+ //JArray arra = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(reportuser);
+ //鍒ゆ柇鏄惁鏈変笉鑹暟鎹�
+ var groupedItems = defectobjs.GroupBy(item => item.defect_code) // 鎸夌紪鐮乧ode鍒嗙粍
+ .Select(group => new { defect_code = group.Key, badqty = group.Sum(item => Convert.ToDecimal(item.badqty)) }).ToList(); // 姹囨�讳笉鑹暟閲�
+ if (groupedItems.Count <= 0)
+ {
+ ngqty = 0;
+ }
+ else
+ {
+ //姹囨�讳笉鑹暟閲�
+ ngqty = groupedItems.Sum(item => Convert.ToDecimal(item.badqty));
+ }
+ list.Clear();
+ //鍒ゆ柇鏄惁鏈夊紑宸ヨ褰�(鏃犳柊澧�)
+ sql = @"select * from TK_Wrk_Record where wo_code=@wo_code and step_code=@step_code and style='S' and eqp_code=@eqpcode";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count <= 0)
+ {
+ //鍐欏叆寮�鎶ュ伐璁板綍琛�
+ sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,step_price,eqp_code,materiel_code,open_person,open_time,task_qty,start_qty,style,lm_user,lm_date)
+ values(@mesordercode,@stepseq,@stepcode,@step_price,@eqpcode,@partcode,@username,@opentime,@taskqty,@startqty,@style,@lm_user,@lm_date)";
+ list0.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price = stepprice, eqpcode = eqpcode, partcode = partcode, username = us.usercode, opentime = date, taskqty = taskqty, startqty = startqty, style = "S", lm_user = us.usercode, lm_date = date } });
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄧ姸鎬佷负START: 寮�宸�
+ sql = @"update TK_Wrk_Step set status='START' where wo_code=@mesordercode and step_code=@stepcode";
+ list0.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode } });
+
+ //鍥炲啓宸ュ崟琛ㄧ姸鎬佷负锛� 寮�宸ワ細START
+ sql = @"update TK_Wrk_Man set status='START' where wo_code=@mesordercode";
+ list0.Add(new { str = sql, parm = new { mesordercode = mesordercode } });
+ bool st = DapperHelper.DoTransaction(list0);
+ if (st)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "寮�宸�", "寮�宸ヤ簡宸ュ崟:" + mesordercode + "宸ュ簭:" + stepcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+
+ //鍒ゆ柇鏄惁鏈夋姤宸ヨ褰�(鏈夛細淇敼 鏃狅細鏂板)
+ sql = @"select * from TK_Wrk_Record where wo_code=@wo_code and step_code=@step_code and style='B'";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ ////鑾峰彇寮�宸ヨ褰曠殑榛樿閫変腑鐨勮澶�(浜х嚎)涓庢姤宸ユ椂鐨勮澶囦骇绾垮仛瀵规瘮鍒ゆ柇
+ //sql = @"select A.eqp_code,B.name from TK_Wrk_Record A
+ // inner join TEqpInfo B on A.eqp_code=B.code
+ // where A.wo_code=@wo_code and A.step_code=@step_code and eqp_code=@eqpcode and A.style='S'";
+ //dynamicParams.Add("@wo_code", mesordercode);
+ //dynamicParams.Add("@step_code", stepcode);
+ //dynamicParams.Add("@eqpcode", eqpcode);
+ //var da = DapperHelper.selectdata(sql, dynamicParams);
+ //if (da.Rows[0]["EQP_CODE"].ToString() != eqpcode)
+ //{
+ // mes.code = "300";
+ // mes.count = 0;
+ // mes.message = "鎿嶄綔澶辫触,褰撳墠鎶ュ伐浜х嚎搴斾负锛�" + da.Rows[0]["NAME"].ToString() + "!";
+ // mes.data = null;
+ // return mes;
+ //}
+ if (data.Rows.Count > 0)
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_Record')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+
+ //鍐欏叆寮�鎶ュ伐璁板綍琛�
+ sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,step_price,eqp_code,materiel_code,task_qty,start_qty,good_qty,ng_qty,style,lm_user,lm_date,inbarcode)
+ values(@mesordercode,@stepseq,@stepcode,@step_price,@eqpcode,@partcode,@taskqty,@startqty,@reportqty,@ngqty,@style,@lm_user,@lm_date,@inbarcode)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price = stepprice, eqpcode = eqpcode, partcode = partcode, taskqty = taskqty, startqty = startqty, reportqty = reportqty, ngqty = ngqty, style = "B", lm_user = us.usercode, lm_date = date, inbarcode = inbarcode } });
+
+ //鍐欏叆瀛愯〃
+ sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,payrate,report_person,report_date,report_qty,reckway,usergroup_code,ratio,ng_qty,style,lm_user,lm_date)
+ values(@m_id,@eqp_code,@payrate,@report_person,@report_date,@report_qty,@reckway,@usergroup_code,@ratio,@ng_qty,@style,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(dt.Rows[0]["ID"].ToString()),
+ eqp_code = eqpcode,
+ payrate= payrate,
+ report_person = reportuser,
+ report_date = date,
+ report_qty = reportqty,
+ reckway = reckway,
+ usergroup_code = usergroupcode,
+ ratio = 0, //鍒嗛厤姣斾緥
+ ng_qty = ngqty,
+ style = "B",
+ lm_user = us.usercode,
+ lm_date = date
+ }
+ });
+ if (groupedItems.Count > 0)
+ {
+ //鍐欏叆缂洪櫡璁板綍琛�
+ for (int i = 0; i < groupedItems.Count; i++)
+ {
+ sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_pendqty,defect_code,remarks,style,lm_user,lm_date)
+ values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_pendqty,@defect_code,@remarks,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = groupedItems[i].badqty, defect_pendqty = groupedItems[i].badqty, defect_code = groupedItems[i].defect_code, remarks = remarks, style = "B", lm_user = us.usercode, lm_date = date } });
+
+ }
+ }
+ }
+ else
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_Record')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆寮�鎶ュ伐璁板綍琛�
+ sql = @"insert into TK_Wrk_Record(wo_code,step_seq,step_code,step_price,eqp_code,materiel_code,task_qty,start_qty,good_qty,ng_qty,style,lm_user,lm_date,inbarcode)
+ values(@mesordercode,@stepseq,@stepcode,@step_price,@eqpcode,@partcode,@taskqty,@startqty,@reportqty,@ngqty,@style,@lm_user,@lm_date,@inbarcode)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, step_price = stepprice, eqpcode = eqpcode, partcode = partcode, taskqty = taskqty, startqty = startqty, reportqty = reportqty, ngqty = ngqty, style = "B", lm_user = us.usercode, lm_date = date, inbarcode = inbarcode } });
+
+ //鍐欏叆瀛愯〃
+ sql = @"insert into TK_Wrk_RecordSub(m_id,eqp_code,payrate,report_person,report_date,report_qty,reckway,usergroup_code,ratio,ng_qty,style,lm_user,lm_date)
+ values(@m_id,@eqp_code,@payrate,@report_person,@report_date,@report_qty,@reckway,@usergroup_code,@ratio,@ng_qty,@style,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(dt.Rows[0]["ID"].ToString()),
+ eqp_code = eqpcode,
+ payrate= payrate,
+ report_person = reportuser,
+ report_date = date,
+ report_qty = reportqty,
+ reckway = reckway,
+ usergroup_code = usergroupcode,
+ ratio = 0, //鍒嗛厤姣斾緥
+ ng_qty = ngqty,
+ style = "B",
+ lm_user = us.usercode,
+ lm_date = date
+ }
+ });
+ if (groupedItems.Count > 0)
+ {
+ //鍐欏叆缂洪櫡璁板綍琛�
+ for (int i = 0; i < groupedItems.Count; i++)
+ {
+ sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_pendqty,defect_code,remarks,style,lm_user,lm_date)
+ values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_pendqty,@defect_code,@remarks,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = groupedItems[i].badqty, defect_pendqty = groupedItems[i].badqty, defect_code = groupedItems[i].defect_code, remarks = remarks, style = "B", lm_user = us.usercode, lm_date = date } });
+
+ }
+ }
+ }
+
+
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ sql = @"update TK_Wrk_Step set good_qty=good_qty+@reportqty,ng_qty=ng_qty+@ngqty where wo_code=@mesordercode and step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, reportqty = reportqty, ngqty = ngqty } });
+
+ //鍥炲啓宸ュ崟琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ //sql = @"update TK_Wrk_Man set good_qty=good_qty+@reportqty,ng_qty=ng_qty+@ngqty where wo_code=@mesordercode";
+ //list.Add(new { str = sql, parm = new { mesordercode = mesordercode, reportqty = reportqty, ngqty = ngqty } });
+
+ //鍐欏叆ERP鍏ュ簱鍗�
+
+ //鍒ゆ柇鏄惁鏈亾宸ュ簭瀹屽伐鎶ュ伐(鑷姩鍏抽棴宸ュ崟鍙婂伐搴忎换鍔�)
+ //list = AutosCloseOrder.AutosColseOrderReport(list,mesordercode, partcode, stepseq,stepcode,reportqty,ngqty);
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鎶ュ伐", "鎶ュ伐浜嗗伐鍗�:" + mesordercode + "宸ュ簭:" + stepcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鍙戞枡鎻愪氦]
+ public static ToMessage SavaMesOrderStepOut(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string outuser, string taskqty, string fqty, User us)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ list.Clear();
+ //鍒ゆ柇鏄惁鏈夊彂鏂欒褰�(鏈�(鍚屽伐鍗�+宸ュ簭+澶栧崗渚涙柟淇敼) 鏃狅細鏂板)
+ sql = @"select * from TK_Wrk_OutRecord where wo_code=@wo_code and step_code=@step_code and wx_code=@wx_code and style='F'";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ dynamicParams.Add("@wx_code", wxcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ //淇敼鍙戞枡璁板綍
+ sql = @"update TK_Wrk_OutRecord set fqty=fqty+@fqty,lm_user=@username,lm_date=@CreateDate
+ where wo_code=@mesordercode and step_code=@stepcode and wx_code=@wx_code and style='F'";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, wx_code = wxcode, fqty = decimal.Parse(fqty), username = us.usercode, CreateDate = date } });
+ //鍐欏叆瀛愯〃
+ sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,out_person,out_time,fqty,style,lm_user,lm_date)
+ values(@m_id,@wx_code,@out_person,@out_time,@fqty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { m_id = int.Parse(data.Rows[0]["ID"].ToString()), wx_code = wxcode, out_person = outuser, out_time = date, fqty = fqty, style = 'F', lm_user = us.usercode, lm_date = date } });
+ }
+ else
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_OutRecord')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆澶栧崗璁板綍涓昏〃
+ sql = @"insert into TK_Wrk_OutRecord(wo_code,step_seq,step_code,wx_code,materiel_code,style,fqty,lm_user,lm_date)
+ values(@mesordercode,@stepseq,@stepcode,@wx_code,@partcode,@style,@fqty,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, wx_code = wxcode, partcode = partcode, style = 'F', fqty = fqty, lm_user = us.usercode, lm_date = date } });
+
+ //鍐欏叆瀛愯〃
+ sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,out_person,out_time,fqty,style,lm_user,lm_date)
+ values(@m_id,@wx_code,@out_person,@out_time,@fqty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { m_id = int.Parse(dt.Rows[0]["ID"].ToString()), wx_code = wxcode, out_person = outuser, out_time = date, fqty = fqty, style = 'F', lm_user = us.usercode, lm_date = date } });
+ }
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄧ姸鎬佷负START: 寮�宸�
+ sql = @"update TK_Wrk_Step set status='START' where wo_code=@mesordercode and step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode } });
+
+
+ //鍥炲啓宸ュ崟琛ㄧ姸鎬佷负锛� 寮�宸ワ細START
+ sql = @"update TK_Wrk_Man set status='START' where wo_code=@mesordercode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode } });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "澶栧崗鍙戞枡", "澶栧崗鍙戞枡宸ュ崟:" + mesordercode + "宸ュ簭:" + stepcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鍙戞枡鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鍙戞枡澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐,鏀舵枡鎻愪氦]
+ public static ToMessage SavaMesOrderStepIn(string mesordercode, string partcode, string stepseq, string stepcode, string wxcode, string inbarcode, string inuser, string taskqty, string sqty, List<ReportDefectList> defectobjs, string remarks, User us)
+ {
+ var sql = "";
+ string[] arra1 = new string[] { };
+ decimal ngqty = 0;
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ //鍒ゆ柇鏄惁鏈変笉鑹暟鎹�
+ var groupedItems = defectobjs.GroupBy(item => item.defect_code) // 鎸夌紪鐮乧ode鍒嗙粍
+ .Select(group => new { defect_code = group.Key, badqty = group.Sum(item => Convert.ToDecimal(item.badqty)) }).ToList(); // 姹囨�绘暟閲弎ty
+ if (groupedItems.Count <= 0)
+ {
+ ngqty = 0;
+ }
+ else
+ {
+ //姹囨�讳笉鑹暟閲�
+ ngqty = groupedItems.Sum(item => Convert.ToDecimal(item.badqty));
+ }
+
+ list.Clear();
+ //鍒ゆ柇鏄惁鏈夋敹鏂欒褰�(鏈夛細锛堝悓宸ュ崟+宸ュ簭+澶栧崗渚涙柟淇敼锛� 鏃狅細鏂板)
+ sql = @"select * from TK_Wrk_OutRecord where wo_code=@wo_code and step_code=@step_code and wx_code=@wx_code and style='S'";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ dynamicParams.Add("@wx_code", wxcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ //鑾峰彇鍙戞枡璁板綍鐨勯粯璁ら�変腑鐨勫鍗忎緵搴斿晢涓庢敹鏂欐椂鐨勫鍗忎緵搴斿晢鍋氬姣斿垽鏂�
+ sql = @"select A.wx_code,B.name,A.fqty from TK_Wrk_OutRecord A
+ inner join TCustomer B on A.wx_code=B.code
+ where A.wo_code=@wo_code and A.step_code=@step_code and wx_code=@wx_code and A.style='F' ";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ dynamicParams.Add("@wx_code", wxcode);
+ var da = DapperHelper.selectdata(sql, dynamicParams);
+ if (da.Rows.Count <= 0)
+ {
+ sql = @"select A.wx_code,B.name,A.fqty from TK_Wrk_OutRecord A
+ inner join TCustomer B on A.wx_code=B.code
+ where A.wo_code=@wo_code and A.step_code=@step_code and A.style='F' ";
+ dynamicParams.Add("@wo_code", mesordercode);
+ dynamicParams.Add("@step_code", stepcode);
+ var da1 = DapperHelper.selectdata(sql, dynamicParams);
+ var dr = da1.AsEnumerable().ToList().Select(x => x.Field<string>("NAME")).ToList();
+ string wxstring = (string.Join(",", dr.Select(x => x.ToString()).ToArray()));
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡澶栧崗渚涙柟涓庡彂鏂欏鍗忎緵搴斿晢涓嶅尮閰�,搴斾负锛氥��" + wxstring + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ if ((decimal.Parse(sqty) + ngqty) > decimal.Parse(da.Rows[0]["FQTY"].ToString())) //鏀舵枡鏁伴噺+涓嶈壇鏁伴噺>鍙戞枡鏁伴噺
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺,涓嶈兘澶т簬鍙戞枡鏁伴噺:" + da.Rows[0]["FQTY"].ToString() + "!";
+ mes.data = null;
+ return mes;
+ }
+ //if (da.Rows[0]["WX_CODE"].ToString() != wxcode)
+ //{
+ // mes.code = "300";
+ // mes.count = 0;
+ // mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡澶栧崗渚涙柟搴斾负锛�" + da.Rows[0]["NAME"].ToString() + "!";
+ // mes.data = null;
+ // return mes;
+ //}
+ if (data.Rows.Count > 0)
+ {
+ decimal sum_sqty = data.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum(); //鑾峰彇鍚屽崟鍙�,鍚屽伐搴�,鍚屽鍗忎緵搴斿晢鏀舵枡鎬绘暟閲�
+ decimal sum_fqty = da.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum(); //鑾峰彇鍚屽崟鍙�,鍚屽伐搴�,鍚屽鍗忎緵搴斿晢鍙戞枡鎬绘暟閲�
+ if ((sum_sqty + decimal.Parse(sqty) + ngqty) > sum_fqty) //宸叉敹鏂欐�绘暟+褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺>鎬诲彂鏂欐暟閲�
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触,褰撳墠鏀舵枡鏁伴噺+涓嶈壇鏁伴噺,涓嶈兘澶т簬寰呮敹鏁伴噺:" + (sum_fqty - sum_sqty) + "!";
+ mes.data = null;
+ return mes;
+ }
+
+
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_OutRecord')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆澶栧崗璁板綍涓昏〃
+ sql = @"insert into TK_Wrk_OutRecord(wo_code,step_seq,step_code,wx_code,materiel_code,style,sqty,ng_qty,lm_user,lm_date,inbarcode)
+ values(@mesordercode,@stepseq,@stepcode,@wx_code,@partcode,@style,@sqty,@ngqty,@lm_user,@lm_date,@inbarcode)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, wx_code = wxcode, partcode = partcode, style = 'S', sqty = sqty, ngqty = ngqty, lm_user = us.usercode, lm_date = date, inbarcode = inbarcode } });
+
+ //鍐欏叆澶栧崗璁板綍瀛愯〃
+ sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,in_person,in_time,sqty,ng_qty,style,lm_user,lm_date)
+ values(@m_id,@wxcode,@in_person,@in_time,@sqty,@ng_qty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { m_id = int.Parse(dt.Rows[0]["ID"].ToString()), wxcode = wxcode, in_person = inuser, in_time = date, sqty = sqty, ng_qty = ngqty, style = "S", lm_user = us.usercode, lm_date = date } });
+
+ if (groupedItems.Count > 0)
+ {
+ //鍐欏叆缂洪櫡璁板綍琛�
+ for (int i = 0; i < groupedItems.Count; i++)
+ {
+ sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_pendqty,defect_code,remarks,style,lm_user,lm_date)
+ values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_pendqty,@defect_code,@remarks,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = groupedItems[i].badqty, defect_pendqty = groupedItems[i].badqty, defect_code = groupedItems[i].defect_code, remarks = remarks, style = "S", lm_user = us.usercode, lm_date = date } });
+
+ }
+ }
+ }
+ else
+ {
+ //鑾峰彇涓昏〃鏈�澶D
+ sql = @"select ISNULL(IDENT_CURRENT('TK_Wrk_OutRecord')+1,1) as id";
+ var dt = DapperHelper.selecttable(sql);
+ //鍐欏叆澶栧崗璁板綍涓昏〃
+ sql = @"insert into TK_Wrk_OutRecord(wo_code,step_seq,step_code,wx_code,materiel_code,style,sqty,ng_qty,lm_user,lm_date,inbarcode)
+ values(@mesordercode,@stepseq,@stepcode,@wx_code,@partcode,@style,@sqty,@ngqty,@lm_user,@lm_date,@inbarcode)";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepseq = stepseq, stepcode = stepcode, wx_code = wxcode, partcode = partcode, style = 'S', sqty = sqty, ngqty = ngqty, lm_user = us.usercode, lm_date = date, inbarcode = inbarcode } });
+
+ //鍐欏叆澶栧崗璁板綍瀛愯〃
+ sql = @"insert into TK_Wrk_OutRecordSub(m_id,wx_code,in_person,in_time,sqty,ng_qty,style,lm_user,lm_date)
+ values(@m_id,@wxcode,@in_person,@in_time,@sqty,@ng_qty,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { m_id = int.Parse(dt.Rows[0]["ID"].ToString()), wxcode = wxcode, in_person = inuser, in_time = date, sqty = sqty, ng_qty = ngqty, style = "S", lm_user = us.usercode, lm_date = date } });
+
+ if (groupedItems.Count > 0)
+ {
+ //鍐欏叆缂洪櫡璁板綍琛�
+ for (int i = 0; i < groupedItems.Count; i++)
+ {
+ sql = @"insert into CSR_WorkRecord_Defect(record_id,wo_code,partnumber,step_seq,step_code,defect_qty,defect_pendqty,defect_code,remarks,style,lm_user,lm_date)
+ values(@record_id,@wo_code,@partcode,@stepseq,@stepcode,@ngqty,@defect_pendqty,@defect_code,@remarks,@style,@lm_user,@lm_date)";
+ list.Add(new { str = sql, parm = new { record_id = int.Parse(dt.Rows[0]["ID"].ToString()), wo_code = mesordercode, partcode = partcode, stepseq = stepseq, stepcode = stepcode, ngqty = groupedItems[i].badqty, defect_pendqty = groupedItems[i].badqty, defect_code = groupedItems[i].defect_code, remarks = remarks, style = "S", lm_user = us.usercode, lm_date = date } });
+
+ }
+ }
+ }
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ sql = @"update TK_Wrk_Step set good_qty=good_qty+@sqty,ng_qty=ng_qty+@ngqty where wo_code=@mesordercode and step_code=@stepcode";
+ list.Add(new { str = sql, parm = new { mesordercode = mesordercode, stepcode = stepcode, sqty = sqty, ngqty = ngqty } });
+
+ //鍥炲啓宸ュ崟琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ //sql = @"update TK_Wrk_Man set good_qty=good_qty+@sqty,ng_qty=ng_qty+@ngqty where wo_code=@mesordercode";
+ //list.Add(new { str = sql, parm = new { mesordercode = mesordercode, sqty = sqty, ngqty = ngqty } });
+
+ ////鍐欏叆ERP鍏ュ簱鍗�
+
+ //鍒ゆ柇鏄惁鏈亾宸ュ簭瀹屽伐鎶ュ伐(鑷姩鍏抽棴宸ュ崟鍙婂伐搴忎换鍔�)
+ //list = AutosCloseOrder.AutosColseOrderReport(list, mesordercode, partcode, stepseq, stepcode, sqty, ngqty);
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "澶栧崗鏀舵枡", "澶栧崗鏀舵枡宸ュ崟:" + mesordercode + "宸ュ簭:" + stepcode, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏀舵垚鍔�!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏀舵枡澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[涓嶈壇澶勭悊,鎻愪氦]
+ public static ToMessage EditOrderNgStepSeave(ReportDefectHandle json, User us)
+ {
+ var sql = "";
+ string[] arra1 = new string[] { };
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ decimal sumrepair_qty = 0, sumlaborbad_qty = 0, summaterielbad_qty = 0; //绱缁翠慨鏁伴噺銆佺疮璁″伐搴熸暟閲忋�佺疮璁℃枡搴熸暟閲�
+ try
+ {
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ list.Clear();
+
+
+ //寰幆json鏁版嵁
+ for (int i = 0; i < json.Data.Rows.Count; i++)
+ {
+ //鑷埗宸ュ簭
+ if (json.Data.Rows[i]["STYLE"].ToString() == "Z")
+ {
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曞瓙琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佸伐搴熸暟閲忋�佹枡搴熸暟閲�
+ sql = @"update TK_Wrk_RecordSub set report_qty=report_qty+@repair_qty,ng_qty=ng_qty-@repair_qty-@laborbad_qty-@materielbad_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where m_id=@m_id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json.Data.Rows[i]["M_ID"].ToString()),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString())
+ }
+ });
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_Record set good_qty=good_qty+@repair_qty,ng_qty=ng_qty-@repair_qty-@laborbad_qty-@materielbad_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ step_code = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ id = int.Parse(json.Data.Rows[i]["M_ID"].ToString())
+ }
+ });
+ //鍥炲啓缂洪櫡璁板綍琛ㄧ殑寰呭鐞嗘暟閲�
+ sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty-@repair_qty-@laborbad_qty-@materielbad_qty, defect_pendqty=defect_pendqty-@repair_qty-@laborbad_qty-@materielbad_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ step_code = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ id = int.Parse(json.Data.Rows[i]["ID"].ToString())
+ }
+ });
+ //鍒ゆ柇缂洪櫡璁板綍澶勭悊琛ㄦ槸鍚﹀瓨鍦ㄨ褰�
+ sql = @"select * from CSR_WorkRecord_DefectHandle where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id";
+ dynamicParams.Add("@wo_code", json.Data.Rows[i]["WO_CODE"].ToString());
+ dynamicParams.Add("@step_code", json.Data.Rows[i]["STEP_CODE"].ToString());
+ dynamicParams.Add("@defect_id", json.Data.Rows[i]["ID"].ToString());
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ //鍐欏叆鎶ュ伐缂洪櫡澶勭悊璁板綍琛�
+ sql = @"insert into CSR_WorkRecord_DefectHandle(defect_id,wo_code,partnumber,step_seq,step_code,repair_qty,laborbad_qty,materielbad_qty,defect_code,style,lm_user,lm_date)
+ values(@defect_id,@wo_code,@partcode,@stepseq,@stepcode,@repair_qty,@laborbad_qty,@materielbad_qty,@defect_code,@style,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ partcode = json.Data.Rows[i]["MATERIEL_CODE"].ToString(),
+ stepseq = json.Data.Rows[i]["SEQ"].ToString(),
+ stepcode = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()),
+ defect_code = json.Data.Rows[i]["DEFECT_CODE"].ToString(),
+ style = "B",
+ lm_user = us.usercode,
+ lm_date = date
+ }
+ });
+ }
+ else
+ {
+ //鏇存柊鎶ュ伐缂洪櫡澶勭悊璁板綍琛�
+ sql = @"update CSR_WorkRecord_DefectHandle set repair_qty=repair_qty+@repair_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ step_code = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString())
+ }
+ });
+ }
+
+ sumrepair_qty = sumrepair_qty + decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString());
+ sumlaborbad_qty = sumlaborbad_qty + decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString());
+ summaterielbad_qty = summaterielbad_qty + decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString());
+ }
+ //澶栧崗宸ュ簭
+ if (json.Data.Rows[i]["STYLE"].ToString() == "S")
+ {
+ //鍥炲啓瀵瑰簲鐨勬敹鏂欒褰曞瓙琛ㄦ敹鏂欐暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_OutRecordSub set sqty=sqty+@repair_qty,ng_qty=ng_qty-@repair_qty-@laborbad_qty-@materielbad_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where m_id=@m_id and style='S'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json.Data.Rows[i]["M_ID"].ToString()),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString())
+ }
+ });
+ //鍥炲啓瀵瑰簲鐨勬敹鏂欒褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_OutRecord set sqty=sqty+@repair_qty,ng_qty=ng_qty-@repair_qty-@laborbad_qty-@materielbad_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='S'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ step_code = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ id = int.Parse(json.Data.Rows[i]["M_ID"].ToString())
+ }
+ });
+ //鍥炲啓缂洪櫡璁板綍琛ㄧ殑寰呭鐞嗘暟閲�
+ sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty-@repair_qty-@laborbad_qty-@materielbad_qty,defect_pendqty=defect_pendqty-@repair_qty-@laborbad_qty-@materielbad_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='S'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ step_code = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ id = int.Parse(json.Data.Rows[i]["ID"].ToString())
+ }
+ });
+ //鍒ゆ柇缂洪櫡璁板綍澶勭悊琛ㄦ槸鍚﹀瓨鍦ㄨ褰�
+ sql = @"select * from CSR_WorkRecord_DefectHandle where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id";
+ dynamicParams.Add("@wo_code", json.Data.Rows[i]["WO_CODE"].ToString());
+ dynamicParams.Add("@step_code", json.Data.Rows[i]["STEP_CODE"].ToString());
+ dynamicParams.Add("@defect_id", json.Data.Rows[i]["ID"].ToString());
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ //鍐欏叆鎶ュ伐缂洪櫡澶勭悊璁板綍琛�
+ sql = @"insert into CSR_WorkRecord_DefectHandle(defect_id,wo_code,partnumber,step_seq,step_code,repair_qty,laborbad_qty,materielbad_qty,defect_code,style,lm_user,lm_date)
+ values(@defect_id,@wo_code,@partcode,@stepseq,@stepcode,@repair_qty,@laborbad_qty,@materielbad_qty,@defect_code,@style,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ partcode = json.Data.Rows[i]["MATERIEL_CODE"].ToString(),
+ stepseq = json.Data.Rows[i]["SEQ"].ToString(),
+ stepcode = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString()),
+ defect_code = json.Data.Rows[i]["DEFECT_CODE"].ToString(),
+ style = "S",
+ lm_user = us.usercode,
+ lm_date = date
+ }
+ });
+ }
+ else
+ {
+ //鏇存柊鎶ュ伐缂洪櫡澶勭悊璁板綍琛�
+ sql = @"update CSR_WorkRecord_DefectHandle set repair_qty=repair_qty+@repair_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ defect_id = int.Parse(json.Data.Rows[i]["ID"].ToString()),
+ wo_code = json.Data.Rows[i]["WO_CODE"].ToString(),
+ step_code = json.Data.Rows[i]["STEP_CODE"].ToString(),
+ repair_qty = decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString()),
+ laborbad_qty = decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString()),
+ materielbad_qty = decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString())
+ }
+ });
+ }
+ sumrepair_qty = sumrepair_qty + decimal.Parse(json.Data.Rows[i]["REPAIR_QTY"].ToString());
+ sumlaborbad_qty = sumlaborbad_qty + decimal.Parse(json.Data.Rows[i]["LABORBAD_QTY"].ToString());
+ summaterielbad_qty = summaterielbad_qty + decimal.Parse(json.Data.Rows[i]["MATERIELBAD_QTY"].ToString());
+ }
+ }
+
+ //鍥炲啓宸ュ崟宸ュ簭琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲�
+ sql = @"update TK_Wrk_Step set good_qty=good_qty+@sumrepair_qty,ng_qty=ng_qty-@sumrepair_qty-@sumlaborbad_qty-@summaterielbad_qty,laborbad_qty=laborbad_qty+@sumlaborbad_qty,materielbad_qty=materielbad_qty+@summaterielbad_qty
+ where wo_code=@wo_code and step_code=@stepcode";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ wo_code = json.Data.Rows[0]["WO_CODE"].ToString(),
+ stepcode = json.Data.Rows[0]["STEP_CODE"].ToString(),
+ sumrepair_qty = sumrepair_qty,
+ sumlaborbad_qty = sumlaborbad_qty,
+ summaterielbad_qty = summaterielbad_qty
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "涓嶈壇澶勭悊", "宸ュ崟:" + json.Data.Rows[0]["WO_CODE"].ToString() + "宸ュ簭:" + json.Data.Rows[0]["STEP_CODE"].ToString(), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鎿嶄綔鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鎿嶄綔澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鏁版嵁鏌ヨ鎺ュ彛]
+ public static ToMessage MesOrderStepVerifySearch(string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wo_code != "" && wo_code != null)
+ {
+ search += "and AA.wo_code like '%'+@wo_code+'%' ";
+ dynamicParams.Add("@wo_code", wo_code);
+ }
+ if (partnumber != "" && partnumber != null)
+ {
+ search += "and AA.partnumber like '%'+@partnumber+'%' ";
+ dynamicParams.Add("@partnumber", partnumber);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and AA.usercode like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (reportdateopendate != "" && reportdateopendate != null)
+ {
+ search += "and AA.report_date between @reportdateopendate and @reportdateclosedate ";
+ dynamicParams.Add("@reportdateopendate", reportdateopendate + " 00:00:00");
+ dynamicParams.Add("@reportdateclosedate", reportdateclosedate + " 23:59:59");
+ }
+
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鑷埗鎶ュ伐澶栧崗鏀舵枡鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name,
+ A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name,
+ B.report_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.report_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.report_date,B.report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,'' as wx_code,'' as wx_name
+ from TK_Wrk_Record A
+ inner join TK_Wrk_RecordSub B on A.id=B.m_id
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code=S.stepcode
+ left join TMateriel_Info P on A.materiel_code=P.partcode
+ left join TOrganization T on M.wkshp_code=T.torg_code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TGroup G on G.usergroupcode=B.usergroup_code
+ where A.style='B' and B.style='B' and M.status<>'CLOSED' and A.verify='N'
+ union all
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name,
+ A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name,
+ B.in_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.in_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,A.wx_code,C.name as wx_name
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_OutRecordSub B on A.id = B.m_id
+ left join TK_Wrk_Man M on A.wo_code = M.wo_code
+ left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code = S.stepcode
+ left join TMateriel_Info P on A.materiel_code = P.partcode
+ left join TOrganization T on M.wkshp_code = T.torg_code
+ left join TCustomer E on A.wx_code = E.code
+ left join TCustomer C on A.wx_code=C.code
+ where A.style = 'S' and B.style = 'S' and M.status<>'CLOSED' and A.verify='N'
+ ) as AA where" + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鑾峰彇閫夊畾鎶ュ伐璁板綍鐨勪笉鑹暟鎹甝
+ public static ToMessage MesOrderStepModelSearch(string wo_code, string step_code, string step_type, string isbott, string isend, string id, string sbid)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (step_type == "Z")
+ {
+ sql = @"select D.id,D.record_id,D.defect_code,
+ STUFF((SELECT ',' + F.name
+ FROM TDefect F
+ WHERE CHARINDEX(',' + F.code + ',', ',' + D.defect_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS defect_name,
+ D.defect_qty,laborbad_qty,materielbad_qty
+ from CSR_WorkRecord_Defect D
+ where wo_code=@wo_code and step_code=@step_code and record_id=@id";
+ dynamicParams.Add("@wo_code", wo_code);
+ dynamicParams.Add("@step_code", step_code);
+ dynamicParams.Add("@id", id);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+
+ }
+ if (step_type == "W")
+ {
+ sql = @"select D.id,D.record_id,D.defect_code,
+ STUFF((SELECT ',' + F.name
+ FROM TDefect F
+ WHERE CHARINDEX(',' + F.code + ',', ',' + D.defect_code + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS defect_name,
+ D.defect_qty,laborbad_qty,materielbad_qty
+ from CSR_WorkRecord_Defect D
+ where wo_code=@wo_code and step_code=@step_code and record_id=@id";
+ dynamicParams.Add("@wo_code", wo_code);
+ dynamicParams.Add("@step_code", step_code);
+ dynamicParams.Add("@id", id);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐璋冩暣鏁版嵁鎻愪氦]
+ public static ToMessage MesOrderStepUpdateSeave(User us, List<UpdateProductReport> json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ dynamic dynObj = JObject.Parse(us.mesSetting);
+ bool isOrder = dynObj.isOrder;
+ //鑾峰彇姝ゆ鎶ュ伐璋冩暣鎻愪氦鐨勬暟鎹�(鍚堟牸鏁伴噺銆佷笉鑹暟閲忋�佸伐搴熸暟閲忋�佹枡搴熸暟閲�)
+ decimal this_reportqty = decimal.Parse(json[0].report_qty.ToString()); //鎶ュ伐鏁伴噺(鍚堟牸)
+ decimal this_ngqty = json[0].children.Sum(item => decimal.Parse(item.ng_qty));//涓嶈壇鏁伴噺姹囨��
+ decimal this_laborbadqty = json[0].children.Sum(item => decimal.Parse(item.laborbad_qty));//宸ュ簾鏁伴噺姹囨��
+ decimal this_materielbadqty = json[0].children.Sum(item => decimal.Parse(item.materielbad_qty));//鏂欏簾鏁伴噺姹囨��
+ decimal this_ng_dvalue = json[0].children.Sum(item => decimal.Parse(item.ng_dvalue));//涓嶈壇鏁伴噺宸�兼眹鎬�
+ decimal this_laborbad_dvalue = json[0].children.Sum(item => decimal.Parse(item.laborbad_dvalue));//宸ュ簾鏁伴噺宸�兼眹鎬�
+ decimal this_materielbad_dvalue = json[0].children.Sum(item => decimal.Parse(item.materielbad_dvalue));//鏂欏簾鏁伴噺宸�兼眹鎬�
+ string date = DateTime.Now.ToString(); //鑾峰彇绯荤粺鏃堕棿
+ if (isOrder) //鎸夊簭
+ {
+ //鎺у埗閫昏緫锛氶閬撳伐搴忚皟鏁�-> 鏈亾宸ュ簭褰撳墠璋冩暣鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)+鏈亾宸ュ簭闈炲綋鍓嶆姤宸ユ�绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)>浠诲姟鏁伴噺 ==涓嶈兘澶т簬浠诲姟鏁伴噺
+ //鎺у埗閫昏緫锛氶閬撳伐搴忚皟鏁�-> (鏈亾宸ュ簭褰撳墠璋冩暣鍚堟牸鏁�+鏈亾宸ュ簭闈炲綋鍓嶆姤宸ュ悎鏍兼�绘暟)<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾) ==涓嶈兘灏忎簬涓嬮亾鎶ュ伐鎬绘暟
+ //鎺у埗閫昏緫锛氭湯閬撳伐搴忚皟鏁�-> 鏈亾宸ュ簭褰撳墠璋冩暣鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)+鏈亾宸ュ簭闈炲綋鍓嶆姤宸ユ�绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)>涓婇亾宸ュ簭鎶ュ伐鍚堟牸鎬绘暟 ==涓嶈兘澶т簬涓婇亾宸ュ簭鎶ュ伐鍚堟牸鎬绘暟
+ //鎺у埗閫昏緫锛氫腑闂村伐搴忚皟鏁�-> 鏈亾宸ュ簭褰撳墠璋冩暣鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)+鏈亾宸ュ簭闈炲綋鍓嶆姤宸ユ�绘暟(鍚堟牸+涓嶈壇+鎶ュ簾)>涓婇亾宸ュ簭鎶ュ伐鍚堟牸鎬绘暟 ==涓嶈兘澶т簬涓婇亾宸ュ簭鎶ュ伐鍚堟牸鎬绘暟
+ //鎺у埗閫昏緫锛氫腑闂村伐搴忚皟鏁�-> (鏈亾宸ュ簭褰撳墠璋冩暣鍚堟牸鏁�+鏈亾宸ュ簭闈炲綋鍓嶆姤宸ュ悎鏍兼�绘暟)<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾) ==涓嶈兘灏忎簬涓嬮亾鎶ュ伐鎬绘暟
+
+
+ list.Clear();
+ //鑾峰彇褰撳墠宸ュ簭涓婇亾宸ュ簭鍙婂睘鎬�
+ sql = @"select T.stepcode,T.stepname,T.flwtype from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq-1 ";
+ dynamicParams.Add("@ordercode", json[0].wo_code);
+ dynamicParams.Add("@seq", json[0].step_seq);
+ var pre = DapperHelper.selectdata(sql, dynamicParams);
+ //鑾峰彇褰撳墠宸ュ簭涓嬮亾宸ュ簭鍙婂睘鎬�
+ sql = @"select T.stepcode,T.stepname,T.flwtype from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq+1 ";
+ dynamicParams.Add("@ordercode", json[0].wo_code);
+ dynamicParams.Add("@seq", json[0].step_seq);
+ var next = DapperHelper.selectdata(sql, dynamicParams);
+ //鍒ゆ柇褰撳墠宸ュ簭鏄嚜鍒跺伐搴忚繕鏄鍗忓伐搴�
+ if (json[0].flw_type.ToString() == "Z")//鑷埗宸ュ簭
+ {
+ //棣栭亾宸ュ簭鐨勬姤宸�
+ if (json[0].first_choke == "Y")
+ {
+ //鏌ヨ褰撳墠棣栭亾鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and id<>@id and step_code=@step_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�讳笉鑹暟
+ decimal notthis_laborbadqty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�诲伐搴熸暟
+ decimal notthis_materielbadqty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘枡搴熸暟
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細鏈鎶ュ伐鏁伴噺+鏈涓嶈壇鏁伴噺+鏈宸ュ簾鏁伴噺+鏈鏂欏簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟>宸ュ崟浠诲姟鏁伴噺
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbadqty + notthis_materielbadqty;
+ if (updatereportsumqty > decimal.Parse(json[0].task_qty.ToString()))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝换鍔¤秴浜ф�绘暟閲忥細銆�" + json[0].task_qty.ToString() + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪涓嬮亾宸ュ簭鍙婂睘鎬�
+ if (next.Rows.Count > 0)
+ {
+ if (next.Rows[0]["flwtype"].ToString() == "Z")
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+宸ュ簾鎬绘暟閲�+鏂欏簾鎬绘暟閲�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�+涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉皬浜庝笅閬撹嚜鍒跺伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氬彂鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬绘暟閲�
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鍙戞枡鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠棣栭亾宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉皬浜庝笅閬撳鍗忓伐搴忓彂鏂欐�绘暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+
+ }
+ //鏈亾宸ュ簭鐨勬姤宸�
+ else if (json[0].last_choke == "Y")
+ {
+ //鏌ヨ褰撳墠鏈亾鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and id<>@id and step_code=@step_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_laborbad_qty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ュ伐搴熸�绘暟
+ decimal notthis_materielbad_qty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ枡搴熸�绘暟
+ //鑾峰彇褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲忥細鏈淇敼鎶ュ伐鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鎶ュ伐鏂欏簾鏁伴噺+褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆℃枡搴熸�绘暟
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbad_qty + notthis_materielbad_qty;
+
+ //鍒ゆ柇鏄惁瀛樺湪涓婇亾宸ュ簭鍙婂睘鎬�
+ if (pre.Rows.Count > 0)
+ {
+ if (pre.Rows[0]["flwtype"].ToString() == "Z")
+ {
+ //鏌ヨ褰撳墠鏈亾宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓婇亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓婇亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓婇亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲�>涓婇亾宸ュ簭鎶ュ伐鍚堟牸鎬绘暟
+ if (updatereportsumqty > last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏈亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘敹鏂欐暟閲�
+ sql = @"select isnull(sum(sqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭敹鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬绘暟閲�
+ //鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠鏈亾宸ュ簭鎶ュ伐鎬绘暟閲�>涓婇亾宸ュ簭鏀舵枡鍚堟牸鎬绘暟
+ if (updatereportsumqty > last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏈亾宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔敹鏂欐�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ }
+ else //涓棿宸ュ簭鐨勬姤宸�
+ {
+ //鏌ヨ褰撳墠涓棿鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and id<>@id and step_code=@step_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_laborbad_qty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ュ伐璐规�绘暟
+ decimal notthis_materielbad_qty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ枡搴熸�绘暟
+ //鑾峰彇褰撳墠涓棿宸ュ簭鎶ュ伐鎬绘暟閲忥細鏈淇敼鎶ュ伐鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鏂欏簾鎬绘暟+褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbad_qty + notthis_materielbad_qty;
+
+ //鍒ゆ柇鏄惁瀛樺湪涓婇亾宸ュ簭鍙婂睘鎬�
+ if (pre.Rows.Count > 0)
+ {
+ if (pre.Rows[0]["flwtype"].ToString() == "Z")
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鎶ュ伐鎬诲悎鏍兼暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓婇亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓婇亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString());//涓婇亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細褰撳墠宸ュ簭鎶ュ伐鎬绘暟>涓婇亾宸ュ簭鎶ュ伐鎬诲悎鏍兼暟
+ if (updatereportsumqty > last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔姤宸ユ�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓婇亾宸ュ簭锛氭�绘敹鏂欐暟閲�
+ sql = @"select isnull(sum(sqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and step_seq=@step_seq-1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭敹鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓婇亾宸ュ簭鏀舵枡鎬诲悎鏍兼暟閲�
+ //鍒ゆ柇锛氬綋鍓嶆湯閬撳伐搴忔姤宸ヨ褰曪細褰撳墠宸ュ簭鎶ュ伐鎬绘暟閲�>涓婇亾宸ュ簭鏀舵枡鎬诲悎鏍兼暟閲�
+ if (updatereportsumqty > last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝笂閬撳伐搴忔敹鏂欐�诲悎鏍兼暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ //鍒ゆ柇鏄惁瀛樺湪涓嬮亾宸ュ簭灞炴��
+ if (next.Rows.Count > 0)
+ {
+ if (next.Rows[0]["flwtype"].ToString() == "Z")
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt1.Rows.Count > 0)
+ {
+ decimal last_reportqty = decimal.Parse(dt1.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt1.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt1.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt1.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬诲悎鏍兼暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉皬浜庝笅閬撳伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氬彂鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬诲悎鏍兼暟閲�
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鎶ュ伐鎬诲悎鏍兼暟+鏈鎶ュ伐璋冩暣鍚堟牸鏁帮級<涓嬮亾宸ュ簭鍙戞枡鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉ぇ浜庝笅閬撳伐搴忓彂鏂欐�绘暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ }
+ }
+ if (json[0].flw_type.ToString() == "W")//澶栧崗宸ュ簭
+ {
+ //鏌ヨ褰撳墠棣栭亾宸ュ簭闈炴娆′緵搴斿晢鏀舵枡锛氭�绘敹鏂欐暟閲�
+ sql = @"select isnull(sum(sqty),0) as sqty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code<>@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
+ var dt_c = DapperHelper.selectdata(sql, dynamicParams);
+
+ //鑾峰彇褰撳墠宸ュ簭銆佷緵搴斿晢瀵瑰簲鐨勫彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as fqty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and id<>@id and step_code=@step_code and wx_code=@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
+ var dt_0 = DapperHelper.selectdata(sql, dynamicParams);
+ //棣栭亾宸ュ簭鐨勬敹鏂�
+ if (json[0].first_choke == "Y")
+ {
+ //鏌ヨ褰撳墠棣栭亾宸ュ簭闈炴娆℃敹鏂欙細鎬绘敹鏂欐暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code=@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�讳笉鑹暟
+ decimal notthis_laborbadqty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�诲伐搴熸暟
+ decimal notthis_materielbadqty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘枡搴熸暟
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細鏈鏀舵枡鏁伴噺+鏈涓嶈壇鏁伴噺+鏈宸ュ簾鏁伴噺+鏈鏂欏簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟>鍙戞枡鏁伴噺
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbadqty + notthis_materielbadqty;
+ if (updatereportsumqty > decimal.Parse(dt_0.Rows[0]["fqty"].ToString()))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠澶栧崗宸ュ簭瀵瑰簲渚涘簲鍟嗘敹鏂欐�绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡彂鏂欐暟閲忥細銆�" + decimal.Parse(dt_0.Rows[0]["fqty"].ToString()) + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪涓嬮亾宸ュ簭鍙婂睘鎬�
+ if (next.Rows.Count > 0)
+ {
+ if (next.Rows[0]["flwtype"].ToString() == "Z")
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+宸ュ簾鎬绘暟閲�+鏂欏簾鎬绘暟閲�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�+涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鏀舵枡鏁�+鏈鏀舵枡璋冩暣鏁�+闈炲綋鍓嶄緵搴斿晢鍚屽伐搴忔敹鏂欐�绘暟锛�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
+ if ((notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠澶栧崗宸ュ簭鏀舵枡鏁伴噺锛氥��" + (notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) + "銆戜笉鑳藉皬浜庝笅閬撹嚜鍒跺伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氬彂鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬绘暟閲�
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鏀舵枡鏁�+鏈鎶ュ伐璋冩暣鏀舵枡鏁帮級<涓嬮亾宸ュ簭鍙戞枡鎬绘暟
+ if ((notthis_reportqty + this_reportqty) < last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠澶栧崗宸ュ簭鏀舵枡鎬绘暟閲忥細銆�" + (notthis_reportqty + this_reportqty) + "銆戜笉鑳藉皬浜庝笅閬撳鍗忓伐搴忓彂鏂欐�绘暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+
+ }
+ //鏈亾宸ュ簭鐨勬姤宸�
+ else if (json[0].last_choke == "Y")
+ {
+ //鏌ヨ褰撳墠鏈亾鎶ュ伐宸ュ簭闈炴娆℃敹鏂欙細鎬绘敹鏂欐暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code=@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃敹鏂欐�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_laborbad_qty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ュ伐搴熸�绘暟
+ decimal notthis_materielbad_qty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ枡搴熸�绘暟
+ //鑾峰彇褰撳墠鏈亾宸ュ簭鏀舵枡鎬绘暟閲忥細鏈淇敼鏀舵枡鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鎶ュ伐鏂欏簾鏁伴噺+褰撳墠鏈亾宸ュ簭闈炴湰娆℃敹鏂欐�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠鏈亾宸ュ簭闈炴湰娆℃枡搴熸�绘暟
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbad_qty + notthis_materielbad_qty;
+ //鍒ゆ柇褰撳墠宸ュ簭渚涘簲鍟嗘敹鏂欐�绘暟>褰撳墠宸ュ簭渚涘簲鍟嗗搴斿彂鏂欐暟閲�
+ if (updatereportsumqty > decimal.Parse(dt_0.Rows[0]["fqty"].ToString()))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭渚涘簲鍟嗘敹鏂欐�绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡伐搴忎緵搴斿晢鍙戞枡鎬绘暟閲忥細銆�" + decimal.Parse(dt_0.Rows[0]["fqty"].ToString()) + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ else //涓棿宸ュ簭鐨勬姤宸�
+ {
+
+ //鏌ヨ褰撳墠棣栭亾宸ュ簭渚涘簲鍟嗛潪姝ゆ鏀舵枡锛氭�绘敹鏂欐暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code=@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�讳笉鑹暟
+ decimal notthis_laborbadqty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�诲伐搴熸暟
+ decimal notthis_materielbadqty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘枡搴熸暟
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細鏈鏀舵枡鏁伴噺+鏈涓嶈壇鏁伴噺+鏈宸ュ簾鏁伴噺+鏈鏂欏簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟>鍙戞枡鏁伴噺
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbadqty + notthis_materielbadqty;
+ if (updatereportsumqty > decimal.Parse(dt_0.Rows[0]["fqty"].ToString()))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠澶栧崗宸ュ簭瀵瑰簲渚涘簲鍟嗘敹鏂欐�绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡彂鏂欐暟閲忥細銆�" + decimal.Parse(dt_0.Rows[0]["fqty"].ToString()) + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪涓嬮亾宸ュ簭鍙婂睘鎬�
+ if (next.Rows.Count > 0)
+ {
+ if (next.Rows[0]["flwtype"].ToString() == "Z")
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�绘姤搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氭姤宸ユ�绘暟鏁伴噺+涓嶈壇鎬绘暟鏁伴噺+宸ュ簾鎬绘暟閲�+鏂欏簾鎬绘暟閲�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�+涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�+涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�+涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鎶ュ伐鎬绘暟閲�
+ decimal last_ngqty = decimal.Parse(dt0.Rows[0]["ng_qty"].ToString()); //涓嬮亾宸ュ簭涓嶈壇鎬绘暟閲�
+ decimal last_laborbad_qty = decimal.Parse(dt0.Rows[0]["laborbad_qty"].ToString()); //涓嬮亾宸ュ簭宸ュ簾鎬绘暟閲�
+ decimal last_materielbad_qty = decimal.Parse(dt0.Rows[0]["materielbad_qty"].ToString()); //涓嬮亾宸ュ簭鏂欏簾鎬绘暟閲�
+ decimal last_updatereportsumqty = last_reportqty + last_ngqty + last_laborbad_qty + last_materielbad_qty;
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鏀舵枡鏁�+鏈鏀舵枡璋冩暣鏁�+闈炲綋鍓嶄緵搴斿晢鍚屽伐搴忔敹鏂欐�绘暟锛�<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟
+ if ((notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) < last_updatereportsumqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠澶栧崗宸ュ簭鏀舵枡鏁伴噺锛氥��" + (notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) + "銆戜笉鑳藉皬浜庝笅閬撹嚜鍒跺伐搴忔姤宸ユ�绘暟閲忥細銆�" + last_updatereportsumqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ褰撳墠宸ュ簭涓嬮亾宸ュ簭锛氭�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as good_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and step_seq=@step_seq+1";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@step_seq", json[0].step_seq);
+ var dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count > 0)
+ {
+ //鍒ゆ柇褰撳墠宸ュ簭锛氬彂鏂欐�绘暟鏁伴噺
+ decimal last_reportqty = decimal.Parse(dt0.Rows[0]["good_qty"].ToString()); //涓嬮亾宸ュ簭鍙戞枡鎬绘暟閲�
+ //鍒ゆ柇锛堝綋鍓嶉潪鏈鏀舵枡鏁�+鏈鎶ュ伐璋冩暣鏀舵枡鏁�+闈炲綋鍓嶄緵搴斿晢鍚屽伐搴忔敹鏂欐�绘暟锛�<涓嬮亾宸ュ簭鍙戞枡鎬绘暟
+ if ((notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) < last_reportqty)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠澶栧崗宸ュ簭鏀舵枡鎬绘暟閲忥細銆�" + (notthis_reportqty + this_reportqty + decimal.Parse(dt_c.Rows[0]["sqty"].ToString())) + "銆戜笉鑳藉皬浜庝笅閬撳鍗忓伐搴忓彂鏂欐�绘暟閲忥細銆�" + last_reportqty + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else //涓嶆寜搴�
+ {
+ //鎺у埗閫昏緫锛氬綋鍓嶅伐搴忔姤宸ヨ皟鏁�-> (鏈亾宸ュ簭褰撳墠璋冩暣鍚堟牸鏁�+鏈亾宸ュ簭闈炲綋鍓嶆姤宸ュ悎鏍兼�绘暟)<涓嬮亾宸ュ簭鎶ュ伐鎬绘暟(鍚堟牸+涓嶈壇+鎶ュ簾) ==涓嶈兘灏忎簬涓嬮亾鎶ュ伐鎬绘暟
+ list.Clear();
+ //鍒ゆ柇褰撳墠宸ュ簭鏄嚜鍒跺伐搴忚繕鏄鍗忓伐搴�
+ if (json[0].flw_type.ToString() == "Z")
+ {
+
+ //鏌ヨ褰撳墠鎶ュ伐宸ュ簭闈炴娆℃姤宸ワ細鎬绘姤宸ユ暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(good_qty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_Record where wo_code=@wo_code and style='B' and id<>@id and step_code=@step_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�讳笉鑹暟
+ decimal notthis_laborbadqty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�诲伐搴熸暟
+ decimal notthis_materielbadqty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘枡搴熸暟
+ //鍒ゆ柇锛氬綋鍓嶅伐搴忔姤宸ヨ褰曪細鏈鎶ュ伐鏁伴噺+鏈涓嶈壇鏁伴噺+鏈宸ュ簾鏁伴噺+鏈鏂欏簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃姤宸ユ�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟>宸ュ崟浠诲姟鏁伴噺
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbadqty + notthis_materielbadqty;
+ if (updatereportsumqty > decimal.Parse(json[0].task_qty.ToString()))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭淇敼鎶ュ伐鎬绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庝换鍔¤秴浜ф�绘暟閲忥細銆�" + json[0].task_qty.ToString() + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (json[0].flw_type.ToString() == "W")
+ {
+ //鑾峰彇褰撳墠宸ュ簭銆佷緵搴斿晢瀵瑰簲鐨勬�诲彂鏂欐暟閲�
+ sql = @"select isnull(sum(fqty),0) as fqty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='F' and id<>@id and step_code=@step_code and wx_code=@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ dynamicParams.Add("@wx_code", json[0].wxcode);
+ var dt_0 = DapperHelper.selectdata(sql, dynamicParams);
+
+ //鏌ヨ褰撳墠宸ュ簭闈炴娆℃敹鏂欙細鎬绘敹鏂欐暟閲忋�佹�讳笉鑹暟閲忋�佹�诲伐搴熸暟閲忋�佹�绘枡搴熸暟閲�
+ sql = @"select isnull(sum(sqty),0) as good_qty,isnull(sum(ng_qty),0) as ng_qty,isnull(sum(laborbad_qty),0) as laborbad_qty,isnull(sum(materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord where wo_code=@wo_code and style='S' and id<>@id and step_code=@step_code and wx_code=@wx_code";
+ dynamicParams.Add("@wo_code", json[0].wo_code);
+ dynamicParams.Add("@id", json[0].id);
+ dynamicParams.Add("@step_code", json[0].step_code);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ decimal notthis_reportqty = decimal.Parse(dt.Rows[0]["good_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃敹鏂欐�绘暟
+ decimal notthis_ngqty = decimal.Parse(dt.Rows[0]["ng_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ�绘暟
+ decimal notthis_laborbad_qty = decimal.Parse(dt.Rows[0]["laborbad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ュ伐搴熸�绘暟
+ decimal notthis_materielbad_qty = decimal.Parse(dt.Rows[0]["materielbad_qty"].ToString()); //褰撳墠鏈亾宸ュ簭闈炴湰娆℃姤宸ユ枡搴熸�绘暟
+ //鑾峰彇褰撳墠鏈亾宸ュ簭鏀舵枡鎬绘暟閲忥細鏈淇敼鏀舵枡鏁伴噺+鏈淇敼涓嶈壇鏁伴噺+鏈淇敼宸ュ簾鏁伴噺+鏈淇敼鎶ュ伐鏂欏簾鏁伴噺+褰撳墠宸ュ簭闈炴湰娆℃敹鏂欐�绘暟+褰撳墠宸ュ簭闈炴湰娆′笉鑹�绘暟+褰撳墠宸ュ簭闈炴湰娆″伐搴熸�绘暟+褰撳墠宸ュ簭闈炴湰娆℃枡搴熸�绘暟
+ decimal updatereportsumqty = this_reportqty + this_ngqty + this_laborbadqty + this_materielbadqty + notthis_reportqty + notthis_ngqty + notthis_laborbad_qty + notthis_materielbad_qty;
+ //鍒ゆ柇褰撳墠宸ュ簭渚涘簲鍟嗘敹鏂欐�绘暟>褰撳墠宸ュ簭渚涘簲鍟嗗搴斿彂鏂欐暟閲�
+ if (updatereportsumqty > decimal.Parse(dt_0.Rows[0]["fqty"].ToString()))
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭渚涘簲鍟嗘敹鏂欐�绘暟閲忥細銆�" + updatereportsumqty + "銆戜笉鑳藉ぇ浜庡伐搴忎緵搴斿晢鍙戞枡鎬绘暟閲忥細銆�" + decimal.Parse(dt_0.Rows[0]["fqty"].ToString()) + "銆�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+
+ switch (json[0].flw_type.ToString())
+ {
+ case "Z":
+ ///////////////////////////////淇敼鎶ュ伐//////////////////////////////
+
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曞瓙琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_RecordSub set report_qty=report_qty+@repair_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where m_id=@m_id and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json[0].id),
+ id = int.Parse(json[0].sbid),
+ repair_qty = decimal.Parse(json[0].report_dvalue),
+ ng_qty = this_ng_dvalue,
+ laborbad_qty = this_laborbad_dvalue,
+ materielbad_qty = this_materielbad_dvalue,
+ //bad_money = decimal.Parse(json[i].badmoney_dvalue),
+ updatereportuser = us.usercode,
+ updatereportdate = date
+ }
+ });
+ //鍥炲啓瀵瑰簲鐨勬姤宸ヨ褰曚富琛ㄥ悎鏍兼暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_Record set step_price=@step_price,start_qty=start_qty+@good_qty, good_qty=good_qty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ step_price=decimal.Parse(json[0].unprice),
+ good_qty = decimal.Parse(json[0].report_dvalue),
+ ng_qty = this_ng_dvalue,
+ laborbad_qty = this_laborbad_dvalue,
+ materielbad_qty = this_materielbad_dvalue,
+ wo_code = json[0].wo_code,
+ step_code = json[0].step_code,
+ id = int.Parse(json[0].id),
+ updatereportuser = us.usercode,
+ updatereportdate = date
+ }
+ });
+ //鍥炲啓宸ュ崟宸ュ簭琛�
+ sql = @"update TK_Wrk_Step set good_qty=good_qty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ good_qty = decimal.Parse(json[0].report_dvalue),
+ ng_qty = this_ng_dvalue,
+ laborbad_qty = this_laborbad_dvalue,
+ materielbad_qty = this_materielbad_dvalue,
+ wo_code = json[0].wo_code,
+ step_code = json[0].step_code
+ }
+ });
+
+ for (int i = 0; i < json[0].children.Count; i++)
+ {
+ //鍥炲啓涓嶈壇
+ sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty+@ng_qty,defect_pendqty=defect_pendqty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where wo_code=@wo_code and step_code=@step_code and id=@ng_id and record_id=@record_id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ ng_qty = decimal.Parse(json[0].children[i].ng_dvalue),
+ laborbad_qty = decimal.Parse(json[0].children[i].laborbad_dvalue),
+ materielbad_qty = decimal.Parse(json[0].children[i].materielbad_dvalue),
+ wo_code = json[0].wo_code,
+ step_code = json[0].step_code,
+ ng_id = int.Parse(json[0].children[i].ng_id),
+ record_id = json[0].id,
+ updatereportuser = us.usercode,
+ updatereportdate = date
+ }
+ });
+ //鍥炲啓涓嶈壇澶勭悊
+ sql = @"update CSR_WorkRecord_DefectHandle set laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id and style='B'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ laborbad_qty = decimal.Parse(json[0].children[i].laborbad_dvalue),
+ materielbad_qty = decimal.Parse(json[0].children[i].materielbad_dvalue),
+ wo_code = json[0].wo_code,
+ step_code = json[0].step_code,
+ defect_id = int.Parse(json[0].children[i].ng_id),
+ updatereportuser = us.usercode,
+ updatereportdate = date
+ }
+ });
+ }
+ break;
+ case "W":
+ ///////////////////////////////淇敼鎶ュ伐//////////////////////////////
+
+ //鍥炲啓瀵瑰簲鐨勫鍗忚褰曞瓙琛ㄦ敹鏂欐暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_OutRecordSub set sqty=sqty+@repair_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where m_id=@m_id and id=@id and style='S' and wx_code=@wx_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = int.Parse(json[0].id),
+ id = int.Parse(json[0].sbid),
+ repair_qty = decimal.Parse(json[0].report_dvalue),
+ ng_qty = this_ng_dvalue,
+ laborbad_qty = this_laborbad_dvalue,
+ materielbad_qty = this_materielbad_dvalue,
+ wx_code = json[0].wxcode,
+ //bad_money = decimal.Parse(json[i].badmoney_dvalue),
+ updatereportuser = us.usercode,
+ updatereportdate = date
+ }
+ });
+ //鍥炲啓瀵瑰簲鐨勬敹鏂欒褰曚富琛ㄦ敹鏂欐暟閲忋�佷笉鑹暟閲忋�佹姤搴熸暟閲�
+ sql = @"update TK_Wrk_OutRecord set step_price=@step_price,sqty=sqty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where wo_code=@wo_code and step_code=@step_code and id=@id and style='S' and wx_code=@wx_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ step_price=decimal.Parse(json[0].unprice),
+ good_qty = decimal.Parse(json[0].report_dvalue),
+ ng_qty = this_ng_dvalue,
+ laborbad_qty = this_laborbad_dvalue,
+ materielbad_qty = this_materielbad_dvalue,
+ wx_code = json[0].wxcode,
+ wo_code = json[0].wo_code,
+ step_code = json[0].step_code,
+ id = int.Parse(json[0].id),
+ updatereportuser = us.usercode,
+ updatereportdate = date
+ }
+ });
+ //鍥炲啓宸ュ崟宸ュ簭琛�
+ sql = @"update TK_Wrk_Step set good_qty=good_qty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ good_qty = decimal.Parse(json[0].report_dvalue),
+ ng_qty = this_ng_dvalue,
+ laborbad_qty = this_laborbad_dvalue,
+ materielbad_qty = this_materielbad_dvalue,
+ wo_code = json[0].wo_code,
+ step_code = json[0].step_code
+ }
+ });
+
+ for (int i = 0; i < json[0].children.Count; i++)
+ {
+ //鍥炲啓涓嶈壇
+ sql = @"update CSR_WorkRecord_Defect set defect_qty=defect_qty+@ng_qty,defect_pendqty=defect_pendqty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
+ updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
+ where wo_code=@wo_code and step_code=@step_code and id=@ng_id and record_id=@record_id and style='S'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ ng_qty = decimal.Parse(json[0].children[i].ng_dvalue),
+ laborbad_qty = decimal.Parse(json[0].children[i].laborbad_dvalue),
+ materielbad_qty = decimal.Parse(json[0].children[i].materielbad_dvalue),
+ wo_code = json[0].wo_code,
+ step_code = json[0].step_code,
+ ng_id = int.Parse(json[0].children[i].ng_id),
+ record_id = json[0].id,
+ updatereportuser = us.usercode,
+ updatereportdate = date
+ }
+ });
+ //鍥炲啓涓嶈壇澶勭悊
+ sql = @"update CSR_WorkRecord_DefectHandle set laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty
+ where wo_code=@wo_code and step_code=@step_code and defect_id=@defect_id and style='S'";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ laborbad_qty = decimal.Parse(json[0].children[i].laborbad_dvalue),
+ materielbad_qty = decimal.Parse(json[0].children[i].materielbad_dvalue),
+ wo_code = json[0].wo_code,
+ step_code = json[0].step_code,
+ defect_id = int.Parse(json[0].children[i].ng_id),
+ updatereportuser = us.usercode,
+ updatereportdate = date
+ }
+ });
+ }
+ break;
+ default:
+ break;
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鎶ュ伐璋冩暣", "宸ュ崟:" + json[0].wo_code + "宸ュ簭:" + json[0].step_code, us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "淇敼鎶ュ伐鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "淇敼鎶ュ伐澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+
+ #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鍒楄〃鏁版嵁鏌ヨ鎺ュ彛]
+ public static ToMessage MesOrderStepReportVerifySearch(string reviewstatus, string wkshopcode, string wo_code, string partnumber, string partname, string partspec, string stepname, string reportuser, string reportdateopendate, string reportdateclosedate, int startNum, int endNum, string prop, string order)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (reviewstatus != "" && reviewstatus != null)
+ {
+ search += "and AA.verify=@reviewstatus ";
+ dynamicParams.Add("@reviewstatus", reviewstatus);
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (wo_code != "" && wo_code != null)
+ {
+ search += "and AA.wo_code like '%'+@wo_code+'%' ";
+ dynamicParams.Add("@wo_code", wo_code);
+ }
+ if (partnumber != "" && partnumber != null)
+ {
+ search += "and AA.partnumber like '%'+@partnumber+'%' ";
+ dynamicParams.Add("@partnumber", partnumber);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ if (stepname != "" && stepname != null)
+ {
+ search += "and AA.stepname like '%'+@stepname+'%' ";
+ dynamicParams.Add("@stepname", stepname);
+ }
+ if (reportuser != "" && reportuser != null)
+ {
+ search += "and AA.usercode like '%'+@reportuser+'%' ";
+ dynamicParams.Add("@reportuser", reportuser);
+ }
+ if (reportdateopendate != "" && reportdateopendate != null)
+ {
+ search += "and AA.report_date between @reportdateopendate and @reportdateclosedate ";
+ dynamicParams.Add("@reportdateopendate", reportdateopendate + " 00:00:00");
+ dynamicParams.Add("@reportdateclosedate", reportdateclosedate + " 23:59:59");
+ }
+
+
+ if (search == "")
+ {
+ search = "and 1=1 ";
+ }
+ search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+ // --------------鏌ヨ鎸囧畾鑷埗鎶ュ伐澶栧崗鏀舵枡鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.eqp_code,E.name as eqp_name,
+ A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,B.reckway,B.usergroup_code,G.usergroupname as usergroup_name,
+ B.report_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.report_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.report_date,B.report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,'' as wx_code,'' as wx_name,A.verify
+ from TK_Wrk_Record A
+ inner join TK_Wrk_RecordSub B on A.id=B.m_id
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code=S.stepcode
+ left join TMateriel_Info P on A.materiel_code=P.partcode
+ left join TOrganization T on M.wkshp_code=T.torg_code
+ left join TEqpInfo E on A.eqp_code=E.code
+ left join TGroup G on G.usergroupcode=B.usergroup_code
+ where A.style='B' and B.style='B' and M.status<>'CLOSED'
+ union all
+ select A.id,B.id as sbid,A.wo_code,A.materiel_code as partnumber,P.partname,P.partspec,K.plan_quantity,K.plan_qty as task_qty,M.wkshp_code,T.torg_name as wkshp_name,A.wx_code as eqp_code,E.name as eqp_name,
+ A.step_seq,A.step_code,S.stepname,S.flwtype as steptype,k.isbott as first_choke,k.isend as last_choke,A.step_price,'person' as reckway,'' as usergroup_code,'' as usergroup_name,
+ B.in_person as usercode,
+ STUFF((SELECT ',' + U.username
+ FROM TUser U
+ WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.in_person + ',') > 0
+ FOR XML PATH('')), 1, 1, '') AS username,
+ B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,A.wx_code,C.name as wx_name,A.verify
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_OutRecordSub B on A.id = B.m_id
+ left join TK_Wrk_Man M on A.wo_code = M.wo_code
+ left join TK_Wrk_Step K on M.wo_code=K.wo_code and A.step_code=K.step_code
+ left join TStep S on A.step_code = S.stepcode
+ left join TMateriel_Info P on A.materiel_code = P.partcode
+ left join TOrganization T on M.wkshp_code = T.torg_code
+ left join TCustomer E on A.wx_code = E.code
+ left join TCustomer C on A.wx_code=C.code
+ where A.style = 'S' and B.style = 'S' and M.status<>'CLOSED'
+ ) as AA where " + search;
+ var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data.ToList();
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐瀹℃牳鏁版嵁鎻愪氦]
+ public static ToMessage MesOrderStepReportVerifySeave(User us, DataModel json)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (json.zdata.Count > 0)
+ {
+ //鍥炲啓鎶ュ伐璁板綍涓昏〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_Record set verify='Y',verifyuser=@verifyuser,verifydate=@verifydate where id in @id";
+ list.Add(new { str = sql, parm = new { verifyuser = us.usercode, verifydate = DateTime.Now.ToString(), id = json.zdata } });
+ //鍥炲啓鎶ュ伐璁板綍瀛愯〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_RecordSub set verify='Y',verifyuser=@verifyuser,verifydate=@verifydate where m_id in @id";
+ list.Add(new { str = sql, parm = new { verifyuser = us.usercode, verifydate = DateTime.Now.ToString(), id = json.zdata } });
+ }
+ if (json.wdata.Count > 0)
+ {
+ //鍥炲啓澶栧崗璁板綍涓昏〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_OutRecord set verify='Y',verifyuser=@verifyuser,verifydate=@verifydate where id in @id";
+ list.Add(new { str = sql, parm = new { verifyuser = us.usercode, verifydate = DateTime.Now.ToString(), id = json.wdata } });
+ //鍥炲啓澶栧崗璁板綍瀛愯〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_OutRecordSub set verify='Y',verifyuser=@verifyuser,verifydate=@verifydate where m_id in @id";
+ list.Add(new { str = sql, parm = new { verifyuser = us.usercode, verifydate = DateTime.Now.ToString(), id = json.wdata } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鎶ュ伐瀹℃牳", "鑷埗鎶ュ伐璁板綍id:" + string.Join(",", json.zdata), us.usertype);
+ LogHelper.DbOperateLog(us.usercode, "鎶ュ伐瀹℃牳", "澶栧崗鏀舵枡璁板綍id:" + string.Join(",", json.wdata), us.usertype);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "瀹℃牳鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀹℃牳澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鎵ц,鎶ュ伐寮冨鏁版嵁鎻愪氦]
+ public static ToMessage MesOrderStepReportNotVerifySeave(User us, string id, string steptype)
+ {
+ var sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ if (steptype == "Z")//鑷埗宸ュ簭
+ {
+ //鍥炲啓鎶ュ伐璁板綍涓昏〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_Record set verify='N',verifyuser=@verifyuser,verifydate=@verifydate where id=@id";
+ list.Add(new { str = sql, parm = new { verifyuser = "", verifydate = "", id = id } });
+ //鍥炲啓鎶ュ伐璁板綍瀛愯〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_RecordSub set verify='N',verifyuser=@verifyuser,verifydate=@verifydate where m_id=@id";
+ list.Add(new { str = sql, parm = new { verifyuser = "", verifydate = "", id = id } });
+ }
+ if (steptype == "W")//澶栧崗宸ュ簭
+ {
+ //鍥炲啓澶栧崗璁板綍涓昏〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_OutRecord set verify='N',verifyuser=@verifyuser,verifydate=@verifydate where id=@id";
+ list.Add(new { str = sql, parm = new { verifyuser = "", verifydate = "", id = id } });
+ //鍥炲啓澶栧崗璁板綍瀛愯〃瀹℃牳鐘舵�併�佸鏍镐汉銆佸鏍告椂闂�
+ sql = @"update TK_Wrk_OutRecordSub set verify='N',verifyuser=@verifyuser,verifydate=@verifydate where m_id=@id";
+ list.Add(new { str = sql, parm = new { verifyuser = "", verifydate = "", id = id } });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ if (steptype == "Z")
+ {
+ //鍐欏叆鎿嶄綔璁板綍琛�
+ LogHelper.DbOperateLog(us.usercode, "鎶ュ伐寮冨", "鑷埗鎶ュ伐璁板綍id:" + string.Join(",", id), us.usertype);
+ }
+ if (steptype == "W")
+ {
+ LogHelper.DbOperateLog(us.usercode, "鎶ュ伐寮冨", "澶栧崗鏀舵枡璁板綍id:" + string.Join(",", id), us.usertype);
+ }
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "瀹℃牳鎴愬姛!";
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "瀹℃牳澶辫触!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐢熶骇鍏ュ簱鏉$爜琛ユ墦]
+ public static ToMessage ProductInHouseLabCode(string ordercode)
+ {
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鑾峰彇鏈亾宸ュ簭鎶ュ伐鏉$爜鏁版嵁
+ sql = @"select * from(
+ select A.inbarcode,A.wo_code,P.partcode,P.partname,P.partspec,
+ A.good_qty,U.username,A.lm_date
+ from TK_Wrk_Record A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TMateriel_Info P on A.materiel_code=P.partcode
+ inner join TUser U on A.lm_user=U.usercode
+ where A.style='B' and S.isend='Y' and A.good_qty>0 and A.inbarcode<>''
+ union all
+ select A.inbarcode,A.wo_code,P.partcode,P.partname,P.partspec,
+ A.sqty as sqty,U.username,A.lm_date
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TMateriel_Info P on A.materiel_code=P.partcode
+ inner join TUser U on A.lm_user=U.usercode
+ where A.style='S' and S.isend='Y' and A.sqty>0 and A.inbarcode<>''
+ ) as AA where AA.wo_code=@ordercode";
+ dynamicParams.Add("@ordercode", ordercode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱淇℃伅鏌ヨ]
+ public static ToMessage ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec)
+ {
+ var dynamicParams = new DynamicParameters();
+ string search = "";
+ try
+ {
+ if (deptno != "" && deptno != null)
+ {
+ search += "and AA.dept_code=@deptno ";
+ dynamicParams.Add("@deptno", deptno);
+ }
+ if (saleordercode != "" && saleordercode != null)
+ {
+ search += "and AA.saleOrderCode like '%'+@saleordercode+'%' ";
+ dynamicParams.Add("@saleordercode", saleordercode);
+ }
+ if (wkshopcode != "" && wkshopcode != null)
+ {
+ search += "and AA.wkshp_code=@wkshopcode ";
+ dynamicParams.Add("@wkshopcode", wkshopcode);
+ }
+ if (erpordercode != "" && erpordercode != null)
+ {
+ search += "and AA.m_po like '%'+@erpordercode+'%' ";
+ dynamicParams.Add("@erpordercode", erpordercode);
+ }
+ if (mesordercode != "" && mesordercode != null)
+ {
+ search += "and AA.wo_code like '%'+@mesordercode+'%' ";
+ dynamicParams.Add("@mesordercode", mesordercode);
+ }
+ if (partcode != "" && partcode != null)
+ {
+ search += "and AA.partcode like '%'+@partcode+'%' ";
+ dynamicParams.Add("@partcode", partcode);
+ }
+ if (partname != "" && partname != null)
+ {
+ search += "and AA.partname like '%'+@partname+'%' ";
+ dynamicParams.Add("@partname", partname);
+ }
+ if (partspec != "" && partspec != null)
+ {
+ search += "and AA.partspec like '%'+@partspec+'%' ";
+ dynamicParams.Add("@partspec", partspec);
+ }
+ // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+ var total = 0; //鎬绘潯鏁�
+ var sql = @"select * from(
+ select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname,
+ A.step_code,T.stepname,M.wkshp_code,O.torg_name as wkshp_name,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,k.name as stockname,E.dept_id,E.dept_code,
+ E.saleOrderqty,E.qty,M.plan_qty,A.good_qty,isnull(A.inhouseqty,0) as inhouseqty,A.good_qty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style,E.voucherdate
+ from TK_Wrk_Record A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TK_Wrk_Man M on S.wo_code=M.wo_code
+ inner join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TKimp_Ewo E on M.m_po=E.wo and M.sourceid= E.id
+ left join TSecStck K on COALESCE(P.idwarehouse, E.stck_code)=K.code
+ left join TStep T on A.step_code=T.stepcode
+ left join TOrganization O on M.wkshp_code=O.torg_code
+ where A.style='B' and A.inbarcode<>'' and S.isend='Y' and A.good_qty>0
+ union all
+ select A.inbarcode,E.saleOrderid,isnull(E.saleOrderCode,'') as saleOrderCode,E.saleOrderDetailId,E.woid as mpoid,M.m_po,E.sbid,M.id as wo_id,A.wo_code,E.materiel_id,P.partcode,P.partname,P.partspec,E.unitid,E.unitcode,E.unitname,
+ A.step_code,T.stepname,M.wkshp_code,O.torg_name as wkshp_name,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,k.name as stockname,E.dept_id,E.dept_code,
+ E.saleOrderqty,E.qty,M.plan_qty,A.sqty as sqty,isnull(A.inhouseqty,0) as inhouseqty,A.sqty-isnull(A.inhouseqty,0) as stinhouseqty,M.lm_date,A.style,E.voucherdate
+ from TK_Wrk_OutRecord A
+ inner join TK_Wrk_Step S on A.wo_code=S.wo_code and A.step_code=S.step_code
+ inner join TK_Wrk_Man M on S.wo_code=M.wo_code
+ inner join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TKimp_Ewo E on M.m_po=E.wo and M.sourceid= E.id
+ left join TSecStck K on COALESCE(P.idwarehouse, E.stck_code)=K.code
+ left join TStep T on A.step_code=T.stepcode
+ left join TOrganization O on M.wkshp_code=O.torg_code
+ where A.style='S' and A.inbarcode<>'' and S.isend='Y' and A.sqty>0
+ ) as AA where AA.good_qty>AA.inhouseqty " + search;
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ mes.code = "200";
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.count = total;
+ mes.data = data;
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇鍏ュ簱鑾峰彇鍗曟嵁鍙穄
+ public static ToMessage ProductInHouseOrderCodeSearch(string rightcode)
+ {
+ try
+ {
+ mes = SeachEncodeJob.EncodingSeach(rightcode);
+ return mes;
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐣呮嵎閫歍+鐢熶骇鍏ュ簱鎻愪氦-瀛樺偍杩囩▼鐗�(閫傜敤鍚屼竴鍙版湇鍔″櫒锛屽悓涓�涓暟鎹簱)]
+ public static ToMessage TProductInHouseOrderSpSeave(InReptModel data, User us)
+ {
+ var sql = "";
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //瀛樺偍杩囩▼鍚�
+ sql = @"h_p_IFCLD_TCloudInProductOrder";
+ dynamicParams.Add("@RecordMin", dbType: DbType.Object, value: data.TableData[0]);
+ dynamicParams.Add("@RecordSub", dbType: DbType.Object, value: data.TableData[1]);
+ dynamicParams.Add("@rightcode", data.rightcode);
+ dynamicParams.Add("@incbit", data.incbit);
+ dynamicParams.Add("@username", us.usercode);
+ // 娣诲姞杈撳嚭鍙傛暟
+ dynamicParams.Add("@StatusCode", dbType: DbType.Int32, direction: ParameterDirection.Output);
+ dynamicParams.Add("@Message", dbType: DbType.String, size: 255, direction: ParameterDirection.Output);
+ bool a = DapperHelper.IsProcedure(sql, dynamicParams);
+ // 鑾峰彇杈撳嚭鍙傛暟鐨勫��
+ var statusCode = dynamicParams.Get<int>("@StatusCode");
+ var message = dynamicParams.Get<string>("@Message");
+ if (a)
+ {
+ mes.code = statusCode.ToString();
+ mes.count = 0;
+ mes.message = message;
+ mes.data = null;
+ }
+ else
+ {
+ mes.code = statusCode.ToString();
+ mes.count = 0;
+ mes.message = message;
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Dockerfile b/VueWebCoreApi/Dockerfile
new file mode 100644
index 0000000..7a6e605
--- /dev/null
+++ b/VueWebCoreApi/Dockerfile
@@ -0,0 +1,25 @@
+#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
+#For more information, please see https://aka.ms/containercompat
+
+FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
+WORKDIR /app
+EXPOSE 80
+EXPOSE 443
+
+FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
+WORKDIR /src
+COPY ["VueWebCoreApi/VueWebCoreApi.csproj", "VueWebCoreApi/"]
+RUN dotnet restore "VueWebCoreApi/VueWebCoreApi.csproj"
+COPY . .
+WORKDIR "/src/VueWebCoreApi"
+RUN dotnet build "VueWebCoreApi.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "VueWebCoreApi.csproj" -c Release -o /app/publish
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "VueWebCoreApi.dll"]
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/APSList.cs b/VueWebCoreApi/Models/APSList.cs
new file mode 100644
index 0000000..fe58772
--- /dev/null
+++ b/VueWebCoreApi/Models/APSList.cs
@@ -0,0 +1,19 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class APSList
+ {
+ public string wo_code { get; set; } //宸ュ崟缂栧彿
+ public string step_id { get; set; } //宸ュ簭缂栫爜
+ public string eqp_id { get; set; } //璁惧缂栫爜
+ public string name { get; set; } //璁惧鍚嶇О
+ public string AdvaDevicCropMob { get; set; } //绋煎姩鐜�
+ public string AdvaDevicRhythm { get; set; } //鑺傛媿
+ public string Style { get; set; } //璁惧绫诲瀷
+ public string ClassType { get; set; } //鎵�灞炵被鍨嬶紙浜х嚎銆佽澶囷級
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AdvancedSchedAlready.cs b/VueWebCoreApi/Models/AdvancedSchedAlready.cs
new file mode 100644
index 0000000..034db04
--- /dev/null
+++ b/VueWebCoreApi/Models/AdvancedSchedAlready.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AdvancedSchedAlready
+ {
+ public string eqp_code { get; set; }
+ public string time_start { get; set; }
+ public string time_end { get; set; }
+ public string status { get; set; }
+ public string alloc_qty { get; set; }
+ public string part_name { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AdvancedSchedulingDevice.cs b/VueWebCoreApi/Models/AdvancedSchedulingDevice.cs
new file mode 100644
index 0000000..2aecf7d
--- /dev/null
+++ b/VueWebCoreApi/Models/AdvancedSchedulingDevice.cs
@@ -0,0 +1,28 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AdvancedSchedulingDevice
+ {
+ public string wo_code { get; set; }
+ public string YearDate { get; set; }
+ public List<AdvancedSchedulingDeviceCont> children { get; set; }
+
+ }
+ public class AdvancedSchedulingDeviceCont
+ {
+
+ public string AdvaDevicNumber { get; set; }
+ public string AdvaDevicName { get; set; }
+ public string AdvaDevicCropMob { get; set; }
+ public string AdvaDevicRhythm { get; set; }
+ public string OneStartDate { get; set; }
+ public string TwoStartDate { get; set; }
+ public string ThreeStartDate { get; set; }
+ public string FourStartDate { get; set; }
+ public string FiveStartDate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AlreadyScheduling.cs b/VueWebCoreApi/Models/AlreadyScheduling.cs
new file mode 100644
index 0000000..e769edf
--- /dev/null
+++ b/VueWebCoreApi/Models/AlreadyScheduling.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AlreadyScheduling
+ {
+ public string AlreDevicNumber { get; set; } //璁惧缂栫爜
+ public string AlreStartDate { get; set; } //寮�濮嬫椂闂�
+ public string AlreEndDate { get; set; } //缁撴潫鏃堕棿
+ public string AlreQty { get; set; } //鏁伴噺
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AnDnDate.cs b/VueWebCoreApi/Models/AnDnDate.cs
new file mode 100644
index 0000000..426f0bb
--- /dev/null
+++ b/VueWebCoreApi/Models/AnDnDate.cs
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AnDnDate
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ public List<AnDnDateSub> children { get; set; }//瀛愯妭鐐�
+ }
+ public class AnDnDateSub
+ {
+ public string rid { get; set; } //鏋佸厜鎺ㄩ�佺敤鎴穒d
+ public string alias { get; set; } //鏋佸厜鎺ㄩ�佹寚瀹氱敤鎴峰埆鍚�(璺熷墠绔繚鎸佷竴鑷�),褰撳墠涓�:rid+usercode
+ public string usercode { get; set; }
+ public string username { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AppDevicecCheck.cs b/VueWebCoreApi/Models/AppDevicecCheck.cs
new file mode 100644
index 0000000..e658152
--- /dev/null
+++ b/VueWebCoreApi/Models/AppDevicecCheck.cs
@@ -0,0 +1,24 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AppDevicecCheck
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string standcode { get; set; }
+ public string result { get; set; }
+ public List<AppDevicecCheckCn> children { get; set; }//瀛愯妭鐐�
+ }
+ public class AppDevicecCheckCn
+ {
+ public string seq { get; set; }
+ public string itemcode { get; set; }
+ public string cycle { get; set; }
+ public string value { get; set; }
+ public string result { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AppLabCode.cs b/VueWebCoreApi/Models/AppLabCode.cs
new file mode 100644
index 0000000..b95dfce
--- /dev/null
+++ b/VueWebCoreApi/Models/AppLabCode.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AppLabCode
+ {
+ /// <summary>
+ /// 鍔熻兘缂栫爜
+ /// </summary>
+ public string rightcode { get; set; }
+ /// <summary>
+ /// 鏍囩鏉$爜
+ /// </summary>
+ public string labcode { get; set; }
+ /// <summary>
+ /// 鏍囩鏁伴噺
+ /// </summary>
+ public string labqty { get; set; }
+ /// <summary>
+ /// 鐗╂枡缂栫爜
+ /// </summary>
+ public string partnumber { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AppPurchOrderSave.cs b/VueWebCoreApi/Models/AppPurchOrderSave.cs
new file mode 100644
index 0000000..c83aa6d
--- /dev/null
+++ b/VueWebCoreApi/Models/AppPurchOrderSave.cs
@@ -0,0 +1,56 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AppPurchOrderSave
+ {
+ /// <summary>
+ /// 棰勮鍒拌揣鏃ユ湡
+ /// </summary>
+ public string hacceptdate { get; set; }
+ /// <summary>
+ /// 閮ㄩ棬缂栫爜
+ /// </summary>
+ public string hdepartmentcode { get; set; }
+ /// <summary>
+ /// 渚涘簲鍟嗙紪鐮�
+ /// </summary>
+ public string hcustomercode { get; set; }
+ /// <summary>
+ /// 鎵规鍙�
+ /// </summary>
+ public string hbatchno { get; set; }
+ /// <summary>
+ /// 婧愬崟鍗曞彿(閲囪喘璁㈠崟鍙�)
+ /// </summary>
+ public string hsourcebillno { get; set; }
+ /// <summary>
+ /// 琛屽彿
+ /// </summary>
+ public string rownumber { get; set; }
+ /// <summary>
+ /// 鐗╂枡缂栫爜
+ /// </summary>
+ public string hpartcode { get; set; }
+ /// <summary>
+ /// 璁㈠崟鏁伴噺
+ /// </summary>
+ public string hplanqty { get; set; }
+ /// <summary>
+ /// 鍒拌揣鏁伴噺
+ /// </summary>
+ public string hqty { get; set; }
+ /// <summary>
+ /// 鐗╂枡鏄惁闇�妫�楠�
+ /// </summary>
+ public string hischeck { get; set; }
+
+ /// <summary>
+ /// 鏉$爜淇℃伅
+ /// </summary>
+ public List<AppLabCode> children { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AppScheduleKanban.cs b/VueWebCoreApi/Models/AppScheduleKanban.cs
new file mode 100644
index 0000000..0b5e943
--- /dev/null
+++ b/VueWebCoreApi/Models/AppScheduleKanban.cs
@@ -0,0 +1,44 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AppScheduleKanban
+ {
+ /// <summary>
+ /// 鍗曟嵁缂栧彿
+ /// </summary>
+ public string ordercode { get; set; }
+ /// <summary>
+ /// 鍗曟嵁鏁伴噺
+ /// </summary>
+ public string orderqty { get; set; }
+ /// <summary>
+ /// 鍗曟嵁缂栧彿
+ /// </summary>
+ public string ordergoodqty { get; set; }
+ /// <summary>
+ /// 浜у搧缂栫爜
+ /// </summary>
+ public string partcode { get; set; }
+ /// <summary>
+ /// 浜у搧鍚嶇О
+ /// </summary>
+ public string partname { get; set; }
+ /// <summary>
+ /// 浜у搧瑙勬牸
+ /// </summary>
+ public string partspec { get; set; }
+ public List<AppScheduleKanbanSub> children { get; set; }//瀛愯妭鐐�
+ }
+ public class AppScheduleKanbanSub
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string spec { get; set; }
+ public string planqty { get; set; }
+ public string goodqty { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AppVersion.cs b/VueWebCoreApi/Models/AppVersion.cs
new file mode 100644
index 0000000..7e16e7c
--- /dev/null
+++ b/VueWebCoreApi/Models/AppVersion.cs
@@ -0,0 +1,16 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class AppVersion
+ {
+ public string path { get; set; }
+ public string version { get; set; }
+ public string dispyversion { get; set; }
+ public string activeversion { get; set; }
+ public string mustupgrade { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ApsOrderSerch.cs b/VueWebCoreApi/Models/ApsOrderSerch.cs
new file mode 100644
index 0000000..451d4e2
--- /dev/null
+++ b/VueWebCoreApi/Models/ApsOrderSerch.cs
@@ -0,0 +1,35 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class ApsOrderSerch
+ {
+ /// <summary>
+ /// 宸ュ崟鍙�
+ /// </summary>
+ public string wocode { get; set; }
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string wkshpcode { get; set; }
+ /// <summary>
+ /// 浜у搧缂栧彿
+ /// </summary>
+ public string partcode { get; set; }
+ /// <summary>
+ /// 鐡堕宸ュ簭缂栫爜(棣栭亾宸ュ簭)
+ /// </summary>
+ public string botproccode { get; set; }
+ /// <summary>
+ /// 寮�濮嬫棩鏈�
+ /// </summary>
+ public string startdate { get; set; }
+ /// <summary>
+ /// 缁撴潫鏃ユ湡
+ /// </summary>
+ public string enddate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/AttendanceSetting/Attendance.cs b/VueWebCoreApi/Models/AttendanceSetting/Attendance.cs
new file mode 100644
index 0000000..46d0457
--- /dev/null
+++ b/VueWebCoreApi/Models/AttendanceSetting/Attendance.cs
@@ -0,0 +1,13 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.AttendanceSetting
+{
+ public class Attendance
+ {
+ public string wkshop_code { get; set; }
+ public string user_code { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/AttendanceSetting/AttendanceRecord.cs b/VueWebCoreApi/Models/AttendanceSetting/AttendanceRecord.cs
new file mode 100644
index 0000000..6b96cf4
--- /dev/null
+++ b/VueWebCoreApi/Models/AttendanceSetting/AttendanceRecord.cs
@@ -0,0 +1,31 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.AttendanceSetting
+{
+ public class AttendanceRecord
+ {
+ /// <summary>
+ /// 鎶ュ伐璁板綍id
+ /// </summary>
+ public string id { get; set; }
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string wkshop_code { get; set; }
+ /// <summary>
+ /// 鎵撳崱浜哄憳缂栫爜
+ /// </summary>
+ public string creatusercode { get; set; }
+ /// <summary>
+ /// 鎵撳崱鏃ユ湡
+ /// </summary>
+ public string creatdate { get; set; }
+ /// <summary>
+ /// 鏍哥畻鐘舵��
+ /// </summary>
+ public string status { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/AttendanceSetting/AttendanceSave.cs b/VueWebCoreApi/Models/AttendanceSetting/AttendanceSave.cs
new file mode 100644
index 0000000..8e229d7
--- /dev/null
+++ b/VueWebCoreApi/Models/AttendanceSetting/AttendanceSave.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.AttendanceSetting
+{
+ public class AttendanceSave
+ {
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string wkshop_code { get; set; }
+ /// <summary>
+ /// 鎵撳崱浜哄憳缂栫爜
+ /// </summary>
+ public string creatusercode { get; set; }
+ /// <summary>
+ /// 鎵撳崱鏃ユ湡
+ /// </summary>
+ public string creatdate { get; set; }
+ /// <summary>
+ /// 鏍哥畻鐘舵��
+ /// </summary>
+ public string status { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/AttendanceSetting/AttendanceSett.cs b/VueWebCoreApi/Models/AttendanceSetting/AttendanceSett.cs
new file mode 100644
index 0000000..c656585
--- /dev/null
+++ b/VueWebCoreApi/Models/AttendanceSetting/AttendanceSett.cs
@@ -0,0 +1,39 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.AttendanceSetting
+{
+ public class AttendanceSett
+ {
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string wkshop_code { get; set; }
+ /// <summary>
+ /// 涓婄彮鏃堕棿
+ /// </summary>
+ public string workhouse { get; set; }
+ /// <summary>
+ /// 涓嬬彮鏃堕棿
+ /// </summary>
+ public string closehouse { get; set; }
+ /// <summary>
+ /// 姝e父涓婄彮宸ヤ环
+ /// </summary>
+ public string workprice { get; set; }
+ /// <summary>
+ /// 鍔犵彮宸ヤ环
+ /// </summary>
+ public string overprice { get; set; }
+ /// <summary>
+ /// 涓婄彮鎵撳崱鏈夋晥鑼冨洿/灏忔椂
+ /// </summary>
+ public string uphouse { get; set; }
+ /// <summary>
+ /// 涓嬬彮鎵撳紑鏈夋晥鑼冨洿/灏忔椂
+ /// </summary>
+ public string downhouse { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/AttendanceSetting/DailyWageReport.cs b/VueWebCoreApi/Models/AttendanceSetting/DailyWageReport.cs
new file mode 100644
index 0000000..8032b8d
--- /dev/null
+++ b/VueWebCoreApi/Models/AttendanceSetting/DailyWageReport.cs
@@ -0,0 +1,55 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.AttendanceSetting
+{
+ public class DailyWageReport
+ {
+ /// <summary>
+ /// id
+ /// </summary>
+ public string id { get; set; }
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string whshop_code { get; set; }
+ /// <summary>
+ /// 鎵撳崱鏃ユ湡
+ /// </summary>
+ public string checkindate { get; set; }
+ /// <summary>
+ /// 鎵撳崱浜哄憳
+ /// </summary>
+ public string usercode { get; set; }
+ /// <summary>
+ /// 宸ヤ綔鏃堕暱(灏忔椂)
+ /// </summary>
+ public string workcount { get; set; }
+ /// <summary>
+ /// 璁℃椂宸ヤ环(鍏�/灏忔椂)
+ /// </summary>
+ public string workprice { get; set; }
+ /// <summary>
+ /// 鍔犵彮鏃堕暱(灏忔椂)
+ /// </summary>
+ public string overcount { get; set; }
+ /// <summary>
+ /// 鍔犵彮宸ヤ环(鍏�/灏忔椂)
+ /// </summary>
+ public string overprice { get; set; }
+ /// <summary>
+ /// 鎵i櫎鏃堕暱(灏忔椂)
+ /// </summary>
+ public string deductcount { get; set; }
+ /// <summary>
+ /// 鎵i櫎钖祫(鍏�)
+ /// </summary>
+ public string deductmoney { get; set; }
+ /// <summary>
+ /// 璁℃椂宸ヨ祫(鍏�)
+ /// </summary>
+ public string timimoney { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/BomSub.cs b/VueWebCoreApi/Models/BomSub.cs
new file mode 100644
index 0000000..0be0451
--- /dev/null
+++ b/VueWebCoreApi/Models/BomSub.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class BomSub
+ {
+ public string seq { get; set; }
+ public string smaterirl_code { get; set; }
+ public string base_quantity { get; set; }
+ public string loss_quantity { get; set; }
+ public string total_quantity { get; set; }
+ public string pn_type { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/CapaPlan.cs b/VueWebCoreApi/Models/CapaPlan.cs
new file mode 100644
index 0000000..0f4e2c6
--- /dev/null
+++ b/VueWebCoreApi/Models/CapaPlan.cs
@@ -0,0 +1,26 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class CapaPlan
+ {
+ public string name { get; set; }
+ public string key { get; set; }
+ public override bool Equals(object obj)
+ {
+ if (obj is CapaPlan)
+ {
+ CapaPlan student = obj as CapaPlan;
+ return name == student.name && key == student.key;
+ }
+ return false;
+ }
+ public override int GetHashCode()
+ {
+ return name.GetHashCode() ^ key.GetHashCode();
+ }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/CapacityPlanSect.cs b/VueWebCoreApi/Models/CapacityPlanSect.cs
new file mode 100644
index 0000000..3560d15
--- /dev/null
+++ b/VueWebCoreApi/Models/CapacityPlanSect.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class CapacityPlanSect
+ {
+ public string CapCode { get; set; } //鏂规缂栫爜
+ public string CapName { get; set; } //鏂规鍚嶇О
+ public string CapStus { get; set; } //閫変腑鐘舵��
+ public List<object> list { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/CapacityPlanningSetup.cs b/VueWebCoreApi/Models/CapacityPlanningSetup.cs
new file mode 100644
index 0000000..461f159
--- /dev/null
+++ b/VueWebCoreApi/Models/CapacityPlanningSetup.cs
@@ -0,0 +1,21 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class CapacityPlanningSetup
+ {
+ public string CapSetupCode { get; set; } //鐝浠g爜
+ public string CapSetupName { get; set; } //鐝鍚嶇О
+ public string OneStartDate { get; set; } //鏃堕棿娈�1
+ public string TwoStartDate { get; set; } //鏃堕棿娈�2
+ public string ThreeStartDate { get; set; } //鏃堕棿娈�3
+ public string FourStartDate { get; set; } //鏃堕棿娈�4
+ public string FiveStartDate { get; set; } //鏃堕棿娈�5
+ public string CapSetupUser { get; set; } //鎿嶄綔浜哄憳
+ public string CapSetupDate { get; set; } //鎿嶄綔鏃堕棿
+ public string Duration { get; set; } //鏃堕暱
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ChanjetEncryptMsg.cs b/VueWebCoreApi/Models/ChanjetEncryptMsg.cs
new file mode 100644
index 0000000..a8e6ba4
--- /dev/null
+++ b/VueWebCoreApi/Models/ChanjetEncryptMsg.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class ChanjetEncryptMsg
+ {
+ public string encryptMsg { get; set; }
+
+ public string GetEncryptMsg()
+ {
+ return encryptMsg;
+ }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/DeviceRepair.cs b/VueWebCoreApi/Models/DeviceRepair.cs
new file mode 100644
index 0000000..51a2db9
--- /dev/null
+++ b/VueWebCoreApi/Models/DeviceRepair.cs
@@ -0,0 +1,25 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class DeviceReport
+ {
+ public string faultsource { get; set; } //鏁呴殰鏉ユ簮
+ public string faultdescr { get; set; } //鏁呴殰鎻忚堪
+ public DataTable faultimage { get; set; } //鏁呴殰鍥剧墖
+ }
+
+ public class DeviceRepair
+ {
+ public string faultdescr { get; set; } //鏁呴殰鎻忚堪
+ public string isstoprepair { get; set; } //鍋滄満缁翠慨
+ public string repaircontent { get; set; } //缁翠慨鍐呭
+ public string repairpart { get; set; } //鏇存崲澶囦欢
+ public DataTable repairimage { get; set; } //鏁呴殰鍥剧墖/鏇存崲澶囦欢鍥剧墖
+
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/DeviceUpdate.cs b/VueWebCoreApi/Models/DeviceUpdate.cs
new file mode 100644
index 0000000..3edee28
--- /dev/null
+++ b/VueWebCoreApi/Models/DeviceUpdate.cs
@@ -0,0 +1,49 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models
+{
+ public class DeviceUpdate
+ {
+ /// <summary>
+ /// 缁翠慨鐢宠鍗曞彿
+ /// </summary>
+ public string docu_code { get; set; }
+ /// <summary>
+ /// 璁惧缂栫爜
+ /// </summary>
+ public string eqpcode { get; set; }
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string wkshpcode { get; set; }
+ /// <summary>
+ /// 鏁呴殰鎻忚堪
+ /// </summary>
+ public string faultdescr { get; set; }
+ /// <summary>
+ /// 鍋滄満缁翠慨
+ /// </summary>
+ public string is_stoprepair { get; set; }
+ /// <summary>
+ /// 缁翠慨鍐呭
+ /// </summary>
+ public string repaircontent { get; set; }
+ /// <summary>
+ /// 鏇存崲澶囦欢
+ /// </summary>
+ public string replaceparts { get; set; }
+ /// <summary>
+ /// 鏁呴殰鍥剧墖鍦板潃
+ /// </summary>
+ public List<string> groupimage1 { get; set; }
+ /// <summary>
+ /// 鏇存崲澶囦欢鍥剧墖鍦板潃
+ /// </summary>
+ public List<string> groupimage2 { get; set; }
+
+ }
+}
diff --git a/VueWebCoreApi/Models/EqpRepair.cs b/VueWebCoreApi/Models/EqpRepair.cs
new file mode 100644
index 0000000..ed48ea6
--- /dev/null
+++ b/VueWebCoreApi/Models/EqpRepair.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class EqpRepair
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string repaircycle { get; set; }
+ public string description { get; set; }
+ public DataTable Data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ErpOrder/ErpOrderBatch.cs b/VueWebCoreApi/Models/ErpOrder/ErpOrderBatch.cs
new file mode 100644
index 0000000..c839bff
--- /dev/null
+++ b/VueWebCoreApi/Models/ErpOrder/ErpOrderBatch.cs
@@ -0,0 +1,71 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.ErpOrder
+{
+ public class ErpOrderBatch
+ {
+ /// <summary>
+ /// 璁㈠崟id
+ /// </summary>
+ public string erporderid { get; set; }
+ /// <summary>
+ /// 璁㈠崟鏄庣粏id
+ /// </summary>
+ public string sbid { get; set; }
+ /// <summary>
+ /// 璁㈠崟缂栧彿
+ /// </summary>
+ public string erpordercode { get; set; }
+ /// <summary>
+ /// 閿�鍞鍗曠紪鍙�
+ /// </summary>
+ public string saleordercode { get; set; }
+ /// <summary>
+ /// 浜у搧缂栫爜
+ /// </summary>
+ public string partcode { get; set; }
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string wkshopcode { get; set; }
+ /// <summary>
+ /// 浠撳簱缂栫爜
+ /// </summary>
+ public string warehousecode { get; set; }
+ /// <summary>
+ /// 璁㈠崟鏁伴噺
+ /// </summary>
+ public string erpqty { get; set; }
+ /// <summary>
+ /// 涓嬪崟鏁伴噺
+ /// </summary>
+ public string markqty { get; set; }
+ /// <summary>
+ /// 涓嬪崟鍗曟暟
+ /// </summary>
+ public string ordernum { get; set; }
+ /// <summary>
+ /// 宸蹭笅鍗曟暟閲�
+ /// </summary>
+ public string relse_qty { get; set; }
+ /// <summary>
+ /// 浜や粯鏃堕棿
+ /// </summary>
+ public string saleOrderDeliveryDate { get; set; }
+ /// <summary>
+ /// 棰勮寮�宸ユ棩鏈�
+ /// </summary>
+ public string paystartdate { get; set; }
+ /// <summary>
+ /// 棰勮瀹屽伐鏃ユ湡
+ /// </summary>
+ public string payenddate { get; set; }
+ /// <summary>
+ /// 閿�鍞鍗曚笟鍔″憳
+ /// </summary>
+ public string clerkuser { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/ExcelErro.cs b/VueWebCoreApi/Models/ExcelErro.cs
new file mode 100644
index 0000000..39ef9d8
--- /dev/null
+++ b/VueWebCoreApi/Models/ExcelErro.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class ExcelErro
+ {
+ public string Seq { get; set; } //搴忓彿
+ public string RoeNumber { get; set; } //琛屽彿
+ public string ErrorField { get; set; } //閿欒瀛楁
+ public string ErrorCont { get; set; } //閿欒璇︽儏
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/InventoryModel/InReptModel.cs b/VueWebCoreApi/Models/InventoryModel/InReptModel.cs
new file mode 100644
index 0000000..45189bd
--- /dev/null
+++ b/VueWebCoreApi/Models/InventoryModel/InReptModel.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.InventoryModel
+{
+ public class InReptModel
+ {
+ public string rightcode { get; set; }
+ public string incbit { get; set; }
+ public List<DataTable> TableData { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/InventoryModel/StorageRecord.cs b/VueWebCoreApi/Models/InventoryModel/StorageRecord.cs
new file mode 100644
index 0000000..f498686
--- /dev/null
+++ b/VueWebCoreApi/Models/InventoryModel/StorageRecord.cs
@@ -0,0 +1,59 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.InventoryModel
+{
+ public class StorageRecord
+ {
+ /// <summary>
+ /// 鍏ュ簱鍗曞彿
+ /// </summary>
+ public string hbillno { get; set; }
+ /// <summary>
+ /// 閿�鍞崟鍙�
+ /// </summary>
+ public string salecode { get; set; }
+ /// <summary>
+ /// 璁㈠崟鍙�
+ /// </summary>
+ public string mo_no { get; set; }
+ /// <summary>
+ /// 宸ュ崟鍙�
+ /// </summary>
+ public string wocode { get; set; }
+ /// <summary>
+ /// 浜у搧缂栫爜
+ /// </summary>
+ public string partcode { get; set; }
+ /// <summary>
+ /// 鍏ュ簱鏁伴噺
+ /// </summary>
+ public string qty { get; set; }
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string wkshop_code { get; set; }
+ /// <summary>
+ /// 浠撳簱缂栫爜
+ /// </summary>
+ public string stockcode { get; set; }
+ /// <summary>
+ /// 鏉$爜
+ /// </summary>
+ public string inbarcode { get; set; }
+ /// <summary>
+ /// 宸ュ簭缂栫爜
+ /// </summary>
+ public string step_code { get; set; }
+ /// <summary>
+ /// 鎶ュ伐绫诲瀷(B:鑷埗/S澶栧崗)
+ /// </summary>
+ public string style { get; set; }
+ /// <summary>
+ /// 鏈亾宸ュ簭鎶ュ伐璁板綍id
+ /// </summary>
+ public string repoid { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/MaterialCraftsSave.cs b/VueWebCoreApi/Models/MaterialCraftsSave.cs
new file mode 100644
index 0000000..158dbcc
--- /dev/null
+++ b/VueWebCoreApi/Models/MaterialCraftsSave.cs
@@ -0,0 +1,24 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models
+{
+ public class MaterialCraftsSave
+ {
+ public string partcode { get; set; }
+ public string defaultroute_code { get; set; }
+ public List<SubData> children { get; set; }
+
+ }
+ public class SubData
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string seq { get; set; }
+ public string isbott { get; set; }
+ public string isend { get; set; }
+ public string unprice { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/MaterialRout.cs b/VueWebCoreApi/Models/MaterialRout.cs
new file mode 100644
index 0000000..f5cdfbe
--- /dev/null
+++ b/VueWebCoreApi/Models/MaterialRout.cs
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class MaterialRout
+ {
+ public string wkshopcode { get; set; }
+ public string wkshopname { get; set; }
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ public DataTable Data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/MouldSearch/MouldMessage.cs b/VueWebCoreApi/Models/MouldSearch/MouldMessage.cs
new file mode 100644
index 0000000..f0af1c2
--- /dev/null
+++ b/VueWebCoreApi/Models/MouldSearch/MouldMessage.cs
@@ -0,0 +1,65 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.MouldSearch
+{
+ public class MouldMessage
+ {
+ /// <summary>
+ /// 妯″叿缂栫爜
+ /// </summary>
+ public string mouldcode { get; set; }
+ /// <summary>
+ /// 妯″叿鍚嶇О
+ /// </summary>
+ public string mouldname { get; set; }
+ /// <summary>
+ /// 瑙勬牸鍨嬪彿
+ /// </summary>
+ public string mouldspec { get; set; }
+ /// <summary>
+ /// 棰勮瀵垮懡
+ /// </summary>
+ public string surp_life { get; set; }
+ /// <summary>
+ /// 鍓╀綑瀵垮懡
+ /// </summary>
+ public string resi_life { get; set; }
+ /// <summary>
+ /// 妯″叿鐘舵��
+ /// </summary>
+ public string status { get; set; }
+ /// <summary>
+ /// 浣跨敤鐘舵��
+ /// </summary>
+ public string usestatus { get; set; }
+ /// <summary>
+ /// 鏈�杩戠偣妫�
+ /// </summary>
+ public string checkdate { get; set; }
+ /// <summary>
+ /// 鏈�杩戜繚鍏�
+ /// </summary>
+ public string maintdate { get; set; }
+
+ public List<RelatedProduct> children { get; set; }
+ }
+ public class RelatedProduct
+ {
+ /// <summary>
+ /// 浜у搧缂栫爜
+ /// </summary>
+ public string partcode { get; set; }
+ /// <summary>
+ /// 浜у搧鍚嶇О
+ /// </summary>
+ public string partname { get; set; }
+ /// <summary>
+ /// 浜у搧瑙勬牸
+ /// </summary>
+ public string partspec { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/MouldVerify/MouldModel.cs b/VueWebCoreApi/Models/MouldVerify/MouldModel.cs
new file mode 100644
index 0000000..e59393b
--- /dev/null
+++ b/VueWebCoreApi/Models/MouldVerify/MouldModel.cs
@@ -0,0 +1,32 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.MouldVerify
+{
+ public class MouldModel
+ {
+ /// <summary>
+ /// 鍔熻兘缂栫爜
+ /// </summary>
+ public string menucode { get; set; }
+ /// <summary>
+ /// 妯″叿缂栫爜
+ /// </summary>
+ public string mouldcode { get; set; }
+ /// <summary>
+ /// 鏁呴殰鏉ユ簮
+ /// </summary>
+ public string faultsourcecode { get; set; }
+ /// <summary>
+ /// 鏁呴殰鎻忚堪
+ /// </summary>
+ public string faultdescr { get; set; }
+ /// <summary>
+ /// 鏁呴殰鍥剧墖
+ /// </summary>
+ public List<IFormFile> files { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/ObjectData.cs b/VueWebCoreApi/Models/ObjectData.cs
new file mode 100644
index 0000000..3b332da
--- /dev/null
+++ b/VueWebCoreApi/Models/ObjectData.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class ObjectData
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ObjectDataCont.cs b/VueWebCoreApi/Models/ObjectDataCont.cs
new file mode 100644
index 0000000..7cfa0c8
--- /dev/null
+++ b/VueWebCoreApi/Models/ObjectDataCont.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class ObjectDataCont
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string group { get; set; }
+ public string description { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ObjectModel.cs b/VueWebCoreApi/Models/ObjectModel.cs
new file mode 100644
index 0000000..d3f21fc
--- /dev/null
+++ b/VueWebCoreApi/Models/ObjectModel.cs
@@ -0,0 +1,13 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models
+{
+ public class ObjectModel
+ {
+ public string type { get; set; }
+ public string url { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/PartRout.cs b/VueWebCoreApi/Models/PartRout.cs
new file mode 100644
index 0000000..4f65fda
--- /dev/null
+++ b/VueWebCoreApi/Models/PartRout.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class PartRout
+ {
+ public string wkshopcode { get; set; }
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ReportDefectHandle.cs b/VueWebCoreApi/Models/ReportDefectHandle.cs
new file mode 100644
index 0000000..360cb22
--- /dev/null
+++ b/VueWebCoreApi/Models/ReportDefectHandle.cs
@@ -0,0 +1,13 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class ReportDefectHandle
+ {
+ public DataTable Data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ReportDefectList.cs b/VueWebCoreApi/Models/ReportDefectList.cs
new file mode 100644
index 0000000..f313779
--- /dev/null
+++ b/VueWebCoreApi/Models/ReportDefectList.cs
@@ -0,0 +1,13 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models
+{
+ public class ReportDefectList
+ {
+ public string badqty { get; set; }
+ public string defect_code { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/ReportVerify/DataModel.cs b/VueWebCoreApi/Models/ReportVerify/DataModel.cs
new file mode 100644
index 0000000..f121d3c
--- /dev/null
+++ b/VueWebCoreApi/Models/ReportVerify/DataModel.cs
@@ -0,0 +1,13 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.ReportVerify
+{
+ public class DataModel
+ {
+ public List<string> zdata { get; set; }
+ public List<string> wdata { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/RolePermission/MenuItem.cs b/VueWebCoreApi/Models/RolePermission/MenuItem.cs
new file mode 100644
index 0000000..94e412c
--- /dev/null
+++ b/VueWebCoreApi/Models/RolePermission/MenuItem.cs
@@ -0,0 +1,36 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.RolePermission
+{
+ public class MenuItem
+ {
+ public string MenuCode { get; set; }
+ public string ButtonCode { get; set; }
+ public string DataCode { get; set; }
+ }
+
+ public class TreeOne
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public int seq { get; set; }
+ public string flag { get; set; }
+ public string imgurl { get; set; }
+ public string is_show { get; set; }
+ public List<TreeTwo> children { get; set; }//瀛愯妭鐐�
+ }
+ public class TreeTwo
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public int seq { get; set; }
+ public string flag { get; set; }
+ public string imgurl { get; set; }
+ public string is_show { get; set; }
+ public string buttoncode { get; set; }
+ public string datacode { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/RolePermission/RolePermission.cs b/VueWebCoreApi/Models/RolePermission/RolePermission.cs
new file mode 100644
index 0000000..c251803
--- /dev/null
+++ b/VueWebCoreApi/Models/RolePermission/RolePermission.cs
@@ -0,0 +1,50 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.RolePermission
+{
+ public class RolePermission
+ {
+ public class Company
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public List<TRole> Roles { get; set; }
+ }
+ public class TRole
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string datarange { get; set; }
+ public string datapermissions { get; set; }
+ public string identifying { get; set; }
+
+ }
+
+ public class TMenu
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string parentid { get; set; }
+ public string flag { get; set; }
+ }
+
+ public class TButton
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string menucode { get; set; }
+ public string flag { get; set; }
+ }
+
+ public class TData
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string menucode { get; set; }
+ public string flag { get; set; }
+ }
+ }
+}
diff --git a/VueWebCoreApi/Models/RolePermission/RolePermissionSava.cs b/VueWebCoreApi/Models/RolePermission/RolePermissionSava.cs
new file mode 100644
index 0000000..e793032
--- /dev/null
+++ b/VueWebCoreApi/Models/RolePermission/RolePermissionSava.cs
@@ -0,0 +1,60 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.RolePermission
+{
+ public class RolePermissionSava
+ {
+ public class RolePermissionSavaData
+ {
+ public List<RoleMenu> RoleMenu { get; set; }
+ public List<RoleButton> RoleButton { get; set; }
+ public List<RoleData> RoleData { get; set; }
+ }
+
+ /// <summary>
+ /// 瑙掕壊鑿滃崟
+ /// </summary>
+ public class RoleMenu
+ {
+ /// <summary>
+ /// 瑙掕壊缂栫爜
+ /// </summary>
+ public string rolecode { get; set; }
+ /// <summary>
+ /// 鑿滃崟缂栫爜
+ /// </summary>
+ public string menucode { get; set; }
+ }
+ /// <summary>
+ /// 瑙掕壊鎸夐挳
+ /// </summary>
+ public class RoleButton
+ {
+ /// <summary>
+ /// 瑙掕壊缂栫爜
+ /// </summary>
+ public string rolecode { get; set; }
+ /// <summary>
+ /// 鎸夐挳缂栫爜
+ /// </summary>
+ public string buttoncode { get; set; }
+ }
+ /// <summary>
+ /// 瑙掕壊鏁版嵁
+ /// </summary>
+ public class RoleData
+ {
+ /// <summary>
+ /// 瑙掕壊缂栫爜
+ /// </summary>
+ public string rolecode { get; set; }
+ /// <summary>
+ ///鏁版嵁缂栫爜
+ /// </summary>
+ public string datacode { get; set; }
+ }
+ }
+}
diff --git a/VueWebCoreApi/Models/RoleUserSubmit.cs b/VueWebCoreApi/Models/RoleUserSubmit.cs
new file mode 100644
index 0000000..970fd08
--- /dev/null
+++ b/VueWebCoreApi/Models/RoleUserSubmit.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class RoleUserSubmit
+ {
+ public string Code { get; set; }
+ public string Name { get; set; }
+ public List<string> Data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/RoutEdit.cs b/VueWebCoreApi/Models/RoutEdit.cs
new file mode 100644
index 0000000..19c9849
--- /dev/null
+++ b/VueWebCoreApi/Models/RoutEdit.cs
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class RoutEdit
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string enable { get; set; }
+ public string description { get; set; }
+ public string wkshopcode { get; set; }
+ public DataTable Data { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ScanStartReportData.cs b/VueWebCoreApi/Models/ScanStartReportData.cs
new file mode 100644
index 0000000..708b519
--- /dev/null
+++ b/VueWebCoreApi/Models/ScanStartReportData.cs
@@ -0,0 +1,34 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class ScanStartReportData
+ {
+ public string wo_code { get; set; } //宸ュ崟缂栧彿
+ public string partnumber { get; set; } //浜у搧缂栫爜
+ public string partname { get; set; } //浜у搧鍚嶇О
+
+ public string partspec { get; set; } //浜у搧瑙勬牸
+ public string seq { get; set; } //褰撳墠宸ュ簭搴忓彿
+ public string stepcode { get; set; } //褰撳墠宸ュ簭缂栫爜
+ public string stepname { get; set; } //褰撳墠宸ュ簭
+ public string stepprice { get; set; } //褰撳墠宸ュ簭宸ヤ环
+ public string nextstepcode { get; set; } //涓嬮亾宸ュ簭缂栫爜
+ public string nextstepname { get; set; } //涓嬮亾宸ュ簭
+ public string nextstepprice { get; set; } //涓嬮亾宸ュ簭宸ヤ环
+ public string stepdesc { get; set; } //宸ュ簭鎻忚堪
+ public decimal planqty { get; set; } //浠诲姟瓒呬骇鎬绘暟閲�
+ public decimal planquantity { get; set; } //浠诲姟鏁伴噺
+ public decimal startqty { get; set; } //寮�宸ユ暟閲�
+ public decimal noreportqty { get; set; } //鏈姤鏁伴噺
+ public decimal reportqty { get; set; } //宸叉姤鏁伴噺
+ public decimal noputqty { get; set; } //鏈敹鏁伴噺
+ public string wkshopcode { get; set; } //杞﹂棿缂栫爜
+ public string wkshopname { get; set; } //杞﹂棿鍚嶇О
+ public string eqpcode { get; set; } //璁惧缂栫爜
+ public string eqpname { get; set; } //璁惧鍚嶇О
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/ScanStartReportDataOut.cs b/VueWebCoreApi/Models/ScanStartReportDataOut.cs
new file mode 100644
index 0000000..84b3a4a
--- /dev/null
+++ b/VueWebCoreApi/Models/ScanStartReportDataOut.cs
@@ -0,0 +1,32 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class ScanStartReportDataOut
+ {
+ public string wo_code { get; set; } //宸ュ崟缂栧彿
+ public string partnumber { get; set; } //浜у搧缂栫爜
+ public string partname { get; set; } //浜у搧鍚嶇О
+ public string partspec { get; set; } //浜у搧瑙勬牸
+ public string seq { get; set; } //褰撳墠宸ュ簭搴忓彿
+ public string stepcode { get; set; } //褰撳墠宸ュ簭缂栫爜
+ public string stepname { get; set; } //褰撳墠宸ュ簭
+ public string stepprice { get; set; } //褰撳墠宸ュ簭宸ヤ环
+ public string nextstepcode { get; set; } //涓嬮亾宸ュ簭缂栫爜
+ public string nextstepname { get; set; } //涓嬮亾宸ュ簭
+ public string nextstepprice { get; set; } //涓嬮亾宸ュ簭宸ヤ环
+ public string stepdesc { get; set; } //宸ュ簭鎻忚堪
+ public string wkshopcode { get; set; } //杞﹂棿缂栫爜
+ public string wkshopname { get; set; } //杞﹂棿鍚嶇О
+ public decimal planqty { get; set; } //浠诲姟瓒呬骇鎬绘暟閲�
+ public decimal planquantity { get; set; } //浠诲姟鏁伴噺
+ public decimal startqty { get; set; } //寮�宸ユ暟閲�
+ public decimal noreportqty { get; set; } //鏈姤鏁伴噺
+ public decimal reportqty { get; set; } //宸叉姤鏁伴噺
+ public decimal noputqty { get; set; } //鏈敹鏁伴噺
+ public object list { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/StandEqp.cs b/VueWebCoreApi/Models/StandEqp.cs
new file mode 100644
index 0000000..84e0f77
--- /dev/null
+++ b/VueWebCoreApi/Models/StandEqp.cs
@@ -0,0 +1,25 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class StandEqp
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string type { get; set; }
+ public string flag { get; set; }
+ public string flag1 { get; set; }
+ public List<StandEqpCn> children { get; set; }//瀛愯妭鐐�
+ }
+ public class StandEqpCn
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string type { get; set; }
+ public string flag { get; set; }
+ public string flag1 { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/StepCheck.cs b/VueWebCoreApi/Models/StepCheck.cs
new file mode 100644
index 0000000..cd022d8
--- /dev/null
+++ b/VueWebCoreApi/Models/StepCheck.cs
@@ -0,0 +1,16 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class StepCheck
+ {
+ public string seq { get; set; }
+ public string code { get; set; }
+ public string name { get; set; }
+ public string descr { get; set; }
+ public string checkresult { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/StepDefect.cs b/VueWebCoreApi/Models/StepDefect.cs
new file mode 100644
index 0000000..fc802d4
--- /dev/null
+++ b/VueWebCoreApi/Models/StepDefect.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class StepDefect
+ {
+ public string storg_code { get; set; }
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/StepEqp.cs b/VueWebCoreApi/Models/StepEqp.cs
new file mode 100644
index 0000000..5025f14
--- /dev/null
+++ b/VueWebCoreApi/Models/StepEqp.cs
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class StepEqp
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string type { get; set; }
+ public string flag { get; set; }
+ public List<StepEqpCn> children { get; set; }//瀛愯妭鐐�
+ }
+ public class StepEqpCn
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string type { get; set; }
+ public string flag { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/SystemSetting/ExceImport.cs b/VueWebCoreApi/Models/SystemSetting/ExceImport.cs
new file mode 100644
index 0000000..dbe9b8a
--- /dev/null
+++ b/VueWebCoreApi/Models/SystemSetting/ExceImport.cs
@@ -0,0 +1,17 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.SystemSetting
+{
+ public class ExceImport
+ {
+ public string FileCode { get; set; }
+ //public List<string> SheetName { get; set; }
+ //public List<List<string>> TableHeader { get; set; }
+ //public List<List<Dictionary<string, object>>> TableData { get; set; }
+ public List<DataTable> TableData { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/TreeDG.cs b/VueWebCoreApi/Models/TreeDG.cs
new file mode 100644
index 0000000..4a2180b
--- /dev/null
+++ b/VueWebCoreApi/Models/TreeDG.cs
@@ -0,0 +1,16 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class TreeDG
+ {
+ public string id { get; set; }
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ public List<TreeDG> children { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/TreeDM.cs b/VueWebCoreApi/Models/TreeDM.cs
new file mode 100644
index 0000000..6c922c8
--- /dev/null
+++ b/VueWebCoreApi/Models/TreeDM.cs
@@ -0,0 +1,31 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class TreeDM
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ public string is_delete { get; set; } //鏄惁闅愯棌
+ public List<TreeDMOne> children { get; set; }
+ }
+ public class TreeDMOne
+ {
+ public string code { set; get; }
+ public string name { set; get; }
+ public string flag { get; set; }
+ public string is_delete { get; set; } //鏄惁闅愯棌
+ public List<TreeDMTwo> children { get; set; }
+ }
+ public class TreeDMTwo
+ {
+ public string code { set; get; }
+ public string name { set; get; }
+ public string flag { get; set; }
+ public string is_delete { get; set; } //鏄惁闅愯棌
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/TreeObejct.cs b/VueWebCoreApi/Models/TreeObejct.cs
new file mode 100644
index 0000000..bbb3a72
--- /dev/null
+++ b/VueWebCoreApi/Models/TreeObejct.cs
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class TreeObejct
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ public string imgurl { get; set; }
+ public List<TreeObejctCn> children { get; set; }//瀛愯妭鐐�
+ }
+ public class TreeObejctCn
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string flag { get; set; }
+ public string imgurl { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/UnitMaterial/Unit.cs b/VueWebCoreApi/Models/UnitMaterial/Unit.cs
new file mode 100644
index 0000000..2ef935c
--- /dev/null
+++ b/VueWebCoreApi/Models/UnitMaterial/Unit.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.UnitMaterial
+{
+ public class Unit
+ {
+ public string unitcode { get; set; }
+ public string unitname { get; set; }
+ public List<unitporject> children { get; set; }
+ }
+ public class unitporject
+ {
+ public string unitcode { get; set; }
+ public string unitname { get; set; }
+ public string isMainUnit { get; set; }
+ public decimal changeRate { get; set; }
+ public string isSingleUnit { get; set; }
+ public string disabled { get; set; }
+ public string isGroup { get; set; }
+ public string rateDescription { get; set; }
+ public string idunitgroup { get; set; }
+ public string data_sources { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/Uom.cs b/VueWebCoreApi/Models/Uom.cs
new file mode 100644
index 0000000..ad60942
--- /dev/null
+++ b/VueWebCoreApi/Models/Uom.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace VueWebCoreApi.Models
+{
+ public class Uom
+ {
+ public string code { get; set; }
+ public string name { get; set; }
+ public string digdect { get; set; }
+ public string r_ule { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Models/UpdateReport/UpdateProductReport.cs b/VueWebCoreApi/Models/UpdateReport/UpdateProductReport.cs
new file mode 100644
index 0000000..ad321d8
--- /dev/null
+++ b/VueWebCoreApi/Models/UpdateReport/UpdateProductReport.cs
@@ -0,0 +1,47 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.UpdateReport
+{
+ /// <summary>
+ /// 淇敼鎶ュ伐鎻愪氦鏁版嵁绫�
+ /// </summary>
+ public class UpdateProductReport
+ {
+ public string id { get; set; } //鎶ュ伐璁板綍涓昏〃id/澶栧崗鏀舵枡璁板綍涓昏〃id
+ public string sbid { get; set; } //鎶ュ伐璁板綍瀛愯〃id/澶栧崗鏀舵枡璁板綍瀛愯〃id
+ public string wo_code { get; set; } //鐢熶骇宸ュ崟鍙�
+ public string partnumber { get; set; } //鐗╂枡缂栫爜
+ public string task_qty { get; set; } //宸ュ崟鏁伴噺
+ public string wkshp_code { get; set; } //杞﹂棿缂栧彿
+ public string eqp_code { get; set; } //璁惧缂栫爜/澶栧崗渚涘簲鍟嗙紪鐮�
+ public string step_seq { get; set; } //宸ュ簭搴忓彿
+ public string step_code { get; set; } //宸ュ簭缂栫爜
+ public string flw_type { get; set; } //宸ュ簭灞炴��(Z:鑷埗 W:澶栧崗)
+ public string first_choke { get; set; } //鏄惁棣栭亾宸ュ簭
+ public string last_choke { get; set; } //鏄惁鏈亾宸ュ簭
+ public string unprice { get; set; } //宸ュ簭鍗曚环
+ public string groupcode { get; set; } //鐝粍缂栫爜
+ public string usercode { get; set; } //鎶ュ伐浜哄憳缂栫爜
+ public string report_date { get; set; } //鎶ュ伐鏃堕棿
+ public string report_qty { get; set; } //鎶ュ伐鏁伴噺
+ public string report_dvalue { get; set; } //鎶ュ伐鏁伴噺宸��
+ public string wxcode { get; set; } //澶栧崗渚涘簲鍟嗙紪鐮�
+ public List<UpdateReportSub> children { get; set; }
+ }
+ public class UpdateReportSub
+ {
+ public string ng_id { get; set; } //涓嶈壇璁板綍涓籭d
+ public string ng_sbid { get; set; } //涓嶈壇璁板綍瀛恑d
+ public string ng_qty { get; set; } //涓嶈壇鏁伴噺
+ public string ng_dvalue { get; set; } //涓嶈壇鏁伴噺宸��
+ public string laborbad_qty { get; set; } //宸ュ簾鏁伴噺
+ public string laborbad_dvalue { get; set; } //宸ュ簾鏁伴噺宸��
+ public string materielbad_qty { get; set; } //鏂欏簾鏁伴噺
+ public string materielbad_dvalue { get; set; } //鏂欏簾鏁伴噺宸��
+ public string bad_money { get; set; } //鎶ュ簾閲戦
+ public string badmoney_dvalue { get; set; } //鎶ュ簾閲戦宸��
+ }
+}
diff --git a/VueWebCoreApi/Models/User.cs b/VueWebCoreApi/Models/User.cs
new file mode 100644
index 0000000..49c71c7
--- /dev/null
+++ b/VueWebCoreApi/Models/User.cs
@@ -0,0 +1,46 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models
+{
+ public class User
+ {
+ /// <summary>
+ /// 鐢ㄦ埛缂栫爜
+ /// </summary>
+ public string usercode { get; set; }
+ /// <summary>
+ /// 鐢ㄦ埛鍚嶇О
+ /// </summary>
+ public string username { get; set; }
+ /// <summary>
+ /// 鎵�灞炵粍缁囩紪鐮�
+ /// </summary>
+ public string storg_code { get; set; }
+ /// <summary>
+ /// 鎵�灞炵粍缁囧悕绉�
+ /// </summary>
+ public string storg_name { get; set; }
+ /// <summary>
+ /// 鏄惁绠$悊鍛�
+ /// </summary>
+ public string is_system_admin { get; set; }
+ /// <summary>
+ /// 瑙掕壊缂栫爜
+ /// </summary>
+ public string role_code { get; set; }
+ /// <summary>
+ /// 瑙掕壊鏁版嵁鏉冮檺缂栫爜
+ /// </summary>
+ public string role_datapermissions { get; set; }
+ /// <summary>
+ /// 鎿嶄綔绔被鍨�
+ /// </summary>
+ public string usertype { get; set; }
+ public string rediskey { get; set; }
+ public string token { get; set; }
+ public string mesSetting { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/WareHouseLocation.cs b/VueWebCoreApi/Models/WareHouseLocation.cs
new file mode 100644
index 0000000..c5bcba1
--- /dev/null
+++ b/VueWebCoreApi/Models/WareHouseLocation.cs
@@ -0,0 +1,19 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models
+{
+ public class WareHouseLocation
+ {
+ public string text { get; set; }
+ public string value { get; set; }
+ public List<LocationData> children { get; set; }
+ }
+ public class LocationData
+ {
+ public string text { get; set; }
+ public string value { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/WorkData/PartRouteList.cs b/VueWebCoreApi/Models/WorkData/PartRouteList.cs
new file mode 100644
index 0000000..febb476
--- /dev/null
+++ b/VueWebCoreApi/Models/WorkData/PartRouteList.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.WorkData
+{
+ public class PartRouteList
+ {
+ /// <summary>
+ /// 浜у搧缂栫爜
+ /// </summary>
+ public string partcode { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/WorkData/PartRouteStepList.cs b/VueWebCoreApi/Models/WorkData/PartRouteStepList.cs
new file mode 100644
index 0000000..1832498
--- /dev/null
+++ b/VueWebCoreApi/Models/WorkData/PartRouteStepList.cs
@@ -0,0 +1,19 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.WorkData
+{
+ public class PartRouteStepList
+ {
+ /// <summary>
+ /// 浜у搧缂栫爜
+ /// </summary>
+ public string partcode { get; set; }
+ /// <summary>
+ /// 宸ヨ壓璺嚎缂栫爜
+ /// </summary>
+ public string routecode { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/WorkData/WorkList.cs b/VueWebCoreApi/Models/WorkData/WorkList.cs
new file mode 100644
index 0000000..771429c
--- /dev/null
+++ b/VueWebCoreApi/Models/WorkData/WorkList.cs
@@ -0,0 +1,103 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.WorkData
+{
+ public class WorkList
+ {
+ /// <summary>
+ /// 鍗曟嵁鐘舵��
+ /// </summary>
+ public string wostatus { get; set; }
+ /// <summary>
+ /// 宸ュ崟缂栧彿
+ /// </summary>
+ public string wocode { get; set; }
+ /// <summary>
+ /// 宸ュ崟绫诲瀷
+ /// </summary>
+ public string wotype { get; set; }
+ /// <summary>
+ /// 婧愬崟id
+ /// </summary>
+ public string sourceid { get; set; }
+ /// <summary>
+ /// 婧愬崟鍗曞彿
+ /// </summary>
+ public string sourcewo { get; set; }
+ /// <summary>
+ /// 浜у搧缂栫爜
+ /// </summary>
+ public string partcode { get; set; }
+ /// <summary>
+ /// 宸ヨ壓璺嚎缂栫爜
+ /// </summary>
+ public string routecode { get; set; }
+ /// <summary>
+ /// 宸ュ崟鏁伴噺
+ /// </summary>
+ public string woqty { get; set; }
+ /// <summary>
+ /// 杞﹂棿缂栫爜
+ /// </summary>
+ public string wkshopcode { get; set; }
+ /// <summary>
+ /// 浜や粯鏃ユ湡
+ /// </summary>
+ public string deliverydate { get; set; }
+ /// <summary>
+ /// 棰勮寮�宸ユ棩鏈�
+ /// </summary>
+ public string paystartdate { get; set; }
+ /// <summary>
+ /// 棰勮瀹屽伐鏃ユ湡
+ /// </summary>
+ public string payenddate { get; set; }
+ /// <summary>
+ /// 鏁版嵁鏉ユ簮
+ /// </summary>
+ public string data_sources { get; set; }
+ /// <summary>
+ /// 淇敼鏁伴噺宸��
+ /// </summary>
+ public string difference { get; set; }
+ /// <summary>
+ /// 鏄惁鍏宠仈宸ュ簭
+ /// </summary>
+ public string isstep { get; set; }
+ public List<WorkListSub> WorkListSub { get; set; }
+ }
+ public class WorkListSub
+ {
+ /// <summary>
+ /// 宸ュ簭搴忓彿
+ /// </summary>
+ public string stepseq { get; set; }
+ /// <summary>
+ /// 宸ュ簭缂栫爜
+ /// </summary>
+ public string stepcode { get; set; }
+ /// <summary>
+ /// 鐢熶骇鍗曚环
+ /// </summary>
+ public string stepprice { get; set; }
+ /// <summary>
+ /// 鏄惁棣栭亾宸ュ簭
+ /// </summary>
+ public string isbott { get; set; }
+ /// <summary>
+ /// 鏄惁鏈亾宸ュ簭
+ /// </summary>
+ public string isend { get; set; }
+ /// <summary>
+ /// 瓒呮姤姣斾緥
+ /// </summary>
+ public string ratio { get; set; }
+ /// <summary>
+ /// 浠诲姟瓒呬骇鎬绘暟閲�
+ /// </summary>
+ public string sumqty { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Models/WorkData/WorkStepList.cs b/VueWebCoreApi/Models/WorkData/WorkStepList.cs
new file mode 100644
index 0000000..04bbd83
--- /dev/null
+++ b/VueWebCoreApi/Models/WorkData/WorkStepList.cs
@@ -0,0 +1,27 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Models.WorkData
+{
+ public class WorkStepList
+ {
+ /// <summary>
+ /// 婧愬崟id
+ /// </summary>
+ public string sourceid { get; set; }
+ /// <summary>
+ /// 婧愬崟鍗曞彿
+ /// </summary>
+ public string sourcewo { get; set; }
+ /// <summary>
+ /// 宸ュ崟鍙�
+ /// </summary>
+ public string wocode { get; set; }
+ /// <summary>
+ /// 鏁版嵁鏉ユ簮锛欵RP/MES
+ /// </summary>
+ public string data_sources { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Program.cs b/VueWebCoreApi/Program.cs
new file mode 100644
index 0000000..2b3a0ae
--- /dev/null
+++ b/VueWebCoreApi/Program.cs
@@ -0,0 +1,35 @@
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ CreateHostBuilder(args).Build().Run();
+ }
+
+ public static IHostBuilder CreateHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ //设置Kestrel文件上传大小
+ webBuilder.ConfigureKestrel((context, options) =>
+ {
+ // 获取或设置任何请求正文的最大允许大小(以字节为单位)。 设置为 null 时,最大请求正文大小不受限制
+ // 默认为 30000000 字节 大约为 28.6MB
+
+ options.Limits.MaxRequestBodySize = 1073741824; //限制1G
+ //options.Limits.MaxRequestBodySize = null; //表示不限制
+ });
+ webBuilder.UseStartup<Startup>();
+ });
+ }
+}
diff --git a/VueWebCoreApi/Properties/launchSettings.json b/VueWebCoreApi/Properties/launchSettings.json
new file mode 100644
index 0000000..ccbc616
--- /dev/null
+++ b/VueWebCoreApi/Properties/launchSettings.json
@@ -0,0 +1,38 @@
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:23258",
+ "sslPort": 44334
+ }
+ },
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "VueWebCoreApi": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "swagger",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "https://localhost:5001;http://localhost:5000"
+ }
+ //,
+ //"Docker": {
+ // "commandName": "Docker",
+ // "launchBrowser": true,
+ // "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
+ // "publishAllPorts": true,
+ // "useSSL": true
+ //}
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Quartz/ConvertPath.cs b/VueWebCoreApi/Quartz/ConvertPath.cs
new file mode 100644
index 0000000..2885289
--- /dev/null
+++ b/VueWebCoreApi/Quartz/ConvertPath.cs
@@ -0,0 +1,22 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public static class ConvertPath
+ {
+ public static bool _windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
+ public static string ReplacePath(this string path)
+ {
+ if (string.IsNullOrEmpty(path))
+ return "";
+ if (_windows)
+ return path.Replace("/", "\\");
+ return path.Replace("\\", "/");
+
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/FileHelper.cs b/VueWebCoreApi/Quartz/FileHelper.cs
new file mode 100644
index 0000000..1f3e7d1
--- /dev/null
+++ b/VueWebCoreApi/Quartz/FileHelper.cs
@@ -0,0 +1,113 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class FileHelper
+ {
+ /// <summary>
+ /// 閫氳繃杩唬鍣ㄨ鍙杢xt鏃ュ織鍐呭
+ /// </summary>
+ /// <param name="fullPath"></param>
+ /// <param name="page"></param>
+ /// <param name="pageSize"></param>
+ /// <param name="seekEnd"></param>
+ /// <returns></returns>
+ public static IEnumerable<string> ReadPageLine(string fullPath, int page, int pageSize, bool seekEnd = false)
+ {
+ if (page <= 0)
+ {
+ page = 1;
+ }
+ fullPath = fullPath.ReplacePath();
+ var lines = File.ReadLines(fullPath, Encoding.UTF8);
+ if (seekEnd)
+ {
+ int lineCount = lines.Count();
+ int linPageCount = (int)Math.Ceiling(lineCount / (pageSize * 1.00));
+ //瓒呰繃鎬婚〉鏁帮紝涓嶅鐞�
+ if (page > linPageCount)
+ {
+ page = 0;
+ pageSize = 0;
+ }
+ else if (page == linPageCount)//鏈�鍚庝竴椤碉紝鍙栨渶鍚庝竴椤靛墿涓嬫墍鏈夌殑琛�
+ {
+ pageSize = lineCount - (page - 1) * pageSize;
+ if (page == 1)
+ {
+ page = 0;
+ }
+ else
+ {
+ page = lines.Count() - page * pageSize;
+ }
+ }
+ else
+ {
+ page = lines.Count() - page * pageSize;
+ }
+ }
+ else
+ {
+ page = (page - 1) * pageSize;
+ }
+ lines = lines.Skip(page).Take(pageSize);
+
+ var enumerator = lines.GetEnumerator();
+ int count = 1;
+ while (enumerator.MoveNext() || count <= pageSize)
+ {
+ yield return enumerator.Current;
+ count++;
+ }
+ enumerator.Dispose();
+ }
+
+ public static string ReadFile(string path)
+ {
+ path = path.ReplacePath();
+ if (!File.Exists(path))
+ return "";
+ using (StreamReader stream = new StreamReader(path))
+ {
+ return stream.ReadToEnd(); // 璇诲彇鏂囦欢
+ }
+ }
+
+ /// <summary>
+ /// 鍐欐枃浠�
+ /// </summary>
+ /// <param name="Path">鏂囦欢璺緞</param>
+ /// <param name="Strings">鏂囦欢鍐呭</param>
+ public static void WriteFile(string path, string fileName, string content, bool appendToLast = false)
+ {
+ if (!path.EndsWith("\\"))
+ {
+ path = path + "\\";
+ }
+ path = path.ReplacePath();
+ if (!Directory.Exists(path))//濡傛灉涓嶅瓨鍦ㄥ氨鍒涘缓file鏂囦欢澶�
+ {
+ Directory.CreateDirectory(path);
+ }
+ using (FileStream stream = File.Open(path + fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))
+ {
+ byte[] by = Encoding.Default.GetBytes(content);
+ if (appendToLast)
+ {
+ stream.Position = stream.Length;
+ }
+ else
+ {
+ stream.SetLength(0);
+ }
+ stream.Write(by, 0, by.Length);
+ }
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/FileQuartz.cs b/VueWebCoreApi/Quartz/FileQuartz.cs
new file mode 100644
index 0000000..59ebcb2
--- /dev/null
+++ b/VueWebCoreApi/Quartz/FileQuartz.cs
@@ -0,0 +1,130 @@
+锘縰sing Microsoft.AspNetCore.Hosting;
+using Newtonsoft.Json;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class FileQuartz
+ {
+ private static string _rootPath { get; set; }
+
+ private static string _logPath { get; set; }
+ /// <summary>
+ /// 鍒涘缓浣滀笟鎵�鍦ㄦ牴鐩綍鍙婃棩蹇楁枃浠跺す
+ /// </summary>
+ /// <returns></returns>
+ public static string CreateQuartzRootPath(IWebHostEnvironment env)
+ {
+ if (!string.IsNullOrEmpty(_rootPath))
+ return _rootPath;
+ _rootPath = $"{Directory.GetParent(env.ContentRootPath).FullName}\\{QuartzFileInfo.QuartzSettingsFolder}\\";
+ _rootPath = _rootPath.ReplacePath();
+ if (!Directory.Exists(_rootPath))
+ {
+ Directory.CreateDirectory(_rootPath);
+ }
+ _logPath = _rootPath + QuartzFileInfo.Logs + "\\";
+ _logPath = _logPath.ReplacePath();
+ //鐢熸垚鏃ュ織鏂囦欢澶�
+ if (!Directory.Exists(_logPath))
+ {
+ Directory.CreateDirectory(_logPath);
+ }
+ return _rootPath;
+ }
+
+ /// <summary>
+ /// 鍒濆鍖栦綔涓氭棩蹇楁枃浠�,浠xt浣滀负鏂囦欢
+ /// </summary>
+ /// <param name="groupJobName"></param>
+ public static void InitGroupJobFileLog(string groupJobName)
+ {
+ string jobFile = _logPath + groupJobName;
+ jobFile = jobFile.ReplacePath();
+ if (!File.Exists(jobFile))
+ {
+ File.Create(jobFile);
+ }
+ }
+
+ public static List<TaskLog> GetJobRunLog(string taskName, string groupName, int page, int pageSize = 100)
+ {
+ string path = $"{_logPath}{groupName}\\{taskName}.txt";
+ List<TaskLog> list = new List<TaskLog>();
+
+ path = path.ReplacePath();
+ if (!File.Exists(path))
+ return list;
+ var logs = FileHelper.ReadPageLine(path, page, pageSize, true);
+ foreach (string item in logs)
+ {
+ string[] arr = item?.Split('_');
+ if (item == "" || arr == null || arr.Length == 0)
+ continue;
+ if (arr.Length != 3)
+ {
+ list.Add(new TaskLog() { Msg = item });
+ continue;
+ }
+ list.Add(new TaskLog() { BeginDate = arr[0], EndDate = arr[1], Msg = arr[2] });
+ }
+ return list.OrderByDescending(x => x.BeginDate).ToList();
+ }
+
+ public static void WriteJobConfig(List<TaskOptions> taskList)
+ {
+ //string jobs = JsonConvert.SerializeObject(taskList);
+ string jobs= JsonConvert.SerializeObject(taskList, Formatting.Indented);
+ //鍐欏叆閰嶇疆鏂囦欢
+ FileHelper.WriteFile(_rootPath, QuartzFileInfo.JobConfigFileName, jobs);
+ }
+
+ public static void WriteStartLog(string content)
+ {
+ content = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "," + content;
+ if (!content.EndsWith("\r\n"))
+ {
+ content += "\r\n";
+ }
+ FileHelper.WriteFile(FileQuartz.LogPath, "start.txt", content, true);
+ }
+ public static void WriteJobAction(JobAction jobAction, ITrigger trigger, string taskName, string groupName)
+ {
+ WriteJobAction(jobAction, taskName, groupName, trigger == null ? "鏈壘鍒颁綔涓�" : "OK");
+ }
+ public static void WriteJobAction(JobAction jobAction, string taskName, string groupName, string content = null)
+ {
+ content = $"{jobAction.ToString()} -- {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} --鍒嗙粍锛歿groupName},浣滀笟锛歿taskName},娑堟伅:{content ?? "OK"}\r\n";
+ FileHelper.WriteFile(FileQuartz.LogPath, "action.txt", content, true);
+ }
+
+ public static void WriteAccess(string content = null)
+ {
+ content = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}_{content}\r\n";
+ FileHelper.WriteFile(FileQuartz.LogPath, "access.txt", content, true);
+ }
+
+ public static string GetAccessLog(int pageSize = 1)
+ {
+ string path = FileQuartz.LogPath + "access.txt";
+ path = path.ReplacePath();
+ if (!File.Exists(path))
+ return "娌℃湁鎵惧埌鐩綍";
+ return string.Join("<br/>", FileHelper.ReadPageLine(path, pageSize, 5000, true).ToList());
+ }
+ public static string RootPath
+ {
+ get { return _rootPath; }
+ }
+
+ public static string LogPath
+ {
+ get { return _logPath; }
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/HttpContext.cs b/VueWebCoreApi/Quartz/HttpContext.cs
new file mode 100644
index 0000000..a787cf2
--- /dev/null
+++ b/VueWebCoreApi/Quartz/HttpContext.cs
@@ -0,0 +1,20 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public static class HttpContext
+ {
+ private static IHttpContextAccessor _accessor;
+
+ public static Microsoft.AspNetCore.Http.HttpContext Current => _accessor.HttpContext;
+
+ internal static void Configure(IHttpContextAccessor accessor)
+ {
+ _accessor = accessor;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/HttpManager.cs b/VueWebCoreApi/Quartz/HttpManager.cs
new file mode 100644
index 0000000..f1f9c4a
--- /dev/null
+++ b/VueWebCoreApi/Quartz/HttpManager.cs
@@ -0,0 +1,73 @@
+锘縰sing Microsoft.AspNetCore.Http;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public static class HttpManager
+ {
+ public static string GetUserIP(IHttpContextAccessor httpContextAccessor)
+ {
+ var Request = httpContextAccessor.HttpContext.Request;
+ string realIP = null;
+ string forwarded = null;
+ string remoteIpAddress = httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
+ if (Request.Headers.ContainsKey("X-Real-IP"))
+ {
+ realIP = Request.Headers["X-Real-IP"].ToString();
+ if (realIP != remoteIpAddress)
+ {
+ remoteIpAddress = realIP;
+ }
+ }
+ if (Request.Headers.ContainsKey("X-Forwarded-For"))
+ {
+ forwarded = Request.Headers["X-Forwarded-For"].ToString();
+ if (forwarded != remoteIpAddress)
+ {
+ remoteIpAddress = forwarded;
+ }
+ }
+ return remoteIpAddress;
+ }
+
+
+
+ public static async Task<string> HttpSendAsync(this IHttpClientFactory httpClientFactory, HttpMethod method, string url, Dictionary<string, string> headers = null)
+ {
+
+ var client = httpClientFactory.CreateClient();
+ var content = new StringContent("");
+ //content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
+ //content.Headers.ContentType.CharSet = "utf-8";
+ var request = new HttpRequestMessage(method, url)
+ {
+ Content = content
+ };
+ if (headers != null)
+ {
+ foreach (var header in headers)
+ {
+ request.Headers.Add(header.Key, header.Value);
+ }
+ }
+ try
+ {
+ HttpResponseMessage httpResponseMessage = await client.SendAsync(request);
+
+ var result = await httpResponseMessage.Content
+ .ReadAsStringAsync();
+ return result;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ return ex.Message;
+ }
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/HttpResultfulJob.cs b/VueWebCoreApi/Quartz/HttpResultfulJob.cs
new file mode 100644
index 0000000..c3aa4e5
--- /dev/null
+++ b/VueWebCoreApi/Quartz/HttpResultfulJob.cs
@@ -0,0 +1,94 @@
+锘縰sing log4net;
+using Microsoft.AspNetCore.SignalR;
+using Quartz;
+using Quartz.Impl;
+using Quartz.Impl.Triggers;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Net.Http;
+using System.Threading.Tasks;
+using VueWebCoreApi.Extensions;
+using VueWebCoreApi.SignalR;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class HttpResultfulJob : IJob
+ {
+ private ILog log = LogManager.GetLogger(Startup.repository.Name, typeof(ChatHub));
+ private readonly IHubContext<ChatHub, IChatClient> _hubContext;
+
+ readonly IHttpClientFactory httpClientFactory;
+ /// <summary>
+ /// 2020.05.31澧炲姞鏋勯�犳柟娉�
+ /// </summary>
+ /// <param name="serviceProvider"></param>
+ /// <param name="httpClientFactory"></param>
+ public HttpResultfulJob(IServiceProvider serviceProvider, IHttpClientFactory httpClientFactory, IHubContext<ChatHub, IChatClient> hubContext)
+ {
+ this.httpClientFactory = httpClientFactory;
+ _hubContext = hubContext;
+ //serviceProvider.GetService()
+ }
+ public async Task Execute(IJobExecutionContext context)
+ {
+ DateTime dateTime = DateTime.Now;
+ TaskOptions taskOptions = context.GetTaskOptions();
+ string httpMessage = "";
+ AbstractTrigger trigger = (context as JobExecutionContextImpl).Trigger as AbstractTrigger;
+ if (taskOptions == null)
+ {
+ FileHelper.WriteFile(FileQuartz.LogPath + trigger.Group, $"{trigger.Name}.txt", "鏈埌鎵句綔涓氭垨鍙兘琚Щ闄�", true);
+ return;
+ }
+ Console.WriteLine($"浣滀笟[{taskOptions.TaskName}]寮�濮�:{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss")}");
+ if (string.IsNullOrEmpty(taskOptions.ApiUrl) || taskOptions.ApiUrl == "/")
+ {
+ FileHelper.WriteFile(FileQuartz.LogPath + trigger.Group, $"{trigger.Name}.txt", $"{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss")}鏈厤缃畊rl,", true);
+ return;
+ }
+
+ try
+ {
+ Dictionary<string, string> header = new Dictionary<string, string>();
+ if (!string.IsNullOrEmpty(taskOptions.AuthKey) && !string.IsNullOrEmpty(taskOptions.AuthValue))
+ {
+ header.Add(taskOptions.AuthKey.Trim(), taskOptions.AuthValue.Trim());
+ }
+
+ httpMessage = await httpClientFactory.HttpSendAsync(taskOptions.RequestType?.ToLower() == "get" ? HttpMethod.Get : HttpMethod.Post, taskOptions.ApiUrl, header);
+ }
+ catch (Exception ex)
+ {
+ httpMessage = ex.Message;
+ }
+
+ try
+ {
+ string logContent = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}_{dateTime.ToString("yyyy-MM-dd HH:mm:ss")}_{(string.IsNullOrEmpty(httpMessage) ? "OK" : httpMessage)}\r\n";
+ FileHelper.WriteFile(FileQuartz.LogPath + taskOptions.GroupName + "\\", $"{taskOptions.TaskName}.txt", logContent, true);
+ //await _hubContext.Clients.All.SendAsync("SendMessage绯荤粺閫氱煡:"+$"鏈�鏂版秷鎭瘂DateTime.Now}");
+ //await _hubContext.Clients.All.SendAll(logContent);
+ //鏌ユ壘绯荤粺鐢ㄦ埛
+ var sql = @"select usercode as code,username as name
+ from TUser
+ where is_delete='0' and enable='Y' and password='123'";
+ var data = DapperHelper.selecttable(sql);
+ var departmentIDs = data.AsEnumerable().Select(x => x.Field<string>("code")).ToList();//鑾峰彇鎺ㄩ�佷汉鍛樼紪鐮�
+ var FindPublicBaseDic = UserIdsStore.Ids.Where(d => departmentIDs.Contains(d.Value)).Select(x => x.Key).ToList(); //鍖归厤宸茬粡鐧诲綍鐨勬帹閫佷汉鍛榗onnectionIds
+ if (FindPublicBaseDic.Count > 0)
+ {
+ //鎺ㄩ�佹寚瀹氱敤鎴�
+ await _hubContext.Clients.Clients(FindPublicBaseDic).SendCustomUserMessage(logContent);
+ }
+ }
+ catch (Exception)
+ {
+ }
+ Console.WriteLine(trigger.FullName + " " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss") + " " + httpMessage);
+ return;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/IOCJobFactory.cs b/VueWebCoreApi/Quartz/IOCJobFactory.cs
new file mode 100644
index 0000000..4240437
--- /dev/null
+++ b/VueWebCoreApi/Quartz/IOCJobFactory.cs
@@ -0,0 +1,28 @@
+锘縰sing Quartz;
+using Quartz.Spi;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class IOCJobFactory : IJobFactory
+ {
+ private readonly IServiceProvider _serviceProvider;
+ public IOCJobFactory(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider;
+ }
+ public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
+ {
+ return _serviceProvider.GetService(bundle.JobDetail.JobType) as IJob;
+
+ }
+
+ public void ReturnJob(IJob job)
+ {
+ (job as IDisposable)?.Dispose();
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/IPathProvider.cs b/VueWebCoreApi/Quartz/IPathProvider.cs
new file mode 100644
index 0000000..af76ac2
--- /dev/null
+++ b/VueWebCoreApi/Quartz/IPathProvider.cs
@@ -0,0 +1,48 @@
+锘縰sing Microsoft.AspNetCore.Hosting;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public interface IPathProvider
+ {
+ string MapPath(string path);
+ string MapPath(string path, bool rootPath);
+ IWebHostEnvironment GetHostingEnvironment();
+ }
+ public class PathProvider : IPathProvider
+ {
+ private IWebHostEnvironment _hostingEnvironment;
+
+ public PathProvider(IWebHostEnvironment environment)
+ {
+ _hostingEnvironment = environment;
+ }
+ public IWebHostEnvironment GetHostingEnvironment()
+ {
+ return _hostingEnvironment;
+ }
+
+ public string MapPath(string path)
+ {
+ return MapPath(path, false);
+ }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="path"></param>
+ /// <param name="rootPath">鑾峰彇wwwroot璺緞</param>
+ /// <returns></returns>
+ public string MapPath(string path, bool rootPath)
+ {
+ if (rootPath)
+ {
+ return Path.Combine(_hostingEnvironment.WebRootPath, path);
+ }
+ return Path.Combine(_hostingEnvironment.ContentRootPath, path);
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/JobAction.cs b/VueWebCoreApi/Quartz/JobAction.cs
new file mode 100644
index 0000000..be66f29
--- /dev/null
+++ b/VueWebCoreApi/Quartz/JobAction.cs
@@ -0,0 +1,18 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public enum JobAction
+ {
+ 鏂板 = 1,
+ 鍒犻櫎 = 2,
+ 淇敼 = 3,
+ 鏆傚仠 = 4,
+ 鍋滄,
+ 寮�鍚�,
+ 绔嬪嵆鎵ц
+ }
+}
diff --git a/VueWebCoreApi/Quartz/QuartzFileInfo.cs b/VueWebCoreApi/Quartz/QuartzFileInfo.cs
new file mode 100644
index 0000000..c588a6d
--- /dev/null
+++ b/VueWebCoreApi/Quartz/QuartzFileInfo.cs
@@ -0,0 +1,22 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class QuartzFileInfo
+ {
+ /// <summary>
+ /// 鎵�鏈変换鍔$浉鍏冲瓨鏀剧殑鏂囦欢澶归粯璁ょ敓鎴愬湪褰撳墠椤圭洰绫诲簱鍚岀骇(瀛愭枃浠跺す鍖呮嫭锛氭棩蹇�,浣滀笟閰嶇疆)
+ /// </summary>
+ public static string QuartzSettingsFolder = "QuartzSettings";
+ //鎵�鏈変綔涓氶厤缃瓨鍌ㄦ枃浠�
+ public static string JobConfigFileName = "job_options.json";
+
+ /// <summary>
+ /// 鏃ュ織鏂囦欢澶瑰悕绉�
+ /// </summary>
+ public static string Logs = "logs";
+ }
+}
diff --git a/VueWebCoreApi/Quartz/QuartzNETExtension.cs b/VueWebCoreApi/Quartz/QuartzNETExtension.cs
new file mode 100644
index 0000000..51e3bdf
--- /dev/null
+++ b/VueWebCoreApi/Quartz/QuartzNETExtension.cs
@@ -0,0 +1,512 @@
+锘縰sing Dapper;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.DependencyInjection;
+using Newtonsoft.Json;
+using Quartz;
+using Quartz.Impl;
+using Quartz.Impl.Matchers;
+using Quartz.Impl.Triggers;
+using Quartz.Spi;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Quartz;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Extensions
+{
+ public static class QuartzNETExtension
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ private static List<TaskOptions> _taskList = new List<TaskOptions>();
+
+ /// <summary>
+ /// 鍒濆鍖栦綔涓�
+ /// </summary>
+ /// <param name="applicationBuilder"></param>
+ /// <param name="env"></param>
+ /// <returns></returns>
+ public static IApplicationBuilder UseQuartz(this IApplicationBuilder applicationBuilder, IWebHostEnvironment env)
+ {
+ IServiceProvider services = applicationBuilder.ApplicationServices;
+
+ ISchedulerFactory _schedulerFactory = services.GetService<ISchedulerFactory>();
+
+ string path = FileQuartz.CreateQuartzRootPath(env);
+ //鏌ユ壘浠诲姟鍒楄〃
+ var data = QuartzSearchData.QuartzSearch();
+ if (data.Rows.Count <= 0)
+ {
+ FileHelper.WriteFile(FileQuartz.LogPath, "start.txt", $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},娌℃湁榛樿閰嶇疆浠诲姟\r\n", true);
+ return applicationBuilder;
+ }
+ string jobConfig = JsonConvert.SerializeObject(data);
+
+ //string jobConfig = FileHelper.ReadFile(path + QuartzFileInfo.JobConfigFileName);
+ //if (string.IsNullOrEmpty(jobConfig))
+ //{
+ // FileHelper.WriteFile(FileQuartz.LogPath, "start.txt", $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},娌℃湁榛樿閰嶇疆浠诲姟\r\n", true);
+ // return applicationBuilder;
+ //}
+
+ int errorCount = 0;
+ string errorMsg = "";
+ TaskOptions options = null;
+ try
+ {
+ _taskList = JsonConvert.DeserializeObject<List<TaskOptions>>(jobConfig);
+ _taskList.ForEach(x =>
+ {
+ options = x;
+ var result = x.AddJob(_schedulerFactory, true, jobFactory: services.GetService<IJobFactory>()).GetAwaiter().GetResult();
+ });
+ }
+ catch (Exception ex)
+ {
+ errorCount = +1;
+ errorMsg += $"浣滀笟:{options?.TaskName},寮傚父锛歿ex.Message}";
+ }
+ string content = $"鎴愬姛:{ _taskList.Count - errorCount}涓�,澶辫触{errorCount}涓�,寮傚父锛歿errorMsg}\r\n";
+ FileQuartz.WriteStartLog(content);
+
+
+ return applicationBuilder;
+ }
+
+ /// <summary>
+ /// 鑾峰彇鎵�鏈夌殑浣滀笟
+ /// </summary>
+ /// <param name="schedulerFactory"></param>
+ /// <returns></returns>
+ public static async Task<List<TaskOptions>> GetJobs(this ISchedulerFactory schedulerFactory)
+ {
+ List<TaskOptions> list = new List<TaskOptions>();
+ try
+ {
+ IScheduler _scheduler = await schedulerFactory.GetScheduler();
+ var groups = await _scheduler.GetJobGroupNames();
+ foreach (var groupName in groups)
+ {
+ foreach (var jobKey in await _scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupEquals(groupName)))
+ {
+ TaskOptions taskOptions = _taskList.Where(x => x.GroupName == jobKey.Group && x.TaskName == jobKey.Name)
+ .FirstOrDefault();
+ if (taskOptions == null)
+ continue;
+
+ var triggers = await _scheduler.GetTriggersOfJob(jobKey);
+ foreach (ITrigger trigger in triggers)
+ {
+ DateTimeOffset? dateTimeOffset = trigger.GetPreviousFireTimeUtc();
+ if (dateTimeOffset != null)
+ {
+ taskOptions.LastRunTime = Convert.ToDateTime(dateTimeOffset.ToString());
+ //鏇存敼鏈�鍚庢墽琛屾椂闂�
+ bool aa = QuartzSearchData.QuartzUpdate(taskOptions);
+ }
+ else
+ {
+ var runlog = FileQuartz.GetJobRunLog(taskOptions.TaskName, taskOptions.GroupName, 1, 2);
+ if (runlog.Count > 0)
+ {
+ DateTime.TryParse(runlog[0].BeginDate, out DateTime lastRunTime);
+ taskOptions.LastRunTime = lastRunTime;
+ //鏇存敼鏈�鍚庢墽琛屾椂闂�
+ bool aa = QuartzSearchData.QuartzUpdate(taskOptions);
+ }
+ }
+ }
+ list.Add(taskOptions);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = ex.Message + ex.StackTrace;
+ mes.data = null;
+ FileQuartz.WriteStartLog("鑾峰彇浣滀笟寮傚父锛�" + ex.Message + ex.StackTrace);
+ }
+ return list;
+ }
+
+ /// <summary>
+ /// 娣诲姞浣滀笟
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <param name="schedulerFactory"></param>
+ /// <param name="init">鏄惁鍒濆鍖�,鍚�=闇�瑕侀噸鏂扮敓鎴愰厤缃枃浠讹紝鏄�=涓嶉噸鏂扮敓鎴愰厤缃枃浠�</param>
+ /// <returns></returns>
+ public static async Task<object> AddJob(this TaskOptions taskOptions, ISchedulerFactory schedulerFactory, bool init = false, IJobFactory jobFactory = null)
+ {
+ try
+ {
+ //澶勭悊鍓嶇Corn琛ㄨ揪寮忔渶鍚庝竴涓湀鐨勬槦鏈熷ぉ琛ㄨ揪寮忕己闄烽棶棰�
+ string resultString = "";
+ string[] str = taskOptions.Interval.Split(" ");
+ if ((str[3].Equals("1L") || str[3].Equals("2L") || str[3].Equals("3L") || str[3].Equals("4L") || str[3].Equals("5L") || str[3].Equals("6L") || str[3].Equals("7L")) && str[5].Equals("?"))
+ {
+ str[5] = str[3];
+ str[3] = "?";
+ for (int i = 0; i < str.Length; i++)
+ {
+ resultString += str[i] + " ";
+ }
+ taskOptions.Interval = resultString;
+ }
+ (bool, string) validExpression = taskOptions.Interval.IsValidExpression();
+ if (!validExpression.Item1)
+ return new { code = 300,count=0,Message=validExpression.Item2,data="null" };
+
+ (bool, object) result = taskOptions.Exists(init);
+ if (!result.Item1)
+ return result.Item2;
+ if (!init)
+ {
+ //灏嗗巻鍙蹭换鍔″強鏂板鍔犱换鍔″ぉ鍔犲埌List闆嗗悎
+ _taskList.Add(taskOptions);
+ //灏嗛泦鍚堟暟鎹坊鍔犲埌json鏂囦欢(瑕嗙洊寮�)
+ FileQuartz.WriteJobConfig(_taskList);
+ //灏嗗綋鍓嶆柊浠诲姟娣诲姞鍒版暟鎹〃
+ bool aa = QuartzSearchData.QuartzCreate(taskOptions);
+ }
+
+ IJobDetail job = JobBuilder.Create<HttpResultfulJob>().WithIdentity(taskOptions.TaskName, taskOptions.GroupName).Build();
+ ITrigger trigger = TriggerBuilder.Create()
+ .WithIdentity(taskOptions.TaskName, taskOptions.GroupName)
+ .StartNow()
+ .WithDescription(taskOptions.Describe)
+ .WithCronSchedule(taskOptions.Interval)
+ .Build();
+
+ IScheduler scheduler = await schedulerFactory.GetScheduler();
+
+ if (jobFactory == null)
+ {
+ try
+ {
+ jobFactory = HttpContext.Current.RequestServices.GetService<IJobFactory>();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"鍒涘缓浠诲姟[{taskOptions.TaskName}]寮傚父,{ex.Message}");
+ }
+ }
+
+ if (jobFactory != null)
+ {
+ scheduler.JobFactory = jobFactory;
+ }
+
+ await scheduler.ScheduleJob(job, trigger);
+ if (taskOptions.Status == (int)TriggerState.Normal)
+ {
+ await scheduler.Start();
+ }
+ else
+ {
+ await scheduler.PauseJob(job.Key);
+ // await schedulerFactory.Pause(taskOptions);
+ FileQuartz.WriteStartLog($"浣滀笟:{taskOptions.TaskName},鍒嗙粍:{taskOptions.GroupName},鏂板缓鏃舵湭鍚姩鍘熷洜,鐘舵�佷负:{taskOptions.Status}");
+ }
+ if (!init)
+ FileQuartz.WriteJobAction(JobAction.鏂板, taskOptions.TaskName, taskOptions.GroupName);
+ mes.code = "200";
+ mes.count = 0;
+ mes.message ="鎵ц鎴愬姛锛�";
+ mes.data = null;
+ }
+ catch (Exception ex)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = ex.Message;
+ mes.data = null;
+ return new { status = false, msg = ex.Message };
+ }
+ return mes;
+ }
+
+ /// <summary>
+ /// 绉婚櫎浣滀笟
+ /// </summary>
+ /// <param name="schedulerFactory"></param>
+ /// <param name="taskName"></param>
+ /// <param name="groupName"></param>
+ /// <returns></returns>
+ public static Task<object> Remove(this ISchedulerFactory schedulerFactory, TaskOptions taskOptions)
+ {
+ return schedulerFactory.TriggerAction(taskOptions.TaskName, taskOptions.GroupName, JobAction.鍒犻櫎, taskOptions);
+ }
+
+ /// <summary>
+ /// 鏇存柊浣滀笟
+ /// </summary>
+ /// <param name="schedulerFactory"></param>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ public static Task<object> Update(this ISchedulerFactory schedulerFactory, TaskOptions taskOptions)
+ {
+ return schedulerFactory.TriggerAction(taskOptions.TaskName, taskOptions.GroupName, JobAction.淇敼, taskOptions);
+ }
+
+ /// <summary>
+ /// 鏆傚仠浣滀笟
+ /// </summary>
+ /// <param name="schedulerFactory"></param>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ public static Task<object> Pause(this ISchedulerFactory schedulerFactory, TaskOptions taskOptions)
+ {
+ return schedulerFactory.TriggerAction(taskOptions.TaskName, taskOptions.GroupName, JobAction.鏆傚仠, taskOptions);
+ }
+
+ /// <summary>
+ /// 鍚姩浣滀笟
+ /// </summary>
+ /// <param name="schedulerFactory"></param>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ public static Task<object> Start(this ISchedulerFactory schedulerFactory, TaskOptions taskOptions)
+ {
+ return schedulerFactory.TriggerAction(taskOptions.TaskName, taskOptions.GroupName, JobAction.寮�鍚�, taskOptions);
+ }
+
+ /// <summary>
+ /// 绔嬪嵆鎵ц涓�娆′綔涓�
+ /// </summary>
+ /// <param name="schedulerFactory"></param>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ public static Task<object> Run(this ISchedulerFactory schedulerFactory, TaskOptions taskOptions)
+ {
+ return schedulerFactory.TriggerAction(taskOptions.TaskName, taskOptions.GroupName, JobAction.绔嬪嵆鎵ц, taskOptions);
+ }
+
+ public static object ModifyTaskEntity(this TaskOptions taskOptions, ISchedulerFactory schedulerFactory, JobAction action)
+ {
+ TaskOptions options = null;
+ object result = null;
+ switch (action)
+ {
+ case JobAction.鍒犻櫎:
+ for (int i = 0; i < _taskList.Count; i++)
+ {
+ options = _taskList[i];
+ if (options.TaskName == taskOptions.TaskName && options.GroupName == taskOptions.GroupName)
+ {
+ _taskList.RemoveAt(i);
+ //鍒犻櫎浠诲姟
+ bool aa = QuartzSearchData.QuartzDelete(options);
+ }
+ }
+ break;
+ case JobAction.淇敼:
+ options = _taskList.Where(x => x.TaskName == taskOptions.TaskName && x.GroupName == taskOptions.GroupName).FirstOrDefault();
+ //绉婚櫎浠ュ墠鐨勯厤缃�
+ if (options != null)
+ {
+ _taskList.Remove(options);
+ //鍒犻櫎浠诲姟
+ bool aa = QuartzSearchData.QuartzDelete(options);
+ }
+
+ //鐢熸垚浠诲姟骞舵坊鍔犳柊閰嶇疆
+ result = taskOptions.AddJob(schedulerFactory, false).GetAwaiter().GetResult();
+ break;
+ case JobAction.鏆傚仠:
+ case JobAction.寮�鍚�:
+ case JobAction.鍋滄:
+ case JobAction.绔嬪嵆鎵ц:
+ options = _taskList.Where(x => x.TaskName == taskOptions.TaskName && x.GroupName == taskOptions.GroupName).FirstOrDefault();
+ if (action == JobAction.鏆傚仠)
+ {
+ options.Status = (int)TriggerState.Paused;
+ //鏇存柊浠诲姟鐘舵��
+ bool aa= QuartzSearchData.QuartzUpdate(options);
+ }
+ else if (action == JobAction.鍋滄)
+ {
+ options.Status = (int)action;
+ //鏇存柊浠诲姟鐘舵��
+ bool aa = QuartzSearchData.QuartzUpdate(options);
+ }
+ else
+ {
+ options.Status = (int)TriggerState.Normal;
+ //鏇存柊浠诲姟鐘舵��
+ bool aa = QuartzSearchData.QuartzUpdate(options);
+ }
+ break;
+ }
+ //鐢熸垚閰嶇疆鏂囦欢
+ FileQuartz.WriteJobConfig(_taskList);
+ FileQuartz.WriteJobAction(action, taskOptions.TaskName, taskOptions.GroupName, "鎿嶄綔瀵硅薄锛�" + JsonConvert.SerializeObject(taskOptions));
+ return result;
+ }
+
+ /// <summary>
+ /// 瑙﹀彂鏂板銆佸垹闄ゃ�佷慨鏀广�佹殏鍋溿�佸惎鐢ㄣ�佺珛鍗虫墽琛屼簨浠�
+ /// </summary>
+ /// <param name="schedulerFactory"></param>
+ /// <param name="taskName"></param>
+ /// <param name="groupName"></param>
+ /// <param name="action"></param>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ public static async Task<object> TriggerAction(this ISchedulerFactory schedulerFactory, string taskName, string groupName, JobAction action, TaskOptions taskOptions = null)
+ {
+ string errorMsg = "";
+ try
+ {
+ //澶勭悊鍓嶇Corn琛ㄨ揪寮忔渶鍚庝竴涓湀鐨勬槦鏈熷ぉ琛ㄨ揪寮忕己闄烽棶棰�
+ string resultString = "";
+ string[] str = taskOptions.Interval.Split(" ");
+ if ((str[3].Equals("1L") || str[3].Equals("2L") || str[3].Equals("3L") || str[3].Equals("4L") || str[3].Equals("5L") || str[3].Equals("6L") || str[3].Equals("7L")) && str[5].Equals("?"))
+ {
+ str[5] = str[3];
+ str[3] = "?";
+ for (int i = 0; i < str.Length; i++)
+ {
+ resultString += str[i] + " ";
+ }
+ taskOptions.Interval = resultString;
+ }
+ IScheduler scheduler = await schedulerFactory.GetScheduler();
+ List<JobKey> jobKeys = scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupEquals(groupName)).Result.ToList();
+ if (jobKeys == null || jobKeys.Count() == 0)
+ {
+ errorMsg = $"鏈壘鍒板垎缁刐{groupName}]";
+ return new { code = 300, count = 0, Message = errorMsg, data = "null" };
+ //return new { status = false, msg = errorMsg };
+ }
+ JobKey jobKey = jobKeys.Where(s => scheduler.GetTriggersOfJob(s).Result.Any(x => (x as CronTriggerImpl).Name == taskName)).FirstOrDefault();
+ if (jobKey == null)
+ {
+ errorMsg = $"鏈壘鍒拌Е鍙戝櫒[{taskName}]";
+ return new { code = 300, count = 0, Message = errorMsg, data = "null" };
+ }
+ var triggers = await scheduler.GetTriggersOfJob(jobKey);
+ ITrigger trigger = triggers?.Where(x => (x as CronTriggerImpl).Name == taskName).FirstOrDefault();
+
+ if (trigger == null)
+ {
+ errorMsg = $"鏈壘鍒拌Е鍙戝櫒[{taskName}]";
+ return new { code = 300, count = 0, Message = errorMsg, data = "null" };
+ }
+ object result = null;
+ switch (action)
+ {
+ case JobAction.鍒犻櫎:
+ case JobAction.淇敼:
+ await scheduler.PauseTrigger(trigger.Key);
+ await scheduler.UnscheduleJob(trigger.Key);// 绉婚櫎瑙﹀彂鍣�
+ await scheduler.DeleteJob(trigger.JobKey);
+ result = taskOptions.ModifyTaskEntity(schedulerFactory, action);
+ break;
+ case JobAction.鏆傚仠:
+ case JobAction.鍋滄:
+ case JobAction.寮�鍚�:
+ result = taskOptions.ModifyTaskEntity(schedulerFactory, action);
+ if (action == JobAction.鏆傚仠)
+ {
+ await scheduler.PauseTrigger(trigger.Key);
+ }
+ else if (action == JobAction.寮�鍚�)
+ {
+ await scheduler.ResumeTrigger(trigger.Key);
+ // await scheduler.RescheduleJob(trigger.Key, trigger);
+ }
+ else
+ {
+ await scheduler.Shutdown();
+ }
+ break;
+ case JobAction.绔嬪嵆鎵ц:
+ if (taskOptions != null && taskOptions.Status != (int)TriggerState.Normal)
+ {
+ result = taskOptions.ModifyTaskEntity(schedulerFactory, JobAction.寮�鍚�);
+ await scheduler.ResumeTrigger(trigger.Key);
+
+ }
+ else {
+ await scheduler.TriggerJob(jobKey);
+ }
+
+ break;
+ }
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = $"浣滀笟{action.ToString()}鎴愬姛";
+ mes.data = null;
+ return result ?? mes;
+ //return result ?? new { status = true, msg = $"浣滀笟{action.ToString()}鎴愬姛" };
+ }
+ catch (Exception ex)
+ {
+ errorMsg = ex.Message;
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = errorMsg;
+ mes.data = null;
+ return mes;
+ //return new { status = false, msg = ex.Message };
+ }
+ finally
+ {
+ FileQuartz.WriteJobAction(action, taskName, groupName, errorMsg);
+ }
+ }
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="context"></param>閫氳繃浣滀笟涓婁笅鏂囪幏鍙栦綔涓氬搴旂殑閰嶇疆鍙傛暟
+ /// <returns></returns>
+ public static TaskOptions GetTaskOptions(this IJobExecutionContext context)
+ {
+ AbstractTrigger trigger = (context as JobExecutionContextImpl).Trigger as AbstractTrigger;
+ TaskOptions taskOptions = _taskList.Where(x => x.TaskName == trigger.Name && x.GroupName == trigger.Group).FirstOrDefault();
+ return taskOptions ?? _taskList.Where(x => x.TaskName == trigger.JobName && x.GroupName == trigger.JobGroup).FirstOrDefault();
+ }
+
+ /// <summary>
+ /// 浣滀笟鏄惁瀛樺湪
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <param name="init">鍒濆鍖栫殑涓嶉渶瑕佸垽鏂�</param>
+ /// <returns></returns>
+ public static (bool, object) Exists(this TaskOptions taskOptions, bool init)
+ {
+ if (!init && _taskList.Any(x => x.TaskName == taskOptions.TaskName && x.GroupName == taskOptions.GroupName))
+ {
+ return (false,
+ new
+ {
+ status = false,
+ msg = $"浣滀笟:{taskOptions.TaskName},鍒嗙粍锛歿taskOptions.GroupName}宸茬粡瀛樺湪"
+ });
+ }
+ return (true, null);
+ }
+
+ public static (bool, string) IsValidExpression(this string cronExpression)
+ {
+ try
+ {
+ CronTriggerImpl trigger = new CronTriggerImpl();
+ trigger.CronExpressionString = cronExpression;
+ DateTimeOffset? date = trigger.ComputeFirstFireTimeUtc(null);
+ return (date != null, date == null ? $"璇风‘璁よ〃杈惧紡{cronExpression}鏄惁姝g‘!" : "");
+ }
+ catch (Exception e)
+ {
+ return (false, $"璇风‘璁よ〃杈惧紡{cronExpression}鏄惁姝g‘!{e.Message}");
+ }
+ }
+ }
+
+}
diff --git a/VueWebCoreApi/Quartz/QuartzSearchData.cs b/VueWebCoreApi/Quartz/QuartzSearchData.cs
new file mode 100644
index 0000000..7f34698
--- /dev/null
+++ b/VueWebCoreApi/Quartz/QuartzSearchData.cs
@@ -0,0 +1,116 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class QuartzSearchData
+ {
+ /// <summary>
+ /// 鏌ヨ浠诲姟鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public static DataTable QuartzSearch()
+ {
+ //鏌ユ壘浠诲姟鍒楄〃
+ var sql = @"select TaskName,GroupName,Interval,ApiUrl,AuthKey,AuthValue,Describe,RequestType,LastRunTime,Status
+ from ScheduleInfo";
+ var data = DapperHelper.selecttable(sql);
+ return data;
+ }
+
+ /// <summary>
+ /// 鏂板浠诲姟
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ public static bool QuartzCreate(TaskOptions taskOptions)
+ {
+ List<object> list = new List<object>();
+ string sql = @"insert into ScheduleInfo(TaskName,GroupName,Interval,ApiUrl,AuthKey,AuthValue,Describe,RequestType,LastRunTime,Status,CreateAuthr,CreateTime)
+ values(@TaskName,@GroupName,@Interval,@ApiUrl,@AuthKey,@AuthValue,@Describe,@RequestType,@LastRunTime,@Status,@CreateAuthr,@CreateTime)";
+ list.Add(new { str = sql, parm = new {
+ TaskName = taskOptions.TaskName,
+ GroupName = taskOptions.GroupName,
+ Interval = taskOptions.Interval,
+ ApiUrl = taskOptions.ApiUrl,
+ AuthKey = taskOptions.AuthKey,
+ AuthValue = taskOptions.AuthValue,
+ Describe = taskOptions.Describe,
+ RequestType = taskOptions.RequestType,
+ LastRunTime = taskOptions.LastRunTime,
+ Status=taskOptions.Status,
+ CreateAuthr="9999",
+ CreateTime= DateTime.Now.ToString()
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ return aa;
+ }
+
+ /// <summary>
+ /// 淇敼浠诲姟
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ public static bool QuartzUpdate(TaskOptions taskOptions)
+ {
+ List<object> list = new List<object>();
+ string sql = @"update ScheduleInfo set TaskName=@TaskName,GroupName=@GroupName,Interval=@Interval,ApiUrl=@ApiUrl,AuthKey=@AuthKey,AuthValue=@AuthValue,Describe=@Describe,RequestType=@RequestType,LastRunTime=@LastRunTime,Status=@Status
+ where TaskName=@TaskName and GroupName=@GroupName";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ TaskName = taskOptions.TaskName,
+ GroupName = taskOptions.GroupName,
+ Interval = taskOptions.Interval,
+ ApiUrl = taskOptions.ApiUrl,
+ AuthKey = taskOptions.AuthKey,
+ AuthValue = taskOptions.AuthValue,
+ Describe = taskOptions.Describe,
+ RequestType = taskOptions.RequestType,
+ LastRunTime = taskOptions.LastRunTime,
+ Status = taskOptions.Status
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ return aa;
+ }
+
+ /// <summary>
+ /// 鍒犻櫎浠诲姟
+ /// </summary>
+ /// <param name="taskOptions"></param>
+ /// <returns></returns>
+ public static bool QuartzDelete(TaskOptions taskOptions)
+ {
+ List<object> list = new List<object>();
+ string sql = @"delete ScheduleInfo where TaskName=@TaskName and GroupName=@GroupName";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ TaskName = taskOptions.TaskName,
+ GroupName = taskOptions.GroupName,
+ Interval = taskOptions.Interval,
+ ApiUrl = taskOptions.ApiUrl,
+ AuthKey = taskOptions.AuthKey,
+ AuthValue = taskOptions.AuthValue,
+ Describe = taskOptions.Describe,
+ RequestType = taskOptions.RequestType,
+ LastRunTime = taskOptions.LastRunTime,
+ Status = taskOptions.Status
+ }
+ });
+ bool aa = DapperHelper.DoTransaction(list);
+ return aa;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/StaticHttpContextExtensions.cs b/VueWebCoreApi/Quartz/StaticHttpContextExtensions.cs
new file mode 100644
index 0000000..20d0cdd
--- /dev/null
+++ b/VueWebCoreApi/Quartz/StaticHttpContextExtensions.cs
@@ -0,0 +1,20 @@
+锘縰sing Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Extensions
+{
+ public static class StaticHttpContextExtensions
+ {
+ public static IApplicationBuilder UseStaticHttpContext(this IApplicationBuilder app)
+ {
+ var httpContextAccessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>();
+ Quartz.HttpContext.Configure(httpContextAccessor);
+ return app;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/TaskAuthorAttribute.cs b/VueWebCoreApi/Quartz/TaskAuthorAttribute.cs
new file mode 100644
index 0000000..a0a1aa8
--- /dev/null
+++ b/VueWebCoreApi/Quartz/TaskAuthorAttribute.cs
@@ -0,0 +1,13 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class TaskAuthorAttribute : Attribute
+ {
+ public string Name { get; set; }
+ public string Role { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/TaskLog.cs b/VueWebCoreApi/Quartz/TaskLog.cs
new file mode 100644
index 0000000..d106211
--- /dev/null
+++ b/VueWebCoreApi/Quartz/TaskLog.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class TaskLog
+ {
+ public string BeginDate { get; set; }
+ public string EndDate { get; set; }
+ public string Msg { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Quartz/TaskOptions.cs b/VueWebCoreApi/Quartz/TaskOptions.cs
new file mode 100644
index 0000000..a921c10
--- /dev/null
+++ b/VueWebCoreApi/Quartz/TaskOptions.cs
@@ -0,0 +1,21 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Quartz
+{
+ public class TaskOptions
+ {
+ public string TaskName { get; set; }
+ public string GroupName { get; set; }
+ public string Interval { get; set; }
+ public string ApiUrl { get; set; }
+ public string AuthKey { get; set; }
+ public string AuthValue { get; set; }
+ public string Describe { get; set; }
+ public string RequestType { get; set; }
+ public DateTime? LastRunTime { get; set; }
+ public int Status { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/SignalR/ChatHub.cs b/VueWebCoreApi/SignalR/ChatHub.cs
new file mode 100644
index 0000000..643cdf2
--- /dev/null
+++ b/VueWebCoreApi/SignalR/ChatHub.cs
@@ -0,0 +1,87 @@
+锘縰sing log4net;
+using Microsoft.AspNet.SignalR.Hubs;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.SignalR;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi.SignalR
+{
+ public class ChatHub : Hub<IChatClient>
+ {
+ private readonly IHttpContextAccessor _httpContextAccessor;
+ private ILog log = LogManager.GetLogger(Startup.repository.Name, typeof(ChatHub));
+ ILogger<ChatHub> _logger;
+ public ChatHub(ILogger<ChatHub> logger, IHttpContextAccessor httpContextAccessor)
+ {
+ _logger = logger;
+ _httpContextAccessor = httpContextAccessor;
+ }
+ /// <summary>
+ /// 瀹㈡埛绔繛鎺ユ湇鍔$
+ /// </summary>
+ /// <returns></returns>
+ public override Task OnConnectedAsync()
+ {
+ log.Info("寮�鍚繛鎺ユ湇鍔�");
+ var id = Context.ConnectionId;
+ _logger.LogInformation($"Client ConnectionId=> [[{id}]] Already Connection Server锛�");
+ return base.OnConnectedAsync();
+ }
+ /// <summary>
+ /// 瀹㈡埛绔柇寮�杩炴帴
+ /// </summary>
+ /// <param name="exception"></param>
+ /// <returns></returns>
+ public override Task OnDisconnectedAsync(Exception exception)
+ {
+ var id = Context.ConnectionId;
+ // 鍒犻櫎鐢ㄦ埛ID
+ UserIdsStore.Ids.Remove(id);
+ _logger.LogInformation($"Client ConnectionId=> [[{id}]] Already Close Connection Server!");
+ return base.OnDisconnectedAsync(exception);
+ }
+ /**
+ * 娴嬭瘯
+ * */
+ /// <summary>
+ /// 缁欐墍鏈夊鎴风鍙戦�佹秷鎭�
+ /// </summary>
+ /// <returns></returns>
+ public async Task SendMessage(string data)
+ {
+ await Clients.All.SendAll(data);
+ }
+
+ /// <summary>
+ /// 娣诲姞鍒板湪绾跨敤鎴峰垪琛�
+ /// </summary>
+ /// <param name="usercode"></param>
+ /// <returns></returns>
+ public async Task AddUser(string usercode)
+ {
+ string cid = Context.ConnectionId;
+ if (!UserIdsStore.Ids.ContainsValue(usercode))
+ {
+ await Task.Run(() => UserIdsStore.Ids.Add(cid, usercode));
+ }
+ else
+ {
+ //lambada琛ㄨ揪寮�:鏍规嵁鍊煎幓閿悕Key
+ string key = UserIdsStore.Ids.FirstOrDefault(d => d.Value == usercode).Key.ToString();
+ // 鍒涘缓涓�涓柊鐨勯敭鍊煎
+ UserIdsStore.Ids.Add(cid, usercode);
+ // 绉婚櫎鏃х殑閿�煎
+ UserIdsStore.Ids.Remove(key);
+ }
+
+ }
+ }
+}
diff --git a/VueWebCoreApi/SignalR/IChatClient.cs b/VueWebCoreApi/SignalR/IChatClient.cs
new file mode 100644
index 0000000..3911bc8
--- /dev/null
+++ b/VueWebCoreApi/SignalR/IChatClient.cs
@@ -0,0 +1,13 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.SignalR
+{
+ public interface IChatClient
+ {
+ Task SendAll(object message);
+ Task SendCustomUserMessage(object message);
+ }
+}
diff --git a/VueWebCoreApi/SignalR/UserIdsStore.cs b/VueWebCoreApi/SignalR/UserIdsStore.cs
new file mode 100644
index 0000000..4090d89
--- /dev/null
+++ b/VueWebCoreApi/SignalR/UserIdsStore.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.SignalR
+{
+ /// <summary>
+ /// 鐢ㄦ埛id闆嗗悎
+ /// </summary>
+ public static class UserIdsStore
+ {
+ public static Dictionary<string, string> Ids = new Dictionary<string, string>();
+ }
+}
diff --git a/VueWebCoreApi/Startup.cs b/VueWebCoreApi/Startup.cs
new file mode 100644
index 0000000..fe8ee5f
--- /dev/null
+++ b/VueWebCoreApi/Startup.cs
@@ -0,0 +1,224 @@
+using log4net;
+using log4net.Config;
+using log4net.Repository;
+using Microsoft.AspNetCore.Authentication.Cookies;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http.Connections;
+using Microsoft.AspNetCore.Http.Features;
+using Microsoft.AspNetCore.HttpsPolicy;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Authorization;
+using Microsoft.AspNetCore.Server.Kestrel.Core;
+using Microsoft.AspNetCore.StaticFiles;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+using Microsoft.OpenApi.Models;
+using Newtonsoft.Json.Serialization;
+using Quartz;
+using Quartz.Impl;
+using Quartz.Spi;
+using Swashbuckle.AspNetCore.SwaggerUI;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.ApiGroup;
+using VueWebCoreApi.Extensions;
+using VueWebCoreApi.Quartz;
+using VueWebCoreApi.SignalR;
+using VueWebCoreApi.Tools;
+
+namespace VueWebCoreApi
+{
+ public class Startup
+ {
+ public Startup(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ }
+
+ public IConfiguration Configuration { get; }
+
+ //log4net日志
+ public static ILoggerRepository repository { get; set; }
+ //跨域设置
+ readonly string ganweiCosr = "AllowSpecificOrigins";
+
+ // This method gets called by the runtime. Use this method to add services to the container.
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddControllers().AddNewtonsoftJson(op =>
+ {
+ op.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();
+ op.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
+ // 返回数据首字母不小写,CamelCasePropertyNamesContractResolver是小写
+ op.SerializerSettings.ContractResolver = new DefaultContractResolver();
+ });
+ //解决文档中首字母被小写的问题
+ services.AddControllers().AddJsonOptions(config =>
+ {
+ config.JsonSerializerOptions.PropertyNamingPolicy = null;
+ });
+ #region Swagger 第二种方式
+ services.AddSwaggerGen(c =>
+ {
+ typeof(OpenApiGroup).GetEnumNames().ToList().ForEach(version =>
+ {
+ c.SwaggerDoc(version, new OpenApiInfo()
+ {
+ Title = $"浙江优步体育用品股份有限公司-MesApi文档:{version}",
+ Version = version,
+ Description = $"Panda.Sewerage : {version} ",
+ });
+ });
+
+ string basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
+ string xmlPath = Path.Combine(basePath, "VueWebCoreApi.xml");
+ c.IncludeXmlComments(xmlPath, true);
+ });
+ #endregion
+
+
+ // 设置配置
+ AppSetting.SetAppSetting(Configuration.GetSection("ConnectionStrings"));
+ //log4net配置
+ repository = LogManager.CreateRepository("AprilLog");
+ XmlConfigurator.Configure(repository, new FileInfo("Config/log4net.config"));
+ BasicConfigurator.Configure(repository);
+ services.AddControllersWithViews();
+ //Quartz
+ services.AddHttpClient();
+ services.AddHttpContextAccessor();
+ services.AddSingleton<IPathProvider, PathProvider>();
+ services.AddTransient<HttpResultfulJob>();
+ services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();
+ services.AddSingleton<IJobFactory, IOCJobFactory>();
+
+
+ //跨域设置
+ services.AddCors(options =>
+ {
+ options.AddPolicy(
+ "cors",
+ set =>
+ {
+ set.SetIsOriginAllowed(origin => true).AllowAnyHeader().AllowAnyMethod().AllowCredentials();
+ });
+ });
+ //设置SignalR
+ services.AddSignalR();
+
+
+ //设置session,并设置超时时间
+ services.AddSession(o =>
+ {
+ o.IdleTimeout = TimeSpan.FromSeconds(double.Parse(AppSetting.GetAppSetting("InProc")));
+ });
+ //设置Cookies
+ services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
+
+ #region 允许大文件上传
+ //允许上传大文件
+ services.Configure<IISServerOptions>(options =>
+ {
+ options.MaxRequestBodySize = 1073741824;//此处限制最大1G
+ });
+ //解决文件上传Multipart body length limit 134217728 exceeded.
+ services.Configure<FormOptions>(x =>
+ {
+ x.ValueLengthLimit = int.MaxValue;
+ x.MultipartBodyLengthLimit = 1073741824; //此处限制最大1G
+ });
+ #endregion 允许大文件上传
+ }
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLeftTime, ILoggerFactory loggerFactory)
+ {
+ if (env.IsDevelopment())
+ {
+ app.UseDeveloperExceptionPage();
+ }
+ applicationLeftTime.ApplicationStarted.Register(() =>
+ {
+ DataOperator.SetConnectionString1(Convert.ToString(AppSetting.GetAppSetting("DBServer")));
+ });
+
+ #region Swagger分组第二种
+ app.UseSwagger();
+ app.UseSwaggerUI(c =>
+ {
+ //删除Swagger上默认Schemas架构
+ c.DefaultModelsExpandDepth(-1);
+ //c.SwaggerEndpoint("/swagger/v1/swagger.json", "Api Document");
+ typeof(OpenApiGroup).GetEnumNames().ToList().ForEach(version =>
+ {
+ c.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"{version}");
+ });
+
+ });
+ #endregion
+ app.UseHttpsRedirection();
+
+ app.UseRouting();
+
+ app.UseAuthorization();
+ //添加静态文件中间件
+ app.UseDefaultFiles();
+ //添加授权文件
+ app.UseStaticFiles(new StaticFileOptions()
+ {
+ ContentTypeProvider = new FileExtensionContentTypeProvider()
+ {
+ Mappings = {
+ [".xls"] = "application/vnd.ms-excel",
+ [".apk"] = "application/vnd.android.package-archive"
+ }
+ }
+ });
+ app.UseStaticFiles();
+ //跨域
+ app.UseCors("cors");
+ //用户session服务
+ app.UseSession();
+ //cookies
+ app.UseCookiePolicy();
+ //HttpContext
+ app.UseStaticHostEnviroment();
+ //Quartz
+ app.UseQuartz(env).UseStaticHttpContext();
+ //配置Excel下载
+ //app.UseStaticFiles(
+ // new StaticFileOptions
+ // {
+ // //设置不限制content-type
+ // ServeUnknownFileTypes = true
+ // });
+ //app.UseStaticFiles(new StaticFileOptions()
+ //{
+ // ContentTypeProvider = new FileExtensionContentTypeProvider()
+ // {
+ // Mappings = { [".exe"] = "application/octect-stream" }
+ // }
+ //});
+
+ app.UseEndpoints(endpoints =>
+ {
+ endpoints.MapControllers();
+ endpoints.MapHub<ChatHub>("/ChatHub", options =>
+ {
+ options.Transports =
+ HttpTransportType.WebSockets |
+ HttpTransportType.LongPolling;
+ });
+ });
+ loggerFactory.AddLog4Net("Config/log4net.config");
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/AppLableBarCode.cs b/VueWebCoreApi/Tools/AppLableBarCode.cs
new file mode 100644
index 0000000..874f1c9
--- /dev/null
+++ b/VueWebCoreApi/Tools/AppLableBarCode.cs
@@ -0,0 +1,191 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class AppLableBarCode
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+ #region [鑾峰彇瑙勫垯缂栫爜]
+ /// <summary>
+ /// 鏍规嵁鍔熻兘缂栫爜鑾峰彇鏈�鏂拌鍒欑紪鐮�
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="qty">鏁伴噺</param>
+ /// <param name="onelabqty">鍗曟爣绛炬暟閲�</param>
+ /// <returns></returns>
+ public static ToMessage EncodingSeach(string rightcode, string partcode, string qty, string onelabqty)
+ {
+ string sql, year = "", month = "", day = "", fdate = "", q = "", cunm2 = "", Encode = "", cunm = "";
+ int digit2 = 0, value2 = 0, digit3 = 0, digitdiff = 0;
+ decimal labcum = 0;
+ bool stf;
+ List<object> list = new List<object>();
+ List<string> listdt = new List<string>();
+ List<AppLabCode> lab = new List<AppLabCode>();
+ var dynamicParams = new DynamicParameters();
+ //鑾峰彇鏍囩涓暟:杩涗竴娉�
+ if (qty == "0" && onelabqty == "0")
+ {
+ labcum = 1;
+ }
+ else
+ {
+ labcum = Math.Ceiling(decimal.Parse(qty) / decimal.Parse(onelabqty));
+ }
+ try
+ {
+ sql = @"select prefix,filingdate,incbit,value from TCodeRules where menucode=@menucode";
+ dynamicParams.Add("@menucode", rightcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ string prefix = data.Rows[0]["PREFIX"].ToString(); //鍥哄畾瀛楁
+ string filingdate = data.Rows[0]["FILINGDATE"].ToString(); //鎻愪氦鏃ユ湡
+ int incbit = int.Parse(data.Rows[0]["INCBIT"].ToString()); //鑷浣嶆暟
+ string value = data.Rows[0]["VALUE"].ToString(); //娴佹按鍙�
+ decimal sumqty = 0;//瀹氫箟绱鍗曟爣绛炬暟閲�
+ if (int.Parse(value) >= 0)
+ {
+ switch (filingdate)
+ {
+ case "骞存湀鏃�":
+ lab = Labcode(partcode, year, month, day, prefix, fdate, digit2, value2, digit3, digitdiff, q, cunm2, Encode, value, labcum, sumqty, onelabqty, rightcode, qty, out cunm);
+ break;
+ case "骞存湀":
+ lab = Labcode(partcode, year, month, day, prefix, fdate, digit2, value2, digit3, digitdiff, q, cunm2, Encode, value, labcum, sumqty, onelabqty, rightcode, qty, out cunm);
+ break;
+ case "骞�":
+ lab = Labcode(partcode, year, month, day, prefix, fdate, digit2, value2, digit3, digitdiff, q, cunm2, Encode, value, labcum, sumqty, onelabqty, rightcode, qty, out cunm);
+ break;
+ default:
+ break;
+ }
+ //鏇存柊瑙勫垯琛ㄤ綅鏁板強娴佹按鍙�
+ sql = @"update TCodeRules set incbit=@incbit,value=@cunm2 where menucode=@menucode";
+ dynamicParams.Add("@incbit", cunm.Length);
+ dynamicParams.Add("@cunm2", cunm);
+ dynamicParams.Add("@menucode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ stf = DapperHelper.DoTransaction(list);
+ if (stf)
+ {
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = lab;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏈缃紪鐮佽鍒�,鐢熸垚鍗曞彿澶辫触,璇疯缃紪鐮佷负銆�" + rightcode + "銆戠殑缂栫爜瑙勫垯!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熸垚鏉$爜]
+ /// <summary>
+ /// 鐢熸垚鏉$爜
+ /// </summary>
+ /// <param name="partcode">鐗╂枡缂栫爜</param>
+ /// <param name="year">骞�</param>
+ /// <param name="month">鏈�</param>
+ /// <param name="day">鏃�</param>
+ /// <param name="prefix">鍥哄畾瀛楁</param>
+ /// <param name="fdate">骞�(2浣�)+鏈�(2浣�)+鏃�(2浣�)</param>
+ /// <param name="digit2">娴佹按鍙烽暱搴�</param>
+ /// <param name="value2">鑷娴佹按鍙�</param>
+ /// <param name="digit3">鑷娴佹按鍙烽暱搴�</param>
+ /// <param name="digitdiff">浣嶆暟宸�</param>
+ /// <param name="q">琛ヤ綅(0)</param>
+ /// <param name="cunm2">鏈�缁堟祦姘村彿(鍖呭惈琛ヤ綅)</param>
+ /// <param name="Encode">鏈�缁堟爣绛剧爜(鍥哄畾瀛楁+瑙勫垯+鏈�缁堟祦姘村彿)</param>
+ /// <param name="value">鍒濆鏌ヨ鏈�鏂版祦姘村彿</param>
+ /// <param name="labcum">鏍囩涓暟</param>
+ /// <param name="sumqty">绱鍗曟爣绛炬暟閲�</param>
+ /// <param name="onelabqty">鍗曟爣绛炬暟閲�</param>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <param name="qty">鏁伴噺</param>
+ /// <param name="cunm">杈撳嚭鏈�缁堟祦姘村彿</param>
+ /// <returns></returns>
+ public static List<AppLabCode> Labcode(string partcode, string year, string month, string day, string prefix, string fdate, int digit2, int value2, int digit3, int digitdiff, string q, string cunm2, string Encode, string value, decimal labcum, decimal sumqty, string onelabqty, string rightcode, string qty, out string cunm)
+ {
+ List<AppLabCode> lab = new List<AppLabCode>();
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ day = DateTime.Now.Day.ToString().PadLeft(2, '0');//鑾峰彇鏃�(2浣�)
+ fdate = year + month + day;
+
+ //鑾峰彇鏌ヨ娴佹按鍙风殑浣嶆暟
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ for (int i = 1; i <= labcum; i++)
+ {
+ AppLabCode lb = new AppLabCode();
+ lb.rightcode = rightcode;
+ if (i == labcum) //鏈�鍚庝竴寮犳爣绛�
+ {
+ lb.labqty = (decimal.Parse(qty) - sumqty).ToString(); //鍗曟爣绛炬暟閲�
+ }
+ else
+ {
+ lb.labqty = onelabqty; //鍗曟爣绛炬暟閲�
+ sumqty += decimal.Parse(onelabqty);
+ }
+
+ //娴佹按鍙峰惊鐜嚜澧�
+ value2 = int.Parse(value) + i;
+ //鑾峰彇鑷鍚庢祦姘村彿浣嶆暟
+ digit3 = value2.ToString().Length;
+ //鑾峰彇浣嶆暟涔嬪樊
+ digitdiff = digit2 - digit3;
+ //閲嶆柊鑾峰彇娴佹按鍙蜂綅鏁�
+ digit2 = digit3;
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ else
+ {
+ for (int j = 1; j <= digitdiff; j++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+ lb.labcode = Encode;
+ lb.partnumber = partcode;
+ lab.Add(lb);
+ }
+ cunm = cunm2;
+ return lab;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/AppSetting.cs b/VueWebCoreApi/Tools/AppSetting.cs
new file mode 100644
index 0000000..89f3d86
--- /dev/null
+++ b/VueWebCoreApi/Tools/AppSetting.cs
@@ -0,0 +1,33 @@
+锘縰sing Microsoft.Extensions.Configuration;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ /// <summary>
+ /// 璇诲彇appsetting閰嶇疆
+ /// </summary>
+ public class AppSetting
+ {
+ private static IConfigurationSection _configurationSection = null;
+ /// <summary>
+ /// 璇诲彇閰嶇疆
+ /// </summary>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public static string GetAppSetting(string key)
+ {
+ return _configurationSection.GetSection(key)?.Value;
+ }
+ /// <summary>
+ /// 璁剧疆閰嶇疆
+ /// </summary>
+ /// <param name="section"></param>
+ public static void SetAppSetting(IConfigurationSection section)
+ {
+ _configurationSection = section;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/ChannelActionFilterAttribute.cs b/VueWebCoreApi/Tools/ChannelActionFilterAttribute.cs
new file mode 100644
index 0000000..09ebf74
--- /dev/null
+++ b/VueWebCoreApi/Tools/ChannelActionFilterAttribute.cs
@@ -0,0 +1,70 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class ChannelActionFilterAttribute: ActionFilterAttribute
+ {
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ /// <summary>
+ /// 鍦ˋction鎵ц鍓嶆墽琛�
+ /// </summary>
+ /// <param name="context"></param>
+ public override void OnActionExecuting(ActionExecutingContext context)
+ {
+ try
+ {
+ //var aa = DapperHelper.GetTokenFromRequestHeader();
+ var token = context.HttpContext.Request.Headers["Token"].ToString();
+ User us = JwtTools.Denocode(token.ToString());
+ base.OnActionExecuting(context);
+ //濡傛灉瀛樺湪
+ if (redis.GetStringKey<User>(us.rediskey) !=null)
+ {
+ //鑾峰彇redis涓綋鍓嶇敤鎴蜂俊鎭�
+ User r_loginUser = redis.GetStringKey<User>(us.rediskey);
+ if (token != r_loginUser.token)
+ {
+ mes.code = "303";
+ mes.count = 0;
+ mes.message = "token宸茶繃鏈�,璇烽噸鏂扮櫥褰�!";
+ context.Result = new JsonResult(mes);
+ }
+ else
+ {
+ //閲嶇疆杩囨湡鏃堕棿
+ redis.SetExpire(us.rediskey, redis.secondsTimeOut);
+ }
+ }
+ else //濡傛灉redis鐧诲綍鐢ㄦ埛涓笉瀛樺湪褰撳墠鐢ㄦ埛
+ {
+ mes.code = "303";
+ mes.count = 0;
+ mes.message = "鐧诲綍宸茶秴鏃�,璇烽噸鏂扮櫥褰�!";
+ context.Result = new JsonResult(mes);
+ }
+ // 灏嗚繃婊ゅ櫒涓殑鍊煎瓨鍌ㄥ湪HttpContext.Items涓紝浠ヤ究鍦ㄦ帶鍒跺櫒涓闂�
+ //context.HttpContext.Items.Remove("Token");
+ //context.HttpContext.Items["Token"] = token;
+ }
+ catch (Exception e)
+ {
+ LogHelper.WriteLog(e);
+ mes.code = "303";
+ mes.message = e.Message;
+ context.Result = new JsonResult(mes);
+ }
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/ChannelActionFilterAttributeApp.cs b/VueWebCoreApi/Tools/ChannelActionFilterAttributeApp.cs
new file mode 100644
index 0000000..a64b6f4
--- /dev/null
+++ b/VueWebCoreApi/Tools/ChannelActionFilterAttributeApp.cs
@@ -0,0 +1,38 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class ChannelActionFilterAttributeApp : ActionFilterAttribute
+ {
+ ToMessage mes = new ToMessage();
+ RedisCommon redis = new RedisCommon();
+
+ /// <summary>
+ /// 鍦ˋction鎵ц鍓嶆墽琛�
+ /// </summary>
+ /// <param name="context"></param>
+ public override void OnActionExecuting(ActionExecutingContext context)
+ {
+ try
+ {
+
+ mes.code = "303";
+ mes.message = "鐧诲綍宸茶秴鏃�,璇烽噸鏂扮櫥褰�!";
+ context.Result = new JsonResult(mes);
+
+ }
+ catch (Exception)
+ {
+ mes.code = "303";
+ mes.message = "鐧诲綍宸茶秴鏃�,璇烽噸鏂扮櫥褰�!";
+ context.Result = new JsonResult(mes);
+ }
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/CoreHttpContext .cs b/VueWebCoreApi/Tools/CoreHttpContext .cs
new file mode 100644
index 0000000..a97ef4f
--- /dev/null
+++ b/VueWebCoreApi/Tools/CoreHttpContext .cs
@@ -0,0 +1,36 @@
+锘縰sing Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class CoreHttpContext
+ {
+ private static IWebHostEnvironment _hostEnviroment;
+ public static string WebPath => _hostEnviroment.WebRootPath;
+
+ public static string MapPath(string path)
+ {
+ return Path.Combine(_hostEnviroment.ContentRootPath, path);
+ }
+
+ internal static void Configure(IWebHostEnvironment hostEnviroment)
+ {
+ _hostEnviroment = hostEnviroment;
+ }
+ }
+ public static class StaticHostEnviromentExtensions
+ {
+ public static IApplicationBuilder UseStaticHostEnviroment(this IApplicationBuilder app)
+ {
+ var webHostEnvironment = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>();
+ CoreHttpContext.Configure(webHostEnvironment);
+ return app;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/DALSkillCondition.cs b/VueWebCoreApi/Tools/DALSkillCondition.cs
new file mode 100644
index 0000000..ce62b6d
--- /dev/null
+++ b/VueWebCoreApi/Tools/DALSkillCondition.cs
@@ -0,0 +1,34 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class DALSkillCondition
+ {
+ /// <summary>
+ /// 涓嬭浇excel
+ /// </summary>
+ /// <param name="path"></param>
+ /// <param name="num"></param>
+ /// <returns></returns>
+ #region
+ public static bool ResultExcel(string path, DataTable dt)
+ {
+ try
+ {
+
+ NPOIHelper.ExportEasy(dt, path);
+ return true;
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/DBHelper.cs b/VueWebCoreApi/Tools/DBHelper.cs
new file mode 100644
index 0000000..4d1d28c
--- /dev/null
+++ b/VueWebCoreApi/Tools/DBHelper.cs
@@ -0,0 +1,731 @@
+锘縰sing System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class DBHelper
+ {
+ #region DataTable GetTable(string sql) 鑾峰彇DataTable
+ /// <summary>
+ /// 鑾峰彇DataTable
+ /// </summary>
+ /// <param name="sql">浼犲叆SQL璇彞</param>
+ /// <returns>杩斿洖DataTable</returns>
+ public static DataTable GetTable(string sql)
+ {
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.getTable(sql);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ //throw (ex);
+ return null;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇DataTable
+ /// </summary>
+ /// <param name="sql">浼犲叆SQL璇彞</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>杩斿洖DataTable</returns>
+ public static DataTable GetTable(string sql, params SqlParameter[] parameters)
+ {
+
+
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.getTable(sql, parameters);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw (ex);
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ /// <summary>
+ /// Dataset鑾峰彇鏁版嵁琛�
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <param name="parameters"></param>
+ /// <returns></returns>
+ #region
+ public static DataSet GetData(string sql, params SqlParameter[] parameters)
+ {
+
+
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.getdate(sql, parameters);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ //throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return null;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region GetCount(string sql) 鑾峰彇鏁版嵁琛屾暟,濡傛灉鍑洪敊杩斿洖"-1"
+ /// <summary>
+ /// 鑾峰彇鏁版嵁琛屾暟,濡傛灉鍑洪敊杩斿洖"-1"
+ /// </summary>
+ /// <param name="sql">浼犲叆SQL璇彞</param>
+ /// <returns>濡傛灉鍑洪敊杩斿洖"-1"</returns>
+ public static int GetCount(string sql)
+ {
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.getCount(sql);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ //throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return 0;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鎵ц澶氭潯sql璇彞鐨勪簨鐗�
+ /// </summary>
+ /// <param name="list"></param>
+ /// <returns></returns>
+ public static int Executesqltran(List<string> list, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.ExecuteSqlTran(list, parameters);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return 0;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇鏁版嵁琛屾暟,濡傛灉鍑洪敊杩斿洖"-1"
+ /// </summary>
+ /// <param name="sql">浼犲叆SQL璇彞</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>濡傛灉鍑洪敊杩斿洖"-1"</returns>
+ public static int GetCount(string sql, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.getCount(sql, parameters);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return 0;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region GetObject(string sql) 鑾峰彇琛ㄦ牸绗竴琛岀涓�鍒�
+ /// <summary>
+ /// 鑾峰彇琛ㄦ牸绗竴琛岀涓�鍒�
+ /// </summary>
+ /// <param name="sql">浼犲叆SQL璇彞</param>
+ /// <returns>濡傛灉鍑洪敊杩斿洖"null"</returns>
+ public static object GetObject(string sql)
+ {
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.getObject(sql);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return null;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇琛ㄦ牸绗竴琛岀涓�鍒�
+ /// </summary>
+ /// <param name="sql">浼犲叆SQL璇彞</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>杩斿洖Object</returns>
+ public static object GetObject(string sql, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.getObject(sql, parameters);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return null;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region ExecuteSql(string sql) 鎵цSQL璇彞杩斿洖鏄惁鎴愬姛
+ /// <summary>
+ /// 鎵цSQL璇彞杩斿洖鏄惁鎴愬姛
+ /// </summary>
+ /// <param name="sql">浼犲叆SQL璇彞</param>
+ /// <returns>杩斿洖鏄惁鎴愬姛</returns>
+ public static bool ExecuteSql(string sql)
+ {
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.executeSql(sql);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ //throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return false;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// 鎵цSQL璇彞杩斿洖鏄惁鎴愬姛
+ /// </summary>
+ /// <param name="sql">浼犲叆SQL璇彞</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>杩斿洖鏄惁鎴愬姛</returns>
+ public static bool ExecuteSql(string sql, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ //ParamCollections pc = new ParamCollections();
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.executeSql(sql, parameters);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return false;
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region ExecuteProduct(string productName, params SqlParameter[] parameters) 鎵ц瀛樺偍杩囩▼杩斿洖杩斿洖鍊�
+ /// <summary>
+ /// 鎵ц瀛樺偍杩囩▼杩斿洖杩斿洖鍊�
+ /// </summary>
+ /// <param name="productName">瀛樺偍杩囩▼鍚嶅瓧</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>杩斿洖鍊糎ash琛�</returns>
+ public static Hashtable ExecuteProduct(string productName, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ //ParamCollections pc = new ParamCollections();
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.executeProduct(productName, parameters);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ //throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ return new Hashtable();
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region ExecuteProductData(string productName, params SqlParameter[] parameters) 鎵ц瀛樺偍杩囩▼杩斿洖DataTable
+ /// <summary>
+ /// 鎵ц瀛樺偍杩囩▼杩斿洖杩斿洖鍊�
+ /// </summary>
+ /// <param name="productName">瀛樺偍杩囩▼鍚嶅瓧</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>杩斿洖鍊糎ash琛�</returns>
+ public static DataTable ExecuteProductData(string productName, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ //ParamCollections pc = new ParamCollections();
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.ExecuteProductData(productName, parameters);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region ExecuteProductData(string productName, params SqlParameter[] parameters) 鎵ц瀛樺偍杩囩▼杩斿洖List<DataTable>
+ /// <summary>
+ /// 鎵ц瀛樺偍杩囩▼杩斿洖杩斿洖鍊�
+ /// </summary>
+ /// <param name="productName">瀛樺偍杩囩▼鍚嶅瓧</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>杩斿洖鍊糎ash琛�</returns>
+ public static List<DataTable> ExecuteProductDataList(string productName, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ //ParamCollections pc = new ParamCollections();
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.ExecuteProductDataList(productName, parameters);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region ExecuteProductData(string productName, params SqlParameter[] parameters) 鎵ц瀛樺偍杩囩▼杩斿洖ArrayList
+ /// <summary>
+ /// 鎵ц瀛樺偍杩囩▼杩斿洖杩斿洖鍊�
+ /// </summary>
+ /// <param name="productName">瀛樺偍杩囩▼鍚嶅瓧</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>杩斿洖鍊糒ist</returns>
+ public static ArrayList executeProductList(string produreName, bool returnDt, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ //ParamCollections pc = new ParamCollections();
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.executeProduct(produreName, parameters, returnDt);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region ExecuteProductData(string productName) 鎵ц瀛樺偍杩囩▼杩斿洖bool
+ /// <summary>
+ /// 鎵ц瀛樺偍杩囩▼杩斿洖杩斿洖鍊�
+ /// </summary>
+ /// <param name="productName">瀛樺偍杩囩▼鍚嶅瓧</param>
+ /// <param name="parameters">SqlParameter 鍙傛暟</param>
+ /// <returns>杩斿洖鍊糄ataTable琛�</returns>
+ public static bool ExecuteProductbool(string productName, params SqlParameter[] parameters)
+ {
+ DataOperator dbo = null;
+ //ParamCollections pc = new ParamCollections();
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ return dbo.ExecuteProduct(productName, parameters);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw (ex);
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+
+ }
+ finally
+ {
+ if (dbo != null)
+ {
+ dbo.Close();
+ }
+ }
+ }
+ #endregion
+
+ #region GetDataByPage() 鍒嗛〉鏌ヨ
+ /// <summary>
+ /// 鍒嗛〉鏌ヨ
+ /// </summary>
+ /// <param name="filename">琛ㄥ悕</param>
+ /// <param name="filename">闇�瑕佽繑鍥炵殑鍒�</param>
+ /// <param name="sortfilename">鎺掑簭瀛楁鍚�</param>
+ /// <param name="PageSize">椤靛昂瀵�</param>
+ /// <param name="PageIndex">椤电爜</param>
+ /// <param name="OrderType">璁剧疆鎺掑簭绫诲瀷, 闈� 0 鍊煎垯闄嶅簭</param>
+ /// <param name="strWhere">鏌ヨ鏉′欢 (娉ㄦ剰: 涓嶈鍔� where)</param>
+ /// <param name="RecordCount">鎬昏褰�</param>
+ /// <returns></returns>
+ public static DataTable GetDataByPage(string tablename, string filename, string sortfilename, int PageSize, int PageIndex, int OrderType, string strWhere, out int RecordCount)
+ {
+ RecordCount = 0;
+ //鍒涘缓鍙傛暟
+ SqlParameter[] param = {
+ new SqlParameter("@tblName", SqlDbType.VarChar, 50),
+ new SqlParameter("@strGetFields", SqlDbType.VarChar, 1000),
+ new SqlParameter("@fldName", SqlDbType.VarChar, 255),
+ new SqlParameter("@PageSize", SqlDbType.Int),
+ new SqlParameter("@PageIndex", SqlDbType.Int),
+ new SqlParameter("@OrderType", SqlDbType.Bit,1),
+ new SqlParameter("@strWhere", SqlDbType.VarChar,500),
+ new SqlParameter("@RecordCount", SqlDbType.Int)
+ };
+ param[0].Value = tablename;
+ param[1].Value = filename;
+ param[2].Value = sortfilename;
+ param[3].Value = PageSize;
+ param[4].Value = PageIndex;
+ param[5].Value = OrderType;
+ param[6].Value = strWhere;
+ param[7].Direction = ParameterDirection.Output;
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ DataTable dt = dbo.ExecuteProductData("GetDataByPage", param);
+ RecordCount = (int)param[7].Value;
+ return dt;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ if (null != dbo)
+ {
+ dbo.Close();
+ dbo = null;
+ }
+ }
+ }
+ /// <summary>
+ /// 鍒嗛〉鏌ヨ(鏀寔JOIN)
+ /// </summary>
+ /// <param name="filename">琛ㄥ悕</param>
+ /// <param name="filename">闇�瑕佽繑鍥炵殑鍒�</param>
+ /// <param name="sortfilename">鎺掑簭瀛楁鍚�(榛樿鍗囧簭锛岄檷搴忛渶鍦ㄦ帓搴忓瓧娈靛悕鍚庨潰DESC鍏抽敭瀛楋細sortField Desc)</param>
+ /// <param name="PageSize">椤靛昂瀵�</param>
+ /// <param name="PageIndex">椤电爜</param>
+ /// <param name="strWhere">鏌ヨ鏉′欢 (娉ㄦ剰: 涓嶈鍔� where)</param>
+ /// <param name="RecordCount">鎬昏褰�</param>
+ /// <returns></returns>
+ public static DataTable GetDataByPage_V2(string tablename, string filename, string sortfilename, int PageSize, int PageIndex, string strWhere, out int RecordCount)
+ {
+ RecordCount = 0;
+ //鍒涘缓鍙傛暟
+ SqlParameter[] param = {
+ new SqlParameter("@tblName", SqlDbType.VarChar, 200),
+ new SqlParameter("@strGetFields", SqlDbType.VarChar, 500),
+ new SqlParameter("@fldName", SqlDbType.VarChar, 255),
+ new SqlParameter("@PageSize", SqlDbType.Int),
+ new SqlParameter("@PageIndex", SqlDbType.Int),
+ new SqlParameter("@strWhere", SqlDbType.VarChar,500),
+ new SqlParameter("@RecordCount", SqlDbType.Int),
+ new SqlParameter("@TotalPage", SqlDbType.Int)
+ };
+ param[0].Value = tablename;//琛ㄥ悕
+ param[1].Value = filename;//闇�瑕佽繑鍥炵殑鍒�
+ param[2].Value = sortfilename;//鎺掑簭瀛楁鍚�
+ param[3].Value = PageSize;//椤靛昂瀵�
+ param[4].Value = PageIndex;//椤电爜
+ param[5].Value = strWhere;//鏌ヨ鏉′欢
+ param[6].Direction = ParameterDirection.ReturnValue;//鎬昏褰�
+ param[7].Direction = ParameterDirection.Output;//鎬婚〉鏁�
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ DataTable dt = dbo.ExecuteProductData("GetDataByPage_V2", param);
+ RecordCount = (int)param[6].Value;
+ return dt;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ if (null != dbo)
+ {
+ dbo.Close();
+ dbo = null;
+ }
+ }
+ }
+ /// <summary>
+ /// 鍒嗛〉鏌ヨ(鏀寔JOIN)
+ /// </summary>
+ /// <param name="filename">琛ㄥ悕</param>
+ /// <param name="filename">闇�瑕佽繑鍥炵殑鍒�</param>
+ /// <param name="sortfilename">鎺掑簭瀛楁鍚�(榛樿鍗囧簭锛岄檷搴忛渶鍦ㄦ帓搴忓瓧娈靛悕鍚庨潰DESC鍏抽敭瀛楋細sortField Desc)</param>
+ /// <param name="PageSize">椤靛昂瀵�</param>
+ /// <param name="PageIndex">椤电爜</param>
+ /// <param name="strWhere">鏌ヨ鏉′欢 (娉ㄦ剰: 涓嶈鍔� where)</param>
+ /// <param name="RecordCount">鎬昏褰�</param>
+ /// <returns></returns>
+ public static DataTable GetDataByPage_V2_Join(string tablename, string filename, string sortfilename, int PageSize, int PageIndex, string strWhere, out int RecordCount)
+ {
+ RecordCount = 0;
+ //鍒涘缓鍙傛暟
+ SqlParameter[] param = {
+ new SqlParameter("@tblName", SqlDbType.VarChar, 200),
+ new SqlParameter("@strGetFields", SqlDbType.VarChar, 500),
+ new SqlParameter("@fldName", SqlDbType.VarChar, 255),
+ new SqlParameter("@PageSize", SqlDbType.Int),
+ new SqlParameter("@PageIndex", SqlDbType.Int),
+ new SqlParameter("@strWhere", SqlDbType.VarChar,500),
+ new SqlParameter("@RecordCount", SqlDbType.Int),
+ new SqlParameter("@TotalPage", SqlDbType.Int)
+ };
+ param[0].Value = tablename;//琛ㄥ悕
+ param[1].Value = filename;//闇�瑕佽繑鍥炵殑鍒�
+ param[2].Value = sortfilename;//鎺掑簭瀛楁鍚�
+ param[3].Value = PageSize;//椤靛昂瀵�
+ param[4].Value = PageIndex;//椤电爜
+ param[5].Value = strWhere;//鏌ヨ鏉′欢
+ param[6].Direction = ParameterDirection.ReturnValue;//鎬昏褰�
+ param[7].Direction = ParameterDirection.Output;//鎬婚〉鏁�
+ DataOperator dbo = null;
+ try
+ {
+ if (dbo == null)
+ {
+ dbo = new DataOperator();
+ }
+ DataTable dt = dbo.ExecuteProductData("GetDataByPage_V2_Join", param);
+ RecordCount = (int)param[6].Value;
+ return dt;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ if (null != dbo)
+ {
+ dbo.Close();
+ dbo = null;
+ }
+ }
+ }
+ #endregion
+
+ #region ParametersStrGet(SqlParameter[] parameters) [鐢ㄤ簬鏃ュ織鏂囨湰杈撳嚭] 灏哠qlParameter鏁扮粍鍙傛暟杞垚瀛楃涓�.
+ /// <summary>
+ /// [鐢ㄤ簬鏃ュ織鏂囨湰杈撳嚭] 灏哠qlParameter鏁扮粍鍙傛暟杞垚瀛楃涓�.
+ /// </summary>
+ /// <param name="parameters">鍙傛暟鏁扮粍</param>
+ /// <returns></returns>
+ private static string ParametersStrGet(SqlParameter[] parameters)
+ {
+ string parametersHeadStr = @"鍙傛暟:{{{0}}}";
+ string parametersContentStr = "";
+ int count = 0;
+ foreach (SqlParameter sp in parameters)
+ {
+ if (count++ > 0)
+ parametersContentStr += @",";
+ parametersContentStr += string.Format("{0}:{1}", sp.ParameterName, sp.Value);
+ }
+ return string.Format(parametersHeadStr, parametersContentStr);
+ }
+ #endregion
+
+ }
+}
diff --git a/VueWebCoreApi/Tools/DapperHelper.cs b/VueWebCoreApi/Tools/DapperHelper.cs
new file mode 100644
index 0000000..61b3a3b
--- /dev/null
+++ b/VueWebCoreApi/Tools/DapperHelper.cs
@@ -0,0 +1,873 @@
+锘縰sing Dapper;
+using Microsoft.AspNetCore.Http;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using VueWebCoreApi.DLL.BLL;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class DapperHelper
+ {
+
+ /// <summary>
+ /// 鍒涘缓鏁版嵁搴撹繛鎺ュ璞qlserver
+ /// </summary>
+ /// <returns></returns>
+ public static IDbConnection sqlConnection()
+ {
+ //string sqlServerConnectString = "server=***;database=***;User=***;password=***;Connect Timeout=10000";
+ string sqlServerConnectString = AppSetting.GetAppSetting("DBServer");
+ //鑾峰彇鏁版嵁搴撹繛鎺�
+ IDbConnection connection = new SqlConnection(sqlServerConnectString);
+ connection.Open();
+ return connection;
+ }
+
+
+ /// <summary>
+ /// Dapper鏌ヨ杩斿洖List
+ /// </summary>
+ /// <typeparam name="T">闇�瑕佽繑鍥炵殑瀵硅薄绫诲瀷</typeparam>
+ /// <param name="sql">Sql璇彞</param>
+ /// <param name="parm"></param>
+ /// <returns></returns>
+ public static List<T> select<T>(string sql, Object parm) where T : new()
+ {
+
+ List<T> list = null;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ //鐢ㄦ埛鎿嶄綔璁板綍鍐欏叆鏁版嵁琛�
+ //Log4net.LogUtil.SaveMessage("PC", "鎿嶄綔浜唜xxxx", "api/Login/LoginSave", ConfigurationManager.AppSettings["FileIP"], "9999", 1);
+ list = conn.Query<T>(sql, parm).ToList<T>();
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+
+ }
+ return list;
+ }
+
+ /// <summary>
+ /// Dapper鏌ヨ杩斿洖List
+ /// </summary>
+ /// <typeparam name="T">闇�瑕佽繑鍥炵殑瀵硅薄绫诲瀷</typeparam>
+ /// <param name="sql">Sql璇彞</param>
+ /// <returns></returns>
+ public static List<T> selectdatalist<T>(string sql) where T : new()
+ {
+
+ List<T> list = null;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ //鐢ㄦ埛鎿嶄綔璁板綍鍐欏叆鏁版嵁琛�
+ //Log4net.LogUtil.SaveMessage("PC", "鎿嶄綔浜唜xxxx", "api/Login/LoginSave", ConfigurationManager.AppSettings["FileIP"], "9999", 1);
+ list = conn.Query<T>(sql).ToList<T>();
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+
+ }
+ return list;
+ }
+
+
+ /// <summary>
+ /// Dapper鏌ヨ杩斿洖List瀛楀吀瀵硅薄 鏃犻渶鎵嬪姩Wapper瀵硅薄浜�
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <param name="parm"></param>
+ /// <returns></returns>
+ public static List<Dictionary<string, Object>> selectToDict(string sql, Object parm)
+ {
+
+ List<Dictionary<string, Object>> result = null;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ var menus = conn.Query(sql, parm).ToList();
+ result = JsonConvert.DeserializeObject<List<Dictionary<string, Object>>>(JsonConvert.SerializeObject(menus));
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ return result;
+ }
+
+ /// <summary>
+ /// Dapper鏌ヨ杩斿洖瀵硅薄闈濴ist闆嗗悎
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="sql"></param>
+ /// <param name="parm"></param>
+ /// <returns></returns>
+ public static T selectToObject<T>(string sql, Object parm) where T : new()
+ {
+ T t = new T();
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ t = conn.Query<T>(sql, parm).Single<T>();
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ return t;
+ }
+
+ /// <summary>
+ /// dapper閫氱敤鍒嗛〉鍑芥暟
+ /// </summary>
+ /// <typeparam name="T">娉涘瀷闆嗗悎瀹炰綋绫�</typeparam>
+ /// <param name="sql">鏌ヨ璇彞</param>
+ /// <param name="orderBy">鎺掑簭锛堝瓧娈� DESC/ASC锛�</param>
+ /// <param name="pageIndex">褰撳墠椤�</param>
+ /// <param name="pageSize">褰撳墠椤垫樉绀烘潯鏁�</param>
+ /// <param name="total">缁撴灉闆嗘�绘暟</param>
+ /// <returns></returns>
+ public static IEnumerable<T> GetPageList<T>(string sql, Object parm, string orderBy, string sort, int pageIndex, int pageSize, out int total)
+ {
+ //int skip = 1;
+ //if (pageIndex > 0)
+ //{
+ // skip = (pageIndex - 1) * pageSize + 1;
+ //}
+ StringBuilder sb = new StringBuilder();
+ sb.AppendFormat("SELECT COUNT(1) FROM ({0}) AS Result;", sql);
+ sb.AppendFormat(@"SELECT *
+ FROM(SELECT *,ROW_NUMBER() OVER(ORDER BY {1} {2}) AS rowNum
+ FROM ({0}) AS Temp) AS Result
+ WHERE rowNum >= {3} AND rowNum <= {4}
+ ORDER BY {1} {2}", sql, orderBy, sort, pageIndex, pageSize); //skip, pageIndex * pageSize
+
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ using (var reader = conn.QueryMultiple(sb.ToString(), parm))
+ {
+ total = reader.ReadFirst<int>();
+ return reader.Read<T>();
+ }
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+
+ }
+ }
+
+ /// <summary>
+ /// dapper閫氱敤鍒嗛〉鍑芥暟
+ /// </summary>
+ /// <typeparam name="T">娉涘瀷闆嗗悎瀹炰綋绫�</typeparam>
+ ///<param name="withsql">with鍑芥暟璇彞</param>
+ /// <param name="sql">鏌ヨ璇彞</param>
+ /// <param name="orderBy">鎺掑簭锛堝瓧娈� DESC/ASC锛�</param>
+ /// <param name="pageIndex">褰撳墠椤�</param>
+ /// <param name="pageSize">褰撳墠椤垫樉绀烘潯鏁�</param>
+ /// <param name="total">缁撴灉闆嗘�绘暟</param>
+ /// <returns></returns>
+ public static IEnumerable<T> GetPagedDataWith<T>(string withsql, string sql, Object parm, string orderBy, string sort, int pageIndex, int pageSize, out int total)
+ {
+ //int skip = 1;
+ //if (pageIndex > 0)
+ //{
+ // skip = (pageIndex - 1) * pageSize + 1;
+ //}
+ StringBuilder sb = new StringBuilder();
+ sb.AppendFormat("{0} SELECT COUNT(1) FROM ({1}) AS Result;",withsql, sql);
+ sb.AppendFormat(@"{0} SELECT *
+ FROM(SELECT *,ROW_NUMBER() OVER(ORDER BY {2} {3}) AS rowNum
+ FROM ({1}) AS Temp) AS Result
+ WHERE rowNum >= {4} AND rowNum <= {5}
+ ORDER BY {2} {3}",withsql, sql, orderBy, sort, pageIndex, pageSize); //skip, pageIndex * pageSize
+
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ using (var reader = conn.QueryMultiple(sb.ToString(), parm))
+ {
+ total = reader.ReadFirst<int>();
+ return reader.Read<T>();
+ }
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+
+ }
+ }
+
+
+ /// <summary>
+ /// WITH鍒嗛〉
+ /// </summary>
+ /// <typeparam name="T">娉涘瀷闆嗗悎瀹炰綋绫�</typeparam>
+ /// <param name="tableName">琛ㄥ悕</param>
+ /// <param name="torg_code">瀛愮骇瀛楁</param>
+ /// <param name="parent_id">鐖剁骇瀛楁</param>
+ /// <param name="condition">鏌ヨ鏉′欢</param>
+ /// <param name="parm">鏌ヨ鍙傛暟</param>
+ /// <param name="prop">鎺掑簭瀛楁</param>
+ /// <param name="order">鎺掑簭瑙勫垯</param>
+ /// <param name="pageSize">椤电爜</param>
+ /// <param name="pageNumber">姣忛〉鏄剧ず鏉℃暟</param>
+ /// <returns></returns>
+
+ public static IEnumerable<T> GetPagedData<T>(string tableName, string torg_code, string parent_id, string condition, Object parm, string prop, string order, int pageSize, int pageNumber, out int total)
+ {
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ // 鏌ヨ鎬昏褰曟暟
+ string countQuery = $@"WITH CTE AS (
+ SELECT *
+ FROM {tableName}
+ WHERE {condition}
+ UNION ALL
+ select o.*
+ from {tableName} o
+ JOIN CTE c ON o.{torg_code} = c.{parent_id}
+ )
+ SELECT DISTINCT * FROM CTE";
+ int totalRecords = conn.ExecuteScalar<int>(countQuery, parm);
+
+ // 璁$畻鎬婚〉鏁�
+ int totalPages = (int)Math.Ceiling((double)totalRecords / pageSize);
+
+ // 璁$畻鍒嗛〉鐨勮捣濮嬭鍙�
+ int startRow = (pageNumber - 1) * pageSize + 1;
+ // 璁$畻鍒嗛〉鐨勭粨鏉熻鍙�
+ int endRow = pageNumber * pageSize;
+
+ // 鍒嗛〉鏌ヨ
+ string query = $@"WITH CTE AS (
+ SELECT *
+ FROM {tableName}
+ WHERE {condition}
+ UNION ALL
+ select o.*
+ from {tableName} o
+ JOIN CTE c ON o.{torg_code} = c.{parent_id}
+ )
+ SELECT * FROM(
+ SELECT ROW_NUMBER() OVER (ORDER BY {prop} {order}) AS rowNum,*
+ FROM (
+ SELECT DISTINCT *
+ from CTE
+ ) AS subquery) AS AA WHERE rowNum >= {startRow} AND rowNum <={endRow}";
+ total = totalRecords;
+ return conn.Query<T>(query, parm);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Dapper鏌ヨ杩斿洖datatable鏁版嵁(甯﹀弬鏁�)
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <param name="parm"></param>
+ /// <returns></returns>
+ public static DataTable selectdata(string sql, Object parm)
+ {
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ DataTable table = new DataTable();
+ var data = conn.ExecuteReader(sql, parm);
+ table.Load(data);
+ return table;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Dapper鏌ヨ杩斿洖datatable鏁版嵁(甯﹀弬鏁�)
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <param name="parm"></param>
+ /// <returns></returns>
+ public static DataTable selectlist(string sql, Object parm)
+ {
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ DataTable table = new DataTable();
+ var data = conn.ExecuteReader(sql, parm);
+ table.Load(data);
+ return table;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Dapper鏌ヨ杩斿洖datatable鏁版嵁(涓嶅甫鍙傛暟)
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <returns></returns>
+ public static DataTable selecttable(string sql)
+ {
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ DataTable table = new DataTable();
+ var data = conn.ExecuteReader(sql);
+ table.Load(data);
+ return table;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Dapper鎵ц瀛樺偍杩囩▼杩斿洖datatable鏁版嵁(甯﹀弬鏁�)
+ /// </summary>
+ /// <param name="sql">瀛樺偍杩囩▼鍚�</param>
+ /// <param name="parm">鍙傛暟</param>
+ /// <returns></returns>
+ public static DataTable selectProcedure(string sql, Object parm)
+ {
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ DataTable table = new DataTable();
+ //var data = conn.ExecuteReader(sql, parm);
+ var res = conn.ExecuteReader(sql, parm, commandType: CommandType.StoredProcedure);//sql 瀛樺偍杩囩▼
+ table.Load(res);
+ return table;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Dapper鎵ц瀛樺偍杩囩▼杩斿洖datatable鏁版嵁(甯﹀弬鏁�)
+ /// </summary>
+ /// <param name="sql">瀛樺偍杩囩▼鍚�</param>
+ /// <param name="parm">鍙傛暟</param>
+ /// <returns></returns>
+ public static bool selectProcedureTable(string sql, Object parm, out DataTable table)
+ {
+ bool result;
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ var res = conn.ExecuteReader(sql, parm, commandType: CommandType.StoredProcedure);//sql 瀛樺偍杩囩▼
+ table= (DataTable)res;
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ return result;
+ }
+
+ }
+
+ /// <summary>
+ /// Dapper鎵ц瀛樺偍杩囩▼杩斿洖datatable鏁版嵁(甯﹀弬鏁�)
+ /// </summary>
+ /// <param name="sql">瀛樺偍杩囩▼鍚�</param>
+ /// <param name="parm">鍙傛暟</param>
+ /// <returns></returns>
+ public static bool IsProcedure(string sql, Object parm)
+ {
+ bool result;
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ DataTable table = new DataTable();
+ //var data = conn.ExecuteReader(sql, parm);
+ var res = conn.ExecuteReader(sql, parm, commandType: CommandType.StoredProcedure);//sql 瀛樺偍杩囩▼
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ result = false;
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Dapper鎵ц瀛樺偍杩囩▼杩斿洖datatable鏁版嵁(涓嶅甫鍙傛暟)
+ /// </summary>
+ /// <param name="sql">瀛樺偍杩囩▼鍚�</param>
+ /// <returns></returns>
+ public static bool IsProcedureNo(string sql)
+ {
+ bool result;
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ DataTable table = new DataTable();
+ //var data = conn.ExecuteReader(sql, parm);
+ var res = conn.ExecuteReader(sql);//sql 瀛樺偍杩囩▼
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ result = false;
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ return result;
+ }
+ }
+ /// <summary>
+ /// Dapper鎵ц瀛樺偍杩囩▼杩斿洖datatable鏁版嵁(涓嶅甫鍙傛暟)
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <returns></returns>
+ public static DataTable IsProcedureNoData(string sql)
+ {
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ DataTable table = new DataTable();
+ //var data = conn.ExecuteReader(sql, parm);
+ var res = conn.ExecuteReader(sql);//sql 瀛樺偍杩囩▼
+ table.Load(res);
+ return table;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Dapper鏌ヨ杩斿洖鏁版嵁鏉℃暟
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <param name="parm"></param>
+ /// <returns></returns>
+ public static int selectcount(string sql, Object parm)
+ {
+ //sql璇彞
+ int result = 0;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ result = conn.Query(sql, parm).Count();
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Dapper澧炲垹鏀�
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <param name="parametere"></param>
+ /// <returns></returns>
+ public static int SQL(string sql, Object parametere)
+ {
+ //sql璇彞
+ int result = 0;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ result = conn.Execute(sql, parametere);
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ return result;
+ }
+
+ /// <summary>
+ /// 澧炲姞锛屽垹闄わ紝淇敼浣跨敤鐨� 浜嬪姟鏂规硶 Sqllist涓轰緷娆℃墽琛�
+ /// </summary>
+ /// <param name="sqlList"></param>
+ /// <returns></returns>
+ public static bool DoTransaction(List<object> sqlList)
+ {
+ bool result;
+ IDbTransaction tranction = null;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ tranction = conn.BeginTransaction();
+ for (int i = 0; i < sqlList.Count; i++)
+ {
+ conn.Execute(sqlList[i].GetType().GetProperty("str").GetValue(sqlList[i], null).ToString(), sqlList[i].GetType().GetProperty("parm").GetValue(sqlList[i], null), tranction);
+ }
+ tranction.Commit();
+
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ result = false;
+ tranction.Rollback();
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// 澧炲姞锛屽垹闄わ紝淇敼浣跨敤鐨� 浜嬪姟鏂规硶 Sqllist涓轰緷娆℃墽琛�
+ /// </summary>
+ /// <param name="sqlList"></param>
+ /// <returns></returns>
+ public static int DoTransactionCont(List<object> sqlList)
+ {
+ int result = 0;
+ IDbTransaction tranction = null;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ tranction = conn.BeginTransaction();
+ for (int i = 0; i < sqlList.Count; i++)
+ {
+ result += conn.Execute(sqlList[i].GetType().GetProperty("str").GetValue(sqlList[i], null).ToString(), sqlList[i].GetType().GetProperty("parm").GetValue(sqlList[i], null), tranction);
+ }
+ tranction.Commit();
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ tranction.Rollback();
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ return result;
+ }
+ }
+
+ /// <summary>
+ /// Dapper鎻掑叆 杩斿洖鑷涓婚敭Id锛堝浠斤級
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <param name="parameter"></param>
+ /// <param name="tableName">寰呮彃鍏ユ暟鎹殑琛ㄥ悕</param>
+ /// <returns></returns>
+ public static int insertReturnId0(string sql, Object parameter, String tableName)
+ {
+
+ int result = 0;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ result = conn.Execute(sql, parameter);
+ if (result != 0)
+ {
+ result = conn.Query<int>("select ident_current(@table)", new { table = tableName }).Single<int>();
+ }
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ return result;
+ }
+
+
+ /// <summary>
+ /// Dapper 杩斿洖鑷涓婚敭褰撳墠鏁版嵁琛ㄦ渶澶d
+ /// </summary>
+ /// <param name="tableName">寰呮彃鍏ユ暟鎹殑琛ㄥ悕</param>
+ /// <returns></returns>
+ public static int insertReturnId(String tableName)
+ {
+
+ int result = 0;
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ if (result == 0)
+ {
+ result = conn.Query<int>("select ident_current(@table)", new { table = tableName }).Single<int>();
+ }
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ return result;
+ }
+ /// <summary>
+ /// 鎵цsql鎵ц璇彞,杩斿洖瀛楃涓�
+ /// </summary>
+ /// <param name="sql"></param>
+ /// <returns></returns>
+ public static string sqlstr(String sql)
+ {
+
+ string result = "";
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ if (result == "")
+ {
+ result = conn.Query<string>(sql).First();
+ }
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ return result;
+ }
+
+ public static DataTable lissql(string sql)
+ {
+ //sql璇彞
+ using (IDbConnection conn = sqlConnection())
+ {
+ try
+ {
+ DataTable table = new DataTable();
+ //var data = conn.ExecuteReader(sql, parm);
+ var res = conn.ExecuteReader(sql);//sql 瀛樺偍杩囩▼
+ table.Load(res);
+ return table;
+ }
+ catch (Exception ex)
+ {
+ //鍒涘缓鏃ュ織璁板綍缁勪欢瀹炰緥
+ LogHelper.WriteLog(ex);
+ throw ex;
+ }
+ finally
+ {
+ conn.Dispose();
+ conn.Close();
+ }
+ }
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/DataOperator.cs b/VueWebCoreApi/Tools/DataOperator.cs
new file mode 100644
index 0000000..3544805
--- /dev/null
+++ b/VueWebCoreApi/Tools/DataOperator.cs
@@ -0,0 +1,1374 @@
+锘縰sing System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class DataOperator
+ {
+ private static string connectionString = string.Empty;
+
+ private static string connectionName = string.Empty;
+
+ private static string key = "fengyi";
+
+ private static string iv = "fengyibi";
+
+ private SqlConnection _conn = null;
+
+ private static string uid;
+
+ public static string password;
+
+ private SqlCommand _cmd = null;
+
+ private SqlDataAdapter _adp = null;
+
+ public static string ConnectionName
+ {
+ get
+ {
+ return DataOperator.connectionName;
+ }
+ }
+
+ public static string Key
+ {
+ get
+ {
+ return DataOperator.key;
+ }
+ set
+ {
+ DataOperator.key = value;
+ }
+ }
+
+ public static string IV
+ {
+ get
+ {
+ return DataOperator.iv;
+ }
+ set
+ {
+ DataOperator.iv = value;
+ }
+ }
+
+ public SqlConnection Connection
+ {
+ get
+ {
+ return this._conn;
+ }
+ }
+
+ public string UId
+ {
+ get
+ {
+ return DataOperator.uid;
+ }
+ }
+
+ public string Password
+ {
+ get
+ {
+ return DataOperator.password;
+ }
+ }
+
+ public DataOperator()
+ {
+ if (DataOperator.connectionString == "")
+ {
+ throw new ArgumentNullException("ConnectionString");
+ }
+ }
+
+ public DataOperator(string server, string puid, string pwd, string dbname)
+ {
+ try
+ {
+ if (server == null || server.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("Type:string pramName:server", "鏁版嵁搴撴湇鍔″櫒涓虹┖锛�");
+ }
+ if (DataOperator.uid == null || DataOperator.uid.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("Type:string pramName:uid", "鏁版嵁搴撶敤鎴峰悕涓虹┖锛�");
+ }
+ if (dbname == null || dbname.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("Type:string pramName:dbname", "鏁版嵁搴撳悕涓虹┖锛�");
+ }
+ DataOperator.uid = puid;
+ DataOperator.password = pwd;
+ string text = string.Format("server={0};uid={1};pwd={2};database={3};", new object[]
+ {
+ server,
+ DataOperator.uid,
+ pwd,
+ dbname
+ });
+ this._conn = new SqlConnection(text);
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ public bool getTable(string sqlstr, ref DataTable rdt)
+ {
+ bool result;
+ try
+ {
+ if (null == rdt)
+ {
+ rdt = new DataTable();
+ }
+ else
+ {
+ rdt.Clear();
+ }
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._adp = new SqlDataAdapter(sqlstr, this._conn);
+ this._adp.Fill(rdt);
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public DataTable getTable(string sqlstr)
+ {
+ DataTable result;
+ try
+ {
+ DataTable dataTable = new DataTable();
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._adp = new SqlDataAdapter(sqlstr, this._conn);
+ this._adp.Fill(dataTable);
+ result = dataTable;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public DataTable GetTable(string sqlstr)
+ {
+ DataTable result;
+ try
+ {
+ DataTable dataTable = new DataTable();
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._adp = new SqlDataAdapter(sqlstr, this._conn);
+ this._adp.Fill(dataTable);
+ result = dataTable;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public bool getTable(string sqlstr, SqlParameter[] param, ref DataTable rdt)
+ {
+ bool result;
+ try
+ {
+ if (null == rdt)
+ {
+ rdt = new DataTable();
+ }
+ else
+ {
+ rdt.Clear();
+ }
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._adp = new SqlDataAdapter(sqlstr, this._conn);
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._adp.SelectCommand.Parameters.Add((SqlParameter)((ICloneable)param[i]).Clone());
+ }
+ this._adp.Fill(rdt);
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public DataTable GetTable(string sqlstr, SqlParameter[] param)
+ {
+ DataTable result;
+ try
+ {
+ DataTable dataTable = new DataTable();
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._adp = new SqlDataAdapter(sqlstr, this._conn);
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._adp.SelectCommand.Parameters.Add((SqlParameter)((ICloneable)param[i]).Clone());
+ }
+ this._adp.Fill(dataTable);
+ result = dataTable;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public DataTable getTable(string sqlstr, SqlParameter[] param)
+ {
+ DataTable result;
+ try
+ {
+ DataTable dataTable = new DataTable();
+ if (null == this._conn)
+ {
+
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._adp = new SqlDataAdapter(sqlstr, this._conn);
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._adp.SelectCommand.Parameters.Add((SqlParameter)((ICloneable)param[i]).Clone());
+ }
+ this._adp.Fill(dataTable);
+ result = dataTable;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+
+ return result;
+ }
+
+ public DataSet getdate(string sqlstr, SqlParameter[] param)
+ {
+ DataSet result;
+ try
+ {
+ DataSet dset = new DataSet();
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._adp = new SqlDataAdapter(sqlstr, this._conn);
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._adp.SelectCommand.Parameters.Add((SqlParameter)((ICloneable)param[i]).Clone());
+ }
+ this._adp.Fill(dset);
+ result = dset;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public object getObject(string sqlstr)
+ {
+ object result;
+ try
+ {
+ if (sqlstr == null || sqlstr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL璇彞涓嶈兘涓虹┖锛�");
+ }
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._cmd = new SqlCommand(sqlstr, this._conn);
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ result = this._cmd.ExecuteScalar();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._cmd)
+ {
+ this._cmd.Dispose();
+ this._cmd = null;
+ }
+ }
+ return result;
+ }
+
+ public object getObject(string sqlstr, SqlParameter[] param)
+ {
+ object result;
+ try
+ {
+ if (sqlstr == null || sqlstr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL璇彞涓嶈兘涓虹┖锛�");
+ }
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._cmd = new SqlCommand(sqlstr, this._conn);
+ this._cmd.Parameters.Clear();
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add((SqlParameter)((ICloneable)param[i]).Clone());
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ result = this._cmd.ExecuteScalar();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._cmd)
+ {
+ this._cmd.Dispose();
+ this._cmd = null;
+ }
+ }
+ return result;
+ }
+
+ public int getCount(string sqlstr)
+ {
+ int result;
+ try
+ {
+ if (sqlstr == null || sqlstr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL璇彞涓嶈兘涓虹┖锛�");
+ }
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand(sqlstr, this._conn);
+ object obj = this._cmd.ExecuteScalar();
+ if (null == obj)
+ {
+ throw new ArgumentNullException("_cmd.ExecuteScalar()", "缁撴灉杩斿洖绌猴紒");
+ }
+ result = Convert.ToInt32(obj);
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._cmd)
+ {
+ this._cmd.Dispose();
+ this._cmd = null;
+ }
+ }
+ return result;
+ }
+
+ public int getCount(string sqlstr, SqlParameter[] param)
+ {
+ int result;
+ try
+ {
+ if (sqlstr == null || sqlstr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL璇彞涓嶈兘涓虹┖锛�");
+ }
+ if (null == this._conn)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand(sqlstr, this._conn);
+ this._cmd.Parameters.Clear();
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add((SqlParameter)((ICloneable)param[i]).Clone());
+ }
+ object obj = this._cmd.ExecuteScalar();
+ if (null == obj)
+ {
+ throw new ArgumentNullException("_cmd.ExecuteScalar()", "缁撴灉杩斿洖绌猴紒");
+ }
+ result = Convert.ToInt32(obj);
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._cmd)
+ {
+ this._cmd.Dispose();
+ this._cmd = null;
+ }
+ }
+ return result;
+ }
+
+ public bool executeSql(string sqlstr)
+ {
+ bool result;
+ try
+ {
+ if (sqlstr == null || sqlstr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL璇彞涓虹┖锛�");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._cmd = new SqlCommand(sqlstr, this._conn);
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd.ExecuteNonQuery();
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (this._cmd != null)
+ {
+ this._cmd.Dispose();
+ this._cmd = null;
+ }
+ }
+ return result;
+ }
+
+ public bool executeSql(string sqlstr, SqlParameter[] param)
+ {
+ bool result;
+ try
+ {
+ if (sqlstr == null || sqlstr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL璇彞涓虹┖锛�");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._cmd = new SqlCommand(sqlstr, this._conn);
+ this._cmd.Parameters.Clear();
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add((SqlParameter)((ICloneable)param[i]).Clone());
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd.ExecuteNonQuery();
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (this._cmd != null)
+ {
+ this._cmd.Dispose();
+ this._cmd = null;
+ }
+ }
+ return result;
+ }
+
+ public bool executeSql(List<string> list)
+ {
+ string[] array = new string[list.Count];
+ for (int i = 0; i < list.Count; i++)
+ {
+ array[i] = list[i];
+ }
+ return this.executeSql(array);
+ }
+
+ public bool executeSql(string[] list)
+ {
+ SqlTransaction sqlTransaction = null;
+ bool result;
+ try
+ {
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ sqlTransaction = this._conn.BeginTransaction();
+ for (int i = 0; i < list.Length; i++)
+ {
+ string text = list[i];
+ if (text == null || text.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL璇彞涓虹┖锛�");
+ }
+ this._cmd = new SqlCommand(text, this._conn);
+ this._cmd.Transaction = sqlTransaction;
+ this._cmd.ExecuteNonQuery();
+ }
+ sqlTransaction.Commit();
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ if (null != sqlTransaction)
+ {
+ sqlTransaction.Rollback();
+ }
+ throw ex;
+ }
+ finally
+ {
+ if (this._cmd != null)
+ {
+ this._cmd.Dispose();
+ this._cmd = null;
+ }
+ if (null != sqlTransaction)
+ {
+ sqlTransaction.Dispose();
+ sqlTransaction = null;
+ }
+ }
+ return result;
+ }
+
+ //public bool executeSql(SQLExecEntity entity)
+ //{
+ // return this.executeSql(new List<SQLExecEntity>
+ // {
+ // entity
+ // });
+ //}
+
+ //public bool executeSql(List<SQLExecEntity> list)
+ //{
+ // SqlTransaction sqlTransaction = null;
+ // bool result;
+ // try
+ // {
+ // if (this._conn == null)
+ // {
+ // this._conn = new SqlConnection(DataOperator.connectionString);
+ // }
+ // if (ConnectionState.Closed == this._conn.State)
+ // {
+ // this._conn.Open();
+ // }
+ // sqlTransaction = this._conn.BeginTransaction();
+ // foreach (SQLExecEntity current in list)
+ // {
+ // this._cmd = new SqlCommand(current.SqlStr, this._conn);
+ // SqlParameter[] @params = new ParamCollections(current.Param).GetParams();
+ // SqlParameter[] array = @params;
+ // for (int i = 0; i < array.Length; i++)
+ // {
+ // SqlParameter value = array[i];
+ // this._cmd.Parameters.Add(value);
+ // }
+ // this._cmd.Transaction = sqlTransaction;
+ // this._cmd.ExecuteNonQuery();
+ // }
+ // sqlTransaction.Commit();
+ // result = true;
+ // }
+ // catch (Exception ex)
+ // {
+ // if (null != sqlTransaction)
+ // {
+ // sqlTransaction.Rollback();
+ // }
+ // throw ex;
+ // }
+ // finally
+ // {
+ // if (this._cmd != null)
+ // {
+ // this._cmd.Dispose();
+ // this._cmd = null;
+ // }
+ // if (null != sqlTransaction)
+ // {
+ // sqlTransaction = null;
+ // }
+ // }
+ // return result;
+ //}
+
+ public bool executeProduct(string sqlstr, ref ArrayList outAl)
+ {
+ DataTable dataTable = new DataTable();
+ bool result;
+ try
+ {
+ if (sqlstr == null || sqlstr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL涓嶈兘涓虹┖锛�");
+ }
+ if (null != outAl)
+ {
+ outAl.Clear();
+ }
+ else
+ {
+ outAl = new ArrayList();
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ this._adp = new SqlDataAdapter(sqlstr, this._conn);
+ this._adp.Fill(dataTable);
+ if (null != dataTable)
+ {
+ for (int i = 0; i < dataTable.Columns.Count; i++)
+ {
+ if (null != dataTable.Rows[0][i])
+ {
+ outAl.Add(dataTable.Rows[0][i]);
+ }
+ }
+ }
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ if (null != dataTable)
+ {
+ dataTable.Clear();
+ dataTable.Dispose();
+ dataTable = null;
+ }
+ }
+ return result;
+ }
+
+ public ArrayList executeProduct(string produreName, SqlParameter[] param, bool returnDt)
+ {
+ DataTable dataTable = new DataTable();
+ ArrayList result;
+ try
+ {
+ ArrayList arrayList = new ArrayList();
+ if (produreName == null || produreName.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("produreName", "杩囩▼鍚嶄笉鑳戒负绌猴紒");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand();
+ this._cmd.Connection = this._conn;
+ this._cmd.CommandType = CommandType.StoredProcedure;
+ this._cmd.CommandText = produreName;
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add(param[i]);
+ }
+ if (returnDt)
+ {
+ SqlDataReader sqlDataReader = this._cmd.ExecuteReader();
+ for (int i = 0; i < sqlDataReader.FieldCount; i++)
+ {
+ dataTable.Columns.Add(sqlDataReader.GetName(i), sqlDataReader.GetFieldType(i));
+ }
+ while (sqlDataReader.Read())
+ {
+ DataRow dataRow = dataTable.NewRow();
+ dataRow.BeginEdit();
+ for (int i = 0; i < sqlDataReader.FieldCount; i++)
+ {
+ dataRow[i] = sqlDataReader.GetValue(i);
+ }
+ dataRow.EndEdit();
+ dataTable.Rows.Add(dataRow);
+ }
+ sqlDataReader.Close();
+ arrayList.Add(dataTable);
+ }
+ else
+ {
+ object value = this._cmd.ExecuteScalar();
+ arrayList.Add(value);
+ }
+ result = arrayList;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
+
+ public DataTable ExecuteProductData(string produreName, SqlParameter[] param)
+ {
+ DataTable result;
+ try
+ {
+ if (produreName == null || produreName.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("produreName", "杩囩▼鍚嶄笉鑳戒负绌猴紒");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand();
+ this._cmd.Connection = this._conn;
+ this._cmd.CommandType = CommandType.StoredProcedure;
+ this._cmd.CommandText = produreName;
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add(param[i]);
+ }
+ DataTable dataTable = new DataTable();
+ this._adp = new SqlDataAdapter(this._cmd);
+ this._adp.Fill(dataTable);
+ result = dataTable;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public List<DataTable> ExecuteProductDataList(string produreName, SqlParameter[] param)
+ {
+ List<DataTable> result = new List<DataTable>();
+ try
+ {
+ if (produreName == null || produreName.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("produreName", "杩囩▼鍚嶄笉鑳戒负绌猴紒");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand();
+ this._cmd.Connection = this._conn;
+ this._cmd.CommandType = CommandType.StoredProcedure;
+ this._cmd.CommandText = produreName;
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add(param[i]);
+ }
+ DataSet ds = new DataSet();
+ this._adp = new SqlDataAdapter(this._cmd);
+ this._adp.Fill(ds);
+ for (int i = 0; i < ds.Tables.Count; i++)
+ {
+ result.Add(ds.Tables[i]);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public DataSet ExecuteProductDataSet(string produreName, SqlParameter[] param)
+ {
+ DataSet result;
+ try
+ {
+ if (produreName == null || produreName.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("produreName", "杩囩▼鍚嶄笉鑳戒负绌猴紒");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand();
+ this._cmd.Connection = this._conn;
+ this._cmd.CommandType = CommandType.StoredProcedure;
+ this._cmd.CommandText = produreName;
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add(param[i]);
+ }
+ DataSet dataSet = new DataSet();
+ this._adp = new SqlDataAdapter(this._cmd);
+ this._adp.Fill(dataSet);
+ result = dataSet;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ }
+ return result;
+ }
+
+ public bool BatchUpdate(DataTable dt, string sqlStr, SqlParameter[] param)
+ {
+ return this.BatchUpdate(dt, sqlStr, param, 100, false);
+ }
+
+ public bool BatchUpdate(DataTable dt, string sqlStr, SqlParameter[] param, int batchSize, bool updateAllRows)
+ {
+ bool result;
+ try
+ {
+ if (updateAllRows)
+ {
+ dt.AcceptChanges();
+ foreach (DataRow dataRow in dt.Rows)
+ {
+ dataRow.SetModified();
+ }
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._adp = new SqlDataAdapter();
+ this._adp.UpdateCommand = new SqlCommand(sqlStr, this._conn);
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._adp.UpdateCommand.Parameters.Add(param[i]);
+ }
+ this._adp.UpdateCommand.UpdatedRowSource = UpdateRowSource.None;
+ this._adp.UpdateBatchSize = batchSize;
+ this._adp.Update(dt);
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ this._adp = null;
+ }
+ if (null != this._conn)
+ {
+ this._conn.Close();
+ this._conn = null;
+ }
+ }
+ return result;
+ }
+ public Hashtable executeProduct(string produreName, SqlParameter[] param)
+ {
+ Hashtable result;
+ try
+ {
+ Hashtable hashtable = new Hashtable();
+ if (produreName == null || produreName.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("produreName", "杩囩▼鍚嶄笉鑳戒负绌猴紒");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand();
+ this._cmd.Connection = this._conn;
+ this._cmd.CommandType = CommandType.StoredProcedure;
+ this._cmd.CommandText = produreName;
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add((SqlParameter)((ICloneable)param[i]).Clone());
+ }
+ this._cmd.ExecuteNonQuery();
+ for (int i = 0; i < this._cmd.Parameters.Count; i++)
+ {
+ if (this._cmd.Parameters[i].Direction == ParameterDirection.Output || this._cmd.Parameters[i].Direction == ParameterDirection.InputOutput)
+ {
+ hashtable.Add(this._cmd.Parameters[i].SourceColumn, this._cmd.Parameters[i].Value);
+ }
+ }
+ result = hashtable;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
+
+ public bool ExecuteProduct(string produreName, SqlParameter[] param)
+ {
+ bool result;
+ try
+ {
+ if (produreName == null || produreName.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("produreName", "杩囩▼鍚嶄笉鑳戒负绌猴紒");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand();
+ this._cmd.Connection = this._conn;
+ this._cmd.CommandType = CommandType.StoredProcedure;
+ this._cmd.CommandText = produreName;
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add(param[i]);
+ }
+ this._cmd.ExecuteNonQuery();
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
+
+ public string ExecuteDBProduct(string produreName, SqlParameter[] param)
+ {
+ string result;
+ try
+ {
+ if (produreName == null || produreName.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("produreName", "杩囩▼鍚嶄笉鑳戒负绌猴紒");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ this._cmd = new SqlCommand();
+ this._cmd.Connection = this._conn;
+ this._cmd.CommandType = CommandType.StoredProcedure;
+ this._cmd.CommandText = produreName;
+ for (int i = 0; i < param.Length; i++)
+ {
+ this._cmd.Parameters.Add(param[i]);
+ }
+ this._cmd.ExecuteNonQuery();
+ result = (string)this._cmd.Parameters["@ResultValues"].Value;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
+
+ public static void SetConnectionName(string serverName)
+ {
+ DataOperator.SetConnectionName(serverName, DataOperator.key, DataOperator.iv);
+ }
+
+ public static void SetConnectionString(string conStr, string key, string iv)
+ {
+ if (conStr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("conStr");
+ }
+ DataOperator.connectionString = Encrypt.DecryptStr(conStr, key, iv);
+ }
+
+ public static void SetConnectionString1(string conStr)
+ {
+ if (conStr.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("conStr");
+ }
+ DataOperator.connectionString = conStr;
+ }
+
+ public static void SetConnectionName(string serverName, string key, string iv)
+ {
+ if (serverName.Trim().Length == 0)
+ {
+ throw new ArgumentNullException("serverName");
+ }
+ DataOperator.connectionName = serverName.Trim();
+ DataOperator.connectionString = DataOperator.GetConnectionObjString(DataOperator.connectionName, "connectionString", key, iv);
+ DataOperator.uid = DataOperator.GetConnectionObjString(DataOperator.connectionName, "Uid", key, iv);
+ DataOperator.password = DataOperator.GetConnectionObjString(DataOperator.connectionName, "Password", key, iv);
+ }
+
+ private static string GetConnectionObjString(string serverName, string itemName)
+ {
+ return DataOperator.GetConnectionObjString(serverName, itemName, DataOperator.key, DataOperator.iv);
+ }
+
+ private static string GetConnectionObjString(string serverName, string itemName, string key, string iv)
+ {
+ return Encrypt.DecryptStr(Regedit.GetValue(serverName, itemName, false), key, iv);
+ }
+
+ public bool TestDboState()
+ {
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ bool result;
+ try
+ {
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
+
+ public string checkSql(string sqlstr)
+ {
+ sqlstr = sqlstr.Replace("--", "__").Replace("'", "鈥�").Replace(";", "锛�").Trim();
+ return sqlstr;
+ }
+
+ public void Close()
+ {
+ if (null != this._conn)
+ {
+ try
+ {
+ if (ConnectionState.Open == this._conn.State)
+ {
+ this._conn.Close();
+ }
+ }
+ catch (Exception)
+ {
+ }
+ finally
+ {
+ this._conn = null;
+ }
+ }
+ if (null != this._adp)
+ {
+ this._adp.Dispose();
+ }
+ this._adp = null;
+ if (null != this._cmd)
+ {
+ this._cmd.Dispose();
+ }
+ }
+
+ public void Dispose()
+ {
+ this.Close();
+ }
+
+ /// <summary>
+ /// 鎵ц澶氭潯SQL璇彞锛屽疄鐜版暟鎹簱浜嬪姟銆�
+ /// </summary>
+ /// <param name="sql">澶氭潯SQL璇彞</param>
+ /// <returns>褰卞搷鐨勮褰曟暟</returns>
+ public int ExecuteSqlTran(List<string> list, params SqlParameter[] param)
+ {
+ if (list == null || list.Count == 0)
+ {
+ throw new ArgumentNullException("sqlstr", "SQL璇彞涓虹┖锛�");
+ }
+ if (this._conn == null)
+ {
+ this._conn = new SqlConnection(DataOperator.connectionString);
+ }
+ for (int i = 0; i < list.Count; i++)
+ {
+ this._cmd = new SqlCommand(list[i], this._conn);
+ this._cmd.Parameters.Clear();
+ }
+ for (int j = 0; j < param.Length; j++)
+ {
+ this._cmd.Parameters.Add((SqlParameter)((ICloneable)param[j]).Clone());
+ }
+ if (ConnectionState.Closed == this._conn.State)
+ {
+ this._conn.Open();
+ }
+ //if (conn.State.ToString() == "OPEN")
+ //{
+ // conn.Close();
+ //}
+ //conn.Open();
+ //SqlCommand cmd = new SqlCommand();
+ this._cmd.Connection = this._conn;
+ SqlTransaction tx = this._conn.BeginTransaction();
+ this._cmd.Transaction = tx;
+ try
+ {
+ int count = 0;
+ for (int n = 0; n < list.Count; n++)
+ {
+
+ string strsql = list[n];
+
+ if (strsql.Trim().Length > 1)
+ {
+
+ this._cmd.CommandText = strsql;
+ count += this._cmd.ExecuteNonQuery();
+ }
+
+ }
+
+ tx.Commit();
+ this._conn.Close();
+ return count;
+ }
+ catch (Exception ex)
+ {
+ throw new Exception(ex.Message);
+ tx.Rollback();
+ this._conn.Close();
+ return -1;
+ }
+ }
+
+
+
+ #region銆愭壒閲忓啓鍏ql銆�
+ //public int AddDBSqlBulkCopy(DataTable dt, string targetTable)
+ //{
+
+
+ // this._conn.Open();
+ // //澹版槑SqlBulkCopy ,using閲婃斁闈炴墭绠¤祫婧�
+
+ // using (OracleBulkCopy sqlBC = new OracleBulkCopy(this._conn))
+ // {
+
+ // //涓�娆℃壒閲忕殑鎻掑叆鐨勬暟鎹噺
+
+ // sqlBC.BatchSize = 1000;
+
+ // //瓒呮椂涔嬪墠鎿嶄綔瀹屾垚鎵�鍏佽鐨勭鏁帮紝濡傛灉瓒呮椂鍒欎簨鍔′笉浼氭彁浜� 锛屾暟鎹皢鍥炴粴锛屾墍鏈夊凡澶嶅埗鐨勮閮戒細浠庣洰鏍囪〃涓Щ闄�
+
+ // sqlBC.BulkCopyTimeout = 60;
+
+ // //瑷畾NotifyAfter 灞炴�э紝浠ヤ究鍦ㄦ瘡鎻掑叆10000 鏉℃暟鎹椂锛屽懠鍙浉搴斾簨浠躲��
+
+ // sqlBC.NotifyAfter = 10000;
+
+ // sqlBC.OracleRowsCopied += new OracleRowsCopiedEventHandler(sqlBC_OracleRowsCopied);
+
+ // //璁剧疆瑕佹壒閲忓啓鍏ョ殑琛�
+
+ // sqlBC.DestinationTableName = "dbo.Name";
+
+ // //鑷畾涔夌殑datatable鍜屾暟鎹簱鐨勫瓧娈佃繘琛屽搴�
+
+ // sqlBC.ColumnMappings.Add("Name", "userName");
+
+ // // sqlBC.ColumnMappings.Add("Name",1);
+
+ // //鎵归噺鍐欏叆
+
+ // sqlBC.WriteToServer(dt);
+
+ // }
+
+ // this._conn.Dispose();
+
+ //}
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/DownLoad.cs b/VueWebCoreApi/Tools/DownLoad.cs
new file mode 100644
index 0000000..431fffa
--- /dev/null
+++ b/VueWebCoreApi/Tools/DownLoad.cs
@@ -0,0 +1,569 @@
+锘縰sing Microsoft.AspNetCore.Hosting;
+using NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using NPOI.SS.Util;
+using NPOI.XSSF.UserModel;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public static class DownLoad
+ {
+ ///<summary>
+ /// 涓嬭浇
+ ///</summary>
+ ///<typeparam name="T"></typeparam>
+ ///<param name="data"></param>
+ ///<param name="map">鎵�闇�瑕佺殑鍒�</param>
+ ///<param name="filenName">鏂囦欢鍚嶅瓧</param>
+ ///<returns></returns>
+ public static string Download<T>(this IList<T> data, Dictionary<string, string> map, string filenName)
+ {
+ var filename = filenName + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
+ string fileip = AppSetting.GetAppSetting("FileIP");
+ var filepath = CoreHttpContext.MapPath("/newxls/");
+ var path = filepath + filename;
+
+ if (!Directory.Exists(filepath))
+ {
+ Directory.CreateDirectory(filepath);
+ }
+ var properties = TypeDescriptor.GetProperties(typeof(T));
+ var dt = new DataTable();
+ var list = map.Values;
+ //鏄剧ず琛ㄧ粨鏋�
+ foreach (var row in list)
+ {
+ dt.Columns.Add(row);
+ }
+ //鍙栧��
+ foreach (var item in data)
+ {
+ var i = 0;
+ var values = new object[dt.Columns.Count];
+ foreach (var content in map)
+ {
+ var property = properties[content.Key];
+ if (property != null)
+ {
+ var value = property.GetValue(item);
+ if (property.PropertyType == typeof(decimal))
+ {
+ if ((decimal)value == 0)
+ {
+ value = 0;
+ }
+ else
+ {
+ value = ((decimal)value).ToString("0.00");
+ }
+ }
+ values[i] = value;
+ if (Convert.ToString(content).Contains("鐜�"))
+ {
+ values[i] = value + "%";
+ }
+
+ }
+ else
+ {
+ values[i] = DBNull.Value;
+ }
+ i++;
+ }
+ dt.Rows.Add(values);
+ }
+ var b = DALSkillCondition.ResultExcel(path, dt);
+ if (b)
+ {
+ var url = fileip + "/apis/newxls/" + filename;
+ return url;
+ }
+ var messge = filename + "涓嬭浇澶辫触";
+ return messge;
+ }
+
+ /// <summary>
+ /// Datas the set to excel.
+ /// </summary>
+ /// <param name="ds">The ds.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
+ public static string DataSetToExcel(DataSet ds, string filenName)
+ {
+ try
+ {
+ string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xlsx";
+ string fileip = AppSetting.GetAppSetting("FileIP");
+ string filePath = CoreHttpContext.MapPath("/newxls/");
+
+ Directory.CreateDirectory(filePath);
+ string Path = filePath + fileName;
+
+ FileStream fs = null;
+ XSSFWorkbook workbook = new XSSFWorkbook();
+ for (int i = 0; i < ds.Tables.Count; i++)
+ {
+ XSSFSheet sheet = (XSSFSheet)workbook.CreateSheet(ds.Tables[i].TableName);
+ XSSFCellStyle dateStyle = (XSSFCellStyle)workbook.CreateCellStyle();
+ XSSFDataFormat format = (XSSFDataFormat)workbook.CreateDataFormat();
+ dateStyle.DataFormat = format.GetFormat("yyyy-mm-dd");
+
+ int rowIndex = 0;
+
+ #region 鏂板缓琛紝濉厖琛ㄥご锛屽~鍏呭垪澶达紝鏍峰紡
+
+ if (rowIndex == 0)
+ {
+ #region 鍒楀ご鍙婃牱寮�
+
+ XSSFRow headerRow = (XSSFRow)sheet.CreateRow(0);
+ XSSFCellStyle headStyle = (XSSFCellStyle)workbook.CreateCellStyle();
+ headStyle.Alignment = HorizontalAlignment.Center;
+
+ XSSFFont font = (XSSFFont)workbook.CreateFont();
+ font.FontName = "寰蒋闆呴粦";
+ font.FontHeightInPoints = 12; //瀛椾綋澶у皬
+ font.Boldweight = 700;//瀛椾綋鍔犵矖
+ headStyle.SetFont(font);
+ //鑷畾涔夎〃澶�
+ for (var j = 0; j < ds.Tables[i].Columns.Count; j++)
+ {
+ sheet.SetColumnWidth(j, 30 * 256);//
+ //sheet.AutoSizeColumn(j); //鑷�傚簲瀹藉害
+ headerRow.CreateCell(j).SetCellValue(ds.Tables[i].Columns[j].ColumnName);
+ headerRow.GetCell(j).CellStyle = headStyle;
+ }
+
+ #endregion
+
+ rowIndex = 1;
+ }
+
+ #endregion
+ ICellStyle cellstyle = workbook.CreateCellStyle();
+ cellstyle.VerticalAlignment = VerticalAlignment.Center;
+ cellstyle.Alignment = HorizontalAlignment.Center;
+ foreach (DataRow row in ds.Tables[i].Rows)
+ {
+ XSSFRow dataRow = (XSSFRow)sheet.CreateRow(rowIndex);
+
+ #region 濉厖鍐呭
+
+ foreach (DataColumn column in ds.Tables[i].Columns)
+ {
+ XSSFCell newCell = (XSSFCell)dataRow.CreateCell(column.Ordinal);
+ string type = row[column].GetType().FullName.ToString();
+ newCell.SetCellValue(GetValue(row[column].ToString(), type));
+ newCell.CellStyle = cellstyle;
+ }
+
+ #endregion
+
+ rowIndex++;
+ }
+ }
+
+ using (fs = File.OpenWrite(Path))
+ {
+ workbook.Write(fs);
+ var url = fileip + "/newxls/" + fileName;
+ return url;
+ }
+ }
+ catch (Exception e)
+ {
+ return e.Message;
+ }
+ }
+
+ /// <summary>
+ /// Datas the set to excel.
+ /// </summary>
+ /// <param name="ds">The ds.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
+ public static string DataTableToExcel(DataTable ds, string filenName)
+ {
+ try
+ {
+ string fileName = filenName + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xlsx";
+ string fileip = AppSetting.GetAppSetting("FileIP");
+ string filePath = CoreHttpContext.MapPath("wwwroot/newxls/");
+ Directory.CreateDirectory(filePath);
+ string Path = filePath + fileName;
+
+ FileStream fs = null;
+ XSSFWorkbook workbook = new XSSFWorkbook();
+
+ XSSFSheet sheet = (XSSFSheet)workbook.CreateSheet(ds.TableName);
+ XSSFCellStyle dateStyle = (XSSFCellStyle)workbook.CreateCellStyle();
+ XSSFDataFormat format = (XSSFDataFormat)workbook.CreateDataFormat();
+ dateStyle.DataFormat = format.GetFormat("yyyy-mm-dd");
+
+ int rowIndex = 0;
+
+ #region 鏂板缓琛紝濉厖琛ㄥご锛屽~鍏呭垪澶达紝鏍峰紡
+
+ if (rowIndex == 0)
+ {
+ #region 鍒楀ご鍙婃牱寮�
+
+ XSSFRow headerRow = (XSSFRow)sheet.CreateRow(0);
+ XSSFCellStyle headStyle = (XSSFCellStyle)workbook.CreateCellStyle();
+ headStyle.Alignment = HorizontalAlignment.Center;
+
+ XSSFFont font = (XSSFFont)workbook.CreateFont();
+ font.FontName = "寰蒋闆呴粦";
+ font.FontHeightInPoints = 12; //瀛椾綋澶у皬
+ font.Boldweight = 700;//瀛椾綋鍔犵矖
+ headStyle.SetFont(font);
+ //鑷畾涔夎〃澶�
+ for (var j = 0; j < ds.Columns.Count; j++)
+ {
+ sheet.SetColumnWidth(j, 30 * 256);//
+ //sheet.AutoSizeColumn(j); //鑷�傚簲瀹藉害
+ headerRow.CreateCell(j).SetCellValue(ds.Columns[j].ColumnName);
+ headerRow.GetCell(j).CellStyle = headStyle;
+ }
+ #endregion
+ rowIndex = 1;
+ }
+
+ #endregion
+ ICellStyle cellstyle = workbook.CreateCellStyle();
+ cellstyle.VerticalAlignment = VerticalAlignment.Center;
+ cellstyle.Alignment = HorizontalAlignment.Center;
+ foreach (DataRow row in ds.Rows)
+ {
+ XSSFRow dataRow = (XSSFRow)sheet.CreateRow(rowIndex);
+
+ #region 濉厖鍐呭
+
+ foreach (DataColumn column in ds.Columns)
+ {
+ XSSFCell newCell = (XSSFCell)dataRow.CreateCell(column.Ordinal);
+ string type = row[column].GetType().FullName.ToString();
+ newCell.SetCellValue(GetValue(row[column].ToString(), type));
+ newCell.CellStyle = cellstyle;
+ }
+
+ #endregion
+
+ rowIndex++;
+ }
+ using (fs = File.OpenWrite(Path))
+ {
+ workbook.Write(fs);
+ var url = fileip + "/newxls/" + fileName;
+ return url;
+ }
+ }
+ catch (Exception e)
+ {
+ return e.Message;
+ }
+ }
+
+ /// <summary>
+ /// Gets the value.
+ /// </summary>
+ /// <param name="cellValue">The cell value.</param>
+ /// <param name="type">The type.</param>
+ /// <returns>System.String.</returns>
+ private static string GetValue(string cellValue, string type)
+ {
+ object value = string.Empty;
+ switch (type)
+ {
+ case "System.String"://瀛楃涓茬被鍨�
+ value = cellValue;
+ break;
+ case "System.DateTime"://鏃ユ湡绫诲瀷
+ System.DateTime dateV;
+ System.DateTime.TryParse(cellValue, out dateV);
+ value = dateV;
+ break;
+ case "System.Boolean"://甯冨皵鍨�
+ bool boolV = false;
+ bool.TryParse(cellValue, out boolV);
+ value = boolV;
+ break;
+ case "System.Int16"://鏁村瀷
+ case "System.Int32":
+ case "System.Int64":
+ case "System.Byte":
+ int intV = 0;
+ int.TryParse(cellValue, out intV);
+ value = intV;
+ break;
+ case "System.Decimal"://娴偣鍨�
+ case "System.Double":
+ double doubV = 0;
+ double.TryParse(cellValue, out doubV);
+ value = doubV;
+ break;
+ case "System.DBNull"://绌哄�煎鐞�
+ value = string.Empty;
+ break;
+ default:
+ value = string.Empty;
+ break;
+ }
+ return value.ToString();
+ }
+
+
+ /// <summary>
+ /// Datatable鐢熸垚Excel琛ㄦ牸骞惰繑鍥炶矾寰�
+ /// </summary>
+ /// <param name="m_DataTable">Datatable</param>
+ /// <param name="s_FileName">鏂囦欢鍚�</param>
+ /// <returns></returns>
+ public static string DataToExcel(System.Data.DataTable m_DataTable, string filenName)
+ {
+ var filename = filenName + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
+ string fileip = AppSetting.GetAppSetting("FileIP");
+ string filepath = CoreHttpContext.MapPath("/File/newxls/");
+ var path = filepath + filename;
+
+ //string FileName = AppDomain.CurrentDomain.BaseDirectory + ("/Upload/Excel/") + filenName + ".xls"; //鏂囦欢瀛樻斁璺緞
+ if (System.IO.File.Exists(path)) //瀛樺湪鍒欏垹闄�
+ {
+ System.IO.File.Delete(path);
+ }
+ System.IO.FileStream objFileStream;
+ System.IO.StreamWriter objStreamWriter;
+ string strLine = "";
+ objFileStream = new System.IO.FileStream(path, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
+ objStreamWriter = new System.IO.StreamWriter(objFileStream, Encoding.Unicode);
+ for (int i = 0; i < m_DataTable.Columns.Count; i++)
+ {
+
+ strLine = strLine + m_DataTable.Columns[i].Caption.ToString() + Convert.ToChar(9); //鍐欏垪鏍囬
+ }
+ objStreamWriter.WriteLine(strLine);
+ strLine = "";
+ for (int i = 0; i < m_DataTable.Rows.Count; i++)
+ {
+ for (int j = 0; j < m_DataTable.Columns.Count; j++)
+ {
+ if (m_DataTable.Rows[i].ItemArray[j] == null)
+ strLine = strLine + " " + Convert.ToChar(9); //鍐欏唴瀹�
+ else
+ {
+ string rowstr = "";
+ rowstr = m_DataTable.Rows[i].ItemArray[j].ToString();
+ if (rowstr.IndexOf("\r\n") > 0)
+ rowstr = rowstr.Replace("\r\n", " ");
+ if (rowstr.IndexOf("\t") > 0)
+ rowstr = rowstr.Replace("\t", " ");
+ strLine = strLine + rowstr + Convert.ToChar(9);
+ }
+ }
+ objStreamWriter.WriteLine(strLine);
+ strLine = "";
+ }
+ objStreamWriter.Close();
+ objFileStream.Close();
+ var url = fileip + "/File/newxls/" + filename;
+ return url;
+ }
+
+
+
+ /// <summary>
+ /// 宸ヨ祫鎶ヨ〃Excel瀵煎嚭鏁版嵁鍚堝苟
+ /// </summary>
+ /// <param name="path"></param>
+ /// <param name="table"></param>
+ /// <param name="treeIndex"></param>
+ public static void DataTree(DataTable table, string filenName, int treeIndex, out string pathstring) // /apis/File/newxls/宸ヨ祫浜ч噺鎶ヨ〃20200507114638.xls
+ {
+ var filename = filenName + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
+ string fileip = AppSetting.GetAppSetting("FileIP");
+ string filepath = CoreHttpContext.MapPath("/File/newxls/");
+ var path = filepath + filename;
+ using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite))
+ {
+ IWorkbook workBook = new HSSFWorkbook();
+ //鐜板湪浣跨敤鐨勪粛鐒舵槸鐢熸垚Excel2003鐨凟xcel鏂囦欢锛岀敱浜�03瀵硅鏁帮紙65535锛夊拰鍒楁暟锛�255锛夋湁闄愬埗锛屾墍浠ュ綋鏁版嵁瓒呭嚭鑼冨洿鍚庨毦鍏嶅嚭閿�
+ //ArgumentException: Invalid column index (256). Allowable column range for BIFF8 is (0..255) or ('A'..'IV') ...
+ if (Path.GetExtension(path).Equals(".xlsx", System.StringComparison.OrdinalIgnoreCase))
+ {
+ workBook = new XSSFWorkbook();
+ }
+
+ string sheetName = string.IsNullOrWhiteSpace(table.TableName) ? "Sheet1" : table.TableName;
+ ISheet sheet = workBook.CreateSheet(sheetName);
+ IRow row = null;
+ int colNum = 8; //鍚堝苟鐨勫垪鏁�
+ //int colNum = table.Columns.Count;
+ //if (treeIndex < table.Columns.Count || treeIndex > 0)
+ //{
+ // colNum = treeIndex;
+ //}
+
+ ICellStyle cellCenterStyle = GetCenter(workBook);
+ //IFont font = workBook.CreateFont(); //鍒涘缓涓�涓瓧浣撴牱寮忓璞�
+ //font.FontName = "鏂规鑸掍綋"; //鍜宔xcel閲岄潰鐨勫瓧浣撳搴�
+ //font.IsItalic = true; //鏂滀綋
+ //font.FontHeightInPoints = 16;//瀛椾綋澶у皬
+ //font.Boldweight = short.MaxValue;//瀛椾綋鍔犵矖
+ //cellCenterStyle.SetFont(font); //灏嗗瓧浣撴牱寮忚祴缁欐牱寮忓璞�
+
+ int beginNum = 1;//鎺掗櫎鍒楀ご锛屼粠1寮�濮�
+
+ //澶勭悊琛ㄦ牸鍒楀ご
+ row = sheet.CreateRow(beginNum - 1);
+ for (int i = 0; i < table.Columns.Count; i++)
+ {
+
+ string strVal = table.Columns[i].ColumnName;
+ ICell cell = row.CreateCell(i);
+ cell.SetCellValue(strVal);
+ cell.CellStyle = cellCenterStyle;
+ row.Height = 450;
+
+ sheet.AutoSizeColumn(i);
+
+ List<int> lstColWidth = new List<int>();
+ //璁板綍鍒楅暱搴�
+ lstColWidth.Add(DataLength(strVal));
+ //璁剧疆鍒楀
+ int maxWidth = lstColWidth.Max() * 600;
+ sheet.SetColumnWidth(i, maxWidth);
+ }
+
+ //澶勭悊鏁版嵁鍐呭
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ row = sheet.CreateRow(beginNum + i);
+ row.Height = 350;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ string strVal = table.Rows[i][j].ToString();
+ ICell currCell = row.CreateCell(j);
+ currCell.SetCellValue(strVal);
+ currCell.CellStyle = cellCenterStyle;
+ sheet.SetColumnWidth(j, 256 * 15);
+ }
+ }
+
+ for (int i = 0; i < colNum; i++) //鏁版嵁鏉℃暟
+ {
+ List<int> lstColWidth = new List<int>();
+ string currVal = string.Empty;
+ string nextVal = string.Empty;
+ for (int j = beginNum; j <= sheet.LastRowNum; j++)
+ {
+ currVal = sheet.GetRow(j).Cells[i].StringCellValue;
+
+ int mk = j;
+ if (!string.IsNullOrWhiteSpace(currVal))//鎺掗櫎 绌哄�硷紝绌哄�间笉鍋氬悎骞跺鐞�
+ {
+ for (int k = j + 1; k <= sheet.LastRowNum; k++)
+ {
+ nextVal = sheet.GetRow(k).Cells[i].StringCellValue;
+
+ if (currVal != nextVal)
+ {
+ //鍥犱负k 绱姞鎵�浠ュ鑷村綋鍓嶅�间笌涓嬩釜鍊� 涓嶇浉鍚岋紝鎵�浠ヨ褰� 褰撳墠琛屾暟瑕� 鍑忓幓1
+ mk = k - 1;
+ break;
+ }
+ else if (k == sheet.LastRowNum) //杈圭晫鍊硷紝澶勭悊鏈�鍚庝竴琛岋紝鍒欐彁鍓岯reak 骞惰褰曞綋鍓� k
+ {
+ mk = k;
+ break;
+ }
+ }
+ }
+
+ if (mk != j)//鎺掗櫎 绌哄�煎锛屼笅涓�肩殑琛屾暟涓嶇瓑浜庡綋鍓嶈鏁帮紝鍒欓渶瑕佸悎骞�
+ {
+ sheet.AddMergedRegion(new CellRangeAddress(j, mk, i, i));
+
+ //sheet.GetRow(j).GetCell(i).SetCellValue("");
+ }
+ //else
+ //{
+ // if (mk < sheet.LastRowNum)
+ // {
+ // if (sheet.GetRow(j).Cells[0].StringCellValue == sheet.GetRow(mk + 1).Cells[0].StringCellValue
+ // && sheet.GetRow(j).Cells[1].StringCellValue == sheet.GetRow(mk + 1).Cells[1].StringCellValue
+ // && sheet.GetRow(j).Cells[2].StringCellValue == sheet.GetRow(mk + 1).Cells[2].StringCellValue
+ // && sheet.GetRow(j).Cells[3].StringCellValue == sheet.GetRow(mk + 1).Cells[3].StringCellValue
+ // )
+ // {
+ // int mmk = mk + 1;
+ // sheet.AddMergedRegion(new CellRangeAddress(j, mmk, i, i));
+ // }
+ // }
+ //}
+
+ //if (i == 0) //濡傛灉鏄涓�鍒楋紝鍒� 鍨傜洿姘村钩灞呬腑
+ {
+ sheet.GetRow(j).Cells[i].CellStyle = cellCenterStyle;
+ }
+ //璺冲埌鎵ц涓嬩竴涓笉鍚屾暟鎹殑琛�
+ j = mk;
+
+ //璁板綍鍒楅暱搴�
+ lstColWidth.Add(DataLength(currVal));
+ }
+
+ //璁剧疆鍒楀
+ //int maxWidth = lstColWidth.Max() * 600;
+ //sheet.SetColumnWidth(i, maxWidth);
+ }
+ //鍥哄畾鍒椼�佽 婊氬姩鏃朵笉鍙�
+ //sheet.CreateFreezePane(3, 1, 3, 1);
+
+ //鍐欏叆鏁版嵁娴�
+ workBook.Write(fs);
+ var url = fileip + "/apis/File/newxls/" + filename;
+ pathstring = url;
+ }
+ }
+
+
+ private static ICellStyle GetCenter(IWorkbook workBook, short fontSize = 10)
+ {
+ ICellStyle cellStyle = workBook.CreateCellStyle();
+ IFont font = workBook.CreateFont();
+ font.FontName = "寰蒋闆呴粦";
+ font.FontHeightInPoints = fontSize;
+ cellStyle.SetFont(font);
+ cellStyle.VerticalAlignment = VerticalAlignment.Center;
+ cellStyle.Alignment = HorizontalAlignment.Center;
+ return cellStyle;
+ }
+
+
+ /// <summary>
+ /// 鑾峰彇瀛楃涓查暱搴︼紙涓枃鎸�2涓瓧鑺傞暱搴︼級
+ /// </summary>
+ /// <param name="stringWithEnglishAndChinese"></param>
+ /// <returns></returns>
+ private static int DataLength(string stringWithEnglishAndChinese)
+ {
+ int lng = 0;
+ for (int i = 0; i < stringWithEnglishAndChinese.Length; i++)
+ {
+ byte[] b = System.Text.Encoding.Default.GetBytes(stringWithEnglishAndChinese.Substring(i, 1));
+ if (b.Length > 1)
+ lng += 2;
+ else
+ lng += 1;
+ }
+ return lng;
+ }
+
+ }
+}
diff --git a/VueWebCoreApi/Tools/Encrypt.cs b/VueWebCoreApi/Tools/Encrypt.cs
new file mode 100644
index 0000000..ef019a7
--- /dev/null
+++ b/VueWebCoreApi/Tools/Encrypt.cs
@@ -0,0 +1,143 @@
+锘縰sing System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace VueWebCoreApi.Tools
+{
+ public class Encrypt
+ {
+ private static RijndaelManaged RMCrypto = null;
+
+ private Hashtable keyList = new Hashtable();
+
+ public static string EncryptStr(string str, string strKey, string strIV)
+ {
+ CryptoStream cryptoStream = null;
+ MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider();
+ string result;
+ try
+ {
+ Encrypt.RMCrypto = new RijndaelManaged();
+ if (str == null || str.Trim().Length == 0)
+ {
+ result = "";
+ }
+ else
+ {
+ byte[] rgbKey = mD5CryptoServiceProvider.ComputeHash(Encoding.ASCII.GetBytes(strKey));
+ byte[] rgbIV = mD5CryptoServiceProvider.ComputeHash(Encoding.ASCII.GetBytes(strIV));
+ MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(str));
+ cryptoStream = new CryptoStream(memoryStream, Encrypt.RMCrypto.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
+ result = Convert.ToBase64String(memoryStream.ToArray());
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != cryptoStream)
+ {
+ cryptoStream = null;
+ }
+ if (null != Encrypt.RMCrypto)
+ {
+ Encrypt.RMCrypto.Clear();
+ Encrypt.RMCrypto = null;
+ }
+ }
+ return result;
+ }
+
+ public static string DecryptStr(string str, string strKey, string strIV)
+ {
+ string result;
+ if (str == null || str.Trim().Length == 0)
+ {
+ result = "";
+ }
+ else
+ {
+ CryptoStream cryptoStream = null;
+ MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider();
+ try
+ {
+ Encrypt.RMCrypto = new RijndaelManaged();
+ byte[] buffer = Convert.FromBase64String(str);
+ byte[] rgbKey = mD5CryptoServiceProvider.ComputeHash(Encoding.ASCII.GetBytes(strKey));
+ byte[] rgbIV = mD5CryptoServiceProvider.ComputeHash(Encoding.ASCII.GetBytes(strIV));
+ MemoryStream memoryStream = new MemoryStream(buffer);
+ cryptoStream = new CryptoStream(memoryStream, Encrypt.RMCrypto.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Read);
+ result = Encoding.UTF8.GetString(memoryStream.ToArray());
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != cryptoStream)
+ {
+ cryptoStream = null;
+ }
+ if (null != Encrypt.RMCrypto)
+ {
+ Encrypt.RMCrypto.Clear();
+ Encrypt.RMCrypto = null;
+ }
+ }
+ }
+ return result;
+ }
+
+ public void Add(string key, string value)
+ {
+ if (this.keyList.ContainsKey(key))
+ {
+ this.keyList[key] = value;
+ }
+ else
+ {
+ this.keyList.Add(key, value);
+ }
+ }
+
+ public string GetEncryptXml(string name, string key, string iv)
+ {
+ XmlDocument xmlDocument = new XmlDocument();
+ XmlElement xmlElement = xmlDocument.CreateElement(name);
+ foreach (object current in this.keyList.Keys)
+ {
+ XmlElement xmlElement2 = xmlDocument.CreateElement(Convert.ToString(current));
+ xmlElement2.InnerText = Convert.ToString(this.keyList[current]);
+ xmlElement.AppendChild(xmlElement2);
+ }
+ xmlDocument.AppendChild(xmlElement);
+ return Encrypt.EncryptStr(xmlDocument.OuterXml, key, iv);
+ }
+
+ public Hashtable GetKeyList(string name, string encryptStr, string key, string iv)
+ {
+ string xml = Encrypt.DecryptStr(encryptStr, key, iv);
+ XmlDocument xmlDocument = new XmlDocument();
+ xmlDocument.LoadXml(xml);
+ this.keyList.Clear();
+ XmlNode xmlNode = xmlDocument.SelectSingleNode(name);
+ if (null != xmlNode)
+ {
+ foreach (XmlNode xmlNode2 in xmlNode.ChildNodes)
+ {
+ this.keyList.Add(xmlNode2.Name, xmlNode2.InnerText);
+ }
+ }
+ return this.keyList;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/ExcelList.cs b/VueWebCoreApi/Tools/ExcelList.cs
new file mode 100644
index 0000000..b868a0b
--- /dev/null
+++ b/VueWebCoreApi/Tools/ExcelList.cs
@@ -0,0 +1,56 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class ExcelList
+ {
+ public static List<ScoreReport> ExcelData()
+ {
+
+ List<ScoreReport> list = new List<ScoreReport>
+ {
+ //new ScoreReport("0","缁勭粐鏋舵瀯"),
+ new ScoreReport("1","宀椾綅绠$悊"),
+ new ScoreReport("2","鐝粍绠$悊"),
+ new ScoreReport("3","浜哄憳绠$悊"),
+ new ScoreReport("4","瑙掕壊绠$悊"),
+ new ScoreReport("5","寰�鏉ュ崟浣�"),
+ new ScoreReport("6","浠撳簱璁剧疆"),
+ new ScoreReport("7","搴撲綅璁剧疆"),
+ new ScoreReport("8","瀛樿揣妗f"),
+ new ScoreReport("9","璁惧娓呭崟"),
+ //new ScoreReport("10","璁惧鐐规椤圭洰"),
+ //new ScoreReport("10_1","璁惧鐐规鏍囧噯"),
+ //new ScoreReport("11","璁惧淇濆吇椤圭洰"),
+ //new ScoreReport("11_1","璁惧淇濆吇鏍囧噯"),
+ new ScoreReport("12","妯″叿娓呭崟"),
+ new ScoreReport("13","妯″叿鐐规椤圭洰"),
+ new ScoreReport("13_1","妯″叿鐐规鏍囧噯"),
+ new ScoreReport("14","妯″叿淇濆吇椤圭洰"),
+ new ScoreReport("14_1","妯″叿淇濆吇鏍囧噯"),
+ new ScoreReport("15","宸ュ簭璁剧疆"),
+ new ScoreReport("16","宸ヨ壓璺嚎"),
+ //new ScoreReport("24","鑺傛媿宸ヤ环"),
+ new ScoreReport("17","璐ㄦ鏍囧噯"),
+ new ScoreReport("18","缂洪櫡瀹氫箟"),
+ new ScoreReport("19","鐢熶骇璁㈠崟"),
+ new ScoreReport("20","搴撳瓨鏌ヨ"),
+ new ScoreReport("21","鐗╂枡娓呭崟"),
+ };
+ return list;
+ }
+ }
+ public class ScoreReport
+ {
+ public ScoreReport(string a, string n)
+ {
+ FileCode = a;
+ FileName = n;
+ }
+ public string FileCode { get; set; }
+ public string FileName { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Tools/ExcelModelCheck.cs b/VueWebCoreApi/Tools/ExcelModelCheck.cs
new file mode 100644
index 0000000..2c25921
--- /dev/null
+++ b/VueWebCoreApi/Tools/ExcelModelCheck.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class ExcelModelCheck
+ {
+ public ToMessage json1 { get; set; }
+ public ToMessage json2 { get; set; }
+ public ToMessage json3 { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Tools/GridMessage.cs b/VueWebCoreApi/Tools/GridMessage.cs
new file mode 100644
index 0000000..1928ee0
--- /dev/null
+++ b/VueWebCoreApi/Tools/GridMessage.cs
@@ -0,0 +1,12 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class GridMessage
+ {
+ public object recordset { get; set; }
+ }
+}
diff --git a/VueWebCoreApi/Tools/ImportExcel.cs b/VueWebCoreApi/Tools/ImportExcel.cs
new file mode 100644
index 0000000..fca0173
--- /dev/null
+++ b/VueWebCoreApi/Tools/ImportExcel.cs
@@ -0,0 +1,1362 @@
+锘縰sing NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class ImportExcel
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+ /// <summary>
+ /// Excel瀵煎叆鎴怐atable
+ /// </summary>
+ /// <param name="file">瀵煎叆璺緞(鍖呭惈鏂囦欢鍚嶄笌鎵╁睍鍚�)</param>
+ /// <returns></returns>
+ public static DataTable ExcelToTable(string file)
+ {
+ IWorkbook Workbook;
+ DataTable table = new DataTable();
+ try
+ {
+ using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
+ {
+ //XSSFWorkbook 閫傜敤XLSX鏍煎紡锛孒SSFWorkbook 閫傜敤XLS鏍煎紡
+ string fileExt = Path.GetExtension(file).ToLower();
+ if (fileExt == ".xls")
+ {
+ Workbook = new HSSFWorkbook(fileStream);
+ }
+ else if (fileExt == ".xlsx")
+ {
+ Workbook = new XSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Workbook = null;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(0);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ if (headerRow == null)
+ {
+ return table;
+ }
+ int cellCount = headerRow.LastCellNum;
+ int rowCount = sheet.LastRowNum;
+
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null && row.Cells.Count > 0)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ return table;
+ }
+
+ /// <summary>
+ /// Excel 2涓猄heet瀵煎叆鎴怐atable
+ /// </summary>
+ /// <param name="file">瀵煎叆璺緞(鍖呭惈鏂囦欢鍚嶄笌鎵╁睍鍚�)</param>
+ /// <returns></returns>
+ public static List<DataTable> ExcelToTableList(string file)
+ {
+ List<DataTable> list = new List<DataTable>();
+ IWorkbook Workbook;
+ try
+ {
+ using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
+ {
+ //XSSFWorkbook 閫傜敤XLSX鏍煎紡锛孒SSFWorkbook 閫傜敤XLS鏍煎紡
+ string fileExt = Path.GetExtension(file).ToLower();
+ if (fileExt == ".xls")
+ {
+ Workbook = new HSSFWorkbook(fileStream);
+ }
+ else if (fileExt == ".xlsx")
+ {
+ Workbook = new XSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Workbook = null;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ int count = Workbook.NumberOfSheets; //鑾峰彇鎵�鏈塖heetName
+ if (count < 2)
+ {
+ DataTable table = new DataTable();
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(0);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ if (headerRow == null)
+ {
+ return list;
+ }
+ int cellCount = headerRow.LastCellNum;
+ int rowCount = sheet.LastRowNum;
+
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null && row.Cells.Count > 0)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ list.Add(table);
+ }
+ else
+ {
+ for (int m = 0; m < count; m++)
+ {
+ DataTable table = new DataTable();
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(m);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ if (headerRow == null)
+ {
+ return list;
+ }
+ int cellCount = headerRow.LastCellNum;
+ int rowCount = sheet.LastRowNum;
+
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null && row.Cells.Count > 0)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ list.Add(table);
+ }
+ }
+ return list;
+ }
+
+ /// <summary>
+ /// Excel 3涓猄heet瀵煎叆鎴怐atable
+ /// </summary>
+ /// <param name="file">瀵煎叆璺緞(鍖呭惈鏂囦欢鍚嶄笌鎵╁睍鍚�)</param>
+ /// <returns></returns>
+ public static List<DataTable> ExcelToThreeTableList(string file)
+ {
+ List<DataTable> list = new List<DataTable>();
+ IWorkbook Workbook;
+ try
+ {
+ using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
+ {
+ //XSSFWorkbook 閫傜敤XLSX鏍煎紡锛孒SSFWorkbook 閫傜敤XLS鏍煎紡
+ string fileExt = Path.GetExtension(file).ToLower();
+ if (fileExt == ".xls")
+ {
+ Workbook = new HSSFWorkbook(fileStream);
+ }
+ else if (fileExt == ".xlsx")
+ {
+ Workbook = new XSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Workbook = null;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ int count = Workbook.NumberOfSheets; //鑾峰彇鎵�鏈塖heetName
+ if (count < 3)
+ {
+ DataTable table = new DataTable();
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(0);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ if (headerRow == null)
+ {
+ return list;
+ }
+ int cellCount = headerRow.LastCellNum;
+ int rowCount = sheet.LastRowNum;
+
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null && row.Cells.Count > 0)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ list.Add(table);
+ }
+ else
+ {
+ for (int m = 0; m < count; m++)
+ {
+ DataTable table = new DataTable();
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(m);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ if (headerRow == null)
+ {
+ return list;
+ }
+ int cellCount = headerRow.LastCellNum;
+ int rowCount = sheet.LastRowNum;
+
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null && row.Cells.Count > 0)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ list.Add(table);
+ }
+ }
+ return list;
+ }
+
+
+
+
+ /// <summary>
+ /// 鑾峰彇鍗曞厓鏍肩被鍨�
+ /// </summary>
+ /// <param name="cell"></param>
+ /// <returns></returns>
+ private static string GetCellValue(ICell cell)
+ {
+ if (cell == null)
+ {
+ return string.Empty;
+ }
+
+ switch (cell.CellType)
+ {
+ case CellType.Blank:
+ return string.Empty;
+ case CellType.Boolean:
+ return cell.BooleanCellValue.ToString();
+ case CellType.Error:
+ return cell.ErrorCellValue.ToString();
+ case CellType.Numeric:
+ //Cell涓洪潪NUMERIC鏃讹紝璋冪敤IsCellDateFormatted鏂规硶浼氭姤閿欙紝鎵�浠ュ厛瑕佽繘琛岀被鍨嬪垽鏂�
+ if (cell.CellType == CellType.Numeric && DateUtil.IsCellDateFormatted(cell))
+ return Convert.ToDateTime(cell.DateCellValue).ToString("yyyy-MM-dd");
+ else
+ {
+ return cell.NumericCellValue.ToString();
+ }
+ //if (format != 0) { return Convert.ToDateTime(cell.DateCellValue).ToString("yyyy-MM-dd"); } else { return cell.NumericCellValue.ToString(); }
+ case CellType.Unknown:
+ default:
+ return cell.ToString();
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Formula:
+ try
+ {
+ HSSFFormulaEvaluator e = new HSSFFormulaEvaluator(cell.Sheet.Workbook);
+ e.EvaluateInCell(cell);
+ return cell.ToString();
+ }
+ catch
+ {
+ return cell.NumericCellValue.ToString();
+ }
+ }
+ }
+
+
+ /// <summary>
+ /// 鍗曚釜Excel 涓嶄负绌洪獙璇併�侀噸澶嶆暟鎹獙璇�
+ /// </summary>
+ /// <param name="file">瀵煎叆璺緞(鍖呭惈鏂囦欢鍚嶄笌鎵╁睍鍚�)</param>
+ /// <returns></returns>
+ public static List<ExcelErro> ExcelToTableErro(string file)
+ {
+ List<ExcelErro> list = new List<ExcelErro>();
+ IWorkbook Workbook;
+ DataTable table = new DataTable();
+ bool iscell = false;
+ int iscellCount = 0;
+ try
+ {
+ using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
+ {
+ //XSSFWorkbook 閫傜敤XLSX鏍煎紡锛孒SSFWorkbook 閫傜敤XLS鏍煎紡
+ string fileExt = Path.GetExtension(file).ToLower();
+ if (fileExt == ".xls")
+ {
+ Workbook = new HSSFWorkbook(fileStream);
+ }
+ else if (fileExt == ".xlsx")
+ {
+ Workbook = new XSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Workbook = null;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(0);
+ //sheet.ShiftRows(sheet.FirstRowNum-1, sheet.LastRowNum,1);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ int cellCount = headerRow.LastCellNum;
+ int rowCount0 = sheet.FirstRowNum;
+ //int rowCount = sheet.LastRowNum;
+ //int rowCount = sheet.PhysicalNumberOfRows;
+ int rowCount = Rownum(headerRow, cellCount, sheet, sheet.LastRowNum); //鑾峰彇鍒犻櫎绌鸿涔嬪悗鐨勬暟鎹 (鍙拡瀵逛簬鏈�鍚庢暟鎹」鏈夌┖琛岀殑)
+
+ if (rowCount - rowCount0 >= 1)
+ {
+
+ //-------------鍒ゆ柇蹇呭~椤规槸鍚︿负绌�----------------//
+ //寰幆鏁版嵁琛�
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ iscell = false;
+ iscellCount = 0;
+ IRow row = sheet.GetRow(i);
+ //鍒ゆ柇鏄惁鏈夌┖琛�
+ if (row == null)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (i + 1).ToString();
+ erro.ErrorField = "绌鸿";
+ erro.ErrorCont = "绌鸿";
+ list.Add(erro);
+ continue;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪绌烘暟鎹
+ for (int c = 0; c < cellCount; c++)
+ {
+ if (GetCellValue(row.GetCell(c)).Trim() != null && GetCellValue(row.GetCell(c)).Trim() != "")
+ {
+ iscell = false;
+ }
+ else
+ {
+ iscell = true;
+ iscellCount++;
+ }
+ }
+ if (iscell == true && iscellCount == cellCount) //绌鸿
+ {
+ continue;
+ }
+ else
+ {
+ //寰幆鏍囬鍒�
+ for (int j = headerRow.FirstCellNum; j < cellCount; j++)
+ {
+ //鑾峰彇鍗曞厓鏍肩殑濉厖鑹�
+ string rgb = headerRow.Cells[j].CellStyle.FillForegroundColor.ToString();
+ if (rgb == "51") //蹇呭~椤瑰瓧娈靛垪澶村~鍏呰壊
+ {
+ if (sheet.GetRow(i) == null || sheet.GetRow(i).ToString() == "") //瀛樺湪绌鸿
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = i.ToString();
+ erro.ErrorField = "{绗�" + i.ToString() + "琛寎";
+ erro.ErrorCont = "{绗�" + i.ToString() + "}琛屼负绌�";
+ list.Add(erro);
+ break;
+ }
+ else
+ {
+ string cellValue = GetCellValue(sheet.GetRow(i).GetCell(j)).Trim(); //GetCell:杩斿洖鍖呮嫭绌哄垪鍊� Cells:鍙繑鍥炴湁鍊肩殑鍒�
+ if (cellValue == "" || cellValue == null)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (sheet.GetRow(i).RowNum + 1).ToString();
+ erro.ErrorField = "{" + headerRow.Cells[j].StringCellValue + "}";
+ erro.ErrorCont = "{" + headerRow.Cells[j].StringCellValue + "}瀛楁涓嶈兘涓虹┖";
+ list.Add(erro);
+ }
+ }
+ }
+
+ }
+ }
+ }
+ //-------------鍒ゆ柇鍞竴椤规槸鍚﹂噸澶�----------------//
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ DataView view = new DataView(table);
+ //鑾峰彇鎵�鏈夊敮涓�鍒�
+ List<string> list0 = new List<string>();
+ //寰幆鏍囬鍒�
+ for (int j = headerRow.FirstCellNum; j < cellCount; j++)
+ {
+ bool isContain = headerRow.Cells[j].StringCellValue.Contains("鍞竴"); //鏍囬鍒椾腑鐨勫繀濉垪
+ if (isContain == true)
+ {
+ //
+ if (view.ToTable(true, new string[] { "" + headerRow.Cells[j].StringCellValue.Trim() + "" }).Rows.Count < table.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{" + headerRow.Cells[j].StringCellValue + "}";
+ erro.ErrorCont = "{" + headerRow.Cells[j].StringCellValue + "}瀛楁鏈夐噸澶嶆暟鎹�";
+ list.Add(erro);
+ }
+ }
+ }
+ }
+ List<ExcelErro> stuList = list.OrderBy(s => s.RoeNumber).ToList<ExcelErro>();
+ return list;
+ }
+ /// <summary>
+ /// Excel 2涓猄heet 鏁版嵁楠岃瘉
+ /// </summary>
+ /// <param name="file">瀵煎叆璺緞(鍖呭惈鏂囦欢鍚嶄笌鎵╁睍鍚�)</param>
+ /// <returns></returns>
+ public static List<ExcelErro> ExcelToTableListErro(string file)
+ {
+ List<ExcelErro> list = new List<ExcelErro>();
+ IWorkbook Workbook;
+ bool iscell = false;
+ int iscellCount = 0;
+ try
+ {
+ using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
+ {
+ //XSSFWorkbook 閫傜敤XLSX鏍煎紡锛孒SSFWorkbook 閫傜敤XLS鏍煎紡
+ string fileExt = Path.GetExtension(file).ToLower();
+ if (fileExt == ".xls")
+ {
+ Workbook = new HSSFWorkbook(fileStream);
+ }
+ else if (fileExt == ".xlsx")
+ {
+ Workbook = new XSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Workbook = null;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ for (int mm = 0; mm < 2; mm++)
+ {
+ DataTable table = new DataTable();
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(mm);
+ //sheet.ShiftRows(sheet.FirstRowNum-1, sheet.LastRowNum,1);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ int cellCount = headerRow.LastCellNum;
+ int rowCount0 = sheet.FirstRowNum;
+ //int rowCount = sheet.LastRowNum;
+ int rowCount = Rownum(headerRow, cellCount, sheet, sheet.LastRowNum); //鑾峰彇鍒犻櫎绌鸿涔嬪悗鐨勬暟鎹 (鍙拡瀵逛簬鏈�鍚庢暟鎹」鏈夌┖琛岀殑)
+ if (rowCount - rowCount0 >= 1)
+ {
+ //-------------鍒ゆ柇蹇呭~椤规槸鍚︿负绌�----------------//
+ //寰幆鏁版嵁琛�
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ iscell = false;
+ iscellCount = 0;
+ IRow row = sheet.GetRow(i);
+ //鍒ゆ柇鏄惁鏈夌┖琛�
+ if (row == null)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (i + 1).ToString();
+ erro.ErrorField = "绌鸿";
+ erro.ErrorCont = "绌鸿";
+ list.Add(erro);
+ continue;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪绌烘暟鎹
+ for (int c = 0; c < cellCount; c++)
+ {
+ if (GetCellValue(row.GetCell(c)).Trim() != null && GetCellValue(row.GetCell(c)).Trim() != "")
+ {
+ iscell = false;
+ }
+ else
+ {
+ iscell = true;
+ iscellCount++;
+ }
+ }
+ if (iscell == true && iscellCount == cellCount) //绌鸿
+ {
+ continue;
+ }
+ else
+ {
+ //寰幆鏍囬鍒�
+ for (int j = headerRow.FirstCellNum; j < cellCount; j++)
+ {
+ //鑾峰彇鍗曞厓鏍肩殑濉厖鑹�
+ string rgb = headerRow.Cells[j].CellStyle.FillForegroundColor.ToString();
+ if (rgb == "51") //蹇呭~椤瑰瓧娈靛垪澶村~鍏呰壊
+ {
+ if (sheet.GetRow(i) == null || sheet.GetRow(i).ToString() == "") //瀛樺湪绌鸿
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = i.ToString();
+ erro.ErrorField = "{绗�" + i.ToString() + "琛寎";
+ erro.ErrorCont = "{绗�" + i.ToString() + "}琛屼负绌�";
+ list.Add(erro);
+ break;
+ }
+ else
+ {
+ string cellValue = GetCellValue(sheet.GetRow(i).GetCell(j)).Trim(); //GetCell:杩斿洖鍖呮嫭绌哄垪鍊� Cells:鍙繑鍥炴湁鍊肩殑鍒�
+ if (cellValue == "" || cellValue == null)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (sheet.GetRow(i).RowNum + 1).ToString();
+ erro.ErrorField = "{" + headerRow.Cells[j].StringCellValue + "}";
+ erro.ErrorCont = mm == 0 ? "涓昏〃涓細" + "{" + headerRow.Cells[j].StringCellValue + "}瀛楁涓嶈兘涓虹┖" : "瀛愯〃涓細" + "{" + headerRow.Cells[j].StringCellValue + "}瀛楁涓嶈兘涓虹┖";
+ list.Add(erro);
+ }
+ }
+ }
+
+ }
+ }
+ }
+ //-------------鍒ゆ柇鍞竴椤规槸鍚﹂噸澶�----------------//
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ DataView view = new DataView(table);
+ //鑾峰彇鎵�鏈夊敮涓�鍒�
+ List<string> list0 = new List<string>();
+ //寰幆鏍囬鍒�
+ for (int j = headerRow.FirstCellNum; j < cellCount; j++)
+ {
+ bool isContain = headerRow.Cells[j].StringCellValue.Contains("鍞竴"); //鏍囬鍒椾腑鐨勫繀濉垪
+ if (isContain == true)
+ {
+ //
+ if (view.ToTable(true, new string[] { "" + headerRow.Cells[j].StringCellValue + "" }).Rows.Count < table.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{" + headerRow.Cells[j].StringCellValue + "}";
+ erro.ErrorCont = mm == 0 ? "涓昏〃涓細" + "{" + headerRow.Cells[j].StringCellValue + "}瀛楁鏈夐噸澶嶆暟鎹�" : "瀛愯〃涓細" + "{" + headerRow.Cells[j].StringCellValue + "}瀛楁鏈夐噸澶嶆暟鎹�";
+ list.Add(erro);
+ }
+ }
+ }
+ }
+ }
+ List<ExcelErro> stuList = list.OrderBy(s => s.RoeNumber).ToList<ExcelErro>();
+ return list;
+ }
+
+ /// <summary>
+ /// Excel 3涓猄heet 鏁版嵁楠岃瘉
+ /// </summary>
+ /// <param name="file">瀵煎叆璺緞(鍖呭惈鏂囦欢鍚嶄笌鎵╁睍鍚�)</param>
+ /// <returns></returns>
+ public static List<ExcelErro> ExcelToThreeTableListErro(string file)
+ {
+ List<ExcelErro> list = new List<ExcelErro>();
+ IWorkbook Workbook;
+ bool iscell = false;
+ int iscellCount = 0;
+ try
+ {
+ using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
+ {
+ //XSSFWorkbook 閫傜敤XLSX鏍煎紡锛孒SSFWorkbook 閫傜敤XLS鏍煎紡
+ string fileExt = Path.GetExtension(file).ToLower();
+ if (fileExt == ".xls")
+ {
+ Workbook = new HSSFWorkbook(fileStream);
+ }
+ else if (fileExt == ".xlsx")
+ {
+ Workbook = new XSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Workbook = null;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ for (int mm = 0; mm < 3; mm++)
+ {
+ DataTable table = new DataTable();
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(mm);
+ //sheet.ShiftRows(sheet.FirstRowNum-1, sheet.LastRowNum,1);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ int cellCount = headerRow.LastCellNum;
+ int rowCount0 = sheet.FirstRowNum;
+ //int rowCount = sheet.LastRowNum;
+ int rowCount = Rownum(headerRow, cellCount, sheet, sheet.LastRowNum); //鑾峰彇鍒犻櫎绌鸿涔嬪悗鐨勬暟鎹 (鍙拡瀵逛簬鏈�鍚庢暟鎹」鏈夌┖琛岀殑)
+ if (rowCount - rowCount0 >= 1)
+ {
+ //-------------鍒ゆ柇蹇呭~椤规槸鍚︿负绌�----------------//
+ //寰幆鏁版嵁琛�
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ iscell = false;
+ iscellCount = 0;
+ IRow row = sheet.GetRow(i);
+ //鍒ゆ柇鏄惁鏈夌┖琛�
+ if (row == null)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (i + 1).ToString();
+ erro.ErrorField = "绌鸿";
+ erro.ErrorCont = "绌鸿";
+ list.Add(erro);
+ continue;
+ }
+ //鍒ゆ柇鏄惁瀛樺湪绌烘暟鎹
+ for (int c = 0; c < cellCount; c++)
+ {
+ if (GetCellValue(row.GetCell(c)).Trim() != null && GetCellValue(row.GetCell(c)).Trim() != "")
+ {
+ iscell = false;
+ }
+ else
+ {
+ iscell = true;
+ iscellCount++;
+ }
+ }
+ if (iscell == true && iscellCount == cellCount) //绌鸿
+ {
+ continue;
+ }
+ else
+ {
+ //寰幆鏍囬鍒�
+ for (int j = headerRow.FirstCellNum; j < cellCount; j++)
+ {
+ //鑾峰彇鍗曞厓鏍肩殑濉厖鑹�
+ string rgb = headerRow.Cells[j].CellStyle.FillForegroundColor.ToString();
+ if (rgb == "51") //蹇呭~椤瑰瓧娈靛垪澶村~鍏呰壊
+ {
+ if (sheet.GetRow(i) == null || sheet.GetRow(i).ToString() == "") //瀛樺湪绌鸿
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = i.ToString();
+ erro.ErrorField = "{绗�" + i.ToString() + "琛寎";
+ erro.ErrorCont = "{绗�" + i.ToString() + "}琛屼负绌�";
+ list.Add(erro);
+ break;
+ }
+ else
+ {
+ string cellValue = GetCellValue(sheet.GetRow(i).GetCell(j)).Trim(); //GetCell:杩斿洖鍖呮嫭绌哄垪鍊� Cells:鍙繑鍥炴湁鍊肩殑鍒�
+ if (cellValue == "" || cellValue == null)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (sheet.GetRow(i).RowNum + 1).ToString();
+ erro.ErrorField = "{" + headerRow.Cells[j].StringCellValue + "}";
+ erro.ErrorCont = mm == 0 ? "涓昏〃涓細" + "{" + headerRow.Cells[j].StringCellValue + "}瀛楁涓嶈兘涓虹┖" : "瀛愯〃涓細" + "{" + headerRow.Cells[j].StringCellValue + "}瀛楁涓嶈兘涓虹┖";
+ list.Add(erro);
+ }
+ }
+ }
+
+ }
+ }
+ }
+ //-------------鍒ゆ柇鍞竴椤规槸鍚﹂噸澶�----------------//
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ DataView view = new DataView(table);
+ //鑾峰彇鎵�鏈夊敮涓�鍒�
+ List<string> list0 = new List<string>();
+ //寰幆鏍囬鍒�
+ for (int j = headerRow.FirstCellNum; j < cellCount; j++)
+ {
+ bool isContain = headerRow.Cells[j].StringCellValue.Contains("鍞竴"); //鏍囬鍒椾腑鐨勫繀濉垪
+ if (isContain == true)
+ {
+ //
+ if (view.ToTable(true, new string[] { "" + headerRow.Cells[j].StringCellValue + "" }).Rows.Count < table.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{" + headerRow.Cells[j].StringCellValue + "}";
+ erro.ErrorCont = mm == 0 ? "涓昏〃涓細" + "{" + headerRow.Cells[j].StringCellValue + "}瀛楁鏈夐噸澶嶆暟鎹�" : "瀛愯〃涓細" + "{" + headerRow.Cells[j].StringCellValue + "}瀛楁鏈夐噸澶嶆暟鎹�";
+ list.Add(erro);
+ }
+ }
+ }
+ }
+ }
+ List<ExcelErro> stuList = list.OrderBy(s => s.RoeNumber).ToList<ExcelErro>();
+ return list;
+ }
+
+
+
+
+
+
+
+ #region銆愭暟鎹噺楠岃瘉銆�
+ public static ToMessage ExcelCheckCountSum(string file)
+ {
+ IWorkbook Workbook;
+ try
+ {
+ using (FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read))
+ {
+ //XSSFWorkbook 閫傜敤XLSX鏍煎紡锛孒SSFWorkbook 閫傜敤XLS鏍煎紡
+ string fileExt = Path.GetExtension(file).ToLower();
+ if (fileExt == ".xls")
+ {
+ Workbook = new HSSFWorkbook(fileStream);
+ }
+ else if (fileExt == ".xlsx")
+ {
+ Workbook = new XSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Workbook = null;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ int count = Workbook.NumberOfSheets; //鑾峰彇鎵�鏈塖heetName
+ if (count < 2)
+ {
+ DataTable table = new DataTable();
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(0);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ int cellCount = headerRow.LastCellNum;
+ int rowCount = sheet.LastRowNum;
+
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j] != null)
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ }
+ }
+ if (table.Rows.Count <= 0)
+ {
+
+ mes.code = "300";
+ mes.message = "鏂囦欢鏁版嵁涓嶈兘涓虹┖锛�";
+
+ }
+ }
+ else
+ {
+ for (int m = 0; m < 2; m++)
+ {
+ DataTable table = new DataTable();
+ //瀹氫綅鍦ㄧ涓�涓猻heet
+ ISheet sheet = Workbook.GetSheetAt(m);
+ //绗竴琛屼负鏍囬琛�
+ IRow headerRow = sheet.GetRow(0);
+ int cellCount = headerRow.LastCellNum;
+ int rowCount = sheet.LastRowNum;
+
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j] != null)
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ }
+ }
+ if (table.Rows.Count <= 0)
+ {
+ mes.code = "300";
+ mes.message = "涓诲瓙琛ㄦ枃浠朵腑鏁版嵁涓嶈兘涓虹┖锛�";
+ }
+ }
+ }
+ return mes;
+ }
+
+ #endregion
+
+
+ #region銆愬幓闄ょ┖琛屽悗鑾峰彇琛屾暟銆�
+ public static int Rownum(IRow headerRow, int cellCount, ISheet sheet, int rowCount)
+ {
+ DataTable table = new DataTable();
+ //寰幆娣诲姞鏍囬鍒�
+ for (int i = headerRow.FirstCellNum; i < cellCount; i++)
+ {
+ DataColumn column = new DataColumn(headerRow.GetCell(i).StringCellValue);
+ table.Columns.Add(column);
+ }
+
+ //鏁版嵁
+ for (int i = (sheet.FirstRowNum + 1); i <= rowCount; i++)
+ {
+ IRow row = sheet.GetRow(i);
+ DataRow dataRow = table.NewRow();
+ if (row != null)
+ {
+ for (int j = row.FirstCellNum; j < cellCount; j++)
+ {
+ if (row.GetCell(j) != null)
+ {
+ dataRow[j] = GetCellValue(row.GetCell(j)).Trim();
+ }
+ }
+ }
+ table.Rows.Add(dataRow);
+ }
+ //娓呴櫎鏈�鍚庣殑绌鸿
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+ bool isnull = true;
+ for (int j = 0; j < table.Columns.Count; j++)
+ {
+ if (table.Rows[i][j].ToString() != null && table.Rows[i][j].ToString() != "")
+ {
+ if (table.Rows[i][j].ToString().Trim() != "" && table.Rows[i][j].ToString().Trim() != null)
+ {
+ isnull = false;
+ break;
+ }
+ }
+ }
+ if (isnull)
+ {
+ table.Rows[i].Delete();
+ i = 0;
+ }
+ }
+ return table.Rows.Count;
+ }
+ #endregion
+
+
+ #region
+ public static List<ExcelErro> InportExcelToTableListErro(List<DataTable> excelTable)
+ {
+ List<ExcelErro> list = new List<ExcelErro>();
+ for (int i = 0; i < excelTable.Count; i++)
+ {
+ var emptyColumn = excelTable[i].Columns.Cast<DataColumn>().FirstOrDefault(
+ column => column.ColumnName.Contains("*") && excelTable[i].AsEnumerable().Any(row => row.IsNull(column))
+ );
+
+ if (emptyColumn != null)
+ {
+ int columnIndex = excelTable[i].Columns.IndexOf(emptyColumn);
+ int rowIndex = excelTable[i].AsEnumerable().ToList().FindIndex(row => row.IsNull(emptyColumn));
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (rowIndex + 1).ToString();
+ erro.ErrorField = emptyColumn.ColumnName;
+ erro.ErrorCont = "妯℃澘琛ㄥご甯�*鐨勫垪涓瓨鍦ㄧ┖鍊�,绗�" + (rowIndex + 1).ToString() + "琛�,蹇呭~瀛楁锛�" + emptyColumn.ColumnName + "涓虹┖";
+ list.Add(erro);
+ }
+ if (excelTable[i].Columns.Cast<DataColumn>().Any(column => column.ColumnName.Contains("M")))
+ {
+ // 鍏堟寜鐓у垪鍚嶅寘鍚�"M"鏍囪瘑鐨勫垪鍒嗙粍
+ var mColumns = excelTable[i].Columns.Cast<DataColumn>()
+ .Where(c => c.ColumnName.Contains("M"))
+ .ToList();
+
+ var groups = excelTable[i].AsEnumerable()
+ .GroupBy(r => string.Join("-", mColumns.Select(c => r[c])));
+
+ foreach (var group in groups)
+ {
+ // 鍒ゆ柇鍒楀悕鍖呭惈"鍞竴"鏍囪瘑鐨勫垪鐨勫垪鍊兼槸鍚﹂噸澶�
+ var uniqueColumnName = excelTable[i].Columns.Cast<DataColumn>()
+ .Where(c => c.ColumnName.Contains("鍞竴"))
+ .Select(c => c.ColumnName)
+ .FirstOrDefault();
+
+ var duplicateUniqueValues = group
+ .GroupBy(r => r[uniqueColumnName])
+ .Where(g => g.Count() > 1)
+ .Select(g => g.Key);
+
+ foreach (var value in duplicateUniqueValues)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = mColumns[0].ToString();
+ erro.ErrorCont = "妯℃澘琛ㄥご瀛楁銆�"+ mColumns[0].ToString() + "銆戜笅鐨勫��:"+ group.Key + ",瀵瑰簲甯�(鍞竴)鐨勫垪涓瓨鍦ㄩ噸澶嶅�间负锛�"+value+"";
+ list.Add(erro);
+ }
+ }
+ }
+ else
+ {
+ var duplicateColumn = excelTable[i].Columns.Cast<DataColumn>().FirstOrDefault(
+ column => column.ColumnName.Contains("鍞竴") && excelTable[i].AsEnumerable().GroupBy(row => row[column]).Any(group => group.Count() > 1));
+ if (duplicateColumn != null)
+ {
+ int columnIndex = excelTable[i].Columns.IndexOf(duplicateColumn);
+ var duplicateRows = excelTable[i].AsEnumerable()
+ .Where(row => row[duplicateColumn] != DBNull.Value)
+ .GroupBy(row => row[duplicateColumn])
+ .Where(group => group.Count() > 1)
+ .SelectMany(group => group.ToList())
+ .ToList();
+ foreach (var row in duplicateRows)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = excelTable[i].Rows.IndexOf(row).ToString();
+ erro.ErrorField = duplicateColumn.ColumnName;
+ erro.ErrorCont = "妯℃澘琛ㄥご甯�(鍞竴)鐨勫垪涓瓨鍦ㄩ噸澶嶅��,绗�" + excelTable[i].Rows.IndexOf(row).ToString() + "琛�,蹇呭~瀛楁锛�" + duplicateColumn.ColumnName + "閲嶅";
+ list.Add(erro);
+
+ }
+ }
+ }
+
+
+ }
+ return list;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/ImportExcelData.cs b/VueWebCoreApi/Tools/ImportExcelData.cs
new file mode 100644
index 0000000..dfd3291
--- /dev/null
+++ b/VueWebCoreApi/Tools/ImportExcelData.cs
@@ -0,0 +1,6276 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class ImportExcelData
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉銆�
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,缁勭粐鏋舵瀯妯℃澘銆�
+ public static string Zerro(string FileCode, out string code)
+ {
+ string Message = "";
+ code = "";
+ List<DataTable> excelTable = new List<DataTable>();
+ excelTable = ImportExcel.ExcelToTableList(FileCode);
+
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,宀椾綅绠$悊妯℃澘銆�
+ public static string One(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 4)
+ {
+ code = "301";
+ Message = "宀椾綅娓呭崟妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*宀椾綅缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "宀椾綅娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*宀椾綅缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*宀椾綅鍚嶇О")
+ {
+ code = "301";
+ Message = "宀椾綅娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*宀椾綅鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "宀椾綅娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "鎻忚堪")
+ {
+ code = "301";
+ Message = "宀椾綅娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,鐝粍绠$悊妯℃澘銆�
+ public static string Two(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 4)
+ {
+ code = "301";
+ Message = "鐝粍娓呭崟妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*鐝粍缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "鐝粍娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*鐝粍缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*鐝粍鍚嶇О")
+ {
+ code = "301";
+ Message = "鐝粍娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*鐝粍鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "鐝粍娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "鎻忚堪")
+ {
+ code = "301";
+ Message = "鐝粍娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,浜哄憳绠$悊妯℃澘銆�
+ public static string Three(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 11)
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*鐢ㄦ埛缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*鐢ㄦ埛缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*鐢ㄦ埛濮撳悕")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*鐢ㄦ埛濮撳悕}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*瀵嗙爜")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*瀵嗙爜}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "*钖祫绫诲瀷")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*钖祫绫诲瀷}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "*鍦ㄨ亴鐘舵��")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕*鍦ㄨ亴鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[5].ColumnName != "鎵嬫満鍙�")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�6鍒楀簲涓簕鎵嬫満鍙穧";
+ return Message;
+ }
+ else if (excelTable[0].Columns[6].ColumnName != "閭")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�7鍒楀簲涓簕閭}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[7].ColumnName != "*鎵�灞炵粍缁囩紪鐮�")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�8鍒楀簲涓簕*鎵�灞炵粍缁囩紪鐮亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[8].ColumnName != "鎵�灞炲矖浣嶇紪鐮�")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�9鍒楀簲涓簕鎵�灞炲矖浣嶇紪鐮亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[9].ColumnName != "鎵�灞炶鑹茬紪鐮�")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�10鍒楀簲涓簕鎵�灞炶鑹茬紪鐮亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[10].ColumnName != "鎵�灞炵彮缁勭紪鐮�")
+ {
+ code = "301";
+ Message = "鐢ㄦ埛娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�11鍒楀簲涓簕鎵�灞炵彮缁勭紪鐮亇";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,瑙掕壊绠″崟妯℃澘銆�
+ public static string Four(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 4)
+ {
+ code = "301";
+ Message = "瑙掕壊娓呭崟妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*瑙掕壊缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "瑙掕壊娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*瑙掕壊缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*瑙掕壊鍚嶇О")
+ {
+ code = "301";
+ Message = "瑙掕壊娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*瑙掕壊鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "瑙掕壊娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "鎻忚堪")
+ {
+ code = "301";
+ Message = "瑙掕壊娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,寰�鏉ュ崟浣嶆ā鏉裤��
+ public static string Five(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 3)
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶇被鍨嬫ā鏉夸笉绗﹀悎瑙勮寖,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[1].Columns.Count != 7)
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶆ā鏉夸笉绗﹀悎瑙勮寖,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶇被鍨嬫ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�1鍒楀簲涓簕*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*寰�鏉ュ崟浣嶇被鍨嬪悕绉�")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶇被鍨嬫ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�2鍒楀簲涓簕*寰�鏉ュ崟浣嶇被鍨嬪悕绉皚";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "涓婄骇缂栫爜")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶇被鍨嬫ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�3鍒楀簲涓簕涓婄骇缂栫爜}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "*寰�鏉ュ崟浣嶇紪鍙�(鍞竴)")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶆ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�1鍒楀簲涓簕*寰�鏉ュ崟浣嶇紪鍙�(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "*寰�鏉ュ崟浣嶅悕绉�")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶆ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�2鍒楀簲涓簕*寰�鏉ュ崟浣嶅悕绉皚";
+ return Message;
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶆ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�3鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "*寰�鏉ュ崟浣嶇被鍨嬬紪鐮�")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶆ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�4鍒楀簲涓簕*寰�鏉ュ崟浣嶇被鍨嬬紪鐮亇";
+ return Message;
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "鑱旂郴浜�")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶆ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�5鍒楀簲涓簕鑱旂郴浜簘";
+ return Message;
+ }
+ else if (excelTable[1].Columns[5].ColumnName != "鑱旂郴鏂瑰紡")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶆ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�6鍒楀簲涓簕鑱旂郴浜簘";
+ return Message;
+ }
+ else if (excelTable[1].Columns[6].ColumnName != "鍦板潃")
+ {
+ code = "301";
+ Message = "寰�鏉ュ崟浣嶆ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�7鍒楀簲涓簕鍦板潃}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,浠撳簱璁剧疆妯℃澘銆�
+ public static string Six(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 5)
+ {
+ code = "301";
+ Message = "浠撳簱璁剧疆妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*浠撳簱缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "浠撳簱璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*浠撳簱缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*浠撳簱鍚嶇О")
+ {
+ code = "301";
+ Message = "浠撳簱璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*浠撳簱鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "浠撳簱璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "*搴撲綅绠$悊")
+ {
+ code = "301";
+ Message = "浠撳簱璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*搴撲綅绠$悊}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "鎻忚堪")
+ {
+ code = "301";
+ Message = "浠撳簱璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,搴撲綅璁剧疆妯℃澘銆�
+ public static string Seven(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 6)
+ {
+ code = "301";
+ Message = "搴撲綅璁剧疆妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*搴撲綅缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "搴撲綅璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*搴撲綅缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*搴撲綅鍚嶇О")
+ {
+ code = "301";
+ Message = "搴撲綅璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*搴撲綅鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鎵�灞炰粨搴撶紪鐮�")
+ {
+ code = "301";
+ Message = "搴撲綅璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鎵�灞炰粨搴撶紪鐮亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "涓婄骇搴撲綅缂栫爜")
+ {
+ code = "301";
+ Message = "搴撲綅璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕涓婄骇搴撲綅缂栫爜}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "搴撲綅璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[5].ColumnName != "鎻忚堪")
+ {
+ code = "301";
+ Message = "搴撲綅璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�6鍒楀簲涓簕鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,瀛樿揣妗f妯℃澘銆�
+ public static string Eight(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 3)
+ {
+ code = "301";
+ Message = "瀛樿揣鍒嗙被妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[1].Columns.Count != 13)
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*瀛樿揣鍒嗙被缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "瀛樿揣鍒嗙被鍨嬫ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�1鍒楀簲涓簕*瀛樿揣鍒嗙被缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*瀛樿揣鍒嗙被鍚嶇О")
+ {
+ code = "301";
+ Message = "瀛樿揣鍒嗙被鍨嬫ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�2鍒楀簲涓簕*瀛樿揣鍒嗙被鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "涓婄骇缂栫爜")
+ {
+ code = "301";
+ Message = "瀛樿揣鍒嗙被鍨嬫ā鏉匡細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�3鍒楀簲涓簕涓婄骇缂栫爜}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "*瀛樿揣缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*瀛樿揣缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "*瀛樿揣鍚嶇О")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*瀛樿揣鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "瑙勬牸鍨嬪彿")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕瑙勬牸鍨嬪彿}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "*瀛樿揣鍒嗙被缂栫爜")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*瀛樿揣鍒嗙被缂栫爜}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[1].Columns[5].ColumnName != "*璁¢噺鏂瑰紡")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�6鍒楀簲涓簕*璁¢噺鏂瑰紡}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[6].ColumnName != "*璁¢噺鍗曚綅/缁勫悕绉�")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�7鍒楀簲涓簕*璁¢噺鍗曚綅/缁勫悕绉皚";
+ return Message;
+ }
+ else if (excelTable[1].Columns[7].ColumnName != "鎵�灞炰粨搴撶紪鐮�")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�8鍒楀簲涓簕鎵�灞炰粨搴撶紪鐮亇";
+ return Message;
+ }
+ else if (excelTable[1].Columns[8].ColumnName != "鏄惁澶栬喘")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�9鍒楀簲涓簕鏄惁澶栬喘}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[9].ColumnName != "鏄惁閿�鍞�")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�10鍒楀簲涓簕鏄惁閿�鍞畗";
+ return Message;
+ }
+ else if (excelTable[1].Columns[10].ColumnName != "鏄惁鑷埗")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�11鍒楀簲涓簕鏄惁鑷埗}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[11].ColumnName != "鏄惁鐢熶骇娑堣��")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�12鍒楀簲涓簕鏄惁鐢熶骇娑堣�梷";
+ return Message;
+ }
+ else if (excelTable[1].Columns[12].ColumnName != "鏄惁濮斿")
+ {
+ code = "301";
+ Message = "瀛樿揣妗f妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�13鍒楀簲涓簕鏄惁濮斿}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,璁惧娓呭崟妯℃澘銆�
+ public static string Nine(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 3)
+ {
+ code = "301";
+ Message = "璁惧绫诲瀷妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[1].Columns.Count != 5)
+ {
+ code = "301";
+ Message = "璁惧娓呭崟妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*璁惧绫诲瀷缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "璁惧绫诲瀷妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*璁惧绫诲瀷缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*璁惧绫诲瀷鍚嶇О")
+ {
+ code = "301";
+ Message = "璁惧绫诲瀷妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*璁惧绫诲瀷鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "鎻忚堪")
+ {
+ code = "301";
+ Message = "璁惧绫诲瀷妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕鎻忚堪}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "*璁惧缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "璁惧娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*璁惧缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "*璁惧鍚嶇О")
+ {
+ code = "301";
+ Message = "璁惧娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*璁惧鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "*鎵�灞炵粍缁囩紪鐮�")
+ {
+ code = "301";
+ Message = "璁惧娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鎵�灞炵粍缁囩紪鐮亇";
+ return Message;
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "*璁惧绫诲瀷缂栫爜")
+ {
+ code = "301";
+ Message = "璁惧娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*璁惧绫诲瀷缂栫爜}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "璁惧娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,璁惧鐐规椤圭洰妯℃澘銆�
+ public static string Ten(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 5)
+ {
+ code = "301";
+ Message = "璁惧鐐规椤圭洰妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*鐐规椤圭洰缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "璁惧鐐规椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*鐐规椤圭洰缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*鐐规椤圭洰鍚嶇О")
+ {
+ code = "301";
+ Message = "璁惧鐐规椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*鐐规椤圭洰鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鐐规鍛ㄦ湡")
+ {
+ code = "301";
+ Message = "璁惧鐐规椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鐐规鍛ㄦ湡}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "*鏄惁鎵爜")
+ {
+ code = "301";
+ Message = "璁惧鐐规椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鏄惁鎵爜}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "鐐规椤圭洰瑕佹眰")
+ {
+ code = "301";
+ Message = "璁惧鐐规椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕鐐规椤圭洰瑕佹眰}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,璁惧鐐规鏍囧噯妯℃澘銆�
+ public static string Ten_one(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "300";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 4)
+ {
+ code = "300";
+ Message = "璁惧鐐规鏍囧噯椤电妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[1].Columns.Count != 7)
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*璁惧鐐规鏍囧噯缂栧彿(鍞竴)")
+ {
+ code = "300";
+ Message = "璁惧鐐规鏍囧噯椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*璁惧鐐规鏍囧噯缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*璁惧鐐规鏍囧噯鍚嶇О")
+ {
+ code = "300";
+ Message = "璁惧鐐规鏍囧噯椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*璁惧鐐规鏍囧噯鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鐐规绠℃帶")
+ {
+ code = "300";
+ Message = "璁惧鐐规鏍囧噯椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鐐规绠℃帶}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "鏍囧噯鎻忚堪")
+ {
+ code = "300";
+ Message = "璁惧鐐规鏍囧噯椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕鏍囧噯鎻忚堪}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "*璁惧鐐规鏍囧噯缂栧彿(M)")
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*璁惧鐐规鏍囧噯缂栧彿(M)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "*鐐规椤瑰簭鍙�")
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*鐐规椤瑰簭鍙穧";
+ return Message;
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "*璁惧鐐规閮ㄤ綅缂栧彿(鍞竴)")
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*璁惧鐐规閮ㄤ綅缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "*璁惧鐐规閮ㄤ綅鍚嶇О")
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*璁惧鐐规閮ㄤ綅鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "鐐规閮ㄤ綅瑕佹眰")
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕鐐规閮ㄤ綅瑕佹眰}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[5].ColumnName != "*閫夋嫨鎵爜")
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�6鍒楀簲涓簕*閫夋嫨鎵爜}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[6].ColumnName != "*鐐规鍛ㄦ湡")
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�7鍒楀簲涓簕*鐐规鍛ㄦ湡}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,璁惧淇濆吇椤圭洰妯℃澘銆�
+ public static string Eleven(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "300";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 4)
+ {
+ code = "300";
+ Message = "璁惧淇濆吇椤圭洰妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*淇濆吇椤圭洰缂栧彿(鍞竴)")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇椤圭洰妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�1鍒楀簲涓簕*淇濆吇椤圭洰缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*淇濆吇椤圭洰鍚嶇О")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇椤圭洰妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�2鍒楀簲涓簕*淇濆吇椤圭洰鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鏄惁鎵爜")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇椤圭洰妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�3鍒楀簲涓簕*鏄惁鎵爜}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "淇濆吇椤圭洰瑕佹眰")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇椤圭洰妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�4鍒楀簲涓簕淇濆吇椤圭洰瑕佹眰}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,璁惧淇濆吇鏍囧噯妯℃澘銆�
+ public static string Eleven_one(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "300";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 4)
+ {
+ code = "300";
+ Message = "璁惧淇濆吇鏍囧噯椤电妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[1].Columns.Count != 6)
+ {
+ code = "300";
+ Message = "璁惧淇濆吇閮ㄤ綅椤电妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇鏍囧噯椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*璁惧淇濆吇鏍囧噯鍚嶇О")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇鏍囧噯椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*璁惧淇濆吇鏍囧噯鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*淇濆吇鍛ㄦ湡")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇鏍囧噯椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*淇濆吇鍛ㄦ湡}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "鏍囧噯鎻忚堪")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇鏍囧噯椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕鏍囧噯鎻忚堪}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "*璁惧淇濆吇鏍囧噯缂栧彿(M)")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*璁惧淇濆吇鏍囧噯缂栧彿(M)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "*淇濆吇椤瑰簭鍙�")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*淇濆吇椤瑰簭鍙穧";
+ return Message;
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "*璁惧淇濆吇閮ㄤ綅缂栧彿(鍞竴)")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*璁惧淇濆吇閮ㄤ綅缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "*璁惧淇濆吇閮ㄤ綅鍚嶇О")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*璁惧淇濆吇閮ㄤ綅鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "淇濆吇閮ㄤ綅瑕佹眰")
+ {
+ code = "300";
+ Message = "璁惧淇濆吇閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕淇濆吇閮ㄤ綅瑕佹眰}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[5].ColumnName != "*閫夋嫨鎵爜")
+ {
+ code = "300";
+ Message = "璁惧鐐规閮ㄤ綅椤电妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�6鍒楀簲涓簕*閫夋嫨鎵爜}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,妯″叿娓呭崟妯℃澘銆�
+ public static string Twelve(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ if (excelTable[1].Rows.Count > 0)
+ {
+ if (excelTable[1].Columns.Count != 2)
+ {
+ code = "301";
+ Message = "妯″叿鍏宠仈浜у搧妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "妯″叿缂栫爜")
+ {
+ code = "301";
+ Message = "妯″叿鍏宠仈浜у搧妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕妯″叿缂栫爜}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "浜у搧缂栫爜")
+ {
+ code = "301";
+ Message = "妯″叿鍏宠仈浜у搧妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕浜у搧缂栫爜}";
+ return Message;
+ }
+ }
+ else if (excelTable[0].Columns.Count != 8)
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*妯″叿缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*妯″叿缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*妯″叿鍚嶇О")
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*妯″叿鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "瑙勬牸鍨嬪彿")
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕瑙勬牸鍨嬪彿}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "*浠撳簱缂栫爜")
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕*浠撳簱缂栫爜}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[5].ColumnName != "*搴撲綅缂栫爜")
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�6鍒楀簲涓簕*搴撲綅缂栫爜}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[6].ColumnName != "棰勮瀵垮懡(娆�)")
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�7鍒楀簲涓簕棰勮瀵垮懡(娆�)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[7].ColumnName != "鍓╀綑瀵垮懡(娆�)")
+ {
+ code = "301";
+ Message = "妯″叿娓呭崟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�8鍒楀簲涓簕鍓╀綑瀵垮懡(娆�)}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,妯″叿鐐规椤规ā鏉裤��
+ public static string Thirteen(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 3)
+ {
+ code = "301";
+ Message = "妯″叿鐐规椤圭洰妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*鐐规椤圭洰缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "妯″叿鐐规椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*鐐规椤圭洰缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*鐐规椤圭洰鍚嶇О")
+ {
+ code = "301";
+ Message = "妯″叿鐐规椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*鐐规椤圭洰鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "瑕佹眰鎻忚堪")
+ {
+ code = "301";
+ Message = "妯″叿鐐规椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕瑕佹眰鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,妯″叿鐐规鏍囧噯妯℃澘銆�
+ public static string Thirteen_one(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 3)
+ {
+ code = "301";
+ Message = "妯″叿鐐规鏍囧噯妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[1].Columns.Count != 5)
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿鐐规閮ㄤ綅妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*妯″叿鐐规鏍囧噯缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "妯″叿鐐规鏍囧噯妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*妯″叿鐐规鏍囧噯缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*妯″叿鐐规鏍囧噯鍚嶇О")
+ {
+ code = "301";
+ Message = "妯″叿鐐规鏍囧噯妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*妯″叿鐐规鏍囧噯鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "鏍囧噯鎻忚堪")
+ {
+ code = "301";
+ Message = "妯″叿鐐规鏍囧噯妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕鏍囧噯鎻忚堪}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "*妯″叿鐐规鏍囧噯缂栧彿(M)")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿鐐规閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*妯″叿鐐规鏍囧噯缂栧彿(M)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "*鐐规椤瑰簭鍙�")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿鐐规閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*鐐规椤瑰簭鍙穧";
+ return Message;
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "*妯″叿鐐规椤圭紪鍙�(鍞竴)")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿鐐规閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*妯″叿鐐规椤圭紪鍙�(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "*妯″叿鐐规椤瑰悕绉�")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿鐐规閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*妯″叿鐐规椤瑰悕绉皚";
+ return Message;
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "鐐规椤硅姹�")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿鐐规閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕鐐规椤硅姹倉";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,妯″叿淇濆吇椤规ā鏉裤��
+ public static string Fourteen(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 3)
+ {
+ code = "301";
+ Message = "妯″叿淇濆吇椤圭洰妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*淇濆吇椤圭洰缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "妯″叿淇濆吇椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*淇濆吇椤圭洰缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*淇濆吇椤圭洰鍚嶇О")
+ {
+ code = "301";
+ Message = "妯″叿淇濆吇椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*淇濆吇椤圭洰鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "瑕佹眰鎻忚堪")
+ {
+ code = "301";
+ Message = "妯″叿淇濆吇椤圭洰妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕瑕佹眰鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,妯″叿淇濆吇鏍囧噯妯℃澘銆�
+ public static string Fourteen_one(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 3)
+ {
+ code = "301";
+ Message = "妯″叿淇濆吇鏍囧噯妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[1].Columns.Count != 5)
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿淇濆吇閮ㄤ綅妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*妯″叿淇濆吇鏍囧噯缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "妯″叿淇濆吇鏍囧噯妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*妯″叿淇濆吇鏍囧噯缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*妯″叿淇濆吇鏍囧噯鍚嶇О")
+ {
+ code = "301";
+ Message = "妯″叿淇濆吇鏍囧噯妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*妯″叿淇濆吇鏍囧噯鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "鏍囧噯鎻忚堪")
+ {
+ code = "301";
+ Message = "妯″叿淇濆吇鏍囧噯妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕鏍囧噯鎻忚堪}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "*妯″叿淇濆吇鏍囧噯缂栧彿(M)")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿淇濆吇閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*妯″叿淇濆吇鏍囧噯缂栧彿(M)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "*淇濆吇椤瑰簭鍙�")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿淇濆吇閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*淇濆吇椤瑰簭鍙穧";
+ return Message;
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "*妯″叿淇濆吇椤圭紪鍙�(鍞竴)")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿淇濆吇閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*妯″叿淇濆吇椤圭紪鍙�(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "*妯″叿淇濆吇椤瑰悕绉�")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿淇濆吇閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕*妯″叿淇濆吇椤瑰悕绉皚";
+ return Message;
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "淇濆吇椤硅姹�")
+ {
+ code = "301";
+ Message = "鍏宠仈妯″叿淇濆吇閮ㄤ綅妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕淇濆吇椤硅姹倉";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,宸ュ簭瀹氫箟妯℃澘銆�
+ public static string Fifteen(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 5)
+ {
+ code = "301";
+ Message = "宸ュ簭璁剧疆妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*宸ュ簭缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "宸ュ簭璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*宸ュ簭缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*宸ュ簭鍚嶇О")
+ {
+ code = "301";
+ Message = "宸ュ簭璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*宸ュ簭鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*宸ュ簭绫诲瀷")
+ {
+ code = "301";
+ Message = "宸ュ簭璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*宸ュ簭绫诲瀷}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "宸ュ簭璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "鎻忚堪")
+ {
+ code = "301";
+ Message = "宸ュ簭璁剧疆妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,宸ヨ壓璺嚎妯℃澘銆�
+ public static string Sixteen(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 2)
+ {
+ code = "301";
+ Message = "妯℃澘涓嶇鍚堣鑼�,缂哄け鐨凷heet";
+ }
+ else if (excelTable[0].Columns.Count != 4)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘(宸ヨ壓璺嚎)涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ }
+ else if (excelTable[1].Columns.Count != 5)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘(鍏宠仈宸ヨ壓)涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*宸ヨ壓璺嚎缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "宸ヨ壓璺嚎妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*宸ヨ壓璺嚎缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*宸ヨ壓璺嚎鍚嶇О")
+ {
+ code = "301";
+ Message = "宸ヨ壓璺嚎妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*宸ヨ壓璺嚎鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "*鐘舵��")
+ {
+ code = "301";
+ Message = "宸ヨ壓璺嚎妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕*鐘舵�亇";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "鎻忚堪")
+ {
+ code = "301";
+ Message = "宸ヨ壓璺嚎妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕鎻忚堪}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "*宸ヨ壓璺嚎缂栧彿")
+ {
+ code = "301";
+ Message = "鍏宠仈宸ヨ壓妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*宸ヨ壓璺嚎缂栧彿}";
+ return Message;
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "*宸ュ簭缂栧彿")
+ {
+ code = "301";
+ Message = "鍏宠仈宸ヨ壓妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*宸ュ簭缂栧彿}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,鑺傛媿宸ヤ环妯℃澘銆�
+ public static string TwentyFour(string FileCode, out string code)
+ {
+ string Message = "";
+ code = "";
+ List<DataTable> excelTable = new List<DataTable>();
+ excelTable = ImportExcel.ExcelToTableList(FileCode);
+ if (excelTable.Count != 2)
+ {
+ code = "300";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 9)
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "搴忓彿")
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�1鍒楀簲涓簕搴忓彿}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "浜у搧鍚嶇О")
+ {
+ code = "300";
+ Message = "浜у搧鍚嶇О妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�2鍒楀簲涓簕浜у搧鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "宸ヨ壓璺嚎鍚嶇О")
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�3鍒楀簲涓簕宸ヨ壓璺嚎鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "宸ュ簭鍚嶇О")
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�4鍒楀簲涓簕宸ュ簭鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "璁惧鍚嶇О")
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�4鍒楀簲涓簕璁惧鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[5].ColumnName != "璁′欢鍗曚环")
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�4鍒楀簲涓簕璁′欢鍗曚环}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[6].ColumnName != "璁惧鑺傛媿")
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�4鍒楀簲涓簕璁惧鑺傛媿}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[7].ColumnName != "鐢熶骇鑺傛媿")
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�4鍒楀簲涓簕鐢熶骇鑺傛媿}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[8].ColumnName != "鍨嬭厰鏁�")
+ {
+ code = "300";
+ Message = "鑺傛媿宸ヤ环妯℃澘涓嶇鍚堣鑼冿細琛ㄥご淇℃伅涓嶇鍚堣鑼�,绗�4鍒楀簲涓簕鍨嬭厰鏁皚";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,璐ㄦ鏍囧噯妯℃澘銆�
+ public static string Seventeen(string FileCode, out string code)
+ {
+ string Message = "";
+ code = "";
+ List<DataTable> excelTable = new List<DataTable>();
+ excelTable = ImportExcel.ExcelToTableList(FileCode);
+ if (excelTable.Count != 2)
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,缂哄け鐨凷heet";
+ }
+ else if (excelTable[0].Columns.Count != 8)
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ }
+ else if (excelTable[1].Columns.Count != 9)
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "搴忓彿")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "鐗╂枡缂栫爜")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "鐗╂枡鍚嶇О")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "妫�楠岀被鍨�")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "宸ヨ壓璺嚎")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[0].Columns[5].ColumnName != "宸ュ簭缂栫爜")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[0].Columns[6].ColumnName != "宸ュ簭鍚嶇О")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[0].Columns[7].ColumnName != "娴佺▼绠℃帶")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "搴忓彿")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "涓昏〃搴忓垪鍙�")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "鎺掑垪椤哄簭")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "妫�楠岄」鐩�")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "閲嶈搴�")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[5].ColumnName != "妫�楠屽伐鍏�")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[6].ColumnName != "鏍囧噯瑕佹眰")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[7].ColumnName != "涓嬮檺鍊�")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable[1].Columns[8].ColumnName != "涓婇檺鍊�")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,缂洪櫡瀹氫箟妯℃澘銆�
+ public static string Eighteen(List<DataTable> excelTable, out string code)
+ {
+ string Message = "";
+ code = "";
+ if (excelTable.Count != 1)
+ {
+ code = "301";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ return Message;
+
+ }
+ else if (excelTable[0].Columns.Count != 3)
+ {
+ code = "301";
+ Message = "缂洪櫡瀹氫箟妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ return Message;
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "*缂洪櫡缂栧彿(鍞竴)")
+ {
+ code = "301";
+ Message = "缂洪櫡瀹氫箟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕*缂洪櫡缂栧彿(鍞竴)}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "*缂洪櫡鍚嶇О")
+ {
+ code = "301";
+ Message = "缂洪櫡瀹氫箟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕*缂洪櫡鍚嶇О}";
+ return Message;
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "缂洪櫡鎻忚堪")
+ {
+ code = "301";
+ Message = "缂洪櫡瀹氫箟妯℃澘锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕缂洪櫡鎻忚堪}";
+ return Message;
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,鐢熶骇璁㈠崟妯℃澘銆�
+ public static string Nineteen(string FileCode, out string code)
+ {
+ string Message = "";
+ code = "";
+ DataTable excelTable = new DataTable();
+ excelTable = ImportExcel.ExcelToTable(FileCode);
+ if (excelTable.Columns.Count != 7)
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[0].ColumnName != "搴忓彿")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[1].ColumnName != "浜у搧缂栫爜")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[2].ColumnName != "浜у搧鍚嶇О")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[3].ColumnName != "浜у搧瑙勬牸")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[4].ColumnName != "璁㈠崟鏁伴噺")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[5].ColumnName != "瑕佹眰浜や粯鏃堕棿")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[6].ColumnName != "ERP璁㈠崟鍙�")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,鐢熶骇璁㈠崟妯℃澘銆�
+ public static string Twenty(string FileCode, out string code)
+ {
+ string Message = "";
+ code = "";
+ DataTable excelTable = new DataTable();
+ excelTable = ImportExcel.ExcelToTable(FileCode);
+ if (excelTable.Columns.Count != 10)
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[0].ColumnName != "搴忓彿")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[1].ColumnName != "搴撲綅缂栫爜")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[2].ColumnName != "鐗╂枡缂栫爜")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[3].ColumnName != "鐗╂枡鍚嶇О")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[4].ColumnName != "娴佺▼鍗″彿")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[5].ColumnName != "瀹瑰櫒缂栫爜")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[6].ColumnName != "鍏ュ巶鏉$爜")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[7].ColumnName != "鐐夊彿鎵规")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[8].ColumnName != "渚涙柟鍚嶇О")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else if (excelTable.Columns[9].ColumnName != "褰撳墠搴撳瓨")
+ {
+ code = "300";
+ Message = "妯℃澘涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚�";
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #region銆怑xcel妯℃澘涓婁紶楠岃瘉,鐗╂枡娓呭崟妯℃澘銆�
+ public static string TwentyOne(string FileCode, out string code)
+ {
+ string Message = "";
+ code = "";
+ List<DataTable> excelTable = new List<DataTable>();
+ excelTable = ImportExcel.ExcelToTableList(FileCode);
+ if (excelTable.Count != 4)
+ {
+ code = "300";
+ Message = "瀵煎叆妯℃澘涓嶇鍚堣鑼�,璇锋鏌heet鏁�";
+ }
+ else if (excelTable[0].Columns.Count != 6)
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(姣嶄欢淇℃伅)涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ }
+ else if (excelTable[1].Columns.Count != 10)
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢淇℃伅)涓嶇鍚堣鑼�,璇锋鏌ュ垪鍚嶅瓧娈垫暟";
+ }
+ else if (excelTable[0].Columns[0].ColumnName != "搴忓彿")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(姣嶄欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕搴忓彿}";
+ }
+ else if (excelTable[0].Columns[1].ColumnName != "姣嶄欢缂栫爜")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(姣嶄欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕姣嶄欢缂栫爜}";
+ }
+ else if (excelTable[0].Columns[2].ColumnName != "姣嶄欢鍚嶇О")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(姣嶄欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕姣嶄欢鍚嶇О}";
+ }
+ else if (excelTable[0].Columns[3].ColumnName != "鍩虹鏁伴噺")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(姣嶄欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕鍩虹鏁伴噺}";
+ }
+ else if (excelTable[0].Columns[4].ColumnName != "鍚敤鐘舵��")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(姣嶄欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕鍚敤鐘舵�亇";
+ }
+ else if (excelTable[0].Columns[5].ColumnName != "鐗堟湰鍙�")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(姣嶄欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�6鍒楀簲涓簕鐗堟湰鍙穧";
+ }
+ else if (excelTable[1].Columns[0].ColumnName != "搴忓彿")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�1鍒楀簲涓簕搴忓彿}";
+ }
+ else if (excelTable[1].Columns[1].ColumnName != "涓昏〃搴忓垪鍙�")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�2鍒楀簲涓簕涓昏〃搴忓垪鍙穧";
+ }
+ else if (excelTable[1].Columns[2].ColumnName != "瀛愪欢椤哄簭鍙�")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�3鍒楀簲涓簕瀛愪欢椤哄簭鍙穧";
+ }
+ else if (excelTable[1].Columns[3].ColumnName != "瀛愪欢缂栫爜")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�4鍒楀簲涓簕瀛愪欢缂栫爜}";
+ }
+ else if (excelTable[1].Columns[4].ColumnName != "瀛愪欢鍚嶇О")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�5鍒楀簲涓簕瀛愪欢鍚嶇О}";
+ }
+ else if (excelTable[1].Columns[5].ColumnName != "鍙戞枡浠撳簱")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�6鍒楀簲涓簕鍙戞枡浠撳簱}";
+ }
+ else if (excelTable[1].Columns[6].ColumnName != "鍩烘湰鐢ㄩ噺")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�7鍒楀簲涓簕鍩烘湰鐢ㄩ噺}";
+ }
+ else if (excelTable[1].Columns[7].ColumnName != "鎹熻�楃巼(%)")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�8鍒楀簲涓簕鎹熻�楃巼(%)}";
+ }
+ else if (excelTable[1].Columns[8].ColumnName != "瀹為檯鐢ㄩ噺")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�9鍒楀簲涓簕瀹為檯鐢ㄩ噺}";
+ }
+ else if (excelTable[1].Columns[9].ColumnName != "灞炴��")
+ {
+ code = "300";
+ Message = "鐗╂枡娓呭崟妯℃澘(瀛愪欢)锛氳〃澶翠俊鎭笉绗﹀悎瑙勮寖,绗�10鍒楀簲涓簕灞炴�";
+ }
+ else
+ {
+ code = "200";
+ Message = "妯℃澘妫�楠岄�氳繃";
+ }
+ return Message;
+ }
+ #endregion
+
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉銆�
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,缁勭粐鏋舵瀯銆�
+ public static List<ExcelErro> ZerroData(string savePath, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,宀椾綅绠$悊銆�
+ public static List<ExcelErro> OneData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //宀椾綅琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TPost where postcode=@postcode";
+ dynamicParams.Add("@postcode", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宀椾綅缂栧彿(鍞竴)}";
+ erro.ErrorCont = "宀椾綅琛�:{*宀椾綅缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TPost where postname=@postname";
+ dynamicParams.Add("@postname", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宀椾綅鍚嶇О}";
+ erro.ErrorCont = "宀椾綅琛�:{*宀椾綅鍚嶇О}瀛楁" + excelTable[0].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,鐝粍绠$悊銆�
+ public static List<ExcelErro> TwoData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //鐝粍琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TGroup where usergroupcode=@usergroupcode";
+ dynamicParams.Add("@usergroupcode", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*鐝粍缂栧彿(鍞竴)}";
+ erro.ErrorCont = "鐝粍琛�:{*鐝粍缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TGroup where usergroupname=@usergroupname";
+ dynamicParams.Add("@usergroupname", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*鐝粍鍚嶇О}";
+ erro.ErrorCont = "鐝粍琛�:{*鐝粍鍚嶇О}瀛楁" + excelTable[0].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,浜哄憳绠$悊銆�
+ public static List<ExcelErro> ThreeData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //鐢ㄦ埛琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TUser where usercode=@usercode";
+ dynamicParams.Add("@usercode", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "*鐢ㄦ埛缂栫爜(鍞竴)";
+ erro.ErrorCont = "鐢ㄦ埛琛�:*鐢ㄦ埛缂栫爜(鍞竴)瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TUser where username=@username";
+ dynamicParams.Add("@username", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "*鐢ㄦ埛鍚嶇О";
+ erro.ErrorCont = "鐢ㄦ埛琛�:*鐢ㄦ埛鍚嶇О瀛楁" + excelTable[0].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][7].ToString().Trim() != null && excelTable[0].Rows[k][7].ToString().Trim() != "")
+ {
+ sql = @"select * from TOrganization where torg_code=@torg_code";
+ dynamicParams.Add("@torg_code", excelTable[0].Rows[k][7].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt == null || dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "*缁勭粐缂栫爜";
+ erro.ErrorCont = "鐢ㄦ埛琛�:*缁勭粐缂栫爜瀛楁" + excelTable[0].Rows[k][7].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][8].ToString().Trim() != null && excelTable[0].Rows[k][8].ToString().Trim() != "")
+ {
+ string[] postcode = Array.ConvertAll<string, string>(excelTable[0].Rows[k][8].ToString().Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ sql = @"select postcode from TPost where postcode in @postcode";
+ dynamicParams.Add("@postcode", postcode);
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt != null && dt.Rows.Count > 0)
+ {
+ string[] values = excelTable[0].Rows[k][8].ToString().Trim().Split(',');
+ var unmatchedValues = values.Except(dt.AsEnumerable().Select(row => row.Field<string>("postcode")));
+ foreach (var value in unmatchedValues)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "{鎵�灞炲矖浣嶇紪鐮亇";
+ erro.ErrorCont = "鐢ㄦ埛琛�:{鎵�灞炲矖浣嶇紪鐮亇瀛楁" + value + " 涓嶆槸鏈夋晥鐨勫矖浣嶇紪鐮�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "{鎵�灞炲矖浣嶇紪鐮亇";
+ erro.ErrorCont = "鐢ㄦ埛琛�:{鎵�灞炲矖浣嶇紪鐮亇瀛楁" + excelTable[0].Rows[k][8].ToString().Trim() + " 涓嶆槸鏈夋晥鐨勫矖浣嶇紪鐮�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][9].ToString().Trim() != null && excelTable[0].Rows[k][9].ToString().Trim() != "")
+ {
+ string[] rolecode = Array.ConvertAll<string, string>(excelTable[0].Rows[k][9].ToString().Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ sql = @"select rolecode from TRole where rolecode in @rolecode";
+ dynamicParams.Add("@rolecode", rolecode);
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt != null && dt.Rows.Count > 0)
+ {
+ string[] values = excelTable[0].Rows[k][9].ToString().Trim().Split(',');
+ var unmatchedValues = values.Except(dt.AsEnumerable().Select(row => row.Field<string>("rolecode")));
+ foreach (var value in unmatchedValues)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "{鎵�灞炶鑹茬紪鐮亇";
+ erro.ErrorCont = "鐢ㄦ埛琛�:{鎵�灞炶鑹茬紪鐮亇瀛楁" + value + " 涓嶆槸鏈夋晥鐨勮鑹茬紪鐮�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "{鎵�灞炶鑹茬紪鐮亇";
+ erro.ErrorCont = "鐢ㄦ埛琛�:{鎵�灞炶鑹茬紪鐮亇瀛楁" + excelTable[0].Rows[k][9].ToString().Trim() + " 涓嶆槸鏈夋晥鐨勮鑹茬紪鐮�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][10].ToString().Trim() != null && excelTable[0].Rows[k][10].ToString().Trim() != "")
+ {
+ string[] usergroupcode = Array.ConvertAll<string, string>(excelTable[0].Rows[k][10].ToString().Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ sql = @"select usergroupcode from TGroup where usergroupcode in @usergroupcode";
+ dynamicParams.Add("@usergroupcode", usergroupcode);
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt != null && dt.Rows.Count > 0)
+ {
+ string[] values = excelTable[0].Rows[k][10].ToString().Trim().Split(',');
+ var unmatchedValues = values.Except(dt.AsEnumerable().Select(row => row.Field<string>("usergroupcode")));
+ foreach (var value in unmatchedValues)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "{鎵�灞炵彮缁勭紪鐮亇";
+ erro.ErrorCont = "鐢ㄦ埛琛�:{鎵�灞炵彮缁勭紪鐮亇瀛楁" + value + " 涓嶆槸鏈夋晥鐨勭彮缁勭紪鐮�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = (k + 1).ToString();
+ erro.ErrorField = "{鎵�灞炵彮缁勭紪鐮亇";
+ erro.ErrorCont = "鐢ㄦ埛琛�:{鎵�灞炵彮缁勭紪鐮亇瀛楁" + excelTable[0].Rows[k][10].ToString().Trim() + " 涓嶆槸鏈夋晥鐨勭彮缁勭紪鐮�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,瑙掕壊绠$悊銆�
+ public static List<ExcelErro> FourData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //瑙掕壊琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TRole where rolecode=@rolecode";
+ dynamicParams.Add("@rolecode", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*瑙掕壊缂栧彿(鍞竴)}";
+ erro.ErrorCont = "瑙掕壊琛�:{*瑙掕壊缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TRole where rolename=@rolename";
+ dynamicParams.Add("@rolename", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*瑙掕壊鍚嶇О}";
+ erro.ErrorCont = "瑙掕壊琛�:{*瑙掕壊鍚嶇О}瀛楁" + excelTable[0].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ //if (excelTable[0].Rows[k][3].ToString().Trim() != null && excelTable[0].Rows[k][3].ToString().Trim() != "")
+ //{
+ // if (excelTable[0].Rows[k][3].ToString().Trim() == "鑷畾涔�")
+ // {
+ // if (excelTable[0].Rows[k][4].ToString().Trim() == null && excelTable[0].Rows[k][4].ToString().Trim() == "")
+ // {
+ // ExcelErro erro = new ExcelErro();
+ // erro.RoeNumber = "/";
+ // erro.ErrorField = "{鏁版嵁鏉冮檺}";
+ // erro.ErrorCont = "瑙掕壊琛�:{鏁版嵁鑼冨洿}瀛楁涓猴細" + excelTable[1].Rows[k][3].ToString().Trim() + "鏃�,{鏁版嵁鏉冮檺}瀛楁涓嶈兘涓虹┖";
+ // list.Add(erro);
+ // }
+ // else
+ // {
+ // //鍒ゆ柇鏁版嵁鏉冮檺缂栫爜鏄惁鍚堢悊
+ // if (excelTable[0].Rows[k][4].ToString().Trim() != null && excelTable[0].Rows[k][4].ToString().Trim() != "")
+ // {
+ // string[] torgcode = Array.ConvertAll<string, string>(excelTable[0].Rows[k][4].ToString().Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string鍒嗗壊杞瑂tring[]
+ // sql = @"select postcode from TOrganization where torg_code in @torgcode";
+ // dynamicParams.Add("@torgcode", torgcode);
+ // dt = DapperHelper.selectdata(sql, dynamicParams);
+ // if (dt != null && dt.Rows.Count > 0)
+ // {
+ // string[] values = excelTable[0].Rows[k][4].ToString().Trim().Split(',');
+ // var unmatchedValues = values.Except(dt.AsEnumerable().Select(row => row.Field<string>("torg_code")));
+ // foreach (var value in unmatchedValues)
+ // {
+ // ExcelErro erro = new ExcelErro();
+ // erro.RoeNumber = (k + 1).ToString();
+ // erro.ErrorField = "{鏁版嵁鏉冮檺}";
+ // erro.ErrorCont = "瑙掕壊琛�:{鏁版嵁鏉冮檺}瀛楁" + value + " 涓嶆槸鏈夋晥鐨勭粍缁囩紪鐮�";
+ // list.Add(erro);
+ // }
+ // }
+ // else
+ // {
+ // ExcelErro erro = new ExcelErro();
+ // erro.RoeNumber = (k + 1).ToString();
+ // erro.ErrorField = "{鏁版嵁鏉冮檺}";
+ // erro.ErrorCont = "瑙掕壊琛�:{鏁版嵁鏉冮檺}瀛楁" + excelTable[0].Rows[k][4].ToString().Trim() + " 涓嶆槸鏈夋晥鐨勭粍缁囩紪鐮�";
+ // list.Add(erro);
+ // }
+ // }
+ // }
+ // }
+ //}
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,寰�鏉ュ崟浣嶃��
+ public static List<ExcelErro> FiveData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //寰�鏉ュ崟浣嶇被鍨嬭〃
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][0].ToString().Trim() != null && excelTable[0].Rows[j][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TCustomerType where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)}";
+ erro.ErrorCont = "寰�鏉ュ崟浣嶇被鍨嬭〃:{*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)}瀛楁" + excelTable[0].Rows[j][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[j][1].ToString().Trim() != null && excelTable[0].Rows[j][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TCustomerType where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[j][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*寰�鏉ュ崟浣嶇被鍨嬪悕绉皚";
+ erro.ErrorCont = "寰�鏉ュ崟浣嶇被鍨嬭〃:{*寰�鏉ュ崟浣嶇被鍨嬪悕绉皚瀛楁" + excelTable[0].Rows[j][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ var invalidRows = excelTable[0].AsEnumerable().Where(row =>
+ row.Field<string>("涓婄骇缂栫爜") == row.Field<string>("*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)") ||
+ (row.Field<string>("涓婄骇缂栫爜") != null && !excelTable[0].AsEnumerable().Any(r => r.Field<string>("*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)") == row.Field<string>("涓婄骇缂栫爜")))
+ );
+
+ // 杈撳嚭涓嶅悎鐞嗙殑琛�
+ foreach (var row in invalidRows)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{涓婄骇缂栫爜}";
+ erro.ErrorCont = $"寰�鏉ュ崟浣嶇被鍨嬭〃:*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)锛� {row.Field<string>("*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)")} 鐨勪笂绾х紪鐮侊細{row.Field<string>("涓婄骇缂栫爜")}涓嶅悎鐞�";
+ list.Add(erro);
+ }
+
+ //寰�鏉ュ崟浣嶈〃
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][0].ToString().Trim() != null && excelTable[1].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TCustomer where code=@code";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*寰�鏉ュ崟浣嶇紪鍙�(鍞竴)}";
+ erro.ErrorCont = "寰�鏉ュ崟浣嶈〃:{*寰�鏉ュ崟浣嶇紪鍙�(鍞竴)}瀛楁" + excelTable[1].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[1].Rows[k][1].ToString().Trim() != null && excelTable[1].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TCustomer where name=@name";
+ dynamicParams.Add("@name", excelTable[1].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*寰�鏉ュ崟浣嶅悕绉皚";
+ erro.ErrorCont = "寰�鏉ュ崟浣嶈〃:{*寰�鏉ュ崟浣嶅悕绉皚瀛楁" + excelTable[1].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)")
+ ).Contains(r.Field<string>("*寰�鏉ュ崟浣嶇被鍨嬬紪鐮�"))
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*寰�鏉ュ崟浣嶇被鍨嬬紪鐮亇";
+ erro.ErrorCont = "寰�鏉ュ崟浣嶈〃:{*寰�鏉ュ崟浣嶇被鍨嬬紪鐮亇瀛楁涓湁鍊煎湪寰�鏉ュ崟浣嶇被鍨嬭〃:{*寰�鏉ュ崟浣嶇被鍨嬬紪鍙�(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,浠撳簱璁剧疆銆�
+ public static List<ExcelErro> SixData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //浠撳簱琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TSecStck where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*浠撳簱缂栧彿(鍞竴)}";
+ erro.ErrorCont = "浠撳簱琛�:{*浠撳簱缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TSecStck where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*浠撳簱鍚嶇О}";
+ erro.ErrorCont = "浠撳簱琛�:{*浠撳簱鍚嶇О}瀛楁" + excelTable[1].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,搴撲綅璁剧疆銆�
+ public static List<ExcelErro> SevenData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //搴撲綅琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TSecLoca where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*搴撲綅缂栧彿(鍞竴)}";
+ erro.ErrorCont = "搴撲綅琛�:{*搴撲綅缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TSecLoca where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*搴撲綅鍚嶇О}";
+ erro.ErrorCont = "搴撲綅琛�:{*搴撲綅鍚嶇О}瀛楁" + excelTable[1].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][2].ToString().Trim() != null && excelTable[0].Rows[k][2].ToString().Trim() != "")
+ {
+ sql = @"select * from TSecStck where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][2].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*鎵�灞炰粨搴撶紪鐮亇";
+ erro.ErrorCont = "搴撲綅琛�:{*鎵�灞炰粨搴撶紪鐮亇瀛楁" + excelTable[1].Rows[k][1].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ var invalidRows = excelTable[0].AsEnumerable().Where(row =>
+ row.Field<string>("涓婄骇搴撲綅缂栫爜") == row.Field<string>("*搴撲綅缂栧彿(鍞竴)") ||
+ (row.Field<string>("涓婄骇搴撲綅缂栫爜") != null && !excelTable[0].AsEnumerable().Any(r => r.Field<string>("*搴撲綅缂栧彿(鍞竴)") == row.Field<string>("涓婄骇搴撲綅缂栫爜")))
+ );
+
+ // 杈撳嚭涓嶅悎鐞嗙殑琛�
+ foreach (var row in invalidRows)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{涓婄骇搴撲綅缂栫爜}";
+ erro.ErrorCont = $"搴撲綅琛�:*搴撲綅缂栧彿(鍞竴)锛� {row.Field<string>("*搴撲綅缂栧彿(鍞竴)")} 鐨勪笂绾у簱浣嶇紪鐮侊細{row.Field<string>("涓婄骇搴撲綅缂栫爜")}涓嶅悎鐞�";
+ list.Add(erro);
+ }
+
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,瀛樿揣妗f銆�
+ public static List<ExcelErro> EightData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //瀛樿揣鍒嗙被琛�
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][0].ToString().Trim() != null && excelTable[0].Rows[j][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TMateriel_Class where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*瀛樿揣鍒嗙被缂栧彿(鍞竴)}";
+ erro.ErrorCont = "瀛樿揣鍒嗙被琛�:{*瀛樿揣鍒嗙被缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[j][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[j][1].ToString().Trim() != null && excelTable[0].Rows[j][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TMateriel_Class where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[j][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*瀛樿揣鍒嗙被鍚嶇О}";
+ erro.ErrorCont = "瀛樿揣鍒嗙被琛�:{*瀛樿揣鍒嗙被鍚嶇О}瀛楁" + excelTable[0].Rows[j][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ var invalidRows = excelTable[0].AsEnumerable().Where(row =>
+ row.Field<string>("涓婄骇缂栫爜") == row.Field<string>("*瀛樿揣鍒嗙被缂栧彿(鍞竴)") ||
+ (row.Field<string>("涓婄骇缂栫爜") != null && !excelTable[0].AsEnumerable().Any(r => r.Field<string>("*瀛樿揣鍒嗙被缂栧彿(鍞竴)") == row.Field<string>("涓婄骇缂栫爜")))
+ );
+
+ // 杈撳嚭涓嶅悎鐞嗙殑琛�
+ foreach (var row in invalidRows)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{涓婄骇缂栫爜}";
+ erro.ErrorCont = $"瀛樿揣绫诲瀷琛�:*瀛樿揣鍒嗙被缂栧彿(鍞竴)锛� {row.Field<string>("**瀛樿揣鍒嗙被缂栧彿(鍞竴)")} 鐨勪笂绾х紪鐮侊細{row.Field<string>("涓婄骇缂栫爜")}涓嶅悎鐞�";
+ list.Add(erro);
+ }
+
+ //瀛樿揣琛�
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][0].ToString().Trim() != null && excelTable[1].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TMateriel_Info where partcode=@partcode";
+ dynamicParams.Add("@partcode", excelTable[1].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*瀛樿揣缂栧彿(鍞竴)}";
+ erro.ErrorCont = "瀛樿揣妗f琛�:{*瀛樿揣缂栧彿(鍞竴)}瀛楁" + excelTable[1].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[1].Rows[k][1].ToString().Trim() != null && excelTable[1].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TMateriel_Info where partname=@partname";
+ dynamicParams.Add("@partname", excelTable[1].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*瀛樿揣鍚嶇О}";
+ erro.ErrorCont = "瀛樿揣妗f琛�:{*瀛樿揣鍚嶇О}瀛楁" + excelTable[1].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[1].Rows[k][5].ToString().Trim() != null && excelTable[1].Rows[k][5].ToString().Trim() != "")
+ {
+ switch (excelTable[1].Rows[k][5].ToString().Trim())
+ {
+ case "S": //鍗曡閲�
+ //鍒ゆ柇璁¢噺鍗曚綅鏄惁涓哄崟璁¢噺
+ if (excelTable[1].Rows[k][6].ToString().Trim() != null && excelTable[1].Rows[k][6].ToString().Trim() != "")
+ {
+ sql = @"select * from TUnit where name=@name and isSingleUnit='1'";
+ dynamicParams.Add("@name", excelTable[1].Rows[k][6].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁¢噺鍗曚綅/缁勫悕瀛梷";
+ erro.ErrorCont = "瀛樿揣妗f琛�:{*璁¢噺鍗曚綅/缁勫悕瀛梷瀛楁" + excelTable[1].Rows[k][6].ToString().Trim() + "涓嶆槸鏈夋晥鐨勫崟璁¢噺鍗曚綅";
+ list.Add(erro);
+ }
+ }
+ break;
+ case "M": //澶氳閲�
+ //鍒ゆ柇璁¢噺鍗曚綅鏄惁涓哄璁¢噺
+ if (excelTable[1].Rows[k][6].ToString().Trim() != null && excelTable[1].Rows[k][6].ToString().Trim() != "")
+ {
+ sql = @"select * from TUnitGroup where name=@name";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][6].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁¢噺鍗曚綅/缁勫悕绉皚";
+ erro.ErrorCont = "瀛樿揣妗f琛�:{*璁¢噺鍗曚綅/缁勫悕绉皚瀛楁" + excelTable[1].Rows[k][6].ToString().Trim() + "涓嶆槸鏈夋晥鐨勫璁¢噺鍗曚綅缁�";
+ list.Add(erro);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if (excelTable[1].Rows[k][7].ToString().Trim() != null && excelTable[1].Rows[k][7].ToString().Trim() != "")
+ {
+ sql = @"select * from TSecStck where code=@code";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][7].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{鎵�灞炰粨搴撶紪鐮亇";
+ erro.ErrorCont = "瀛樿揣妗f琛�:{鎵�灞炰粨搴撶紪鐮亇瀛楁" + excelTable[1].Rows[k][7].ToString().Trim() + "涓嶆槸鏈夋晥鐨勪粨搴撶紪鐮�";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*瀛樿揣鍒嗙被缂栧彿(鍞竴)")
+ ).Contains(r.Field<string>("*瀛樿揣鍒嗙被缂栫爜"))
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*瀛樿揣鍒嗙被缂栫爜}";
+ erro.ErrorCont = "瀛樿揣妗f琛�:{*瀛樿揣鍒嗙被缂栫爜}瀛楁涓湁鍊煎湪瀛樿揣鍒嗙被琛�:{*瀛樿揣鍒嗙被缂栧彿(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,璁惧娓呭崟銆�
+ public static List<ExcelErro> NineData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //璁惧绫诲瀷琛�
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][0].ToString().Trim() != null && excelTable[0].Rows[j][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TEqpType where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧绫诲瀷缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧绫诲瀷琛�:{*璁惧绫诲瀷缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[j][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[j][1].ToString().Trim() != null && excelTable[0].Rows[j][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TEqpType where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[j][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧绫诲瀷鍚嶇О}";
+ erro.ErrorCont = "璁惧绫诲瀷琛�:{*璁惧绫诲瀷鍚嶇О}瀛楁" + excelTable[0].Rows[j][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+
+ //璁惧琛�
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][0].ToString().Trim() != null && excelTable[1].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TEqpInfo where code=@code";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧琛�:{*璁惧缂栧彿(鍞竴)}瀛楁" + excelTable[1].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[1].Rows[k][1].ToString().Trim() != null && excelTable[1].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TEqpInfo where name=@name";
+ dynamicParams.Add("@name", excelTable[1].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧鍚嶇О}";
+ erro.ErrorCont = "璁惧琛�:{*璁惧鍚嶇О}瀛楁" + excelTable[1].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[1].Rows[k][2].ToString().Trim() != null && excelTable[1].Rows[k][2].ToString().Trim() != "")
+ {
+ sql = @"select * from TOrganization where torg_code=@torg_code";
+ dynamicParams.Add("@torg_code", excelTable[1].Rows[k][2].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*鎵�灞炵粍缁囩紪鐮亇";
+ erro.ErrorCont = "璁惧琛�:{*鎵�灞炵粍缁囩紪鐮亇瀛楁" + excelTable[1].Rows[k][2].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*璁惧绫诲瀷缂栧彿(鍞竴)")
+ ).Contains(r.Field<string>("*璁惧绫诲瀷缂栫爜"))
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧绫诲瀷缂栫爜}";
+ erro.ErrorCont = "璁惧琛�:{*璁惧绫诲瀷缂栫爜}瀛楁涓湁鍊煎湪璁惧绫诲瀷琛�:{*璁惧绫诲瀷缂栧彿(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,璁惧鐐规椤圭洰銆�
+ public static List<ExcelErro> TenData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //褰撳墠Excel鏁版嵁涓偣妫�鏍囧噯椤电涓�,璁惧鐐规鏍囧噯缂栧彿(鍞竴鏄惁鏈夐噸澶�)
+ DataTable distinct = excelTable[0].DefaultView.ToTable(true, "*鐐规椤圭洰缂栧彿(鍞竴)");
+ if (distinct.Rows.Count != excelTable[0].Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*鐐规椤圭洰缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧鐐规椤圭洰妯℃澘:{*鐐规椤圭洰缂栧彿(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ if (excelTable[0].Rows[i][0].ToString().Trim() != null && excelTable[0].Rows[i][0].ToString().Trim() != "")
+ {
+ sql = @"select code from TEqpchk_Item where code=@code";
+
+ dynamicParams.Add("@code", excelTable[0].Rows[i][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*鐐规椤圭洰缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧鐐规椤圭洰琛�:{*鐐规椤圭洰缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[i][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,璁惧鐐规鏍囧噯銆�
+ public static List<ExcelErro> Ten_oneData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //褰撳墠Excel鏁版嵁涓偣妫�鏍囧噯椤电涓�,璁惧鐐规鏍囧噯缂栧彿(鍞竴鏄惁鏈夐噸澶�)
+ DataTable distinct = excelTable[0].DefaultView.ToTable(true, "*璁惧鐐规鏍囧噯缂栧彿(鍞竴)");
+ if (distinct.Rows.Count != excelTable[0].Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧鐐规鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧鐐规鏍囧噯椤电妯℃澘:{*璁惧鐐规鏍囧噯缂栧彿(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ //璁惧鐐规鏍囧噯琛ㄦ槸鍚﹀凡瀛樺湪鐐规鏍囧噯
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][0].ToString().Trim() != null && excelTable[0].Rows[j][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TEqpchk_Main where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧鐐规鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧鐐规鏍囧噯琛�:{*璁惧鐐规鏍囧噯缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[j][0].ToString().Trim() + "鍦ㄦ暟鎹〃涓凡瀛樺湪";
+ list.Add(erro);
+ }
+ //閫氳繃璁惧鐐规鏍囧噯椤电妯℃澘涓殑鏍囧噯缂栫爜鏌ヨ璁惧鐐规閮ㄤ綅椤电妯℃澘涓搴旂殑鏁版嵁淇℃伅
+ var var_dtTable = excelTable[1].AsEnumerable().Where<DataRow>(W => W["*璁惧鐐规鏍囧噯缂栧彿(M)"].ToString() == excelTable[0].Rows[j][0].ToString().Trim());
+ DataTable ds = var_dtTable.Any() ? var_dtTable.CopyToDataTable() : excelTable[1].Clone();
+ if (ds.Rows.Count > 0)
+ {
+ //鍒ゆ柇鐐规鏍囧噯鏌ヨ鐐规閮ㄤ綅鏁版嵁鏄惁鏈夐噸澶�
+ DataTable distinct1 = ds.DefaultView.ToTable(true, "*璁惧鐐规閮ㄤ綅缂栧彿(鍞竴)");
+ if (distinct1.Rows.Count != ds.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧鐐规閮ㄤ綅缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧鐐规閮ㄤ綅椤电妯℃澘:{*璁惧鐐规鏍囧噯缂栧彿(M)}:" + excelTable[1].Rows[j][1].ToString().Trim() + " 瀵瑰簲{*璁惧鐐规閮ㄤ綅缂栧彿(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧鐐规鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧鐐规鏍囧噯妯℃澘sheet1涓�:{*璁惧鐐规鏍囧噯缂栧彿(M)}:" + excelTable[1].Rows[j][0].ToString().Trim() + " 鍦ㄨ澶囩偣妫�鏍囧噯妯℃澘sheet涓瓄*璁惧鐐规鏍囧噯缂栧彿(鍞竴)}鍒椾笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //褰撳墠Excel鏁版嵁涓偣妫�閮ㄤ綅椤电涓�,璁惧鐐规閮ㄤ綅缂栧彿(鍞竴)鍦ㄨ澶囩偣妫�閮ㄤ綅琛ㄤ腑鏄惁瀛樺湪
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][2].ToString().Trim() != null && excelTable[1].Rows[k][2].ToString().Trim() != "")
+ {
+ sql = @"select * from TEqpchk_Item where code=@code";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][2].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧鐐规閮ㄤ綅缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧鐐规閮ㄤ綅琛�:{*璁惧鐐规閮ㄤ綅缂栧彿(鍞竴)}瀛楁" + excelTable[1].Rows[k][2].ToString().Trim() + "鍦ㄦ暟鎹〃涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*璁惧鐐规鏍囧噯缂栧彿(鍞竴)")
+ ).Contains(r.Field<string>("*璁惧鐐规鏍囧噯缂栧彿(M)"))
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧鐐规鏍囧噯缂栧彿(M)}";
+ erro.ErrorCont = "璁惧鐐规閮ㄤ綅椤电妯℃澘:{*璁惧鐐规鏍囧噯缂栧彿(M)}瀛楁涓湁鍊煎湪璁惧鐐规鏍囧噯椤电妯℃澘:{*璁惧鐐规鏍囧噯缂栧彿(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,璁惧淇濆吇椤圭洰銆�
+ public static List<ExcelErro> ElevenData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //褰撳墠Excel鏁版嵁涓偣妫�鏍囧噯椤电涓�,璁惧鐐规鏍囧噯缂栧彿(鍞竴鏄惁鏈夐噸澶�)
+ DataTable distinct = excelTable[0].DefaultView.ToTable(true, "*淇濆吇椤圭洰缂栧彿(鍞竴)");
+ if (distinct.Rows.Count != excelTable[0].Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*淇濆吇椤圭洰缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧淇濆吇椤圭洰椤电妯℃澘:{*淇濆吇椤圭洰缂栧彿(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ if (excelTable[0].Rows[i][0].ToString().Trim() != null && excelTable[0].Rows[i][0].ToString().Trim() != "")
+ {
+ sql = @"select code from TEqpmai_Item where code=@code";
+
+ dynamicParams.Add("@code", excelTable[0].Rows[i][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*淇濆吇椤圭洰缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧淇濆吇椤圭洰琛�:{*鐐规淇濆吇缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[i][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,璁惧淇濆吇鏍囧噯銆�
+ public static List<ExcelErro> Eleven_oneData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //褰撳墠Excel鏁版嵁涓繚鍏绘爣鍑嗛〉绛句腑,璁惧淇濆吇鏍囧噯缂栧彿(鍞竴鏄惁鏈夐噸澶�)
+ DataTable distinct = excelTable[0].DefaultView.ToTable(true, "*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)");
+ if (distinct.Rows.Count != excelTable[0].Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧淇濆吇鏍囧噯椤电妯℃澘:{*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ //璁惧淇濆吇鏍囧噯琛ㄦ槸鍚﹀凡瀛樺湪淇濆吇鏍囧噯
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][0].ToString().Trim() != null && excelTable[0].Rows[j][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TEqpmai_Main where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧淇濆吇鏍囧噯琛�:{*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[j][0].ToString().Trim() + "鍦ㄦ暟鎹〃涓凡瀛樺湪";
+ list.Add(erro);
+ }
+ //閫氳繃璁惧淇濆吇鏍囧噯椤电妯℃澘涓殑鏍囧噯缂栫爜鏌ヨ璁惧淇濆吇閮ㄤ綅椤电妯℃澘涓搴旂殑鏁版嵁淇℃伅
+ var var_dtTable = excelTable[1].AsEnumerable().Where<DataRow>(W => W["*璁惧淇濆吇鏍囧噯缂栧彿(M)"].ToString() == excelTable[0].Rows[j][0].ToString().Trim());
+ DataTable ds = var_dtTable.Any() ? var_dtTable.CopyToDataTable() : excelTable[0].Clone();
+ if (ds.Rows.Count > 0)
+ {
+ //鍒ゆ柇淇濆吇鏍囧噯鏌ヨ淇濆吇閮ㄤ綅鏁版嵁鏄惁鏈夐噸澶�
+ DataTable distinct1 = ds.DefaultView.ToTable(true, "*璁惧淇濆吇閮ㄤ綅缂栧彿(鍞竴)");
+ if (distinct1.Rows.Count != ds.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧淇濆吇閮ㄤ綅缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧淇濆吇閮ㄤ綅椤电妯℃澘:{*璁惧淇濆吇鏍囧噯缂栧彿(M)}:" + excelTable[1].Rows[j][1].ToString().Trim() + " 瀵瑰簲{*璁惧淇濆吇閮ㄤ綅缂栧彿(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧淇濆吇鏍囧噯妯℃澘sheet1涓�:{*璁惧淇濆吇鏍囧噯缂栧彿(M)}:" + excelTable[1].Rows[j][0].ToString().Trim() + " 鍦ㄨ澶囦繚鍏绘爣鍑嗘ā鏉縮heet涓瓄*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)}鍒椾笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //褰撳墠Excel鏁版嵁涓偣妫�閮ㄤ綅椤电涓�,璁惧淇濆吇閮ㄤ綅缂栧彿(鍞竴)鍦ㄨ澶囦繚鍏婚儴浣嶈〃涓槸鍚﹀瓨鍦�
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][2].ToString().Trim() != null && excelTable[1].Rows[k][2].ToString().Trim() != "")
+ {
+ sql = @"select * from TEqpmai_Item where code=@code";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][2].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧淇濆吇閮ㄤ綅缂栧彿(鍞竴)}";
+ erro.ErrorCont = "璁惧淇濆吇閮ㄤ綅琛�:{*璁惧淇濆吇閮ㄤ綅缂栧彿(鍞竴)}瀛楁" + excelTable[1].Rows[k][2].ToString().Trim() + "鍦ㄦ暟鎹〃涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)")
+ ).Contains(r.Field<string>("*璁惧淇濆吇鏍囧噯缂栧彿(M)"))
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*璁惧淇濆吇鏍囧噯缂栧彿(M)}";
+ erro.ErrorCont = "璁惧淇濆吇閮ㄤ綅椤电妯℃澘:{*璁惧淇濆吇鏍囧噯缂栧彿(M)}瀛楁涓湁鍊煎湪璁惧淇濆吇鏍囧噯椤电妯℃澘:{*璁惧淇濆吇鏍囧噯缂栧彿(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,妯″叿娓呭崟銆�
+ public static List<ExcelErro> TwelveData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+
+ //妯″叿琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldInfo where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿缂栧彿(鍞竴)}";
+ erro.ErrorCont = "妯″叿琛�:{*妯″叿缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldInfo where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿鍚嶇О}";
+ erro.ErrorCont = "妯″叿琛�:{*妯″叿鍚嶇О}瀛楁" + excelTable[0].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ //鍒ゆ柇浠撳簱缂栫爜鏄惁涓虹┖
+ if (excelTable[0].Rows[k][4].ToString().Trim() != null && excelTable[0].Rows[k][4].ToString().Trim() != "")
+ {
+ sql = @"select * from TSecStck where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][4].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*浠撳簱缂栫爜}";
+ erro.ErrorCont = "妯″叿琛�:{*浠撳簱缂栫爜}瀛楁" + excelTable[0].Rows[k][4].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ //鍒ゆ柇搴撲綅缂栫爜鏄惁涓虹┖
+ if (excelTable[0].Rows[k][5].ToString().Trim() != null && excelTable[0].Rows[k][5].ToString().Trim() != "")
+ {
+ //搴撲綅涓嶄负绌烘椂,鍒ゆ柇浠撳簱鏄惁涓虹┖
+ if (excelTable[0].Rows[k][4].ToString().Trim() != null && excelTable[0].Rows[k][4].ToString().Trim() != "")
+ {
+ //鍒ゆ柇搴撲綅鏄惁瀛樺湪
+ sql = @"select * from TSecLoca where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][5].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*搴撲綅缂栫爜}";
+ erro.ErrorCont = "妯″叿琛�:{*搴撲綅缂栫爜}瀛楁" + excelTable[0].Rows[k][5].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ else
+ {
+ //鍒ゆ柇搴撲綅鏄惁灞炰簬褰撳墠浠撳簱
+ if (excelTable[0].Rows[k][4].ToString().Trim() != dt.Rows[0]["idwarehouse"].ToString())
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*搴撲綅缂栫爜}";
+ erro.ErrorCont = "妯″叿琛�:{*搴撲綅缂栫爜}瀛楁" + excelTable[0].Rows[k][5].ToString().Trim() + "涓巤*浠撳簱缂栫爜}瀛楁锛�" + excelTable[0].Rows[k][4].ToString().Trim() + "涓嶅尮閰�";
+ list.Add(erro);
+ }
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*搴撲綅缂栫爜}";
+ erro.ErrorCont = "妯″叿琛�:{*搴撲綅缂栫爜}瀛楁" + excelTable[0].Rows[k][5].ToString().Trim() + "瀵瑰簲鐨勪粨搴撳瓧娈典笉鑳戒负绌�";
+ list.Add(erro);
+ }
+ }
+ }
+ //妯″叿鍏宠仈浜у搧琛�
+ for (int j = 0; j < excelTable[1].Rows.Count; j++)
+ {
+ if (excelTable[1].Rows[j][1].ToString().Trim() != null && excelTable[1].Rows[j][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TMateriel_Info where partcode=@partcode";
+ dynamicParams.Add("@partcode", excelTable[1].Rows[j][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{浜у搧缂栫爜}";
+ erro.ErrorCont = "妯″叿鍏宠仈浜у搧琛�:{浜у搧缂栫爜}瀛楁" + excelTable[1].Rows[j][1].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇妯″叿鍏宠仈浜у搧琛ㄦ槸鍚︽湁鏁版嵁
+ if (excelTable[1].Rows.Count > 0)
+ {
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*妯″叿缂栧彿(鍞竴)").Trim()
+ ).Contains(r.Field<string>("妯″叿缂栫爜").Trim())
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{妯″叿缂栫爜}";
+ erro.ErrorCont = "妯″叿鍏宠仈浜у搧琛�:{妯″叿缂栫爜}瀛楁涓湁鍊煎湪妯″叿娓呭崟琛�:{*妯″叿缂栧彿(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,妯″叿鐐规椤圭洰銆�
+ public static List<ExcelErro> ThirteenData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //妯″叿鐐规椤圭洰琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldchk_Item where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*鐐规椤圭洰缂栧彿(鍞竴)}";
+ erro.ErrorCont = "妯″叿鐐规椤圭洰:{*鐐规椤圭洰缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldchk_Item where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*鐐规椤圭洰鍚嶇О}";
+ erro.ErrorCont = "妯″叿鐐规椤圭洰琛�:{*鐐规椤圭洰鍚嶇О}瀛楁" + excelTable[0].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,妯″叿鐐规鏍囧噯銆�
+ public static List<ExcelErro> Thirteen_oneData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //妯″叿鐐规鏍囧噯琛ㄦ槸鍚﹀凡瀛樺湪鐐规鏍囧噯
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][0].ToString().Trim() != null && excelTable[0].Rows[j][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldchk_Main where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿鐐规鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "妯″叿鐐规鏍囧噯琛�:{*妯″叿鐐规鏍囧噯缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[j][0].ToString().Trim() + "鍦ㄦ暟鎹〃涓凡瀛樺湪";
+ list.Add(erro);
+ }
+ //閫氳繃妯″叿鐐规鏍囧噯椤电妯℃澘涓殑鏍囧噯缂栫爜鏌ヨ妯″叿鐐规椤归〉绛炬ā鏉夸腑瀵瑰簲鐨勬暟鎹俊鎭�
+ var var_dtTable = excelTable[1].AsEnumerable().Where<DataRow>(W => W["*妯″叿鐐规鏍囧噯缂栧彿(M)"].ToString().Trim() == excelTable[0].Rows[j][0].ToString().Trim());
+ DataTable ds = var_dtTable.Any() ? var_dtTable.CopyToDataTable() : excelTable[1].Clone();
+ if (ds.Rows.Count > 0)
+ {
+ //鍒ゆ柇鐐规鏍囧噯鏌ヨ鐐规椤规暟鎹槸鍚︽湁閲嶅
+ DataTable distinct1 = ds.DefaultView.ToTable(true, "*妯″叿鐐规椤圭紪鍙�(鍞竴)");
+ if (distinct1.Rows.Count != ds.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿鐐规椤圭紪鍙�(鍞竴)}";
+ erro.ErrorCont = "妯″叿鐐规椤归〉绛炬ā鏉�:{*妯″叿鐐规鏍囧噯缂栧彿(M)}:" + excelTable[1].Rows[j][0].ToString().Trim() + " 瀵瑰簲{*妯″叿鐐规椤圭紪鍙�(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿鐐规鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "妯″叿鐐规鏍囧噯妯℃澘sheet1涓�:{*妯″叿鐐规鏍囧噯缂栧彿(M)}:" + excelTable[1].Rows[j][0].ToString().Trim() + " 鍦ㄦā鍏风偣妫�鏍囧噯妯℃澘sheet涓瓄*妯″叿鐐规鏍囧噯缂栧彿(鍞竴)}鍒椾笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //褰撳墠Excel鏁版嵁涓偣妫�椤归〉绛句腑,妯″叿鐐规椤圭紪鍙�(鍞竴)鍦ㄦā鍏风偣妫�閮ㄤ綅琛ㄤ腑鏄惁瀛樺湪
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][2].ToString().Trim() != null && excelTable[1].Rows[k][2].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldchk_Item where code=@code and name=@name";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][2].ToString().Trim());
+ dynamicParams.Add("@name", excelTable[1].Rows[k][3].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿鐐规椤圭紪鍙�(鍞竴)}";
+ erro.ErrorCont = "妯″叿鐐规閮ㄤ綅琛�:{*妯″叿鐐规椤圭紪鍙�(鍞竴),*妯″叿鐐规椤瑰悕绉皚瀛楁{" + excelTable[1].Rows[k][2].ToString().Trim() + "," + excelTable[1].Rows[k][3].ToString().Trim() + "}鍦ㄦā鍏风偣妫�椤逛腑涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*妯″叿鐐规鏍囧噯缂栧彿(鍞竴)").Trim()
+ ).Contains(r.Field<string>("*妯″叿鐐规鏍囧噯缂栧彿(M)").Trim())
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿鐐规鏍囧噯缂栧彿(M)}";
+ erro.ErrorCont = "妯″叿鐐规椤归〉绛炬ā鏉�:{*妯″叿鐐规鏍囧噯缂栧彿(M)}瀛楁涓湁鍊煎湪妯″叿鐐规鏍囧噯椤电妯℃澘:{*妯″叿鐐规鏍囧噯缂栧彿(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,妯″叿淇濆吇椤圭洰銆�
+ public static List<ExcelErro> FourteenData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //妯″叿淇濆吇椤圭洰琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldmai_Item where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*淇濆吇椤圭洰缂栧彿(鍞竴)}";
+ erro.ErrorCont = "妯″叿淇濆吇椤圭洰:{*淇濆吇椤圭洰缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldmai_Item where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*淇濆吇椤圭洰鍚嶇О}";
+ erro.ErrorCont = "妯″叿淇濆吇椤圭洰琛�:{*淇濆吇椤圭洰鍚嶇О}瀛楁" + excelTable[0].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,妯″叿淇濆吇鏍囧噯銆�
+ public static List<ExcelErro> FourteenData_one(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //妯″叿淇濆吇鏍囧噯琛ㄦ槸鍚﹀凡瀛樺湪淇濆吇鏍囧噯
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][0].ToString().Trim() != null && excelTable[0].Rows[j][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldmai_Main where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿淇濆吇鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "妯″叿淇濆吇鏍囧噯琛�:{*妯″叿淇濆吇鏍囧噯缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[j][0].ToString().Trim() + "鍦ㄦ暟鎹〃涓凡瀛樺湪";
+ list.Add(erro);
+ }
+ //閫氳繃妯″叿淇濆吇鏍囧噯椤电妯℃澘涓殑鏍囧噯缂栫爜鏌ヨ妯″叿淇濆吇椤归〉绛炬ā鏉夸腑瀵瑰簲鐨勬暟鎹俊鎭�
+ var var_dtTable = excelTable[1].AsEnumerable().Where<DataRow>(W => W["*妯″叿淇濆吇鏍囧噯缂栧彿(M)"].ToString().Trim() == excelTable[0].Rows[j][0].ToString().Trim());
+ DataTable ds = var_dtTable.Any() ? var_dtTable.CopyToDataTable() : excelTable[1].Clone();
+ if (ds.Rows.Count > 0)
+ {
+ //鍒ゆ柇淇濆吇鏍囧噯鏌ヨ淇濆吇椤规暟鎹槸鍚︽湁閲嶅
+ DataTable distinct1 = ds.DefaultView.ToTable(true, "*妯″叿淇濆吇椤圭紪鍙�(鍞竴)");
+ if (distinct1.Rows.Count != ds.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿淇濆吇椤圭紪鍙�(鍞竴)}";
+ erro.ErrorCont = "妯″叿淇濆吇椤归〉绛炬ā鏉�:{*妯″叿淇濆吇鏍囧噯缂栧彿(M)}:" + excelTable[1].Rows[j][0].ToString().Trim() + " 瀵瑰簲{*妯″叿淇濆吇椤圭紪鍙�(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿淇濆吇鏍囧噯缂栧彿(鍞竴)}";
+ erro.ErrorCont = "妯″叿淇濆吇鏍囧噯妯℃澘sheet1涓�:{*妯″叿淇濆吇鏍囧噯缂栧彿(M)}:" + excelTable[1].Rows[j][0].ToString().Trim() + " 鍦ㄦā鍏蜂繚鍏绘爣鍑嗘ā鏉縮heet涓瓄*妯″叿淇濆吇鏍囧噯缂栧彿(鍞竴)}鍒椾笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //褰撳墠Excel鏁版嵁涓繚鍏婚」椤电涓�,妯″叿淇濆吇椤圭紪鍙�(鍞竴)鍦ㄦā鍏蜂繚鍏婚儴浣嶈〃涓槸鍚﹀瓨鍦�
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][2].ToString().Trim() != null && excelTable[1].Rows[k][2].ToString().Trim() != "")
+ {
+ sql = @"select * from TMouldmai_Item where code=@code and name=@name";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][2].ToString().Trim());
+ dynamicParams.Add("@name", excelTable[1].Rows[k][3].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿淇濆吇椤圭紪鍙�(鍞竴)}";
+ erro.ErrorCont = "妯″叿淇濆吇閮ㄤ綅琛�:{*妯″叿淇濆吇椤圭紪鍙�(鍞竴),*妯″叿淇濆吇椤瑰悕绉皚瀛楁{" + excelTable[1].Rows[k][2].ToString().Trim() + "," + excelTable[1].Rows[k][3].ToString().Trim() + "}鍦ㄦā鍏蜂繚鍏婚」涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*妯″叿淇濆吇鏍囧噯缂栧彿(鍞竴)").Trim()
+ ).Contains(r.Field<string>("*妯″叿淇濆吇鏍囧噯缂栧彿(M)").Trim())
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*妯″叿淇濆吇鏍囧噯缂栧彿(M)}";
+ erro.ErrorCont = "妯″叿淇濆吇椤归〉绛炬ā鏉�:{*妯″叿淇濆吇鏍囧噯缂栧彿(M)}瀛楁涓湁鍊煎湪妯″叿淇濆吇鏍囧噯椤电妯℃澘:{*妯″叿淇濆吇鏍囧噯缂栧彿(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,宸ュ簭瀹氫箟銆�
+ public static List<ExcelErro> FifteenData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //宸ュ簭琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TStep where stepcode=@stepcode";
+ dynamicParams.Add("@stepcode", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宸ュ簭缂栧彿(鍞竴)}";
+ erro.ErrorCont = "宸ュ簭琛�:{*宸ュ簭缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TStep where stepname=@stepname";
+ dynamicParams.Add("@stepname", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宸ュ簭鍚嶇О}";
+ erro.ErrorCont = "宸ュ簭琛�:{*宸ュ簭鍚嶇О}瀛楁" + excelTable[0].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,宸ヨ壓璺嚎銆�
+ public static List<ExcelErro> SixteenData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //褰撳墠Excel鏁版嵁涓伐鑹鸿矾绾块〉绛句腑,*宸ヨ壓璺嚎缂栧彿(鍞竴)鏄惁鏈夐噸澶�
+ DataTable distinct = excelTable[0].DefaultView.ToTable(true, "*宸ヨ壓璺嚎缂栧彿(鍞竴)");
+ if (distinct.Rows.Count != excelTable[0].Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宸ヨ壓璺嚎缂栧彿(鍞竴)}";
+ erro.ErrorCont = "宸ヨ壓璺嚎椤电妯℃澘:{*宸ヨ壓璺嚎缂栧彿(鍞竴)}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ //宸ヨ壓璺嚎琛ㄦ槸鍚﹀凡瀛樺湪宸ヨ壓璺嚎鏁版嵁
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][0].ToString().Trim() != null && excelTable[0].Rows[j][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TFlw_Rout where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宸ヨ壓璺嚎缂栧彿(鍞竴)}";
+ erro.ErrorCont = "宸ヨ壓璺嚎琛�:{*宸ヨ壓璺嚎缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[j][0].ToString().Trim() + "鍦ㄦ暟鎹〃涓凡瀛樺湪";
+ list.Add(erro);
+ }
+ //閫氳繃宸ヨ壓璺嚎椤电妯℃澘涓殑宸ヨ壓璺嚎缂栧彿鏌ヨ鍏宠仈宸ヨ壓椤电妯℃澘涓搴旂殑鏁版嵁淇℃伅
+ var var_dtTable = excelTable[1].AsEnumerable().Where<DataRow>(W => W["*宸ヨ壓璺嚎缂栧彿"].ToString() == excelTable[0].Rows[j][0].ToString().Trim());
+ DataTable ds = var_dtTable.Any() ? var_dtTable.CopyToDataTable() : excelTable[1].Clone();
+ if (ds.Rows.Count > 0)
+ {
+ //鍒ゆ柇宸ヨ壓璺嚎缂栧彿鏌ヨ宸ュ簭缂栫爜鏁版嵁鏄惁鏈夐噸澶�
+ DataTable distinct1 = ds.DefaultView.ToTable(true, "*宸ュ簭缂栧彿");
+ if (distinct1.Rows.Count != ds.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宸ュ簭缂栧彿}";
+ erro.ErrorCont = "鍏宠仈宸ュ簭椤电妯℃澘:{*宸ヨ壓璺嚎缂栧彿}:" + excelTable[1].Rows[j][0].ToString().Trim() + " 瀵瑰簲{*宸ュ簭缂栧彿}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宸ヨ壓璺嚎缂栧彿(鍞竴)}";
+ erro.ErrorCont = "宸ヨ壓璺嚎-鍏宠仈宸ュ簭椤电妯℃澘涓�:{*宸ヨ壓璺嚎缂栧彿}:" + excelTable[1].Rows[j][0].ToString().Trim() + " 鍦ㄥ伐鑹鸿矾绾挎ā鏉夸腑{*宸ヨ壓璺嚎缂栧彿(鍞竴)}鍒椾笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //褰撳墠Excel鏁版嵁鍏宠仈宸ュ簭椤电涓�,宸ュ簭缂栧彿(鍞竴)鍦ㄥ伐搴忚〃涓槸鍚﹀瓨鍦�
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][1].ToString().Trim() != null && excelTable[1].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TStep where stepcode=@code";
+ dynamicParams.Add("@code", excelTable[1].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宸ュ簭缂栧彿}";
+ erro.ErrorCont = "宸ュ簭琛�:{*宸ュ簭缂栧彿}瀛楁" + excelTable[1].Rows[k][1].ToString().Trim() + "鍦ㄦ暟鎹〃涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ }
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("*宸ヨ壓璺嚎缂栧彿(鍞竴)")
+ ).Contains(r.Field<string>("*宸ヨ壓璺嚎缂栧彿"))
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*宸ヨ壓璺嚎缂栧彿}";
+ erro.ErrorCont = "宸ヨ壓璺嚎-鍏宠仈宸ュ簭椤电妯℃澘:{*宸ヨ壓璺嚎缂栧彿}瀛楁涓湁鍊煎湪宸ヨ壓璺嚎椤电妯℃澘:{*宸ヨ壓璺嚎缂栧彿(鍞竴)}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,鑺傛媿宸ヤ环銆�
+ public static List<ExcelErro> TwentyFourData(string FileCode, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ var dynamicParams = new DynamicParameters();
+ List<ExcelErro> list = new List<ExcelErro>();
+ DataTable excelTable = new DataTable();
+ list = ImportExcel.ExcelToTableErro(FileCode); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ excelTable = ImportExcel.ExcelToTable(FileCode); //鑾峰彇Excel鏁版嵁
+ for (int i = 0; i < excelTable.Rows.Count; i++)
+ {
+ //浜у搧鏄惁瀛樺湪
+ sql = @"select partname from TMateriel_Info
+ where partname=@partname";
+ dynamicParams.Add("@partname", excelTable.Rows[i][1].ToString().Trim());
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{浜у搧鍚嶇О}";
+ erro.ErrorCont = "瀛樿揣妗f:{浜у搧鍚嶇О}瀛楁" + excelTable.Rows[i][1].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ //宸ヨ壓璺嚎鏄惁瀛樺湪
+ sql = @"select name from TFlw_Rout
+ where name=@routename";
+ dynamicParams.Add("@routename", excelTable.Rows[i][2].ToString().Trim());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{宸ヨ壓璺嚎鍚嶇О}";
+ erro.ErrorCont = "宸ヨ壓璺嚎:{宸ヨ壓璺嚎鍚嶇О}瀛楁" + excelTable.Rows[i][2].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ //宸ュ簭鏄惁瀛樺湪
+ sql = @"select stepname from TStep
+ where stepname=@stepname";
+ dynamicParams.Add("@stepname", excelTable.Rows[i][3].ToString().Trim());
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{宸ュ簭鍚嶇О}";
+ erro.ErrorCont = "宸ュ簭瀹氫箟:{宸ュ簭鍚嶇О}瀛楁" + excelTable.Rows[i][3].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ //璁惧鏄惁瀛樺湪
+ sql = @"select name from TEqpInfo
+ where name=@eqpname";
+ dynamicParams.Add("@eqpname", excelTable.Rows[i][4].ToString().Trim());
+ var data2 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data2.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{璁惧鍚嶇О}";
+ erro.ErrorCont = "璁惧娓呭崟:{璁惧鍚嶇О}瀛楁" + excelTable.Rows[i][4].ToString().Trim() + "涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ //鍒ゆ柇浜у搧鏄惁鍏宠仈宸ヨ壓璺嚎
+ sql = @"select M.partname,R.name from TMateriel_Route A
+ inner join TMateriel_Info M on A.materiel_code=M.partcode
+ inner join TFlw_Rout R on A.route_code=R.code
+ where M.partname=@partname and R.name=@routename";
+ dynamicParams.Add("@partname", excelTable.Rows[i][1].ToString().Trim());
+ dynamicParams.Add("@routename", excelTable.Rows[i][2].ToString().Trim());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{浜у搧鍚嶇О/宸ヨ壓璺嚎鍚嶇О}";
+ erro.ErrorCont = "浜у搧鍏宠仈宸ヨ壓璺嚎:{浜у搧鍚嶇О}瀛楁:銆�" + excelTable.Rows[i][1].ToString().Trim() + "銆戝搴斿伐鑹鸿矾绾垮悕绉帮細銆�" + excelTable.Rows[i][2].ToString().Trim() + "銆戞湭鍏宠仈";
+ list.Add(erro);
+ }
+ //鍒ゆ柇宸ヨ壓璺嚎鏄惁鍏宠仈宸ュ簭
+ sql = @"select R.name,S.stepname from TFlw_Rtdt A
+ inner join TFlw_Rout R on A.rout_code=R.code
+ inner join TStep S on A.step_code=S.stepcode
+ where R.name=@routename and S.stepname=@stepname";
+ dynamicParams.Add("@routename", excelTable.Rows[i][2].ToString().Trim());
+ dynamicParams.Add("@stepname", excelTable.Rows[i][3].ToString().Trim());
+ var data4 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data4.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{宸ヨ壓璺嚎鍚嶇О/宸ュ簭鍚嶇О}";
+ erro.ErrorCont = "宸ヨ壓璺嚎鍏宠仈宸ュ簭:{宸ヨ壓璺嚎鍚嶇О}瀛楁:銆�" + excelTable.Rows[i][2].ToString().Trim() + "銆戝搴斿伐搴忓悕绉帮細銆�" + excelTable.Rows[i][3].ToString().Trim() + "銆戞湭鍏宠仈";
+ list.Add(erro);
+ }
+ //鍒ゆ柇宸ュ簭鏄惁鍏宠仈璁惧
+ sql = @"select E.name,S.stepname from TFlw_Rteqp A
+ inner join TStep S on A.step_code=S.stepcode
+ inner join TEqpInfo E on A.eqp_code=E.code
+ where S.stepname=@stepname and E.name=@eqpname";
+ dynamicParams.Add("@stepname", excelTable.Rows[i][3].ToString().Trim());
+ dynamicParams.Add("@eqpname", excelTable.Rows[i][4].ToString().Trim());
+ var data5 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data5.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{宸ュ簭鍚嶇О/璁惧鍚嶇О}";
+ erro.ErrorCont = "宸ュ簭鍏宠仈璁惧:{宸ュ簭鍚嶇О}瀛楁:銆�" + excelTable.Rows[i][3].ToString().Trim() + "銆戝搴旇澶囧悕绉帮細銆�" + excelTable.Rows[i][4].ToString().Trim() + "銆戞湭鍏宠仈";
+ list.Add(erro);
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable.Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,璐ㄦ鏍囧噯銆�
+ public static List<ExcelErro> SeventeenData(string FileCode, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,缂洪櫡瀹氫箟銆�
+ public static List<ExcelErro> EighteenData(List<DataTable> excelTable, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ list = ImportExcel.InportExcelToTableListErro(excelTable); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ //缂洪櫡琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ if (excelTable[0].Rows[k][0].ToString().Trim() != null && excelTable[0].Rows[k][0].ToString().Trim() != "")
+ {
+ sql = @"select * from TDefect where code=@code";
+ dynamicParams.Add("@code", excelTable[0].Rows[k][0].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*缂洪櫡缂栧彿(鍞竴)}";
+ erro.ErrorCont = "缂洪櫡:{*缂洪櫡缂栧彿(鍞竴)}瀛楁" + excelTable[0].Rows[k][0].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ if (excelTable[0].Rows[k][1].ToString().Trim() != null && excelTable[0].Rows[k][1].ToString().Trim() != "")
+ {
+ sql = @"select * from TDefect where name=@name";
+ dynamicParams.Add("@name", excelTable[0].Rows[k][1].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{*缂洪櫡鍚嶇О}";
+ erro.ErrorCont = "缂洪櫡琛�:{*缂洪櫡鍚嶇О}瀛楁" + excelTable[1].Rows[k][1].ToString().Trim() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,鐢熶骇璁㈠崟銆�
+ public static List<ExcelErro> NineteenData(string FileCode, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+
+ return list;
+ }
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,搴撳瓨鏌ヨ銆�
+ public static List<ExcelErro> TwentyData(string FileCode, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ DataTable dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+
+ return list;
+ }
+
+ #region銆愯幏鍙栧簱瀛樼殑瀹瑰櫒涓槸鍚﹀悓涓�涓骇鍝併��
+
+ public static Boolean getSamePNofTote(String PN, String Tote_ID)
+ {
+ Boolean bRes = false;
+ String sql = "";
+ String stockPN = "";
+ DataTable dt = null;
+
+ if (String.IsNullOrEmpty(PN))
+ {
+ bRes = true;
+ }
+ else
+ {
+ sql = @"select part_number from mes_tk_wms_stock where tote_id='" + Tote_ID + "' and qty>0 ";
+ dt = DBHelper.GetTable(sql);
+ if (dt.Rows.Count > 0)
+ {
+ stockPN = dt.Rows[0]["part_number"].ToString();
+ if (PN == stockPN)
+ {
+ bRes = true;
+ }
+ }
+ else
+ {
+ //浠撳簱涓笉瀛樺湪姝ゅ鍣�
+ bRes = true;
+ }
+ }
+ return bRes;
+ }
+ #endregion
+ #endregion
+
+ #region銆怑xcel涓婁紶鏁版嵁楠岃瘉,鐗╂枡娓呭崟銆�
+ public static List<ExcelErro> TwentyOneData(string FileCode, out string StuCode, out string message, out int count)
+ {
+ message = "";
+ StuCode = "";
+ count = 0;
+ string sql = "";
+ var dynamicParams = new DynamicParameters();
+ DataTable dt0, dt;
+ List<ExcelErro> list = new List<ExcelErro>();
+ List<DataTable> excelTable = new List<DataTable>();
+ list = ImportExcel.ExcelToTableListErro(FileCode); //楠岃瘉Excel鏁版嵁蹇呭~瀛楁鏄惁涓虹┖銆佸敮涓�瀛楁鏄惁閲嶅
+ excelTable = ImportExcel.ExcelToTableList(FileCode); //鑾峰彇Excel鏁版嵁
+ //Excel鏌ヨ姣嶄欢+鐗堟湰鍙锋槸鍚﹂噸澶�
+ DataTable distinct = excelTable[0].DefaultView.ToTable(true, new string[] { "姣嶄欢缂栫爜", "鐗堟湰鍙�" });
+ if (distinct.Rows.Count != excelTable[0].Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{鐗堟湰鍙穧";
+ erro.ErrorCont = "Bom姣嶄欢琛�:{姣嶄欢缂栫爜}瀵瑰簲鐨剓鐗堟湰鍙穧鏈夐噸澶�";
+ list.Add(erro);
+ }
+ //鍒ゆ柇瀛愯〃澶栭敭涓嶅瓨鍦ㄤ簬涓昏〃涓婚敭涓殑鏁版嵁
+ var dt3 = from r in excelTable[1].AsEnumerable()
+ where !(
+ from rr in excelTable[0].AsEnumerable()
+ select rr.Field<string>("搴忓彿")
+ ).Contains(r.Field<string>("涓昏〃搴忓垪鍙�"))
+ select r;
+ List<DataRow> listRow = dt3.ToList();
+ if (listRow.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{涓昏〃搴忓垪鍙穧";
+ erro.ErrorCont = "瀛愪欢淇℃伅:{涓昏〃搴忓垪鍙穧瀛楁涓湁鍊煎湪姣嶄欢淇℃伅:{搴忓彿}涓笉瀛樺湪";
+ list.Add(erro);
+ }
+ //鏁版嵁搴撴煡璇㈡瘝浠�+鐗堟湰鍙锋槸鍚﹀瓨鍦�
+ for (int j = 0; j < excelTable[0].Rows.Count; j++)
+ {
+ if (excelTable[0].Rows[j][1].ToString().Trim() != null && excelTable[0].Rows[j][1].ToString().Trim() != "")
+ {
+ //鍒ゆ柇姣嶄欢鍦ㄥ瓨璐т腑鏄惁瀛樺湪
+ sql = @"select * from TMateriel_Info where partcode=@partcode";
+ dynamicParams.Add("@partcode", excelTable[0].Rows[j][1].ToString().Trim());
+ dt0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt0.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{姣嶄欢缂栫爜}";
+ erro.ErrorCont = "Bom姣嶄欢琛�:{姣嶄欢缂栫爜}瀛楁" + excelTable[0].Rows[j][1].ToString().Trim() + "鍦ㄥ瓨璐ф。妗堜腑涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+
+ sql = @"select * from TBom_Main where materiel_code=@code and version=@version";
+ dynamicParams.Add("@code", excelTable[0].Rows[j][1].ToString().Trim());
+ dynamicParams.Add("@version", excelTable[0].Rows[j][5].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{姣嶄欢缂栫爜}";
+ erro.ErrorCont = "Bom姣嶄欢琛�:{姣嶄欢缂栫爜}瀛楁" + excelTable[0].Rows[j][1].ToString().Trim() + "瀵瑰簲鐨勭増鏈彿:" + excelTable[0].Rows[j][5].ToString() + "宸插瓨鍦�";
+ list.Add(erro);
+ }
+ //鏌ヨ姣嶄欢淇℃伅瀵瑰簲鐨勫瓙浠朵俊鎭�
+ var var_dtTable = excelTable[1].AsEnumerable().Where<DataRow>(W => W["涓昏〃搴忓垪鍙�"].ToString() == excelTable[0].Rows[j][0].ToString().Trim());
+ DataTable ds = var_dtTable.Any() ? var_dtTable.CopyToDataTable() : excelTable[1].Clone();
+ if (ds.Rows.Count > 0)
+ {
+ //鍒ゆ柇鍚屾瘝浠跺搴旂殑瀛愪欢鏄惁閲嶅
+ DataTable distinct1 = ds.DefaultView.ToTable(true, "瀛愪欢缂栫爜");
+ if (distinct1.Rows.Count != ds.Rows.Count)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{瀛愪欢缂栫爜}";
+ erro.ErrorCont = "鐗╂枡娓呭崟瀵瑰簲瀛愪欢淇℃伅椤电妯℃澘:涓昏〃搴忓垪鍙凤細銆�" + excelTable[1].Rows[j]["涓昏〃搴忓垪鍙�"].ToString() + "銆戝搴攞瀛愪欢缂栫爜}鏈夐噸澶�";
+ list.Add(erro);
+ }
+ }
+ else
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{涓昏〃搴忓垪鍙穧";
+ erro.ErrorCont = "鐗╂枡娓呭崟瀵瑰簲瀛愪欢淇℃伅椤电妯℃澘:{涓昏〃搴忓垪鍙穧:" + excelTable[1].Rows[j][1].ToString().Trim() + " 鍦ㄦ瘝浠朵俊鎭〉绛炬ā鏉夸腑涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ //瀛愪欢鍒ゆ柇
+ for (int k = 0; k < excelTable[1].Rows.Count; k++)
+ {
+ if (excelTable[1].Rows[k][3].ToString().Trim() != null && excelTable[1].Rows[k][3].ToString().Trim() != "")
+ {
+ sql = @"select * from TMateriel_Info where partcode=@partcode";
+ dynamicParams.Add("@partcode", excelTable[1].Rows[k][3].ToString().Trim());
+ dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count <= 0)
+ {
+ ExcelErro erro = new ExcelErro();
+ erro.RoeNumber = "/";
+ erro.ErrorField = "{瀛愪欢缂栫爜}";
+ erro.ErrorCont = "鐗╂枡娓呭崟瀛愪欢淇℃伅:{瀛愪欢缂栫爜}瀛楁" + excelTable[1].Rows[k][3].ToString().Trim() + "鍦ㄥ瓨璐ф。妗堜腑涓嶅瓨鍦�";
+ list.Add(erro);
+ }
+ }
+ }
+ if (list.Count > 0)
+ {
+ int index = 0;
+ foreach (ExcelErro item in list)
+ {
+ index++;
+ item.Seq = index.ToString();
+ }
+ StuCode = "301";
+ message = "鏁版嵁楠岃瘉澶辫触";
+ }
+ else
+ {
+ StuCode = "200";
+ message = "鏁版嵁楠岃瘉鎴愬姛";
+ count = excelTable[0].Rows.Count + excelTable[1].Rows.Count;
+ }
+ return list;
+ }
+ #endregion
+ #endregion
+
+ #region[Excel涓婁紶鏁版嵁鎻愪氦]
+ #region銆怑xcel鏁版嵁涓婁紶,缁勭粐鏋舵瀯銆�
+ public static string ZerroSubmit(string FileCode, string User, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ string ZZName = "", Enable = "", WageType = "";
+ DataTable dt;
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ List<DataTable> excelTable = new List<DataTable>();
+ excelTable = ImportExcel.ExcelToTableList(FileCode);
+ //瀵煎叆瑙掕壊绫诲瀷
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ sql = @"insert into TRoleType(roletype_code,roletype_name,torg_code)
+ values(@roletype_code,@roletype_name,@torg_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ roletype_code = excelTable[0].Rows[k][2].ToString().Trim(),
+ roletype_name = excelTable[0].Rows[k][3].ToString().Trim(),
+ torg_code = excelTable[0].Rows[k][1].ToString().Trim()
+ }
+ });
+ }
+ //瀵煎叆瑙掕壊
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ sql = @"insert into TRole(role_code,role_name,roletype_code,description,lm_user,lm_date,torg_code)
+ values(@role_code,@role_name,@roletype_code,@description,@Operator,@CreateDate,@torg_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ role_code = excelTable[1].Rows[i][2].ToString().Trim(),
+ role_name = excelTable[1].Rows[i][3].ToString().Trim(),
+ roletype_code = excelTable[1].Rows[i][4].ToString().Trim(),
+ description = excelTable[1].Rows[i][5].ToString().Trim(),
+ Operator = User,
+ CreateDate = DateTime.Now.ToString(),
+ torg_code = excelTable[1].Rows[i][1].ToString().Trim()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,宀椾綅绠$悊銆�
+ public static string OneSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆宀椾綅
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ sql = @"insert into TPost(postcode,postname,status,description,lm_user,lm_date)
+ values(@postcode,@postname,@status,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ postcode = excelTable[0].Rows[i][0].ToString().Trim(),
+ postname = excelTable[0].Rows[i][1].ToString().Trim(),
+ status = excelTable[0].Rows[i][2].ToString().Trim(),
+ description = excelTable[0].Rows[i][3].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,鍒嗙粍绠$悊銆�
+ public static string TwoSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆鐝粍
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ sql = @"insert into TGroup(usergroupcode,usergroupname,status,description,lm_user,lm_date)
+ values(@usergroupcode,@usergroupname,@status,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ usergroupcode = excelTable[0].Rows[i][0].ToString().Trim(),
+ usergroupname = excelTable[0].Rows[i][1].ToString().Trim(),
+ status = excelTable[0].Rows[i][2].ToString().Trim(),
+ description = excelTable[0].Rows[i][3].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,浜哄憳绠$悊銆�
+ public static string ThreeSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ DataTable dt;
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆鐢ㄦ埛
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ //sql = @"select * from TUser where usercode=@usercode";
+ //dynamicParams.Add("@usercode", excelTable[1].Rows[i][1].ToString().Trim());
+ //dt = DapperHelper.selectdata(sql, dynamicParams);
+ //if (dt.Rows.Count > 0)
+ //{
+ // continue;
+ //}
+ string Type = "";
+ switch (excelTable[0].Rows[i][3].ToString().Trim())
+ {
+ case "璁′欢":
+ Type = "S";
+ break;
+ case "璁℃椂":
+ Type = "T";
+ break;
+ case "鍥哄畾":
+ Type = "M";
+ break;
+ default:
+ break;
+ }
+ sql = @"insert into TUser(usercode,username,password,payrate,status,mobile,email,storg_code,post_code,role_code,group_code,is_system_admin,lm_user,lm_date)
+ values(@usercode,@username,@password,@payrate,@status,@mobile,@email,@storg_code,@post_code,@role_code,@group_code,@is_system_admin,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ usercode = excelTable[0].Rows[i][0].ToString().Trim(),
+ username = excelTable[0].Rows[i][1].ToString().Trim(),
+ password = excelTable[0].Rows[i][2].ToString().Trim(),
+ payrate = Type,
+ status = excelTable[0].Rows[i][4].ToString().Trim(),
+ mobile = excelTable[0].Rows[i][5].ToString().Trim(),
+ email = excelTable[0].Rows[i][6].ToString().Trim(),
+ storg_code = excelTable[0].Rows[i][7].ToString().Trim(),
+ post_code = excelTable[0].Rows[i][8].ToString().Trim(),
+ role_code = excelTable[0].Rows[i][9].ToString().Trim(),
+ group_code = excelTable[0].Rows[i][10].ToString().Trim(),
+ is_system_admin = "N",
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,瑙掕壊绠$悊銆�
+ public static string FourSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "", datarange = "", datapermissions = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆瑙掕壊
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ //if (excelTable[0].Rows[i][3].ToString().Trim() != null && excelTable[0].Rows[i][3].ToString().Trim() != "")
+ //{
+ // //鏁版嵁鑼冨洿
+ // switch (excelTable[0].Rows[i][3].ToString().Trim())
+ // {
+ // case "鍏ㄩ儴":
+ // datarange = "ALL";
+ // break;
+ // case "鏈骇":
+ // datarange = "LEVEL";
+ // break;
+ // case "鏈汉":
+ // datarange = "PERSON";
+ // break;
+ // case "鑷畾涔�":
+ // datarange = "CUSTOM";
+ // datapermissions = excelTable[0].Rows[i][4].ToString().Trim();
+ // break;
+ // default:
+ // break;
+ // }
+ //}
+
+ sql = @"insert into TRole(rolecode,rolename,status,datarange,datapermissions,identifying,description,lm_user,lm_date)
+ values(@rolecode,@rolename,@status,@datarange,@datapermissions,@identifying,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ rolecode = excelTable[0].Rows[i][0].ToString().Trim(),
+ rolename = excelTable[0].Rows[i][1].ToString().Trim(),
+ status = excelTable[0].Rows[i][2].ToString().Trim(),
+ datarange = "ALL",
+ datapermissions = datapermissions,
+ identifying = "2",
+ description = excelTable[0].Rows[i][3].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,寰�鏉ュ崟浣嶃��
+ public static string FiveSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆寰�鏉ュ崟浣嶇被鍨�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ sql = @"insert into TCustomerType(code,name,idparent,lm_user,lm_date,data_sources)
+ values(@code,@name,@idparent,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ idparent = excelTable[0].Rows[k][2].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = "MES"
+ }
+ });
+ }
+ //瀵煎叆寰�鏉ュ崟浣�
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ sql = @"insert into TCustomer(code,name,status,conttacts,conttphone,addr,customertype,lm_user,lm_date,data_sources)
+ values(@code,@name,@status,@conttacts,@conttphone,@addr,@customertype,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[1].Rows[i][0].ToString().Trim(),
+ name = excelTable[1].Rows[i][1].ToString().Trim(),
+ status = excelTable[1].Rows[i][2].ToString().Trim(),
+ customertype = excelTable[1].Rows[i][3].ToString().Trim(),
+ conttacts = excelTable[1].Rows[i][4].ToString().Trim(),
+ conttphone = excelTable[1].Rows[i][5].ToString().Trim(),
+ addr = excelTable[1].Rows[i][6].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = "MES"
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,浠撳簱璁剧疆銆�
+ public static string SixSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆浠撳簱
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ sql = @"insert into TSecStck(code,name,status,ishasPosition,description,lm_user,lm_date,data_sources)
+ values(@code,@name,@status,@ishasPosition,@description,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[i][0].ToString().Trim(),
+ name = excelTable[0].Rows[i][1].ToString().Trim(),
+ status = excelTable[0].Rows[i][2].ToString().Trim(),
+ ishasPosition = excelTable[0].Rows[i][3].ToString().Trim(),
+ description = excelTable[0].Rows[i][4].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = "MES"
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,搴撲綅璁剧疆銆�
+ public static string SevenSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆搴撲綅
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ string status = "";
+ if (excelTable[0].Rows[i][4].ToString().Trim() != null && excelTable[0].Rows[i][4].ToString().Trim() != "")
+ {
+ switch (excelTable[0].Rows[i][3].ToString().Trim())
+ {
+ case "姝e父":
+ status = "Y";
+ break;
+ case "鍋滅敤":
+ status = "N";
+ break;
+ default:
+ break;
+ }
+ }
+ sql = @"insert into TSecLoca(code,name,idwarehouse,idparent,status,description,lm_user,lm_date,data_sources)
+ values(@code,@name,@idwarehouse,@idparent,@status,@description,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[i][0].ToString().Trim(),
+ name = excelTable[0].Rows[i][1].ToString().Trim(),
+ idwarehouse = excelTable[0].Rows[i][2].ToString().Trim(),
+ idparent = excelTable[0].Rows[i][3].ToString().Trim(),
+ status = status,
+ description = excelTable[0].Rows[i][5].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = "MES"
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,瀛樿揣妗f銆�
+ public static string EightSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆瀛樿揣绫诲瀷
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ sql = @"insert into TMateriel_Class(code,name,idparent,lm_user,lm_date,data_sources)
+ values(@code,@name,@idparent,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ idparent = excelTable[0].Rows[k][2].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = "MES"
+ }
+ });
+ }
+ //瀵煎叆瀛樿揣妗f
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ string idunitgroup = "", idunit = "", idnounit = "";
+ int isSingleUnit = 0;
+ if (excelTable[1].Rows[i][5].ToString().Trim() == "S")
+ {
+ isSingleUnit = 1;
+ sql = @"select * from TUnit where name=@name and isSingleUnit='1'";
+ dynamicParams.Add("@name", excelTable[1].Rows[i][6].ToString().Trim());
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ idunit = dt.Rows[0]["code"].ToString();
+ }
+ if (excelTable[1].Rows[i][5].ToString().Trim() == "M")
+ {
+ sql = @"select T.code,T.name,T.isMainUnit from TUnitGroup G
+ inner join TUnit T on G.code=T.idunitgroup
+ where G.name=@name";
+ dynamicParams.Add("@name", excelTable[1].Rows[i][6].ToString().Trim());
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ idunitgroup = dt.Rows[0]["groupcode"].ToString();
+ idunit = dt.AsEnumerable().Where(row => row.Field<string>("isMainUnit") == "1").Select(row => row.Field<string>("code")).FirstOrDefault();
+ idnounit = dt.AsEnumerable().Where(row => row.Field<string>("isMainUnit") == "0").Select(row => row.Field<string>("code")).FirstOrDefault();
+ }
+
+ sql = @"insert into TMateriel_Info(partcode,partname,partspec,idunit,idunitgroup,isSingleUnit,idSubUnitByReport,idUnitByStock,
+ idUnitByPurchase,idUnitBySale,idunitbymanufacture,idinventoryclass,isPurchase,isSale,isMadeSelf,isMaterial,isMadeRequest,
+ idwarehouse,status,lm_user,lm_date,data_sources)
+ values(@partcode,@partname,@partspec,@idunit,@idunitgroup,@isSingleUnit,@idSubUnitByReport,@idUnitByStock,
+ @idUnitByPurchase,@idUnitBySale,@idunitbymanufacture,@idinventoryclass,@isPurchase,@isSale,@isMadeSelf,@isMaterial,@isMadeRequest,
+ @idwarehouse,@status,@lm_user,@lm_date,@data_sources)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = excelTable[1].Rows[i][0].ToString().Trim(),
+ partname = excelTable[1].Rows[i][1].ToString().Trim(),
+ partspec = excelTable[1].Rows[i][2].ToString().Trim(),
+ idunit = idunit,
+ idunitgroup = idunitgroup,
+ isSingleUnit = isSingleUnit,
+ idSubUnitByReport = idnounit,
+ idUnitByStock = idunit,
+ idUnitByPurchase = idunit,
+ idUnitBySale = idunit,
+ idunitbymanufacture = idunit,
+ idinventoryclass = excelTable[1].Rows[i][3].ToString().Trim(),
+ isPurchase = excelTable[1].Rows[i][8].ToString().Trim(),
+ isSale = excelTable[1].Rows[i][9].ToString().Trim(),
+ isMadeSelf = excelTable[1].Rows[i][10].ToString().Trim(),
+ isMaterial = excelTable[1].Rows[i][11].ToString().Trim(),
+ isMadeRequest = excelTable[1].Rows[i][12].ToString().Trim(),
+ idwarehouse = excelTable[1].Rows[i][7].ToString().Trim(),
+ status = excelTable[1].Rows[i][4].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ data_sources = "MES"
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,璁惧娓呭崟銆�
+ public static string NineSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆璁惧绫诲瀷
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ sql = @"insert into TEqpType(code,name,lm_user,lm_date,remark)
+ values(@code,@name,@lm_user,@lm_date,@remark)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString(),
+ remark = excelTable[0].Rows[k][2].ToString().Trim()
+ }
+ });
+ }
+ //瀵煎叆璁惧
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ sql = @"insert into TEqpInfo(code,name,torg_code,eqptype_code,operation_ration,enable,opc_uom,lm_user,lm_date)
+ values(@code,@name,@torg_code,@eqptype_code,@operation_ration,@enable,@opc_uom,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[1].Rows[i][0].ToString().Trim(),
+ name = excelTable[1].Rows[i][1].ToString().Trim(),
+ torg_code = excelTable[1].Rows[i][2].ToString().Trim(),
+ eqptype_code = excelTable[1].Rows[i][3].ToString().Trim(),
+ operation_ration = "100",
+ enable = excelTable[1].Rows[i][4].ToString().Trim(),
+ opc_uom = "鍙�",
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,璁惧鐐规椤圭洰銆�
+ public static string TenSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆璁惧鐐规椤圭洰琛�
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ string Type = "", IsScan = "";
+ switch (excelTable[0].Rows[i][2].ToString().Trim())
+ {
+ case "骞�":
+ Type = "Y";
+ break;
+ case "瀛�":
+ Type = "S";
+ break;
+ case "鏈�":
+ Type = "M";
+ break;
+ case "鍛�":
+ Type = "W";
+ break;
+ case "鏃�":
+ Type = "D";
+ break;
+ default:
+ break;
+ }
+ switch (excelTable[0].Rows[i][3].ToString().Trim())
+ {
+ case "鏄�":
+ IsScan = "Y";
+ break;
+ case "鍚�":
+ IsScan = "N";
+ break;
+ default:
+ break;
+ }
+ sql = @"insert into TEqpchk_Item(code,name,description,isscan,cycle,lm_user,lm_date)
+ values(@code,@name,@descr,@isscan,@cycle,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[i][0].ToString().Trim(),
+ name = excelTable[0].Rows[i][1].ToString().Trim(),
+ descr = excelTable[0].Rows[i][4].ToString().Trim(),
+ isscan = IsScan,
+ cycle = Type,
+ Operator = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,璁惧鐐规鏍囧噯銆�
+ public static string Ten_oneSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆璁惧鐐规鏍囧噯涓昏〃
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ sql = @"insert into TEqpchk_Main(code,name,description,iscontr,lm_user,lm_date)
+ values(@code,@name,@description,@iscontr,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ iscontr = excelTable[0].Rows[k][2].ToString().Trim(),
+ description = excelTable[0].Rows[k][3].ToString().Trim(),
+ CreateDate = DateTime.Now.ToString(),
+ Operator = us.usercode
+ }
+ });
+ }
+ //瀵煎叆璁惧鐐规鏍囧噯閮ㄤ綅瀛愯〃
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ string Type = "";
+ switch (excelTable[1].Rows[i][6].ToString().Trim())
+ {
+ case "鏃�":
+ Type = "D";
+ break;
+ default:
+ break;
+ }
+ sql = @"insert into TEqpchk_Deta(seq,code,name,eqpchk_main_code,chkdesc,isscan,cycle,lm_user,lm_date)
+ values(@seq,@code,@name,@eqpchk_main_code,@description,@isscan,@cycle,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ seq = excelTable[1].Rows[i][1].ToString().Trim(),
+ code = excelTable[1].Rows[i][2].ToString().Trim(),
+ name = excelTable[1].Rows[i][3].ToString().Trim(),
+ eqpchk_main_code = excelTable[1].Rows[i][0].ToString().Trim(),
+ description = excelTable[1].Rows[i][4].ToString().Trim(),
+ isscan = excelTable[1].Rows[i][5].ToString().Trim(),
+ cycle = Type,
+ Operator = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,璁惧淇濆吇椤圭洰銆�
+ public static string ElevenSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆璁惧鐐规椤圭洰琛�
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ string IsScan = "";
+ switch (excelTable[0].Rows[i][2].ToString().Trim())
+ {
+ case "鏄�":
+ IsScan = "Y";
+ break;
+ case "鍚�":
+ IsScan = "N";
+ break;
+ default:
+ break;
+ }
+ sql = @"insert into TEqpmai_Item(code,name,description,isscan,cycle,lm_user,lm_date)
+ values(@code,@name,@descr,@isscan,@cycle,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[i][0].ToString().Trim(),
+ name = excelTable[0].Rows[i][1].ToString().Trim(),
+ descr = excelTable[0].Rows[i][3].ToString().Trim(),
+ isscan = IsScan,
+ cycle = "",
+ Operator = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,璁惧淇濆吇鏍囧噯銆�
+ public static string Eleven_oneSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆璁惧淇濆吇鏍囧噯涓昏〃
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ string Type = "";
+ switch (excelTable[0].Rows[k][2].ToString().Trim())
+ {
+ case "骞�":
+ Type = "Y";
+ break;
+ case "瀛�":
+ Type = "S";
+ break;
+ case "鏈�":
+ Type = "M";
+ break;
+ case "鍛�":
+ Type = "W";
+ break;
+ default:
+ break;
+ }
+ sql = @"insert into TEqpmai_Main(code,name,description,main_cycle,lm_user,lm_date)
+ values(@code,@name,@description,@main_cycle,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ main_cycle = Type,
+ description = excelTable[0].Rows[k][3].ToString().Trim(),
+ CreateDate = DateTime.Now.ToString(),
+ Operator = us.usercode
+ }
+ });
+ }
+ //瀵煎叆璁惧淇濆吇鏍囧噯閮ㄤ綅瀛愯〃
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ sql = @"insert into TEqpmai_Deta(seq,code,name,eapmai_code,chk_desc,isscan,lm_user,lm_date)
+ values(@seq,@code,@name,@eapmai_code,@description,@isscan,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ seq = excelTable[1].Rows[i][1].ToString().Trim(),
+ code = excelTable[1].Rows[i][2].ToString().Trim(),
+ name = excelTable[1].Rows[i][3].ToString().Trim(),
+ eapmai_code = excelTable[1].Rows[i][0].ToString().Trim(),
+ description = excelTable[1].Rows[i][4].ToString().Trim(),
+ isscan = excelTable[1].Rows[i][5].ToString().Trim(),
+ Operator = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,妯″叿娓呭崟銆�
+ public static string TwelveSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆妯″叿娓呭崟
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ sql = @"insert into TMouldInfo(code,name,spec,status,surp_life,resi_life,lm_user,lm_date,warehousecode,location_code)
+ values(@code,@name,@spec,@status,@surp_life,@resi_life,@lm_user,@lm_date,@warehousecode,@location_code)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ spec = excelTable[0].Rows[k][2].ToString().Trim(),
+ status = excelTable[0].Rows[k][3].ToString().Trim(),
+ warehousecode = excelTable[0].Rows[k][4].ToString().Trim(),
+ location_code = excelTable[0].Rows[k][5].ToString().Trim(),
+ surp_life = decimal.Parse(excelTable[0].Rows[k][6].ToString().Trim() == "" ? "0" : excelTable[0].Rows[k][6].ToString().Trim()),
+ resi_life = decimal.Parse(excelTable[0].Rows[k][7].ToString().Trim() == "" ? "0" : excelTable[0].Rows[k][7].ToString().Trim()),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //鍐欏叆妯″叿鍏宠仈浜у搧琛�
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ sql = @"insert into TMouldInfoPart(mouldcode,partcode,lm_user,lm_date)
+ values(@mouldcode,@partcode,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ mouldcode = excelTable[1].Rows[i][0].ToString().Trim(),
+ partcode = excelTable[1].Rows[i][1].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,妯″叿鐐规椤圭洰銆�
+ public static string ThirteenSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆妯″叿鐐规椤圭洰琛�
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ sql = @"insert into TMouldchk_Item(code,name,description,lm_user,lm_date)
+ values(@code,@name,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[i][0].ToString().Trim(),
+ name = excelTable[0].Rows[i][1].ToString().Trim(),
+ description = excelTable[0].Rows[i][2].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,妯″叿鐐规鏍囧噯銆�
+ public static string Thirteen_oneSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆妯″叿鐐规鏍囧噯涓昏〃
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ sql = @"insert into TMouldchk_Main(code,name,description,lm_user,lm_date)
+ values(@code,@name,@description,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ description = excelTable[0].Rows[k][2].ToString().Trim(),
+ CreateDate = DateTime.Now.ToString(),
+ Operator = us.usercode
+ }
+ });
+ }
+ //瀵煎叆妯″叿鐐规鏍囧噯鍏宠仈鐐规椤瑰瓙琛�
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ sql = @"insert into TMouldchk_Deta(seq,code,name,mouldchk_main_code,chkdesc,lm_user,lm_date)
+ values(@seq,@code,@name,@mouldchk_main_code,@description,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ seq = excelTable[1].Rows[i][1].ToString().Trim(),
+ code = excelTable[1].Rows[i][2].ToString().Trim(),
+ name = excelTable[1].Rows[i][3].ToString().Trim(),
+ mouldchk_main_code = excelTable[1].Rows[i][0].ToString().Trim(),
+ description = excelTable[1].Rows[i][4].ToString().Trim(),
+ Operator = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,妯″叿淇濆吇椤圭洰銆�
+ public static string FourteenSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆妯″叿淇濆吇椤圭洰琛�
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ sql = @"insert into TMouldmai_Item(code,name,description,lm_user,lm_date)
+ values(@code,@name,@description,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[i][0].ToString().Trim(),
+ name = excelTable[0].Rows[i][1].ToString().Trim(),
+ description = excelTable[0].Rows[i][2].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,妯″叿淇濆吇鏍囧噯銆�
+ public static string Fourteen_oneSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆妯″叿淇濆吇鏍囧噯涓昏〃
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ sql = @"insert into TMouldmai_Main(code,name,description,lm_user,lm_date)
+ values(@code,@name,@description,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ description = excelTable[0].Rows[k][2].ToString().Trim(),
+ CreateDate = DateTime.Now.ToString(),
+ Operator = us.usercode
+ }
+ });
+ }
+ //瀵煎叆妯″叿淇濆吇鏍囧噯鍏宠仈淇濆吇椤瑰瓙琛�
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ sql = @"insert into TMouldmai_Deta(seq,code,name,mouldmai_main_code,chkdesc,lm_user,lm_date)
+ values(@seq,@code,@name,@mouldmai_main_code,@description,@Operator,@CreateDate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ seq = excelTable[1].Rows[i][1].ToString().Trim(),
+ code = excelTable[1].Rows[i][2].ToString().Trim(),
+ name = excelTable[1].Rows[i][3].ToString().Trim(),
+ mouldmai_main_code = excelTable[1].Rows[i][0].ToString().Trim(),
+ description = excelTable[1].Rows[i][4].ToString().Trim(),
+ Operator = us.usercode,
+ CreateDate = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,宸ュ簭瀹氫箟銆�
+ public static string FifteenSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆宸ュ簭
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ sql = @"insert into TStep(stepcode,stepname,enable,descr,flwtype,lm_user,lm_date)
+ values(@stepcode,@stepname,@enable,@descr,@flwtype,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ stepcode = excelTable[0].Rows[i][0].ToString().Trim(),
+ stepname = excelTable[0].Rows[i][1].ToString().Trim(),
+ enable = excelTable[0].Rows[i][3].ToString().Trim(),
+ descr = excelTable[0].Rows[i][4].ToString().Trim(),
+ flwtype = excelTable[0].Rows[i][2].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,宸ヨ壓璺嚎銆�
+ public static string SixteenSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆宸ヨ壓璺嚎琛�
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ string status = "";
+ switch (excelTable[0].Rows[k][2].ToString().Trim())
+ {
+ case "鏄�":
+ status = "Y";
+ break;
+ case "鍚�":
+ status = "N";
+ break;
+ default:
+ break;
+ }
+ sql = @"insert into TFlw_Rout(code,name,description,enable,lm_user,lm_date)
+ values(@code,@name,@description,@enable,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[k][0].ToString().Trim(),
+ name = excelTable[0].Rows[k][1].ToString().Trim(),
+ enable = status,
+ description = excelTable[0].Rows[k][3].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ //瀵煎叆宸ヨ壓璺嚎鍏宠仈宸ュ簭琛�
+ for (int i = 0; i < excelTable[1].Rows.Count; i++)
+ {
+ sql = @"insert into TFlw_Rtdt(rout_code,step_code,seq,first_choke,last_choke,lm_user,lm_date)
+ values(@rout_code,@step_code,@seq,@first_choke,@last_choke,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ rout_code = excelTable[1].Rows[i][0].ToString().Trim(),
+ step_code = excelTable[1].Rows[i][1].ToString().Trim(),
+ seq = excelTable[1].Rows[i][2].ToString().Trim(),
+ first_choke = excelTable[1].Rows[i][3].ToString().Trim(),
+ last_choke = excelTable[1].Rows[i][4].ToString().Trim(),
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,鑺傛媿宸ヤ环銆�
+ public static string TwentyFourSubmit(string FileCode, string User, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ DataTable excelTable = new DataTable();
+ excelTable = ImportExcel.ExcelToTable(FileCode);
+ //瀵煎叆璁惧鐐规椤圭洰琛�
+ for (int i = 0; i < excelTable.Rows.Count; i++)
+ {
+ string partcode = "", routecode = "", stepcode = "", eqpcode = "", wkspcode = "";
+ //鏌ヨ浜у搧缂栫爜
+ sql = @"select partcode from TMateriel_Info
+ where partname=@partname";
+ dynamicParams.Add("@partname", excelTable.Rows[i][1].ToString().Trim());
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ partcode = data.Rows[0]["partcode"].ToString();
+ }
+ else
+ {
+ StuCode = "浜у搧鍚嶇О锛氥��" + excelTable.Rows[i][1].ToString().Trim() + "銆戝搴旂紪鐮佷笉瀛樺湪锛�";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ //鏌ヨ宸ヨ壓璺嚎缂栫爜
+ sql = @"select code from TFlw_Rout
+ where name=@routename";
+ dynamicParams.Add("@routename", excelTable.Rows[i][2].ToString().Trim());
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ routecode = data0.Rows[0]["code"].ToString();
+ }
+ else
+ {
+ StuCode = "宸ヨ壓璺嚎鍚嶇О锛氥��" + excelTable.Rows[i][2].ToString().Trim() + "銆戝搴旂紪鐮佷笉瀛樺湪锛�";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ //鏌ヨ宸ュ簭缂栫爜
+ sql = @"select stepcode from TStep
+ where stepname=@stepname";
+ dynamicParams.Add("@stepname", excelTable.Rows[i][3].ToString().Trim());
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ stepcode = data1.Rows[0]["stepcode"].ToString();
+ }
+ else
+ {
+ StuCode = "宸ュ簭鍚嶇О锛氥��" + excelTable.Rows[i][3].ToString().Trim() + "銆戝搴旂紪鐮佷笉瀛樺湪锛�";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ //鏌ヨ璁惧缂栫爜
+ sql = @"select code from TEqpInfo
+ where name=@eqpname";
+ dynamicParams.Add("@eqpname", excelTable.Rows[i][4].ToString().Trim());
+ var data4 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data4.Rows.Count > 0)
+ {
+ eqpcode = data4.Rows[0]["code"].ToString();
+ }
+ else
+ {
+ StuCode = "璁惧鍚嶇О锛氥��" + excelTable.Rows[i][4].ToString().Trim() + "銆戝搴旂紪鐮佷笉瀛樺湪锛�";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ //鏌ヨ杞﹂棿缂栫爜
+ sql = @"select wksp_code from TEqpInfo
+ where name=@eqpname";
+ dynamicParams.Add("@eqpname", excelTable.Rows[i][4].ToString().Trim());
+ var data5 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data5.Rows.Count > 0)
+ {
+ wkspcode = data5.Rows[0]["wksp_code"].ToString();
+ }
+ else
+ {
+ StuCode = "璁惧鍚嶇О锛氥��" + excelTable.Rows[i][4].ToString().Trim() + "銆戝搴旇溅闂寸紪鐮佷笉瀛樺湪锛�";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ //鏌ヨ宸ュ簭鑺傛媿琛ㄤ腑锛氫骇鍝�+宸ヨ壓璺嚎+宸ュ簭+璁惧鏄惁瀛樺湪
+ sql = @"select * from TPrteEqp_Stad
+ where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode and eqp_code=@eqpcode";
+ dynamicParams.Add("@partcode", partcode);
+ dynamicParams.Add("@routecode", routecode);
+ dynamicParams.Add("@stepcode", stepcode);
+ dynamicParams.Add("@eqpcode", eqpcode);
+ var data6 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data6.Rows.Count > 0)
+ {
+ sql = @"update TPrteEqp_Stad set stand_value=@stand_value,eqp_value=@eqp_value,cavity_qty=@cavity_qty,unprice=@unprice,lm_user=@username,lm_date=@userdate
+ where materiel_code=@partcode and route_code=@routecode and step_code=@stepcode and eqp_code=@eqpcode ";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = partcode,
+ routecode = routecode,
+ stepcode = stepcode,
+ eqpcode = eqpcode,
+ stand_value = excelTable.Rows[i][7].ToString().Trim(),
+ eqp_value = excelTable.Rows[i][6].ToString().Trim(),
+ cavity_qty = excelTable.Rows[i][8].ToString().Trim(),
+ unprice = excelTable.Rows[i][5].ToString().Trim(),
+ username = User,
+ userdate = DateTime.Now.ToString()
+ }
+ });
+ }
+ else
+ {
+ sql = @"insert into TPrteEqp_Stad(materiel_code,eqp_code,stand_value,route_code,unprice,eqp_value,cavity_qty,wkspcode,lm_user,lm_date,step_code)
+ values(@partcode,@eqpcode,@stand_value,@routecode,@unprice,@eqp_value,@cavity_qty,@wkspcode,@username,@userdate,@stepcode)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ partcode = partcode,
+ eqpcode = eqpcode,
+ stand_value = excelTable.Rows[i][7].ToString().Trim(),
+ routecode = routecode,
+ unprice = excelTable.Rows[i][5].ToString().Trim(),
+ eqp_value = excelTable.Rows[i][6].ToString().Trim(),
+ cavity_qty = excelTable.Rows[i][8].ToString().Trim(),
+ wkspcode = wkspcode,
+ username = User,
+ userdate = DateTime.Now.ToString(),
+ stepcode = stepcode
+ }
+ });
+ }
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,璐ㄦ鏍囧噯銆�
+ public static string SeventeenSubmit(string FileCode, string User, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ try
+ {
+
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,缂洪櫡瀹氫箟銆�
+ public static string EighteenSubmit(List<DataTable> excelTable, User us, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ string sql = "";
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ //瀵煎叆缂洪櫡
+ for (int i = 0; i < excelTable[0].Rows.Count; i++)
+ {
+ sql = @"insert into TDefect(code,name,description,is_step,lm_user,lm_date)
+ values(@code,@name,@description,@is_step,@lm_user,@lm_date)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ code = excelTable[0].Rows[i][0].ToString().Trim(),
+ name = excelTable[0].Rows[i][1].ToString().Trim(),
+ description = excelTable[0].Rows[i][2].ToString().Trim(),
+ is_step = "N",
+ lm_user = us.usercode,
+ lm_date = DateTime.Now.ToString()
+ }
+ });
+ }
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,鐢熶骇璁㈠崟銆�
+ public static string NineteenSubmit(string FileCode, string User, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ try
+ {
+
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,搴撳瓨鏌ヨ銆�
+ public static string TwentySubmit(string FileCode, string User, out string StuCode)
+ {
+ string message = "";
+ StuCode = "";
+ try
+ {
+
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #region銆怑xcel鏁版嵁涓婁紶,鐗╂枡娓呭崟銆�
+ public static string TwentyOneSubmit(string FileCode, string User, out string StuCode)
+ {
+ string message = ""; StuCode = "";
+ string sql = "";
+ int BomID = 0; //鏈�澶d
+ List<object> list = new List<object>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ list.Clear();
+ List<DataTable> excelTable = new List<DataTable>();
+ excelTable = ImportExcel.ExcelToTableList(FileCode);
+ //鑾峰彇涓昏〃褰撳墠鏈�澶D
+ BomID = DapperHelper.insertReturnId("TBom_Main");
+ //瀵煎叆Bom涓昏〃
+ for (int k = 0; k < excelTable[0].Rows.Count; k++)
+ {
+ BomID = BomID + 1;
+ sql = @"insert into TBom_Main(materiel_code,quantity,status,version,lm_user,lm_date,startdate)
+ values(@materiel_code,@quantity,@status,@version,@lm_user,@lm_date,@startdate)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ materiel_code = excelTable[0].Rows[k][1].ToString().Trim(),
+ quantity = excelTable[0].Rows[k][3].ToString().Trim(),
+ status = excelTable[0].Rows[k][4].ToString().Trim(),
+ version = excelTable[0].Rows[k][5].ToString().Trim(),
+ lm_user = User,
+ lm_date = DateTime.Now.ToString(),
+ startdate = DateTime.Now.ToString()
+ }
+ });
+ //鏌ヨ姣嶄欢淇℃伅瀵瑰簲鐨勫瓙浠朵俊鎭�
+ DataTable ds = excelTable[1].AsEnumerable().Where(item => item["涓昏〃搴忓垪鍙�"].ToString().Equals(excelTable[0].Rows[k][0].ToString())).CopyToDataTable();
+ //瀵煎叆Bom瀛愯〃
+ for (int i = 0; i < ds.Rows.Count; i++)
+ {
+ string Type = "";
+ switch (ds.Rows[i][9].ToString().Trim())
+ {
+ case "涓绘枡":
+ Type = "Z";
+ break;
+ case "杈呮枡":
+ Type = "F";
+ break;
+ default:
+ break;
+ }
+ sql = @"insert into TBom_Deta(m_id,seq,smateriel_code,base_quantity,loss_quantity,total_quantity,pn_type)
+ values(@m_id,@seq,@smateriel_code,@base_quantity,@loss_quantity,@total_quantity,@pn_type)";
+ list.Add(new
+ {
+ str = sql,
+ parm = new
+ {
+ m_id = BomID,
+ seq = ds.Rows[i][2].ToString().Trim(),
+ smateriel_code = ds.Rows[i][3].ToString().Trim(),
+ base_quantity = ds.Rows[i][6].ToString().Trim(),
+ loss_quantity = ds.Rows[i][7].ToString().Trim(),
+ total_quantity = ds.Rows[i][8].ToString().Trim(),
+ pn_type = Type
+ }
+ });
+ }
+ }
+
+ bool aa = DapperHelper.DoTransaction(list);
+ if (aa)
+ {
+ StuCode = "200";
+ message = "瀵煎叆鎴愬姛锛�";
+ }
+ else
+ {
+ StuCode = "300";
+ message = "瀵煎叆澶辫触锛�";
+ }
+ }
+ catch (Exception e)
+ {
+ StuCode = "300";
+ message = e.Message;
+ }
+ return message;
+ }
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/JPushManage.cs b/VueWebCoreApi/Tools/JPushManage.cs
new file mode 100644
index 0000000..f2465d4
--- /dev/null
+++ b/VueWebCoreApi/Tools/JPushManage.cs
@@ -0,0 +1,71 @@
+锘縰sing Jiguang.JPush;
+using Jiguang.JPush.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class JPushManage
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ private static JPushClient client = new JPushClient("502772cf67ff42b7b55c8a3f", "55f2881b7afde3e08e30da58"); //"鑷繁鐨刱ey", "鑷繁鐨凪asterSecret"
+ //List<string> registration_id, string title, string content
+
+ /// <summary>
+ /// 鎺ㄩ�佸埌涓汉,姣忔鎺ㄩ�佹渶澶�1000浜�
+ /// </summary>
+ /// <param name="username">璇锋眰鐢ㄦ埛</param>
+ /// <param name="wkshpcode">杞﹂棿缂栫爜</param>
+ /// <param name="eqpcode">璁惧缂栫爜</param>
+ /// <param name="json">鎻愪氦鐨勬暟鎹�</param>
+ public static ToMessage ExecutePushByUserId(string username, string wkshpcode, string eqpcode, List<AnDnDate> json)
+ {
+ try
+ {
+ for (int i = 0; i < json.Count; i++)
+ {
+ //List<string> registration_id = new List<string>();
+ List<string> alias = new List<string>();
+ string title = json[i].name.ToString(); //鏍囬
+ string content = "鏉ヨ嚜鐢ㄦ埛:" + username.ToString() + "鍐呭锛氳溅闂寸紪鍙�:銆�" + wkshpcode + "銆�,瀵瑰簲璁惧缂栧彿:銆�" + eqpcode + "銆�,鏃堕棿" + DateTime.Now.ToString("yyyy/MM/ddhh:mm:ss") + "鐨勬秷鎭�氱煡锛�"; //鍐呭
+ //registration_id = json[i].children.Select(x => x.rid).Distinct().ToList(); //鑾峰彇App闆嗘垚SDK鐢熸垚鐨凴id[ "111", "22" ] 鍘婚櫎閲嶅
+ alias = json[i].children.Select(x => x.alias).Distinct().ToList(); //鑾峰彇鍒悕[ "111", "22" ] 鍘婚櫎閲嶅
+ //audience : { "registration_id" : [ "111", "22" ]} 璁惧鏍囪瘑銆備竴娆℃帹閫佹渶澶� 1000 涓��
+ var pushPayload = new PushPayload()
+ {
+ Platform = new List<string> { "android" }, //鎺ㄩ�佸钩鍙拌缃�(蹇呭~)
+ //Audience = "{\"registration_id\" :" + Newtonsoft.Json.JsonConvert.SerializeObject(registration_id) + "}", //鎺ㄩ�佽澶囨寚瀹�(蹇呭~)
+ Audience = new { alias = alias.ToArray()}, //鎺ㄩ�佷汉鍛樻寚瀹�(蹇呭~)
+ Notification = new Notification
+ {
+ Android = new Android
+ {
+ Alert = content,
+ Title = title
+ },
+ },
+ Options = new Options
+ {
+ TimeToLive = 60//鍗曚綅绉�,鏈�澶у��10澶�
+ }
+ };
+
+ var response = client.SendPush(pushPayload);
+ mes.code = response.StatusCode.ToString();
+ mes.message = response.Content;
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Tools/JwtTools.cs b/VueWebCoreApi/Tools/JwtTools.cs
new file mode 100644
index 0000000..6320443
--- /dev/null
+++ b/VueWebCoreApi/Tools/JwtTools.cs
@@ -0,0 +1,133 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using JWT;
+using JWT.Algorithms;
+using JWT.Exceptions;
+using JWT.Serializers;
+using Newtonsoft.Json;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public static class JwtTools
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+ public static string Key = AppSetting.GetAppSetting("SigningKey");
+ public static double time =double.Parse(AppSetting.GetAppSetting("RedisKeyTimeCont"));
+ //public static string Key { get; set; } = "Hello World"; //涓嶈娉勫瘑
+ //鍔犲瘑
+ public static ToMessage Encode(Dictionary<string, object> payLoad, string key = null)
+ {
+ if (string.IsNullOrEmpty(key))
+ {
+ key = Key;
+ }
+
+ IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
+ IJsonSerializer serializer = new JsonNetSerializer();
+ IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
+ IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
+ //娣诲姞涓�涓狫wt鏃舵晥涓�
+ payLoad.Add("timeout", DateTime.Now.AddSeconds(time));
+ mes.code = "200";
+ mes.message = "鑾峰彇token鎴愬姛!";
+ mes.data= encoder.Encode(payLoad, key);
+ return mes;
+ }
+
+ //瑙e瘑(鏁版嵁绫诲瀷1)
+ public static Dictionary<string, object> Decode(string jwtstr, string key = null)
+ {
+ if (string.IsNullOrEmpty(key))
+ {
+ key = Key;
+ }
+ try
+ {
+ IJsonSerializer serializer = new JsonNetSerializer();
+ IDateTimeProvider provider = new UtcDateTimeProvider();
+ IJwtValidator validator = new JwtValidator(serializer, provider);
+ IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
+ IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
+ IJwtDecoder decoder = new JwtDecoder(serializer, validator, urlEncoder, algorithm);
+
+ var json = decoder.Decode(jwtstr, key, verify: true);//token涓轰箣鍓嶇敓鎴愮殑瀛楃涓�
+
+ //string---->Dictionary
+ //鎶婁竴涓瓧绗︿覆鍙嶅悜鐢熸垚瀵瑰簲鐨勫璞″唴瀹�
+ var result = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
+ if ((DateTime)result["timeout"] < DateTime.Now)
+ {
+ throw new Exception(message: "token宸茶繃鏈�,璇烽噸鏂扮櫥褰�");
+ }
+ result.Remove(key: "timeout");
+ return result;
+ }
+ catch (TokenExpiredException)
+ {
+
+ throw; //璇锋眰瓒呮椂
+ }
+ catch (SignatureVerificationException)
+ {
+ throw; //绛惧悕楠岃瘉澶辫触锛屾暟鎹彲鑳借绡℃敼
+ }
+ }
+ //瑙e瘑(鏁版嵁绫诲瀷2)
+ public static User Denocode(string jwtstr, string key = null)
+ {
+ if (string.IsNullOrEmpty(key))
+ {
+ key = Key;
+ }
+ try
+ {
+ IJsonSerializer serializer = new JsonNetSerializer();
+ IDateTimeProvider provider = new UtcDateTimeProvider();
+ IJwtValidator validator = new JwtValidator(serializer, provider);
+ IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
+ IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
+ IJwtDecoder decoder = new JwtDecoder(serializer, validator, urlEncoder, algorithm);
+
+ var json = decoder.Decode(jwtstr, key, verify: true);//token涓轰箣鍓嶇敓鎴愮殑瀛楃涓�
+
+ //string---->Dictionary
+ //鎶婁竴涓瓧绗︿覆鍙嶅悜鐢熸垚瀵瑰簲鐨勫璞″唴瀹�
+ User loginUser = JsonConvert.DeserializeObject<User>(json);
+ return loginUser;
+ }
+ catch (TokenExpiredException)
+ {
+
+ throw; //璇锋眰瓒呮椂
+ }
+ catch (SignatureVerificationException)
+ {
+ throw; //绛惧悕楠岃瘉澶辫触锛屾暟鎹彲鑳借绡℃敼
+ }
+ }
+
+ //鏍规嵁缁欏畾鍊艰幏鍙栭敭鍚�
+ public static K FindFirstValueByKey<K, V>(this Dictionary<K, V> dict, V val)
+ {
+ return dict.FirstOrDefault(entry =>
+ EqualityComparer<V>.Default.Equals(entry.Value, val)).Key;
+ }
+
+ //鏍规嵁缁欏畾閿悕鑾峰彇鍊�
+ public static V FindFirstKeyByValue<K,V>(this Dictionary<K, V> dict, K val)
+ {
+ return dict.FirstOrDefault(entry =>EqualityComparer<K>.Default.Equals(entry.Key, val)).Value;
+ }
+ //鏍¢獙鐧诲綍
+ //public static string key = "123456";
+ //public static string ValideLogined(HttpRequest req)
+ //{
+ // if (req.Headers["token"] == null)
+ // throw new Exception(message: "璇风櫥褰�!");
+ // return Decode(token: req.Headers["token"], key);
+ //}
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Tools/LogHelper.cs b/VueWebCoreApi/Tools/LogHelper.cs
new file mode 100644
index 0000000..eeae7c0
--- /dev/null
+++ b/VueWebCoreApi/Tools/LogHelper.cs
@@ -0,0 +1,101 @@
+锘縰sing Dapper;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class LogHelper
+ {
+ /// <summary>
+ /// 杈撳嚭鏃ュ織鍒癓og4Net
+ /// </summary>
+ /// <param name="ex"></param>
+ #region
+ public static void WriteLog(Exception ex)
+ {
+ string message = string.Format("娑堟伅绫诲瀷锛歿0}\r\n 娑堟伅鍐呭锛歿1}\r\n 寮曞彂寮傚父鐨勬柟娉曪細{2}\r\n 寮曞彂寮傚父鐨勫璞★細{3}",
+ ex.GetType().Name,
+ ex.Message,
+ ex.TargetSite,
+ ex.Source + ex.StackTrace);
+ log4net.ILog log = log4net.LogManager.GetLogger("鏃ュ織璁板綍");
+ log.Error(message);
+ }
+ #endregion
+
+ #region
+ public static void WriteLogData(string aa)
+ {
+ string message = string.Format("" + aa + "\r\n鏃堕棿锛歿0}"
+ , DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
+ log4net.ILog log = log4net.LogManager.GetLogger("鏃ュ織璁板綍");
+ log.Error(message);
+ }
+ #endregion
+
+ #region
+ public static void WriteLogData1(string aa)
+ {
+ string message = aa;
+ log4net.ILog log = log4net.LogManager.GetLogger("鏃ュ織璁板綍");
+ log.Error(message);
+ }
+ #endregion
+
+ #region
+ public static void WriteLogData2(string aa)
+ {
+ log4net.ILog log = log4net.LogManager.GetLogger("鏃ュ織璁板綍");
+ log.Error(JsonConvert.SerializeObject(aa));
+ }
+ #endregion
+
+ #region[灏嗘搷浣滃啓鍏ユ暟鎹〃璁板綍]
+ public static void DbOperateLog(string usercode, string oper_type, string description, string type)
+ {
+ var sql = "";
+ var cont = 0;
+ var dynamicParams = new DynamicParameters();
+ string message = string.Format("\r\n鐢ㄦ埛璐﹀彿锛歿0}\r\n鎿嶄綔鏃堕棿锛歿1}\r\n鎿嶄綔绫诲瀷锛歿2}\r\n鎿嶄綔鎻忚堪锛歿3}\r\n鎿嶄綔绔細{4}"
+ , usercode
+ , DateTime.Now.ToString()
+ , oper_type
+ , description
+ , type
+ );
+ log4net.ILog log = log4net.LogManager.GetLogger("鏃ュ織璁板綍");
+ log.Error(message);
+
+ sql = @"insert into TOperlog(usercode,oper_date,oper_type,description,operator_type)
+ values(@usercode,@oper_date,@oper_type,@description,@operator_type)";
+ dynamicParams.Add("@usercode", usercode);
+ dynamicParams.Add("@oper_date", DateTime.Now.ToString());
+ dynamicParams.Add("@oper_type", oper_type);
+ dynamicParams.Add("@description", description);
+ dynamicParams.Add("@operator_type", type);
+ cont = DapperHelper.SQL(sql, dynamicParams);
+
+
+ }
+ #endregion
+
+ #region[灏嗘搷浣滄棩蹇梋
+ public static void OperateLog(string usercode, string oper_type, string description, string type)
+ {
+ var dynamicParams = new DynamicParameters();
+ string message = string.Format("\r\n鐢ㄦ埛璐﹀彿锛歿0}\r\n鎿嶄綔鏃堕棿锛歿1}\r\n鎿嶄綔绫诲瀷锛歿2}\r\n鎿嶄綔鎻忚堪锛歿3}\r\n鎿嶄綔绔細{4}"
+ , usercode
+ , DateTime.Now.ToString()
+ , oper_type
+ , description
+ , type
+ );
+ log4net.ILog log = log4net.LogManager.GetLogger("鏃ュ織璁板綍");
+ log.Error(message);
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/NPOIHelper.cs b/VueWebCoreApi/Tools/NPOIHelper.cs
new file mode 100644
index 0000000..1ae2e24
--- /dev/null
+++ b/VueWebCoreApi/Tools/NPOIHelper.cs
@@ -0,0 +1,190 @@
+锘縰sing NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.OleDb;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class NPOIHelper
+ {
+ /// <summary>
+ /// NPOI绠�鍗旸emo锛屽揩閫熷叆闂ㄤ唬鐮�
+ /// </summary>
+ /// <param name="dtSource"></param>
+ /// <param name="strFileName"></param>
+ /// <remarks>NPOI璁や负Excel鐨勭涓�涓崟鍏冩牸鏄細(0锛�0)</remarks>
+ /// <Author>鏌虫案娉� http://www.yongfa365.com/ 2010-5-8 22:21:41</Author>
+ public static void ExportEasy(DataTable dtSource, string strFileName)
+ {
+ HSSFWorkbook workbook = new HSSFWorkbook();
+ ISheet sheet = workbook.CreateSheet();
+ //濉厖琛ㄥご
+ IRow dataRow = sheet.CreateRow(0);
+ foreach (DataColumn column in dtSource.Columns)
+ {
+ dataRow.CreateCell(column.Ordinal).SetCellValue(column.ColumnName);
+ }
+
+
+ //濉厖鍐呭
+ for (int i = 0; i < dtSource.Rows.Count; i++)
+ {
+ dataRow = sheet.CreateRow(i + 1);
+ for (int j = 0; j < dtSource.Columns.Count; j++)
+ {
+ dataRow.CreateCell(j).SetCellValue(dtSource.Rows[i][j].ToString());
+ }
+ }
+
+
+ //淇濆瓨
+ using (MemoryStream ms = new MemoryStream())
+ {
+ using (FileStream fs = new FileStream(strFileName, FileMode.Create, FileAccess.Write))
+ {
+ workbook.Write(ms);
+ ms.Flush();
+ ms.Position = 0;
+ byte[] data = ms.ToArray();
+ fs.Write(data, 0, data.Length);
+ fs.Flush();
+ }
+ }
+ //workbook.Dispose();
+ }
+
+
+
+
+ public static System.Data.DataTable GetExcelDatatable(string fileUrl)
+ {
+
+ string strConn = "Provider=Microsoft.Ace.OleDb.12.0;" + "data source=" + fileUrl + ";Extended Properties='Excel 12.0; HDR=Yes; IMEX=1'";
+
+
+ DataSet myDataSet = new DataSet();
+
+ //杩炴帴涓�
+ OleDbConnection conn = new OleDbConnection(strConn);
+ conn.Open();
+ //杩斿洖Excel鐨勬灦鏋勶紝鍖呮嫭鍚勪釜sheet琛ㄧ殑鍚嶇О,绫诲瀷锛屽垱寤烘椂闂村拰淇敼鏃堕棿绛夈��
+ DataTable dtSheetName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" });
+ //鍖呭惈excel涓〃鍚嶇殑瀛楃涓叉暟缁�
+ string[] strTableNames = new string[dtSheetName.Rows.Count];
+ for (int k = 0; k < dtSheetName.Rows.Count; k++)
+ {
+ strTableNames[k] = dtSheetName.Rows[k]["TABLE_NAME"].ToString();
+ }
+ OleDbDataAdapter myCommand = null;
+ DataTable dt = new DataTable();
+ //浠庢寚瀹氱殑琛ㄦ槑鏌ヨ鏁版嵁,鍙厛鎶婃墍鏈夎〃鏄庡垪鍑烘潵渚涚敤鎴烽�夋嫨
+ string strExcel = "select*from[" + strTableNames[0] + "]";
+ myCommand = new OleDbDataAdapter(strExcel, strConn);
+ //myCommand.Fill(dt);
+ myCommand.Fill(myDataSet, "ExcelInfo");
+ conn.Close();
+ DataTable ExcelTable = myDataSet.Tables["ExcelInfo"].DefaultView.ToTable();
+ return ExcelTable;
+ }
+
+
+ /// <summary>
+ /// 澶氫釜sheet瀵煎叆
+ /// </summary>
+ /// <param name="fileUrl"></param>
+ /// <returns></returns>
+ public static List<DataTable> GetExcelDatatableList(string fileUrl)
+ {
+ List<DataTable> list = new List<DataTable>();
+ string strConn = "Provider=Microsoft.Ace.OleDb.12.0;" + "data source=" + fileUrl + ";Extended Properties='Excel 12.0; HDR=Yes; IMEX=1'";
+
+
+ DataSet myDataSet = new DataSet();
+
+ //杩炴帴涓�
+ OleDbConnection conn = new OleDbConnection(strConn);
+ conn.Open();
+ //杩斿洖Excel鐨勬灦鏋勶紝鍖呮嫭鍚勪釜sheet琛ㄧ殑鍚嶇О,绫诲瀷锛屽垱寤烘椂闂村拰淇敼鏃堕棿绛夈��
+ DataTable dtSheetName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" });
+ //鍖呭惈excel涓〃鍚嶇殑瀛楃涓叉暟缁�
+ string[] strTableNames = new string[dtSheetName.Rows.Count];
+ for (int k = 0; k < dtSheetName.Rows.Count; k++)
+ {
+ strTableNames[k] = dtSheetName.Rows[k]["TABLE_NAME"].ToString();
+ }
+ for (int i = 0; i < strTableNames.Length; i++)
+ {
+ OleDbDataAdapter myCommand = null;
+ DataTable dt = new DataTable();
+ //浠庢寚瀹氱殑琛ㄦ槑鏌ヨ鏁版嵁,鍙厛鎶婃墍鏈夎〃鏄庡垪鍑烘潵渚涚敤鎴烽�夋嫨
+ string strExcel = "select*from[" + strTableNames[i].Trim() + "]";
+ myCommand = new OleDbDataAdapter(strExcel, strConn);
+ //myCommand.Fill(dt);
+ myCommand.Fill(myDataSet, "" + i + "");
+ conn.Close();
+ DataTable ExcelTable = myDataSet.Tables[i].DefaultView.ToTable();
+ list.Add(ExcelTable);
+ }
+
+ return list;
+ }
+
+ /// <summary>
+ /// 澶氫釜sheet瀵煎叆
+ /// </summary>
+ /// <param name="fileUrl"></param>
+ /// <returns></returns>
+ public static List<DataTable> GetExcelDatatableListName(string fileUrl)
+ {
+ List<DataTable> list = new List<DataTable>();
+ string strConn = "Provider=Microsoft.Ace.OleDb.12.0;" + "data source=" + fileUrl + ";Extended Properties='Excel 12.0; HDR=Yes; IMEX=1'";
+
+
+ DataSet myDataSet = new DataSet();
+
+ //杩炴帴涓�
+ OleDbConnection conn = new OleDbConnection(strConn);
+ conn.Open();
+ //杩斿洖Excel鐨勬灦鏋勶紝鍖呮嫭鍚勪釜sheet琛ㄧ殑鍚嶇О,绫诲瀷锛屽垱寤烘椂闂村拰淇敼鏃堕棿绛夈��
+ DataTable dtSheetName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" });
+ for (int m = 0; m < dtSheetName.Rows.Count; m++)
+ {
+ string TABLE_NAME = dtSheetName.Rows[m]["TABLE_NAME"].ToString();
+ string FilterDatabase = "$FilterDatabase";
+ if (TABLE_NAME.Contains(FilterDatabase))
+ {
+ dtSheetName.Rows.Remove(dtSheetName.Rows[m]);
+ }
+ }
+
+ //鍖呭惈excel涓〃鍚嶇殑瀛楃涓叉暟缁�
+ string[] strTableNames = new string[dtSheetName.Rows.Count];
+ for (int k = 0; k < dtSheetName.Rows.Count; k++)
+ {
+ strTableNames[k] = dtSheetName.Rows[k]["TABLE_NAME"].ToString();
+ }
+ for (int i = 0; i < strTableNames.Length; i++)
+ {
+ OleDbDataAdapter myCommand = null;
+ DataTable dt = new DataTable();
+
+ //浠庢寚瀹氱殑琛ㄦ槑鏌ヨ鏁版嵁,鍙厛鎶婃墍鏈夎〃鏄庡垪鍑烘潵渚涚敤鎴烽�夋嫨
+ string strExcel = "select*from[" + strTableNames[i].Trim() + "]";
+ myCommand = new OleDbDataAdapter(strExcel, strConn);
+ //myCommand.Fill(dt);
+ myCommand.Fill(myDataSet, "" + i + "");
+ conn.Close();
+ DataTable ExcelTable = myDataSet.Tables[i].DefaultView.ToTable();
+ ExcelTable.TableName = strTableNames[i].Trim();
+ list.Add(ExcelTable);
+ }
+
+ return list;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/RedisCommon.cs b/VueWebCoreApi/Tools/RedisCommon.cs
new file mode 100644
index 0000000..3ce53d2
--- /dev/null
+++ b/VueWebCoreApi/Tools/RedisCommon.cs
@@ -0,0 +1,309 @@
+锘縰sing Newtonsoft.Json;
+using StackExchange.Redis;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class RedisCommon
+ {
+ //public static ILogger Log = UtilLogger<RedisCommon>.Log;//鏃ュ織璁板綍
+ //redis鏁版嵁搴撹繛鎺ュ瓧绗︿覆
+ private static readonly string RedisIpConnString = AppSetting.GetAppSetting("RedisConnIp");
+ private static readonly string RedisPortConnString = AppSetting.GetAppSetting("RedisConnPort");
+ private static readonly string RedisKeyTimeCont = AppSetting.GetAppSetting("RedisKeyTimeCont");
+
+
+ private string _conn = RedisIpConnString+":"+RedisPortConnString;
+ private int _db = 1;
+ //榛樿缂撳瓨杩囨湡鏃堕棿鍗曚綅绉�
+ public int secondsTimeOut = Convert.ToInt32(RedisKeyTimeCont);
+ //闈欐�佸彉閲� 淇濊瘉鍚勬ā鍧椾娇鐢ㄧ殑鏄笉鍚屽疄渚嬬殑鐩稿悓閾炬帴
+ private static ConnectionMultiplexer connection;
+ public RedisCommon() { }
+
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ /// <param name="db"></param>
+ /// <param name="connectStr"></param>
+ public RedisCommon(int db, string connectStr)
+ {
+ _conn = connectStr;
+ _db = db;
+ }
+
+ /// <summary>
+ /// 缂撳瓨鏁版嵁搴擄紝鏁版嵁搴撹繛鎺�
+ /// </summary>
+ public ConnectionMultiplexer CacheConnection
+ {
+ get
+ {
+ try
+ {
+ if (connection == null || !connection.IsConnected)
+ {
+ connection = new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect(_conn)).Value;
+ }
+ }
+ catch (Exception ex)
+ {
+ //Log.LogError("RedisHelper->CacheConnection 鍑洪敊\r\n" + ex.ToString());
+ return null;
+ }
+ return connection;
+ }
+ }
+
+ /// <summary>
+ /// 缂撳瓨鏁版嵁搴�
+ /// </summary>
+ public IDatabase CacheRedis => CacheConnection.GetDatabase(_db);
+
+ #region --KEY/VALUE瀛樺彇--
+
+ /// <summary>
+ /// 鍗曟潯瀛樺��
+ /// </summary>
+ /// <param name="key">key</param>
+ /// <param name="value">The value.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
+ public bool StringSet(string key, string value)
+ {
+ return CacheRedis.StringSet(key, value);
+ }
+
+ /// <summary>
+ /// 淇濆瓨鍗曚釜key value
+ /// </summary>
+ /// <param name="key">Redis Key</param>
+ /// <param name="value">淇濆瓨鐨勫��</param>
+ /// <param name="expiry">杩囨湡鏃堕棿</param>
+ /// <returns></returns>
+ public bool StringSet(string key, string value, TimeSpan? expiry = default(TimeSpan?))
+ {
+ return CacheRedis.StringSet(key, value, expiry);
+ }
+
+ /// <summary>
+ /// 淇濆瓨澶氫釜key value
+ /// </summary>
+ /// <param name="arr">key</param>
+ /// <returns></returns>
+ public bool StringSet(KeyValuePair<RedisKey, RedisValue>[] arr)
+ {
+ return CacheRedis.StringSet(arr);
+ }
+
+ /// <summary>
+ /// 鎵归噺瀛樺��
+ /// </summary>
+ /// <param name="keysStr">key</param>
+ /// <param name="valuesStr">The value.</param>
+ /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
+ public bool StringSetMany(string[] keysStr, string[] valuesStr)
+ {
+ var count = keysStr.Length;
+ var keyValuePair = new KeyValuePair<RedisKey, RedisValue>[count];
+ for (int i = 0; i < count; i++)
+ {
+ keyValuePair[i] = new KeyValuePair<RedisKey, RedisValue>(keysStr[i], valuesStr[i]);
+ }
+
+ return CacheRedis.StringSet(keyValuePair);
+ }
+
+ /// <summary>
+ /// 淇濆瓨涓�涓璞�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="key"></param>
+ /// <param name="obj"></param>
+ /// <returns></returns>
+ public bool SetStringKey<T>(string key, T obj, TimeSpan? expiry = default(TimeSpan?))
+ {
+ string json = JsonConvert.SerializeObject(obj);
+ return CacheRedis.StringSet(key, json, expiry);
+ }
+
+ /// <summary>
+ /// 杩藉姞鍊�
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ public void StringAppend(string key, string value)
+ {
+ ////杩藉姞鍊硷紝杩斿洖杩藉姞鍚庨暱搴�
+ long appendlong = CacheRedis.StringAppend(key, value);
+ }
+
+ /// <summary>
+ /// 鑾峰彇鍗曚釜key鐨勫��
+ /// </summary>
+ /// <param name="key">Redis Key</param>
+ /// <returns></returns>
+ public RedisValue GetStringKey(string key)
+ {
+ return CacheRedis.StringGet(key);
+ }
+
+ /// <summary>
+ /// 鏍规嵁Key鑾峰彇鍊�
+ /// </summary>
+ /// <param name="key">閿��</param>
+ /// <returns>System.String.</returns>
+ public string StringGet(string key)
+ {
+ try
+ {
+ return CacheRedis.StringGet(key);
+ }
+ catch (Exception ex)
+ {
+ //Log.LogError("RedisHelper->StringGet 鍑洪敊\r\n" + ex.ToString());
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇澶氫釜Key
+ /// </summary>
+ /// <param name="listKey">Redis Key闆嗗悎</param>
+ /// <returns></returns>
+ public RedisValue[] GetStringKey(List<RedisKey> listKey)
+ {
+ return CacheRedis.StringGet(listKey.ToArray());
+ }
+
+ /// <summary>
+ /// 鎵归噺鑾峰彇鍊�
+ /// </summary>
+ public string[] StringGetMany(string[] keyStrs)
+ {
+ var count = keyStrs.Length;
+ var keys = new RedisKey[count];
+ var addrs = new string[count];
+
+ for (var i = 0; i < count; i++)
+ {
+ keys[i] = keyStrs[i];
+ }
+ try
+ {
+
+ var values = CacheRedis.StringGet(keys);
+ for (var i = 0; i < values.Length; i++)
+ {
+ addrs[i] = values[i];
+ }
+ return addrs;
+ }
+ catch (Exception ex)
+ {
+ //Log.LogError("RedisHelper->StringGetMany 鍑洪敊\r\n" + ex.ToString());
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇涓�涓猭ey鐨勫璞�
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public T GetStringKey<T>(string key)
+ {
+ try
+ {
+ return JsonConvert.DeserializeObject<T>(CacheRedis.StringGet(key));
+ }
+ catch (Exception ex)
+ {
+ //return new T();
+ return default(T);
+ }
+ }
+
+ #endregion
+
+ #region --鍒犻櫎璁剧疆杩囨湡--
+
+ /// <summary>
+ /// 鍒犻櫎鍗曚釜key
+ /// </summary>
+ /// <param name="key">redis key</param>
+ /// <returns>鏄惁鍒犻櫎鎴愬姛</returns>
+ public bool KeyDelete(string key)
+ {
+ return CacheRedis.KeyDelete(key);
+ }
+
+ /// <summary>
+ /// 鍒犻櫎澶氫釜key
+ /// </summary>
+ /// <param name="keys">rediskey</param>
+ /// <returns>鎴愬姛鍒犻櫎鐨勪釜鏁�</returns>
+ public long KeyDelete(RedisKey[] keys)
+ {
+ return CacheRedis.KeyDelete(keys);
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇key鏄惁瀛樺偍
+ /// </summary>
+ /// <param name="key">redis key</param>
+ /// <returns></returns>
+ public bool KeyExists(string key)
+ {
+ return CacheRedis.KeyExists(key);
+ }
+
+ /// <summary>
+ /// 閲嶆柊鍛藉悕key
+ /// </summary>
+ /// <param name="key">灏辩殑redis key</param>
+ /// <param name="newKey">鏂扮殑redis key</param>
+ /// <returns></returns>
+ public bool KeyRename(string key, string newKey)
+ {
+ return CacheRedis.KeyRename(key, newKey);
+ }
+
+ /// <summary>
+ /// 鍒犻櫎hasekey
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="hashField"></param>
+ /// <returns></returns>
+ public bool HaseDelete(RedisKey key, RedisValue hashField)
+ {
+ return CacheRedis.HashDelete(key, hashField);
+ }
+
+ /// <summary>
+ /// 绉婚櫎hash涓殑鏌愬��
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="key"></param>
+ /// <param name="dataKey"></param>
+ /// <returns></returns>
+ public bool HashRemove(string key, string dataKey)
+ {
+ return CacheRedis.HashDelete(key, dataKey);
+ }
+
+ /// <summary>
+ /// 璁剧疆缂撳瓨杩囨湡
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="datetime"></param>
+ public void SetExpire(string key, int datetime)
+ {
+ CacheRedis.KeyExpire(key, DateTime.Now.AddSeconds(datetime));
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/RedisHelper.cs b/VueWebCoreApi/Tools/RedisHelper.cs
new file mode 100644
index 0000000..c5c1368
--- /dev/null
+++ b/VueWebCoreApi/Tools/RedisHelper.cs
@@ -0,0 +1,267 @@
+锘縰sing ServiceStack.Redis;
+using ServiceStack.Redis.Generic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class RedisHelper
+ {
+ /// <summary>
+ /// redis鑾峰彇杩炴帴閰嶇疆瀛楃涓�
+ /// </summary>
+ private static readonly string RedisIpConnString = AppSetting.GetAppSetting("RedisConnIp");
+ private static readonly string RedisPortConnString = AppSetting.GetAppSetting("RedisConnPort");
+ private static readonly string RedisKeyTimeCont = AppSetting.GetAppSetting("RedisKeyTimeCont");
+
+
+ private static RedisClient Redis = new RedisClient(RedisIpConnString, Convert.ToInt32(RedisPortConnString));
+ //缂撳瓨姹�
+ static PooledRedisClientManager prcm = new PooledRedisClientManager();
+
+
+ //榛樿缂撳瓨杩囨湡鏃堕棿鍗曚綅绉�
+ public int secondsTimeOut = Convert.ToInt32(RedisKeyTimeCont);
+ private static readonly Dictionary<int, PooledRedisClientManager> pools = new Dictionary<int, PooledRedisClientManager>();
+ /// <summary>
+ /// 缂撳啿姹�
+ /// </summary>
+ /// <param name="readWriteHosts"></param>
+ /// <param name="readOnlyHosts"></param>
+ /// <returns></returns>
+ private static void CreateManager(string[] readWriteHosts, string[] readOnlyHosts)
+ {
+ for (int i = 0; i <= 15; i++)
+ {
+ PooledRedisClientManager prc = new PooledRedisClientManager(readWriteHosts, readOnlyHosts,
+ new RedisClientManagerConfig
+ {
+ MaxWritePoolSize = readWriteHosts.Length * 512, //鏈�澶у啓閾炬帴鏁�
+ MaxReadPoolSize = readOnlyHosts.Length * 512, //鏈�澶ц閾炬帴鏁�
+ AutoStart = true, //鑷姩閲嶅惎
+ }, i, 200, 10);// { RedisClientFactory = (IRedisClientFactory)RedisCacheClientFactory.Instance.CreateRedisClient("127.0.0.1", 6379) };
+ pools.Add(i, prc);
+ }
+ }
+ public static PooledRedisClientManager ChooseRedisInstance(int database)
+ {
+ if (database > 16) return pools[0];
+ return pools[database];
+ }
+ /// <summary>
+ /// 鏋勯�犲嚱鏁�
+ /// </summary>
+ /// <param name="openPooledRedis">鏄惁寮�鍚紦鍐叉睜</param>
+ static RedisHelper()
+ {
+ //CreateManager(new string[] { "127.0.0.1:6379" }, new string[] { "127.0.0.1:6379" });
+ CreateManager(new string[] { RedisIpConnString + ":" + RedisPortConnString }, new string[] { RedisIpConnString + ":" + RedisPortConnString });
+ //Redis = prcm.GetClient() as RedisClient;
+ }
+
+ #region Key/Value瀛樺偍
+ /// <summary>
+ /// 璁剧疆缂撳瓨
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="key">缂撳瓨寤�</param>
+ /// <param name="t">缂撳瓨鍊�</param>
+ /// <param name="timeout">杩囨湡鏃堕棿锛屽崟浣嶇,-1锛氫笉杩囨湡锛�0锛氶粯璁よ繃鏈熸椂闂�</param>
+ /// <returns></returns>
+ public bool Set<T>(string key, T t, int timeout = 0, int db = 0)
+ {
+ Redis = (RedisClient)ChooseRedisInstance(db).GetClient();
+ var values = Redis.Add<T>(key, t);
+ if (timeout >= 0)
+ {
+ if (timeout > 0)
+ {
+ secondsTimeOut = timeout;
+ }
+ Redis.Expire(key, secondsTimeOut);
+ }
+ Redis.Dispose();
+ return values;
+ }
+
+ /// <summary>
+ /// 璁剧疆澶辨晥鏃堕棿
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="expiry"></param>
+ /// <returns></returns>
+ public bool KeyExpire(string key, int expiry)
+ {
+ return Redis.Expire(key, expiry);
+ }
+ /// <summary>
+ /// 鑾峰彇
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public T Get<T>(string key, int db = 0)
+ {
+ Redis = (RedisClient)ChooseRedisInstance(db).GetClient();
+ var values = Redis.Get<T>(key);
+ Redis.Dispose();
+ return values;
+ }
+ /// <summary>
+ /// 鍒犻櫎
+ /// </summary>
+ /// <param name="key"></param>
+ /// <returns></returns>
+ public bool Remove(string key, int db = 0)
+ {
+ Redis = (RedisClient)ChooseRedisInstance(db).GetClient();
+ Redis.Dispose();
+ return Redis.Remove(key);
+ }
+
+
+ //public static bool Add<T>(string key, T t, int timeout)
+ //{
+ // var values = Redis.Add<T>(key, t);
+ // if (timeout >= 0)
+ // {
+ // if (timeout > 0)
+ // {
+ // secondsTimeOut = timeout;
+ // }
+ // Redis.Expire(key, secondsTimeOut);
+ // }
+ // return values;
+ //}
+ #endregion
+
+
+ #region 閾捐〃鎿嶄綔
+ /// <summary>
+ /// 鏍规嵁IEnumerable鏁版嵁娣诲姞閾捐〃
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="listId"></param>
+ /// <param name="values"></param>
+ /// <param name="timeout"></param>
+ public void AddList<T>(string listId, IEnumerable<T> values, int timeout = 0)
+ {
+ Redis.Expire(listId, 60);
+ IRedisTypedClient<T> iredisClient = Redis.As<T>();
+ if (timeout >= 0)
+ {
+ if (timeout > 0)
+ {
+ secondsTimeOut = timeout;
+ }
+ Redis.Expire(listId, secondsTimeOut);
+ }
+ var redisList = iredisClient.Lists[listId];
+ redisList.AddRange(values);
+ iredisClient.Save();
+ Redis.Dispose();
+ }
+ /// <summary>
+ /// 娣诲姞鍗曚釜瀹炰綋鍒伴摼琛ㄤ腑
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="listId"></param>
+ /// <param name="Item"></param>
+ /// <param name="timeout"></param>
+ public void AddEntityToList<T>(string listId, T Item, int timeout = 0, int db = 0)
+ {
+ Redis = (RedisClient)ChooseRedisInstance(db).GetClient();
+ IRedisTypedClient<T> iredisClient = Redis.As<T>();
+ if (timeout >= 0)
+ {
+ if (timeout > 0)
+ {
+ secondsTimeOut = timeout;
+ }
+ Redis.Expire(listId, secondsTimeOut);
+ }
+ var redisList = iredisClient.Lists[listId];
+ redisList.Add(Item);
+ iredisClient.Save();
+ Redis.Dispose();
+ }
+ /// <summary>
+ /// 鑾峰彇閾捐〃
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="listId"></param>
+ /// <returns></returns>
+ public IEnumerable<T> GetList<T>(string listId, int db = 0)
+ {
+ Redis = (RedisClient)ChooseRedisInstance(db).GetClient();
+ IRedisTypedClient<T> iredisClient = Redis.As<T>();
+ Redis.Dispose();
+ return iredisClient.Lists[listId];
+ }
+ /// <summary>
+ /// 鍦ㄩ摼琛ㄤ腑鍒犻櫎鍗曚釜瀹炰綋
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="listId"></param>
+ /// <param name="t"></param>
+ public void RemoveEntityFromList<T>(string listId, T t, int db = 0)
+ {
+ Redis = (RedisClient)ChooseRedisInstance(db).GetClient();
+ IRedisTypedClient<T> iredisClient = Redis.As<T>();
+ var redisList = iredisClient.Lists[listId];
+ redisList.RemoveValue(t);
+ iredisClient.Save();
+ Redis.Dispose();
+ }
+ /// <summary>
+ /// 鏍规嵁lambada琛ㄨ揪寮忓垹闄ょ鍚堟潯浠剁殑瀹炰綋
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="listId"></param>
+ /// <param name="func"></param>
+ public void RemoveEntityFromList<T>(string listId, Func<T, bool> func)
+ {
+ //using (IRedisTypedClient<T> iredisClient = Redis.As<T>())
+ //{
+ // var redisList = iredisClient.Lists[listId];
+ // T value = redisList.Where(func).FirstOrDefault();
+ // redisList.RemoveValue(value);
+ // iredisClient.Save();
+ //}
+
+
+ // 浣跨敤using 鎶ラ敊锛�
+ // using 璇彞涓娇鐢ㄧ殑绫诲瀷蹇呴』鍙殣寮忚浆鎹负鈥淪ystem.IDisposable鈥�
+ // using浼氳嚜鍔ㄨ皟鐢⊿ystem.IDisposable涓嬬殑Dispose鏂规硶鏉ラ噴鏀鹃潪鎵樼璧勬簮锛�
+ // IRedisTypedClient娌℃湁缁ф壙System.IDisposable鐨勬帴鍙o紝鎵�浠ヤ笉鑳界敤
+ IRedisTypedClient<T> iredisClient = Redis.As<T>();
+ var redisList = iredisClient.Lists[listId];
+ T value = redisList.Where(func).FirstOrDefault();
+ redisList.RemoveValue(value);
+ iredisClient.Save();
+ Redis.Dispose();
+
+ }
+ public void test()
+ {
+ string s1 = Redis.GetClient();
+ List<Dictionary<string, string>> s2 = Redis.GetClientsInfo();
+ List<string> s3 = Redis.GetAllKeys();
+ string s4 = Redis.GetHostString();
+ long s5 = Redis.Db;
+ }
+ #endregion
+ //閲婃斁璧勬簮
+ public void Dispose()
+ {
+ if (Redis != null)
+ {
+ Redis.Dispose();
+ Redis = null;
+ }
+ GC.Collect();
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/Regedit.cs b/VueWebCoreApi/Tools/Regedit.cs
new file mode 100644
index 0000000..721f371
--- /dev/null
+++ b/VueWebCoreApi/Tools/Regedit.cs
@@ -0,0 +1,573 @@
+锘縰sing Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class Regedit
+ {
+ private static RegistryKey LoadRoot(string path, bool writable)
+ {
+ RegistryKey result;
+ try
+ {
+ RegistryKey registryKey = Regedit.LoadRoot(writable);
+ registryKey = registryKey.OpenSubKey(path, writable);
+ if (null == registryKey)
+ {
+ registryKey = Registry.LocalMachine.CreateSubKey(path);
+ }
+ result = registryKey;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ return result;
+ }
+
+ private static RegistryKey LoadRoot(bool writable)
+ {
+ RegistryKey registryKey = null;
+ RegistryKey result;
+ try
+ {
+ registryKey = Registry.LocalMachine.OpenSubKey("Software", writable);
+ RegistryKey registryKey2 = registryKey.OpenSubKey("YYBB", writable);
+ if (null == registryKey2)
+ {
+ registryKey2 = registryKey.CreateSubKey("YYBB");
+ }
+ result = registryKey2;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ private static RegistryKey LoadRegistryKey(bool writable)
+ {
+ RegistryKey registryKey = null;
+ RegistryKey result;
+ try
+ {
+ registryKey = Registry.LocalMachine.OpenSubKey("Software", writable);
+ RegistryKey registryKey2 = registryKey.OpenSubKey("YYBB", writable);
+ if (null == registryKey2)
+ {
+ registryKey2 = registryKey.CreateSubKey("YYBB");
+ }
+ RegistryKey registryKey3 = registryKey2.OpenSubKey("connectionString", writable);
+ if (null == registryKey3)
+ {
+ registryKey3 = registryKey2.CreateSubKey("connectionString");
+ }
+ result = registryKey3;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static RegistryKey AddFolder(string itemName)
+ {
+ RegistryKey registryKey = null;
+ RegistryKey result;
+ try
+ {
+ registryKey = Regedit.LoadRoot(true);
+ result = registryKey.CreateSubKey(itemName);
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static bool SetFolderValueX(string path, string name, string val)
+ {
+ RegistryKey registryKey = null;
+ bool result;
+ try
+ {
+ registryKey = Regedit.LoadRoot(path, true);
+ registryKey.SetValue(name, val);
+ registryKey.Flush();
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static bool SetFolderValue(string itemName, string name, string itemValue)
+ {
+ RegistryKey registryKey = null;
+ bool result;
+ try
+ {
+ registryKey = Regedit.AddFolder(itemName);
+ registryKey.SetValue(name, itemValue);
+ registryKey.Flush();
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static bool DeleteFolder(string itemName)
+ {
+ RegistryKey registryKey = null;
+ bool result;
+ try
+ {
+ registryKey = Regedit.LoadRoot(true);
+ registryKey.DeleteSubKey(itemName);
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static bool DeleteFolder(string path, string itemName)
+ {
+ RegistryKey registryKey = null;
+ bool result;
+ try
+ {
+ registryKey = Regedit.LoadRoot(path, true);
+ registryKey.DeleteSubKey(itemName);
+ registryKey.Flush();
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static bool DeleteFolderValue(string itemName, string name)
+ {
+ RegistryKey registryKey = null;
+ bool result;
+ try
+ {
+ registryKey = Regedit.LoadRoot(true);
+ registryKey = Regedit.LoadRoot(true);
+ RegistryKey registryKey2 = registryKey.OpenSubKey(itemName, true);
+ registryKey2.DeleteValue(name);
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static RegistryKey GetFolder(string itemName)
+ {
+ RegistryKey registryKey = null;
+ RegistryKey result;
+ try
+ {
+ registryKey = Regedit.LoadRoot(false);
+ RegistryKey registryKey2 = registryKey.OpenSubKey(itemName, false);
+ if (null == registryKey2)
+ {
+ throw new Exception("涓嶅瓨鍦╗" + itemName + "]鐨勯」...");
+ }
+ result = registryKey2;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static string[] GetFolderNames(string itemName)
+ {
+ RegistryKey registryKey = null;
+ string[] result;
+ try
+ {
+ registryKey = Regedit.LoadRoot(false);
+ RegistryKey registryKey2 = registryKey.OpenSubKey(itemName, false);
+ if (null == registryKey2)
+ {
+ result = null;
+ }
+ else
+ {
+ result = registryKey2.GetValueNames();
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static string GetFolderValueX(string path, string name)
+ {
+ RegistryKey registryKey = null;
+ string result;
+ try
+ {
+ registryKey = Regedit.LoadRoot(path, false);
+ string text = string.Empty;
+ object value = registryKey.GetValue(name);
+ if (null != value)
+ {
+ text = value.ToString();
+ result = text;
+ }
+ else
+ {
+ result = null;
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static string GetFolderValue(string itemName, string name)
+ {
+ RegistryKey registryKey = null;
+ string result;
+ try
+ {
+ registryKey = Regedit.GetFolder(itemName);
+ string text = string.Empty;
+ object value = registryKey.GetValue(name);
+ if (null != value)
+ {
+ text = value.ToString();
+ result = text;
+ }
+ else
+ {
+ result = null;
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static RegistryKey CreateItem(string itemName)
+ {
+ RegistryKey registryKey = null;
+ RegistryKey result;
+ try
+ {
+ registryKey = Regedit.LoadRegistryKey(true);
+ result = registryKey.CreateSubKey(itemName);
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static RegistryKey CreateItem(string path, string itemName)
+ {
+ RegistryKey registryKey = null;
+ RegistryKey result;
+ try
+ {
+ registryKey = Regedit.AddFolder(path);
+ result = registryKey.CreateSubKey(itemName);
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static bool DeleteItem(string itemName)
+ {
+ RegistryKey registryKey = null;
+ bool result;
+ try
+ {
+ registryKey = Regedit.LoadRegistryKey(true);
+ registryKey.DeleteSubKey(itemName);
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static RegistryKey GetItem(string itemName)
+ {
+ RegistryKey registryKey = null;
+ RegistryKey result;
+ try
+ {
+ registryKey = Regedit.LoadRegistryKey(false);
+ RegistryKey registryKey2 = registryKey.OpenSubKey(itemName, false);
+ if (null == registryKey2)
+ {
+ throw new Exception("涓嶅瓨鍦╗" + itemName + "]鐨勯」...");
+ }
+ result = registryKey2;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static bool SetConnectionString(string name, string connectionString)
+ {
+ return Regedit.SetValue(name, "connectionString", connectionString);
+ }
+
+ public static bool SetValue(string itemName, string name, string itemValue)
+ {
+ RegistryKey registryKey = null;
+ bool result;
+ try
+ {
+ registryKey = Regedit.CreateItem(itemName);
+ registryKey.SetValue(name, Encrypt.EncryptStr(itemValue, "fengyi", "fengyibi"));
+ registryKey.Flush();
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static string GetConnectionString(string serverName)
+ {
+ string[] connectionLists = Regedit.GetConnectionLists();
+ string[] array = connectionLists;
+ for (int i = 0; i < array.Length; i++)
+ {
+ string a = array[i];
+ if (a == serverName)
+ {
+ return Regedit.GetValue(serverName, "connectionString", false);
+ }
+ }
+ throw new Exception("涓嶅瓨鍦ㄩ厤缃悕涓篬" + serverName + "]鐨勮缃�,璇锋鏌�!");
+ }
+
+ public static string GetValue(string itemName, string name)
+ {
+ return Regedit.GetValue(itemName, name, true);
+ }
+
+ public static string GetValue(string itemName, string name, bool isDecrpt)
+ {
+ RegistryKey registryKey = null;
+ string result;
+ try
+ {
+ registryKey = Regedit.GetItem(itemName);
+ string text = string.Empty;
+ object value = registryKey.GetValue(name);
+ if (null == value)
+ {
+ throw new Exception(itemName + "涓笉瀛樺湪[" + name + "]椤癸紒");
+ }
+ text = value.ToString();
+ if (isDecrpt)
+ {
+ result = Encrypt.DecryptStr(text, "fengyi", "fengyibi");
+ }
+ else
+ {
+ result = text;
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return result;
+ }
+
+ public static string[] GetConnectionLists()
+ {
+ RegistryKey registryKey = null;
+ string[] subKeyNames;
+ try
+ {
+ registryKey = Regedit.LoadRegistryKey(false);
+ subKeyNames = registryKey.GetSubKeyNames();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ finally
+ {
+ if (null != registryKey)
+ {
+ registryKey.Close();
+ }
+ }
+ return subKeyNames;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/ScanStartReport.cs b/VueWebCoreApi/Tools/ScanStartReport.cs
new file mode 100644
index 0000000..cd8da11
--- /dev/null
+++ b/VueWebCoreApi/Tools/ScanStartReport.cs
@@ -0,0 +1,1505 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Web;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class ScanStartReport
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+
+ #region[鐢熶骇寮�鎶ュ伐:鑷埗宸ュ簭浠诲姟寮�鎶ュ伐鍒ゆ柇锛氬伐鍗�+宸ュ簭鏉$爜,鎸夊簭鐢熶骇]
+ /// <summary>
+ /// 鎵爜淇℃伅涓哄伐鍗�+宸ュ簭鏉$爜
+ /// </summary>
+ /// <param name="ordercode">宸ュ崟缂栧彿</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <returns></returns>
+ public static ToMessage ZZEncodingSeach(string ordercode, string stepcode)
+ {
+ var sql = "";
+ string flwtype = ""; //宸ュ簭灞炴��
+ string isbott = ""; //棣栭亾宸ュ簭
+ string isend = ""; //鏈亾宸ュ簭
+ string seq = ""; //宸ュ簭搴忓彿
+ List<object> list = new List<object>();
+ ScanStartReportData rt = new ScanStartReportData();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠宸ュ崟鏄惁鍏抽棴
+ sql = @"select * from TK_Wrk_Man where wo_code=@ordercode and status='CLOSED'";
+ dynamicParams.Add("@ordercode", ordercode);
+ var da0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (da0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟宸插叧闂�,涓嶅厑璁稿紑鎶ュ伐鎿嶄綔!";
+ mes.data = null;
+ return mes;
+ }
+
+ //1.鏍规嵁宸ュ崟+宸ュ簭鏌ユ壘褰撳墠宸ュ簭鏄惁棣栭亾宸ュ簭
+ sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.stepprice,A.seq,T.flwtype,T.descr,A.status,A.plan_quantity,A.plan_qty,A.isbott,A.isend,L.torg_code,L.torg_name
+ from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TOrganization L on M.wkshp_code=L.torg_code
+ where A.wo_code=@ordercode and A.step_code=@stepcode";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ rt.wkshopcode = data.Rows[0]["torg_code"].ToString(); //杞﹂棿缂栫爜
+ rt.wkshopname = data.Rows[0]["torg_name"].ToString(); //杞﹂棿鍚嶇О
+ rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //宸ュ崟鍙�
+ rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //浜у搧缂栫爜
+ rt.partname = data.Rows[0]["PARTNAME"].ToString(); //浜у搧鍚嶇О
+ rt.partspec = data.Rows[0]["PARTSPEC"].ToString(); //浜у搧瑙勬牸
+ rt.stepcode = data.Rows[0]["STEPCODE"].ToString(); //宸ュ簭缂栫爜
+ rt.stepname = data.Rows[0]["STEPNAME"].ToString(); //宸ュ簭鍚嶇О
+ rt.stepdesc = data.Rows[0]["DESCR"].ToString(); //宸ュ簭鎻忚堪
+ rt.stepprice = data.Rows[0]["STEPPRICE"].ToString(); //宸ュ簭宸ヤ环
+ rt.planquantity = decimal.Parse(data.Rows[0]["PLAN_QUANTITY"].ToString()); //浠诲姟鏁伴噺
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+
+ flwtype = data.Rows[0]["FLWTYPE"].ToString();//鑾峰彇宸ュ簭灞炴��
+ isbott = data.Rows[0]["ISBOTT"].ToString();//棣栭亾宸ュ簭
+ isend = data.Rows[0]["ISEND"].ToString();//鏈亾宸ュ簭
+ rt.seq = data.Rows[0]["SEQ"].ToString();//宸ュ簭搴忓彿
+
+ //鑾峰彇褰撳墠宸ュ簭涓嬮亾宸ュ簭
+ sql = @"select A.isbott,A.isend,T.stepcode,T.stepname,A.stepprice from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq+1 ";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["SEQ"].ToString()));
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0) //鏈変笅閬撳伐搴�
+ {
+ rt.nextstepcode = dt.Rows[0]["STEPCODE"].ToString();//涓嬮亾宸ュ簭缂栫爜
+ rt.nextstepname = dt.Rows[0]["STEPNAME"].ToString();//涓嬮亾宸ュ簭鍚嶇О
+ rt.nextstepprice = dt.Rows[0]["STEPPRICE"].ToString(); //涓嬮亾宸ュ簭宸ヤ环
+ }
+ if (isend == "Y") //褰撳墠宸ュ簭鏄湯閬撳伐搴�
+ {
+ rt.nextstepcode = "";//data.Rows[0]["STEPCODE"].ToString();//褰撳墠宸ュ簭缂栫爜
+ rt.nextstepname = "";// data.Rows[0]["STEPNAME"].ToString();//褰撳墠宸ュ簭鍚嶇О
+ rt.nextstepprice = "";// data.Rows[0]["STEPPRICE"].ToString();//褰撳墠宸ュ簭宸ヤ环
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ switch (flwtype)
+ {
+ case "Z": //鑷埗宸ュ簭
+ if (isbott == "Y") //棣栭亾宸ュ簭
+ {
+ //棣栭亾宸ュ簭鏃讹紝鍒ゆ柇鏄惁鏈夋姤宸ヨ褰�
+ sql = @"select * from TK_Wrk_Record where wo_code=@ordercode and step_code=@stepcode and style='B'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ decimal good_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("GOOD_QTY")).Sum(); //鎶ュ伐鎬绘暟閲�
+ decimal ng_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum(); //涓嶈壇鏁伴噺
+ decimal laborbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //宸ュ簾鏁伴噺
+ decimal materielbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏂欏簾鏁伴噺
+ //鍓╀綑鍙姤宸ユ暟閲�=浠诲姟瓒呬骇鎬绘暟閲�-(鎶ュ伐鏁伴噺+涓嶈壇鏁伴噺+宸ュ簾搴熸暟閲�+鏂欏簾鏁伴噺)
+ decimal kbqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()) - (good_qty + ng_qty + laborbad_qty + materielbad_qty);
+ if (kbqty <= 0)//鏃犲彲鎶ュ伐鏁伴噺
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭鏃犲彲鎶ュ伐鏁伴噺!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()) - good_qty - ng_qty - laborbad_qty - materielbad_qty; //鏈姤鏁伴噺=浠诲姟瓒呬骇鎬绘暟閲�-宸叉姤鏁伴噺-涓嶈壇鏁伴噺-宸ュ簾鏁伴噺-鏂欏簾鏁伴噺
+ rt.reportqty = good_qty + ng_qty + laborbad_qty + materielbad_qty; //宸叉姤鏁伴噺=鎶ュ伐鏁伴噺+涓嶈壇鏁伴噺+宸ュ簾鏁伴噺+鏂欏簾鏁伴噺
+ mes.code = "200";
+ mes.count = 1;
+ mes.message = "鏌ユ壘鎴愬姛!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //鏈姤鏁伴噺
+ rt.reportqty = 0; //宸叉姤鏁伴噺
+ mes.code = "200";
+ mes.count = 1;
+ mes.message = "鏌ユ壘鎴愬姛!";
+ mes.data = rt;
+ }
+
+ }
+ else //闈為閬撳伐搴�
+ {
+ //鏌ユ壘褰撳墠宸ュ簭涓婂埌宸ュ簭(鑷埗鎴栬�呭鍗�)
+ sql = @"select A.step_code,S.stepname,S.flwtype from TK_Wrk_Step A
+ left join TStep S on A.step_code=S.stepcode
+ where A.wo_code=@wocode and A.seq=@seq-1";
+ dynamicParams.Add("@wocode", data.Rows[0]["WO_CODE"].ToString());
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["SEQ"].ToString()));
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ //闈為閬撳伐搴忔椂锛屽垽鏂湰閬撴槸鍚︽湁鎶ュ伐璁板綍
+ sql = @"select * from TK_Wrk_Record where wo_code=@ordercode and step_code=@stepcode and style='B'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data2 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data2.Rows.Count > 0) //鏈夋姤宸ヨ褰�
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "Z") //鍒ゆ柇涓婇亾宸ュ簭灞炴�э細鑷埗宸ュ簭
+ {
+ //鏌ユ壘涓婂埌宸ュ簭鎶ュ伐璁板綍
+ sql = @"select * from TK_Wrk_Record where wo_code=@ordercode and step_code=@stepcode and style='B'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", data0.Rows[0]["STEP_CODE"].ToString());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count > 0) //涓婇亾鏈夋姤宸�
+ {
+ decimal sgood_qty = data3.AsEnumerable().Select(d => d.Field<decimal>("GOOD_QTY")).Sum(); //涓婇亾鎶ュ伐鎬绘暟閲�
+ decimal good_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("GOOD_QTY")).Sum(); //鏈亾鎶ュ伐鎬绘暟閲�
+ decimal ng_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum(); //鏈亾涓嶈壇鎬绘暟閲�
+ decimal laborbad_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //鏈亾鎬诲伐搴熸暟閲�
+ decimal materielbad_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏈亾鎬绘枡搴熸暟閲�
+ //鏈亾鍓╀綑鍙姤鏁伴噺=涓婇亾鎶ュ伐鎬绘暟閲�-鏈亾鎶ュ伐鎬绘暟閲�-鏈亾涓嶈壇鎬绘暟閲�-鏈亾宸ュ簾鎬绘暟-鏈亾鏂欏簾鎬绘暟
+ decimal sybqty = sgood_qty - good_qty - ng_qty - laborbad_qty - materielbad_qty;
+ if (sybqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + "鏃犲彲鎶ユ暟閲�!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ if (sgood_qty == null || sgood_qty == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鍚堟牸浜у嚭涓�0,鏈亾涓嶅厑璁告姤宸�!";
+ mes.data = null;
+ return mes;
+ }
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = sybqty; //鏈姤鏁伴噺=鏈亾鍓╀綑鍙姤鏁伴噺
+ rt.reportqty = good_qty + ng_qty + laborbad_qty + materielbad_qty;//宸叉姤鏁伴噺=鏈亾鎶ュ伐鎬绘暟閲�+鏈亾鎶ュ伐鎬讳笉鑹�+鏈亾宸ュ簾鎬绘暟+鏈亾鏂欏簾鎬绘暟
+ mes.code = "200";
+ mes.count = 1;
+ mes.message = "寮圭獥鎶ュ伐鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鏈姤宸�,鏈亾涓嶅厑璁告姤宸�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "W") //鍒ゆ柇涓婇亾宸ュ簭灞炴�э細濮斿宸ュ簭
+ {
+ //鏌ユ壘涓婂埌宸ュ簭鏀舵枡璁板綍
+ sql = @"select * from TK_Wrk_OutRecord where wo_code=@ordercode and step_code=@stepcode and style='S'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", data0.Rows[0]["STEP_CODE"].ToString());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count > 0) //涓婇亾鏈夋敹鏂�
+ {
+ decimal sqty = data3.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum(); //涓婇亾鏀舵枡鏁伴噺
+ decimal good_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("GOOD_QTY")).Sum(); //鏈亾鎶ュ伐鎬绘暟閲�
+ decimal ng_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum(); //鏈亾涓嶈壇鎬绘暟閲�
+ decimal laborbad_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //鏈亾鎬诲伐搴熸暟閲�
+ decimal materielbad_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏈亾鎬绘枡搴熸暟閲�
+ //鏈亾鍓╀綑鍙姤鏁伴噺=涓婇亾鏀舵枡鎬绘暟閲�-鏈亾鎶ュ伐鎬绘暟閲�-鏈亾涓嶈壇鎬绘暟閲�-鏈亾鎬诲伐搴熸暟閲�-鏈亾鎬绘枡搴熸暟閲�
+ decimal sybqty = sqty - good_qty - ng_qty - laborbad_qty - materielbad_qty;
+ if (sybqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + "鏃犲彲鎶ユ暟閲�!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ if (sqty == null || sqty == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鍚堟牸鏀舵枡涓�0,鏈亾涓嶅厑璁稿紑鎶ュ伐!";
+ mes.data = null;
+ return mes;
+ }
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = sybqty; //鏈姤鏁伴噺=鏈亾鍓╀綑鍙姤鏁伴噺
+ rt.reportqty = good_qty + ng_qty + laborbad_qty + materielbad_qty; //宸叉姤鏁伴噺=鏈亾鎶ュ伐鎬绘暟閲�+鏈亾鎶ュ伐鎬讳笉鑹�+鏈亾鎬诲伐搴熸暟+鏈亾鎬绘枡搴熸暟
+ mes.code = "200";
+ mes.count = 1;
+ mes.message = "鏌ユ壘鎴愬姛!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鏈敹鏂�,鏈亾涓嶅厑璁稿紑鎶ュ伐,璇峰墠寰�澶栧崗鎿嶄綔椤垫墽琛�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else //鏈亾鏃犳姤宸ヨ褰�
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "Z") //鑷埗宸ュ簭
+ {
+ //鏌ユ壘涓婂埌宸ュ簭鎶ュ伐璁板綍
+ sql = @"select * from TK_Wrk_Record where wo_code=@ordercode and step_code=@stepcode and style='B'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", data0.Rows[0]["STEP_CODE"].ToString());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count > 0) //涓婇亾鏈夋姤宸�
+ {
+ decimal sgood_qty = data3.AsEnumerable().Select(d => d.Field<decimal>("GOOD_QTY")).Sum(); //涓婇亾鎶ュ伐鎬绘暟閲�
+ decimal sybqty = sgood_qty; //鏈亾鍓╀綑鍙姤鏁伴噺=涓婇亾鎶ュ伐鏁伴噺
+ if (sgood_qty == null || sgood_qty == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鍚堟牸浜у嚭涓�0,鏈亾涓嶅厑璁稿紑鎶ュ伐!";
+ mes.data = null;
+ return mes;
+ }
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = sybqty; //鏈姤鏁伴噺=鏈亾鍓╀綑鍙姤鏁伴噺
+ rt.reportqty = 0; //宸叉姤鏁伴噺
+ mes.code = "200";
+ mes.count = 1;
+ mes.message = "鏌ユ壘鎴愬姛!";
+ mes.data = rt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鏈姤宸�,鏈亾涓嶅厑璁告姤宸�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "W") //濮斿宸ュ簭
+ {
+ //鏌ユ壘涓婂埌宸ュ簭鏀舵枡璁板綍
+ sql = @"select * from TK_Wrk_OutRecord where wo_code=@ordercode and step_code=@stepcode and style='S'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", data0.Rows[0]["STEP_CODE"].ToString());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count > 0) //涓婇亾鏈夋敹鏂�
+ {
+ decimal sqty = data3.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum();//涓婇亾鏀舵枡鏁伴噺
+ decimal sybqty = sqty; //鏈亾鍓╀綑鍙敹鏁伴噺=涓婇亾鏀舵枡鏁伴噺
+ if (sqty == null || sqty == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鍚堟牸鏀舵枡涓�0,鏈亾涓嶅厑璁稿紑鎶ュ伐!";
+ mes.data = null;
+ return mes;
+ }
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = sybqty; //鏈姤鏁伴噺=鏈亾鍓╀綑鍙敹鏁伴噺
+ rt.reportqty = 0; //宸叉姤鏁伴噺
+ mes.code = "200";
+ mes.count = 1;
+ mes.message = "鏌ユ壘鎴愬姛!";
+ mes.data = rt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鏈敹鏂�,鏈亾涓嶅厑璁告姤宸�,璇峰墠寰�澶栧崗鎿嶄綔椤垫墽琛�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏈壘鍒板綋鍓嶅伐搴忕殑涓婇亾宸ュ簭淇℃伅,璇疯仈绯荤鐞嗗憳鏍稿疄!";
+ mes.data = null;
+ return mes;
+ }
+
+ }
+ break;
+ case "W": //澶栧崗宸ュ簭
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟宸ュ簭浠诲姟涓哄鍗�,璇峰墠寰�澶栧崗鎿嶄綔鏍囩椤垫搷浣�!";
+ mes.data = null;
+ break;
+ default: //鑷埗+澶栧崗宸ュ簭
+ break;
+ }
+
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ return mes;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐:澶栧崗宸ュ簭浠诲姟寮�鎶ュ伐鍒ゆ柇:宸ュ崟鍙�+宸ュ簭,鎸夊簭鏀跺彂鏂橾
+ /// <summary>
+ /// 鐢熶骇寮�鎶ュ伐:澶栧崗宸ュ簭浠诲姟寮�鎶ュ伐鍒ゆ柇:宸ュ崟鍙�+宸ュ簭
+ /// </summary>
+ /// <param name="SelectType">鎿嶄綔绫诲瀷</param>
+ /// <param name="ordercode">宸ュ崟缂栧彿</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <returns></returns>
+ public static ToMessage WXEncodingSeach(string SelectType, string ordercode, string stepcode)
+ {
+ var sql = "";
+ string flwtype = ""; //宸ュ簭灞炴��
+ string isbott = ""; //棣栭亾宸ュ簭
+ string isend = ""; //鏈亾宸ュ簭
+ string seq = ""; //宸ュ簭搴忓彿
+ List<object> list = new List<object>();
+ ScanStartReportDataOut rt = new ScanStartReportDataOut();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠宸ュ崟鏄惁鍏抽棴
+ sql = @"select * from TK_Wrk_Man where wo_code=@ordercode and status='CLOSED'";
+ dynamicParams.Add("@ordercode", ordercode);
+ var da0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (da0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟宸插叧闂�,涓嶅厑璁稿紑鎶ュ伐鎿嶄綔!";
+ mes.data = null;
+ return mes;
+ }
+
+ //1.鏍规嵁宸ュ崟+宸ュ簭鏌ユ壘褰撳墠宸ュ簭鏄惁棣栭亾宸ュ簭
+ sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.seq,T.flwtype,T.descr,A.stepprice,A.status,A.plan_quantity,A.plan_qty,A.isbott,A.isend,L.torg_code,L.torg_name
+ from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TOrganization L on M.wkshp_code=L.torg_code
+ where A.wo_code=@ordercode and A.step_code=@stepcode";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ rt.wkshopcode = data.Rows[0]["torg_code"].ToString(); //杞﹂棿缂栫爜
+ rt.wkshopname = data.Rows[0]["torg_name"].ToString(); //杞﹂棿鍚嶇О
+ rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //宸ュ崟鍙�
+ rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //浜у搧缂栫爜
+ rt.partname = data.Rows[0]["PARTNAME"].ToString(); //浜у搧鍚嶇О
+ rt.partspec = data.Rows[0]["PARTSPEC"].ToString(); //浜у搧瑙勬牸
+ rt.stepcode = data.Rows[0]["STEPCODE"].ToString(); //宸ュ簭缂栫爜
+ rt.stepname = data.Rows[0]["STEPNAME"].ToString(); //宸ュ簭鍚嶇О
+ rt.stepdesc = data.Rows[0]["DESCR"].ToString(); //宸ュ簭鎻忚堪
+ rt.planquantity = decimal.Parse(data.Rows[0]["PLAN_QUANTITY"].ToString()); //浠诲姟鏁伴噺
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.stepprice = data.Rows[0]["STEPPRICE"].ToString(); //宸ュ簭宸ヤ环
+ flwtype = data.Rows[0]["FLWTYPE"].ToString();//鑾峰彇宸ュ簭灞炴��
+ isbott = data.Rows[0]["ISBOTT"].ToString();//棣栭亾宸ュ簭
+ isend = data.Rows[0]["ISEND"].ToString();//鏈亾宸ュ簭
+ rt.seq = data.Rows[0]["SEQ"].ToString();//宸ュ簭搴忓彿
+
+ //鑾峰彇褰撳墠宸ュ簭涓嬮亾宸ュ簭
+ sql = @"select A.isbott,A.isend,T.stepcode,T.stepname,A.stepprice from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq+1 ";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["SEQ"].ToString()));
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0) //鏈変笅閬撳伐搴�
+ {
+ rt.nextstepcode = dt.Rows[0]["STEPCODE"].ToString();//涓嬮亾宸ュ簭缂栫爜
+ rt.nextstepname = dt.Rows[0]["STEPNAME"].ToString();//涓嬮亾宸ュ簭鍚嶇О
+ rt.nextstepprice = dt.Rows[0]["STEPPRICE"].ToString(); //涓嬮亾宸ュ簭宸ヤ环
+ }
+ if (isend == "Y") //褰撳墠宸ュ簭鏄湯閬撳伐搴�
+ {
+ rt.nextstepcode = "";// data.Rows[0]["STEPCODE"].ToString();//褰撳墠宸ュ簭缂栫爜
+ rt.nextstepname = "";// data.Rows[0]["STEPNAME"].ToString();//褰撳墠宸ュ簭鍚嶇О
+ rt.nextstepprice = ""; //data.Rows[0]["NEXTSTEPPRICE"].ToString();//涓嬮亾宸ュ簭宸ヤ环
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鎵爜宸ュ簭浠诲姟涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ switch (SelectType)
+ {
+ case "OUT": //鍙戞枡
+ switch (flwtype)
+ {
+ case "Z":
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏍囩涓鸿嚜鍒舵爣绛�,璇峰墠寰�鑷埗鎿嶄綔鏍囩椤垫壂鐮�!";
+ mes.data = null;
+ break;
+ case "W":
+ if (isbott == "Y") //棣栭亾宸ュ簭
+ {
+ //1.棣栭亾宸ュ簭鏃讹紝鍒ゆ柇鏄惁鏈夊彂鏂欒褰�
+ sql = @"select * from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0) //鏈夊彂鏂欒褰�
+ {
+ decimal fqty = data0.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum(); //鍙戞枡鏁伴噺
+ decimal ng_qty = data0.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum();// 涓嶈壇鏁伴噺
+ decimal laborbad_qty = data0.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //宸ュ簾鏁伴噺
+ decimal materielbad_qty = data0.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏂欏簾鏁伴噺
+ decimal kfqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()) - fqty - ng_qty - laborbad_qty - materielbad_qty; //鍓╀綑鍙彂鏁伴噺
+ if (kfqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭鏃犲彲鍙戞枡鏁伴噺!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = kfqty; //鏈彂鏁伴噺=鍓╀綑鍙彂鏁伴噺
+ rt.reportqty = fqty; //宸插彂鏁伴噺= 鍙戞枡鏁伴噺
+ rt.startqty = kfqty; //鍙戞枡鏁伴噺=鍓╀綑鍙彂鏁伴噺
+ mes.code = "200";
+ mes.count = 2;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //鏈彂鏁伴噺=浠诲姟鏁伴噺
+ rt.reportqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //宸插彂鏁伴噺=浠诲姟鏁伴噺
+ rt.startqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //鍙戞枡鏁伴噺=浠诲姟鏁伴噺
+ mes.code = "200";
+ mes.count = 2;
+ mes.message = "寮圭獥鍙戞枡鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else //闈為閬�
+ {
+ //鏌ユ壘褰撳墠宸ュ簭涓婂埌宸ュ簭(鑷埗鎴栬�呭鍗�)
+ sql = @"select A.step_code,S.stepname,S.flwtype from TK_Wrk_Step A
+ left join TStep S on A.step_code=S.stepcode
+ where A.wo_code=@wocode and A.seq=@seq-1";
+ dynamicParams.Add("@wocode", data.Rows[0]["WO_CODE"].ToString());
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["SEQ"].ToString()));
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ //1.闈為閬撳伐搴忔椂锛屽垽鏂湰閬撴槸鍚︽湁鍙戞枡璁板綍
+ sql = @"select * from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)//鏈亾鏈夊彂鏂欒褰�
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "Z") //鍒ゆ柇涓婇亾宸ュ簭灞炴�э細鑷埗宸ュ簭
+ {
+ //鏌ユ壘涓婂埌宸ュ簭鎶ュ伐璁板綍
+ sql = @"select * from TK_Wrk_Record where wo_code=@ordercode and step_code=@stepcode and style='B'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", data0.Rows[0]["STEP_CODE"].ToString());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count > 0) //涓婇亾鏈夋姤宸�
+ {
+ decimal sgood_qty = data3.AsEnumerable().Select(d => d.Field<decimal>("GOOD_QTY")).Sum(); //鏈亾鎶ュ伐鎬绘暟閲�
+ decimal sqty = data1.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum();//鏈亾鍙戞枡鏁伴噺
+ decimal ng_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum();// 鏈亾涓嶈壇鏁伴噺
+ decimal laborbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //鏈亾宸ュ簾鏁伴噺
+ decimal materielbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏈亾鏂欏簾鏁伴噺
+ //鏈亾鍓╀綑鍙彂鏁伴噺=涓婇亾鎶ュ伐鏁伴噺-鏈亾鍙戞枡鏁伴噺-鏈亾涓嶈壇鏁伴噺-鏈亾宸ュ簾鏁伴噺-鏈亾鏂欏簾鏁伴噺
+ decimal sybqty = sgood_qty - sqty - ng_qty - laborbad_qty - materielbad_qty;
+ if (sybqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + "鏃犲彲鍙戞暟閲�!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ if (sgood_qty == null || sgood_qty == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鍚堟牸浜у嚭涓�0,鏈亾涓嶅厑璁稿彂鏂�!";
+ mes.data = null;
+ return mes;
+ }
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = sybqty; //鏈彂鏁伴噺=鍓╀綑鍙彂鏁伴噺
+ rt.reportqty = sqty + ng_qty + laborbad_qty + materielbad_qty; //宸插彂鏁伴噺= 鏈亾鍙戞枡鏁伴噺+鏈亾涓嶈壇鏁伴噺+鏈亾宸ュ簾鏁伴噺+鏈亾鏂欏簾鏁伴噺
+ rt.startqty = sybqty; //鏀舵枡鏁伴噺=鍓╀綑鍙彂鏁伴噺
+
+ mes.code = "200";
+ mes.count = 2;
+ mes.message = "寮圭獥鍙戞枡鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else //鏃犳姤宸ヨ褰�
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鏈姤宸�,鏈亾涓嶅厑璁稿彂鏂�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "W") //鍒ゆ柇涓婇亾宸ュ簭灞炴�э細澶栧崗宸ュ簭
+ {
+ //鏌ユ壘涓婂埌宸ュ簭鏀舵枡璁板綍
+ sql = @"select * from TK_Wrk_OutRecord where wo_code=@ordercode and step_code=@stepcode and style='S'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", data0.Rows[0]["STEP_CODE"].ToString());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count > 0) //涓婇亾鏈夋敹鏂�
+ {
+ decimal ssqty = data3.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum();//涓婇亾鏀舵枡鏁伴噺
+ decimal sqty = data1.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum();//鏈亾鍙戞枡鏁伴噺
+ decimal ng_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum();// 鏈亾涓嶈壇鏁伴噺
+ decimal laborbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //鏈亾宸ュ簾鏁伴噺
+ decimal materielbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏈亾鏂欏簾鏁伴噺
+ //鏈亾鍓╀綑鍙彂鏁伴噺=涓婇亾鏀舵枡鏁伴噺-鏈亾鍙戞枡鏁伴噺-鏈亾涓嶈壇鏁伴噺-鏈亾宸ュ簾鏁伴噺-鏈亾鏂欏簾鏁伴噺
+ decimal sybqty = ssqty - sqty - ng_qty - laborbad_qty - materielbad_qty;
+ if (sybqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + "鏃犲彲鍙戞暟閲�!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ if (ssqty == null || ssqty == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鍚堟牸鏀舵枡涓�0,鏈亾涓嶅厑璁稿彂鏂�!";
+ mes.data = null;
+ return mes;
+ }
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = sybqty; //鏈彂鏁伴噺=鍓╀綑鍙彂鏁伴噺
+ rt.reportqty = sqty + ng_qty + laborbad_qty + materielbad_qty; //宸插彂鏁伴噺= 鏈亾鍙戞枡鏁伴噺+鏈亾涓嶈壇鏁伴噺+鏈亾宸ュ簾鏁伴噺+鏈亾鏂欏簾鏁伴噺
+ rt.startqty = sybqty; //鏀舵枡鏁伴噺=鍓╀綑鍙彂鏁伴噺
+
+ mes.code = "200";
+ mes.count = 2;
+ mes.message = "寮圭獥鍙戞枡鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else //鏃犳姤宸ヨ褰�
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鏈彂鏂�,鏈亾涓嶅厑璁稿彂鏂�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ else //鏃犲彂鏂欒褰�
+ {
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "Z") //鑷埗宸ュ簭
+ {
+ //鏌ユ壘涓婂埌宸ュ簭鎶ュ伐璁板綍
+ sql = @"select * from TK_Wrk_Record where wo_code=@ordercode and step_code=@stepcode and style='B'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", data0.Rows[0]["STEP_CODE"].ToString());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count > 0) //涓婇亾鏈夋姤宸�
+ {
+ decimal sgood_qty = data3.AsEnumerable().Select(d => d.Field<decimal>("GOOD_QTY")).Sum(); //鏈亾鎶ュ伐鎬绘暟閲�
+
+ decimal sybqty = sgood_qty;//鏈亾鍓╀綑鍙彂鏁伴噺=涓婇亾鎶ュ伐鎬绘暟閲�
+ if (sgood_qty == null || sgood_qty == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鍚堟牸浜у嚭涓�0,鏈亾涓嶅厑璁稿彂鏂�!";
+ mes.data = null;
+ return mes;
+ }
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = sybqty; //鏈彂鏁伴噺=鍓╀綑鍙彂鏁伴噺
+ rt.reportqty = 0; //宸插彂鏁伴噺
+ rt.startqty = sybqty; //鏀舵枡鏁伴噺=鍓╀綑鍙彂鏁伴噺
+
+ mes.code = "200";
+ mes.count = 2;
+ mes.message = "寮圭獥鍙戞枡鐣岄潰!";
+ mes.data = rt;
+
+ }
+ else //鏃犳姤宸ヨ褰�
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鏈姤宸�,鏈亾涓嶅厑璁稿彂鏂�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ if (data0.Rows[0]["FLWTYPE"].ToString() == "W") //澶栧崗宸ュ簭
+ {
+ //鏌ユ壘涓婂埌宸ュ簭鏀舵枡璁板綍
+ sql = @"select * from TK_Wrk_OutRecord where wo_code=@ordercode and step_code=@stepcode and style='S'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", data0.Rows[0]["STEP_CODE"].ToString());
+ var data3 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data3.Rows.Count > 0) //涓婇亾鏈夋敹鏂�
+ {
+ decimal ssqty = data3.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum();//涓婇亾鏀舵枡鏁伴噺
+
+ decimal sybqty = ssqty;//鏈亾鍓╀綑鍙彂鏁伴噺=涓婇亾鏀舵枡鏁伴噺
+ if (sybqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + "鏃犲彲鍙戞暟閲�!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ if (ssqty == null || ssqty == 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鍚堟牸鏀舵枡涓�0,鏈亾涓嶅厑璁稿彂鏂�!";
+ mes.data = null;
+ return mes;
+ }
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = sybqty; //鏈彂鏁伴噺=鍓╀綑鍙彂鏁伴噺
+ rt.reportqty = 0; //宸插彂鏁伴噺
+ rt.startqty = sybqty; //鏀舵枡鏁伴噺=鍓╀綑鍙彂鏁伴噺
+
+ mes.code = "200";
+ mes.count = 2;
+ mes.message = "寮圭獥鍙戞枡鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else //鏃犳姤宸ヨ褰�
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鐨勪笂閬撳伐搴忥細" + data0.Rows[0]["STEPNAME"].ToString() + " 鏈敹鏂�,鏈亾涓嶅厑璁稿彂鏂�!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏈壘鍒板綋鍓嶅伐搴忕殑涓婇亾宸ュ簭淇℃伅,璇疯仈绯荤鐞嗗憳鏍稿疄!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case "IN": //鏀舵枡
+ switch (flwtype)
+ {
+ case "Z"://鑷埗
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏍囩涓鸿嚜鍒舵爣绛�,璇峰墠寰�鑷埗鎿嶄綔鏍囩椤垫壂鐮�!";
+ mes.data = null;
+ break;
+ case "W":
+ if (isbott == "Y") //棣栭亾宸ュ簭
+ {
+ //1.棣栭亾宸ュ簭鏃讹紝鍒ゆ柇鏄惁鏈夊彂鏂欒褰�
+ sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code,
+ isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F'
+ group by R.wo_code,R.step_code,R.wx_code,C.name,R.materiel_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0) //鏈夊彂鏂欒褰�
+ {
+ //1.棣栭亾宸ュ簭鏃讹紝鍒ゆ柇鏄惁鏈夋敹鏂欒褰�
+ sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code,
+ isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='S'
+ group by R.wo_code,R.step_code,R.wx_code,C.name,R.materiel_code";
+ //sql = @"select * from TK_Wrk_OutRecord where wo_code=@ordercode and step_code=@stepcode and style='S'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0) //鏈夋敹鏂欒褰�
+ {
+ decimal fqty = data0.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum();//鏈亾鍙戞枡鏁伴噺
+ decimal sqty = data1.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum();//鏈亾鏀舵枡鏁伴噺
+ decimal ng_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum();//鏈亾涓嶈壇鏁伴噺
+ decimal laborbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //鏈亾宸ュ簾鏁伴噺
+ decimal materielbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏈亾鏂欏簾鏁伴噺
+ //鍓╀綑鍙彂鏁伴噺=鏈亾鍙戞枡鏁伴噺-鏈亾鏀舵枡鏁伴噺-鏈亾涓嶈壇鏁伴噺-鏈亾宸ュ簾鏁伴噺-鏈亾鏂欏簾鏁伴噺
+ decimal ksqty = fqty - sqty - ng_qty - laborbad_qty - materielbad_qty;
+ if (ksqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鏃犲彲鏀舵枡鏁伴噺!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = ksqty; //鏈敹鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ rt.reportqty = sqty + ng_qty + laborbad_qty + materielbad_qty; //宸叉敹鏁伴噺
+ rt.startqty = ksqty; //鏀舵枡鏁伴噺=鏈亾鍙戞枡鏁伴噺
+
+ data0.Merge(data1);//灏嗘寚瀹氱殑dt鍚堝苟
+ rt.list = data0.AsEnumerable().GroupBy(r => new
+ {
+ wo_code = r["wo_code"],
+ step_code = r["step_code"],
+ code = r["code"],
+ name = r["name"]
+ }).Select(g => new
+ {
+ Name = g.Key.code,
+ tp = g.Key.name,
+ fqty = g.Sum(i => (decimal)i["fqty"]),
+ sqty = g.Sum(i => (decimal)i["sqty"]),
+ ng_qty = g.Sum(i => (decimal)i["ng_qty"]),
+ laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]),
+ materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"])
+ }).ToList();
+
+ mes.code = "200";
+ mes.count = 3;
+ mes.message = "寮圭獥鏀舵枡鐣岄潰!";
+ mes.data = rt;
+ }
+
+ }
+ else
+ {
+ decimal fqty = data0.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum();//鏈亾鍙戞枡鏁伴噺
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = fqty; //鏈敹鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ rt.reportqty = 0; //宸叉敹鏁伴噺
+ rt.startqty = fqty; //鏀舵枡鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ //
+ data0.Merge(data1);//灏嗘寚瀹氱殑dt鍚堝苟
+ rt.list = data0.AsEnumerable().GroupBy(r => new
+ {
+ wo_code = r["wo_code"],
+ step_code = r["step_code"],
+ code = r["code"],
+ name = r["name"]
+ }).Select(g => new
+ {
+ Name = g.Key.code,
+ tp = g.Key.name,
+ fqty = g.Sum(i => (decimal)i["fqty"]),
+ sqty = g.Sum(i => (decimal)i["sqty"]),
+ ng_qty = g.Sum(i => (decimal)i["ng_qty"]),
+ laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]),
+ materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"])
+ }).ToList();
+
+ mes.code = "200";
+ mes.count = 3;
+ mes.message = "寮圭獥鏀舵枡鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鏈彂鏂�,璇峰厛鍙戞枡!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else //闈為閬�
+ {
+ //鏌ユ壘褰撳墠宸ュ簭涓婂埌宸ュ簭(鑷埗鎴栬�呭鍗�)
+ sql = @"select A.step_code,S.stepname,S.flwtype from TK_Wrk_Step A
+ left join TStep S on A.step_code=S.stepcode
+ where A.wo_code=@wocode and A.seq=@seq-1";
+ dynamicParams.Add("@wocode", data.Rows[0]["WO_CODE"].ToString());
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["SEQ"].ToString()));
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0)
+ {
+ //1.闈為閬撳伐搴忔椂锛屽垽鏂湰閬撴槸鍚︽湁鍙戞枡璁板綍
+ sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code,
+ isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F'
+ group by R.wo_code,R.step_code,R.wx_code,C.name,R.materiel_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)//鏈亾鏈夊彂鏂欒褰�
+ {
+ //2.闈為閬撳伐搴忔椂锛屽垽鏂湰閬撴槸鍚︽湁鏀舵枡璁板綍
+ sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code,
+ isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='S'
+ group by R.wo_code,R.step_code,R.wx_code,C.name,R.materiel_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data2 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data2.Rows.Count > 0) //鏈夋敹鏂欒褰�
+ {
+ decimal fqty = data1.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum();//鏈亾鍙戞枡鏁伴噺
+ decimal sqty = data2.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum();//鏈亾鏀舵枡鏁伴噺
+ decimal ng_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum();//鏈亾涓嶈壇鏁伴噺
+ decimal laborbad_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //鏈亾宸ュ簾鏁伴噺
+ decimal materielbad_qty = data2.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏈亾鏂欏簾鏁伴噺
+ //鍓╀綑鍙彂鏁伴噺=鏈亾鍙戞枡鏁伴噺-鏈亾鏀舵枡鏁伴噺-鏈亾涓嶈壇鏁伴噺-鏈亾宸ュ簾鏁伴噺-鏈亾鏂欏簾鏁伴噺
+ decimal ksqty = fqty - sqty - ng_qty - laborbad_qty - materielbad_qty;
+ if (ksqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鏃犲彲鏀舵枡鏁伴噺!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = ksqty; //鏈敹鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ rt.reportqty = sqty + ng_qty + laborbad_qty + materielbad_qty; //宸叉敹鏁伴噺
+ rt.startqty = ksqty; //鏀舵枡鏁伴噺=鏈亾鍙戞枡鏁伴噺
+
+ data1.Merge(data2);//灏嗘寚瀹氱殑dt鍚堝苟
+ rt.list = data1.AsEnumerable().GroupBy(r => new
+ {
+ wo_code = r["wo_code"],
+ step_code = r["step_code"],
+ code = r["code"],
+ name = r["name"]
+ }).Select(g => new
+ {
+ Name = g.Key.code,
+ tp = g.Key.name,
+ fqty = g.Sum(i => (decimal)i["fqty"]),
+ sqty = g.Sum(i => (decimal)i["sqty"]),
+ ng_qty = g.Sum(i => (decimal)i["ng_qty"]),
+ laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]),
+ materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"])
+ }).ToList();
+
+ mes.code = "200";
+ mes.count = 3;
+ mes.message = "寮圭獥鏀舵枡鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ decimal fqty = data1.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum(); //鏈亾鍙戞枡鏁伴噺
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = fqty; //鏈敹鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ rt.reportqty = 0; //宸叉敹鏁伴噺
+ rt.startqty = fqty; //鏀舵枡鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ data1.Merge(data2);//灏嗘寚瀹氱殑dt鍚堝苟
+ rt.list = data1.AsEnumerable().GroupBy(r => new
+ {
+ wo_code = r["wo_code"],
+ step_code = r["step_code"],
+ code = r["code"],
+ name = r["name"]
+ }).Select(g => new
+ {
+ Name = g.Key.code,
+ tp = g.Key.name,
+ fqty = g.Sum(i => (decimal)i["fqty"]),
+ sqty = g.Sum(i => (decimal)i["sqty"]),
+ ng_qty = g.Sum(i => (decimal)i["ng_qty"]),
+ laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]),
+ materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"])
+ }).ToList();
+ mes.code = "200";
+ mes.count = 3;
+ mes.message = "寮圭獥鏀舵枡鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鏈彂鏂�,璇峰厛鍙戞枡!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏈壘鍒板綋鍓嶅伐搴忕殑涓婇亾宸ュ簭淇℃伅,璇疯仈绯荤鐞嗗憳鏍稿疄!";
+ mes.data = null;
+ return mes;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ return mes;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ #region[鐢熶骇寮�鎶ュ伐:鑷埗宸ュ簭浠诲姟寮�鎶ュ伐鍒ゆ柇锛氬伐鍗�+宸ュ簭鏉$爜,涓嶆寜搴忕敓浜
+ /// <summary>
+ /// 鎵爜淇℃伅涓哄伐鍗�+宸ュ簭鏉$爜
+ /// </summary>
+ /// <param name="ordercode">宸ュ崟缂栧彿</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <returns></returns>
+ public static ToMessage NoZZEncodingSeach(string ordercode, string stepcode)
+ {
+ var sql = "";
+ string flwtype = ""; //宸ュ簭灞炴��
+ string isbott = ""; //棣栭亾宸ュ簭
+ string isend = ""; //鏈亾宸ュ簭
+ List<object> list = new List<object>();
+ ScanStartReportData rt = new ScanStartReportData();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠宸ュ崟鏄惁鍏抽棴
+ sql = @"select * from TK_Wrk_Man where wo_code=@ordercode and status='CLOSED'";
+ dynamicParams.Add("@ordercode", ordercode);
+ var da0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (da0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟宸插叧闂�,涓嶅厑璁稿紑鎶ュ伐鎿嶄綔!";
+ mes.data = null;
+ return mes;
+ }
+
+ //1.鏍规嵁宸ュ崟+宸ュ簭鏌ユ壘褰撳墠宸ュ簭鏄惁棣栭亾宸ュ簭
+ sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.stepprice,A.seq,T.flwtype,T.descr,A.status,A.plan_quantity,A.plan_qty,A.isbott,A.isend,L.torg_code,L.torg_name
+ from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TOrganization L on M.wkshp_code=L.torg_code
+ where A.wo_code=@ordercode and A.step_code=@stepcode";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ rt.wkshopcode = data.Rows[0]["torg_code"].ToString(); //杞﹂棿缂栫爜
+ rt.wkshopname = data.Rows[0]["torg_name"].ToString(); //杞﹂棿鍚嶇О
+ rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //宸ュ崟鍙�
+ rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //浜у搧缂栫爜
+ rt.partname = data.Rows[0]["PARTNAME"].ToString(); //浜у搧鍚嶇О
+ rt.partspec = data.Rows[0]["PARTSPEC"].ToString(); //浜у搧瑙勬牸
+ rt.stepcode = data.Rows[0]["STEPCODE"].ToString(); //宸ュ簭缂栫爜
+ rt.stepname = data.Rows[0]["STEPNAME"].ToString(); //宸ュ簭鍚嶇О
+ rt.stepdesc = data.Rows[0]["DESCR"].ToString(); //宸ュ簭鎻忚堪
+ rt.stepprice = data.Rows[0]["STEPPRICE"].ToString(); //宸ュ簭宸ヤ环
+ rt.planquantity = decimal.Parse(data.Rows[0]["PLAN_QUANTITY"].ToString()); //浠诲姟鏁伴噺
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+
+ flwtype = data.Rows[0]["FLWTYPE"].ToString();//鑾峰彇宸ュ簭灞炴��
+ isbott = data.Rows[0]["ISBOTT"].ToString();//棣栭亾宸ュ簭
+ isend = data.Rows[0]["ISEND"].ToString();//鏈亾宸ュ簭
+ rt.seq = data.Rows[0]["SEQ"].ToString();//宸ュ簭搴忓彿
+
+ //鑾峰彇褰撳墠宸ュ簭涓嬮亾宸ュ簭
+ sql = @"select A.isbott,A.isend,T.stepcode,T.stepname,A.stepprice from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq+1 ";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["SEQ"].ToString()));
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0) //鏈変笅閬撳伐搴�
+ {
+ rt.nextstepcode = dt.Rows[0]["STEPCODE"].ToString();//涓嬮亾宸ュ簭缂栫爜
+ rt.nextstepname = dt.Rows[0]["STEPNAME"].ToString();//涓嬮亾宸ュ簭鍚嶇О
+ rt.nextstepprice = dt.Rows[0]["STEPPRICE"].ToString(); //涓嬮亾宸ュ簭宸ヤ环
+ }
+ if (isend == "Y") //褰撳墠宸ュ簭鏄湯閬撳伐搴�
+ {
+ rt.nextstepcode = "";//data.Rows[0]["STEPCODE"].ToString();//褰撳墠宸ュ簭缂栫爜
+ rt.nextstepname = "";// data.Rows[0]["STEPNAME"].ToString();//褰撳墠宸ュ簭鍚嶇О
+ rt.nextstepprice = "";// data.Rows[0]["STEPPRICE"].ToString();//褰撳墠宸ュ簭宸ヤ环
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭浠诲姟涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ switch (flwtype)
+ {
+ case "Z": //鑷埗宸ュ簭
+ //棣栭亾宸ュ簭鏃讹紝鍒ゆ柇鏄惁鏈夋姤宸ヨ褰�
+ sql = @"select * from TK_Wrk_Record where wo_code=@ordercode and step_code=@stepcode and style='B'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0)
+ {
+ decimal good_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("GOOD_QTY")).Sum(); //鎶ュ伐鎬绘暟閲�
+ decimal ng_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum(); //涓嶈壇鏁伴噺
+ decimal laborbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //宸ュ簾鏁伴噺
+ decimal materielbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏂欏簾鏁伴噺
+ //鍓╀綑鍙姤宸ユ暟閲�=浠诲姟鏁伴噺-(鎶ュ伐鏁伴噺+涓嶈壇鏁伴噺+宸ュ簾搴熸暟閲�+鏂欏簾鏁伴噺)
+ decimal kbqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()) - (good_qty + ng_qty + laborbad_qty + materielbad_qty);
+ if (kbqty <= 0)//鏃犲彲鎶ュ伐鏁伴噺
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭鏃犲彲鎶ュ伐鏁伴噺!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()) - good_qty - ng_qty - laborbad_qty - materielbad_qty; //鏈姤鏁伴噺=浠诲姟鏁伴噺-宸叉姤鏁伴噺-涓嶈壇鏁伴噺-宸ュ簾鏁伴噺-鏂欏簾鏁伴噺
+ rt.reportqty = good_qty + ng_qty + laborbad_qty + materielbad_qty; //宸叉姤鏁伴噺=鎶ュ伐鏁伴噺+涓嶈壇鏁伴噺+宸ュ簾鏁伴噺+鏂欏簾鏁伴噺
+ mes.code = "200";
+ mes.count = 1;
+ mes.message = "鏌ユ壘鎴愬姛!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //鏈姤鏁伴噺
+ rt.reportqty = 0; //宸叉姤鏁伴噺
+ mes.code = "200";
+ mes.count = 1;
+ mes.message = "鏌ユ壘鎴愬姛!";
+ mes.data = rt;
+ }
+ break;
+ case "W": //澶栧崗宸ュ簭
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟宸ュ簭浠诲姟涓哄鍗�,璇峰墠寰�澶栧崗鎿嶄綔鏍囩椤垫搷浣�!";
+ mes.data = null;
+ break;
+ default: //鑷埗+澶栧崗宸ュ簭
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ return mes;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鐢熶骇寮�鎶ュ伐:澶栧崗宸ュ簭浠诲姟寮�鎶ュ伐鍒ゆ柇:宸ュ崟鍙�+宸ュ簭,鎸夊簭鏀跺彂鏂橾
+ /// <summary>
+ /// 鎵爜淇℃伅涓哄伐鍗�+宸ュ簭鏉$爜
+ /// </summary>
+ /// <param name="ordercode">宸ュ崟缂栧彿</param>
+ /// <param name="stepcode">宸ュ簭缂栫爜</param>
+ /// <returns></returns>
+ public static ToMessage NoWXEncodingSeach(string SelectType, string ordercode, string stepcode)
+ {
+ var sql = "";
+ string flwtype = ""; //宸ュ簭灞炴��
+ string isbott = ""; //棣栭亾宸ュ簭
+ string isend = ""; //鏈亾宸ュ簭
+ List<object> list = new List<object>();
+ ScanStartReportDataOut rt = new ScanStartReportDataOut();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ //鍒ゆ柇褰撳墠宸ュ崟鏄惁鍏抽棴
+ sql = @"select * from TK_Wrk_Man where wo_code=@ordercode and status='CLOSED'";
+ dynamicParams.Add("@ordercode", ordercode);
+ var da0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (da0.Rows.Count > 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ崟宸插叧闂�,涓嶅厑璁稿紑鎶ュ伐鎿嶄綔!";
+ mes.data = null;
+ return mes;
+ }
+
+ //1.鏍规嵁宸ュ崟+宸ュ簭鏌ユ壘褰撳墠宸ュ簭鏄惁棣栭亾宸ュ簭
+ sql = @"select A.wo_code,P.partcode,P.partname,P.partspec, T.stepcode,T.stepname,A.seq,T.flwtype,T.descr,A.stepprice,A.status,A.plan_quantity,A.plan_qty,A.isbott,A.isend,L.torg_code,L.torg_name
+ from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ left join TK_Wrk_Man M on A.wo_code=M.wo_code
+ left join TMateriel_Info P on M.materiel_code=P.partcode
+ left join TOrganization L on M.wkshp_code=L.torg_code
+ where A.wo_code=@ordercode and A.step_code=@stepcode";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ rt.wkshopcode = data.Rows[0]["torg_code"].ToString(); //杞﹂棿缂栫爜
+ rt.wkshopname = data.Rows[0]["torg_name"].ToString(); //杞﹂棿鍚嶇О
+ rt.wo_code = data.Rows[0]["WO_CODE"].ToString(); //宸ュ崟鍙�
+ rt.partnumber = data.Rows[0]["PARTCODE"].ToString(); //浜у搧缂栫爜
+ rt.partname = data.Rows[0]["PARTNAME"].ToString(); //浜у搧鍚嶇О
+ rt.partspec = data.Rows[0]["PARTSPEC"].ToString(); //浜у搧瑙勬牸
+ rt.stepcode = data.Rows[0]["STEPCODE"].ToString(); //宸ュ簭缂栫爜
+ rt.stepname = data.Rows[0]["STEPNAME"].ToString(); //宸ュ簭鍚嶇О
+ rt.stepdesc = data.Rows[0]["DESCR"].ToString(); //宸ュ簭鎻忚堪
+ rt.planquantity = decimal.Parse(data.Rows[0]["PLAN_QUANTITY"].ToString()); //浠诲姟鏁伴噺
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.stepprice = data.Rows[0]["STEPPRICE"].ToString(); //宸ュ簭宸ヤ环
+ flwtype = data.Rows[0]["FLWTYPE"].ToString();//鑾峰彇宸ュ簭灞炴��
+ isbott = data.Rows[0]["ISBOTT"].ToString();//棣栭亾宸ュ簭
+ isend = data.Rows[0]["ISEND"].ToString();//鏈亾宸ュ簭
+ rt.seq = data.Rows[0]["SEQ"].ToString();//宸ュ簭搴忓彿
+
+ //鑾峰彇褰撳墠宸ュ簭涓嬮亾宸ュ簭
+ sql = @"select A.isbott,A.isend,T.stepcode,T.stepname,A.stepprice from TK_Wrk_Step A
+ left join TStep T on A.step_code=T.stepcode
+ where A.wo_code=@ordercode and A.seq=@seq+1 ";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@seq", decimal.Parse(data.Rows[0]["SEQ"].ToString()));
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+ if (dt.Rows.Count > 0) //鏈変笅閬撳伐搴�
+ {
+ rt.nextstepcode = dt.Rows[0]["STEPCODE"].ToString();//涓嬮亾宸ュ簭缂栫爜
+ rt.nextstepname = dt.Rows[0]["STEPNAME"].ToString();//涓嬮亾宸ュ簭鍚嶇О
+ rt.nextstepprice = dt.Rows[0]["STEPPRICE"].ToString(); //涓嬮亾宸ュ簭宸ヤ环
+ }
+ if (isend == "Y") //褰撳墠宸ュ簭鏄湯閬撳伐搴�
+ {
+ rt.nextstepcode = "";// data.Rows[0]["STEPCODE"].ToString();//褰撳墠宸ュ簭缂栫爜
+ rt.nextstepname = "";// data.Rows[0]["STEPNAME"].ToString();//褰撳墠宸ュ簭鍚嶇О
+ rt.nextstepprice = ""; //data.Rows[0]["NEXTSTEPPRICE"].ToString();//涓嬮亾宸ュ簭宸ヤ环
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鎵爜宸ュ簭浠诲姟涓嶅瓨鍦�!";
+ mes.data = null;
+ return mes;
+ }
+ switch (SelectType)
+ {
+ case "OUT": //鍙戞枡
+ switch (flwtype)
+ {
+ case "Z":
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏍囩涓鸿嚜鍒舵爣绛�,璇峰墠寰�鑷埗鎿嶄綔鏍囩椤垫壂鐮�!";
+ mes.data = null;
+ break;
+ case "W":
+ //1.鍒ゆ柇鏄惁鏈夊彂鏂欒褰�
+ sql = @"select * from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F'";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0) //鏈夊彂鏂欒褰�
+ {
+ decimal fqty = data0.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum(); //鍙戞枡鏁伴噺
+ decimal ng_qty = data0.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum();// 涓嶈壇鏁伴噺
+ decimal laborbad_qty = data0.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //宸ュ簾鏁伴噺
+ decimal materielbad_qty = data0.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏂欏簾鏁伴噺
+ decimal kfqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()) - fqty - ng_qty - laborbad_qty - materielbad_qty; //鍓╀綑鍙彂鏁伴噺
+ if (kfqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭鏃犲彲鍙戞枡鏁伴噺!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = kfqty; //鏈彂鏁伴噺=鍓╀綑鍙彂鏁伴噺
+ rt.reportqty = fqty; //宸插彂鏁伴噺= 鍙戞枡鏁伴噺
+ rt.startqty = kfqty; //鍙戞枡鏁伴噺=鍓╀綑鍙彂鏁伴噺
+ mes.code = "200";
+ mes.count = 2;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //鏈彂鏁伴噺=浠诲姟鏁伴噺
+ rt.reportqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //宸插彂鏁伴噺=浠诲姟鏁伴噺
+ rt.startqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //鍙戞枡鏁伴噺=浠诲姟鏁伴噺
+ mes.code = "200";
+ mes.count = 2;
+ mes.message = "寮圭獥鍙戞枡鐣岄潰!";
+ mes.data = rt;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case "IN": //鏀舵枡
+ switch (flwtype)
+ {
+ case "Z"://鑷埗
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鏍囩涓鸿嚜鍒舵爣绛�,璇峰墠寰�鑷埗鎿嶄綔鏍囩椤垫壂鐮�!";
+ mes.data = null;
+ break;
+ case "W":
+
+ //1.鍒ゆ柇鏄惁鏈夊彂鏂欒褰�
+ sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code,
+ isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='F'
+ group by R.wo_code,R.step_code,R.wx_code,C.name,R.materiel_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data0 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data0.Rows.Count > 0) //鏈夊彂鏂欒褰�
+ {
+ //1.鍒ゆ柇鏄惁鏈夋敹鏂欒褰�
+ sql = @"select R.wo_code,R.step_code,R.wx_code as code,C.name,R.materiel_code,
+ isnull(sum(R.fqty),0) as fqty,isnull(sum(R.sqty),0) as sqty,isnull(sum(R.ng_qty),0) as ng_qty,isnull(sum(R.laborbad_qty),0) as laborbad_qty,isnull(sum(R.materielbad_qty),0) as materielbad_qty
+ from TK_Wrk_OutRecord R
+ left join TCustomer C on R.wx_code=C.code
+ where R.wo_code=@ordercode and R.step_code=@stepcode and R.style='S'
+ group by R.wo_code,R.step_code,R.wx_code,C.name,R.materiel_code";
+ dynamicParams.Add("@ordercode", ordercode);
+ dynamicParams.Add("@stepcode", stepcode);
+ var data1 = DapperHelper.selectdata(sql, dynamicParams);
+ if (data1.Rows.Count > 0) //鏈夋敹鏂欒褰�
+ {
+ decimal fqty = data0.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum();//鏈亾鍙戞枡鏁伴噺
+ decimal sqty = data1.AsEnumerable().Select(d => d.Field<decimal>("SQTY")).Sum();//鏈亾鏀舵枡鏁伴噺
+ decimal ng_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("NG_QTY")).Sum();//鏈亾涓嶈壇鏁伴噺
+ decimal laborbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("LABORBAD_QTY")).Sum(); //鏈亾宸ュ簾鏁伴噺
+ decimal materielbad_qty = data1.AsEnumerable().Select(d => d.Field<decimal>("MATERIELBAD_QTY")).Sum(); //鏈亾鏂欏簾鏁伴噺
+ //鍓╀綑鍙彂鏁伴噺=鏈亾鍙戞枡鏁伴噺-鏈亾鏀舵枡鏁伴噺-鏈亾涓嶈壇鏁伴噺-鏈亾宸ュ簾鏁伴噺-鏈亾鏂欏簾鏁伴噺
+ decimal ksqty = fqty - sqty - ng_qty - laborbad_qty - materielbad_qty;
+ if (ksqty <= 0)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鏃犲彲鏀舵枡鏁伴噺!";
+ mes.data = null;
+ return mes;
+ }
+ else
+ {
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = ksqty; //鏈敹鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ rt.reportqty = sqty + ng_qty + laborbad_qty + materielbad_qty; //宸叉敹鏁伴噺
+ rt.startqty = ksqty; //鏀舵枡鏁伴噺=鏈亾鍙戞枡鏁伴噺
+
+ data0.Merge(data1);//灏嗘寚瀹氱殑dt鍚堝苟
+ rt.list = data0.AsEnumerable().GroupBy(r => new
+ {
+ wo_code = r["wo_code"],
+ step_code = r["step_code"],
+ code = r["code"],
+ name = r["name"]
+ }).Select(g => new
+ {
+ Name = g.Key.code,
+ tp = g.Key.name,
+ fqty = g.Sum(i => (decimal)i["fqty"]),
+ sqty = g.Sum(i => (decimal)i["sqty"]),
+ ng_qty = g.Sum(i => (decimal)i["ng_qty"]),
+ laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]),
+ materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"])
+ }).ToList();
+
+ mes.code = "200";
+ mes.count = 3;
+ mes.message = "寮圭獥鏀舵枡鐣岄潰!";
+ mes.data = rt;
+ }
+
+ }
+ else
+ {
+ decimal fqty = data0.AsEnumerable().Select(d => d.Field<decimal>("FQTY")).Sum();//鏈亾鍙戞枡鏁伴噺
+ rt.planqty = decimal.Parse(data.Rows[0]["PLAN_QTY"].ToString()); //浠诲姟瓒呬骇鎬绘暟閲�
+ rt.noreportqty = fqty; //鏈敹鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ rt.reportqty = 0; //宸叉敹鏁伴噺
+ rt.startqty = fqty; //鏀舵枡鏁伴噺=鏈亾鍙戞枡鏁伴噺
+ //
+ data0.Merge(data1);//灏嗘寚瀹氱殑dt鍚堝苟
+ rt.list = data0.AsEnumerable().GroupBy(r => new
+ {
+ wo_code = r["wo_code"],
+ step_code = r["step_code"],
+ code = r["code"],
+ name = r["name"]
+ }).Select(g => new
+ {
+ Name = g.Key.code,
+ tp = g.Key.name,
+ fqty = g.Sum(i => (decimal)i["fqty"]),
+ sqty = g.Sum(i => (decimal)i["sqty"]),
+ ng_qty = g.Sum(i => (decimal)i["ng_qty"]),
+ laborbad_qty = g.Sum(i => (decimal)i["laborbad_qty"]),
+ materielbad_qty = g.Sum(i => (decimal)i["materielbad_qty"])
+ }).ToList();
+
+ mes.code = "200";
+ mes.count = 3;
+ mes.message = "寮圭獥鏀舵枡鐣岄潰!";
+ mes.data = rt;
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠宸ュ簭锛�" + data.Rows[0]["STEPNAME"].ToString() + " 鏈彂鏂�,璇峰厛鍙戞枡!";
+ mes.data = null;
+ return mes;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ return mes;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Tools/SchedulingMethod.cs b/VueWebCoreApi/Tools/SchedulingMethod.cs
new file mode 100644
index 0000000..a255abd
--- /dev/null
+++ b/VueWebCoreApi/Tools/SchedulingMethod.cs
@@ -0,0 +1,75 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class SchedulingMethod
+ {
+ public static List<APSList> SchedulingMethodTF(string wocode, string wkshpcode, string partcode)
+ {
+ bool TF = true;
+ var dynamicParams = new DynamicParameters();
+ List<APSList> list = new List<APSList>(); //涓嶅睘浜庝骇绾跨殑鍗曟満
+ List<APSList> list0 = new List<APSList>(); //浜х嚎涓殑鍗曟満
+ List<APSList> list1 = new List<APSList>(); //浜х嚎
+ List<APSList> listSum = new List<APSList>(); //姹囨��
+ //鏌ヨ宸ヨ壓璺嚎鎵�鏈夌殑浜х嚎璁惧鎴栬�呭伐浣�
+ string sql = @"select distinct D.code,D.name from TK_Wrk_Man A
+ left join TFlw_Rout K on A.route_code=K.code
+ left join TFlw_Rtdt B on K.code=B.rout_code
+ left join TFlw_Rteqp C on B.step_code= C.step_code
+ left join TEqpInfo D on C.eqp_code=D.code
+ where A.wo_code=@wocode and A.materiel_code=@partcode
+ and D.enable='Y' and D.wksp_code=@wkshpcode
+ order by D.code";
+ dynamicParams.Add("@wocode", wocode);
+ dynamicParams.Add("@wkshpcode", wkshpcode);
+ dynamicParams.Add("@partcode", partcode);
+ var dt = DapperHelper.selectdata(sql, dynamicParams);
+
+ //(0)鏌ヨ鍏抽敭宸ュ簭鍏宠仈涓嶅睘浜庝骇绾跨殑璁惧鎴栬�呭伐浣�
+ string sql0 = @"select distinct A.wo_code, B.step_code,C.eqp_code,D.name,
+ isnull(D.operation_ration,0) AdvaDevicCropMob,
+ isnull(H.stand_value,0) AdvaDevicRhythm,
+ D.eqptype_code as style,
+ 'D' ClassType
+ from TK_Wrk_Man A
+ left join TFlw_Rout K on A.route_code=K.code
+ left join TFlw_Rtdt B on K.code=B.rout_code and B.first_choke='Y'
+ left join TFlw_Rteqp C on B.step_code= C.step_code
+ left join TEqpInfo D on C.eqp_code=D.code
+ left join TPrteEqp_Stad H on C.eqp_code= H.eqp_code and K.code=H.route_code and B.step_code=H.step_code
+ where A.wo_code=@wocode and H.materiel_code=@partcode and D.wksp_code=@wkshpcode and D.enable='Y'
+ order by C.eqp_code";
+ dynamicParams.Add("@wocode", wocode);
+ dynamicParams.Add("@wkshpcode", wkshpcode);
+ dynamicParams.Add("@partcode", partcode);
+ var dt0 = DapperHelper.selectdata(sql0, dynamicParams);
+
+ if (dt0.Rows.Count > 0)
+ {
+ for (int j = 0; j < dt0.Rows.Count; j++)
+ {
+ APSList asp = new APSList();
+ asp.wo_code = dt0.Rows[j]["wo_code"].ToString();
+ asp.step_id = dt0.Rows[j]["step_code"].ToString();
+ asp.eqp_id = dt0.Rows[j]["eqp_code"].ToString();
+ asp.name = dt0.Rows[j]["name"].ToString();
+ asp.AdvaDevicCropMob = dt0.Rows[j]["AdvaDevicCropMob"].ToString(); //绋煎姩鐜�
+ asp.AdvaDevicRhythm = dt0.Rows[j]["AdvaDevicRhythm"].ToString(); //鐢熶骇鑺傛媿
+ asp.Style = dt0.Rows[j]["Style"].ToString();
+ asp.ClassType = dt0.Rows[j]["ClassType"].ToString();
+ list.Add(asp);
+ }
+ }
+ //鍏抽敭宸ュ簭鍏宠仈鐨勮澶囧叏閮ㄦ槸鍗曟満
+ //缁勫悎鍑犵粍鏁版嵁婧�
+ listSum = list.ToList();
+ return listSum;
+ }
+ }
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/Tools/SeachEncode.cs b/VueWebCoreApi/Tools/SeachEncode.cs
new file mode 100644
index 0000000..138d232
--- /dev/null
+++ b/VueWebCoreApi/Tools/SeachEncode.cs
@@ -0,0 +1,368 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using VueWebCoreApi.Models;
+
+namespace VueWebCoreApi.Tools
+{
+ public class SeachEncode
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+ #region [鑾峰彇瑙勫垯缂栫爜]
+ /// <summary>
+ /// 鏍规嵁鍔熻兘缂栫爜鑾峰彇鏈�鏂拌鍒欑紪鐮�
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <returns></returns>
+ public static ToMessage EncodingSeach(string rightcode)
+ {
+ string sql, year, month, day, fdate, q, cunm2, Encode;
+ int digit2, value2, digit3, digitdiff;
+ bool stf;
+ List<object> list = new List<object>();
+ List<string> listdt = new List<string>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select prefix,filingdate,incbit,value from TCodeRules where menucode=@rightcode";
+ dynamicParams.Add("@rightcode", rightcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ string prefix = data.Rows[0]["PREFIX"].ToString(); //鍥哄畾瀛楁
+ string filingdate = data.Rows[0]["FILINGDATE"].ToString(); //鎻愪氦鏃ユ湡
+ int incbit = int.Parse(data.Rows[0]["INCBIT"].ToString()); //鑷浣嶆暟
+ string value = data.Rows[0]["VALUE"].ToString(); //娴佹按鍙�
+ if (int.Parse(value) > 0) //鍒ゆ柇鏄惁涓洪娆¤幏鍙�
+ {
+ switch (filingdate)
+ {
+ case "骞存湀鏃�":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ day = DateTime.Now.Day.ToString().PadLeft(2, '0');//鑾峰彇鏃�(2浣�)
+ fdate = year + month + day;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ sql = @"update TCodeRules set incbit=@incbit where menucode=@rightcode";
+ dynamicParams.Add("@incbit", digit3);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+ sql = @"update TCodeRules set value=@cunm2 where menucode=@rightcode";
+ dynamicParams.Add("@cunm2", cunm2);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ stf = DapperHelper.DoTransaction(list);
+ if (stf)
+ {
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ break;
+ case "骞存湀":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ fdate = year + month;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ sql = @"update TCodeRules set incbit=@incbit where menucode=@rightcode";
+ dynamicParams.Add("@incbit", digit3);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+
+ sql = @"update TCodeRules set value=@cunm2 where menucode=@rightcode";
+ dynamicParams.Add("@cunm2", cunm2);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ stf = DapperHelper.DoTransaction(list);
+ if (stf)
+ {
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ break;
+ case "骞�":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ fdate = year;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ sql = @"update TCodeRules set incbit=@incbit where menucode=@rightcode";
+ dynamicParams.Add("@incbit", digit3);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+ sql = @"update TCodeRules set value=@cunm2 where menucode=@rightcode";
+ dynamicParams.Add("@cunm2", cunm2);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ stf = DapperHelper.DoTransaction(list);
+ if (stf)
+ {
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch (filingdate)
+ {
+ case "骞存湀鏃�":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ day = DateTime.Now.Day.ToString().PadLeft(2, '0');//鑾峰彇鏃�(2浣�)
+ fdate = year + month + day;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ sql = @"update TCodeRules set incbit=@incbit where menucode=@rightcode";
+ dynamicParams.Add("@incbit", digit3);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+ sql = @"update TCodeRules set value=@cunm2 where menucode=@rightcode";
+ dynamicParams.Add("@cunm2", cunm2);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ stf = DapperHelper.DoTransaction(list);
+ if (stf)
+ {
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ break;
+ case "骞存湀":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ fdate = year + month;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ sql = @"update TCodeRules set incbit=@incbit where menucode=@rightcode";
+ dynamicParams.Add("@incbit", digit3);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+
+ sql = @"update TCodeRules set value=@cunm2 where menucode=@rightcode";
+ dynamicParams.Add("@cunm2", cunm2);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ stf = DapperHelper.DoTransaction(list);
+ if (stf)
+ {
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ break;
+ case "骞�":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ fdate = year;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ sql = @"update TCodeRules set incbit=@incbit where menucode=@rightcode";
+ dynamicParams.Add("@incbit", digit3);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+ sql = @"update TCodeRules set value=@cunm2 where menucode=@rightcode";
+ dynamicParams.Add("@cunm2", cunm2);
+ dynamicParams.Add("@rightcode", rightcode);
+ list.Add(new { str = sql, parm = dynamicParams });
+ stf = DapperHelper.DoTransaction(list);
+ if (stf)
+ {
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "澶辫触!";
+ mes.data = null;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏈缃紪鐮佽鍒�,鐢熸垚鍗曞彿澶辫触,璇疯缃紪鐮佷负銆�" + rightcode + "銆戠殑缂栫爜瑙勫垯!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+
+ }
+}
diff --git a/VueWebCoreApi/Tools/SeachEncodeJob.cs b/VueWebCoreApi/Tools/SeachEncodeJob.cs
new file mode 100644
index 0000000..a43eb2b
--- /dev/null
+++ b/VueWebCoreApi/Tools/SeachEncodeJob.cs
@@ -0,0 +1,265 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class SeachEncodeJob
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+ #region [鑾峰彇瑙勫垯缂栫爜鐢熸垚鐨勬潯鐮乚
+ /// <summary>
+ /// 鏍规嵁鍔熻兘缂栫爜鑾峰彇鏈�鏂拌鍒欑紪鐮�
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <returns></returns>
+ public static ToMessage EncodingSeach(string rightcode)
+ {
+ string sql, year, month, day, fdate, q, cunm2, Encode;
+ int digit2, value2, digit3, digitdiff;
+ bool stf;
+ List<object> list = new List<object>();
+ List<string> listdt = new List<string>();
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @"select prefix,filingdate,incbit,value from TCodeRules where menucode=@rightcode";
+ dynamicParams.Add("@rightcode", rightcode);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0)
+ {
+ string prefix = data.Rows[0]["PREFIX"].ToString(); //鍥哄畾瀛楁
+ string filingdate = data.Rows[0]["FILINGDATE"].ToString(); //鎻愪氦鏃ユ湡
+ int incbit = int.Parse(data.Rows[0]["INCBIT"].ToString()); //鑷浣嶆暟
+ string value = data.Rows[0]["VALUE"].ToString(); //娴佹按鍙�
+ if (int.Parse(value) > 0) //鍒ゆ柇鏄惁涓洪娆¤幏鍙�
+ {
+ switch (filingdate)
+ {
+ case "骞存湀鏃�":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ day = DateTime.Now.Day.ToString().PadLeft(2, '0');//鑾峰彇鏃�(2浣�)
+ fdate = year + month + day;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ break;
+ case "骞存湀":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ fdate = year + month;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ break;
+ case "骞�":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ fdate = year;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch (filingdate)
+ {
+ case "骞存湀鏃�":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ day = DateTime.Now.Day.ToString().PadLeft(2, '0');//鑾峰彇鏃�(2浣�)
+ fdate = year + month + day;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ break;
+ case "骞存湀":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ month = DateTime.Now.Month.ToString().PadLeft(2, '0');//鑾峰彇鏈�(2浣�)
+ fdate = year + month;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ break;
+ case "骞�":
+ year = DateTime.Now.Year.ToString().Substring(2, 2);//鑾峰彇骞�(2浣�)
+ fdate = year;
+ digit2 = value.Length;//鑾峰彇string绫诲瀷浣嶆暟
+ value2 = int.Parse(value) + 1;// 灏唖tring绫诲瀷杞寲涓篿nt鑷1
+ digit3 = value2.ToString().Length; //鑾峰彇杞寲鍚巌nt鍨嬬殑浣嶆暟
+ digitdiff = digit2 - digit3; //浣嶆暟涔嬪樊
+ q = "";
+ if (digitdiff < 0) //浣嶆暟宸负璐熸暟闇�瑕佽繘琛ヤ綅
+ {
+ cunm2 = value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ else
+ {
+ for (int i = 1; i <= digitdiff; i++)
+ {
+ q = q + "0";
+ }
+ cunm2 = q + value2.ToString();//鏈�缁堟祦姘村彿
+ }
+ Encode = prefix + fdate + cunm2; //鏈�缁堢紪鐮�
+
+ listdt.Add(Encode);
+ listdt.Add(cunm2);
+ mes.code = "200";
+ mes.message = "鎴愬姛!";
+ mes.data = listdt;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "鏈缃紪鐮佽鍒�,鐢熸垚鍗曞彿澶辫触,璇疯缃紪鐮佷负銆�" + rightcode + "銆戠殑缂栫爜瑙勫垯!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region[鏇存柊鏉$爜瑙勫垯琛╙
+ /// <summary>
+ /// 鏇存柊鏉$爜瑙勫垯琛�
+ /// </summary>
+ /// <param name="rightcode">鍔熻兘缂栫爜</param>
+ /// <param name="incbit">娴佹按鍙�</param>
+ /// <returns></returns>
+ public static List<object> StrEncodingUpdate(string rightcode, string incbit)
+ {
+ List<object> list = new List<object>();
+ list.Clear();
+ string sql = @"update TCodeRules set value=@cunm2,incbit=@incbit where menucode=@rightcode";
+ list.Add(new { str = sql, parm = new { rightcode = rightcode, cunm2 = incbit, incbit = incbit.Length } });
+ return list;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/TJson.cs b/VueWebCoreApi/Tools/TJson.cs
new file mode 100644
index 0000000..1a8a49e
--- /dev/null
+++ b/VueWebCoreApi/Tools/TJson.cs
@@ -0,0 +1,30 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class TJson
+ {
+ public static HttpResponseMessage toJson(Object obj)
+ {
+ String str;
+ if (obj is String || obj is Char)
+ {
+ str = obj.ToString();
+ }
+ else
+ {
+ var timeConverter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
+ str = JsonConvert.SerializeObject(obj, Formatting.Indented, timeConverter);
+ }
+ HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json") };
+ return result;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Tools/TOrganizationRecursion.cs b/VueWebCoreApi/Tools/TOrganizationRecursion.cs
new file mode 100644
index 0000000..cd504a7
--- /dev/null
+++ b/VueWebCoreApi/Tools/TOrganizationRecursion.cs
@@ -0,0 +1,115 @@
+锘縰sing Dapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class TOrganizationRecursion
+ {
+ public static ToMessage mes = new ToMessage(); //瀹氫箟鍏ㄥ眬杩斿洖淇℃伅瀵硅薄
+
+ #region [鏍规嵁褰撳墠缁勭粐缂栫爜鑾峰彇鎵�鏈夊瓙鑺傜偣缁勭粐(鍖呭惈鑷韩,甯﹀崟寮曞彿)]
+ /// <summary>
+ /// 鏍规嵁褰撳墠缁勭粐缂栫爜鑾峰彇鎵�鏈夊瓙鑺傜偣缁勭粐(鍖呭惈鑷韩,甯﹀崟寮曞彿)
+ /// </summary>
+ /// <param name="torg_code">缁勭粐缂栫爜</param>
+ /// <returns></returns>
+ public static ToMessage TOrgCodeSeach(string torg_code)
+ {
+ string sql;
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @" WITH RecursiveCTE AS (
+ SELECT id, parent_id, torg_code, torg_name, status, leve, torg_seq
+ FROM TOrganization
+ WHERE torg_code = @torg_code
+ UNION ALL
+ SELECT o.id, o.parent_id, o.torg_code, o.torg_name, o.status, o.leve, o.torg_seq
+ FROM TOrganization o
+ INNER JOIN RecursiveCTE r ON r.torg_code = o.parent_id
+ )
+ SELECT STUFF((SELECT ',' + QUOTENAME(torg_code, '''') FROM RecursiveCTE
+ FOR XML PATH('')), 1, 1, '') AS torg_codelist";
+ dynamicParams.Add("@torg_code", torg_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0&&data.Rows[0]["torg_codelist"].ToString()!=null&& data.Rows[0]["torg_codelist"].ToString()!="")
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.Rows[0]["torg_codelist"].ToString();
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鐢ㄦ埛鎵�灞炵粍缁囩紪鐮併��" + torg_code + "銆戜笉瀛樺湪鎴栦负绌�!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+
+ #region [鏍规嵁褰撳墠缁勭粐缂栫爜鑾峰彇鎵�鏈夊瓙鑺傜偣缁勭粐(鍖呭惈鑷韩,涓嶅甫鍗曞紩鍙�)]
+ /// <summary>
+ /// 鏍规嵁褰撳墠缁勭粐缂栫爜鑾峰彇鎵�鏈夊瓙鑺傜偣缁勭粐(鍖呭惈鑷韩,涓嶅甫鍗曞紩鍙�)
+ /// </summary>
+ /// <param name="torg_code">缁勭粐缂栫爜</param>
+ /// <returns></returns>
+ public static ToMessage TOrgCodeSeachNo(string torg_code)
+ {
+ string sql;
+ var dynamicParams = new DynamicParameters();
+ try
+ {
+ sql = @" WITH RecursiveCTE AS (
+ SELECT id, parent_id, torg_code, torg_name, status, leve, torg_seq
+ FROM TOrganization
+ WHERE torg_code = @torg_code
+ UNION ALL
+ SELECT o.id, o.parent_id, o.torg_code, o.torg_name, o.status, o.leve, o.torg_seq
+ FROM TOrganization o
+ INNER JOIN RecursiveCTE r ON r.torg_code = o.parent_id
+ )
+ SELECT STUFF((SELECT ',' + torg_code FROM RecursiveCTE
+ FOR XML PATH('')), 1, 1, '') AS torg_codelist";
+ dynamicParams.Add("@torg_code", torg_code);
+ var data = DapperHelper.selectdata(sql, dynamicParams);
+ if (data.Rows.Count > 0 && data.Rows[0]["torg_codelist"].ToString() != null)
+ {
+ mes.code = "200";
+ mes.count = 0;
+ mes.message = "鏌ヨ鎴愬姛!";
+ mes.data = data.Rows[0]["torg_codelist"].ToString();
+ }
+ else
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = "褰撳墠鐢ㄦ埛鎵�灞炵粍缁囩紪鐮併��" + torg_code + "銆戜笉瀛樺湪!";
+ mes.data = null;
+ }
+ }
+ catch (Exception e)
+ {
+ mes.code = "300";
+ mes.count = 0;
+ mes.message = e.Message;
+ mes.data = null;
+ }
+ return mes;
+ }
+ #endregion
+ }
+}
diff --git a/VueWebCoreApi/Tools/ToMessage.cs b/VueWebCoreApi/Tools/ToMessage.cs
new file mode 100644
index 0000000..f881491
--- /dev/null
+++ b/VueWebCoreApi/Tools/ToMessage.cs
@@ -0,0 +1,24 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Tools
+{
+ public class ToMessage
+ {
+ public string code { get; set; }
+ public int count { get; set; }
+ public string message { get; set; }
+ public object data { get; set; }
+
+ public HttpResponseMessage ResponseMess(ToMessage mes)
+ {
+ HttpResponseMessage result = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(mes), System.Text.Encoding.UTF8) };
+ return result;
+ }
+ }
+}
diff --git a/VueWebCoreApi/Util/Message.cs b/VueWebCoreApi/Util/Message.cs
new file mode 100644
index 0000000..942f9f7
--- /dev/null
+++ b/VueWebCoreApi/Util/Message.cs
@@ -0,0 +1,38 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Util
+{
+ public class MessageBase
+ {
+ public string id;
+ public string appKey;
+ public string msgType;
+ public string time;
+ public object bizContent;
+ }
+
+ public class AppTestContent
+ {
+ public string message;
+ }
+
+ public class AppTicketContent
+ {
+ public string appTicket;
+ }
+
+ public class OrgTempAuthContent
+ {
+ public string tempAuthCode;
+ public string state;
+ }
+
+ public class OrderPayContent
+ {
+ public string orderNo;
+ public string orgId;
+ }
+}
diff --git a/VueWebCoreApi/Util/OpenapiHelper.cs b/VueWebCoreApi/Util/OpenapiHelper.cs
new file mode 100644
index 0000000..8f2e17d
--- /dev/null
+++ b/VueWebCoreApi/Util/OpenapiHelper.cs
@@ -0,0 +1,60 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Util
+{
+ public class OpenapiHelper
+ {
+ // <summary>
+ /// AES 鍔犲瘑
+ /// </summary>
+ /// <param name="str">鏄庢枃锛堝緟鍔犲瘑锛�</param>
+ /// <param name="key">瀵嗘枃</param>
+ /// <returns></returns>
+ public static string AesEncrypt(string str, string key)
+ {
+ if (string.IsNullOrEmpty(str)) return null;
+ Byte[] toEncryptArray = Encoding.UTF8.GetBytes(str);
+
+ RijndaelManaged rm = new RijndaelManaged
+ {
+ Key = Encoding.UTF8.GetBytes(key),
+ Mode = CipherMode.ECB,
+ Padding = PaddingMode.PKCS7
+ };
+
+ ICryptoTransform cTransform = rm.CreateEncryptor();
+ Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
+
+ return Convert.ToBase64String(resultArray, 0, resultArray.Length);
+ }
+
+ /// <summary>
+ /// AES 瑙e瘑
+ /// </summary>
+ /// <param name="str">鏄庢枃锛堝緟瑙e瘑锛�</param>
+ /// <param name="key">瀵嗘枃</param>
+ /// <returns></returns>
+ public static string AesDecrypt(string str, string key)
+ {
+ if (string.IsNullOrEmpty(str)) return null;
+ Byte[] toEncryptArray = Convert.FromBase64String(str);
+
+ RijndaelManaged rm = new RijndaelManaged
+ {
+ Key = Encoding.UTF8.GetBytes(key),
+ Mode = CipherMode.ECB,
+ Padding = PaddingMode.PKCS7
+ };
+
+ ICryptoTransform cTransform = rm.CreateDecryptor();
+ Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
+
+ return Encoding.UTF8.GetString(resultArray);
+ }
+ }
+}
diff --git a/VueWebCoreApi/Util/config.cs b/VueWebCoreApi/Util/config.cs
new file mode 100644
index 0000000..938eac7
--- /dev/null
+++ b/VueWebCoreApi/Util/config.cs
@@ -0,0 +1,25 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace VueWebCoreApi.Util
+{
+ public class config
+ {
+ public const string Url_Server = "https://openapi.chanjet.com";
+ public const string Key_encryptKey = "1234567890123456";
+
+ public const string Url_getTokenbyTempCode = "/auth/getToken";
+ public const string Url_getTokenbyPemCode = "/auth/token/getTokenByPermanentCode";
+
+ //鑾峰彇搴旂敤鍑瘉
+ public const string Url_getAppAccessToken = "/auth/appAuth/getAppAccessToken";
+ //鑾峰彇浼佷笟姘镐箙鎺堟潈鐮�
+ public const string Url_getOrgPemAuthCode = "/auth/orgAuth/getPermanentAuthCode";
+ //鑾峰彇浼佷笟鍑瘉
+ public const string Url_getOrgAccessToken = "/auth/orgAuth/getOrgAccessToken";
+ //绔嬪嵆瑙﹀彂appTicket鎺ㄩ��
+ public const string Url_getAppTicket = "/auth/appTicket/resend";
+ }
+}
diff --git a/VueWebCoreApi/VueWebCoreApi.csproj b/VueWebCoreApi/VueWebCoreApi.csproj
new file mode 100644
index 0000000..c086036
--- /dev/null
+++ b/VueWebCoreApi/VueWebCoreApi.csproj
@@ -0,0 +1,82 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+ <PropertyGroup>
+ <TargetFramework>netcoreapp3.1</TargetFramework>
+ <SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
+ <UserSecretsId>779cd365-c17d-4e17-92df-cf5d66806042</UserSecretsId>
+ <DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+ <OutputPath>bin\</OutputPath>
+ <DocumentationFile>bin\VueWebCoreApi.xml</DocumentationFile>
+ <NoWarn>1701;1702;1591</NoWarn>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
+ <OutputPath>bin\</OutputPath>
+ <DocumentationFile>bin\VueWebCoreApi.xml</DocumentationFile>
+ <NoWarn>1701;1702;1591</NoWarn>
+ <Optimize>false</Optimize>
+ <DefineConstants>TRACE</DefineConstants>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Dapper" Version="2.0.143" />
+ <PackageReference Include="DocumentFormat.OpenXml" Version="2.20.0" />
+ <PackageReference Include="Jiguang.JPush" Version="1.2.4" />
+ <PackageReference Include="JWT" Version="8.0.0" />
+ <PackageReference Include="log4net" Version="2.0.14" />
+ <PackageReference Include="Microsoft.AspNet.SignalR.Core" Version="2.0.1" />
+ <PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.0.0" />
+ <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />
+ <PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.1.21" />
+ <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
+ <PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.1.2" />
+ <PackageReference Include="Microsoft.AspNetCore.Session" Version="2.1.1" />
+ <PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0" />
+ <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.0" />
+ <PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="3.0.0" />
+ <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.11.1" />
+ <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
+ <PackageReference Include="NPOI" Version="2.5.6" />
+ <PackageReference Include="Quartz" Version="3.3.3" />
+ <PackageReference Include="ServiceStack.Redis" Version="5.0.0" />
+ <PackageReference Include="StackExchange.Redis" Version="2.7.10" />
+ <PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />
+ <PackageReference Include="System.Data.OleDb" Version="4.6.0" />
+ <PackageReference Include="System.Data.SqlClient" Version="4.5.0" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Folder Include="InExcel\" />
+ <Folder Include="wwwroot\DeviceRecordImage\image1\" />
+ <Folder Include="wwwroot\DeviceRecordImage\image2\" />
+ <Folder Include="wwwroot\newxls\" />
+ <Folder Include="wwwroot\MouldRecordImage\" />
+ <Folder Include="wwwroot\DeviceSopFile\" />
+ <Folder Include="wwwroot\ProcessSopFile\" />
+ <Folder Include="wwwroot\WrkOrderSopFile\" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Include="wwwroot\Excel\寰�鏉ュ崟浣�.xls" />
+ <None Include="wwwroot\Excel\鐗╂枡娓呭崟.xls" />
+ <None Include="wwwroot\Excel\缂洪櫡瀹氫箟.xls" />
+ <None Include="wwwroot\Excel\鑺傛媿宸ヤ环.xls" />
+ <None Include="wwwroot\Excel\璁惧淇濆吇鏍囧噯.xls" />
+ <None Include="wwwroot\Excel\璁惧淇濆吇椤圭洰.xls" />
+ <None Include="wwwroot\Excel\璁惧娓呭崟.xls" />
+ <None Include="wwwroot\Excel\璁惧鐐规鏍囧噯.xls" />
+ <None Include="wwwroot\Excel\璁惧鐐规椤圭洰.xls" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Content Update="Config\log4net.config">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+
+
+</Project>
diff --git a/VueWebCoreApi/appsettings.Development.json b/VueWebCoreApi/appsettings.Development.json
new file mode 100644
index 0000000..8983e0f
--- /dev/null
+++ b/VueWebCoreApi/appsettings.Development.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ }
+}
diff --git a/VueWebCoreApi/appsettings.json b/VueWebCoreApi/appsettings.json
new file mode 100644
index 0000000..80b74b6
--- /dev/null
+++ b/VueWebCoreApi/appsettings.json
@@ -0,0 +1,32 @@
+锘縶
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ },
+ "AllowedHosts": "*",
+ //鏈嶅姟鍣ㄧ幆澧�
+ "ConnectionStrings": {
+ "DBServer": "Data Source=121.196.36.24,1533;Initial Catalog=vmes_yy;User ID=sa;Password=xkd@20230101;pooling=false",
+ //浼佷笟缂栫爜
+ "CompanyCode": "000",
+ //浼佷笟鍚嶇О
+ "CompanyName": "娴欐睙瀵呭瘏绉戞妧鏈夐檺鍏徃",
+ //redis浼佷笟閰嶇疆
+ "Enterprise": "NewYYMES",
+ //redis鏁版嵁搴撻摼鎺ラ厤缃甶p
+ "RedisConnIp": "127.0.0.1",
+ //redis鏁版嵁搴撻摼鎺ラ厤缃鍙e彿
+ "RedisConnPort": "6379",
+ //key澶辨晥鏃堕棿30绉�(reids銆乯wt鍏辩敤)
+ "RedisKeyTimeCont": "7200",
+ //session澶辨晥鏃堕棿
+ "InProc": "240",
+ //Excel瀵煎嚭妯℃澘閰嶇疆IP
+ "FileIP": "http://121.196.36.24:8042/",
+ //jwtkey
+ "SigningKey": "Hello World"
+ }
+}
diff --git a/VueWebCoreApi/libman.json b/VueWebCoreApi/libman.json
new file mode 100644
index 0000000..5cb59aa
--- /dev/null
+++ b/VueWebCoreApi/libman.json
@@ -0,0 +1,14 @@
+{
+ "version": "1.0",
+ "defaultProvider": "unpkg",
+ "libraries": [
+ {
+ "library": "@aspnet/signalr@1.0.2",
+ "destination": "lib/aspnet/signalr/",
+ "files": [
+ "dist/browser/signalr.js",
+ "dist/browser/signalr.min.js"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_1.png
new file mode 100644
index 0000000..d19d940
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_1_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_1_1.png
new file mode 100644
index 0000000..12e078c
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_1_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_2.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_2.png
new file mode 100644
index 0000000..a2a072b
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_2.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_2_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_2_1.png
new file mode 100644
index 0000000..cc16800
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_2_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_2_5.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_2_5.png
new file mode 100644
index 0000000..fb631b6
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_2_5.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_3.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_3.png
new file mode 100644
index 0000000..7c775c9
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_3.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_3_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_3_1.png
new file mode 100644
index 0000000..3d077d7
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_3_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_3_2.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_3_2.png
new file mode 100644
index 0000000..7a5e7ed
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_3_2.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_4.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_4.png
new file mode 100644
index 0000000..b6cce43
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_4.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_4_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_1.png
new file mode 100644
index 0000000..bad5496
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_4_2.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_2.png
new file mode 100644
index 0000000..2db937a
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_2.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_4_3.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_3.png
new file mode 100644
index 0000000..35e7ffa
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_3.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_4_4.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_4.png
new file mode 100644
index 0000000..a22f8b1
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_4.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_4_5.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_5.png
new file mode 100644
index 0000000..c639232
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_4_5.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5.png
new file mode 100644
index 0000000..b6cce43
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_0.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_0.png
new file mode 100644
index 0000000..bcc42f8
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_0.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_1.png
new file mode 100644
index 0000000..2adfdcc
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_10.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_10.png
new file mode 100644
index 0000000..d512935
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_10.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_11.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_11.png
new file mode 100644
index 0000000..309c8bf
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_11.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_2.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_2.png
new file mode 100644
index 0000000..e8fa27d
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_2.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_3.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_3.png
new file mode 100644
index 0000000..c639232
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_3.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_4.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_4.png
new file mode 100644
index 0000000..ad08cb7
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_4.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_5.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_5.png
new file mode 100644
index 0000000..13fcc9c
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_5.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_6.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_6.png
new file mode 100644
index 0000000..197f759
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_6.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_7.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_7.png
new file mode 100644
index 0000000..6aa270f
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_7.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_8.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_8.png
new file mode 100644
index 0000000..a4ab53b
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_8.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_5_9.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_9.png
new file mode 100644
index 0000000..6c2981e
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_5_9.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6.png
new file mode 100644
index 0000000..4d40ea4
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_1.png
new file mode 100644
index 0000000..d05f494
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_10.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_10.png
new file mode 100644
index 0000000..91bc400
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_10.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_11.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_11.png
new file mode 100644
index 0000000..1ebb6f4
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_11.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_12.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_12.png
new file mode 100644
index 0000000..ba94d5c
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_12.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_13.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_13.png
new file mode 100644
index 0000000..a4ab53b
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_13.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_14.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_14.png
new file mode 100644
index 0000000..6c2981e
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_14.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_2.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_2.png
new file mode 100644
index 0000000..d512935
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_2.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_3.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_3.png
new file mode 100644
index 0000000..a9431b2
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_3.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_4.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_4.png
new file mode 100644
index 0000000..2d2d722
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_4.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_5.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_5.png
new file mode 100644
index 0000000..8bcaccc
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_5.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_6.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_6.png
new file mode 100644
index 0000000..2353e4d
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_6.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_7.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_7.png
new file mode 100644
index 0000000..23f5f22
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_7.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_8.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_8.png
new file mode 100644
index 0000000..d3397cd
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_8.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_6_9.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_9.png
new file mode 100644
index 0000000..6542617
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_6_9.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_7.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_7.png
new file mode 100644
index 0000000..2692939
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_7.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_7_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_7_1.png
new file mode 100644
index 0000000..de23f64
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_7_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_7_2.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_7_2.png
new file mode 100644
index 0000000..b0dc94c
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_7_2.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_8.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_8.png
new file mode 100644
index 0000000..3bb319a
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_8.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_8_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_8_1.png
new file mode 100644
index 0000000..795daa7
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_8_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_8_2.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_8_2.png
new file mode 100644
index 0000000..cee7be0
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_8_2.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_8_3.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_8_3.png
new file mode 100644
index 0000000..b0e1b4c
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_8_3.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_9.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_9.png
new file mode 100644
index 0000000..5b39989
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_9.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_9_1.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_9_1.png
new file mode 100644
index 0000000..cc16800
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_9_1.png
Binary files differ
diff --git a/VueWebCoreApi/wwwroot/AppMenuImage/app_9_2.png b/VueWebCoreApi/wwwroot/AppMenuImage/app_9_2.png
new file mode 100644
index 0000000..78a8592
--- /dev/null
+++ b/VueWebCoreApi/wwwroot/AppMenuImage/app_9_2.png
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\344\272\272\345\221\230\347\256\241\347\220\206.xls" "b/VueWebCoreApi/wwwroot/Excel/\344\272\272\345\221\230\347\256\241\347\220\206.xls"
new file mode 100644
index 0000000..5c22835
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\344\272\272\345\221\230\347\256\241\347\220\206.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\344\273\223\345\272\223\350\256\276\347\275\256.xls" "b/VueWebCoreApi/wwwroot/Excel/\344\273\223\345\272\223\350\256\276\347\275\256.xls"
new file mode 100644
index 0000000..48b36c5
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\344\273\223\345\272\223\350\256\276\347\275\256.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\345\255\230\350\264\247\346\241\243\346\241\210.xls" "b/VueWebCoreApi/wwwroot/Excel/\345\255\230\350\264\247\346\241\243\346\241\210.xls"
new file mode 100644
index 0000000..8cebcd0
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\345\255\230\350\264\247\346\241\243\346\241\210.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\345\262\227\344\275\215\347\256\241\347\220\206.xls" "b/VueWebCoreApi/wwwroot/Excel/\345\262\227\344\275\215\347\256\241\347\220\206.xls"
new file mode 100644
index 0000000..b00a08a
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\345\262\227\344\275\215\347\256\241\347\220\206.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\345\267\245\345\272\217\350\256\276\347\275\256.xls" "b/VueWebCoreApi/wwwroot/Excel/\345\267\245\345\272\217\350\256\276\347\275\256.xls"
new file mode 100644
index 0000000..4d42674
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\345\267\245\345\272\217\350\256\276\347\275\256.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\345\267\245\350\211\272\350\267\257\347\272\277.xls" "b/VueWebCoreApi/wwwroot/Excel/\345\267\245\350\211\272\350\267\257\347\272\277.xls"
new file mode 100644
index 0000000..e0f7ca8
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\345\267\245\350\211\272\350\267\257\347\272\277.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\345\272\223\344\275\215\350\256\276\347\275\256.xls" "b/VueWebCoreApi/wwwroot/Excel/\345\272\223\344\275\215\350\256\276\347\275\256.xls"
new file mode 100644
index 0000000..2986c37
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\345\272\223\344\275\215\350\256\276\347\275\256.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\345\276\200\346\235\245\345\215\225\344\275\215.xls" "b/VueWebCoreApi/wwwroot/Excel/\345\276\200\346\235\245\345\215\225\344\275\215.xls"
new file mode 100644
index 0000000..239f153
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\345\276\200\346\235\245\345\215\225\344\275\215.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\344\277\235\345\205\273\346\240\207\345\207\206.xls" "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\344\277\235\345\205\273\346\240\207\345\207\206.xls"
new file mode 100644
index 0000000..13c4662
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\344\277\235\345\205\273\346\240\207\345\207\206.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\344\277\235\345\205\273\351\241\271\347\233\256.xls" "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\344\277\235\345\205\273\351\241\271\347\233\256.xls"
new file mode 100644
index 0000000..0bb2474
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\344\277\235\345\205\273\351\241\271\347\233\256.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\346\270\205\345\215\225.xls" "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\346\270\205\345\215\225.xls"
new file mode 100644
index 0000000..0b589f0
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\346\270\205\345\215\225.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\347\202\271\346\243\200\346\240\207\345\207\206.xls" "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\347\202\271\346\243\200\346\240\207\345\207\206.xls"
new file mode 100644
index 0000000..c3886da
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\347\202\271\346\243\200\346\240\207\345\207\206.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\347\202\271\346\243\200\351\241\271\347\233\256.xls" "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\347\202\271\346\243\200\351\241\271\347\233\256.xls"
new file mode 100644
index 0000000..773ed55
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\346\250\241\345\205\267\347\202\271\346\243\200\351\241\271\347\233\256.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\347\211\251\346\226\231\346\270\205\345\215\225.xls" "b/VueWebCoreApi/wwwroot/Excel/\347\211\251\346\226\231\346\270\205\345\215\225.xls"
new file mode 100644
index 0000000..ec5befe
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\347\211\251\346\226\231\346\270\205\345\215\225.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\347\217\255\347\273\204\347\256\241\347\220\206.xls" "b/VueWebCoreApi/wwwroot/Excel/\347\217\255\347\273\204\347\256\241\347\220\206.xls"
new file mode 100644
index 0000000..f96e344
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\347\217\255\347\273\204\347\256\241\347\220\206.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\347\274\272\351\231\267\345\256\232\344\271\211.xls" "b/VueWebCoreApi/wwwroot/Excel/\347\274\272\351\231\267\345\256\232\344\271\211.xls"
new file mode 100644
index 0000000..cbf0ed8
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\347\274\272\351\231\267\345\256\232\344\271\211.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\350\212\202\346\213\215\345\267\245\344\273\267.xls" "b/VueWebCoreApi/wwwroot/Excel/\350\212\202\346\213\215\345\267\245\344\273\267.xls"
new file mode 100644
index 0000000..af8e14e
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\350\212\202\346\213\215\345\267\245\344\273\267.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\350\247\222\350\211\262\347\256\241\347\220\206.xls" "b/VueWebCoreApi/wwwroot/Excel/\350\247\222\350\211\262\347\256\241\347\220\206.xls"
new file mode 100644
index 0000000..42ef02b
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\350\247\222\350\211\262\347\256\241\347\220\206.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\344\277\235\345\205\273\346\240\207\345\207\206.xls" "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\344\277\235\345\205\273\346\240\207\345\207\206.xls"
new file mode 100644
index 0000000..e4bbf82
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\344\277\235\345\205\273\346\240\207\345\207\206.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\344\277\235\345\205\273\351\241\271\347\233\256.xls" "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\344\277\235\345\205\273\351\241\271\347\233\256.xls"
new file mode 100644
index 0000000..010179a
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\344\277\235\345\205\273\351\241\271\347\233\256.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\346\270\205\345\215\225.xls" "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\346\270\205\345\215\225.xls"
new file mode 100644
index 0000000..e1d0f91
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\346\270\205\345\215\225.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\347\202\271\346\243\200\346\240\207\345\207\206.xls" "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\347\202\271\346\243\200\346\240\207\345\207\206.xls"
new file mode 100644
index 0000000..a02e359
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\347\202\271\346\243\200\346\240\207\345\207\206.xls"
Binary files differ
diff --git "a/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\347\202\271\346\243\200\351\241\271\347\233\256.xls" "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\347\202\271\346\243\200\351\241\271\347\233\256.xls"
new file mode 100644
index 0000000..1e52556
--- /dev/null
+++ "b/VueWebCoreApi/wwwroot/Excel/\350\256\276\345\244\207\347\202\271\346\243\200\351\241\271\347\233\256.xls"
Binary files differ
--
Gitblit v1.9.3