集成打卡功能,修改报修功能

master
zhaojian 2 years ago
parent e9bdecf486
commit 5d84acc2a8

@ -8,7 +8,7 @@
Title="MachineRepairWin" Height="550" Width="900" WindowStartupLocation="CenterScreen" WindowStyle="None" Loaded="Window_Loaded">
<Window.Resources>
<SolidColorBrush x:Key="EvenRowBackground" Color="#E0E0E0"/>
<SolidColorBrush x:Key="OddRowBackground" Color="#FFFFFF"/>
<SolidColorBrush x:Key="OddRowBackground" Color="#FFFFFF"/>
<Style x:Key="ColumnHeaderGripperStyle" TargetType="DataGridColumnHeader"/>
<Style x:Key="DataGridRowStyle" TargetType="DataGridRow">
@ -274,28 +274,26 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column ="0" Orientation="Horizontal" Margin="5">
<TextBlock Text="请输入用户名或者ID" VerticalAlignment="Center"/>
<TextBox x:Name="txtP" Width="120" Height="30" FontSize="18" VerticalAlignment="Center" VerticalContentAlignment="Center" TextChanged="txtP_TextChanged"/>
<TextBlock Text="故障描述" VerticalAlignment="Center"/>
<TextBox x:Name="txtP" Width="309" Height="30" FontSize="18" VerticalAlignment="Center" VerticalContentAlignment="Center" TextChanged="txtP_TextChanged"/>
<Button x:Name="btnQueryUser" Content="查询" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnQueryUser_Click" Visibility="Collapsed"/>
<Button x:Name="btnUserConfirm" Content="确认" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnUserConfirm_Click"/>
<Button x:Name="btnCloseWin" HorizontalAlignment="Right" Content="关闭" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnCloseWin_Click"/>
</StackPanel>
<DataGrid
Grid.Row="1" Grid.Column ="0" Grid.ColumnSpan="2"
Grid.Row="1"
x:Name="dgUserInfo"
MinWidth="400"
MinHeight="260"
RowStyle="{StaticResource DataGridRowStyle}"
Margin="10,0,0,5"
MaxHeight="400"
AlternationCount="2"
FontSize="18"
LoadingRow="dgWorkOrderInfo_LoadingRow"
HeadersVisibility="Column"
HorizontalAlignment="Left"
HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True"
AutoGenerateColumns="False" CanUserAddRows="False" SelectionMode="Single" SelectionUnit="FullRow" >
AutoGenerateColumns="False" CanUserAddRows="False" SelectionMode="Single" SelectionUnit="FullRow" Width="880" Height="447" >
<DataGrid.ColumnHeaderStyle >
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
@ -305,7 +303,7 @@
<Setter Property="Background" Value="#2B7EE6" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGrid.Columns>
<DataGridTemplateColumn Header=" 序号" Width="80" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
@ -314,9 +312,8 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="230" Header="用户编码" Binding="{Binding user_name}"/>
<DataGridTextColumn Width="290" Header="用户名称" Binding="{Binding nick_name}"/>
<DataGridTextColumn Width="290" Header="手机号" Binding="{Binding phonenumber}"/>
<DataGridTextColumn Width="230*" Header="故障编码" Binding="{Binding fault_code}"/>
<DataGridTextColumn Width="290*" Header="故障描述" Binding="{Binding fault_subclass}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>

@ -1,6 +1,8 @@
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -22,30 +24,37 @@ namespace CommonFunc.Tools
/// </summary>
public partial class MachineRepairWin : Window
{
List<faultModel> faultModels = new List<faultModel>();
List<faultModel> CopyModel = new List<faultModel>();
string _apiUrl = "";
DataTable _tables = new DataTable();
public MachineRepairWin()
{
InitializeComponent();
}
public MachineRepairWin(string apiUrl)
public MachineRepairWin(string apiUrl,DataTable dataTable)
{
InitializeComponent();
_apiUrl = apiUrl;
_tables= dataTable;
}
private void btnQueryUser_Click(object sender, RoutedEventArgs e)
{
string queryP = this.txtP.Text.Trim();
if (string.IsNullOrEmpty(queryP))
{
this.dgUserInfo.ItemsSource = Utils.userList;
this.dgUserInfo.ItemsSource = CopyModel;
return;
}
this.dgUserInfo.ItemsSource = null;
var queryList = Utils.userList.Where(t => t.nick_name.Contains(queryP) || t.user_name.Contains(queryP));
var queryList = faultModels.FindAll(t=>t.fault_subclass.Contains(queryP));
this.dgUserInfo.ItemsSource = queryList;
}
private void btnCloseWin_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void txtP_TextChanged(object sender, TextChangedEventArgs e)
{
btnQueryUser_Click(null, null);
@ -53,12 +62,27 @@ namespace CommonFunc.Tools
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.dgUserInfo.ItemsSource = Utils.userList;
CopyModel = ConvertToFaultModelList(_tables);
faultModels= ConvertToFaultModelList(_tables);
this.dgUserInfo.ItemsSource = CopyModel;
}
private void btnCloseWin_Click(object sender, RoutedEventArgs e)
private List<faultModel> ConvertToFaultModelList(DataTable dataTable)
{
this.Close();
var faultList = new List<faultModel>();
if (dataTable != null)
{
foreach (DataRow row in dataTable.Rows)
{
var fault = new faultModel
{
fault_code = row["fault_code"].ToString(),
fault_subclass = row["fault_subclass"].ToString()
};
faultList.Add(fault);
}
}
return faultList;
}
private async void btnUserConfirm_Click(object sender, RoutedEventArgs e)
@ -67,17 +91,18 @@ namespace CommonFunc.Tools
{
if (dgUserInfo.SelectedItems.Count <= 0)
{
CustomMessageBox.Show("请选择人员", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
CustomMessageBox.Show("请选择故障", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
sys_user user = dgUserInfo.SelectedItem as sys_user;
var select= dgUserInfo.SelectedItem as faultModel;
var user= Utils.userList.Find(t=>t.nick_name== LoginUser.UserName);
MachineRepairModel machineRepairModel = new MachineRepairModel();
machineRepairModel.equipmentCode = Utils.GetAppSetting("DeviceCode");
machineRepairModel.factory = Utils.GetAppSetting("SiteCode");
machineRepairModel.userName = user.user_name;
machineRepairModel.phoneNumber = user.phonenumber;
machineRepairModel.userNickName = user.nick_name;
machineRepairModel.orderDesc= select.fault_subclass.ToString();
// 将要发送的数据序列化为JSON格式
var jsonContent = JsonConvert.SerializeObject(machineRepairModel);
@ -104,7 +129,7 @@ namespace CommonFunc.Tools
LogHelper.instance.log.Error($"报修时发生异常>>" + ex.Message);
CustomMessageBox.Show($"调用报修接口时发生异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
}
private void dgWorkOrderInfo_LoadingRow(object sender, DataGridRowEventArgs e)
@ -112,4 +137,10 @@ namespace CommonFunc.Tools
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}
}
public class faultModel
{
public string fault_code { get; set; }
public string fault_subclass { get; set; }
}
}

@ -4,7 +4,7 @@
library
C#
.cs
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\CommonFunc\obj\x86\Debug\
E:\workspace\LanJu\榄菊上位机\shangjian\CommonFunc\obj\x86\Debug\
CommonFunc
none
false
@ -13,8 +13,8 @@ DEBUG;TRACE
489050341
2-1355062061
28-621354674
44-239516262
44-1016000948
HMessageBox.xaml;Tools\MachineRepairWin.xaml;Tools\PauseOrderWin.xaml;Tools\PauseRecoverWin.xaml;
True
False

@ -89,5 +89,20 @@ LEFT JOIN pro_order_workorder workorder WITH (NOLOCK) on dry.workorder_code = wo
}
return null;
}
/// <summary>
/// 获取报修描述
/// </summary>
/// <returns></returns>
public DataTable ConvertToFaultModelList()
{
string getReportCodeSql = "SELECT fault_code, fault_subclass FROM equ_fault_description";
DataSet dtset = Utils.netClientDBHelper.getDataSet(getReportCodeSql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
}
}

@ -980,7 +980,21 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC";
}
return null;
}
/// <summary>
/// 获取报修描述
/// </summary>
/// <returns></returns>
public DataTable ConvertToFaultModelList()
{
string getReportCodeSql = "SELECT fault_code, fault_subclass FROM equ_fault_description";
DataSet dtset = Utils.netClientDBHelper.getDataSet(getReportCodeSql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
public DataTable GetNewRFID()
{
string sql = $@"select max(rfid) as rfid from mes_rfidandsfc_bind where CONVERT(VARCHAR(10), create_time , 120) = CONVERT(VARCHAR(10),Getdate(), 120)";

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace XGL.Models.Model
{
/// <summary>
/// 设备报修 equipmentCode设备编码、factory工厂源、userName用户账号、phoneNumber联系方式、userNickName用户昵称
/// 设备报修 equipmentCode设备编码、factory工厂源、userName用户账号、phoneNumber联系方式、userNickName用户昵称 orderDesc(故障描述)
/// </summary>
public class MachineRepairModel
{
@ -16,5 +16,6 @@ namespace XGL.Models.Model
public string userName { get; set; }
public string phoneNumber { get; set; }
public string userNickName { get; set; }
public string orderDesc { get; set; }
}
}

@ -299,10 +299,11 @@ namespace XGL.Views
}
private void btnMachineRepair_Click(object sender, RoutedEventArgs e)
{
var selefuel = dringRoomService.ConvertToFaultModelList();
FormingMachineService formingMachineService = new FormingMachineService();
//调用首件检验接口
string apiUrl = formingMachineService.GetInterfaceUrl("machineRepair");
MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl);
MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl, selefuel);
machineRepairWin.ShowDialog();
}
}

@ -608,9 +608,10 @@ VALUES
private void btnMachineRepair_Click(object sender, RoutedEventArgs e)
{
//调用首件检验接口
string apiUrl = formingMachineService.GetInterfaceUrl("machineRepair");
MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl);
MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl, formingMachineService.ConvertToFaultModelList());
machineRepairWin.ShowDialog();
}
}

@ -457,7 +457,7 @@ Background="#F2F3F5"
Click="btnRefresh_Click" Content="刷新"></Button>
</StackPanel>
<!--<StackPanel
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="9"
@ -470,8 +470,9 @@ Background="#F2F3F5"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Content="称重"></Button>
</StackPanel>-->
Click="weigh_Click"
Content="打卡"></Button>
</StackPanel>
</StackPanel>
</ScrollViewer>

@ -818,9 +818,11 @@ namespace XGLFinishPro.Views
private void btnMachineRepair_Click(object sender, RoutedEventArgs e)
{
var selefuel= formingMachineService.ConvertToFaultModelList();
//调用首件检验接口
string apiUrl = formingMachineService.GetInterfaceUrl("machineRepair");
MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl);
MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl, selefuel);
machineRepairWin.ShowDialog();
}
@ -854,6 +856,12 @@ namespace XGLFinishPro.Views
PieceSalaryCalWin pieceSalaryCalWin = new PieceSalaryCalWin(prodCode, prodName, deviceCode, workOrderCode, sapWorkOrderCode);
pieceSalaryCalWin.ShowDialog();
}
private void weigh_Click(object sender, RoutedEventArgs e)
{
punchCard punchCard = new punchCard();
punchCard.ShowDialog();
}
}
public class ReportWorkModel
{

@ -5,8 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:XGLFinishPro.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Width="1920"
Height="800"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
mc:Ignorable="d">
<UserControl.Resources>
<Style TargetType="TextBox">

@ -0,0 +1,16 @@
<Window x:Class="XGLFinishPro.Views.punchCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:XGLFinishPro.Views"
mc:Ignorable="d"
WindowState="Maximized"
Title="打卡"
Width="1920"
Height="1080">
<Grid Name="content"
Background="#F2F3F5">
<ContentControl Name="Index" />
</Grid>
</Window>

@ -0,0 +1,31 @@
using CommonFunc.Tools;
using System;
using System.Collections.Generic;
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.Shapes;
namespace XGLFinishPro.Views
{
/// <summary>
/// punchCard.xaml 的交互逻辑
/// </summary>
public partial class punchCard : Window
{
public punchCard()
{
InitializeComponent();
LanJu_User prepare = new LanJu_User();
this.Index.Content = prepare;
}
}
}

@ -419,6 +419,9 @@
<Compile Include="Views\PieceSalaryCalWin.xaml.cs">
<DependentUpon>PieceSalaryCalWin.xaml</DependentUpon>
</Compile>
<Compile Include="Views\punchCard.xaml.cs">
<DependentUpon>punchCard.xaml</DependentUpon>
</Compile>
<Compile Include="Views\QitaoLvUC.xaml.cs">
<DependentUpon>QitaoLvUC.xaml</DependentUpon>
</Compile>
@ -672,6 +675,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\punchCard.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\QitaoLvUC.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

Loading…
Cancel
Save