diff --git a/shangjian/.vs/BL/v17/.suo b/shangjian/.vs/BL/v17/.suo
index f294f5f..dc8f773 100644
Binary files a/shangjian/.vs/BL/v17/.suo and b/shangjian/.vs/BL/v17/.suo differ
diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application
index b3f5981..3fd1503 100644
--- a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application
+++ b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application
@@ -14,7 +14,7 @@
- c0Rf+CYPtsvtvSUmXds9V3/rrktlKG3rzjN5DuQeWaE=
+ 9gelEpMO4qJ5KxvCk+ce67lmnH5+0CTvBVOkoSS5ic4=
diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe
index 9cb634b..c4e79b9 100644
Binary files a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe and b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe differ
diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest
index c9ccd2f..8bf238a 100644
--- a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest
+++ b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest
@@ -49,7 +49,7 @@
- JYnml/VunFI2cpX5vz9XEjoQbR4ehe5wE83P4SCElVc=
+ +6uGt7/UGrobhZzEzE1gWClphUGNE6QWTTfhav4xNS0=
diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.pdb b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.pdb
index e0497d2..358c1d7 100644
Binary files a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.pdb and b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.pdb differ
diff --git a/shangjian/AutoUpdate/bin/Debug/app.publish/AutoUpdate.exe b/shangjian/AutoUpdate/bin/Debug/app.publish/AutoUpdate.exe
index 9cb634b..c4e79b9 100644
Binary files a/shangjian/AutoUpdate/bin/Debug/app.publish/AutoUpdate.exe and b/shangjian/AutoUpdate/bin/Debug/app.publish/AutoUpdate.exe differ
diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application
index b3f5981..3fd1503 100644
--- a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application
+++ b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application
@@ -14,7 +14,7 @@
- c0Rf+CYPtsvtvSUmXds9V3/rrktlKG3rzjN5DuQeWaE=
+ 9gelEpMO4qJ5KxvCk+ce67lmnH5+0CTvBVOkoSS5ic4=
diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.AssemblyReference.cache b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.AssemblyReference.cache
index 0f5ecf5..e6e493b 100644
Binary files a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.AssemblyReference.cache and b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.csproj.AssemblyReference.cache differ
diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe
index 9cb634b..c4e79b9 100644
Binary files a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe and b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe differ
diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe.manifest b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe.manifest
index c9ccd2f..8bf238a 100644
--- a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe.manifest
+++ b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.exe.manifest
@@ -49,7 +49,7 @@
- JYnml/VunFI2cpX5vz9XEjoQbR4ehe5wE83P4SCElVc=
+ +6uGt7/UGrobhZzEzE1gWClphUGNE6QWTTfhav4xNS0=
diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.pdb b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.pdb
index e0497d2..358c1d7 100644
Binary files a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.pdb and b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.pdb differ
diff --git a/shangjian/CentralControl/bin/Debug/CentralControl.exe b/shangjian/CentralControl/bin/Debug/CentralControl.exe
index f6a3025..506d199 100644
Binary files a/shangjian/CentralControl/bin/Debug/CentralControl.exe and b/shangjian/CentralControl/bin/Debug/CentralControl.exe differ
diff --git a/shangjian/CentralControl/bin/Debug/CentralControl.pdb b/shangjian/CentralControl/bin/Debug/CentralControl.pdb
index e487470..dd780b8 100644
Binary files a/shangjian/CentralControl/bin/Debug/CentralControl.pdb and b/shangjian/CentralControl/bin/Debug/CentralControl.pdb differ
diff --git a/shangjian/CentralControl/bin/Debug/CommonFunc.dll b/shangjian/CentralControl/bin/Debug/CommonFunc.dll
index e91188f..c788329 100644
Binary files a/shangjian/CentralControl/bin/Debug/CommonFunc.dll and b/shangjian/CentralControl/bin/Debug/CommonFunc.dll differ
diff --git a/shangjian/CentralControl/bin/Debug/CommonFunc.pdb b/shangjian/CentralControl/bin/Debug/CommonFunc.pdb
index ed3a64c..b207f18 100644
Binary files a/shangjian/CentralControl/bin/Debug/CommonFunc.pdb and b/shangjian/CentralControl/bin/Debug/CommonFunc.pdb differ
diff --git a/shangjian/CentralControl/bin/Debug/XGL.Data.dll b/shangjian/CentralControl/bin/Debug/XGL.Data.dll
index be9ef4c..fb76a39 100644
Binary files a/shangjian/CentralControl/bin/Debug/XGL.Data.dll and b/shangjian/CentralControl/bin/Debug/XGL.Data.dll differ
diff --git a/shangjian/CentralControl/bin/Debug/XGL.Data.pdb b/shangjian/CentralControl/bin/Debug/XGL.Data.pdb
index 7730a09..fa9f67c 100644
Binary files a/shangjian/CentralControl/bin/Debug/XGL.Data.pdb and b/shangjian/CentralControl/bin/Debug/XGL.Data.pdb differ
diff --git a/shangjian/CentralControl/bin/Debug/XGL.Models.dll b/shangjian/CentralControl/bin/Debug/XGL.Models.dll
index 4a02928..ef6d10b 100644
Binary files a/shangjian/CentralControl/bin/Debug/XGL.Models.dll and b/shangjian/CentralControl/bin/Debug/XGL.Models.dll differ
diff --git a/shangjian/CentralControl/bin/Debug/XGL.Models.pdb b/shangjian/CentralControl/bin/Debug/XGL.Models.pdb
index 658c204..7b5f2df 100644
Binary files a/shangjian/CentralControl/bin/Debug/XGL.Models.pdb and b/shangjian/CentralControl/bin/Debug/XGL.Models.pdb differ
diff --git a/shangjian/CentralControl/bin/Debug/XGL.Thrift.dll b/shangjian/CentralControl/bin/Debug/XGL.Thrift.dll
index cac0fde..6594a30 100644
Binary files a/shangjian/CentralControl/bin/Debug/XGL.Thrift.dll and b/shangjian/CentralControl/bin/Debug/XGL.Thrift.dll differ
diff --git a/shangjian/CentralControl/bin/Debug/XGL.Thrift.pdb b/shangjian/CentralControl/bin/Debug/XGL.Thrift.pdb
index 874b283..b867864 100644
Binary files a/shangjian/CentralControl/bin/Debug/XGL.Thrift.pdb and b/shangjian/CentralControl/bin/Debug/XGL.Thrift.pdb differ
diff --git a/shangjian/CentralControl/obj/Debug/CentralControl.csproj.AssemblyReference.cache b/shangjian/CentralControl/obj/Debug/CentralControl.csproj.AssemblyReference.cache
index 788e3a5..032c8ac 100644
Binary files a/shangjian/CentralControl/obj/Debug/CentralControl.csproj.AssemblyReference.cache and b/shangjian/CentralControl/obj/Debug/CentralControl.csproj.AssemblyReference.cache differ
diff --git a/shangjian/CentralControl/obj/Debug/CentralControl.exe b/shangjian/CentralControl/obj/Debug/CentralControl.exe
index f6a3025..506d199 100644
Binary files a/shangjian/CentralControl/obj/Debug/CentralControl.exe and b/shangjian/CentralControl/obj/Debug/CentralControl.exe differ
diff --git a/shangjian/CentralControl/obj/Debug/CentralControl.pdb b/shangjian/CentralControl/obj/Debug/CentralControl.pdb
index e487470..dd780b8 100644
Binary files a/shangjian/CentralControl/obj/Debug/CentralControl.pdb and b/shangjian/CentralControl/obj/Debug/CentralControl.pdb differ
diff --git a/shangjian/CommonFunc/Tools/MachineRepairWin.xaml b/shangjian/CommonFunc/Tools/MachineRepairWin.xaml
index f1eef01..27738ee 100644
--- a/shangjian/CommonFunc/Tools/MachineRepairWin.xaml
+++ b/shangjian/CommonFunc/Tools/MachineRepairWin.xaml
@@ -5,8 +5,320 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CommonFunc.Tools"
mc:Ignorable="d"
- Title="MachineRepairWin" Height="450" Width="800">
+ Title="MachineRepairWin" Height="550" Width="900" WindowStartupLocation="CenterScreen" WindowStyle="None" Loaded="Window_Loaded">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/shangjian/CommonFunc/Tools/MachineRepairWin.xaml.cs b/shangjian/CommonFunc/Tools/MachineRepairWin.xaml.cs
index ca381a6..4bd2b2f 100644
--- a/shangjian/CommonFunc/Tools/MachineRepairWin.xaml.cs
+++ b/shangjian/CommonFunc/Tools/MachineRepairWin.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -11,6 +12,8 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
+using XGL.Models.Model;
+using XGL.Models.Model.OrderPrepare;
namespace CommonFunc.Tools
{
@@ -19,9 +22,94 @@ namespace CommonFunc.Tools
///
public partial class MachineRepairWin : Window
{
+ string _apiUrl = "";
public MachineRepairWin()
{
InitializeComponent();
}
+ public MachineRepairWin(string apiUrl)
+ {
+ InitializeComponent();
+ _apiUrl = apiUrl;
+ }
+ private void btnQueryUser_Click(object sender, RoutedEventArgs e)
+ {
+ string queryP = this.txtP.Text.Trim();
+ if (string.IsNullOrEmpty(queryP))
+ {
+ this.dgUserInfo.ItemsSource = Utils.userList;
+ return;
+ }
+ this.dgUserInfo.ItemsSource = null;
+ var queryList = Utils.userList.Where(t => t.nick_name.Contains(queryP) || t.user_name.Contains(queryP));
+
+ this.dgUserInfo.ItemsSource = queryList;
+ }
+
+ private void txtP_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ btnQueryUser_Click(null, null);
+ }
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ this.dgUserInfo.ItemsSource = Utils.userList;
+ }
+
+ private void btnCloseWin_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private async void btnUserConfirm_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (dgUserInfo.SelectedItems.Count <= 0)
+ {
+ CustomMessageBox.Show("请选择人员!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+ return;
+ }
+
+ sys_user user = dgUserInfo.SelectedItem as sys_user;
+ MachineRepairModel machineRepairModel = new MachineRepairModel();
+ machineRepairModel.equipmentCode = Utils.GetAppSetting("DeviceCode");
+ machineRepairModel.factory = Utils.GetAppSetting("SiteCode");
+ machineRepairModel.userName = user.user_name;
+ machineRepairModel.phoneNumber = user.phonenumber;
+ machineRepairModel.userNickName = user.nick_name;
+
+ // 将要发送的数据序列化为JSON格式
+ var jsonContent = JsonConvert.SerializeObject(machineRepairModel);
+ LogHelper.instance.log.Info($"开始报修>>" + jsonContent);
+ RestHelper restClient = new RestHelper();
+ //var response =;
+
+ Rootobjectresu result = Utils.DeJson(await restClient.PostAsync(_apiUrl, jsonContent));
+
+
+ if (result.code == 200)
+ {
+ LogHelper.instance.log.Info($"报修成功>>" + result.msg);
+ CustomMessageBox.Show($"调用报修接口成功", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+ }
+ else
+ {
+ LogHelper.instance.log.Error($"报修失败>>" + result.msg);
+ CustomMessageBox.Show($"调用报修接口失败:" + result.msg, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogHelper.instance.log.Error($"报修时发生异常>>" + ex.Message);
+ CustomMessageBox.Show($"调用报修接口时发生异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+ }
+
+ }
+
+ private void dgWorkOrderInfo_LoadingRow(object sender, DataGridRowEventArgs e)
+ {
+ e.Row.Header = (e.Row.GetIndex() + 1).ToString();
+ }
}
}
diff --git a/shangjian/CommonFunc/Tools/Utils.cs b/shangjian/CommonFunc/Tools/Utils.cs
index 452e899..5242e70 100644
--- a/shangjian/CommonFunc/Tools/Utils.cs
+++ b/shangjian/CommonFunc/Tools/Utils.cs
@@ -14,6 +14,8 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
+using XGL.Models;
+using XGL.Models.Model;
namespace CommonFunc.Tools
@@ -27,7 +29,7 @@ namespace CommonFunc.Tools
public static SqlServerDBHelper cloudDBHelper = new SqlServerDBHelper(SqlDataObject.GetCloudSqlConnectionString);
public static SqlServerDBHelper clientDBHelper = new SqlServerDBHelper(SqlDataObject.GetMESClientSqlConnectionString);
public static SqlServerDBHelper netClientDBHelper = new SqlServerDBHelper(SqlDataObject.GetMESNetClientSqlConnectionString);
-
+ public static List userList { get; set; }
public static string GetServerIP()
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(SqlDataObject.GetMESNetClientSqlConnectionString);
diff --git a/shangjian/LanJu/obj/Debug/LanJu.csproj.AssemblyReference.cache b/shangjian/LanJu/obj/Debug/LanJu.csproj.AssemblyReference.cache
index 6c695b1..d89fad1 100644
Binary files a/shangjian/LanJu/obj/Debug/LanJu.csproj.AssemblyReference.cache and b/shangjian/LanJu/obj/Debug/LanJu.csproj.AssemblyReference.cache differ
diff --git a/shangjian/LanJuControl/obj/Debug/LanJuControl.csproj.AssemblyReference.cache b/shangjian/LanJuControl/obj/Debug/LanJuControl.csproj.AssemblyReference.cache
index 630cd99..e653b41 100644
Binary files a/shangjian/LanJuControl/obj/Debug/LanJuControl.csproj.AssemblyReference.cache and b/shangjian/LanJuControl/obj/Debug/LanJuControl.csproj.AssemblyReference.cache differ
diff --git a/shangjian/LanJuLib/bin/Debug/CommonFunc.dll b/shangjian/LanJuLib/bin/Debug/CommonFunc.dll
index e91188f..c788329 100644
Binary files a/shangjian/LanJuLib/bin/Debug/CommonFunc.dll and b/shangjian/LanJuLib/bin/Debug/CommonFunc.dll differ
diff --git a/shangjian/LanJuLib/bin/Debug/CommonFunc.pdb b/shangjian/LanJuLib/bin/Debug/CommonFunc.pdb
index ed3a64c..b207f18 100644
Binary files a/shangjian/LanJuLib/bin/Debug/CommonFunc.pdb and b/shangjian/LanJuLib/bin/Debug/CommonFunc.pdb differ
diff --git a/shangjian/LanJuLib/bin/Debug/XGL.Models.dll b/shangjian/LanJuLib/bin/Debug/XGL.Models.dll
index 4a02928..ef6d10b 100644
Binary files a/shangjian/LanJuLib/bin/Debug/XGL.Models.dll and b/shangjian/LanJuLib/bin/Debug/XGL.Models.dll differ
diff --git a/shangjian/LanJuLib/bin/Debug/XGL.Models.pdb b/shangjian/LanJuLib/bin/Debug/XGL.Models.pdb
index 658c204..7b5f2df 100644
Binary files a/shangjian/LanJuLib/bin/Debug/XGL.Models.pdb and b/shangjian/LanJuLib/bin/Debug/XGL.Models.pdb differ
diff --git a/shangjian/LanJuLib/obj/Debug/LanJuLib.csproj.AssemblyReference.cache b/shangjian/LanJuLib/obj/Debug/LanJuLib.csproj.AssemblyReference.cache
index aad05bc..27de418 100644
Binary files a/shangjian/LanJuLib/obj/Debug/LanJuLib.csproj.AssemblyReference.cache and b/shangjian/LanJuLib/obj/Debug/LanJuLib.csproj.AssemblyReference.cache differ
diff --git a/shangjian/RestartApp/bin/Debug/RestartApp.exe b/shangjian/RestartApp/bin/Debug/RestartApp.exe
index 5cb60de..d6c53e2 100644
Binary files a/shangjian/RestartApp/bin/Debug/RestartApp.exe and b/shangjian/RestartApp/bin/Debug/RestartApp.exe differ
diff --git a/shangjian/RestartApp/bin/Debug/RestartApp.pdb b/shangjian/RestartApp/bin/Debug/RestartApp.pdb
index 86b9a47..b6ebbc1 100644
Binary files a/shangjian/RestartApp/bin/Debug/RestartApp.pdb and b/shangjian/RestartApp/bin/Debug/RestartApp.pdb differ
diff --git a/shangjian/RestartApp/obj/Debug/RestartApp.csproj.AssemblyReference.cache b/shangjian/RestartApp/obj/Debug/RestartApp.csproj.AssemblyReference.cache
index 293b360..03498a4 100644
Binary files a/shangjian/RestartApp/obj/Debug/RestartApp.csproj.AssemblyReference.cache and b/shangjian/RestartApp/obj/Debug/RestartApp.csproj.AssemblyReference.cache differ
diff --git a/shangjian/RestartApp/obj/Debug/RestartApp.csproj.CoreCompileInputs.cache b/shangjian/RestartApp/obj/Debug/RestartApp.csproj.CoreCompileInputs.cache
index d841009..612fb61 100644
--- a/shangjian/RestartApp/obj/Debug/RestartApp.csproj.CoreCompileInputs.cache
+++ b/shangjian/RestartApp/obj/Debug/RestartApp.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-03c0b79cd3691853fd4748eb06a5fdb72fc84d6a
+480a3b974159ff526098f6d65536fd513e8930601ce13afba64b502e068040c0
diff --git a/shangjian/RestartApp/obj/Debug/RestartApp.csproj.FileListAbsolute.txt b/shangjian/RestartApp/obj/Debug/RestartApp.csproj.FileListAbsolute.txt
index e547473..a710516 100644
--- a/shangjian/RestartApp/obj/Debug/RestartApp.csproj.FileListAbsolute.txt
+++ b/shangjian/RestartApp/obj/Debug/RestartApp.csproj.FileListAbsolute.txt
@@ -5,7 +5,6 @@ D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\bin\Debug\HtmlA
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\bin\Debug\HtmlAgilityPack.pdb
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\bin\Debug\HtmlAgilityPack.xml
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.csproj.AssemblyReference.cache
-D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.csproj.SuggestedBindingRedirects.cache
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.csproj.CoreCompileInputs.cache
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.csproj.CopyComplete
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.exe
diff --git a/shangjian/RestartApp/obj/Debug/RestartApp.csproj.SuggestedBindingRedirects.cache b/shangjian/RestartApp/obj/Debug/RestartApp.csproj.SuggestedBindingRedirects.cache
deleted file mode 100644
index e69de29..0000000
diff --git a/shangjian/RestartApp/obj/Debug/RestartApp.exe b/shangjian/RestartApp/obj/Debug/RestartApp.exe
index 5cb60de..d6c53e2 100644
Binary files a/shangjian/RestartApp/obj/Debug/RestartApp.exe and b/shangjian/RestartApp/obj/Debug/RestartApp.exe differ
diff --git a/shangjian/RestartApp/obj/Debug/RestartApp.pdb b/shangjian/RestartApp/obj/Debug/RestartApp.pdb
index 86b9a47..b6ebbc1 100644
Binary files a/shangjian/RestartApp/obj/Debug/RestartApp.pdb and b/shangjian/RestartApp/obj/Debug/RestartApp.pdb differ
diff --git a/shangjian/WPFupdate/obj/Debug/WPFupdate.csproj.AssemblyReference.cache b/shangjian/WPFupdate/obj/Debug/WPFupdate.csproj.AssemblyReference.cache
index 293b360..03498a4 100644
Binary files a/shangjian/WPFupdate/obj/Debug/WPFupdate.csproj.AssemblyReference.cache and b/shangjian/WPFupdate/obj/Debug/WPFupdate.csproj.AssemblyReference.cache differ
diff --git a/shangjian/XGL.Data/DBService/FormingMachineService.cs b/shangjian/XGL.Data/DBService/FormingMachineService.cs
index 69888df..a2c1440 100644
--- a/shangjian/XGL.Data/DBService/FormingMachineService.cs
+++ b/shangjian/XGL.Data/DBService/FormingMachineService.cs
@@ -6,6 +6,7 @@ using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Controls;
using XGL.Models.Model.FoamingMac;
namespace XGL.Data.DBService
@@ -18,7 +19,7 @@ namespace XGL.Data.DBService
///
///
///
- public DataTable GetFormingMachineInfo(string devicecode,string workDate)
+ public DataTable GetFormingMachineInfo(string devicecode, string workDate)
{
//过于复杂,给数据库造成了压力,经常死锁
// string sql = $@"SELECT DISTINCT
@@ -91,7 +92,7 @@ namespace XGL.Data.DBService
string sql = $@"select shift_id,shift_code,shift_desc,Shift_Start_Time,Shift_End_Time from base_shifts_t where del_flag ='0' ";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
-
+
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
@@ -118,7 +119,7 @@ namespace XGL.Data.DBService
///
///
///
- public string getnumber(string order, string devicecode,string shetl)
+ public string getnumber(string order, string devicecode, string shetl)
{
string sql = $@"SELECT COUNT(*) FROM mes_material_transfer_result WHERE equipmentCode='{order}' and work_date='{devicecode}' and shift_id='{shetl}' and rfid_status='1'";
@@ -158,7 +159,7 @@ namespace XGL.Data.DBService
///
///
///
- public DataTable GetInOutHistoryList(string workOrderCode,string devicecode,string workDate)
+ public DataTable GetInOutHistoryList(string workOrderCode, string devicecode, string workDate)
{
string sql = $@"SELECT DISTINCT ord.workorder_id,ord.workorder_code,res.OrderCode,ord.product_name,product_code,isnull(car_num,0) as car_num,
isnull([begin],'1900-01-01 08:00:00') as [begin],ord.status,ord.route_code,ord.attr1,work_batch_code,res.taskcode,res.rfid,plan_time ,res.update_time
@@ -226,7 +227,7 @@ where res.taskcode = '0' and equipmentCode = 'C6' and res.OrderCode is not null
///
///
///
- public bool UpdateWorkOrder(string orderCode,string status,string remark,string type,string deviceCode)
+ public bool UpdateWorkOrder(string orderCode, string status, string remark, string type, string deviceCode)
{
List sqlList = new List();
string logSql = "";
@@ -253,10 +254,10 @@ where res.taskcode = '0' and equipmentCode = 'C6' and res.OrderCode is not null
sqlList.Add(logSql);
bool issucc = Utils.netClientDBHelper.executeBatchSql(sqlList);
- return issucc ;
+ return issucc;
}
-
+
///
/// 更新工单
@@ -313,14 +314,14 @@ VALUES
///
///
///
- public bool ExecuteReportWork(DataRowView selectRow,string orderQuntity,string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode, string isEndReport, string deviceCode)
+ public bool ExecuteReportWork(DataRowView selectRow, string orderQuntity, string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode, string isEndReport, string deviceCode)
{
string getReportCodeSql = $@"SELECT equipment_code,equipment_name FROM [dbo].[base_equipment] WHERE equipment_code='{deviceCode}'";
string lineName = "";
DataSet dtset = Utils.netClientDBHelper.getDataSet(getReportCodeSql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
- lineName = dtset.Tables[0].Rows[0]["equipment_name"].ToString();
+ lineName = dtset.Tables[0].Rows[0]["equipment_name"].ToString();
}
//获取子工单的信息
@@ -329,15 +330,15 @@ VALUES
string subProductCode = "";
string subProductName = "";
string subQuntity = "";
- string subUnit = "";
- DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
+ string subUnit = "";
+ DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
if (dtSubOrder != null && dtSubOrder.Tables.Count > 0 && dtSubOrder.Tables[0].Rows.Count > 0)
{
subOrder = dtSubOrder.Tables[0].Rows[0]["workorder_code"].ToString();
subProductCode = dtSubOrder.Tables[0].Rows[0]["product_code"].ToString();
subProductName = dtSubOrder.Tables[0].Rows[0]["product_name"].ToString();
subQuntity = dtSubOrder.Tables[0].Rows[0]["quantity_split"].ToString();
- subUnit = dtSubOrder.Tables[0].Rows[0]["unit"].ToString();
+ subUnit = dtSubOrder.Tables[0].Rows[0]["unit"].ToString();
}
double rate = Convert.ToDouble(workCount) / Convert.ToDouble(orderQuntity);
@@ -400,10 +401,10 @@ VALUES
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}',GetDate(), '0', NULL, 'prod',
- {userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["parent_order"]}');";
+ {userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["parent_order"]}');";
sqlList.Add(mainOrderSql);
}
-
+
//赵啸林说不用上位机更新报工标识
//string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' ";
//sqlList.Add(sql);
@@ -427,7 +428,7 @@ VALUES
///
///
///
- public List GetExecuteReportWorkSql(DataRowView selectRow, string orderQuntity, string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode, string isEndReport, string deviceCode)
+ public List GetExecuteReportWorkSql(DataRowView selectRow, string orderQuntity, string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode, string isEndReport, string deviceCode, string fatherOrderUserCount)
{
string getReportCodeSql = $@"SELECT equipment_code,equipment_name FROM [dbo].[base_equipment] WHERE equipment_code='{deviceCode}'";
string lineName = "";
@@ -437,6 +438,7 @@ VALUES
lineName = dtset.Tables[0].Rows[0]["equipment_name"].ToString();
}
+ #region 生成报工数据
//获取子工单的信息
string getSubOrderSql = $"select workorder_code,product_code,product_name,quantity_split,unit from pro_order_workorder where parent_order = '{selectRow["workorder_code"]}'";
string subOrder = "";
@@ -470,12 +472,12 @@ VALUES
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{selectRow["workorder_code"]}', '{selectRow["product_code"]}', '{selectRow["product_name"]}',
- '{selectRow["product_spc"]}', '{selectRow["unit"]}', {workCount}, {workCount}, 0, 0,
+ '{selectRow["product_spc"]}', '{selectRow["unit"]}', {selectRow["batch_quantity"]}, {workCount}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
- {userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{0}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
+ {fatherOrderUserCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{0}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
string subOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
@@ -487,7 +489,7 @@ VALUES
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{subOrder}', '{subProductCode}', '{subProductName}',
- '{selectRow["product_spc"]}', '{subUnit}', {subOrderQty}, {subOrderQty}, 0, 0,
+ '{selectRow["product_spc"]}', '{subUnit}', {selectRow["batch_quantity"]}, {subOrderQty}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
@@ -509,7 +511,7 @@ VALUES
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{selectRow["workorder_code"]}', '{selectRow["product_code"]}', '{selectRow["product_name"]}',
- '{selectRow["product_spc"]}', '{selectRow["unit"]}', {workCount}, {workCount}, 0, 0,
+ '{selectRow["product_spc"]}', '{selectRow["unit"]}', {selectRow["batch_quantity"]}, {workCount}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
@@ -517,26 +519,250 @@ VALUES
{userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["parent_order"]}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
sqlList.Add(mainOrderSql);
}
+ #endregion
+
//赵啸林说不用上位机更新报工标识
//string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' ";
//sqlList.Add(sql);
//sqlList.Add(updateOrderSql);
- //赵啸林又说sap有问题,需要上位机修改报工标识2023-12-25,仅在最终报工时,才更新此状态
+ #region 最终报工,更新工单状态为已报工
+ //赵啸林又说sap有问题,需要上位机修改报工标识2023-12-25,但仅在最终报工时,才更新此状态
if (isEndReport.Equals("1"))
{
- string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where belong_work_order = '{selectRow["workorder_code"]}' ";
+ //更新订单状态为已报工;
+ string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where belong_work_order = '{selectRow["workorder_code"]}' ";
sqlList.Add(updateOrderSql);
- }
+ //修改报工逻辑,最终报工时添加子母工单领料单状态更新2024-02-20
+ if (subOrder != "") //有子单
+ {
+ //更新子单状态
+ string updateSubOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{subOrder}'";
+ //更新母单状态
+ string updateMainOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{selectRow["workorder_code"]}'";
+ sqlList.Add(updateSubOrderPrepareSql);
+ sqlList.Add(updateMainOrderPrepareSql);
+ }
+ else //无子单
+ {
+ //更新母单状态
+ string updateMainOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{selectRow["workorder_code"]}'";
+ sqlList.Add(updateMainOrderPrepareSql);
+ }
+ }
+ #endregion
+
+ #region 批次报工状态更新
//添加批次报工状态更新--2023-12-26
string updateBatchOrderStatusSql = $@"update pro_order_workorder_batch set status = '0', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' and batch_code = '{batchCode}' ";
sqlList.Add(updateBatchOrderStatusSql);
+ #endregion
+
return sqlList;//> 0 ? true : false;
}
+
+ ///
+ /// 新版报工
+ ///
+ ///
+ ///
+ ///
+ public List GetExecuteReportWorkSql(DataRowView selectRow, string orderQuntity, string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode,
+ string isEndReport, string deviceCode, Dictionary workTimeDic, Dictionary userCountDic)
+ {
+ string getReportCodeSql = $@"SELECT equipment_code,equipment_name FROM [dbo].[base_equipment] WHERE equipment_code='{deviceCode}'";
+ string lineName = "";
+ DataSet dtset = Utils.netClientDBHelper.getDataSet(getReportCodeSql);
+ if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
+ {
+ lineName = dtset.Tables[0].Rows[0]["equipment_name"].ToString();
+ }
+
+ #region 生成报工数据
+ //获取子工单的信息
+ string getSubOrderSql = $"select workorder_code,product_code,product_name,quantity_split,unit from pro_order_workorder where parent_order = '{selectRow["workorder_code"]}'";
+ string subOrder = "";
+ //string subProductCode = "";
+ //string subProductName = "";
+ //string subQuntity = "";
+ //string subUnit = "";
+ DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
+ if (dtSubOrder != null && dtSubOrder.Tables.Count > 0 && dtSubOrder.Tables[0].Rows.Count > 0)
+ {
+ subOrder = dtSubOrder.Tables[0].Rows[0]["workorder_code"].ToString();
+ //subProductCode = dtSubOrder.Tables[0].Rows[0]["product_code"].ToString();
+ //subProductName = dtSubOrder.Tables[0].Rows[0]["product_name"].ToString();
+ //subQuntity = dtSubOrder.Tables[0].Rows[0]["quantity_split"].ToString();
+ //subUnit = dtSubOrder.Tables[0].Rows[0]["unit"].ToString();
+ }
+
+ //double rate = Convert.ToDouble(workCount) / Convert.ToDouble(orderQuntity);
+ //double subOrderQty = rate * Convert.ToDouble(subQuntity);
+ List sqlList = new List();
+ //有子单
+ if (subOrder != "")
+ {
+ string mainOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
+ ([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
+ [spec], [unit], [quantity], [quantity_feedback], [quantity_qualified], [quantity_unqualified],
+ [user_name], [nick_name], [feedback_channel], [feedback_time], [record_user], [status],
+ [remark], [work_time], [machine_code], [machine_name], [team_code], [shift_code],
+ [attr1], [attr2], [attr3], [attr4], [create_by], [create_time],
+ [update_time], [update_by], [upload_status], [upload_msg], [prod_type],
+ [use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
+ VALUES
+ ('{Common.GetUUID()}', 'SELF', '{reportCode}', '{selectRow["workorder_code"]}', '{selectRow["product_code"]}', '{selectRow["product_name"]}',
+ '{selectRow["product_spc"]}', '{selectRow["unit"]}', {selectRow["batch_quantity"]}, {workCount}, 0, 0,
+ '{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
+ '无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
+ NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
+ '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
+ {userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{0}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
+
+ foreach (string item in GetAllWorkReportsForOrderAndChildren(selectRow["workorder_code"].ToString(), selectRow, orderQuntity, reportCode, costCenter, batchCode,
+ isEndReport, deviceCode, lineName, workCount, workTimeDic, userCountDic,0))
+ {
+ sqlList.Add(item);
+ }
+
+ //string subOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
+ // ([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
+ // [spec], [unit], [quantity], [quantity_feedback], [quantity_qualified], [quantity_unqualified],
+ // [user_name], [nick_name], [feedback_channel], [feedback_time], [record_user], [status],
+ // [remark], [work_time], [machine_code], [machine_name], [team_code], [shift_code],
+ // [attr1], [attr2], [attr3], [attr4], [create_by], [create_time],
+ // [update_time], [update_by], [upload_status], [upload_msg], [prod_type],
+ // [use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
+ // VALUES
+ // ('{Common.GetUUID()}', 'SELF', '{reportCode}', '{subOrder}', '{subProductCode}', '{subProductName}',
+ // '{selectRow["product_spc"]}', '{subUnit}', {selectRow["batch_quantity"]}, {subOrderQty}, 0, 0,
+ // '{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
+ // '无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
+ // NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
+ // '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
+ // {userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["workorder_code"]}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
+ sqlList.Add(mainOrderSql);
+ //sqlList.Add(subOrderSql);
+ }
+ else
+ {
+ //无子单
+ string mainOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
+ ([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
+ [spec], [unit], [quantity], [quantity_feedback], [quantity_qualified], [quantity_unqualified],
+ [user_name], [nick_name], [feedback_channel], [feedback_time], [record_user], [status],
+ [remark], [work_time], [machine_code], [machine_name], [team_code], [shift_code],
+ [attr1], [attr2], [attr3], [attr4], [create_by], [create_time],
+ [update_time], [update_by], [upload_status], [upload_msg], [prod_type],
+ [use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
+ VALUES
+ ('{Common.GetUUID()}', 'SELF', '{reportCode}', '{selectRow["workorder_code"]}', '{selectRow["product_code"]}', '{selectRow["product_name"]}',
+ '{selectRow["product_spc"]}', '{selectRow["unit"]}', {selectRow["batch_quantity"]}, {workCount}, 0, 0,
+ '{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
+ '无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
+ NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
+ '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
+ {userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["parent_order"]}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
+ sqlList.Add(mainOrderSql);
+ }
+ #endregion
+
+
+ //赵啸林说不用上位机更新报工标识
+ //string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' ";
+ //sqlList.Add(sql);
+ //sqlList.Add(updateOrderSql);
+
+ #region 最终报工,更新工单状态为已报工
+ //赵啸林又说sap有问题,需要上位机修改报工标识2023-12-25,但仅在最终报工时,才更新此状态
+ if (isEndReport.Equals("1"))
+ {
+ //更新订单状态为已报工;
+ string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where belong_work_order = '{selectRow["workorder_code"]}' ";
+ sqlList.Add(updateOrderSql);
+
+ //修改报工逻辑,最终报工时添加子母工单领料单状态更新2024-02-20
+ if (subOrder != "") //有子单
+ {
+ //更新子单状态
+ string updateSubOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{subOrder}'";
+ //更新母单状态
+ string updateMainOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{selectRow["workorder_code"]}'";
+ sqlList.Add(updateSubOrderPrepareSql);
+ sqlList.Add(updateMainOrderPrepareSql);
+ }
+ else //无子单
+ {
+ //更新母单状态
+ string updateMainOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{selectRow["workorder_code"]}'";
+ sqlList.Add(updateMainOrderPrepareSql);
+ }
+ }
+ #endregion
+
+ #region 批次报工状态更新
+ //添加批次报工状态更新--2023-12-26
+ string updateBatchOrderStatusSql = $@"update pro_order_workorder_batch set status = '0', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' and batch_code = '{batchCode}' ";
+ sqlList.Add(updateBatchOrderStatusSql);
+ #endregion
+
+
+ return sqlList;//> 0 ? true : false;
+ }
+
+ List workReports = new List();
+
+ public List GetAllWorkReportsForOrderAndChildren(string orderId, DataRowView selectRow, string orderQuntity, string reportCode, string costCenter, string batchCode,
+ string isEndReport, string deviceCode, string lineName, string workCount, Dictionary workTimeDic, Dictionary userCountDic,int sortNo)
+ {
+
+ //获取子工单的信息
+ string getSubOrderSql = $"select workorder_code,product_code,product_name,quantity_split,unit from pro_order_workorder where parent_order = '{orderId}'";
+ string subOrder = "";
+ string subProductCode = "";
+ string subProductName = "";
+ string subQuntity = "";
+ string subUnit = "";
+ DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
+ if (dtSubOrder != null && dtSubOrder.Tables.Count > 0 && dtSubOrder.Tables[0].Rows.Count > 0)
+ {
+ subOrder = dtSubOrder.Tables[0].Rows[0]["workorder_code"].ToString();
+ subProductCode = dtSubOrder.Tables[0].Rows[0]["product_code"].ToString();
+ subProductName = dtSubOrder.Tables[0].Rows[0]["product_name"].ToString();
+ subQuntity = dtSubOrder.Tables[0].Rows[0]["quantity_split"].ToString();
+ subUnit = dtSubOrder.Tables[0].Rows[0]["unit"].ToString();
+ double rate = Convert.ToDouble(workCount) / Convert.ToDouble(orderQuntity);
+ double subOrderQty = rate * Convert.ToDouble(subQuntity);
+ string subOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
+ ([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
+ [spec], [unit], [quantity], [quantity_feedback], [quantity_qualified], [quantity_unqualified],
+ [user_name], [nick_name], [feedback_channel], [feedback_time], [record_user], [status],
+ [remark], [work_time], [machine_code], [machine_name], [team_code], [shift_code],
+ [attr1], [attr2], [attr3], [attr4], [create_by], [create_time],
+ [update_time], [update_by], [upload_status], [upload_msg], [prod_type],
+ [use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
+ VALUES
+ ('{Common.GetUUID()}', 'SELF', '{reportCode}', '{subOrder}', '{subProductCode}', '{subProductName}',
+ '{selectRow["product_spc"]}', '{subUnit}', {selectRow["batch_quantity"]}, {subOrderQty}, 0, 0,
+ '{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
+ '无', '{workTimeDic[sortNo]}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
+ NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
+ '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
+ {userCountDic[sortNo]}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["workorder_code"]}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
+ workReports.Add(subOrderSql);
+ sortNo++;
+ GetAllWorkReportsForOrderAndChildren(subOrder, selectRow, orderQuntity, reportCode, costCenter, batchCode, isEndReport, deviceCode, lineName, subQuntity, workTimeDic, userCountDic, sortNo);
+ }
+
+
+ return workReports;
+ }
+
+
public bool ChangeShiftsInfo(string deviceCode)
{
//
@@ -555,7 +781,7 @@ VALUES
///
///
///
- public bool InsertConsumeInfo(string qty, string remark, DataRowView selectedRow, string newReportCode, string siteCode,string recoil,string parentOrder)
+ public bool InsertConsumeInfo(string qty, string remark, DataRowView selectedRow, string newReportCode, string siteCode, string recoil, string parentOrder)
{
string sql = $@" INSERT INTO [dbo].[mes_report_work_consume]
([record_id], [workorder_code], [material_code], [material_name], [material_spc],
@@ -578,7 +804,7 @@ VALUES
return ret > 0 ? true : false;
}
- public bool InsertConsumeInfo(DataRowView selectedConsumeRow,string newReportCode, string siteCode)
+ public bool InsertConsumeInfo(DataRowView selectedConsumeRow, string newReportCode, string siteCode)
{
string sql = $@" INSERT INTO [dbo].[mes_report_work_consume]
([record_id], [workorder_code], [material_code], [material_name], [material_spc],
@@ -610,6 +836,33 @@ VALUES
return sql;
}
+
+ public DataTable GetFatherOrderUserCount(string orderCode)
+ {
+ string sql = $@"SELECT top 1 use_man FROM [dbo].[mes_report_work] where workorder_code = '{orderCode}' order by create_time";
+
+ DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
+ if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
+ {
+ return dtset.Tables[0];
+ }
+ return null;
+ }
+
+ public DataTable GetSubOrderCount(string orderCode)
+ {
+ //获取子工单的信息
+ string getSubOrderSql = $"select workorder_code,product_code,product_name,quantity_split,unit from pro_order_workorder where parent_order = '{orderCode}'";
+
+ DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
+ if (dtSubOrder != null && dtSubOrder.Tables.Count > 0 && dtSubOrder.Tables[0].Rows.Count > 0)
+ {
+ return dtSubOrder.Tables[0];
+ }
+ return null;
+ }
+
+
///
/// 根据设备编码获取当前机台最新的吊满的RFID信息
///
diff --git a/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs b/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs
index ad8c1b5..85abd26 100644
--- a/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs
+++ b/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs
@@ -11,6 +11,7 @@ using System.Data.SqlClient;
using MySql.Data.MySqlClient;
using CommonFunc.Tools;
+using XGL.Models.Model;
namespace XGL.Dats.DBServiceFinishProd
{
@@ -181,7 +182,7 @@ where CONVERT(VARCHAR(10), create_time , 120)= CONVERT(VARCHAR(10), GetDate() ,
public DataTable GetCosumeData(string workorder)
{
- string sql = $@"select '0' as qty,'' as remark, workorder_code, material_code,material_name,detail.prod_type,material_spc,detail.unit,quantity,
+ string sql = $@"select '0' as qty,'' as remark, workorder_code, SUBSTRING(material_code, 8, LEN(material_code)) as material_code1,material_code,material_name,detail.prod_type,material_spc,detail.unit,quantity,
detail.create_by,detail.create_time,detail.update_by,detail.update_time,locator,need_date,
recoil,fund_quanlity,detail.del_flag,parent_work_order
from mes_prepare_detail detail
@@ -205,6 +206,19 @@ where detail.parent_work_order ='{workorder}' and detail.del_flag = '0'";
}
return null;
}
+
+ //根据线体查询成本中心
+ public DataTable GetCostCenter(string deviceCode)
+ {
+ string sql = $"SELECT workshop_code as factory_code,workshop_name as factory_name FROM [dbo].[base_equipment] where equipment_code = '{deviceCode}';";
+ DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
+ if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
+ {
+ return dtset.Tables[0];
+ }
+ return null;
+ }
+
public DataTable piciGetCostCenter(string workorder)
{
string sql = $" SELECT batch_code FROM pro_order_workorder_batch WHERE workorder_id='{workorder}' AND del_flag='0'";
@@ -515,12 +529,13 @@ select a.TrayCode,a.ProductBarNo,a.carcode,a.createtime,a.lineno,b.HadNumber
public DataTable GetWetPlanInfo(string deviceCode, string date)
{
string sql = $@"select workorder.factory_code,workorder.product_date as plan_time, workorder.workorder_id,workorder.workorder_code, product_code,product_name,
-product_spc,shifts.shift_desc,prod_line_code,workorder.status,route_code,quantity_split,unit,workorder.shift_id ,batch.batch_code,batch.batch_quantity,sort_no, workorder.parent_order,batch.qc_status,batch.status as batchStatus,workorder_code_sap
+product_spc,shifts.shift_desc,prod_line_code,workorder.status,route_code,quantity_split,
+unit,workorder.shift_id ,batch.batch_code,batch.batch_quantity,sort_no, workorder.parent_order,batch.qc_status,batch.status as batchStatus,workorder_code_sap,salary_flag
from pro_order_workorder workorder WITH (NOLOCK)
left JOIN base_shifts_t shifts WITH (NOLOCK) on workorder.shift_id = shifts.shift_id
left JOIN pro_order_workorder_batch batch WITH (NOLOCK) on workorder.workorder_id = batch.workorder_id
where 1=1 and batch.del_flag = 0 and workorder.del_flag = 0 and
- workorder.parent_order ='0' and CONVERT(VARCHAR(10), workorder.product_date , 120)= CONVERT(VARCHAR(10), '{date}' , 120) and workorder.prod_line_code like '%{deviceCode}%' order by sort_no";
+ workorder.parent_order ='0' and CONVERT(VARCHAR(10), workorder.product_date , 120)= CONVERT(VARCHAR(10), '{date}' , 120) and workorder.prod_line_code like '%{deviceCode}%' order by sort_no,batch_code";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
@@ -530,6 +545,25 @@ where 1=1 and batch.del_flag = 0 and workorder.del_flag = 0 and
return null;
}
+ ///
+ /// 根据线体、产品获取工序列表
+ ///
+ ///
+ ///
+ ///
+ public DataTable GetProductStepListInfo(string deviceCode, string productCode)
+ {
+ string sql = $@"SELECT childprocess_code,childprocess_name FROM [dbo].[mes_unit_price]
+where product_code = '{productCode.Replace("0000000","")}' and line_code = '{deviceCode}' ORDER BY childprocess_code";
+
+ DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
+ if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
+ {
+ return dtset.Tables[0];
+ }
+ return null;
+ }
+
public DataTable GetSubOrderInfo(string workorderID)
{
@@ -547,6 +581,87 @@ where 1=1 and
return null;
}
+ ///
+ /// 根据线体、产品获取工序列表
+ ///
+ ///
+ ///
+ ///
+ public DataTable GetUnitPriceData(string deviceCode)
+ {
+ string sql = $@"select [workorder_code], [workorder_code_sap], [product_name], SUBSTRING([product_code], 8, LEN(product_code)) as product_code, [user_name], [nick_name], [childprocess_code], [childprocess_name] ,[create_by], [create_time], [line_code]
+from mes_unitprice_report
+where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = CONVERT(VARCHAR(10),GETDATE(), 120) ORDER BY childprocess_code,create_time";
+
+ DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
+ if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
+ {
+ return dtset.Tables[0];
+ }
+ return null;
+ }
+
+ ///
+ /// 生成计件薪酬数据
+ ///
+ ///
+ ///
+ public string GetCreateUnitPriceInfo(sys_user item,string workorderCode, string sapWorkorderCode,string productCode,string productName,string childProcessCode,string childProcessName,string deviceCode)
+ {
+ string sql = $@"INSERT INTO [dbo].[mes_unitprice_report] (
+ [id],[workorder_code], [workorder_code_sap], [product_name], [product_code],
+ [user_name], [nick_name], [childprocess_code], [childprocess_name], [attr1],
+ [attr2], [attr3], [create_by], [create_time], [update_by],
+ [update_time], [remark] ,[line_code]
+ )
+ VALUES
+ (
+ '{Common.GetUUID()}', '{workorderCode}','{sapWorkorderCode}', '{productName}', '{productCode}',
+ N'{item.user_name}', N'{item.nick_name}', N'{childProcessCode}', N'{childProcessName}', NULL,
+ NULL, NULL, '{LoginUser.UserName}', getdate(), NULL,
+ NULL, NULL,'{deviceCode}' );";
+
+ return sql;
+ }
+
+ public string GetUpdateUnitPriceSql(string workOrderCode)
+ {
+ string updateOrderSql = $@"update pro_order_workorder set salary_flag = '1', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_code = '{workOrderCode}' ";
+
+ return updateOrderSql;
+ }
+
+ public bool ExecuteCreateUnitPriceSql(List reportWorkSqlList)
+ {
+ bool issucc = Utils.netClientDBHelper.executeBatchSql(reportWorkSqlList);
+ return issucc;
+ }
+
+ public bool IsExistData(string workOrderCode, string childprocessCode, string deviceCode)
+ {
+ string sql = $@"select * from mes_unitprice_report where line_code = '{deviceCode}' and workorder_code = '{workOrderCode}' and childprocess_code = '{childprocessCode}'";
+ DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
+ if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public bool DelUnitPriceData(string workOrderCode, string childprocessCode, string deviceCode)
+ {
+ string sql = $@"delete mes_unitprice_report where line_code = '{deviceCode}' and workorder_code = '{workOrderCode}' and childprocess_code = '{childprocessCode}'";
+ int i = Utils.netClientDBHelper.executeUpdate(sql);
+ bool issucc = i > 0 ? true : false;
+ return issucc;
+ }
+
+ public string GetDelUnitPriceData(string workOrderCode, string childprocessCode, string deviceCode)
+ {
+ string sql = $@"delete mes_unitprice_report where line_code = '{deviceCode}' and workorder_code = '{workOrderCode}' and childprocess_code = '{childprocessCode}'";
+
+ return sql;
+ }
public List GeteqmentInfo()
{
@@ -714,7 +829,7 @@ where detail.parent_work_order = '{processid}'"; //where CONVERT(VARCHAR(10), w
}
return null;
}
-
+
///
/// 更新湿料计划同步状态、工单状态
///
@@ -3181,6 +3296,14 @@ left join basedata_plcsetting f on a.PlcId5=f.Id
return Items;
}
+
+
+
+
+
+
+
+
// ///
// /// 获取物料bom列表
// ///
diff --git a/shangjian/XGL.Data/XGL.Data.csproj b/shangjian/XGL.Data/XGL.Data.csproj
index 4c3f1f4..0316d54 100644
--- a/shangjian/XGL.Data/XGL.Data.csproj
+++ b/shangjian/XGL.Data/XGL.Data.csproj
@@ -70,6 +70,8 @@
+
+
diff --git a/shangjian/XGL.Data/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/shangjian/XGL.Data/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
index 7eda1a8..507a273 100644
Binary files a/shangjian/XGL.Data/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/shangjian/XGL.Data/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/shangjian/XGL.Data/obj/x86/Debug/XGL.Data.csproj.CoreCompileInputs.cache b/shangjian/XGL.Data/obj/x86/Debug/XGL.Data.csproj.CoreCompileInputs.cache
index 0330b12..8a18c33 100644
--- a/shangjian/XGL.Data/obj/x86/Debug/XGL.Data.csproj.CoreCompileInputs.cache
+++ b/shangjian/XGL.Data/obj/x86/Debug/XGL.Data.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-9632f572e4e99b96159e5a32041c3dab14c406f4801ba34f3987b9c789ca7320
+2df19547b61eec50ce5622f682c721677c5685d3e9c6b57b48caf94d220efa28
diff --git a/shangjian/XGL.Data/userDB.cs b/shangjian/XGL.Data/userDB.cs
index dd3b5e5..46dd583 100644
--- a/shangjian/XGL.Data/userDB.cs
+++ b/shangjian/XGL.Data/userDB.cs
@@ -338,6 +338,21 @@ namespace XGL.Data
return issuccess;//lst.Count > 0 ? true : false;
}
+ public List GetUserList()
+ {
+ string sql = $"select * from sys_user ";
+ DataTable dt = Utils.cloudDBHelper.getDataSet(sql).Tables[0];
+
+
+ var lst = Utils.ToDataList(dt);
+ if (lst.Count > 0)
+ {
+ return lst;
+ }
+ return null;//lst.Count > 0 ? true : false;
+ }
+
+
public bool UpdateWorkDate(string deviceCode,string shiftID, string workDate)
{
string sql = $"update base_equipment set curr_work_date = '{workDate}',curr_shift = '{shiftID}' where equipment_code = '{deviceCode}'";
diff --git a/shangjian/XGL.Model/Model/sys_user.cs b/shangjian/XGL.Model/Model/sys_user.cs
index a556fcc..d2dd128 100644
--- a/shangjian/XGL.Model/Model/sys_user.cs
+++ b/shangjian/XGL.Model/Model/sys_user.cs
@@ -11,6 +11,10 @@ namespace XGL.Models.Model
///
public class sys_user
{
+ ///
+ /// 选中状态
+ ///
+ public bool IsChecked { get; set; }
///
/// 编码
///
diff --git a/shangjian/XGL.Model/bin/Debug/XGL.Models.dll b/shangjian/XGL.Model/bin/Debug/XGL.Models.dll
index 4a02928..ef6d10b 100644
Binary files a/shangjian/XGL.Model/bin/Debug/XGL.Models.dll and b/shangjian/XGL.Model/bin/Debug/XGL.Models.dll differ
diff --git a/shangjian/XGL.Model/bin/Debug/XGL.Models.pdb b/shangjian/XGL.Model/bin/Debug/XGL.Models.pdb
index 658c204..7b5f2df 100644
Binary files a/shangjian/XGL.Model/bin/Debug/XGL.Models.pdb and b/shangjian/XGL.Model/bin/Debug/XGL.Models.pdb differ
diff --git a/shangjian/XGL.Model/obj/Debug/XGL.Models.csproj.AssemblyReference.cache b/shangjian/XGL.Model/obj/Debug/XGL.Models.csproj.AssemblyReference.cache
index b1e3e18..709a5dc 100644
Binary files a/shangjian/XGL.Model/obj/Debug/XGL.Models.csproj.AssemblyReference.cache and b/shangjian/XGL.Model/obj/Debug/XGL.Models.csproj.AssemblyReference.cache differ
diff --git a/shangjian/XGL.Model/obj/Debug/XGL.Models.dll b/shangjian/XGL.Model/obj/Debug/XGL.Models.dll
index 4a02928..ef6d10b 100644
Binary files a/shangjian/XGL.Model/obj/Debug/XGL.Models.dll and b/shangjian/XGL.Model/obj/Debug/XGL.Models.dll differ
diff --git a/shangjian/XGL.Model/obj/Debug/XGL.Models.pdb b/shangjian/XGL.Model/obj/Debug/XGL.Models.pdb
index 658c204..7b5f2df 100644
Binary files a/shangjian/XGL.Model/obj/Debug/XGL.Models.pdb and b/shangjian/XGL.Model/obj/Debug/XGL.Models.pdb differ
diff --git a/shangjian/XGL.Thrift/bin/Debug/XGL.Thrift.dll b/shangjian/XGL.Thrift/bin/Debug/XGL.Thrift.dll
index cac0fde..6594a30 100644
Binary files a/shangjian/XGL.Thrift/bin/Debug/XGL.Thrift.dll and b/shangjian/XGL.Thrift/bin/Debug/XGL.Thrift.dll differ
diff --git a/shangjian/XGL.Thrift/bin/Debug/XGL.Thrift.pdb b/shangjian/XGL.Thrift/bin/Debug/XGL.Thrift.pdb
index 874b283..b867864 100644
Binary files a/shangjian/XGL.Thrift/bin/Debug/XGL.Thrift.pdb and b/shangjian/XGL.Thrift/bin/Debug/XGL.Thrift.pdb differ
diff --git a/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.csproj.AssemblyReference.cache b/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.csproj.AssemblyReference.cache
index 9048442..bbf53b4 100644
Binary files a/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.csproj.AssemblyReference.cache and b/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.csproj.AssemblyReference.cache differ
diff --git a/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.dll b/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.dll
index cac0fde..6594a30 100644
Binary files a/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.dll and b/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.dll differ
diff --git a/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.pdb b/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.pdb
index 874b283..b867864 100644
Binary files a/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.pdb and b/shangjian/XGL.Thrift/obj/Debug/XGL.Thrift.pdb differ
diff --git a/shangjian/XGL/App.config b/shangjian/XGL/App.config
index 0f4164b..872a6c6 100644
--- a/shangjian/XGL/App.config
+++ b/shangjian/XGL/App.config
@@ -12,7 +12,7 @@
-
+
diff --git a/shangjian/XGL/obj/x86/Debug/XGL.Properties.Resources.resources b/shangjian/XGL/obj/x86/Debug/XGL.Properties.Resources.resources
deleted file mode 100644
index b4a07ff..0000000
Binary files a/shangjian/XGL/obj/x86/Debug/XGL.Properties.Resources.resources and /dev/null differ
diff --git a/shangjian/XGL/obj/x86/Debug/XGL.csproj.CopyComplete b/shangjian/XGL/obj/x86/Debug/XGL.csproj.CopyComplete
deleted file mode 100644
index e69de29..0000000
diff --git a/shangjian/XGL/obj/x86/Debug/XGL.csproj.GenerateResource.cache b/shangjian/XGL/obj/x86/Debug/XGL.csproj.GenerateResource.cache
deleted file mode 100644
index ba0b41c..0000000
Binary files a/shangjian/XGL/obj/x86/Debug/XGL.csproj.GenerateResource.cache and /dev/null differ
diff --git a/shangjian/XGL/obj/x86/Debug/XGL.csproj.SuggestedBindingRedirects.cache b/shangjian/XGL/obj/x86/Debug/XGL.csproj.SuggestedBindingRedirects.cache
deleted file mode 100644
index e69de29..0000000
diff --git a/shangjian/XGLFinishPro/LoginPage.xaml.cs b/shangjian/XGLFinishPro/LoginPage.xaml.cs
index 4764c8c..ab2a228 100644
--- a/shangjian/XGLFinishPro/LoginPage.xaml.cs
+++ b/shangjian/XGLFinishPro/LoginPage.xaml.cs
@@ -165,6 +165,7 @@ namespace XGLFinishPro
bw.ReportProgress(1);
bool islogin = usdb.Login(ul.username, ul.pwd, ul.shiftID,ul.teamID,ul.workDate, ul.startTime, ul.endTime);
+ Utils.userList = usdb.GetUserList();
if (islogin)
{
usdb.UpdateWorkDate(deviceCode,ul.shiftID,ul.workDate);
diff --git a/shangjian/XGLFinishPro/Tools/NumericValidationRule.cs b/shangjian/XGLFinishPro/Tools/NumericValidationRule.cs
new file mode 100644
index 0000000..16d5650
--- /dev/null
+++ b/shangjian/XGLFinishPro/Tools/NumericValidationRule.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+
+namespace XGLFinishPro.Tools
+{
+ public class NumericValidationRule : ValidationRule
+ {
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ double result;
+ if (double.TryParse(value as string, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
+ {
+ return ValidationResult.ValidResult;
+ }
+ else
+ {
+ return new ValidationResult(false, "Invalid numeric value");
+ }
+ }
+ }
+}
diff --git a/shangjian/XGLFinishPro/Tools/ValidationHelper.cs b/shangjian/XGLFinishPro/Tools/ValidationHelper.cs
new file mode 100644
index 0000000..5dd5a84
--- /dev/null
+++ b/shangjian/XGLFinishPro/Tools/ValidationHelper.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace XGLFinishPro.Tools
+{
+ public class ValidationHelper
+ {
+ public static readonly DependencyProperty ErrorProperty =
+ DependencyProperty.RegisterAttached("Error", typeof(string), typeof(ValidationHelper), new PropertyMetadata(null));
+
+ public static string GetError(DependencyObject obj)
+ {
+ return (string)obj.GetValue(ErrorProperty);
+ }
+
+ public static void SetError(DependencyObject obj, string value)
+ {
+ obj.SetValue(ErrorProperty, value);
+ }
+ }
+}
diff --git a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml
index e27a8da..7816ae0 100644
--- a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml
+++ b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml
@@ -4,8 +4,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:XGLFinishPro.Views"
+ xmlns:convert="clr-namespace:XGLFinishPro.Tools"
mc:Ignorable="d"
- Title="CheckUserWin" Height="850" Width="1350" WindowStartupLocation="CenterScreen" WindowStyle="None" Loaded="Window_Loaded">
+ Title="CheckUserWin" Height="950" Width="1350" WindowStartupLocation="CenterScreen" WindowStyle="None" Loaded="Window_Loaded">
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RowStyle="{StaticResource DataGridRowStyle}"
+ CellStyle="{StaticResource CustomCellStyle}" MinRowHeight="35">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml.cs b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml.cs
index e01f39d..a1a276e 100644
--- a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml.cs
+++ b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml.cs
@@ -4,6 +4,7 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
+using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@@ -21,6 +22,7 @@ using XGL.Data;
using XGL.Data.DBService;
using XGL.Dats.DBServiceFinishProd;
using XGL.Models.Model.OrderPrepare;
+using XGLFinishPro.Tools;
namespace XGLFinishPro.Views
{
@@ -42,7 +44,7 @@ namespace XGLFinishPro.Views
public string _workOrderId = "";
public string batchCode = "";
public bool? _isEndReport = false;
- public string _deviceCode = "";
+ public string _deviceCode = "";
public string _siteCode = "";
DataRowView selectedRow = null;
@@ -51,7 +53,7 @@ namespace XGLFinishPro.Views
InitializeComponent();
}
- public ExecReportWorkWin(string workOrder, string quantity,string workOrdercode, string batch_code, string siteCode)
+ public ExecReportWorkWin(string workOrder, string quantity, string workOrdercode, string batch_code, string siteCode)
{
InitializeComponent();
this._workOrdercode = workOrdercode;
@@ -60,7 +62,7 @@ namespace XGLFinishPro.Views
this.comboBoxBatch.Text = batch_code;
_siteCode = siteCode;
}
- public ExecReportWorkWin(DataRowView _selectedRow,string deviceCode, string siteCode)
+ public ExecReportWorkWin(DataRowView _selectedRow, string deviceCode, string siteCode)
{
InitializeComponent();
//if (_selectedRow["parent_order"].ToString() == "0")
@@ -88,64 +90,89 @@ namespace XGLFinishPro.Views
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
- {
+ {
this.DialogResult = false;
this.Close();
}
private async void btnOK_Click(object sender, RoutedEventArgs e)
{
- if (string.IsNullOrEmpty(this.txtQuantity.Text))
+ try
{
- this.tbMsg.Content = "报工数量不能为空";
- this.txtQuantity.Focus();
- return;
- }
- if (string.IsNullOrEmpty(this.txtWorkTime.Text))
- {
- this.tbMsg.Content = "工时数量不能为空";
- this.txtWorkTime.Focus();
- return;
- }
- if (string.IsNullOrEmpty(this.txtUserCount.Text))
- {
- this.tbMsg.Content = "人数数量不能为空";
- this.txtUserCount.Focus();
- return;
- }
+
+ if (string.IsNullOrEmpty(this.txtQuantity.Text))
+ {
+ this.tbMsg.Content = "报工数量不能为空";
+ this.txtQuantity.Focus();
+ return;
+ }
+ if (string.IsNullOrEmpty(this.txtWorkTime.Text))
+ {
+ this.tbMsg.Content = "工时数量不能为空";
+ this.txtWorkTime.Focus();
+ return;
+ }
+ if (string.IsNullOrEmpty(this.txtUserCount.Text))
+ {
+ this.tbMsg.Content = "人数数量不能为空";
+ this.txtUserCount.Focus();
+ return;
+ }
- if (string.IsNullOrEmpty(this.comboBoxCostCenter.SelectedValue.ToString()))
+ if (string.IsNullOrEmpty(this.comboBoxCostCenter.SelectedValue.ToString()))
+ {
+ this.tbMsg.Content = "成本中心不能为空";
+ this.comboBoxCostCenter.Focus();
+ return;
+ }
+
+ if (!Regex.IsMatch(this.txtQuantity.Text, @"^\d+(\.\d+)?$"))
+ {
+ // 输入是一个有效的数字,包括小数
+ this.tbMsg.Content = "报工数量非法字符!";
+ this.txtQuantity.Focus();
+ return;
+ }
+
+ if (!Regex.IsMatch(this.txtWorkTime.Text, @"^\d+(\.\d+)?$"))
+ {
+ // 输入是一个有效的数字,包括小数
+ this.tbMsg.Content = "工时含有非法字符!";
+ this.txtWorkTime.Focus();
+ return;
+ }
+
+ if (!Regex.IsMatch(this.txtUserCount.Text, @"^\d+$"))
+ {
+ // 输入是一个有效的数字,包括小数
+ this.tbMsg.Content = "人数含有非法字符!";
+ this.txtUserCount.Focus();
+ return;
+ }
+ if (!CheckWorkTimeDynamicTextBox())
+ {
+ return;
+ }
+ if (!CheckUserCountDynamicTextBox())
+ {
+ return;
+ }
+ if (comboBoxBatch.Items.Count <= 2)//小于等于2的时候代表只有一个批次,必须最终报工
+ {
+ if (_isEndReport == false)
+ {
+ this.tbMsg.Content = "该工单只有一个批次,必须勾选最终报工!";
+ // return;
+ }
+ }
+ }
+ catch (Exception ex)
{
- this.tbMsg.Content = "成本中心不能为空";
- this.comboBoxCostCenter.Focus();
- return;
- }
-
-
- if (!Regex.IsMatch(this.txtQuantity.Text, @"^\d+(\.\d+)?$"))
- {
- // 输入是一个有效的数字,包括小数
- this.tbMsg.Content = "报工数量非法字符!";
- this.txtQuantity.Focus();
- return;
-
- }
-
- if (!Regex.IsMatch(this.txtWorkTime.Text, @"^\d+(\.\d+)?$"))
- {
- // 输入是一个有效的数字,包括小数
- this.tbMsg.Content = "工时含有非法字符!";
- this.txtWorkTime.Focus();
- return;
- }
-
- if (!Regex.IsMatch(this.txtUserCount.Text, @"^\d+$"))
- {
- // 输入是一个有效的数字,包括小数
- this.tbMsg.Content = "人数含有非法字符!";
- this.txtUserCount.Focus();
+ CustomMessageBox.Show("报工检验数据有效性时发生了异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
+ LogHelper.instance.log.Error("报工检验数据有效性时发生了异常:" + ex.Message);
return;
}
+
_useMan = this.txtUserCount.Text;
_workTime = this.txtWorkTime.Text;
_costCenter = this.comboBoxCostCenter.SelectedValue.ToString();
@@ -170,7 +197,7 @@ namespace XGLFinishPro.Views
else
{
CustomMessageBox.Show("报工失败", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
- LogHelper.instance.log.Error("报工失败:" +selectedRow["workorder_code"]);
+ LogHelper.instance.log.Error("报工失败:" + selectedRow["workorder_code"]);
}
}
catch (Exception ex)
@@ -195,20 +222,67 @@ namespace XGLFinishPro.Views
else
{
CustomMessageBox.Show("报工失败", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
- }
+ }
}
catch (Exception ex)
{
+ CustomMessageBox.Show("报工失败"+ ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
LogHelper.instance.log.Error("报工失败:" + ex.Message);
- }
-
+ }
+
}
}
-
+
}
- private bool ReportWork()
+ private bool CheckUserCountDynamicTextBox()
+ {
+ dicUserCount.Clear();
+ bool isScucc = false;
+ for (int i = 0; i < dynamicUserCountTextBoxes.Count; i++)
+ {
+ if (!Regex.IsMatch(dynamicUserCountTextBoxes[i + 1].Text, @"^\d+$"))
+ {
+ // 输入是一个有效的数字,包括小数
+ this.tbMsg.Content = "人员数量含有非法字符!";
+ dynamicUserCountTextBoxes[i].Focus();
+ isScucc = false;
+ }
+ else
+ {
+ dicUserCount.Add(i, dynamicUserCountTextBoxes[i + 1].Text);
+ this.tbMsg.Content = "";
+ isScucc = true;
+ }
+ }
+ return isScucc;
+ }
+
+ private bool CheckWorkTimeDynamicTextBox()
+ {
+ dicWorkTime.Clear();
+ bool isScucc = false;
+ for (int i = 0; i < dynamicWorkTimeTextBoxes.Count; i++)
+ {
+ if (!Regex.IsMatch(dynamicWorkTimeTextBoxes[i+1].Text, @"^\d+(\.\d+)?$"))
+ {
+ // 输入是一个有效的数字,包括小数
+ this.tbMsg.Content = "工时含有非法字符!";
+ dynamicWorkTimeTextBoxes[i].Focus();
+ isScucc = false;
+ }
+ else
+ {
+ dicWorkTime.Add(i, dynamicWorkTimeTextBoxes[i+1].Text);
+ this.tbMsg.Content = "";
+ isScucc = true;
+ }
+ }
+ return isScucc;
+ }
+
+ private bool ReportWork()
{
//获取报工编码
string newReportCode = "";
@@ -231,7 +305,7 @@ namespace XGLFinishPro.Views
string isEndReport = _isEndReport == true ? "1" : "0";
//bool issucc = formingMachineService.ExecuteReportWork(selectedRow, _orderQuntity, _workQuntity, newReportCode, _workTime, _useMan, _costCenter, batchCode, isEndReport, _deviceCode);
- List reportWorkSqlList = formingMachineService.GetExecuteReportWorkSql(selectedRow, _orderQuntity, _workQuntity, newReportCode, _workTime, _useMan, _costCenter, batchCode, isEndReport, _deviceCode);
+ List reportWorkSqlList = formingMachineService.GetExecuteReportWorkSql(selectedRow, _orderQuntity, _workQuntity, newReportCode, _workTime, _useMan, _costCenter, batchCode, isEndReport, _deviceCode, dicWorkTime, dicUserCount);
if (reportWorkSqlList.Count > 0)
{
//报工接口不用调了
@@ -250,7 +324,7 @@ namespace XGLFinishPro.Views
//if (result.code == 200)
//{
- return AddConsumInfo(reportWorkSqlList, newReportCode);
+ return AddConsumInfo(reportWorkSqlList, newReportCode);
//}
//else
//{
@@ -264,7 +338,7 @@ namespace XGLFinishPro.Views
}
}
- private bool AddConsumInfo(List reportWorkSqlList ,string newReportCode)
+ private bool AddConsumInfo(List reportWorkSqlList, string newReportCode)
{
try
{
@@ -277,9 +351,9 @@ namespace XGLFinishPro.Views
foreach (var row in dgConsumeInfo.Items)
{
var selectedConsumeRow = (row as DataRowView);
- var qty = selectedConsumeRow["qty"].ToString() == ""?"0": selectedConsumeRow["qty"].ToString();
+ var qty = selectedConsumeRow["qty"].ToString() == "" ? "0" : selectedConsumeRow["qty"].ToString();
var remark = selectedConsumeRow["remark"].ToString();
-
+
string insertConsumeSql = formingMachineService.GetInsertConsumeInfoSql(selectedConsumeRow, newReportCode, _siteCode);
reportWorkSqlList.Add(insertConsumeSql);
//// 获取 DataGridRow
@@ -311,20 +385,20 @@ namespace XGLFinishPro.Views
//}
}
}
-
+
bool isReportSuccess = formingMachineService.GetExecuteReportWorkSql(reportWorkSqlList);
-
+
return isReportSuccess; ;
-
+
}
catch (Exception ex)
{
LogHelper.instance.log.Error("报工失败:生成消耗数据发生异常:" + ex.Message);
- CustomMessageBox.Show("报工失败:生成消耗数据发生异常:"+ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
+ CustomMessageBox.Show("报工失败:生成消耗数据发生异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
return false;
throw ex;
- }
+ }
}
private void pw_PasswordChanged(object sender, RoutedEventArgs e)
@@ -333,12 +407,216 @@ namespace XGLFinishPro.Views
}
private void Window_Loaded(object sender, RoutedEventArgs e)
- {
+ {
+ GetFatherOrderUserCount();
InitComBoboxData();
piciInitComBoboxData();
InitConsumeData();
}
+ private void GetFatherOrderUserCount()
+ {
+
+ string workOrder = this.lbCurrOrderNo.Content.ToString();
+ //DataTable dt = formingMachineService.GetSubOrderCount(workOrder);
+ //if (dt == null)
+ //{
+ // this.txtFOUserCount.Visibility = Visibility.Collapsed;
+ // this.txtFOUserCount.IsEnabled = true;
+ //}
+ //else
+ //{
+ // this.txtFOUserCount.Text = "4";
+ // this.txtFOUserCount.IsEnabled = false;
+ //}
+ GetSubOrder(workOrder);
+ //string workOrder = this.lbCurrOrderNo.Content.ToString();
+ //DataTable dt = formingMachineService.GetFatherOrderUserCount(workOrder);
+ //if (dt == null)
+ //{
+ // this.txtFOUserCount.IsEnabled = true;
+ //}
+ //else
+ //{
+ // this.txtFOUserCount.Text = dt.Rows[0][0].ToString();
+ // this.txtFOUserCount.IsEnabled = false;
+ //}
+
+ }
+
+ int sortNo = 0; //定义一个整数,记录子集级数
+ Dictionary dynamicWorkTimeTextBoxes = new Dictionary();
+ Dictionary dynamicUserCountTextBoxes = new Dictionary();
+
+ Dictionary dicWorkTime = new Dictionary();
+ Dictionary dicUserCount = new Dictionary();
+ private bool GetSubOrder(string workorderID)
+ {
+ try
+ {
+ sortNo++;
+ DataTable dtSubOrders = userDbWareHouse.GetSubOrderInfo(workorderID);
+ if (dtSubOrders != null)
+ {
+ string sort = "";
+ switch (sortNo)
+ {
+ case 1:
+ sort = "一"; break;
+ case 2:
+ sort = "二"; break;
+ case 3:
+ sort = "三"; break;
+ case 4:
+ sort = "四"; break;
+ case 5:
+ sort = "五"; break;
+ case 6:
+ sort = "六"; break;
+ case 7:
+ sort = "七"; break;
+ case 8:
+ sort = "八"; break;
+ case 9:
+ sort = "九"; break;
+ case 10:
+ sort = "10"; break;
+ case 11:
+ sort = "11"; break;
+ case 12:
+ sort = "12"; break;
+ default:
+ sortNo.ToString();
+ break;
+ }
+ //if (sortNo == 2)
+ //{
+ // StackPanel myStackPanelWorkTime = new StackPanel(); // 假设已经有一个StackPanel实例
+ // myStackPanelWorkTime.Orientation = Orientation.Horizontal;
+ // Label lbl = new Label();
+ // lbl.FontSize = 24;
+ // lbl.VerticalAlignment = VerticalAlignment.Center;
+ // lbl.HorizontalAlignment = HorizontalAlignment.Left;
+ // lbl.Content = "第" + sortNo + "工时:";
+
+ // TextBox textBox = new TextBox();
+ // textBox.FontSize = 24;
+ // textBox.Width = 260;
+ // textBox.VerticalAlignment = VerticalAlignment.Center;
+ // textBox.HorizontalAlignment = HorizontalAlignment.Left;
+ // textBox.TextChanged += TextBox_TextChanged;
+ // myStackPanelWorkTime.Children.Add(lbl);
+ // myStackPanelWorkTime.Children.Add(textBox);
+ // Grid.SetRow(myStackPanelWorkTime,3+sortNo);
+ // Grid.SetColumn(myStackPanelWorkTime, 1);
+ // MyGrid.Children.Add(myStackPanelWorkTime);
+ //}
+ //else
+ //{
+ Grid myGrid = (Grid)scrollViewer.Content;
+ StackPanel myStackPanelWorkTime = new StackPanel(); // 假设已经有一个StackPanel实例
+ myStackPanelWorkTime.Orientation = Orientation.Horizontal;
+ //添加工时
+ Label lbl = new Label();
+ lbl.FontSize = 24;
+ lbl.VerticalAlignment = VerticalAlignment.Center;
+ lbl.HorizontalAlignment = HorizontalAlignment.Left;
+ lbl.Content = sort + "层工时:";
+
+ TextBox textBox = new TextBox();
+ textBox.FontSize = 24;
+ textBox.Width = 260;
+ textBox.TextChanged += TextBox_TextChanged;
+ textBox.VerticalAlignment = VerticalAlignment.Center;
+ textBox.HorizontalAlignment = HorizontalAlignment.Left;
+
+ //添加人数
+ Label lblUserCount = new Label();
+ lblUserCount.FontSize = 24;
+ lblUserCount.VerticalAlignment = VerticalAlignment.Center;
+ lblUserCount.HorizontalAlignment = HorizontalAlignment.Left;
+ lblUserCount.Content = sort + "层人数:";
+ myStackPanelWorkTime.Children.Add(lbl);
+ myStackPanelWorkTime.Children.Add(textBox);
+ Grid.SetRow(myStackPanelWorkTime, 3 + sortNo);
+ Grid.SetColumn(myStackPanelWorkTime, 0);
+ myGrid.Children.Add(myStackPanelWorkTime);
+ //将工时文本框存储到数据字典中
+ dynamicWorkTimeTextBoxes.Add(sortNo, textBox);
+
+ StackPanel myStackPanelWorkTime2 = new StackPanel(); // 假设已经有一个StackPanel实例
+ myStackPanelWorkTime2.Orientation = Orientation.Horizontal;
+ TextBox textBoxUserCount = new TextBox();
+ textBoxUserCount.TextChanged += UserCount_TextChanged;
+ textBoxUserCount.FontSize = 24;
+ textBoxUserCount.Width = 260;
+ textBoxUserCount.VerticalAlignment = VerticalAlignment.Center;
+ textBoxUserCount.HorizontalAlignment = HorizontalAlignment.Left;
+
+ myStackPanelWorkTime2.Children.Add(lblUserCount);
+ myStackPanelWorkTime2.Children.Add(textBoxUserCount);
+ Grid.SetRow(myStackPanelWorkTime2, 3 + sortNo);
+ Grid.SetColumn(myStackPanelWorkTime2, 1);
+ myGrid.Children.Add(myStackPanelWorkTime2);
+
+ //将人数文本框存储到数据字典中
+ dynamicUserCountTextBoxes.Add(sortNo, textBox);
+ //stackPanelFather.Children.Add(myStackPanelWorkTime);
+ //}
+
+ // 递归添加控件
+ GetSubOrder(dtSubOrders.Rows[0]["workorder_code"].ToString());
+
+ //// 递归添加控件
+ //foreach (DataRow subOrder in dtSubOrders.Rows)
+ //{
+ // GetSubOrder(subOrder["workorder_code"].ToString());
+ //}
+ }
+ return true;
+ }
+ catch (Exception ex)
+ {
+ LogHelper.instance.log.Error(ex.Message);
+ return false;
+ }
+ }
+
+ private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ TextBox box = sender as TextBox;
+ if (!Regex.IsMatch(box.Text, @"^\d+(\.\d+)?$"))
+ {
+ // 输入是一个有效的数字,包括小数
+ this.tbMsg.Content = "工时含有非法字符!";
+ box.Focus();
+ return;
+ }
+ else
+ {
+ this.tbMsg.Content = "";
+ }
+ }
+
+ private void UserCount_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ TextBox box = sender as TextBox;
+ if (!Regex.IsMatch(box.Text, @"^\d+$"))
+ {
+ // 输入是一个有效的数字,包括小数
+ this.tbMsg.Content = "人数含有非法字符!";
+ box.Focus();
+ return;
+ }
+ else
+ {
+ this.tbMsg.Content = "";
+ }
+ }
+
+
+
+
private void InitConsumeData()
{
DataTable dt = userDbWareHouse.GetCosumeData(_workOrdercode);
@@ -348,10 +626,10 @@ namespace XGLFinishPro.Views
//CustomMessageBox.Show("没有维护成本中心,请联系管理员!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
-
+
//绑定
dgConsumeInfo.ItemsSource = dt.DefaultView;
-
+
}
private void txtQuantity_TextChanged(object sender, TextChangedEventArgs e)
@@ -401,10 +679,10 @@ namespace XGLFinishPro.Views
private void InitComBoboxData()
{
- DataTable dt = userDbWareHouse.GetCostCenter();
- if (dt == null)
+ DataTable dt = userDbWareHouse.GetCostCenter(_deviceCode);
+ if (dt == null || dt.Rows.Count == 0)
{
- CustomMessageBox.Show("没有维护成本中心,请联系管理员!",CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+ CustomMessageBox.Show("没有维护成本中心,请联系管理员!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
@@ -418,7 +696,7 @@ namespace XGLFinishPro.Views
comboBoxCostCenter.DisplayMemberPath = "factory_name";
comboBoxCostCenter.SelectedIndex = 0;
}
- private void piciInitComBoboxData()
+ private void piciInitComBoboxData()
{
DataTable dt = userDbWareHouse.piciGetCostCenter(this._workOrderId);
if (dt == null)
@@ -426,7 +704,7 @@ namespace XGLFinishPro.Views
CustomMessageBox.Show("没有找到批次号,请联系管理员!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
- List strings =new List();
+ List strings = new List();
strings.Add("");
foreach (System.Data.DataRow row in dt.Rows)
{
@@ -454,15 +732,73 @@ namespace XGLFinishPro.Views
private void dgConsumeInfo_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
//dgConsumeInfo.CommitEdit();
+ if (e.EditAction == DataGridEditAction.Commit)
+ {
+ if (e.Column is DataGridTextColumn textColumn && e.EditingElement is TextBox textBox)
+ {
+ // 获取当前编辑的单元格的行和列索引
+ int rowIndex = e.Row.GetIndex();
+ int colIndex = dgConsumeInfo.Columns.IndexOf(textColumn);
+
+ // 获取输入的值
+ string newValue = textBox.Text;
+
+ // 执行你的验证逻辑,这里以整数为例
+ if (!Regex.IsMatch(newValue, @"^\d+(\.\d+)?$"))
+ {
+ // 输入的不是整数,可以执行相应的操作,例如还原之前的值或显示错误消息等
+
+ CustomMessageBox.Show("请输入整数或者小数!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+
+ // 还原之前的值
+ dgConsumeInfo.CancelEdit();
+
+ // 或者清除输入的值
+ textBox.Text = string.Empty;
+ }
+ }
+ }
}
private void xuanze9_Checked(object sender, RoutedEventArgs e)
{
_isEndReport = true;
}
+
+ private void xuanze9_Click(object sender, RoutedEventArgs e)
+ {
+ if (xuanze9.IsChecked == true)
+ {
+ _isEndReport = true;
+ }
+ else
+ {
+ _isEndReport = false;
+ }
+ }
+
+ //private void txtFOUserCount_TextChanged(object sender, TextChangedEventArgs e)
+ //{
+ // if (!Regex.IsMatch(this.txtFOUserCount.Text, @"^\d+$"))
+ // {
+ // // 输入是一个有效的数字,包括小数
+ // this.tbMsg.Content = "母单人数含有非法字符!";
+ // this.txtFOUserCount.Focus();
+ // return;
+ // }
+ // else
+ // {
+ // this.tbMsg.Content = "";
+ // }
+ //}
+
+ private void dgConsumeInfo_CurrentCellChanged(object sender, EventArgs e)
+ {
+
+ }
}
public class CostCenter
- {
+ {
public string factory_code { get; set; }
public string factory_name { get; set; }
}
diff --git a/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml
index 88b11d6..d7cb453 100644
--- a/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml
+++ b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml
@@ -17,7 +17,7 @@
-
+
+
@@ -153,290 +154,315 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml.cs b/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml.cs
new file mode 100644
index 0000000..b635de9
--- /dev/null
+++ b/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml.cs
@@ -0,0 +1,358 @@
+using CommonFunc;
+using CommonFunc.Tools;
+using DevExpress.Data.Browsing.Design;
+using DevExpress.Mvvm.Native;
+using DevExpress.Office.Utils;
+using DevExpress.XtraRichEdit.Layout.Engine;
+using HandyControl.Tools.Extension;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using XGL.Data;
+using XGL.Dats.DBServiceFinishProd;
+using XGL.Models.Model;
+
+namespace XGLFinishPro.Views
+{
+ ///
+ /// PieceSalaryCalWin.xaml 的交互逻辑
+ ///
+ public partial class PieceSalaryCalWin : Window
+ {
+ FinishProdDBService prodDBService = new FinishProdDBService();
+ string _deviceCode = "", _productCode= "",_workOrderCode="",_sapWorkOrderCode="",_productName="", _childprocessCode="", _childprocessName = "";
+ public PieceSalaryCalWin()
+ {
+ InitializeComponent();
+ }
+
+ public PieceSalaryCalWin(string productCode,string productName,string deviceCode,string workOrderCode,string sapWorkOrderCode)
+ {
+ InitializeComponent();
+ _deviceCode = deviceCode;
+ _productCode = productCode;
+ _productName = productName;
+ _workOrderCode = workOrderCode;
+ _sapWorkOrderCode = sapWorkOrderCode;
+ }
+
+ private void dgWorkOrderInfo_LoadingRow(object sender, DataGridRowEventArgs e)
+ {
+ e.Row.Header = (e.Row.GetIndex() + 1).ToString();
+ }
+
+
+ private void btnConfirm_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ List listDetail = new List();
+ if (lstBoxStep.SelectedItems.Count > 0)
+ {
+ foreach (var item in lstBoxStep.SelectedItems)
+ {
+ ChildProcess childProcess = new ChildProcess();
+
+ childProcess.childprocess_code = (item as ChildProcess).childprocess_code;
+ childProcess.childprocess_name = (item as ChildProcess).childprocess_name;
+ listDetail.Add(childProcess);
+ }
+ if (lstSelectedStep.Items.Count > 0)
+ {
+ //this.lstSelectedStep.Items.Clear();
+ this.lstSelectedStep.ItemsSource = null;
+ lstSelectedStep.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
+ this.btnSelectStep.IsChecked = false;
+ }
+ else
+ {
+ lstSelectedStep.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
+ this.btnSelectStep.IsChecked = false;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ LogHelper.instance.log.Error("计件薪酬选择工序时发生异常:"+ex.Message);
+ }
+
+ }
+
+ private void lstSelectedStep_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ this.msgBox.Text = "";
+ List listDetail = new List();
+ if (lstSelectedStep.SelectedItems.Count > 0)
+ {
+ _childprocessCode = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_code;
+ _childprocessName = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_name;
+ }
+ // DataTable dt = prodDBService.GetUnitPriceInfo();
+
+ this.dgUserInfo.ItemsSource = null;
+ checkedRowsCache.Clear();
+ Utils.userList.ForEach(t => t.IsChecked = false);
+ dataSource = Utils.userList;
+ this.dgUserInfo.ItemsSource = dataSource;
+ }
+
+ private void dgUserInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ // 处理选中行的事件
+ //foreach (sys_user selectedItem in e.AddedItems)
+ //{
+ // // 在这里执行你的操作,YourDataType 是你的数据类型
+ // // selectedItem 包含当前选中行的数据
+ // selectedItem.IsChecked = true;
+ // int i = dgUserInfo.Items.IndexOf(selectedItem);
+ // (dgUserInfo.Items[i] as sys_user).IsChecked = true;
+ //}
+ }
+
+ private void CheckBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ // 阻止事件继续传播,以防止默认行为
+ e.Handled = true;
+ }
+
+ private void CheckBox_Click(object sender, RoutedEventArgs e)
+ {
+ CheckBox CBCheck = (CheckBox)sender;
+ try
+ {
+ List UsersList = dgUserInfo.SelectedItems as List;
+ if (UsersList != null)
+ {
+ foreach (sys_user item in UsersList)
+ {
+ if (item.IsChecked == true)
+ { item.IsChecked = false; }
+ else
+ { item.IsChecked = true; }
+ }
+ }
+ dgUserInfo.Items.Refresh();
+ }
+ catch (Exception ex)
+ {
+
+ }
+
+
+ }
+
+ //作为选中行的缓存
+ List checkedRowsCache = new List();
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ this.lstSelectedStep.ItemsSource = GetStepData();
+ GetData();
+ }
+
+ private void GetData()
+ {
+ DataTable dt = prodDBService.GetUnitPriceData(_deviceCode);
+ if (dt == null)
+ {
+ this.dgCreatedUserInfo.ItemsSource = null;
+ CustomMessageBox.Show("请配置工序数据之后再试!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Question);
+ }
+ else
+ {
+ this.dgCreatedUserInfo.ItemsSource = null;
+ this.dgCreatedUserInfo.ItemsSource = dt.DefaultView;
+ }
+ }
+
+ private void btnCloseWin_Click(object sender, RoutedEventArgs e)
+ {
+ if (CustomMessageBox.Show("确定要关闭此窗口吗?", CustomMessageBoxButton.YesNo, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.No)
+ return;
+ this.Close();
+ }
+
+ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+ {
+
+ }
+
+ List dataSource = new List();
+
+ private void cb_child_Click(object sender, RoutedEventArgs e)
+ {
+ CheckBox cb = e.Source as CheckBox;
+ bool isChecked;
+ isChecked = cb.IsChecked == true ? true : false;
+
+
+ sys_user curRow = (dgUserInfo.CurrentItem as sys_user);
+ if (isChecked)
+ {
+ //this.chkPrintBatch.IsChecked = false;
+ foreach (var item in dgUserInfo.Items)
+ {
+ // DataGridTemplateColumn templeColumn = dgUserInfo.Columns[0] as DataGridTemplateColumn;
+ // FrameworkElement fwElement = dgUserInfo.Columns[0].GetCellContent(item);
+ // CheckBox cBox = templeColumn.CellTemplate.FindName("cb_child", fwElement) as CheckBox;
+
+ // //循环的行
+ // //DataRow tempRow = (item as DataRowView).Row;
+ // cBox.IsChecked = false;
+
+ }
+ checkedRowsCache.Add(curRow);
+ cb.IsChecked = true;
+ curRow.IsChecked = true;
+ }
+ else
+ {
+ checkedRowsCache.Remove(curRow);
+ cb.IsChecked = false;
+ curRow.IsChecked = false;
+ }
+ }
+
+ private void btnQueryUser_Click(object sender, RoutedEventArgs e)
+ {
+ string queryP = this.txtP.Text.Trim();
+ if (string.IsNullOrEmpty(queryP))
+ {
+ this.dgUserInfo.ItemsSource = Utils.userList;
+ return;
+ }
+ this.dgUserInfo.ItemsSource = null;
+ var queryList = Utils.userList.Where(t => t.nick_name.Contains(queryP) || t.user_name.Contains(queryP));
+
+ this.dgUserInfo.ItemsSource = queryList;
+ }
+
+ private void txtP_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ btnQueryUser_Click(null,null);
+ }
+
+ private void btnUserConfirm_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ if (CustomMessageBox.Show("确定要生成该工序的数据吗?", CustomMessageBoxButton.YesNo, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.No)
+ return;
+ if (checkedRowsCache.Count == 0)
+ {
+ CustomMessageBox.Show("请选择人员", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+ return;
+ }
+ List CreateUnitPriceSqlList = new List();
+ if (prodDBService.IsExistData(_workOrderCode, _childprocessCode, _deviceCode))
+ {
+ string delSql = prodDBService.GetDelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
+ CreateUnitPriceSqlList.Add(delSql);
+ //prodDBService.DelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
+ }
+ foreach (sys_user item in checkedRowsCache)
+ {
+ string sql = prodDBService.GetCreateUnitPriceInfo(item, _workOrderCode, _sapWorkOrderCode, _productCode, _productName, _childprocessCode, _childprocessName,_deviceCode);
+ CreateUnitPriceSqlList.Add(sql);
+ }
+ //之前如果已经插入了,先删除,
+
+ //暂时不更新工单状态
+ //string updateSql = prodDBService.GetUpdateUnitPriceSql(_workOrderCode);
+ //CreateUnitPriceSqlList.Add(updateSql);
+ if (prodDBService.ExecuteCreateUnitPriceSql(CreateUnitPriceSqlList))
+ {
+ CustomMessageBox.Show("插入成功!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+
+ GetData();
+ foreach (sys_user item in dgUserInfo.Items)
+ {
+ if (item.IsChecked == true)
+ {
+ item.IsChecked = false;
+ }
+ }
+ }
+ else
+ {
+ CustomMessageBox.Show("插入失败,请重试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+
+ }
+ }
+ catch (Exception ex)
+ {
+ CustomMessageBox.Show("插入失败:"+ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
+ LogHelper.instance.log.Error("写入计件薪酬数据时发生异常:"+ex.Message);
+ }
+
+ }
+
+ private void btnSelectStep_Click(object sender, RoutedEventArgs e)
+ {
+ List list = new List();
+ DataTable dt = prodDBService.GetProductStepListInfo(_deviceCode, _productCode);
+
+ if (dt == null)
+ {
+ lstBoxStep.ItemsSource = null;
+ lstBoxStep.Items.Clear();
+ }
+ else
+ {
+ foreach (DataRow item in dt.Rows)
+ {
+ list.Add(new ChildProcess()
+ {
+ childprocess_code = item["childprocess_code"].ToString(),
+ childprocess_name = item["childprocess_name"].ToString()
+ });
+ }
+ lstBoxStep.ItemsSource = null;
+ lstBoxStep.Items.Clear();
+ lstBoxStep.ItemsSource = list;//dt.DefaultView;
+ }
+
+ }
+
+ private List GetStepData()
+ {
+ List list = new List();
+ DataTable dt = prodDBService.GetProductStepListInfo(_deviceCode, _productCode);
+
+ if (dt == null)
+ {
+ lstBoxStep.ItemsSource = null;
+ lstBoxStep.Items.Clear();
+ }
+ else
+ {
+ foreach (DataRow item in dt.Rows)
+ {
+ list.Add(new ChildProcess()
+ {
+ childprocess_code = item["childprocess_code"].ToString(),
+ childprocess_name = item["childprocess_name"].ToString()
+ });
+ }
+
+ }
+ return list;
+ }
+ }
+ public class ChildProcess
+ {
+ public string childprocess_code { get; set; }
+ public string childprocess_name { get; set; }
+ }
+}
diff --git a/shangjian/XGLFinishPro/XGLFinishPro.csproj b/shangjian/XGLFinishPro/XGLFinishPro.csproj
index 05e5547..6a61350 100644
--- a/shangjian/XGLFinishPro/XGLFinishPro.csproj
+++ b/shangjian/XGLFinishPro/XGLFinishPro.csproj
@@ -321,6 +321,7 @@
ModuleUC.xaml
+
@@ -330,6 +331,7 @@
+
ordertj.xaml
@@ -414,6 +416,9 @@
HBLogWin.xaml
+
+ PieceSalaryCalWin.xaml
+
QitaoLvUC.xaml
@@ -660,6 +665,10 @@
MSBuild:Compile
Designer
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/shangjian/XGLFinishPro/config/ConnectionConfig.Config b/shangjian/XGLFinishPro/config/ConnectionConfig.Config
index 0c6a3ef..5bcfc2d 100644
--- a/shangjian/XGLFinishPro/config/ConnectionConfig.Config
+++ b/shangjian/XGLFinishPro/config/ConnectionConfig.Config
@@ -1,14 +1,23 @@
- 强烈建议:对数据库以及本软件的参数更改,不要在此页进行.可以通过系统配置页进行更新.
-
-
-
-
+强烈建议:对数据库以及本软件的参数更改,不要在此页进行.可以通过系统配置页进行更新.
- vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S
+
- vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91A7V9zSnfhmhLWUQKZQdqof6chkC37l6QElb57z876mZdo9764iNmLGULHBiQyMu6PXowBdyaQVt17BPsWFn4EUs7Z7zTZwBP+2iJBVXitA3OF6EZXxAztmeZk/1iCwni+JzeWNpXqeOoGzkmSSzmVQH2Yf9m/mlqag2TbldSCcnUQl6lE7tcGg==
+
- vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91ML11cYCqHcHmTXJFsNQamIbW3UEpkjgNPUcBwRfgP6AWftvk9YFyv7y7/6nzX/c+6z6xMDIdcjYVvfteU+7YtOQhJXTfF5ScosAA0GliBfD8dWAunW+ZCos5LemAj2xb2wvvCxlbnrof8IunWslCaBEAGrdC/KhE0qEfNbxydwc=
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+ vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S
+
+ vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNntlKCeRLc6CBQNAw+bzYK+yDKBny3FzdffaiQ/9ohZ/iFw6P/06Dz1d7Q8OX2fGT3YK8v2yeiGlLhRHNGlkzN6Okv9SEccNYXDHZKQND/31n9bbXRhaFERnPoCp+evwBwpKq0nDcp4lLRNDrJpG2b6nw1popy2st0u+eYfbIYddNpj2jZcnrJXg==
+
+ vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNnXgKYRJ9zN5r4cTE3Hh+JS6lnhIJQCLO5Tn/1DUIbZe8kwpCPuiyxdQS9ApxjjxU3xmhgbAR3NfwaZV2/zLMECLZyTqYXOHwTHdkzxa9RyCzNcbpiSjkFFOVT9SrfkzeVUA+7kogOazAQ7II0ms/Pnls5vU+gUjP9JcI1Q6esb8M=
+
+
\ No newline at end of file
diff --git a/shangjian/加密解密.zip b/shangjian/加密解密.zip
new file mode 100644
index 0000000..fb8002d
Binary files /dev/null and b/shangjian/加密解密.zip differ