You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

245 lines
8.5 KiB
C#

using CentralControl.DBDAO;
using CommonFunc;
2 years ago
using CommonFunc.Tools;
using COSMO.IM.LanJu.Index;
2 years ago
using System;
using System.Collections.Generic;
2 years ago
using System.Data;
2 years ago
using System.Linq;
using System.Reflection;
2 years ago
using System.Text;
2 years ago
using System.Threading.Tasks;
2 years ago
using System.Timers;
2 years ago
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
2 years ago
using XGL.Data.DBService;
using XGL.Models.Model.FoamingMac;
2 years ago
namespace XGL.Views
{
/// <summary>
/// LanJu_Operator.xaml 的交互逻辑
/// </summary>
public partial class LanJu_Operator : UserControl
{
2 years ago
FormingMachineService formingMachineService = new FormingMachineService();
DBService userDbWareHouse = new DBService();
2 years ago
public static LanJu_Operator lanJu_Operator;
Frame frame = new Frame() { Content = new Views.LanJu_InOut()};
2 years ago
string deviceCode = Utils.GetAppSetting("DeviceCode");
2 years ago
2 years ago
public enum WindowID
{
frame
}
public LanJu_Operator()
{
InitializeComponent();
WindowChange(WindowID.frame);
2 years ago
}
2 years ago
public void WindowChange(WindowID windowID)
{
Window1.Content = frame;
}
private void InOut_Click(object sender, RoutedEventArgs e)
{
LanJu_InOut lanJu_InOut = new LanJu_InOut();
Window1.Content = new Frame
{
Content = lanJu_InOut
};
}
private void Complete_Click(object sender, RoutedEventArgs e)
{
LanJu_Complete lanJu_Complete = new LanJu_Complete();
Window1.Content = new Frame
{
Content = lanJu_Complete
};
}
private void DeviceItems_Click(object sender, RoutedEventArgs e)
{
LanJu_DeviceItems lanJu_DeviceItems = new LanJu_DeviceItems();
Window1.Content = new Frame
{
Content = lanJu_DeviceItems
};
}
private void Paused_Click(object sender, RoutedEventArgs e)
{
LanJu_Paused lanJu_Paused = new LanJu_Paused();
Window1.Content= new Frame
{
Content = lanJu_Paused
};
}
2 years ago
private void UCOperator_Loaded(object sender, RoutedEventArgs e)
{
GetWorkOrderInfo();
}
2 years ago
2 years ago
private void GetWorkOrderInfo()
{
try
{
2 years ago
List<FoamingMacModel> orderList = new List<FoamingMacModel>();
2 years ago
2 years ago
//modelWareHouse = new List<WorkOrder>();
2 years ago
userDbWareHouse = new DBService();
2 years ago
DataTable dt = formingMachineService.GetFormingMachineInfo(deviceCode);
2 years ago
if (dt == null) return;
foreach (DataRow i in dt.Rows)
2 years ago
{
FoamingMacModel order = new FoamingMacModel();
order.workorder_id = i["workorder_id"].ToString();
2 years ago
order.workorder_code = i["workorder_code"].ToString();
order.product_name = i["product_name"].ToString();
2 years ago
2 years ago
order.product_code = i["product_code"].ToString();
order.car_num = Convert.ToInt32(i["car_num"].ToString());
order.plan_time = Convert.ToDateTime(i["plan_time"].ToString());
2 years ago
order.status = i["status"].ToString();
order.process_id = i["route_code"].ToString();
2 years ago
order.attr1 = i["attr1"].ToString();
order.totalCount = i["totalCount"].ToString();
2 years ago
orderList.Add(order);
2 years ago
2 years ago
}
2 years ago
this.dgWorkOrderInfo.ItemsSource = null;
2 years ago
this.dgWorkOrderInfo.ItemsSource = orderList;//dt.DefaultView;
2 years ago
}
catch (Exception ex)
{
LogHelper.instance.log.Error("获取工单准备信息时发生异常:" + ex.Message);
}
}
private void dgWorkOrderInfo_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}
2 years ago
private void btnPause_Click(object sender, RoutedEventArgs e)
{
var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
2 years ago
if (selectedRow == null)
{
MessageBox.Show("请选择你要暂停的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
MessageBoxResult result = MessageBox.Show("你确定要暂停该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
if (result == MessageBoxResult.No)
return;
2 years ago
var workordercode = selectedRow.workorder_code;
string currStatus = selectedRow.status;
if(currStatus!="w2")
{
MessageBox.Show("只有活动中的工单才支持暂停!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
formingMachineService.UpdateWorkOrder(workordercode,"w4");
2 years ago
GetWorkOrderInfo();
}
2 years ago
private void btnRecover_Click(object sender, RoutedEventArgs e)
2 years ago
{
var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
if (selectedRow == null)
{
MessageBox.Show("请选择你要恢复的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
MessageBoxResult result = MessageBox.Show("你确定要恢复该工单吗?", "温馨提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
if (result == MessageBoxResult.No)
return;
var workordercode = selectedRow.workorder_code;
formingMachineService.UpdateWorkOrder(workordercode, "w2");
GetWorkOrderInfo();
2 years ago
}
/// <summary>
/// 查看工艺
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Flow_Click(object sender, RoutedEventArgs e)
{
var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
2 years ago
if (selectedRow == null) return;
var workordercode = selectedRow.workorder_code;
DataTable dt = userDbWareHouse.GetFlowInfo(workordercode);
FlowInfoWin flowInfoWin = new FlowInfoWin(dt);
flowInfoWin.ShowDialog();
}
/// <summary>
/// 查看物料
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Material_Click(object sender, RoutedEventArgs e)
{
var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
2 years ago
if (selectedRow == null) return;
var processid = selectedRow.workorder_code;
DataTable dt = userDbWareHouse.GetMaterialInfo(processid);
LanJu_Material sopInfoWin = new LanJu_Material(dt);
sopInfoWin.ShowDialog();
}
/// <summary>
/// 查看SOP
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Button_Click(object sender, RoutedEventArgs e)
{
var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
2 years ago
if (selectedRow == null) return;
var workordercode = selectedRow.workorder_code;
DataTable dt = userDbWareHouse.GetSOPInfo(workordercode);
SopInfoWin sopInfoWin = new SopInfoWin(dt);
sopInfoWin.ShowDialog();
2 years ago
}
private void btnRefresh_Click(object sender, RoutedEventArgs e)
{
GetWorkOrderInfo();
}
private void btnComplete_Click(object sender, RoutedEventArgs e)
{
if (dgWorkOrderInfo.SelectedItems.Count == 0)
{
CustomMessageBox.Show("请选择要完成的数据", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
var selectedRow = dgWorkOrderInfo.SelectedItem as FoamingMacModel;
ShouPeiWin shouPeiWin = new ShouPeiWin(selectedRow);
shouPeiWin.ShowDialog();
}
2 years ago
}
}