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.

140 lines
5.3 KiB
C#

2 years ago
using CentralControl.DBDAO;
2 years ago
using CommonFunc.Tools;
2 years ago
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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.Models.Model.OrderPrepare;
2 years ago
using XGL.Thrift;
namespace XGL.Views
{
/// <summary>
/// LanJu_Prepare.xaml 的交互逻辑
/// </summary>
public partial class LanJu_Prepare : UserControl
{
public LanJu_Prepare()
{
InitializeComponent();
2 years ago
2 years ago
}
2 years ago
List<WorkOrder> modelWareHouse = new List<WorkOrder>();
DBService userDbWareHouse = new DBService();
WorkOrder list_modelWareHouse = new WorkOrder();
2 years ago
2 years ago
List<WetMaterialModel> wetList = new List<WetMaterialModel>();
WetMaterialModel wet = new WetMaterialModel();
string messageOrderCode = "";
2 years ago
DataTable dt;
2 years ago
/// <summary>
/// <summary>
/// 获取主页显示订单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GetWorkOrder()
{
try
{
2 years ago
//modelWareHouse = new List<WorkOrder>();
//userDbWareHouse = new DBService();
2 years ago
dt = userDbWareHouse.GetWetPlanInfo();
foreach (DataRow i in dt.Rows)
2 years ago
{
2 years ago
wet.id = i["id"].ToString();
wet.workorder_id = i["workorder_id"].ToString();
wet.product_name = i["product_name"].ToString();
wet.material_code = i["material_code"].ToString();
wet.plan_time = Convert.ToDateTime(i["plan_time"].ToString());
wet.bucket_code = i["bucket_code"].ToString();
wet.shift_desc = i["shift_desc"].ToString();
2 years ago
wet.prod_line_code = i["prod_line_code"].ToString();
2 years ago
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);
2 years ago
}
this.WorkOrder.ItemsSource = modelWareHouse;
}
catch (Exception ex)
{
}
}
private void Flow_Click(object sender, RoutedEventArgs e)
{
var selectedRow = WorkOrder.SelectedItem as WorkOrder;
var workordercode = selectedRow.WorkOrderCode;
}
2 years ago
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
GetWorkOrder();
}
private void btnStartOrders_Click(object sender, RoutedEventArgs e)
{
2 years ago
if (WorkOrder.SelectedItems.Count == 0)
{
CustomMessageBox.Show("请选择要开始的工单!", CustomMessageBoxIcon.Warning);
return;
}
string orderID = (WorkOrder.SelectedItem as WetMaterialModel).id;
var wmsState = userDbWareHouse.GetWorkOrderQitaoLv(orderID);
2 years ago
if (wmsState == null || wmsState.Rows[0][0].Equals("0"))
{
CustomMessageBox.Show("该工单未准备好,请稍后再试!", CustomMessageBoxIcon.Warning);
return;
}
2 years ago
2 years ago
string apiUrl = "http://example.com/api/endpoint";
2 years ago
string jsonContent = "{\"key1\":\"value1\",\"key2\":\"value2\"}";
MaterialPlanModel materialPlanModel = new MaterialPlanModel();
2 years ago
skuInfo sku = new skuInfo();
List<WetMaterialModel> listWetMaterial = Utils.ToDataList<WetMaterialModel>(dt);
List<unloadNoInfo> unloadNoInfoList = new List<unloadNoInfo>();
//根据湿料计划、成型机分组
var listChengXingji = listWetMaterial.GroupBy(a => new { a.id,a.prod_line_code});
var list = listWetMaterial.GroupBy(a=>a.prod_line_code);
foreach (var item in listChengXingji)
{
unloadNoInfo unloadNoInfo = new unloadNoInfo();
unloadNoInfo.unloadNo = (WorkOrder.SelectedItem as WetMaterialModel).bucket_code;
unloadNoInfoList.Add(unloadNoInfo);
}
materialPlanModel.reqCode = CommonFunc.Common.GetUUID();
materialPlanModel.reqTime = DateTime.Now.ToString();
materialPlanModel.planNo = orderID;
sku.sku = "";
sku.loadNo = "";
2 years ago
RestHelper restClient = new RestHelper();
var response = restClient.PostAsync(apiUrl, jsonContent);
Console.WriteLine(response);
}
2 years ago
}
}