|
|
using CentralControl.BaseData;
|
|
|
using CommonFunc;
|
|
|
using CommonFunc.Tools;
|
|
|
using HandyControl.Tools.Extension;
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Timers;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Input;
|
|
|
using System.Windows.Media;
|
|
|
using XGL.Data.DBService;
|
|
|
using XGL.Dats.DBServiceFinishProd;
|
|
|
using XGL.Models.Model.OrderPrepare;
|
|
|
using XGL.Thrift;
|
|
|
|
|
|
namespace XGLFinishPro.Views
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// LanJu_Prepare.xaml 的交互逻辑
|
|
|
/// </summary>
|
|
|
public partial class LanJu_Prepare : UserControl
|
|
|
{
|
|
|
FormingMachineService formingMachineService = new FormingMachineService();
|
|
|
Timer timerDeciveState = new Timer();
|
|
|
string deviceCode = Utils.GetAppSetting("DeviceCode");
|
|
|
|
|
|
public LanJu_Prepare()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
List<WorkOrder> modelWareHouse = new List<WorkOrder>();
|
|
|
FinishProdDBService userDbWareHouse = new FinishProdDBService();
|
|
|
WorkOrder list_modelWareHouse = new WorkOrder();
|
|
|
|
|
|
|
|
|
|
|
|
string messageOrderCode = "";
|
|
|
DataTable dt;
|
|
|
List<BaseEquipment> eqment;
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 获取主页显示订单
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
private void GetWorkOrder()
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
List<WetMaterialModel> wetList = new List<WetMaterialModel>();
|
|
|
|
|
|
//modelWareHouse = new List<WorkOrder>();
|
|
|
//userDbWareHouse = new DBService();
|
|
|
string date = this.dateStart.SelectedDate.ToString() == "" ? DateTime.Now.ToString() : this.dateStart.SelectedDate.ToString();
|
|
|
dt = userDbWareHouse.GetWetPlanInfo(deviceCode, date);
|
|
|
//eqment = userDbWareHouse.GeteqmentInfo();
|
|
|
if (dt == null)
|
|
|
{
|
|
|
this.WorkOrder.ItemsSource = null;
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.WorkOrder.ItemsSource = null;
|
|
|
this.WorkOrder.ItemsSource = dt.DefaultView;
|
|
|
}
|
|
|
//foreach (DataRow i in dt.Rows)
|
|
|
//{
|
|
|
// WetMaterialModel wet = new WetMaterialModel();
|
|
|
// wet.id = i["id"].ToString();
|
|
|
// wet.workorder_id = i["workorder_id"].ToString();
|
|
|
// wet.workorder_code = i["workorder_code"].ToString();
|
|
|
// wet.product_name = i["product_name"].ToString();
|
|
|
|
|
|
// wet.material_code = i["material_code"].ToString();
|
|
|
// wet.material_name = i["material_name"].ToString();
|
|
|
// wet.plan_time = Convert.ToDateTime(i["plan_time"].ToString());
|
|
|
// wet.bucket_code = i["bucket_code"].ToString();
|
|
|
// wet.shift_desc = i["shift_desc"].ToString();
|
|
|
// var inneconde= ExtractAndSort(i["prod_line_code"].ToString());
|
|
|
// foreach (var item in inneconde)
|
|
|
// {
|
|
|
// wet.prod_line_code += "[" + eqment.Find(c=>c.EquipmentCode== item).EquipmentName + "],";
|
|
|
// }
|
|
|
// wet.status = i["status"].ToString();
|
|
|
// wet.sync_flag = i["sync_flag"].ToString();
|
|
|
// wet.processid = i["route_code"].ToString();
|
|
|
// wetList.Add(wet);
|
|
|
// // list_modelWareHouse.WorkOrderCode = i["WorkOrderCode"].ToString();
|
|
|
// // list_modelWareHouse.OrderCode = i["OrderCode"].ToString();
|
|
|
// // list_modelWareHouse.ProductName = i["ProductName"].ToString();
|
|
|
// // list_modelWareHouse.ProductSpc = i["ProductSpc"].ToString();
|
|
|
// // list_modelWareHouse.QuantitySplit = i["QuantitySplit"].ToString();
|
|
|
// // list_modelWareHouse.BatchCode = i["BatchCode"].ToString();
|
|
|
// // modelWareHouse.Add(list_modelWareHouse);
|
|
|
// LogHelper.instance.log.Info(wet.prod_line_code);
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
LogHelper.instance.log.Error("获取成品工单准备信息时发生异常:" + ex.Message);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<string> ExtractAndSort(string input)
|
|
|
{
|
|
|
List<string> extractedData = new List<string>();
|
|
|
|
|
|
JArray jsonArray = JArray.Parse(input);
|
|
|
|
|
|
foreach (JArray subArray in jsonArray)
|
|
|
{
|
|
|
if (subArray.Count == 2)
|
|
|
{
|
|
|
string process = subArray[0].Value<string>();
|
|
|
string value = subArray[1].Value<string>();
|
|
|
|
|
|
if (process.StartsWith("GX-") && !process.Equals("GX-01"))
|
|
|
{
|
|
|
extractedData.Add(value);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return extractedData;
|
|
|
}
|
|
|
private T FindParent<T>(DependencyObject child) where T : DependencyObject
|
|
|
{
|
|
|
DependencyObject parent = VisualTreeHelper.GetParent(child);
|
|
|
|
|
|
if (parent is T)
|
|
|
{
|
|
|
return (T)parent;
|
|
|
}
|
|
|
|
|
|
if (parent != null)
|
|
|
{
|
|
|
return FindParent<T>(parent);
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
this.dateStart.SelectedDate = Convert.ToDateTime(LoginUser.WorkDate);//DateTime.Now;
|
|
|
timerDeciveState.Interval = Utils.GetAppSetting("GetDeviceStateInterval") == "" ? 15000 : Convert.ToInt32(Utils.GetAppSetting("GetDeviceStateInterval"));
|
|
|
timerDeciveState.Elapsed += TimerDeciveState_Elapsed;
|
|
|
//timerDeciveState.Start();
|
|
|
GetWorkOrder();
|
|
|
}
|
|
|
|
|
|
private void TimerDeciveState_Elapsed(object sender, ElapsedEventArgs e)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (Utils.isAnyBodyPerating) return;
|
|
|
List<WetMaterialModel> wetList = new List<WetMaterialModel>();
|
|
|
string date = "";
|
|
|
//使用Dispatcher来在UI线程上更新UI
|
|
|
this.Dispatcher.Invoke(
|
|
|
new Action(() =>
|
|
|
{
|
|
|
date = this.dateStart.SelectedDate.ToString() == "" ? DateTime.Now.ToString() : this.dateStart.SelectedDate.ToString();
|
|
|
}
|
|
|
),
|
|
|
System.Windows.Threading.DispatcherPriority.Render);
|
|
|
|
|
|
dt = userDbWareHouse.GetWetPlanInfo(deviceCode, date);
|
|
|
if (dt == null) return;
|
|
|
|
|
|
if (wetList != null)
|
|
|
{
|
|
|
//使用Dispatcher来在UI线程上更新UI
|
|
|
this.Dispatcher.Invoke(
|
|
|
new Action(() =>
|
|
|
{
|
|
|
this.WorkOrder.ItemsSource = null;
|
|
|
this.WorkOrder.ItemsSource = dt.DefaultView;
|
|
|
}
|
|
|
),
|
|
|
System.Windows.Threading.DispatcherPriority.Render);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
LogHelper.instance.log.Error("获取工单准备信息时发生异常:" + ex.Message);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private async void btnStartOrders_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
//陈恒杰在2024-01-07日与榄菊的苏振华确认,不需要用户验证
|
|
|
//CheckUserWin checkUserWin = new CheckUserWin();
|
|
|
//checkUserWin.ShowDialog();
|
|
|
//if (!checkUserWin.loginFlag)
|
|
|
//{
|
|
|
// CustomMessageBox.Show("请先校验用户!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
// return;
|
|
|
//}
|
|
|
if (WorkOrder.SelectedItems.Count == 0)
|
|
|
{
|
|
|
CustomMessageBox.Show("请选择要开始的工单!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
string workorderID = (WorkOrder.SelectedItem as DataRowView)["workorder_code"].ToString();
|
|
|
|
|
|
string status = (WorkOrder.SelectedItem as DataRowView)["status"].ToString();
|
|
|
|
|
|
if (!status.Equals("w1"))
|
|
|
{
|
|
|
if (status != "")
|
|
|
{
|
|
|
CustomMessageBox.Show("该工单不符合条件,请选择其他的工单!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
var selectedRow = (WorkOrder.SelectedItem as DataRowView);
|
|
|
|
|
|
//获取WMS齐套率,湿料计划先不用
|
|
|
//var wmsState = userDbWareHouse.GetWorkOrderQitaoLv(orderID);
|
|
|
//if (wmsState == null || wmsState.Rows[0][0].Equals("0"))
|
|
|
//{
|
|
|
// CustomMessageBox.Show("该工单未准备好,请稍后再试!", CustomMessageBoxIcon.Warning);
|
|
|
// return;
|
|
|
//}
|
|
|
|
|
|
//获取湿料计划指定的成型机
|
|
|
//var cxjDt = userDbWareHouse.GetCXJList(orderID);
|
|
|
|
|
|
|
|
|
//更新工单状态
|
|
|
//var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID);
|
|
|
if (!UpdateOrderStatus(workorderID))
|
|
|
{
|
|
|
CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
string materialCode = selectedRow["product_code"].ToString();
|
|
|
string materialDesc = selectedRow["product_name"].ToString();
|
|
|
userDbWareHouse.InsertOperationLog(workorderID, "w2", "", "开始工单", deviceCode, materialCode, materialDesc);
|
|
|
await CallCheckApi("checkTypeSCXJ");
|
|
|
GetWorkOrder();
|
|
|
}
|
|
|
|
|
|
#region MyRegion
|
|
|
//DataTable cxjDt = null;
|
|
|
////根据工单获取成型机
|
|
|
//cxjDt = userDbWareHouse.GetCXJList(workorderID);// 在此处执行数据库查询
|
|
|
|
|
|
//if (cxjDt == null || cxjDt.Rows.Count == 0)
|
|
|
//{
|
|
|
// CustomMessageBox.Show("该工单未指定料罐、成型机,请稍后再试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
// return;
|
|
|
//}
|
|
|
//List<string> cxjList = new List<string>();
|
|
|
//List<string> bucketList = new List<string>();
|
|
|
////这扯淡的设计,根据湿料计划获取各个工单对应的工序、机台信息,这样式的,[["GX01","C1"],["GX01","C5"],["GX01","C3"],["GX01","C6"],["GX01","C8"],["GX02","H2"],["GX02","H3"],["GX02","H4"],["GX02","H5"],["GX02","H6"],["GX03","X3"],["GX03","X6"]]
|
|
|
//for (int i = 0; i < cxjDt.Rows.Count; i++)
|
|
|
//{
|
|
|
// string jsonStrCXJList = cxjDt.Rows[i][0].ToString();
|
|
|
// string bucketNo = cxjDt.Rows[i][1].ToString();
|
|
|
// bucketList.Add(bucketNo);
|
|
|
// // 解析JSON字符串为嵌套的列表结构
|
|
|
// List<List<string>> data = JsonConvert.DeserializeObject<List<List<string>>>(jsonStrCXJList);
|
|
|
|
|
|
|
|
|
// // 输出嵌套列表的值
|
|
|
// foreach (var innerList in data)
|
|
|
// {
|
|
|
|
|
|
// if (innerList[1].Contains("C"))
|
|
|
// {
|
|
|
// //记录成型机列表
|
|
|
// cxjList.Add(innerList[1]);
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
//}
|
|
|
//cxjList = cxjList.Distinct().ToList();//去重
|
|
|
//bucketList = bucketList.Distinct().ToList();
|
|
|
////var jsonObject = JsonConvert.DeserializeObject(jsonStrCXJList);
|
|
|
|
|
|
//string apiUrl = Utils.GetAppSetting("WCSMaterialSyncAddress") == "" ? "http://192.168.202.28:9001/api/v1/ReceiveMesMsg/materialPlanSync" : Utils.GetAppSetting("WCSMaterialSyncAddress");
|
|
|
|
|
|
|
|
|
//MaterialPlanModel materialPlanModel = new MaterialPlanModel();
|
|
|
|
|
|
//List<WetMaterialModel> listWetMaterial = Utils.ToDataList<WetMaterialModel>(dt);
|
|
|
|
|
|
//List<skuInfo> skuInfoList = new List<skuInfo>();
|
|
|
|
|
|
//materialPlanModel.reqCode = CommonFunc.Common.GetUUID();
|
|
|
//materialPlanModel.reqTime = DateTime.Now.ToString();
|
|
|
//materialPlanModel.factory = Utils.GetAppSetting("SiteCode");
|
|
|
//materialPlanModel.planNo = workorderID;
|
|
|
|
|
|
|
|
|
//foreach (var item in bucketList)
|
|
|
//{
|
|
|
// skuInfo sku = new skuInfo();
|
|
|
// sku.sku = material;
|
|
|
// sku.loadNo = item;
|
|
|
|
|
|
// List<unloadNoInfo> unloadNoInfoList = new List<unloadNoInfo>();
|
|
|
// foreach (var buckt in cxjList)
|
|
|
// {
|
|
|
// unloadNoInfo unloadNoInfo = new unloadNoInfo();
|
|
|
// unloadNoInfo.unloadNo = buckt;
|
|
|
// unloadNoInfoList.Add(unloadNoInfo);
|
|
|
// }
|
|
|
// sku.unLoadItems = unloadNoInfoList;
|
|
|
// skuInfoList.Add(sku);
|
|
|
//}
|
|
|
|
|
|
//materialPlanModel.data = skuInfoList;
|
|
|
|
|
|
//// 将要发送的数据序列化为JSON格式
|
|
|
//var jsonContent = JsonConvert.SerializeObject(materialPlanModel);
|
|
|
//LogHelper.instance.log.Info("给WCS同步计划>>" + jsonContent);
|
|
|
//RestHelper restClient = new RestHelper();
|
|
|
//var response = await restClient.PostAsync(apiUrl, jsonContent);
|
|
|
|
|
|
//WcsSyncResult result = Utils.DeJson<WcsSyncResult>(response);
|
|
|
////Console.WriteLine(response);
|
|
|
//if (result.message.ToLower().Equals("ok"))
|
|
|
//{
|
|
|
// //更新湿料计划同步状态
|
|
|
// var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID);
|
|
|
// if (!updatestatus)
|
|
|
// LogHelper.instance.log.Info("更新湿料计划同步状态失败!");
|
|
|
// else
|
|
|
// {
|
|
|
// GetWorkOrder();
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
//}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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)
|
|
|
{
|
|
|
string name = LoginUser.UserName + "-" + LoginUser.UserCode;
|
|
|
if (name.IsNullOrEmpty())
|
|
|
{
|
|
|
name = "无-0";
|
|
|
}
|
|
|
//更新工单状态
|
|
|
var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID, deviceCode, name);
|
|
|
if (!updatestatus)
|
|
|
{
|
|
|
CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
return false;
|
|
|
}
|
|
|
DataTable dtSubOrders = userDbWareHouse.GetSubOrderInfo(workorderID);
|
|
|
if (dtSubOrders != null)
|
|
|
{
|
|
|
// 递归更新子单状态
|
|
|
foreach (DataRow subOrder in dtSubOrders.Rows)
|
|
|
{
|
|
|
UpdateOrderStatus(subOrder["workorder_code"].ToString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
|
|
|
private void Flow_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
int index = 0;
|
|
|
Button flowButton = (Button)sender;
|
|
|
DataGridRow row = FindParent<DataGridRow>(flowButton);
|
|
|
|
|
|
if (row != null)
|
|
|
{
|
|
|
// 获取对应行的数据项对象
|
|
|
var rowDataItem = row.Item;
|
|
|
// 获取行号
|
|
|
index = row.GetIndex();
|
|
|
}
|
|
|
|
|
|
var selectedRow = (WorkOrder.Items[index] as DataRowView);//WorkOrder.Items[index] as WetMaterialModel;
|
|
|
var workordercode = selectedRow["workorder_code"].ToString();
|
|
|
dt = userDbWareHouse.GetFlowInfo(workordercode);
|
|
|
FlowInfoWin flowInfoWin = new FlowInfoWin(dt);
|
|
|
flowInfoWin.ShowDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void SOP_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
int index = 0;
|
|
|
Button sopButton = (Button)sender;
|
|
|
DataGridRow row = FindParent<DataGridRow>(sopButton);
|
|
|
|
|
|
if (row != null)
|
|
|
{
|
|
|
// 获取对应行的数据项对象
|
|
|
var rowDataItem = row.Item;
|
|
|
// 获取行号
|
|
|
index = row.GetIndex();
|
|
|
}
|
|
|
|
|
|
var selectedRow = (WorkOrder.Items[index] as DataRowView);//WorkOrder.Items[index] as WetMaterialModel;
|
|
|
var processid = selectedRow["route_code"].ToString();
|
|
|
dt = userDbWareHouse.GetSOPInfo(processid);
|
|
|
SopInfoWin sopInfoWin = new SopInfoWin(dt);
|
|
|
sopInfoWin.ShowDialog();
|
|
|
}
|
|
|
|
|
|
private void Material_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
int index = 0;
|
|
|
Button sopButton = (Button)sender;
|
|
|
DataGridRow row = FindParent<DataGridRow>(sopButton);
|
|
|
|
|
|
if (row != null)
|
|
|
{
|
|
|
// 获取对应行的数据项对象
|
|
|
var rowDataItem = row.Item;
|
|
|
// 获取行号
|
|
|
index = row.GetIndex();
|
|
|
}
|
|
|
|
|
|
var selectedRow = (WorkOrder.Items[index] as DataRowView);//WorkOrder.Items[index] as WetMaterialModel;
|
|
|
var processid = selectedRow["workorder_code"].ToString();
|
|
|
dt = userDbWareHouse.GetMaterialInfo(processid);
|
|
|
LanJu_Material sopInfoWin = new LanJu_Material(dt);
|
|
|
sopInfoWin.ShowDialog();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
private void btnRefresh_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
GetWorkOrder();
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 增加序号
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
private void USERLIST_LoadingRow(object sender, DataGridRowEventArgs e)
|
|
|
{
|
|
|
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
|
|
|
}
|
|
|
|
|
|
private void WorkOrder_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
var selectedRow = (WorkOrder.SelectedItem as DataRowView);//WorkOrder.SelectedItem as WetMaterialModel;
|
|
|
if (selectedRow == null) return;
|
|
|
var processid = selectedRow["workorder_code"].ToString();
|
|
|
DataTable dt = userDbWareHouse.GetQitaolvInfo(processid);
|
|
|
if (dt == null)
|
|
|
{
|
|
|
this.dgMaterialInfo.ItemsSource = null;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.dgMaterialInfo.ItemsSource = dt.DefaultView;
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
CustomMessageBox.Show(ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
|
|
|
LogHelper.instance.log.Error("获取工单齐套信息时发生异常:" + ex.Message);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void dgMaterialInfo_LoadingRow(object sender, DataGridRowEventArgs e)
|
|
|
{
|
|
|
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
|
|
|
}
|
|
|
|
|
|
private void Button_MouseEnter(object sender, MouseEventArgs e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|