@ -14,6 +14,7 @@ using XGL.Models.Model;
using XGL.Models.Model.FoamingMac ;
using XGL.Models.Model.FoamingMac ;
using XGL.Models.Model.OrderPrepare ;
using XGL.Models.Model.OrderPrepare ;
using XGL.Thrift ;
using XGL.Thrift ;
using static System . Windows . Forms . VisualStyles . VisualStyleElement ;
namespace XGLFinishPro.Views
namespace XGLFinishPro.Views
@ -100,7 +101,7 @@ namespace XGLFinishPro.Views
timerDeciveState . Interval = Utils . GetAppSetting ( "GetDeviceStateInterval" ) = = "" ? 15000 : Convert . ToInt32 ( Utils . GetAppSetting ( "GetDeviceStateInterval" ) ) ;
timerDeciveState . Interval = Utils . GetAppSetting ( "GetDeviceStateInterval" ) = = "" ? 15000 : Convert . ToInt32 ( Utils . GetAppSetting ( "GetDeviceStateInterval" ) ) ;
timerDeciveState . Elapsed + = TimerDeciveState_Elapsed ;
timerDeciveState . Elapsed + = TimerDeciveState_Elapsed ;
timerDeciveState . Start ( ) ;
timerDeciveState . Start ( ) ;
Complete_Click ( null , null ) ;
Complete_Click ( null , null ) ;
GetWorkOrderInfo ( ) ;
GetWorkOrderInfo ( ) ;
}
}
string isbaiye ;
string isbaiye ;
@ -303,7 +304,7 @@ namespace XGLFinishPro.Views
//var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
//var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
if ( selectedRow = = null )
if ( selectedRow = = null )
{
{
MessageBox. Show ( "请选择你要暂停的工单!" , "温馨提示" , MessageBoxButton. OK , MessageBoxImage . Warning ) ;
Custom MessageBox. Show ( "请选择你要暂停的工单!" , Custom MessageBoxButton. OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
@ -311,23 +312,22 @@ namespace XGLFinishPro.Views
string currStatus = selectedRow [ "status" ] . ToString ( ) ; //.status;
string currStatus = selectedRow [ "status" ] . ToString ( ) ; //.status;
if ( currStatus ! = "w2" )
if ( currStatus ! = "w2" )
{
{
MessageBox. Show ( "只有活动中的工单才支持暂停!" , "温馨提示" , MessageBoxButton. OK , MessageBoxImage . Warning ) ;
Custom MessageBox. Show ( "只有活动中的工单才支持暂停!" , Custom MessageBoxButton. OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
PauseOrderWin pauseOrderWin = new PauseOrderWin ( ) ;
PauseOrderWin pauseOrderWin = new PauseOrderWin ( ) ;
if ( pauseOrderWin . ShowDialog ( ) = = true )
if ( pauseOrderWin . ShowDialog ( ) = = true )
{
{
PauseRecoverOrderS ( workordercode , "w4" , pauseOrderWin ) ;
PauseRecoverOrderS ( workordercode , "w4" , pauseOrderWin ) ;
GetWorkOrderInfo ( ) ;
GetWorkOrderInfo ( ) ;
}
}
//MessageBoxResult result = MessageBox.Show("你确定要暂停该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
//MessageBoxResult result = MessageBox.Show("你确定要暂停该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
//if (result == MessageBoxResult.No)
//if (result == MessageBoxResult.No)
// return;
// return;
}
}
private bool PauseRecoverOrderS ( string workordercode , string status , PauseOrderWin pauseOrderWin )
private bool PauseRecoverOrderS ( string workordercode , string status , PauseOrderWin pauseOrderWin )
{
{
bool updatestatus = formingMachineService . UpdateWorkOrder ( workordercode , status , pauseOrderWin . remark , pauseOrderWin . type , deviceCode ) ;
bool updatestatus = formingMachineService . UpdateWorkOrder ( workordercode , status , pauseOrderWin . remark , pauseOrderWin . type , deviceCode ) ;
if ( ! updatestatus )
if ( ! updatestatus )
@ -353,14 +353,22 @@ namespace XGLFinishPro.Views
var selectedRow = ( dgWorkOrderInfo . SelectedItem as DataRowView ) ;
var selectedRow = ( dgWorkOrderInfo . SelectedItem as DataRowView ) ;
if ( selectedRow = = null )
if ( selectedRow = = null )
{
{
MessageBox. Show ( "请选择你要恢复的工单!" , "温馨提示" , MessageBoxButton. OK , MessageBoxImage . Warning ) ;
Custom MessageBox. Show ( "请选择你要恢复的工单!" , Custom MessageBoxButton. OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
int orderCount = GetActivedOrdersCount ( this . deviceCode , LoginUser . WorkDate ) ;
if ( orderCount > = 1 )
{
CustomMessageBox . Show ( "已有活动中的工单,请先报工再开始下一个工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
}
var workordercode = selectedRow [ "workorder_code" ] . ToString ( ) ; //.workorder_code;
var workordercode = selectedRow [ "workorder_code" ] . ToString ( ) ; //.workorder_code;
string currStatus = selectedRow [ "status" ] . ToString ( ) ; //.status;
string currStatus = selectedRow [ "status" ] . ToString ( ) ; //.status;
if ( currStatus ! = "w4" )
if ( currStatus ! = "w4" )
{
{
MessageBox . Show ( "只有暂停中的工单才支持恢复!" , "温馨提示" , MessageBoxButton . OK , MessageBoxImage . Warning ) ;
Custom MessageBox. Show ( "只有暂停中的工单才支持恢复!" , Custom MessageBoxButton. OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
//MessageBoxResult result = MessageBox.Show("你确定要恢复该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
//MessageBoxResult result = MessageBox.Show("你确定要恢复该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
@ -439,20 +447,23 @@ namespace XGLFinishPro.Views
CustomMessageBox . Show ( "请选择你要报工的工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
CustomMessageBox . Show ( "请选择你要报工的工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
if ( ! selectedRow [ "status" ] . ToString ( ) . Equals ( "w2" ) )
if ( ! selectedRow [ "status" ] . ToString ( ) . Equals ( "w2" ) & & ! selectedRow [ "status" ] . ToString ( ) . Equals ( "w4" ) )
{
{
CustomMessageBox . Show ( "你选择的工单不能报工!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
string status = selectedRow [ "status" ] . ToString ( ) ;
string st = status . Equals ( "w1" ) ? "未派发" : status . Equals ( "w3" ) ? "已报工" : status . Equals ( "w0" ) ? "未派发" : "已暂停" ;
CustomMessageBox . Show ( "你选择的工单不能报工,请检查工单状态,当前工单状态为:" + st , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
if ( selectedRow [ "batchStatus" ] . ToString ( ) . Equals ( "0" ) )
//20240424预报工功能, 不能限制批次报工次数,
{
//if (selectedRow["batchStatus"].ToString().Equals("0"))
CustomMessageBox . Show ( "你选择的该批次不能报工!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
//{
return ;
// CustomMessageBox.Show("你选择的该批次不能报工!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
// return;
//}
ExecReportWorkWin execReport = new ExecReportWorkWin ( selectedRow , deviceCode , Utils . GetAppSetting ( "SiteCode" ) ) ;
ExecReportWorkWin execReport = new ExecReportWorkWin ( selectedRow , deviceCode , Utils . GetAppSetting ( "SiteCode" ) ) ;
if ( execReport . ShowDialog ( ) = = true )
if ( execReport . ShowDialog ( ) = = true )
{
{
@ -518,7 +529,8 @@ namespace XGLFinishPro.Views
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
LogHelper . instance . log . Error ( "报工失败11>>" + ex . Message ) ;
CustomMessageBox . Show ( "报工失败:" + ex . Message , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Error ) ;
}
}
}
}
@ -576,10 +588,21 @@ namespace XGLFinishPro.Views
{
{
if ( status ! = "" )
if ( status ! = "" )
{
{
CustomMessageBox . Show ( "该工单不符合条件,请选择其他的工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
string st = status . Equals ( "w1" ) ? "未派发" : status . Equals ( "w3" ) ? "已报工" : status . Equals ( "w0" ) ? "未派发" : "已暂停" ;
CustomMessageBox . Show ( "该工单不符合条件,请检查工单状态,当前工单状态为:" + st , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
}
}
CustomMessageBoxResult result = CustomMessageBox . Show ( "你确定要开始工单么?" , CustomMessageBoxButton . OKCancel , CustomMessageBoxIcon . Warning ) ;
if ( result = = CustomMessageBoxResult . Cancel )
return ;
//2024-04-23赵啸林要求添加一条产线同一天只能有一个活动状态下的工单, 如果有未报工的则不允许开始新的工单
int orderCount = GetActivedOrdersCount ( this . deviceCode , LoginUser . WorkDate ) ;
if ( orderCount > = 1 )
{
CustomMessageBox . Show ( "已有活动中的工单,请先报工再开始下一个工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
}
//更新工单状态
//更新工单状态
if ( ! UpdateOrderStatus ( workorderID ) )
if ( ! UpdateOrderStatus ( workorderID ) )
{
{
@ -591,14 +614,24 @@ namespace XGLFinishPro.Views
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" ) ;
// await CallCheckApi("checkTypeSCXJ");20240403赵啸林因为切线方案调整, 要求取消上位机生成巡检任务的功能;
TimerDeciveState_Elapsed ( null , null ) ;
TimerDeciveState_Elapsed ( null , null ) ;
}
}
}
}
private int GetActivedOrdersCount ( string deviceCode , string workDate )
{
DataTable dtActivedOrdersQty = userDbWareHouse . GetActivedOrdersQty ( deviceCode , workDate ) ;
if ( dtActivedOrdersQty = = null )
return 0 ;
int count = Convert . ToInt32 ( dtActivedOrdersQty . Rows [ 0 ] [ 0 ] ) ;
return count ;
}
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 ) ;
@ -624,7 +657,7 @@ namespace XGLFinishPro.Views
}
}
}
}
private void GetQitaolv_Click ( object sender , RoutedEventArgs e )
private void GetQitaolv_Click ( object sender , RoutedEventArgs e )
{
{
QitaoLvUC lanJu_QitaoLv = new QitaoLvUC ( _workOrderCode ) ;
QitaoLvUC lanJu_QitaoLv = new QitaoLvUC ( _workOrderCode ) ;
@ -642,8 +675,8 @@ namespace XGLFinishPro.Views
CustomMessageBox . Show ( "请对母单使用叫料功能!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
CustomMessageBox . Show ( "请对母单使用叫料功能!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
}
}
private async void btnFirstCheck_Click ( object sender , RoutedEventArgs e )
private async void btnFirstCheck_Click ( object sender , RoutedEventArgs e )
{
{
if ( dgWorkOrderInfo . SelectedItems . Count = = 0 )
if ( dgWorkOrderInfo . SelectedItems . Count = = 0 )
@ -651,7 +684,8 @@ namespace XGLFinishPro.Views
CustomMessageBox . Show ( "请选择要首件检验的工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
CustomMessageBox . Show ( "请选择要首件检验的工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
try
try
{
{
string status1 = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "workorder_code" ] . ToString ( ) ;
string status1 = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "workorder_code" ] . ToString ( ) ;
@ -661,22 +695,28 @@ namespace XGLFinishPro.Views
{
{
if ( status ! = "" )
if ( status ! = "" )
{
{
CustomMessageBox . Show ( "该工单不符合条件,请选择其他的工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
string st = status . Equals ( "w1" ) ? "未派发" : status . Equals ( "w3" ) ? "已报工" : status . Equals ( "w0" ) ? "未派发" : "已暂停" ;
CustomMessageBox . Show ( "该工单不符合条件,请检查工单状态,当前工单状态为:" + st , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
}
}
CustomMessageBoxResult result = CustomMessageBox . Show ( "你确定要首检么?" , CustomMessageBoxButton . OKCancel , CustomMessageBoxIcon . Warning ) ;
if ( result = = CustomMessageBoxResult . Cancel )
return ;
string qcStatus = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "qc_status" ] . ToString ( ) ;
if ( qcStatus . Equals ( "1" ) | | qcStatus . Equals ( "2" ) )
//2024-04-16添加不限制首检确认的功能;
{
//string qcStatus = (dgWorkOrderInfo.SelectedItem as DataRowView)["qc_status"].ToString();
if ( qcStatus ! = "" )
{
//if (qcStatus.Equals("1") || qcStatus.Equals("2"))
CustomMessageBox . Show ( "该工单已完成质检,请不要重复创建质检任务!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
//{
return ;
// if (qcStatus != "")
}
// {
}
// CustomMessageBox.Show("该工单已完成质检,请不要重复创建质检任务!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
// return;
// }
//}
//首件检验
//首件检验
await CallCheckApi ( "checkTypeSC" ) ;
await CallCheckApi ( "checkTypeSC" ) ;
}
}
@ -685,7 +725,7 @@ namespace XGLFinishPro.Views
LogHelper . instance . log . Error ( "首检检验发生异常>>" + ex . Message ) ;
LogHelper . instance . log . Error ( "首检检验发生异常>>" + ex . Message ) ;
CustomMessageBox . Show ( "首检检验发生异常:" + ex . Message , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Error ) ;
CustomMessageBox . Show ( "首检检验发生异常:" + ex . Message , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Error ) ;
}
}
}
}
/// <summary>
/// <summary>
@ -698,7 +738,7 @@ namespace XGLFinishPro.Views
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 ( ) ;
@ -714,7 +754,7 @@ namespace XGLFinishPro.Views
taskName = "首件检验任务" ;
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 ( ) ;
@ -741,7 +781,7 @@ namespace XGLFinishPro.Views
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 )
{
{
//巡检
//巡检
@ -767,7 +807,7 @@ namespace XGLFinishPro.Views
LogHelper . instance . log . Info ( $"更新{taskName}状态失败>>" + result . msg ) ;
LogHelper . instance . log . Info ( $"更新{taskName}状态失败>>" + result . msg ) ;
}
}
}
}
}
}
else
else
{
{
@ -782,7 +822,7 @@ namespace XGLFinishPro.Views
string apiUrl = formingMachineService . GetInterfaceUrl ( "machineRepair" ) ;
string apiUrl = formingMachineService . GetInterfaceUrl ( "machineRepair" ) ;
MachineRepairWin machineRepairWin = new MachineRepairWin ( apiUrl ) ;
MachineRepairWin machineRepairWin = new MachineRepairWin ( apiUrl ) ;
machineRepairWin . ShowDialog ( ) ;
machineRepairWin . ShowDialog ( ) ;
}
}
private void btnSalaryCal_Click ( object sender , RoutedEventArgs e )
private void btnSalaryCal_Click ( object sender , RoutedEventArgs e )
@ -811,7 +851,7 @@ namespace XGLFinishPro.Views
string workOrderCode = selectedRow [ "workorder_code" ] . ToString ( ) ;
string workOrderCode = selectedRow [ "workorder_code" ] . ToString ( ) ;
string sapWorkOrderCode = selectedRow [ "workorder_code_sap" ] . ToString ( ) ;
string sapWorkOrderCode = selectedRow [ "workorder_code_sap" ] . ToString ( ) ;
PieceSalaryCalWin pieceSalaryCalWin = new PieceSalaryCalWin ( prodCode , prodName , deviceCode , workOrderCode , sapWorkOrderCode ) ;
PieceSalaryCalWin pieceSalaryCalWin = new PieceSalaryCalWin ( prodCode , prodName , deviceCode , workOrderCode , sapWorkOrderCode ) ;
pieceSalaryCalWin . ShowDialog ( ) ;
pieceSalaryCalWin . ShowDialog ( ) ;
}
}
}
}