|
|
|
|
@ -1,15 +1,18 @@
|
|
|
|
|
using CentralControl.BaseData;
|
|
|
|
|
using CommonFunc;
|
|
|
|
|
using CommonFunc.Tools;
|
|
|
|
|
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;
|
|
|
|
|
@ -21,6 +24,7 @@ namespace XGLFinishPro.Views
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class LanJu_Prepare : UserControl
|
|
|
|
|
{
|
|
|
|
|
FormingMachineService formingMachineService = new FormingMachineService();
|
|
|
|
|
Timer timerDeciveState = new Timer();
|
|
|
|
|
string deviceCode = Utils.GetAppSetting("DeviceCode");
|
|
|
|
|
|
|
|
|
|
@ -34,8 +38,8 @@ namespace XGLFinishPro.Views
|
|
|
|
|
FinishProdDBService userDbWareHouse = new FinishProdDBService();
|
|
|
|
|
WorkOrder list_modelWareHouse = new WorkOrder();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string messageOrderCode = "";
|
|
|
|
|
DataTable dt;
|
|
|
|
|
List<BaseEquipment> eqment;
|
|
|
|
|
@ -50,11 +54,11 @@ namespace XGLFinishPro.Views
|
|
|
|
|
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);
|
|
|
|
|
dt = userDbWareHouse.GetWetPlanInfo(deviceCode, date);
|
|
|
|
|
//eqment = userDbWareHouse.GeteqmentInfo();
|
|
|
|
|
if (dt == null)
|
|
|
|
|
{
|
|
|
|
|
@ -97,7 +101,7 @@ namespace XGLFinishPro.Views
|
|
|
|
|
// // modelWareHouse.Add(list_modelWareHouse);
|
|
|
|
|
// LogHelper.instance.log.Info(wet.prod_line_code);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
@ -159,20 +163,20 @@ namespace XGLFinishPro.Views
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (Utils.isAnyBodyPerating) return;
|
|
|
|
|
List<WetMaterialModel> wetList = new List<WetMaterialModel>();
|
|
|
|
|
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();
|
|
|
|
|
date = this.dateStart.SelectedDate.ToString() == "" ? DateTime.Now.ToString() : this.dateStart.SelectedDate.ToString();
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
System.Windows.Threading.DispatcherPriority.Render);
|
|
|
|
|
|
|
|
|
|
dt = userDbWareHouse.GetWetPlanInfo(deviceCode,date);
|
|
|
|
|
|
|
|
|
|
dt = userDbWareHouse.GetWetPlanInfo(deviceCode, date);
|
|
|
|
|
if (dt == null) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (wetList != null)
|
|
|
|
|
{
|
|
|
|
|
//使用Dispatcher来在UI线程上更新UI
|
|
|
|
|
@ -195,21 +199,22 @@ namespace XGLFinishPro.Views
|
|
|
|
|
|
|
|
|
|
private async void btnStartOrders_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
CheckUserWin checkUserWin = new CheckUserWin();
|
|
|
|
|
checkUserWin.ShowDialog();
|
|
|
|
|
if (!checkUserWin.loginFlag)
|
|
|
|
|
{
|
|
|
|
|
CustomMessageBox.Show("请先校验用户!",CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//陈恒杰在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("请选择要开始的工单!", CustomMessageBoxIcon.Warning);
|
|
|
|
|
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"))
|
|
|
|
|
@ -218,7 +223,7 @@ namespace XGLFinishPro.Views
|
|
|
|
|
{
|
|
|
|
|
CustomMessageBox.Show("该工单不符合条件,请选择其他的工单!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var selectedRow = (WorkOrder.SelectedItem as DataRowView);
|
|
|
|
|
|
|
|
|
|
@ -239,12 +244,13 @@ namespace XGLFinishPro.Views
|
|
|
|
|
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);
|
|
|
|
|
userDbWareHouse.InsertOperationLog(workorderID, "w2", "", "开始工单", deviceCode, materialCode, materialDesc);
|
|
|
|
|
await CallCheckApi("checkTypeSCXJ");
|
|
|
|
|
GetWorkOrder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -347,10 +353,69 @@ namespace XGLFinishPro.Views
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
//更新工单状态
|
|
|
|
|
var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID,deviceCode);
|
|
|
|
|
var updatestatus = userDbWareHouse.UpdateSycnFlag(workorderID, deviceCode);
|
|
|
|
|
if (!updatestatus)
|
|
|
|
|
{
|
|
|
|
|
CustomMessageBox.Show("开始工单失败!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
|
|
|
|
|
@ -365,7 +430,7 @@ namespace XGLFinishPro.Views
|
|
|
|
|
UpdateOrderStatus(subOrder["workorder_code"].ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -432,9 +497,9 @@ namespace XGLFinishPro.Views
|
|
|
|
|
dt = userDbWareHouse.GetMaterialInfo(processid);
|
|
|
|
|
LanJu_Material sopInfoWin = new LanJu_Material(dt);
|
|
|
|
|
sopInfoWin.ShowDialog();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnRefresh_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
@ -452,7 +517,7 @@ namespace XGLFinishPro.Views
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void WorkOrder_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var selectedRow = (WorkOrder.SelectedItem as DataRowView);//WorkOrder.SelectedItem as WetMaterialModel;
|
|
|
|
|
@ -466,11 +531,11 @@ namespace XGLFinishPro.Views
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.dgMaterialInfo.ItemsSource = dt.DefaultView;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
CustomMessageBox.Show(ex.Message,CustomMessageBoxButton.OK,CustomMessageBoxIcon.Error);
|
|
|
|
|
CustomMessageBox.Show(ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
|
|
|
|
|
LogHelper.instance.log.Error("获取工单齐套信息时发生异常:" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|