取消用户校验

master
zhaoaomin 2 years ago
parent c0b6273a50
commit 23c06a5f17

Binary file not shown.

@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms> </dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>ih3KkGKpdid9dU5UoQEXXgsZpplgMpRUQ8Tqz1i1/wQ=</dsig:DigestValue> <dsig:DigestValue>2xT7WSJ3JOGwOwaH5T5VSLO0545A2bhrSpA8Se3jmhE=</dsig:DigestValue>
</hash> </hash>
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>

@ -49,7 +49,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms> </dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>g3bEdlk6z/YhmxjUvrtfWuYKNM4Z225YvrpzH8n8vcI=</dsig:DigestValue> <dsig:DigestValue>y6yzsU8Eugy+ObfgrPA463CS+Nq1+410yHtpvzJQ8xU=</dsig:DigestValue>
</hash> </hash>
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>

@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms> </dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>ih3KkGKpdid9dU5UoQEXXgsZpplgMpRUQ8Tqz1i1/wQ=</dsig:DigestValue> <dsig:DigestValue>2xT7WSJ3JOGwOwaH5T5VSLO0545A2bhrSpA8Se3jmhE=</dsig:DigestValue>
</hash> </hash>
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>

@ -49,7 +49,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" /> <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms> </dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /> <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>g3bEdlk6z/YhmxjUvrtfWuYKNM4Z225YvrpzH8n8vcI=</dsig:DigestValue> <dsig:DigestValue>y6yzsU8Eugy+ObfgrPA463CS+Nq1+410yHtpvzJQ8xU=</dsig:DigestValue>
</hash> </hash>
</dependentAssembly> </dependentAssembly>
</dependency> </dependency>

@ -537,11 +537,11 @@ VALUES
return sqlList;//> 0 ? true : false; return sqlList;//> 0 ? true : false;
} }
public bool ChangeShiftsInfo() public bool ChangeShiftsInfo(string deviceCode)
{ {
// //
string sql = $@"INSERT INTO [dbo].[mes_changeshift_info] ([id], [shift_code], [change_time], [create_time], [create_by], [last_update], [update_by], [work_date]) string sql = $@"INSERT INTO [dbo].[mes_changeshift_info] ([id], [shift_code], [change_time], [create_time], [create_by], [last_update], [update_by], [work_date],[device_code])
VALUES ('{Common.GetUUID()}', '{LoginUser.ShiftCode}', GetDate(), GetDate(), '{LoginUser.UserName}', GetDate(), '{LoginUser.UserName}', '{LoginUser.WorkDate}');"; VALUES ('{Common.GetUUID()}', '{LoginUser.ShiftCode}', GetDate(), GetDate(), '{LoginUser.UserName}', GetDate(), '{LoginUser.UserName}', '{LoginUser.WorkDate}','{deviceCode}');";
int ret = Utils.netClientDBHelper.executeUpdate(sql); int ret = Utils.netClientDBHelper.executeUpdate(sql);
return ret > 0 ? true : false; return ret > 0 ? true : false;
} }

@ -261,8 +261,8 @@ namespace XGL.FormItem
byte[] buffer = System.Text.Encoding.ASCII.GetBytes(data); byte[] buffer = System.Text.Encoding.ASCII.GetBytes(data);
int timeout = 120; int timeout = 120;
while (true) //while (true)
{ //{
PingReply reply = pingSender.Send(ipAddress, timeout, buffer, options); PingReply reply = pingSender.Send(ipAddress, timeout, buffer, options);
if (reply.Status != IPStatus.Success) if (reply.Status != IPStatus.Success)
{ {
@ -281,7 +281,7 @@ namespace XGL.FormItem
// 可以设定一个间隔时间,然后再次 ping // 可以设定一个间隔时间,然后再次 ping
//System.Threading.Thread.Sleep(5000); // 5 秒 //System.Threading.Thread.Sleep(5000); // 5 秒
} //}
} }

@ -579,7 +579,7 @@ VALUES
{ {
if (CustomMessageBox.Show("交接班后产量会计入下一班次,您确定要交接班吗?", CustomMessageBoxButton.OKCancel, CustomMessageBoxIcon.Warning) == CustomMessageBoxResult.OK) if (CustomMessageBox.Show("交接班后产量会计入下一班次,您确定要交接班吗?", CustomMessageBoxButton.OKCancel, CustomMessageBoxIcon.Warning) == CustomMessageBoxResult.OK)
{ {
formingMachineService.ChangeShiftsInfo(); formingMachineService.ChangeShiftsInfo(deviceCode);
//因为程序多开受限制,先启动一个中间程序,再启动本程序 //因为程序多开受限制,先启动一个中间程序,再启动本程序
//设置要启动的应用程序名称和参数 //设置要启动的应用程序名称和参数
string appName = "RestartApp.exe"; // 替换为你的目标控制台应用程序的名称 string appName = "RestartApp.exe"; // 替换为你的目标控制台应用程序的名称

@ -243,16 +243,17 @@ namespace XGL.Views
private async void btnStartOrders_Click(object sender, RoutedEventArgs e) private async void btnStartOrders_Click(object sender, RoutedEventArgs e)
{ {
CheckUserWin checkUserWin = new CheckUserWin(); //陈恒杰在2024-01-07日与榄菊的苏振华确认不需要用户验证
checkUserWin.ShowDialog(); //CheckUserWin checkUserWin = new CheckUserWin();
if (!checkUserWin.loginFlag) //checkUserWin.ShowDialog();
{ //if (!checkUserWin.loginFlag)
CustomMessageBox.Show("请先校验用户!",CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); //{
return; // CustomMessageBox.Show("请先校验用户!",CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
} // return;
//}
if (WorkOrder.SelectedItems.Count == 0) if (WorkOrder.SelectedItems.Count == 0)
{ {
CustomMessageBox.Show("请选择要开始的工单!", CustomMessageBoxIcon.Warning); CustomMessageBox.Show("请选择要开始的工单!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return; return;
} }
string orderID = (WorkOrder.SelectedItem as WetMaterialModel).id; string orderID = (WorkOrder.SelectedItem as WetMaterialModel).id;

@ -10,9 +10,9 @@
<!--车间编码--> <!--车间编码-->
<add key="SiteCode" value="1000" /> <add key="SiteCode" value="1000" />
<!--设备编码--> <!--设备编码-->
<add key="DeviceCode" value="XL08" /> <add key="DeviceCode" value="XL01" />
<!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录--> <!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录-->
<add key="ClientMode" value="1" /> <add key="ClientMode" value="0" />
<add key="SerialPort" value="COM5" /> <add key="SerialPort" value="COM5" />

@ -393,9 +393,7 @@
Height="90"> Height="90">
<Button <Button
x:Name="btnFirstCheck" x:Name="btnFirstCheck"
Width="170" Style="{StaticResource btnKey}"
Height="60"
Margin="10,5"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Background="#2B7EE6" Click="btnFirstCheck_Click"> Background="#2B7EE6" Click="btnFirstCheck_Click">
@ -415,7 +413,6 @@
> >
<Button <Button
x:Name="btnRefresh" x:Name="btnRefresh"
Style="{StaticResource btnKey}" Style="{StaticResource btnKey}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
VerticalAlignment="Center" VerticalAlignment="Center"

@ -4,6 +4,7 @@ using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Threading.Tasks;
using System.Timers; using System.Timers;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@ -550,18 +551,19 @@ namespace XGLFinishPro.Views
HFPlcWin.ShowDialog(); HFPlcWin.ShowDialog();
} }
private void btnPause1_Click(object sender, RoutedEventArgs e) private async void btnPause1_Click(object sender, RoutedEventArgs e)
{ {
CheckUserWin checkUserWin = new CheckUserWin(); //陈恒杰在2024-01-07日与榄菊的苏振华确认不需要用户验证
checkUserWin.ShowDialog(); //CheckUserWin checkUserWin = new CheckUserWin();
if (!checkUserWin.loginFlag) //checkUserWin.ShowDialog();
{ //if (!checkUserWin.loginFlag)
CustomMessageBox.Show("请先校验用户!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); //{
return; // CustomMessageBox.Show("请先校验用户!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
} // return;
//}
if (dgWorkOrderInfo.SelectedItems.Count == 0) if (dgWorkOrderInfo.SelectedItems.Count == 0)
{ {
CustomMessageBox.Show("请选择要开始的工单!", CustomMessageBoxIcon.Warning); CustomMessageBox.Show("请选择要开始的工单!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return; return;
} }
@ -584,9 +586,11 @@ namespace XGLFinishPro.Views
} }
else else
{ {
//巡检
string materialCode = (dgWorkOrderInfo.SelectedItem as DataRowView)["product_code"].ToString(); string materialCode = (dgWorkOrderInfo.SelectedItem as DataRowView)["product_code"].ToString();
string materialDesc = (dgWorkOrderInfo.SelectedItem as DataRowView)["product_name"].ToString(); string materialDesc = (dgWorkOrderInfo.SelectedItem as DataRowView)["product_name"].ToString();
userDbWareHouse.InsertOperationLog(workorderID, "w2", "", "开始工单", deviceCode, materialCode, materialDesc); userDbWareHouse.InsertOperationLog(workorderID, "w2", "", "开始工单", deviceCode, materialCode, materialDesc);
await CallCheckApi("checkTypeSCXJ");
TimerDeciveState_Elapsed(null,null); TimerDeciveState_Elapsed(null,null);
} }
} }
@ -672,18 +676,48 @@ namespace XGLFinishPro.Views
return; return;
} }
} }
//首件检验
await CallCheckApi("checkTypeSC");
}
catch (Exception ex)
{
LogHelper.instance.log.Error("首检检验发生异常>>" + ex.Message);
CustomMessageBox.Show("首检检验发生异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
}
}
/// <summary>
/// 首检/巡检
/// </summary>
/// <param name="checkType"></param>
/// <returns></returns>
private async Task CallCheckApi(string checkType)
{
string workorderCode = (dgWorkOrderInfo.SelectedItem as DataRowView)["workorder_code"].ToString(); string workorderCode = (dgWorkOrderInfo.SelectedItem as DataRowView)["workorder_code"].ToString();
string workorderID= (dgWorkOrderInfo.SelectedItem as DataRowView)["workorder_id"].ToString(); string workorderID = (dgWorkOrderInfo.SelectedItem as DataRowView)["workorder_id"].ToString();
string batchCode = (dgWorkOrderInfo.SelectedItem as DataRowView)["batch_code"].ToString(); string batchCode = (dgWorkOrderInfo.SelectedItem as DataRowView)["batch_code"].ToString();
//调用首件检验接口 //调用首件检验接口
string apiUrl = formingMachineService.GetInterfaceUrl("createCheckProduceTask"); string apiUrl = formingMachineService.GetInterfaceUrl("createCheckProduceTask");
FirstCheckModel firstCheck = new FirstCheckModel(); FirstCheckModel firstCheck = new FirstCheckModel();
firstCheck.factoryCode = Utils.GetAppSetting("SiteCode"); firstCheck.factoryCode = Utils.GetAppSetting("SiteCode");
string taskName = "";
if (checkType.Equals("checkTypeSCXJ"))
{
taskName = "巡检任务";
firstCheck.incomeBatchNo = null;
}
else
{
taskName = "首件检验任务";
firstCheck.incomeBatchNo = (dgWorkOrderInfo.SelectedItem as DataRowView)["batch_code"].ToString(); firstCheck.incomeBatchNo = (dgWorkOrderInfo.SelectedItem as DataRowView)["batch_code"].ToString();
}
firstCheck.orderNo = workorderCode; firstCheck.orderNo = workorderCode;
firstCheck.materialName = (dgWorkOrderInfo.SelectedItem as DataRowView)["product_name"].ToString(); firstCheck.materialName = (dgWorkOrderInfo.SelectedItem as DataRowView)["product_name"].ToString();
firstCheck.materialCode = (dgWorkOrderInfo.SelectedItem as DataRowView)["product_code"].ToString(); firstCheck.materialCode = (dgWorkOrderInfo.SelectedItem as DataRowView)["product_code"].ToString();
firstCheck.checkType = "checkTypeSC"; firstCheck.checkType = checkType;//"checkTypeSC";
firstCheck.quality = (dgWorkOrderInfo.SelectedItem as DataRowView)["quantity_split"].ToString(); firstCheck.quality = (dgWorkOrderInfo.SelectedItem as DataRowView)["quantity_split"].ToString();
firstCheck.unit = (dgWorkOrderInfo.SelectedItem as DataRowView)["unit"].ToString(); firstCheck.unit = (dgWorkOrderInfo.SelectedItem as DataRowView)["unit"].ToString();
//根据线体编码获取车间编码 //根据线体编码获取车间编码
@ -700,41 +734,46 @@ namespace XGLFinishPro.Views
// 将要发送的数据序列化为JSON格式 // 将要发送的数据序列化为JSON格式
var jsonContent = JsonConvert.SerializeObject(firstCheck); var jsonContent = JsonConvert.SerializeObject(firstCheck);
LogHelper.instance.log.Info("开始首检>>" + jsonContent); LogHelper.instance.log.Info($"开始{taskName}>>" + jsonContent);
RestHelper restClient = new RestHelper(); RestHelper restClient = new RestHelper();
//var response =; //var response =;
Rootobjectresu result = Utils.DeJson<Rootobjectresu>(await restClient.PostAsync(apiUrl, jsonContent)); Rootobjectresu result = Utils.DeJson<Rootobjectresu>(await restClient.PostAsync(apiUrl, jsonContent));
if (result.code == 200) if (result.code == 200)
{ {
//调用首件检验接口 //巡检
bool isSuccess = formingMachineService.UpdateFirstCheckTask(workorderID, batchCode); if (checkType.Equals("checkTypeSCXJ"))
if (isSuccess)
{ {
CustomMessageBox.Show("首件检验任务创建成功", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success); CustomMessageBox.Show($"{taskName}创建成功", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success);
LogHelper.instance.log.Info("首检检验成功>>" + result.msg); LogHelper.instance.log.Info($"{taskName}创建成功>>" + result.msg);
GetWorkOrderInfo(); GetWorkOrderInfo();
} }
else else
{ {
CustomMessageBox.Show("更新首检任务状态失败", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); //调用首件检验
LogHelper.instance.log.Info("更新首检任务状态失败>>" + result.msg); bool isSuccess = formingMachineService.UpdateFirstCheckTask(workorderID, batchCode);
} if (isSuccess)
{
CustomMessageBox.Show($"{taskName}创建成功", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success);
LogHelper.instance.log.Info($"{taskName}创建成功>>" + result.msg);
GetWorkOrderInfo();
} }
else else
{ {
LogHelper.instance.log.Info("首检检验失败>>" + result.msg); CustomMessageBox.Show($"更新{taskName}状态失败", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
CustomMessageBox.Show("调用首件检验接口失败:" + result.msg, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); LogHelper.instance.log.Info($"更新{taskName}状态失败>>" + result.msg);
} }
} }
catch (Exception ex)
{
LogHelper.instance.log.Error("首检检验发生异常>>" + ex.Message);
CustomMessageBox.Show("首检检验发生异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
}
} }
else
{
LogHelper.instance.log.Info($"{taskName}失败>>" + result.msg);
CustomMessageBox.Show($"调用{taskName}接口失败:" + result.msg, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
}
} }
public class ReportWorkModel public class ReportWorkModel
{ {

@ -388,15 +388,19 @@
Binding="{Binding workorder_code}" Binding="{Binding workorder_code}"
Header="订单码" /> Header="订单码" />
<DataGridTextColumn <DataGridTextColumn
Width="150" Width="450"
Binding="{Binding product_name}" Binding="{Binding product_name}"
Header="产品名称" /> Header="产品名称" />
<DataGridTextColumn <DataGridTextColumn
Width="200" Width="250"
Binding="{Binding product_code}" Binding="{Binding product_code}"
Header="产品型号" /> Header="产品型号" />
<DataGridTextColumn <DataGridTextColumn
Width="1350" Width="100"
Binding="{Binding quantity_split}"
Header="数量" />
<DataGridTextColumn
Width="250"
Binding="{Binding prod_line_code}" Binding="{Binding prod_line_code}"
Header="设备" /> Header="设备" />

@ -1,15 +1,18 @@
using CentralControl.BaseData; using CentralControl.BaseData;
using CommonFunc; using CommonFunc;
using CommonFunc.Tools; using CommonFunc.Tools;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Threading.Tasks;
using System.Timers; using System.Timers;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using XGL.Data.DBService;
using XGL.Dats.DBServiceFinishProd; using XGL.Dats.DBServiceFinishProd;
using XGL.Models.Model.OrderPrepare; using XGL.Models.Model.OrderPrepare;
using XGL.Thrift; using XGL.Thrift;
@ -21,6 +24,7 @@ namespace XGLFinishPro.Views
/// </summary> /// </summary>
public partial class LanJu_Prepare : UserControl public partial class LanJu_Prepare : UserControl
{ {
FormingMachineService formingMachineService = new FormingMachineService();
Timer timerDeciveState = new Timer(); Timer timerDeciveState = new Timer();
string deviceCode = Utils.GetAppSetting("DeviceCode"); string deviceCode = Utils.GetAppSetting("DeviceCode");
@ -54,7 +58,7 @@ namespace XGLFinishPro.Views
//modelWareHouse = new List<WorkOrder>(); //modelWareHouse = new List<WorkOrder>();
//userDbWareHouse = new DBService(); //userDbWareHouse = new DBService();
string date = this.dateStart.SelectedDate.ToString() == "" ? DateTime.Now.ToString() : this.dateStart.SelectedDate.ToString(); string date = this.dateStart.SelectedDate.ToString() == "" ? DateTime.Now.ToString() : this.dateStart.SelectedDate.ToString();
dt = userDbWareHouse.GetWetPlanInfo(deviceCode,date); dt = userDbWareHouse.GetWetPlanInfo(deviceCode, date);
//eqment = userDbWareHouse.GeteqmentInfo(); //eqment = userDbWareHouse.GeteqmentInfo();
if (dt == null) if (dt == null)
{ {
@ -170,7 +174,7 @@ namespace XGLFinishPro.Views
), ),
System.Windows.Threading.DispatcherPriority.Render); System.Windows.Threading.DispatcherPriority.Render);
dt = userDbWareHouse.GetWetPlanInfo(deviceCode,date); dt = userDbWareHouse.GetWetPlanInfo(deviceCode, date);
if (dt == null) return; if (dt == null) return;
if (wetList != null) if (wetList != null)
@ -195,16 +199,17 @@ namespace XGLFinishPro.Views
private async void btnStartOrders_Click(object sender, RoutedEventArgs e) private async void btnStartOrders_Click(object sender, RoutedEventArgs e)
{ {
CheckUserWin checkUserWin = new CheckUserWin(); //陈恒杰在2024-01-07日与榄菊的苏振华确认不需要用户验证
checkUserWin.ShowDialog(); //CheckUserWin checkUserWin = new CheckUserWin();
if (!checkUserWin.loginFlag) //checkUserWin.ShowDialog();
{ //if (!checkUserWin.loginFlag)
CustomMessageBox.Show("请先校验用户!",CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); //{
return; // CustomMessageBox.Show("请先校验用户!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
} // return;
//}
if (WorkOrder.SelectedItems.Count == 0) if (WorkOrder.SelectedItems.Count == 0)
{ {
CustomMessageBox.Show("请选择要开始的工单!", CustomMessageBoxIcon.Warning); CustomMessageBox.Show("请选择要开始的工单!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return; return;
} }
@ -244,7 +249,8 @@ namespace XGLFinishPro.Views
{ {
string materialCode = selectedRow["product_code"].ToString(); string materialCode = selectedRow["product_code"].ToString();
string materialDesc = selectedRow["product_name"].ToString(); string materialDesc = selectedRow["product_name"].ToString();
userDbWareHouse.InsertOperationLog(workorderID, "w2", "","开始工单", deviceCode, materialCode, materialDesc); userDbWareHouse.InsertOperationLog(workorderID, "w2", "", "开始工单", deviceCode, materialCode, materialDesc);
await CallCheckApi("checkTypeSCXJ");
GetWorkOrder(); GetWorkOrder();
} }
@ -347,10 +353,69 @@ namespace XGLFinishPro.Views
} }
private async Task CallCheckApi(string checkType)
{
string workorderCode = (WorkOrder.SelectedItem as DataRowView)["workorder_code"].ToString();
string workorderID = (WorkOrder.SelectedItem as DataRowView)["workorder_id"].ToString();
//string batchCode = (WorkOrder.SelectedItem as DataRowView)["batch_code"].ToString();
//调用首件检验接口
string apiUrl = formingMachineService.GetInterfaceUrl("createCheckProduceTask");
FirstCheckModel firstCheck = new FirstCheckModel();
firstCheck.factoryCode = Utils.GetAppSetting("SiteCode");
if (checkType.Equals("checkTypeSCXJ"))
{
firstCheck.incomeBatchNo = null;
}
else
{
firstCheck.incomeBatchNo = null;//(WorkOrder.SelectedItem as DataRowView)["batch_code"].ToString();
}
firstCheck.orderNo = workorderCode;
firstCheck.materialName = (WorkOrder.SelectedItem as DataRowView)["product_name"].ToString();
firstCheck.materialCode = (WorkOrder.SelectedItem as DataRowView)["product_code"].ToString();
firstCheck.checkType = checkType;//"checkTypeSC";
firstCheck.quality = (WorkOrder.SelectedItem as DataRowView)["quantity_split"].ToString();
firstCheck.unit = (WorkOrder.SelectedItem as DataRowView)["unit"].ToString();
//根据线体编码获取车间编码
DataTable dtCar = userDbWareHouse.GetCarInfo(deviceCode);
string carCode = dtCar.Rows[0][0].ToString();
string carName = dtCar.Rows[0][1].ToString();
firstCheck.carName = carName;
firstCheck.carCode = carCode;
firstCheck.produceDate = (WorkOrder.SelectedItem as DataRowView)["plan_time"].ToString();
firstCheck.checkManName = LoginUser.UserName;
firstCheck.checkManCode = LoginUser.UserCode;
firstCheck.checkLoc = deviceCode;
// 将要发送的数据序列化为JSON格式
var jsonContent = JsonConvert.SerializeObject(firstCheck);
LogHelper.instance.log.Info("开始巡检>>" + jsonContent);
RestHelper restClient = new RestHelper();
//var response =;
Rootobjectresu result = Utils.DeJson<Rootobjectresu>(await restClient.PostAsync(apiUrl, jsonContent));
if (result.code == 200)
{
CustomMessageBox.Show("巡检任务创建成功", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success);
LogHelper.instance.log.Info("首检检验成功>>" + result.msg);
GetWorkOrder();
}
else
{
LogHelper.instance.log.Info("巡检任务创建失败>>" + result.msg);
CustomMessageBox.Show("调用巡检任务接口失败:" + result.msg, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
}
private bool UpdateOrderStatus(string workorderID) private bool UpdateOrderStatus(string workorderID)
{ {
//更新工单状态 //更新工单状态
var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID,deviceCode); var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID, deviceCode);
if (!updatestatus) if (!updatestatus)
{ {
CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
@ -470,7 +535,7 @@ namespace XGLFinishPro.Views
} }
catch (Exception ex) catch (Exception ex)
{ {
CustomMessageBox.Show(ex.Message,CustomMessageBoxButton.OK,CustomMessageBoxIcon.Error); CustomMessageBox.Show(ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
LogHelper.instance.log.Error("获取工单齐套信息时发生异常:" + ex.Message); LogHelper.instance.log.Error("获取工单齐套信息时发生异常:" + ex.Message);
} }
} }

Loading…
Cancel
Save