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

master
zhaojian 2 years ago
parent e9bdecf486
commit 5d84acc2a8

@ -274,28 +274,26 @@
<ColumnDefinition/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column ="0" Orientation="Horizontal" Margin="5"> <StackPanel Grid.Row="0" Grid.Column ="0" Orientation="Horizontal" Margin="5">
<TextBlock Text="请输入用户名或者ID" VerticalAlignment="Center"/> <TextBlock Text="故障描述" VerticalAlignment="Center"/>
<TextBox x:Name="txtP" Width="120" Height="30" FontSize="18" VerticalAlignment="Center" VerticalContentAlignment="Center" TextChanged="txtP_TextChanged"/> <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="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="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"/> <Button x:Name="btnCloseWin" HorizontalAlignment="Right" Content="关闭" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnCloseWin_Click"/>
</StackPanel> </StackPanel>
<DataGrid <DataGrid
Grid.Row="1" Grid.Column ="0" Grid.ColumnSpan="2" Grid.Row="1"
x:Name="dgUserInfo" x:Name="dgUserInfo"
MinWidth="400" MinWidth="400"
MinHeight="260" MinHeight="260"
RowStyle="{StaticResource DataGridRowStyle}" RowStyle="{StaticResource DataGridRowStyle}"
Margin="10,0,0,5"
MaxHeight="400"
AlternationCount="2" AlternationCount="2"
FontSize="18" FontSize="18"
LoadingRow="dgWorkOrderInfo_LoadingRow" LoadingRow="dgWorkOrderInfo_LoadingRow"
HeadersVisibility="Column" HeadersVisibility="Column"
HorizontalAlignment="Left" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" 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 > <DataGrid.ColumnHeaderStyle >
<Style TargetType="DataGridColumnHeader"> <Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center" />
@ -314,9 +312,8 @@
</DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn> </DataGridTemplateColumn>
<DataGridTextColumn Width="230" Header="用户编码" Binding="{Binding user_name}"/> <DataGridTextColumn Width="230*" Header="故障编码" Binding="{Binding fault_code}"/>
<DataGridTextColumn Width="290" Header="用户名称" Binding="{Binding nick_name}"/> <DataGridTextColumn Width="290*" Header="故障描述" Binding="{Binding fault_subclass}"/>
<DataGridTextColumn Width="290" Header="手机号" Binding="{Binding phonenumber}"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
</Grid> </Grid>

@ -1,6 +1,8 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -22,30 +24,37 @@ namespace CommonFunc.Tools
/// </summary> /// </summary>
public partial class MachineRepairWin : Window public partial class MachineRepairWin : Window
{ {
List<faultModel> faultModels = new List<faultModel>();
List<faultModel> CopyModel = new List<faultModel>();
string _apiUrl = ""; string _apiUrl = "";
DataTable _tables = new DataTable();
public MachineRepairWin() public MachineRepairWin()
{ {
InitializeComponent(); InitializeComponent();
} }
public MachineRepairWin(string apiUrl) public MachineRepairWin(string apiUrl,DataTable dataTable)
{ {
InitializeComponent(); InitializeComponent();
_apiUrl = apiUrl; _apiUrl = apiUrl;
_tables= dataTable;
} }
private void btnQueryUser_Click(object sender, RoutedEventArgs e) private void btnQueryUser_Click(object sender, RoutedEventArgs e)
{ {
string queryP = this.txtP.Text.Trim(); string queryP = this.txtP.Text.Trim();
if (string.IsNullOrEmpty(queryP)) if (string.IsNullOrEmpty(queryP))
{ {
this.dgUserInfo.ItemsSource = Utils.userList; this.dgUserInfo.ItemsSource = CopyModel;
return; return;
} }
this.dgUserInfo.ItemsSource = null; 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; this.dgUserInfo.ItemsSource = queryList;
} }
private void btnCloseWin_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void txtP_TextChanged(object sender, TextChangedEventArgs e) private void txtP_TextChanged(object sender, TextChangedEventArgs e)
{ {
btnQueryUser_Click(null, null); btnQueryUser_Click(null, null);
@ -53,12 +62,27 @@ namespace CommonFunc.Tools
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
this.dgUserInfo.ItemsSource = Utils.userList; CopyModel = ConvertToFaultModelList(_tables);
faultModels= ConvertToFaultModelList(_tables);
this.dgUserInfo.ItemsSource = CopyModel;
} }
private List<faultModel> ConvertToFaultModelList(DataTable dataTable)
private void btnCloseWin_Click(object sender, RoutedEventArgs e)
{ {
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) private async void btnUserConfirm_Click(object sender, RoutedEventArgs e)
@ -67,17 +91,18 @@ namespace CommonFunc.Tools
{ {
if (dgUserInfo.SelectedItems.Count <= 0) if (dgUserInfo.SelectedItems.Count <= 0)
{ {
CustomMessageBox.Show("请选择人员", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning); CustomMessageBox.Show("请选择故障", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return; return;
} }
var select= dgUserInfo.SelectedItem as faultModel;
sys_user user = dgUserInfo.SelectedItem as sys_user; var user= Utils.userList.Find(t=>t.nick_name== LoginUser.UserName);
MachineRepairModel machineRepairModel = new MachineRepairModel(); MachineRepairModel machineRepairModel = new MachineRepairModel();
machineRepairModel.equipmentCode = Utils.GetAppSetting("DeviceCode"); machineRepairModel.equipmentCode = Utils.GetAppSetting("DeviceCode");
machineRepairModel.factory = Utils.GetAppSetting("SiteCode"); machineRepairModel.factory = Utils.GetAppSetting("SiteCode");
machineRepairModel.userName = user.user_name; machineRepairModel.userName = user.user_name;
machineRepairModel.phoneNumber = user.phonenumber; machineRepairModel.phoneNumber = user.phonenumber;
machineRepairModel.userNickName = user.nick_name; machineRepairModel.userNickName = user.nick_name;
machineRepairModel.orderDesc= select.fault_subclass.ToString();
// 将要发送的数据序列化为JSON格式 // 将要发送的数据序列化为JSON格式
var jsonContent = JsonConvert.SerializeObject(machineRepairModel); var jsonContent = JsonConvert.SerializeObject(machineRepairModel);
@ -112,4 +137,10 @@ namespace CommonFunc.Tools
e.Row.Header = (e.Row.GetIndex() + 1).ToString(); 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 library
C# C#
.cs .cs
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\CommonFunc\obj\x86\Debug\ E:\workspace\LanJu\榄菊上位机\shangjian\CommonFunc\obj\x86\Debug\
CommonFunc CommonFunc
none none
false false
@ -13,8 +13,8 @@ DEBUG;TRACE
489050341 489050341
2-1355062061 2-1355062061
28-621354674 28-621354674
44-239516262 44-1016000948
HMessageBox.xaml;Tools\MachineRepairWin.xaml;Tools\PauseOrderWin.xaml;Tools\PauseRecoverWin.xaml; 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; 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; 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() 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)"; 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 namespace XGL.Models.Model
{ {
/// <summary> /// <summary>
/// 设备报修 equipmentCode设备编码、factory工厂源、userName用户账号、phoneNumber联系方式、userNickName用户昵称 /// 设备报修 equipmentCode设备编码、factory工厂源、userName用户账号、phoneNumber联系方式、userNickName用户昵称 orderDesc(故障描述)
/// </summary> /// </summary>
public class MachineRepairModel public class MachineRepairModel
{ {
@ -16,5 +16,6 @@ namespace XGL.Models.Model
public string userName { get; set; } public string userName { get; set; }
public string phoneNumber { get; set; } public string phoneNumber { get; set; }
public string userNickName { 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) private void btnMachineRepair_Click(object sender, RoutedEventArgs e)
{ {
var selefuel = dringRoomService.ConvertToFaultModelList();
FormingMachineService formingMachineService = new FormingMachineService(); FormingMachineService formingMachineService = new FormingMachineService();
//调用首件检验接口 //调用首件检验接口
string apiUrl = formingMachineService.GetInterfaceUrl("machineRepair"); string apiUrl = formingMachineService.GetInterfaceUrl("machineRepair");
MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl); MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl, selefuel);
machineRepairWin.ShowDialog(); machineRepairWin.ShowDialog();
} }
} }

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

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

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

@ -5,8 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:XGLFinishPro.Views" xmlns:local="clr-namespace:XGLFinishPro.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Width="1920" HorizontalAlignment="Stretch"
Height="800" VerticalAlignment="Stretch"
mc:Ignorable="d"> mc:Ignorable="d">
<UserControl.Resources> <UserControl.Resources>
<Style TargetType="TextBox"> <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"> <Compile Include="Views\PieceSalaryCalWin.xaml.cs">
<DependentUpon>PieceSalaryCalWin.xaml</DependentUpon> <DependentUpon>PieceSalaryCalWin.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\punchCard.xaml.cs">
<DependentUpon>punchCard.xaml</DependentUpon>
</Compile>
<Compile Include="Views\QitaoLvUC.xaml.cs"> <Compile Include="Views\QitaoLvUC.xaml.cs">
<DependentUpon>QitaoLvUC.xaml</DependentUpon> <DependentUpon>QitaoLvUC.xaml</DependentUpon>
</Compile> </Compile>
@ -672,6 +675,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\punchCard.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\QitaoLvUC.xaml"> <Page Include="Views\QitaoLvUC.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

Loading…
Cancel
Save