@ -503,6 +503,7 @@ namespace XGLFinishPro.Views
}
}
if ( ! selectedRow [ "status" ] . ToString ( ) . Equals ( "w2" ) & & ! selectedRow [ "status" ] . ToString ( ) . Equals ( "w4" ) )
if ( ! selectedRow [ "status" ] . ToString ( ) . Equals ( "w2" ) & & ! selectedRow [ "status" ] . ToString ( ) . Equals ( "w4" ) )
{
{
LogHelper . instance . log . Info ( "当前选择的工单" + ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "workorder_code" ] . ToString ( ) + "状态为:" + selectedRow [ "status" ] . ToString ( ) ) ;
string status = selectedRow [ "status" ] . ToString ( ) ;
string status = selectedRow [ "status" ] . ToString ( ) ;
string st = status . Equals ( "w1" ) ? "未派发" : status . Equals ( "w3" ) ? "已报工" : status . Equals ( "w0" ) ? "未派发" : "已暂停" ;
string st = status . Equals ( "w1" ) ? "未派发" : status . Equals ( "w3" ) ? "已报工" : status . Equals ( "w0" ) ? "未派发" : "已暂停" ;
CustomMessageBox . Show ( "你选择的工单不能报工,请检查工单状态,当前工单状态为:" + st , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
CustomMessageBox . Show ( "你选择的工单不能报工,请检查工单状态,当前工单状态为:" + st , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
@ -644,7 +645,7 @@ namespace XGLFinishPro.Views
if ( dgWorkOrderInfo . SelectedItem is DataRowView selectedRow )
if ( dgWorkOrderInfo . SelectedItem is DataRowView selectedRow )
{
{
string rowContent = string . Join ( ", " , selectedRow . Row . ItemArray ) ;
string rowContent = string . Join ( ", " , selectedRow . Row . ItemArray ) ;
LogHelper . instance . log . Info ( " 选择的行内容: " + rowContent ) ;
LogHelper . instance . log . Info ( " 开始工单 选择的行内容: " + rowContent ) ;
}
}
else
else
{
{
@ -652,12 +653,13 @@ namespace XGLFinishPro.Views
}
}
string workorderID = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "workorder_code" ] . ToString ( ) ;
string workorderID = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "workorder_code" ] . ToString ( ) ;
string status = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "status" ] . ToString ( ) ;
string status = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "status" ] . ToString ( ) ;
LogHelper . instance . log . Info ( "记录 工单状态:"+ status + ", 工单号为:"+ workorderID ) ;
LogHelper . instance . log . Info ( "记录 开始 工单状态:"+ status + ", 开始 工单号为:"+ workorderID ) ;
if ( ! status . Equals ( "w1" ) )
if ( ! status . Equals ( "w1" ) )
{
{
if ( status ! = "" )
if ( status ! = "" )
{
{
string st = status . Equals ( "w1" ) ? "未派发" : status . Equals ( "w3" ) ? "已报工" : status . Equals ( "w0" ) ? "未派发" : "已暂停" ;
string st = status . Equals ( "w1" ) ? "未派发" : status . Equals ( "w3" ) ? "已报工" : status . Equals ( "w0" ) ? "未派发" : "已暂停" ;
LogHelper . instance . log . Info ( "该工单不符合条件,请检查工单状态,当前工单状态为:" + st ) ;
CustomMessageBox . Show ( "该工单不符合条件,请检查工单状态,当前工单状态为:" + st , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
CustomMessageBox . Show ( "该工单不符合条件,请检查工单状态,当前工单状态为:" + st , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
return ;
return ;
}
}
@ -670,11 +672,14 @@ namespace XGLFinishPro.Views
if ( orderCount > = 1 )
if ( orderCount > = 1 )
{
{
CustomMessageBox . Show ( "已有活动中的工单,请先报工再开始下一个工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
CustomMessageBox . Show ( "已有活动中的工单,请先报工再开始下一个工单!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
LogHelper . instance . log . Info ( "开始工单:已有活动中的工单,请先报工再开始下一个工单!" ) ;
return ;
return ;
}
}
LogHelper . instance . log . Info ( "查询到当前正在活动的工单数量为" + orderCount ) ;
//更新工单状态
//更新工单状态
if ( ! UpdateOrderStatus ( workorderID ) )
if ( ! UpdateOrderStatus ( workorderID ) )
{
{
LogHelper . instance . log . Info ( "开始工单返回失败" ) ;
CustomMessageBox . Show ( "开始工单失败!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
CustomMessageBox . Show ( "开始工单失败!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
}
}
else
else
@ -705,7 +710,9 @@ namespace XGLFinishPro.Views
private bool UpdateOrderStatus ( string workorderID )
private bool UpdateOrderStatus ( string workorderID )
{
{
string name = LoginUser . UserName + "-" + LoginUser . UserId ;
try
{
string name = LoginUser . UserName + "-" + LoginUser . UserId ;
if ( name . IsNullOrEmpty ( ) )
if ( name . IsNullOrEmpty ( ) )
{
{
name = "无-0" ;
name = "无-0" ;
@ -715,6 +722,12 @@ namespace XGLFinishPro.Views
if ( ! updatestatus )
if ( ! updatestatus )
{
{
CustomMessageBox . Show ( "开始工单失败!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
CustomMessageBox . Show ( "开始工单失败!" , CustomMessageBoxButton . OK , CustomMessageBoxIcon . Warning ) ;
LogHelper . instance . log . Info ( "开始工单失败" ) ;
return false ;
}
else
{
LogHelper . instance . log . Info ( "开始工单正常" ) ;
}
}
DataTable dtSubOrders = userDbWareHouse . GetSubOrderInfo ( workorderID ) ;
DataTable dtSubOrders = userDbWareHouse . GetSubOrderInfo ( workorderID ) ;
if ( dtSubOrders ! = null )
if ( dtSubOrders ! = null )
@ -725,7 +738,11 @@ namespace XGLFinishPro.Views
UpdateOrderStatus ( subOrder [ "workorder_code" ] . ToString ( ) ) ;
UpdateOrderStatus ( subOrder [ "workorder_code" ] . ToString ( ) ) ;
}
}
}
}
}
catch ( Exception ex )
{
LogHelper . instance . log . Info ( "开始工单异常" + ex . Message ) ;
}
return true ;
return true ;
}
}
@ -781,11 +798,10 @@ namespace XGLFinishPro.Views
}
}
}
}
CustomMessageBoxResult result = CustomMessageBox . Show ( "你确定要首检么?", CustomMessageBoxButton . OKCancel , CustomMessageBoxIcon . Warning ) ;
CustomMessageBoxResult result = CustomMessageBox . Show ( $ "你确定要为批次号:{ (dgWorkOrderInfo.SelectedItem as DataRowView)["batch_code "]}进行 首检么?", CustomMessageBoxButton . OKCancel , CustomMessageBoxIcon . Warning ) ;
if ( result = = CustomMessageBoxResult . Cancel )
if ( result = = CustomMessageBoxResult . Cancel )
return ;
return ;
LogHelper . instance . log . Info ( $"首检检验按钮被点击工单号为:{(dgWorkOrderInfo.SelectedItem as DataRowView)[" workorder_code "]},批次号为:{(dgWorkOrderInfo.SelectedItem as DataRowView)[" batch_code "]}" ) ;
//2024-04-16添加不限制首检确认的功能;
//2024-04-16添加不限制首检确认的功能;
//string qcStatus = (dgWorkOrderInfo.SelectedItem as DataRowView)["qc_status"].ToString();
//string qcStatus = (dgWorkOrderInfo.SelectedItem as DataRowView)["qc_status"].ToString();
@ -820,7 +836,6 @@ 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 ( ) ;
@ -829,11 +844,13 @@ namespace XGLFinishPro.Views
if ( checkType . Equals ( "checkTypeSCXJ" ) )
if ( checkType . Equals ( "checkTypeSCXJ" ) )
{
{
taskName = "巡检任务" ;
taskName = "巡检任务" ;
LogHelper . instance . log . Info ( $"准备触发巡检任务{workorderCode}>>批次号为:{batchCode}" ) ;
firstCheck . incomeBatchNo = null ;
firstCheck . incomeBatchNo = null ;
}
}
else
else
{
{
taskName = "首件检验任务" ;
taskName = "首件检验任务" ;
LogHelper . instance . log . Info ( $"准备触发首件检验任务{workorderCode}>>批次号为:{batchCode}" ) ;
firstCheck . incomeBatchNo = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "batch_code" ] . ToString ( ) ;
firstCheck . incomeBatchNo = ( dgWorkOrderInfo . SelectedItem as DataRowView ) [ "batch_code" ] . ToString ( ) ;
}
}