From b82d78f7a061445557d7eec5ddc7fe897860e0f6 Mon Sep 17 00:00:00 2001 From: zhaojian Date: Fri, 10 Nov 2023 13:48:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=A8code=E4=B8=8A?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E4=B8=80=E4=B8=AA0=20=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8C=85=E5=85=AC=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bin/Debug/AutoUpdate.application | 4 +- .../bin/Debug/AutoUpdate.exe.manifest | 2 +- .../obj/x86/Debug/AutoUpdate.application | 4 +- .../DBService/FormingMachineService.cs | 2 +- .../Model/OrderPrepare/WcsSyncResult.cs | 21 +++- shangjian/XGL/Views/LanJu_Operator.xaml.cs | 6 +- .../XGLFinishPro/Views/LanJu_Operator.xaml.cs | 112 ++++++++++-------- shangjian/XGLFinishPro/XGLFinishPro.csproj | 4 + .../XGLFinishPro/XGLFinishPro.csproj.user | 6 + 9 files changed, 97 insertions(+), 64 deletions(-) create mode 100644 shangjian/XGLFinishPro/XGLFinishPro.csproj.user diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application index a8655b1..1d2dc68 100644 --- a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application +++ b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.application @@ -1,7 +1,7 @@  - + @@ -14,7 +14,7 @@ - kCr1fh10+EtMBHGFNQ8qK4lr256zI+0Jrd2pZnBY0uI= + Me9Xo9mBXudYE/51yJuvPG+bparg2CiQ+ufukPtZMoM= diff --git a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest index af8e83c..9d44e0f 100644 --- a/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest +++ b/shangjian/AutoUpdate/bin/Debug/AutoUpdate.exe.manifest @@ -49,7 +49,7 @@ - qnFKF+/3YlPAODyAGRSFG761uj8zOHLBVY6MUaXwrHc= + Po3RXPWGZu4mUxH1jVsl/Rdx6vzD+7hH//g0gawb1HM= diff --git a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application index a8655b1..1d2dc68 100644 --- a/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application +++ b/shangjian/AutoUpdate/obj/x86/Debug/AutoUpdate.application @@ -1,7 +1,7 @@  - + @@ -14,7 +14,7 @@ - kCr1fh10+EtMBHGFNQ8qK4lr256zI+0Jrd2pZnBY0uI= + Me9Xo9mBXudYE/51yJuvPG+bparg2CiQ+ufukPtZMoM= diff --git a/shangjian/XGL.Data/DBService/FormingMachineService.cs b/shangjian/XGL.Data/DBService/FormingMachineService.cs index bc94a55..0883a2f 100644 --- a/shangjian/XGL.Data/DBService/FormingMachineService.cs +++ b/shangjian/XGL.Data/DBService/FormingMachineService.cs @@ -297,7 +297,7 @@ VALUES '{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE', '无', '{workTime}', '{deviceCode}', N'线体2', N'A01', '{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(), '1', NULL, 'prod', + '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}',GetDate(), '0', NULL, 'prod', {userCount}, '{costCenter}');"; //赵啸林说不用上位机更新报工标识 //string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' "; diff --git a/shangjian/XGL.Model/Model/OrderPrepare/WcsSyncResult.cs b/shangjian/XGL.Model/Model/OrderPrepare/WcsSyncResult.cs index 8e6bee1..21bd663 100644 --- a/shangjian/XGL.Model/Model/OrderPrepare/WcsSyncResult.cs +++ b/shangjian/XGL.Model/Model/OrderPrepare/WcsSyncResult.cs @@ -7,14 +7,29 @@ using System.Threading.Tasks; namespace XGL.Models.Model.OrderPrepare { public class WcsSyncResult - { + { public string reqCode { get; set; } public int code { get; set; } - public string message { get; set; } + public string message { get; set; } } public class MesResult - { + { public int code { get; set; } public string msg { get; set; } } + + public class Rootobjectresu + { + public string msg { get; set; } + public int code { get; set; } + public Data data { get; set; } + } + + public class Data + { + public int code { get; set; } + public string msg { get; set; } + public object data { get; set; } + } + } diff --git a/shangjian/XGL/Views/LanJu_Operator.xaml.cs b/shangjian/XGL/Views/LanJu_Operator.xaml.cs index 9114d4f..fc4c886 100644 --- a/shangjian/XGL/Views/LanJu_Operator.xaml.cs +++ b/shangjian/XGL/Views/LanJu_Operator.xaml.cs @@ -481,13 +481,13 @@ namespace XGL.Views DataTable dtNewRFID = formingMachineService.GetNewRFID(); if (dtNewRFID == null || dtNewRFID.Rows.Count == 0) { - newRfid = "B" + DateTime.Now.ToString("yyyyMMdd") + "001"; + newRfid = "B" + DateTime.Now.ToString("yyyyMMdd") + "0001"; } else { if (string.IsNullOrEmpty(dtNewRFID.Rows[0]["report_code"].ToString())) { - newRfid = "B" + DateTime.Now.ToString("yyyyMMdd") + "001"; + newRfid = "B" + DateTime.Now.ToString("yyyyMMdd") + "0001"; } else { @@ -524,7 +524,7 @@ VALUES '{item["workorder_code"]}', '{item["product_code"]}', NULL, - 'B{DateTime.Now.ToString("yyyyMMdd")}001', + 'B{DateTime.Now.ToString("yyyyMMdd")}0001', 'af69d35181624b00848958c93c875818', NULL, GetDate(), diff --git a/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml.cs index b955c10..c2065d6 100644 --- a/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml.cs +++ b/shangjian/XGLFinishPro/Views/LanJu_Operator.xaml.cs @@ -407,71 +407,79 @@ namespace XGLFinishPro.Views private async void btnComplete_Click(object sender, RoutedEventArgs e) { - var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); //dgWorkOrderInfo.SelectedItem as FoamingMacModel; - if (selectedRow == null) + try { - MessageBox.Show("请选择你要报工的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } - if (!selectedRow["status"].ToString().Equals("w2")) - { - MessageBox.Show("你选择的工单不能报工!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); - return; - } - string newReportCode = ""; - DataTable dtNewReportCode = formingMachineService.GetReportCode(); - if (dtNewReportCode == null || dtNewReportCode.Rows.Count == 0) - { - newReportCode = DateTime.Now.ToString("yyyyMMdd") + "001"; - } - else - { - if (string.IsNullOrEmpty(dtNewReportCode.Rows[0]["report_code"].ToString())) + var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); //dgWorkOrderInfo.SelectedItem as FoamingMacModel; + if (selectedRow == null) { - newReportCode = DateTime.Now.ToString("yyyyMMdd") + "001"; + MessageBox.Show("请选择你要报工的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + if (!selectedRow["status"].ToString().Equals("w2")) + { + MessageBox.Show("你选择的工单不能报工!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); + return; + } + string newReportCode = ""; + DataTable dtNewReportCode = formingMachineService.GetReportCode(); + if (dtNewReportCode == null || dtNewReportCode.Rows.Count == 0) + { + newReportCode = DateTime.Now.ToString("yyyyMMdd") + "0001"; } else { - newReportCode = (Convert.ToInt32(dtNewReportCode.Rows[0]["report_code"].ToString()) + 1).ToString(); - } - } - ExecReportWorkWin execReport = new ExecReportWorkWin(selectedRow["workorder_code"].ToString(), selectedRow["quantity_split"].ToString()); - - if (execReport.ShowDialog() == true) - { - string workTime = execReport._workTime; - string costCenter = execReport._costCenter; - string userCount = execReport._useMan; - bool issucc = formingMachineService.ExecuteReportWork(selectedRow, newReportCode, workTime, userCount, costCenter, deviceCode); - if (issucc) - { - //调用报工接口 - string apiUrl = formingMachineService.InterfaceUrl("reportWork"); - ReportWork reportWork = new ReportWork(); - reportWork.factoryCode = Utils.GetAppSetting("SiteCode"); - reportWork.reportCode = newReportCode; - // 将要发送的数据序列化为JSON格式 - var jsonContent = JsonConvert.SerializeObject(reportWork); - LogHelper.instance.log.Info("开始报工>>" + jsonContent); - RestHelper restClient = new RestHelper(); - var response = await restClient.PostAsync(apiUrl, jsonContent); - - MesResult result = Utils.DeJson(response); - - if (result.code == 200) + if (string.IsNullOrEmpty(dtNewReportCode.Rows[0]["report_code"].ToString())) { - GetWorkOrderInfo(); + newReportCode = DateTime.Now.ToString("yyyyMMdd") + "0001"; } else { - CustomMessageBox.Show("调用报工接口失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); - } + newReportCode = (Convert.ToInt64(dtNewReportCode.Rows[0]["report_code"].ToString()) + 1).ToString(); + } } - else + ExecReportWorkWin execReport = new ExecReportWorkWin(selectedRow["workorder_code"].ToString(), selectedRow["quantity_split"].ToString()); + + if (execReport.ShowDialog() == true) { - CustomMessageBox.Show("报工失败",CustomMessageBoxButton.OK,CustomMessageBoxIcon.Error); + string workTime = execReport._workTime; + string costCenter = execReport._costCenter; + string userCount = execReport._useMan; + bool issucc = formingMachineService.ExecuteReportWork(selectedRow, newReportCode, workTime, userCount, costCenter, deviceCode); + if (issucc) + { + //调用报工接口 + string apiUrl = formingMachineService.InterfaceUrl("reportWork"); + ReportWork reportWork = new ReportWork(); + reportWork.factoryCode = Utils.GetAppSetting("SiteCode"); + reportWork.reportCode = newReportCode; + // 将要发送的数据序列化为JSON格式 + var jsonContent = JsonConvert.SerializeObject(reportWork); + LogHelper.instance.log.Info("开始报工>>" + jsonContent); + RestHelper restClient = new RestHelper(); + //var response =; + + Rootobjectresu result = Utils.DeJson(await restClient.PostAsync(apiUrl, jsonContent)); + + if (result.code == 200) + { + GetWorkOrderInfo(); + } + else + { + CustomMessageBox.Show("调用报工接口失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); + } + } + else + { + CustomMessageBox.Show("报工失败", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error); + } } } + catch (Exception ex) + { + + } + } diff --git a/shangjian/XGLFinishPro/XGLFinishPro.csproj b/shangjian/XGLFinishPro/XGLFinishPro.csproj index a07298a..ddaf922 100644 --- a/shangjian/XGLFinishPro/XGLFinishPro.csproj +++ b/shangjian/XGLFinishPro/XGLFinishPro.csproj @@ -811,6 +811,10 @@ + + {341ad485-e4a2-4a2c-9e93-9d4e360d692c} + AutoUpdate + {93e27248-65cd-4e02-abe3-645d7d5a519c} CentralControl diff --git a/shangjian/XGLFinishPro/XGLFinishPro.csproj.user b/shangjian/XGLFinishPro/XGLFinishPro.csproj.user new file mode 100644 index 0000000..865c607 --- /dev/null +++ b/shangjian/XGLFinishPro/XGLFinishPro.csproj.user @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file