|
|
|
@ -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
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|