一波新版报工、计件薪酬等

20260122
zhaoaomin 2 years ago
parent 2f18ceeba2
commit 11da21ae79

Binary file not shown.

@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>c0Rf+CYPtsvtvSUmXds9V3/rrktlKG3rzjN5DuQeWaE=</dsig:DigestValue>
<dsig:DigestValue>9gelEpMO4qJ5KxvCk+ce67lmnH5+0CTvBVOkoSS5ic4=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

@ -49,7 +49,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>JYnml/VunFI2cpX5vz9XEjoQbR4ehe5wE83P4SCElVc=</dsig:DigestValue>
<dsig:DigestValue>+6uGt7/UGrobhZzEzE1gWClphUGNE6QWTTfhav4xNS0=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

@ -14,7 +14,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>c0Rf+CYPtsvtvSUmXds9V3/rrktlKG3rzjN5DuQeWaE=</dsig:DigestValue>
<dsig:DigestValue>9gelEpMO4qJ5KxvCk+ce67lmnH5+0CTvBVOkoSS5ic4=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

@ -49,7 +49,7 @@
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>JYnml/VunFI2cpX5vz9XEjoQbR4ehe5wE83P4SCElVc=</dsig:DigestValue>
<dsig:DigestValue>+6uGt7/UGrobhZzEzE1gWClphUGNE6QWTTfhav4xNS0=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>

@ -5,8 +5,320 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CommonFunc.Tools"
mc:Ignorable="d"
Title="MachineRepairWin" Height="450" Width="800">
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"/>
<Style x:Key="ColumnHeaderGripperStyle" TargetType="DataGridColumnHeader"/>
<Style x:Key="DataGridRowStyle" TargetType="DataGridRow">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="{StaticResource EvenRowBackground}"/>
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="{StaticResource OddRowBackground}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="CustomCellStyle" TargetType="DataGridCell">
<Setter Property="Foreground" Value="Black" />
<Setter Property="TextBlock.TextAlignment" Value="Center" />
<Setter Property="TextBlock.FontSize" Value="22" />
</Style>
<Style x:Key="ApplicantList_ListBox_Style" TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="#00000000"/>
<Setter Property="BorderBrush" Value="#00000000"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<!--<Setter Property="ItemContainerStyle" Value="{DynamicResource ApplicantList_ListBoxItem_Style}" />-->
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<!--<WrapPanel Orientation="Horizontal" IsItemsHost="True" />-->
<UniformGrid Columns="2"/>
<!--设置横向Horizontal 纵向Vertical显示-->
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="btnKey" TargetType="Button">
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="60" />
<Setter Property="Margin" Value="5.5"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="#2B7EE6" BorderThickness="2" CornerRadius="10">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ApplicantList_ListBoxItem_Style" TargetType="{x:Type ListBoxItem}">
<Setter Property="Margin" Value="10,10,10,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Bd" BorderThickness="3"
Width="120"
Height="40"
Margin="2,0,0,0"
Style="{DynamicResource ListBoxItemNormalBackground_Border_Style}">
<Grid >
<Image Source="../Resources/leaf.png" Margin="223,-82,0,0" Width="50"/>
<TextBlock Text="{Binding childprocess_code}"
VerticalAlignment="Center"
Margin="10,0,0,0" FontWeight="Bold" Foreground="Black"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
<TextBlock Text="{Binding childprocess_name}"
VerticalAlignment="Center"
Margin="35,0,0,0" FontWeight="Bold" Foreground="Black"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
<Grid
Margin="-15,12,0,0"
Width="90"
Height="102"
VerticalAlignment="Top"
HorizontalAlignment="Left" >
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-62,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-22,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,18,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,56,0,0"/>
<!--<Image Source="../Resources/lanjuLogo.png" VerticalAlignment="Stretch"/>-->
<!--<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding rfid_no}" FontSize="18"
Foreground="{Binding rfid_no,Converter={StaticResource ForeGroundBatchType}}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Image Source="..\Img\1.png"></Image>
</StackPanel>-->
</Grid>
</Grid>
</Border>
<!--控件触发器-->
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<!--LinearGradientBrush,渐变线画笔-->
<LinearGradientBrush
StartPoint="0.4,0"
EndPoint="0.4,1">
<LinearGradientBrush.GradientStops>
<!--GradientStops渐变线停止GradientStopCollection渐变线停止集合点-->
<GradientStopCollection>
<GradientStop
Color="#FFffeeac"
Offset="0" />
<GradientStop
Color="#FFfbe178"
Offset="0.4" />
<GradientStop
Color="#FFfbe178"
Offset="0.6" />
<GradientStop
Color="#FFfffbd9"
Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd" Value="RoyalBlue"></Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<!--LinearGradientBrush,渐变线画笔-->
<LinearGradientBrush
StartPoint="0.4,0"
EndPoint="0.4,1">
<LinearGradientBrush.GradientStops>
<!--GradientStops渐变线停止GradientStopCollection渐变线停止集合点-->
<GradientStopCollection>
<GradientStop
Color="#FFC2E0FF"
Offset="0" />
<GradientStop
Color="#FFC2E0dF"
Offset="0.4" />
<GradientStop
Color="#FFC2E0dF"
Offset="0.6" />
<GradientStop
Color="#FFfffbd9"
Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Border}" x:Key="ListBoxItemHeadBackground_Border_Style">
<Setter Property="BitmapEffect">
<Setter.Value>
<DropShadowBitmapEffect Color="Black" Direction="340" ShadowDepth="7" Softness="0.1" Opacity="0.3"/>
</Setter.Value>
</Setter>
<Setter Property="Background" >
<Setter.Value>
<LinearGradientBrush
StartPoint="0.4,0"
EndPoint="0.4,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop
Color="#FFffeeac"
Offset="0" />
<GradientStop
Color="#FFfbe178"
Offset="0.4" />
<GradientStop
Color="#FFfbe178"
Offset="0.6" />
<GradientStop
Color="#FFfffbd9"
Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<!--字体样式-->
<Style x:Key="Title_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="34"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
</Style>
<Style x:Key="Copyright_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontFamily" Value="宋体"/>
<Setter Property="Foreground" Value="#FF939393"/>
</Style>
<Style x:Key="ChirdrenControlTitle_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
</Style>
<Style x:Key="ListBoxItemName_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#000000"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<Style x:Key="ListBoxItemContent_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<!--ListBox元素边框样式-->
<Style x:Key="ListBoxItemNormalBackground_Border_Style" TargetType="{x:Type Border}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="5" />
<Setter Property="BorderBrush" Value="#E1E1E1"/>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0.5,0"
EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FFffffff"
Offset="0" />
<GradientStop Color="#FFE4E4E4"
Offset="0.96" />
<GradientStop Color="#FFe4e4e4"
Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="#9e9e9e"
Direction="315"
ShadowDepth="3"
Opacity="1" />
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid Grid.Row="0" Grid.RowSpan="2" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"/>
<RowDefinition Height="0.85*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<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"/>
<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"/>
</StackPanel>
<Button x:Name="btnCloseWin" HorizontalAlignment="Right" Content="关闭" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnCloseWin_Click"/>
<DataGrid
Grid.Row="1" Grid.Column ="0" Grid.ColumnSpan="2"
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"
VerticalAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True"
AutoGenerateColumns="False" CanUserAddRows="False" SelectionMode="Single" SelectionUnit="FullRow" >
<DataGrid.ColumnHeaderStyle >
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="48" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#2B7EE6" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header=" 序号" Width="80" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</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}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Grid>
</Window>

@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -11,6 +12,8 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using XGL.Models.Model;
using XGL.Models.Model.OrderPrepare;
namespace CommonFunc.Tools
{
@ -19,9 +22,94 @@ namespace CommonFunc.Tools
/// </summary>
public partial class MachineRepairWin : Window
{
string _apiUrl = "";
public MachineRepairWin()
{
InitializeComponent();
}
public MachineRepairWin(string apiUrl)
{
InitializeComponent();
_apiUrl = apiUrl;
}
private void btnQueryUser_Click(object sender, RoutedEventArgs e)
{
string queryP = this.txtP.Text.Trim();
if (string.IsNullOrEmpty(queryP))
{
this.dgUserInfo.ItemsSource = Utils.userList;
return;
}
this.dgUserInfo.ItemsSource = null;
var queryList = Utils.userList.Where(t => t.nick_name.Contains(queryP) || t.user_name.Contains(queryP));
this.dgUserInfo.ItemsSource = queryList;
}
private void txtP_TextChanged(object sender, TextChangedEventArgs e)
{
btnQueryUser_Click(null, null);
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.dgUserInfo.ItemsSource = Utils.userList;
}
private void btnCloseWin_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private async void btnUserConfirm_Click(object sender, RoutedEventArgs e)
{
try
{
if (dgUserInfo.SelectedItems.Count <= 0)
{
CustomMessageBox.Show("请选择人员!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
sys_user user = dgUserInfo.SelectedItem as sys_user;
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;
// 将要发送的数据序列化为JSON格式
var jsonContent = JsonConvert.SerializeObject(machineRepairModel);
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)
{
LogHelper.instance.log.Info($"报修成功>>" + result.msg);
CustomMessageBox.Show($"调用报修接口成功", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
else
{
LogHelper.instance.log.Error($"报修失败>>" + result.msg);
CustomMessageBox.Show($"调用报修接口失败:" + result.msg, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
}
catch (Exception ex)
{
LogHelper.instance.log.Error($"报修时发生异常>>" + ex.Message);
CustomMessageBox.Show($"调用报修接口时发生异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
}
private void dgWorkOrderInfo_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}
}
}

@ -14,6 +14,8 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
using XGL.Models;
using XGL.Models.Model;
namespace CommonFunc.Tools
@ -27,7 +29,7 @@ namespace CommonFunc.Tools
public static SqlServerDBHelper cloudDBHelper = new SqlServerDBHelper(SqlDataObject.GetCloudSqlConnectionString);
public static SqlServerDBHelper clientDBHelper = new SqlServerDBHelper(SqlDataObject.GetMESClientSqlConnectionString);
public static SqlServerDBHelper netClientDBHelper = new SqlServerDBHelper(SqlDataObject.GetMESNetClientSqlConnectionString);
public static List<sys_user> userList { get; set; }
public static string GetServerIP()
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(SqlDataObject.GetMESNetClientSqlConnectionString);

@ -1 +1 @@
03c0b79cd3691853fd4748eb06a5fdb72fc84d6a
480a3b974159ff526098f6d65536fd513e8930601ce13afba64b502e068040c0

@ -5,7 +5,6 @@ D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\bin\Debug\HtmlA
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\bin\Debug\HtmlAgilityPack.pdb
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\bin\Debug\HtmlAgilityPack.xml
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.csproj.AssemblyReference.cache
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.csproj.SuggestedBindingRedirects.cache
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.csproj.CoreCompileInputs.cache
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.csproj.CopyComplete
D:\WorkSpace\KHD\Project\Lanju\Lanju-client\shangjian\RestartApp\obj\Debug\RestartApp.exe

@ -6,6 +6,7 @@ using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using XGL.Models.Model.FoamingMac;
namespace XGL.Data.DBService
@ -18,7 +19,7 @@ namespace XGL.Data.DBService
/// <param name="bdt"></param>
/// <param name="edt"></param>
/// <returns></returns>
public DataTable GetFormingMachineInfo(string devicecode,string workDate)
public DataTable GetFormingMachineInfo(string devicecode, string workDate)
{
//过于复杂,给数据库造成了压力,经常死锁
// string sql = $@"SELECT DISTINCT
@ -91,7 +92,7 @@ namespace XGL.Data.DBService
string sql = $@"select shift_id,shift_code,shift_desc,Shift_Start_Time,Shift_End_Time from base_shifts_t where del_flag ='0' ";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
@ -118,7 +119,7 @@ namespace XGL.Data.DBService
/// <param name="bdt"></param>
/// <param name="edt"></param>
/// <returns></returns>
public string getnumber(string order, string devicecode,string shetl)
public string getnumber(string order, string devicecode, string shetl)
{
string sql = $@"SELECT COUNT(*) FROM mes_material_transfer_result WHERE equipmentCode='{order}' and work_date='{devicecode}' and shift_id='{shetl}' and rfid_status='1'";
@ -158,7 +159,7 @@ namespace XGL.Data.DBService
/// <param name="bdt"></param>
/// <param name="edt"></param>
/// <returns></returns>
public DataTable GetInOutHistoryList(string workOrderCode,string devicecode,string workDate)
public DataTable GetInOutHistoryList(string workOrderCode, string devicecode, string workDate)
{
string sql = $@"SELECT DISTINCT ord.workorder_id,ord.workorder_code,res.OrderCode,ord.product_name,product_code,isnull(car_num,0) as car_num,
isnull([begin],'1900-01-01 08:00:00') as [begin],ord.status,ord.route_code,ord.attr1,work_batch_code,res.taskcode,res.rfid,plan_time ,res.update_time
@ -226,7 +227,7 @@ where res.taskcode = '0' and equipmentCode = 'C6' and res.OrderCode is not null
/// <param name="bdt"></param>
/// <param name="edt"></param>
/// <returns></returns>
public bool UpdateWorkOrder(string orderCode,string status,string remark,string type,string deviceCode)
public bool UpdateWorkOrder(string orderCode, string status, string remark, string type, string deviceCode)
{
List<string> sqlList = new List<string>();
string logSql = "";
@ -253,10 +254,10 @@ where res.taskcode = '0' and equipmentCode = 'C6' and res.OrderCode is not null
sqlList.Add(logSql);
bool issucc = Utils.netClientDBHelper.executeBatchSql(sqlList);
return issucc ;
return issucc;
}
/// <summary>
/// 更新工单
@ -313,14 +314,14 @@ VALUES
/// <param name="bdt"></param>
/// <param name="edt"></param>
/// <returns></returns>
public bool ExecuteReportWork(DataRowView selectRow,string orderQuntity,string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode, string isEndReport, string deviceCode)
public bool ExecuteReportWork(DataRowView selectRow, string orderQuntity, string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode, string isEndReport, string deviceCode)
{
string getReportCodeSql = $@"SELECT equipment_code,equipment_name FROM [dbo].[base_equipment] WHERE equipment_code='{deviceCode}'";
string lineName = "";
DataSet dtset = Utils.netClientDBHelper.getDataSet(getReportCodeSql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
lineName = dtset.Tables[0].Rows[0]["equipment_name"].ToString();
lineName = dtset.Tables[0].Rows[0]["equipment_name"].ToString();
}
//获取子工单的信息
@ -329,15 +330,15 @@ VALUES
string subProductCode = "";
string subProductName = "";
string subQuntity = "";
string subUnit = "";
DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
string subUnit = "";
DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
if (dtSubOrder != null && dtSubOrder.Tables.Count > 0 && dtSubOrder.Tables[0].Rows.Count > 0)
{
subOrder = dtSubOrder.Tables[0].Rows[0]["workorder_code"].ToString();
subProductCode = dtSubOrder.Tables[0].Rows[0]["product_code"].ToString();
subProductName = dtSubOrder.Tables[0].Rows[0]["product_name"].ToString();
subQuntity = dtSubOrder.Tables[0].Rows[0]["quantity_split"].ToString();
subUnit = dtSubOrder.Tables[0].Rows[0]["unit"].ToString();
subUnit = dtSubOrder.Tables[0].Rows[0]["unit"].ToString();
}
double rate = Convert.ToDouble(workCount) / Convert.ToDouble(orderQuntity);
@ -400,10 +401,10 @@ VALUES
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}',GetDate(), '0', NULL, 'prod',
{userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["parent_order"]}');";
{userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["parent_order"]}');";
sqlList.Add(mainOrderSql);
}
//赵啸林说不用上位机更新报工标识
//string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' ";
//sqlList.Add(sql);
@ -427,7 +428,7 @@ VALUES
/// <param name="bdt"></param>
/// <param name="edt"></param>
/// <returns></returns>
public List<string> GetExecuteReportWorkSql(DataRowView selectRow, string orderQuntity, string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode, string isEndReport, string deviceCode)
public List<string> GetExecuteReportWorkSql(DataRowView selectRow, string orderQuntity, string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode, string isEndReport, string deviceCode, string fatherOrderUserCount)
{
string getReportCodeSql = $@"SELECT equipment_code,equipment_name FROM [dbo].[base_equipment] WHERE equipment_code='{deviceCode}'";
string lineName = "";
@ -437,6 +438,7 @@ VALUES
lineName = dtset.Tables[0].Rows[0]["equipment_name"].ToString();
}
#region 生成报工数据
//获取子工单的信息
string getSubOrderSql = $"select workorder_code,product_code,product_name,quantity_split,unit from pro_order_workorder where parent_order = '{selectRow["workorder_code"]}'";
string subOrder = "";
@ -470,12 +472,12 @@ VALUES
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{selectRow["workorder_code"]}', '{selectRow["product_code"]}', '{selectRow["product_name"]}',
'{selectRow["product_spc"]}', '{selectRow["unit"]}', {workCount}, {workCount}, 0, 0,
'{selectRow["product_spc"]}', '{selectRow["unit"]}', {selectRow["batch_quantity"]}, {workCount}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
{userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{0}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
{fatherOrderUserCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{0}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
string subOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
@ -487,7 +489,7 @@ VALUES
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{subOrder}', '{subProductCode}', '{subProductName}',
'{selectRow["product_spc"]}', '{subUnit}', {subOrderQty}, {subOrderQty}, 0, 0,
'{selectRow["product_spc"]}', '{subUnit}', {selectRow["batch_quantity"]}, {subOrderQty}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
@ -509,7 +511,7 @@ VALUES
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{selectRow["workorder_code"]}', '{selectRow["product_code"]}', '{selectRow["product_name"]}',
'{selectRow["product_spc"]}', '{selectRow["unit"]}', {workCount}, {workCount}, 0, 0,
'{selectRow["product_spc"]}', '{selectRow["unit"]}', {selectRow["batch_quantity"]}, {workCount}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
@ -517,26 +519,250 @@ VALUES
{userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["parent_order"]}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
sqlList.Add(mainOrderSql);
}
#endregion
//赵啸林说不用上位机更新报工标识
//string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' ";
//sqlList.Add(sql);
//sqlList.Add(updateOrderSql);
//赵啸林又说sap有问题需要上位机修改报工标识2023-12-25,仅在最终报工时,才更新此状态
#region 最终报工,更新工单状态为已报工
//赵啸林又说sap有问题需要上位机修改报工标识2023-12-25,但仅在最终报工时,才更新此状态
if (isEndReport.Equals("1"))
{
string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where belong_work_order = '{selectRow["workorder_code"]}' ";
//更新订单状态为已报工;
string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where belong_work_order = '{selectRow["workorder_code"]}' ";
sqlList.Add(updateOrderSql);
}
//修改报工逻辑最终报工时添加子母工单领料单状态更新2024-02-20
if (subOrder != "") //有子单
{
//更新子单状态
string updateSubOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{subOrder}'";
//更新母单状态
string updateMainOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{selectRow["workorder_code"]}'";
sqlList.Add(updateSubOrderPrepareSql);
sqlList.Add(updateMainOrderPrepareSql);
}
else //无子单
{
//更新母单状态
string updateMainOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{selectRow["workorder_code"]}'";
sqlList.Add(updateMainOrderPrepareSql);
}
}
#endregion
#region 批次报工状态更新
//添加批次报工状态更新--2023-12-26
string updateBatchOrderStatusSql = $@"update pro_order_workorder_batch set status = '0', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' and batch_code = '{batchCode}' ";
sqlList.Add(updateBatchOrderStatusSql);
#endregion
return sqlList;//> 0 ? true : false;
}
/// <summary>
/// 新版报工
/// </summary>
/// <param name="bdt"></param>
/// <param name="edt"></param>
/// <returns></returns>
public List<string> GetExecuteReportWorkSql(DataRowView selectRow, string orderQuntity, string workCount, string reportCode, string workTime, string userCount, string costCenter, string batchCode,
string isEndReport, string deviceCode, Dictionary<int, string> workTimeDic, Dictionary<int, string> userCountDic)
{
string getReportCodeSql = $@"SELECT equipment_code,equipment_name FROM [dbo].[base_equipment] WHERE equipment_code='{deviceCode}'";
string lineName = "";
DataSet dtset = Utils.netClientDBHelper.getDataSet(getReportCodeSql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
lineName = dtset.Tables[0].Rows[0]["equipment_name"].ToString();
}
#region 生成报工数据
//获取子工单的信息
string getSubOrderSql = $"select workorder_code,product_code,product_name,quantity_split,unit from pro_order_workorder where parent_order = '{selectRow["workorder_code"]}'";
string subOrder = "";
//string subProductCode = "";
//string subProductName = "";
//string subQuntity = "";
//string subUnit = "";
DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
if (dtSubOrder != null && dtSubOrder.Tables.Count > 0 && dtSubOrder.Tables[0].Rows.Count > 0)
{
subOrder = dtSubOrder.Tables[0].Rows[0]["workorder_code"].ToString();
//subProductCode = dtSubOrder.Tables[0].Rows[0]["product_code"].ToString();
//subProductName = dtSubOrder.Tables[0].Rows[0]["product_name"].ToString();
//subQuntity = dtSubOrder.Tables[0].Rows[0]["quantity_split"].ToString();
//subUnit = dtSubOrder.Tables[0].Rows[0]["unit"].ToString();
}
//double rate = Convert.ToDouble(workCount) / Convert.ToDouble(orderQuntity);
//double subOrderQty = rate * Convert.ToDouble(subQuntity);
List<string> sqlList = new List<string>();
//有子单
if (subOrder != "")
{
string mainOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
[spec], [unit], [quantity], [quantity_feedback], [quantity_qualified], [quantity_unqualified],
[user_name], [nick_name], [feedback_channel], [feedback_time], [record_user], [status],
[remark], [work_time], [machine_code], [machine_name], [team_code], [shift_code],
[attr1], [attr2], [attr3], [attr4], [create_by], [create_time],
[update_time], [update_by], [upload_status], [upload_msg], [prod_type],
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{selectRow["workorder_code"]}', '{selectRow["product_code"]}', '{selectRow["product_name"]}',
'{selectRow["product_spc"]}', '{selectRow["unit"]}', {selectRow["batch_quantity"]}, {workCount}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
{userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{0}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
foreach (string item in GetAllWorkReportsForOrderAndChildren(selectRow["workorder_code"].ToString(), selectRow, orderQuntity, reportCode, costCenter, batchCode,
isEndReport, deviceCode, lineName, workCount, workTimeDic, userCountDic,0))
{
sqlList.Add(item);
}
//string subOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
// ([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
// [spec], [unit], [quantity], [quantity_feedback], [quantity_qualified], [quantity_unqualified],
// [user_name], [nick_name], [feedback_channel], [feedback_time], [record_user], [status],
// [remark], [work_time], [machine_code], [machine_name], [team_code], [shift_code],
// [attr1], [attr2], [attr3], [attr4], [create_by], [create_time],
// [update_time], [update_by], [upload_status], [upload_msg], [prod_type],
// [use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
// VALUES
// ('{Common.GetUUID()}', 'SELF', '{reportCode}', '{subOrder}', '{subProductCode}', '{subProductName}',
// '{selectRow["product_spc"]}', '{subUnit}', {selectRow["batch_quantity"]}, {subOrderQty}, 0, 0,
// '{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
// '无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
// NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
// '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
// {userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["workorder_code"]}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
sqlList.Add(mainOrderSql);
//sqlList.Add(subOrderSql);
}
else
{
//无子单
string mainOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
[spec], [unit], [quantity], [quantity_feedback], [quantity_qualified], [quantity_unqualified],
[user_name], [nick_name], [feedback_channel], [feedback_time], [record_user], [status],
[remark], [work_time], [machine_code], [machine_name], [team_code], [shift_code],
[attr1], [attr2], [attr3], [attr4], [create_by], [create_time],
[update_time], [update_by], [upload_status], [upload_msg], [prod_type],
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{selectRow["workorder_code"]}', '{selectRow["product_code"]}', '{selectRow["product_name"]}',
'{selectRow["product_spc"]}', '{selectRow["unit"]}', {selectRow["batch_quantity"]}, {workCount}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTime}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
{userCount}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["parent_order"]}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
sqlList.Add(mainOrderSql);
}
#endregion
//赵啸林说不用上位机更新报工标识
//string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' ";
//sqlList.Add(sql);
//sqlList.Add(updateOrderSql);
#region 最终报工,更新工单状态为已报工
//赵啸林又说sap有问题需要上位机修改报工标识2023-12-25,但仅在最终报工时,才更新此状态
if (isEndReport.Equals("1"))
{
//更新订单状态为已报工;
string updateOrderSql = $@"update pro_order_workorder set status = 'w3', update_by = '{LoginUser.UserName}',update_time = GETDATE() where belong_work_order = '{selectRow["workorder_code"]}' ";
sqlList.Add(updateOrderSql);
//修改报工逻辑最终报工时添加子母工单领料单状态更新2024-02-20
if (subOrder != "") //有子单
{
//更新子单状态
string updateSubOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{subOrder}'";
//更新母单状态
string updateMainOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{selectRow["workorder_code"]}'";
sqlList.Add(updateSubOrderPrepareSql);
sqlList.Add(updateMainOrderPrepareSql);
}
else //无子单
{
//更新母单状态
string updateMainOrderPrepareSql = $"update mes_prepare set status = 'L1' where workorder_code = '{selectRow["workorder_code"]}'";
sqlList.Add(updateMainOrderPrepareSql);
}
}
#endregion
#region 批次报工状态更新
//添加批次报工状态更新--2023-12-26
string updateBatchOrderStatusSql = $@"update pro_order_workorder_batch set status = '0', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_id = '{selectRow["workorder_id"]}' and batch_code = '{batchCode}' ";
sqlList.Add(updateBatchOrderStatusSql);
#endregion
return sqlList;//> 0 ? true : false;
}
List<string> workReports = new List<string>();
public List<string> GetAllWorkReportsForOrderAndChildren(string orderId, DataRowView selectRow, string orderQuntity, string reportCode, string costCenter, string batchCode,
string isEndReport, string deviceCode, string lineName, string workCount, Dictionary<int, string> workTimeDic, Dictionary<int, string> userCountDic,int sortNo)
{
//获取子工单的信息
string getSubOrderSql = $"select workorder_code,product_code,product_name,quantity_split,unit from pro_order_workorder where parent_order = '{orderId}'";
string subOrder = "";
string subProductCode = "";
string subProductName = "";
string subQuntity = "";
string subUnit = "";
DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
if (dtSubOrder != null && dtSubOrder.Tables.Count > 0 && dtSubOrder.Tables[0].Rows.Count > 0)
{
subOrder = dtSubOrder.Tables[0].Rows[0]["workorder_code"].ToString();
subProductCode = dtSubOrder.Tables[0].Rows[0]["product_code"].ToString();
subProductName = dtSubOrder.Tables[0].Rows[0]["product_name"].ToString();
subQuntity = dtSubOrder.Tables[0].Rows[0]["quantity_split"].ToString();
subUnit = dtSubOrder.Tables[0].Rows[0]["unit"].ToString();
double rate = Convert.ToDouble(workCount) / Convert.ToDouble(orderQuntity);
double subOrderQty = rate * Convert.ToDouble(subQuntity);
string subOrderSql = $@"INSERT INTO [dbo].[mes_report_work]
([id], [report_type], [report_code], [workorder_code], [product_code], [product_name],
[spec], [unit], [quantity], [quantity_feedback], [quantity_qualified], [quantity_unqualified],
[user_name], [nick_name], [feedback_channel], [feedback_time], [record_user], [status],
[remark], [work_time], [machine_code], [machine_name], [team_code], [shift_code],
[attr1], [attr2], [attr3], [attr4], [create_by], [create_time],
[update_time], [update_by], [upload_status], [upload_msg], [prod_type],
[use_man], [work_center],[del_flag],[batch],[end_report],[parent_order],[IP],[version])
VALUES
('{Common.GetUUID()}', 'SELF', '{reportCode}', '{subOrder}', '{subProductCode}', '{subProductName}',
'{selectRow["product_spc"]}', '{subUnit}', {selectRow["batch_quantity"]}, {subOrderQty}, 0, 0,
'{LoginUser.UserCode}', '{LoginUser.UserName}', 'PC', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', 'PREPARE',
'无', '{workTimeDic[sortNo]}', '{deviceCode}', '{lineName}', N'{LoginUser.TeamCode}', '{selectRow["shift_id"]}',
NULL, NULL, NULL, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',
'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}', '{LoginUser.UserName}', '0', NULL, 'prod',
{userCountDic[sortNo]}, '{costCenter}','0','{batchCode}','{isEndReport}','{selectRow["workorder_code"]}','{LoginUser.CurrDeviceIP}','{LoginUser.Version}');";
workReports.Add(subOrderSql);
sortNo++;
GetAllWorkReportsForOrderAndChildren(subOrder, selectRow, orderQuntity, reportCode, costCenter, batchCode, isEndReport, deviceCode, lineName, subQuntity, workTimeDic, userCountDic, sortNo);
}
return workReports;
}
public bool ChangeShiftsInfo(string deviceCode)
{
//
@ -555,7 +781,7 @@ VALUES
/// <param name="selectedRow"></param>
/// <param name="newReportCode"></param>
/// <param name="siteCode"></param>
public bool InsertConsumeInfo(string qty, string remark, DataRowView selectedRow, string newReportCode, string siteCode,string recoil,string parentOrder)
public bool InsertConsumeInfo(string qty, string remark, DataRowView selectedRow, string newReportCode, string siteCode, string recoil, string parentOrder)
{
string sql = $@" INSERT INTO [dbo].[mes_report_work_consume]
([record_id], [workorder_code], [material_code], [material_name], [material_spc],
@ -578,7 +804,7 @@ VALUES
return ret > 0 ? true : false;
}
public bool InsertConsumeInfo(DataRowView selectedConsumeRow,string newReportCode, string siteCode)
public bool InsertConsumeInfo(DataRowView selectedConsumeRow, string newReportCode, string siteCode)
{
string sql = $@" INSERT INTO [dbo].[mes_report_work_consume]
([record_id], [workorder_code], [material_code], [material_name], [material_spc],
@ -610,6 +836,33 @@ VALUES
return sql;
}
public DataTable GetFatherOrderUserCount(string orderCode)
{
string sql = $@"SELECT top 1 use_man FROM [dbo].[mes_report_work] where workorder_code = '{orderCode}' order by create_time";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
public DataTable GetSubOrderCount(string orderCode)
{
//获取子工单的信息
string getSubOrderSql = $"select workorder_code,product_code,product_name,quantity_split,unit from pro_order_workorder where parent_order = '{orderCode}'";
DataSet dtSubOrder = Utils.netClientDBHelper.getDataSet(getSubOrderSql);
if (dtSubOrder != null && dtSubOrder.Tables.Count > 0 && dtSubOrder.Tables[0].Rows.Count > 0)
{
return dtSubOrder.Tables[0];
}
return null;
}
/// <summary>
/// 根据设备编码获取当前机台最新的吊满的RFID信息
/// </summary>

@ -11,6 +11,7 @@ using System.Data.SqlClient;
using MySql.Data.MySqlClient;
using CommonFunc.Tools;
using XGL.Models.Model;
namespace XGL.Dats.DBServiceFinishProd
{
@ -181,7 +182,7 @@ where CONVERT(VARCHAR(10), create_time , 120)= CONVERT(VARCHAR(10), GetDate() ,
public DataTable GetCosumeData(string workorder)
{
string sql = $@"select '0' as qty,'' as remark, workorder_code, material_code,material_name,detail.prod_type,material_spc,detail.unit,quantity,
string sql = $@"select '0' as qty,'' as remark, workorder_code, SUBSTRING(material_code, 8, LEN(material_code)) as material_code1,material_code,material_name,detail.prod_type,material_spc,detail.unit,quantity,
detail.create_by,detail.create_time,detail.update_by,detail.update_time,locator,need_date,
recoil,fund_quanlity,detail.del_flag,parent_work_order
from mes_prepare_detail detail
@ -205,6 +206,19 @@ where detail.parent_work_order ='{workorder}' and detail.del_flag = '0'";
}
return null;
}
//根据线体查询成本中心
public DataTable GetCostCenter(string deviceCode)
{
string sql = $"SELECT workshop_code as factory_code,workshop_name as factory_name FROM [dbo].[base_equipment] where equipment_code = '{deviceCode}';";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
public DataTable piciGetCostCenter(string workorder)
{
string sql = $" SELECT batch_code FROM pro_order_workorder_batch WHERE workorder_id='{workorder}' AND del_flag='0'";
@ -515,12 +529,13 @@ select a.TrayCode,a.ProductBarNo,a.carcode,a.createtime,a.lineno,b.HadNumber
public DataTable GetWetPlanInfo(string deviceCode, string date)
{
string sql = $@"select workorder.factory_code,workorder.product_date as plan_time, workorder.workorder_id,workorder.workorder_code, product_code,product_name,
product_spc,shifts.shift_desc,prod_line_code,workorder.status,route_code,quantity_split,unit,workorder.shift_id ,batch.batch_code,batch.batch_quantity,sort_no, workorder.parent_order,batch.qc_status,batch.status as batchStatus,workorder_code_sap
product_spc,shifts.shift_desc,prod_line_code,workorder.status,route_code,quantity_split,
unit,workorder.shift_id ,batch.batch_code,batch.batch_quantity,sort_no, workorder.parent_order,batch.qc_status,batch.status as batchStatus,workorder_code_sap,salary_flag
from pro_order_workorder workorder WITH (NOLOCK)
left JOIN base_shifts_t shifts WITH (NOLOCK) on workorder.shift_id = shifts.shift_id
left JOIN pro_order_workorder_batch batch WITH (NOLOCK) on workorder.workorder_id = batch.workorder_id
where 1=1 and batch.del_flag = 0 and workorder.del_flag = 0 and
workorder.parent_order ='0' and CONVERT(VARCHAR(10), workorder.product_date , 120)= CONVERT(VARCHAR(10), '{date}' , 120) and workorder.prod_line_code like '%{deviceCode}%' order by sort_no";
workorder.parent_order ='0' and CONVERT(VARCHAR(10), workorder.product_date , 120)= CONVERT(VARCHAR(10), '{date}' , 120) and workorder.prod_line_code like '%{deviceCode}%' order by sort_no,batch_code";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
@ -530,6 +545,25 @@ where 1=1 and batch.del_flag = 0 and workorder.del_flag = 0 and
return null;
}
/// <summary>
/// 根据线体、产品获取工序列表
/// </summary>
/// <param name="deviceCode"></param>
/// <param name="date"></param>
/// <returns></returns>
public DataTable GetProductStepListInfo(string deviceCode, string productCode)
{
string sql = $@"SELECT childprocess_code,childprocess_name FROM [dbo].[mes_unit_price]
where product_code = '{productCode.Replace("0000000","")}' and line_code = '{deviceCode}' ORDER BY childprocess_code";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
public DataTable GetSubOrderInfo(string workorderID)
{
@ -547,6 +581,87 @@ where 1=1 and
return null;
}
/// <summary>
/// 根据线体、产品获取工序列表
/// </summary>
/// <param name="deviceCode"></param>
/// <param name="date"></param>
/// <returns></returns>
public DataTable GetUnitPriceData(string deviceCode)
{
string sql = $@"select [workorder_code], [workorder_code_sap], [product_name], SUBSTRING([product_code], 8, LEN(product_code)) as product_code, [user_name], [nick_name], [childprocess_code], [childprocess_name] ,[create_by], [create_time], [line_code]
from mes_unitprice_report
where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = CONVERT(VARCHAR(10),GETDATE(), 120) ORDER BY childprocess_code,create_time";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return dtset.Tables[0];
}
return null;
}
/// <summary>
/// 生成计件薪酬数据
/// </summary>
/// <param name="item"></param>
/// <exception cref="NotImplementedException"></exception>
public string GetCreateUnitPriceInfo(sys_user item,string workorderCode, string sapWorkorderCode,string productCode,string productName,string childProcessCode,string childProcessName,string deviceCode)
{
string sql = $@"INSERT INTO [dbo].[mes_unitprice_report] (
[id],[workorder_code], [workorder_code_sap], [product_name], [product_code],
[user_name], [nick_name], [childprocess_code], [childprocess_name], [attr1],
[attr2], [attr3], [create_by], [create_time], [update_by],
[update_time], [remark] ,[line_code]
)
VALUES
(
'{Common.GetUUID()}', '{workorderCode}','{sapWorkorderCode}', '{productName}', '{productCode}',
N'{item.user_name}', N'{item.nick_name}', N'{childProcessCode}', N'{childProcessName}', NULL,
NULL, NULL, '{LoginUser.UserName}', getdate(), NULL,
NULL, NULL,'{deviceCode}' );";
return sql;
}
public string GetUpdateUnitPriceSql(string workOrderCode)
{
string updateOrderSql = $@"update pro_order_workorder set salary_flag = '1', update_by = '{LoginUser.UserName}',update_time = GETDATE() where workorder_code = '{workOrderCode}' ";
return updateOrderSql;
}
public bool ExecuteCreateUnitPriceSql(List<string> reportWorkSqlList)
{
bool issucc = Utils.netClientDBHelper.executeBatchSql(reportWorkSqlList);
return issucc;
}
public bool IsExistData(string workOrderCode, string childprocessCode, string deviceCode)
{
string sql = $@"select * from mes_unitprice_report where line_code = '{deviceCode}' and workorder_code = '{workOrderCode}' and childprocess_code = '{childprocessCode}'";
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
return true;
}
return false;
}
public bool DelUnitPriceData(string workOrderCode, string childprocessCode, string deviceCode)
{
string sql = $@"delete mes_unitprice_report where line_code = '{deviceCode}' and workorder_code = '{workOrderCode}' and childprocess_code = '{childprocessCode}'";
int i = Utils.netClientDBHelper.executeUpdate(sql);
bool issucc = i > 0 ? true : false;
return issucc;
}
public string GetDelUnitPriceData(string workOrderCode, string childprocessCode, string deviceCode)
{
string sql = $@"delete mes_unitprice_report where line_code = '{deviceCode}' and workorder_code = '{workOrderCode}' and childprocess_code = '{childprocessCode}'";
return sql;
}
public List<BaseEquipment> GeteqmentInfo()
{
@ -714,7 +829,7 @@ where detail.parent_work_order = '{processid}'"; //where CONVERT(VARCHAR(10), w
}
return null;
}
/// <summary>
/// 更新湿料计划同步状态、工单状态
/// </summary>
@ -3181,6 +3296,14 @@ left join basedata_plcsetting f on a.PlcId5=f.Id
return Items;
}
// /// <summary>
// /// 获取物料bom列表
// /// </summary>

@ -70,6 +70,8 @@
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Management" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Controls.Ribbon" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />

@ -1 +1 @@
9632f572e4e99b96159e5a32041c3dab14c406f4801ba34f3987b9c789ca7320
2df19547b61eec50ce5622f682c721677c5685d3e9c6b57b48caf94d220efa28

@ -338,6 +338,21 @@ namespace XGL.Data
return issuccess;//lst.Count > 0 ? true : false;
}
public List<sys_user> GetUserList()
{
string sql = $"select * from sys_user ";
DataTable dt = Utils.cloudDBHelper.getDataSet(sql).Tables[0];
var lst = Utils.ToDataList<sys_user>(dt);
if (lst.Count > 0)
{
return lst;
}
return null;//lst.Count > 0 ? true : false;
}
public bool UpdateWorkDate(string deviceCode,string shiftID, string workDate)
{
string sql = $"update base_equipment set curr_work_date = '{workDate}',curr_shift = '{shiftID}' where equipment_code = '{deviceCode}'";

@ -11,6 +11,10 @@ namespace XGL.Models.Model
/// </summary>
public class sys_user
{
/// <summary>
/// 选中状态
/// </summary>
public bool IsChecked { get; set; }
/// <summary>
/// 编码
/// </summary>

@ -12,7 +12,7 @@
<!--设备编码-->
<add key="DeviceCode" value="C3" />
<!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录-->
<add key="ClientMode" value="1" />
<add key="ClientMode" value="0" />
<add key="SerialPort" value="COM5" />
<add key="DryingHouseList" value="H16,H17,H18"/>
<!--线体编码-->

@ -165,6 +165,7 @@ namespace XGLFinishPro
bw.ReportProgress(1);
bool islogin = usdb.Login(ul.username, ul.pwd, ul.shiftID,ul.teamID,ul.workDate, ul.startTime, ul.endTime);
Utils.userList = usdb.GetUserList();
if (islogin)
{
usdb.UpdateWorkDate(deviceCode,ul.shiftID,ul.workDate);

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace XGLFinishPro.Tools
{
public class NumericValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
double result;
if (double.TryParse(value as string, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
{
return ValidationResult.ValidResult;
}
else
{
return new ValidationResult(false, "Invalid numeric value");
}
}
}
}

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace XGLFinishPro.Tools
{
public class ValidationHelper
{
public static readonly DependencyProperty ErrorProperty =
DependencyProperty.RegisterAttached("Error", typeof(string), typeof(ValidationHelper), new PropertyMetadata(null));
public static string GetError(DependencyObject obj)
{
return (string)obj.GetValue(ErrorProperty);
}
public static void SetError(DependencyObject obj, string value)
{
obj.SetValue(ErrorProperty, value);
}
}
}

@ -4,8 +4,9 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:XGLFinishPro.Views"
xmlns:convert="clr-namespace:XGLFinishPro.Tools"
mc:Ignorable="d"
Title="CheckUserWin" Height="850" Width="1350" WindowStartupLocation="CenterScreen" WindowStyle="None" Loaded="Window_Loaded">
Title="CheckUserWin" Height="950" Width="1350" WindowStartupLocation="CenterScreen" WindowStyle="None" Loaded="Window_Loaded">
<Window.Resources>
<!--ComboBox下拉按钮-->
<Style TargetType="ToggleButton" x:Key="ComboxStyleBtn">
@ -42,7 +43,7 @@
<Style TargetType="ComboBoxItem">
<Setter Property="Height" Value="60"></Setter>
<Setter Property="MinHeight" Value="22"></Setter>
<Setter Property="MinWidth" Value="60"></Setter>
<Setter Property="MinWidth" Value="60"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
@ -96,7 +97,9 @@
</Setter>
</Style>
<Style TargetType="TextBox">
<Setter Property="Height" Value="50"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Margin" Value="5"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style TargetType="Label">
@ -109,8 +112,92 @@
<Setter Property="BorderThickness" Value="0 0 1 1" />
<Setter Property="BorderBrush" Value="LightGray" />
</Style>
<SolidColorBrush x:Key="EvenRowBackground" Color="#E0E0E0"/>
<SolidColorBrush x:Key="OddRowBackground" Color="#FFFFFF"/>
<Style x:Key="DataGridRowStyle" TargetType="DataGridRow">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="{StaticResource EvenRowBackground}"/>
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="{StaticResource OddRowBackground}"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="350"/>
<RowDefinition Height="550"/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.ColumnSpan="2" x:Name="lbTitle" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="报工" FontWeight="Bold"></Label>
<ScrollViewer x:Name="scrollViewer" Grid.Row="1" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid x:Name="MyGrid" Grid.Row="1" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="1">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="当前工单:"></Label>
<Label x:Name="lbCurrOrderNo" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="202311010001" Width="260"></Label>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="报工数量:"></Label>
<TextBox x:Name="txtQuantity" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="260" TextChanged="txtQuantity_TextChanged"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="2">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="工 时:"></Label>
<TextBox x:Name="txtWorkTime" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="260" TextChanged="txtWorkTime_TextChanged"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="人 数:"></Label>
<TextBox x:Name="txtUserCount" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="260" TextChanged="txtUserCount_TextChanged"></TextBox>
</StackPanel>
<!--<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="3" Grid.Column="1">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="母单人数:"></Label>
<TextBox x:Name="txtFOUserCount" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="260" TextChanged="txtFOUserCount_TextChanged"></TextBox>
</StackPanel>-->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="12" Grid.Column="0" Grid.ColumnSpan="2">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="成本中心:"></Label>
<ComboBox x:Name="comboBoxCostCenter" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="360" Height="50"
Style="{StaticResource ComboBoxStyle}" SelectionChanged="comboBoxCostCenter_SelectionChanged"></ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="13" Grid.Column="0" Grid.ColumnSpan="2">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="批 次 号:"></Label>
<ComboBox x:Name="comboBoxBatch" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Margin="2,5,0,0" Width="360" Height="50" Style="{StaticResource ComboBoxStyle}"></ComboBox>
<Label Content="* 不选批次号则默认为该工单报工" Foreground="Red" VerticalAlignment="Center"></Label>
</StackPanel>
</Grid>
</ScrollViewer>
<!--<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF2281D1"></GradientStop>
@ -118,97 +205,77 @@
<GradientStop Color="AliceBlue" Offset="1"></GradientStop>
</LinearGradientBrush>
</Grid.Background>-->
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition Height="400"/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Label Grid.ColumnSpan="2" x:Name="lbTitle" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="报工" FontWeight="Bold"></Label>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="1">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="当前工单:"></Label>
<Label x:Name="lbCurrOrderNo" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="202311010001" Width="260"></Label>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="1" Grid.Column="1">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="报工数量:"></Label>
<TextBox x:Name="txtQuantity" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="260" TextChanged="txtQuantity_TextChanged"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="2">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="工 时:"></Label>
<TextBox x:Name="txtWorkTime" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="260" TextChanged="txtWorkTime_TextChanged"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="1">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="人 数:"></Label>
<TextBox x:Name="txtUserCount" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="260" TextChanged="txtUserCount_TextChanged"></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="成本中心:"></Label>
<ComboBox x:Name="comboBoxCostCenter" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Width="360" Height="50" Style="{StaticResource ComboBoxStyle}" SelectionChanged="comboBoxCostCenter_SelectionChanged"></ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2">
<Label Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Content="批 次 号:"></Label>
<ComboBox x:Name="comboBoxBatch" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="24" Margin="2,0,0,0" Width="360" Height="50" Style="{StaticResource ComboBoxStyle}"></ComboBox>
<Label Content="* 不选批次号则默认为该工单报工" Foreground="Red" VerticalAlignment="Center"></Label>
</StackPanel>
<DataGrid x:Name="dgConsumeInfo" Grid.Row="5" Grid.ColumnSpan="2" Background="#0000"
<Grid Grid.Row="2" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="400"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<DataGrid x:Name="dgConsumeInfo" Grid.Row="0" Grid.ColumnSpan="2" Background="#0000"
LoadingRow="dgConsumeInfo_LoadingRow"
CanUserAddRows="False"
AutoGenerateColumns="False"
HeadersVisibility="Column"
SelectionMode="Single"
SelectionMode="Single"
CellEditEnding="dgConsumeInfo_CellEditEnding"
CellStyle="{StaticResource CustomCellStyle}">
<DataGrid.ColumnHeaderStyle >
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="48" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Background" Value="#0000" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header=" 序号" Width="50" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="120" Header="领取数" Binding="{Binding quantity}" IsReadOnly="True" />
<DataGridTextColumn Width="120" Header="用量" Binding="{Binding qty}" IsReadOnly="False">
</DataGridTextColumn>
<DataGridTextColumn Width="150" Header="备注" Binding="{Binding remark}" IsReadOnly="False" />
<DataGridTextColumn Width="250" Header="组件编码" Binding="{Binding material_code}" IsReadOnly="True"/>
<DataGridTextColumn Width="350" Header="组件名称" Binding="{Binding material_name}" IsReadOnly="True"/>
<DataGridTextColumn Width="100" Header="单位" Binding="{Binding unit}" />
<DataGridTextColumn Width="100" Header="反冲标识" Binding="{Binding recoil}"/>
<DataGridTextColumn Width="100" Header="母单" Binding="{Binding parent_work_order}" />
<!--<DataGridTextColumn Width="250" Header="物料组" Binding="{Binding productGroup}" IsReadOnly="True"/>
<DataGridTextColumn Width="250" Header="组名称" Binding="{Binding productGroupName}" IsReadOnly="True"/>-->
</DataGrid.Columns>
</DataGrid>
<Label x:Name="tbMsg" Width="600" Height="60" Grid.Row="6" Grid.ColumnSpan="2" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" FontSize="24" Foreground="Red" FontWeight="Bold"></Label>
<CheckBox Content="最终报工" Height="auto" Margin="15,0,0,0" FontSize="10" ToolTip="选择后将结束该工单" Grid.Row="6" IsChecked="False" HorizontalAlignment="Left" VerticalContentAlignment="Center" Name="xuanze9" Checked="xuanze9_Checked">
<CheckBox.LayoutTransform >
<ScaleTransform ScaleX="2" ScaleY="2" />
</CheckBox.LayoutTransform>
</CheckBox>
<Button x:Name="btnOK" Grid.Row="7" Grid.Column="0" Width="120" Height="43" Content="确定" Margin="3,-20,0,0" Background="#2F82E7" Foreground="White" FontSize="22" FontWeight="Bold" Click="btnOK_Click"/>
<Button x:Name="btnCancel" Grid.Row="7" Grid.Column="1" Width="120" Height="43" Content="取消" Margin="3,-20,0,0" FontWeight="Bold" FontSize="22" Click="btnCancel_Click"/>
RowStyle="{StaticResource DataGridRowStyle}"
CellStyle="{StaticResource CustomCellStyle}" MinRowHeight="35">
<DataGrid.ColumnHeaderStyle >
<!--<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="48" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Background" Value="#0000" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Gray" />
</Style>-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="48" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#2B7EE6" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Header=" 序号" Width="50" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="250" Header="组件编码" Binding="{Binding material_code1}" IsReadOnly="True"/>
<DataGridTextColumn Width="250" Header="组件编码" Binding="{Binding material_code}" Visibility="Hidden" IsReadOnly="True"/>
<DataGridTextColumn Width="350" Header="组件名称" Binding="{Binding material_name}" IsReadOnly="True"/>
<DataGridTextColumn Width="100" Header="单位" Binding="{Binding unit}" />
<DataGridTextColumn Width="100" Header="反冲标识" Binding="{Binding recoil}"/>
<DataGridTextColumn Width="120" Header="领取数" Binding="{Binding quantity}" IsReadOnly="True" />
<DataGridTextColumn Width="120" Header="用量" Binding="{Binding qty}" IsReadOnly="False">
</DataGridTextColumn>
<DataGridTextColumn Width="100" Header="母单" Binding="{Binding parent_work_order}" />
<DataGridTextColumn Width="150" Header="备注" Binding="{Binding remark}" IsReadOnly="False" />
<!--<DataGridTextColumn Width="250" Header="物料组" Binding="{Binding productGroup}" IsReadOnly="True"/>
<DataGridTextColumn Width="250" Header="组名称" Binding="{Binding productGroupName}" IsReadOnly="True"/>-->
</DataGrid.Columns>
</DataGrid>
<Label x:Name="tbMsg" Width="600" Height="60" Grid.Row="1" Grid.ColumnSpan="2" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" FontSize="24" Foreground="Red" FontWeight="Bold"></Label>
<CheckBox Content="最终报工" Height="auto" Margin="15,0,0,0" FontSize="10" ToolTip="选择后将结束该工单" Grid.Row="1" IsChecked="False" HorizontalAlignment="Left" VerticalContentAlignment="Center" Click="xuanze9_Click" Name="xuanze9" Checked="xuanze9_Checked">
<CheckBox.LayoutTransform >
<ScaleTransform ScaleX="2" ScaleY="2" />
</CheckBox.LayoutTransform>
</CheckBox>
<Button x:Name="btnOK" Grid.Row="2" Grid.Column="0" Width="120" Height="43" Content="确定" Margin="3,-20,0,0" Background="#2F82E7" Foreground="White" FontSize="22" FontWeight="Bold" Click="btnOK_Click"/>
<Button x:Name="btnCancel" Grid.Row="2" Grid.Column="1" Width="120" Height="43" Content="取消" Margin="3,-20,0,0" FontWeight="Bold" FontSize="22" Click="btnCancel_Click"/>
</Grid>
</Grid>
</Window>

@ -4,6 +4,7 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@ -21,6 +22,7 @@ using XGL.Data;
using XGL.Data.DBService;
using XGL.Dats.DBServiceFinishProd;
using XGL.Models.Model.OrderPrepare;
using XGLFinishPro.Tools;
namespace XGLFinishPro.Views
{
@ -42,7 +44,7 @@ namespace XGLFinishPro.Views
public string _workOrderId = "";
public string batchCode = "";
public bool? _isEndReport = false;
public string _deviceCode = "";
public string _deviceCode = "";
public string _siteCode = "";
DataRowView selectedRow = null;
@ -51,7 +53,7 @@ namespace XGLFinishPro.Views
InitializeComponent();
}
public ExecReportWorkWin(string workOrder, string quantity,string workOrdercode, string batch_code, string siteCode)
public ExecReportWorkWin(string workOrder, string quantity, string workOrdercode, string batch_code, string siteCode)
{
InitializeComponent();
this._workOrdercode = workOrdercode;
@ -60,7 +62,7 @@ namespace XGLFinishPro.Views
this.comboBoxBatch.Text = batch_code;
_siteCode = siteCode;
}
public ExecReportWorkWin(DataRowView _selectedRow,string deviceCode, string siteCode)
public ExecReportWorkWin(DataRowView _selectedRow, string deviceCode, string siteCode)
{
InitializeComponent();
//if (_selectedRow["parent_order"].ToString() == "0")
@ -88,64 +90,89 @@ namespace XGLFinishPro.Views
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
{
this.DialogResult = false;
this.Close();
}
private async void btnOK_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(this.txtQuantity.Text))
try
{
this.tbMsg.Content = "报工数量不能为空";
this.txtQuantity.Focus();
return;
}
if (string.IsNullOrEmpty(this.txtWorkTime.Text))
{
this.tbMsg.Content = "工时数量不能为空";
this.txtWorkTime.Focus();
return;
}
if (string.IsNullOrEmpty(this.txtUserCount.Text))
{
this.tbMsg.Content = "人数数量不能为空";
this.txtUserCount.Focus();
return;
}
if (string.IsNullOrEmpty(this.txtQuantity.Text))
{
this.tbMsg.Content = "报工数量不能为空";
this.txtQuantity.Focus();
return;
}
if (string.IsNullOrEmpty(this.txtWorkTime.Text))
{
this.tbMsg.Content = "工时数量不能为空";
this.txtWorkTime.Focus();
return;
}
if (string.IsNullOrEmpty(this.txtUserCount.Text))
{
this.tbMsg.Content = "人数数量不能为空";
this.txtUserCount.Focus();
return;
}
if (string.IsNullOrEmpty(this.comboBoxCostCenter.SelectedValue.ToString()))
if (string.IsNullOrEmpty(this.comboBoxCostCenter.SelectedValue.ToString()))
{
this.tbMsg.Content = "成本中心不能为空";
this.comboBoxCostCenter.Focus();
return;
}
if (!Regex.IsMatch(this.txtQuantity.Text, @"^\d+(\.\d+)?$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "报工数量非法字符!";
this.txtQuantity.Focus();
return;
}
if (!Regex.IsMatch(this.txtWorkTime.Text, @"^\d+(\.\d+)?$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "工时含有非法字符!";
this.txtWorkTime.Focus();
return;
}
if (!Regex.IsMatch(this.txtUserCount.Text, @"^\d+$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "人数含有非法字符!";
this.txtUserCount.Focus();
return;
}
if (!CheckWorkTimeDynamicTextBox())
{
return;
}
if (!CheckUserCountDynamicTextBox())
{
return;
}
if (comboBoxBatch.Items.Count <= 2)//小于等于2的时候代表只有一个批次必须最终报工
{
if (_isEndReport == false)
{
this.tbMsg.Content = "该工单只有一个批次,必须勾选最终报工!";
// return;
}
}
}
catch (Exception ex)
{
this.tbMsg.Content = "成本中心不能为空";
this.comboBoxCostCenter.Focus();
return;
}
if (!Regex.IsMatch(this.txtQuantity.Text, @"^\d+(\.\d+)?$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "报工数量非法字符!";
this.txtQuantity.Focus();
return;
}
if (!Regex.IsMatch(this.txtWorkTime.Text, @"^\d+(\.\d+)?$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "工时含有非法字符!";
this.txtWorkTime.Focus();
return;
}
if (!Regex.IsMatch(this.txtUserCount.Text, @"^\d+$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "人数含有非法字符!";
this.txtUserCount.Focus();
CustomMessageBox.Show("报工检验数据有效性时发生了异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
LogHelper.instance.log.Error("报工检验数据有效性时发生了异常:" + ex.Message);
return;
}
_useMan = this.txtUserCount.Text;
_workTime = this.txtWorkTime.Text;
_costCenter = this.comboBoxCostCenter.SelectedValue.ToString();
@ -170,7 +197,7 @@ namespace XGLFinishPro.Views
else
{
CustomMessageBox.Show("报工失败", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
LogHelper.instance.log.Error("报工失败:" +selectedRow["workorder_code"]);
LogHelper.instance.log.Error("报工失败:" + selectedRow["workorder_code"]);
}
}
catch (Exception ex)
@ -195,20 +222,67 @@ namespace XGLFinishPro.Views
else
{
CustomMessageBox.Show("报工失败", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
}
}
}
catch (Exception ex)
{
CustomMessageBox.Show("报工失败"+ ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
LogHelper.instance.log.Error("报工失败:" + ex.Message);
}
}
}
}
}
private bool ReportWork()
private bool CheckUserCountDynamicTextBox()
{
dicUserCount.Clear();
bool isScucc = false;
for (int i = 0; i < dynamicUserCountTextBoxes.Count; i++)
{
if (!Regex.IsMatch(dynamicUserCountTextBoxes[i + 1].Text, @"^\d+$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "人员数量含有非法字符!";
dynamicUserCountTextBoxes[i].Focus();
isScucc = false;
}
else
{
dicUserCount.Add(i, dynamicUserCountTextBoxes[i + 1].Text);
this.tbMsg.Content = "";
isScucc = true;
}
}
return isScucc;
}
private bool CheckWorkTimeDynamicTextBox()
{
dicWorkTime.Clear();
bool isScucc = false;
for (int i = 0; i < dynamicWorkTimeTextBoxes.Count; i++)
{
if (!Regex.IsMatch(dynamicWorkTimeTextBoxes[i+1].Text, @"^\d+(\.\d+)?$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "工时含有非法字符!";
dynamicWorkTimeTextBoxes[i].Focus();
isScucc = false;
}
else
{
dicWorkTime.Add(i, dynamicWorkTimeTextBoxes[i+1].Text);
this.tbMsg.Content = "";
isScucc = true;
}
}
return isScucc;
}
private bool ReportWork()
{
//获取报工编码
string newReportCode = "";
@ -231,7 +305,7 @@ namespace XGLFinishPro.Views
string isEndReport = _isEndReport == true ? "1" : "0";
//bool issucc = formingMachineService.ExecuteReportWork(selectedRow, _orderQuntity, _workQuntity, newReportCode, _workTime, _useMan, _costCenter, batchCode, isEndReport, _deviceCode);
List<string> reportWorkSqlList = formingMachineService.GetExecuteReportWorkSql(selectedRow, _orderQuntity, _workQuntity, newReportCode, _workTime, _useMan, _costCenter, batchCode, isEndReport, _deviceCode);
List<string> reportWorkSqlList = formingMachineService.GetExecuteReportWorkSql(selectedRow, _orderQuntity, _workQuntity, newReportCode, _workTime, _useMan, _costCenter, batchCode, isEndReport, _deviceCode, dicWorkTime, dicUserCount);
if (reportWorkSqlList.Count > 0)
{
//报工接口不用调了
@ -250,7 +324,7 @@ namespace XGLFinishPro.Views
//if (result.code == 200)
//{
return AddConsumInfo(reportWorkSqlList, newReportCode);
return AddConsumInfo(reportWorkSqlList, newReportCode);
//}
//else
//{
@ -264,7 +338,7 @@ namespace XGLFinishPro.Views
}
}
private bool AddConsumInfo(List<string> reportWorkSqlList ,string newReportCode)
private bool AddConsumInfo(List<string> reportWorkSqlList, string newReportCode)
{
try
{
@ -277,9 +351,9 @@ namespace XGLFinishPro.Views
foreach (var row in dgConsumeInfo.Items)
{
var selectedConsumeRow = (row as DataRowView);
var qty = selectedConsumeRow["qty"].ToString() == ""?"0": selectedConsumeRow["qty"].ToString();
var qty = selectedConsumeRow["qty"].ToString() == "" ? "0" : selectedConsumeRow["qty"].ToString();
var remark = selectedConsumeRow["remark"].ToString();
string insertConsumeSql = formingMachineService.GetInsertConsumeInfoSql(selectedConsumeRow, newReportCode, _siteCode);
reportWorkSqlList.Add(insertConsumeSql);
//// 获取 DataGridRow
@ -311,20 +385,20 @@ namespace XGLFinishPro.Views
//}
}
}
bool isReportSuccess = formingMachineService.GetExecuteReportWorkSql(reportWorkSqlList);
return isReportSuccess; ;
}
catch (Exception ex)
{
LogHelper.instance.log.Error("报工失败:生成消耗数据发生异常:" + ex.Message);
CustomMessageBox.Show("报工失败:生成消耗数据发生异常:"+ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
CustomMessageBox.Show("报工失败:生成消耗数据发生异常:" + ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
return false;
throw ex;
}
}
}
private void pw_PasswordChanged(object sender, RoutedEventArgs e)
@ -333,12 +407,216 @@ namespace XGLFinishPro.Views
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
{
GetFatherOrderUserCount();
InitComBoboxData();
piciInitComBoboxData();
InitConsumeData();
}
private void GetFatherOrderUserCount()
{
string workOrder = this.lbCurrOrderNo.Content.ToString();
//DataTable dt = formingMachineService.GetSubOrderCount(workOrder);
//if (dt == null)
//{
// this.txtFOUserCount.Visibility = Visibility.Collapsed;
// this.txtFOUserCount.IsEnabled = true;
//}
//else
//{
// this.txtFOUserCount.Text = "4";
// this.txtFOUserCount.IsEnabled = false;
//}
GetSubOrder(workOrder);
//string workOrder = this.lbCurrOrderNo.Content.ToString();
//DataTable dt = formingMachineService.GetFatherOrderUserCount(workOrder);
//if (dt == null)
//{
// this.txtFOUserCount.IsEnabled = true;
//}
//else
//{
// this.txtFOUserCount.Text = dt.Rows[0][0].ToString();
// this.txtFOUserCount.IsEnabled = false;
//}
}
int sortNo = 0; //定义一个整数,记录子集级数
Dictionary<int, TextBox> dynamicWorkTimeTextBoxes = new Dictionary<int, TextBox>();
Dictionary<int, TextBox> dynamicUserCountTextBoxes = new Dictionary<int, TextBox>();
Dictionary<int, string> dicWorkTime = new Dictionary<int, string>();
Dictionary<int, string> dicUserCount = new Dictionary<int, string>();
private bool GetSubOrder(string workorderID)
{
try
{
sortNo++;
DataTable dtSubOrders = userDbWareHouse.GetSubOrderInfo(workorderID);
if (dtSubOrders != null)
{
string sort = "";
switch (sortNo)
{
case 1:
sort = "一"; break;
case 2:
sort = "二"; break;
case 3:
sort = "三"; break;
case 4:
sort = "四"; break;
case 5:
sort = "五"; break;
case 6:
sort = "六"; break;
case 7:
sort = "七"; break;
case 8:
sort = "八"; break;
case 9:
sort = "九"; break;
case 10:
sort = "10"; break;
case 11:
sort = "11"; break;
case 12:
sort = "12"; break;
default:
sortNo.ToString();
break;
}
//if (sortNo == 2)
//{
// StackPanel myStackPanelWorkTime = new StackPanel(); // 假设已经有一个StackPanel实例
// myStackPanelWorkTime.Orientation = Orientation.Horizontal;
// Label lbl = new Label();
// lbl.FontSize = 24;
// lbl.VerticalAlignment = VerticalAlignment.Center;
// lbl.HorizontalAlignment = HorizontalAlignment.Left;
// lbl.Content = "第" + sortNo + "工时:";
// TextBox textBox = new TextBox();
// textBox.FontSize = 24;
// textBox.Width = 260;
// textBox.VerticalAlignment = VerticalAlignment.Center;
// textBox.HorizontalAlignment = HorizontalAlignment.Left;
// textBox.TextChanged += TextBox_TextChanged;
// myStackPanelWorkTime.Children.Add(lbl);
// myStackPanelWorkTime.Children.Add(textBox);
// Grid.SetRow(myStackPanelWorkTime,3+sortNo);
// Grid.SetColumn(myStackPanelWorkTime, 1);
// MyGrid.Children.Add(myStackPanelWorkTime);
//}
//else
//{
Grid myGrid = (Grid)scrollViewer.Content;
StackPanel myStackPanelWorkTime = new StackPanel(); // 假设已经有一个StackPanel实例
myStackPanelWorkTime.Orientation = Orientation.Horizontal;
//添加工时
Label lbl = new Label();
lbl.FontSize = 24;
lbl.VerticalAlignment = VerticalAlignment.Center;
lbl.HorizontalAlignment = HorizontalAlignment.Left;
lbl.Content = sort + "层工时:";
TextBox textBox = new TextBox();
textBox.FontSize = 24;
textBox.Width = 260;
textBox.TextChanged += TextBox_TextChanged;
textBox.VerticalAlignment = VerticalAlignment.Center;
textBox.HorizontalAlignment = HorizontalAlignment.Left;
//添加人数
Label lblUserCount = new Label();
lblUserCount.FontSize = 24;
lblUserCount.VerticalAlignment = VerticalAlignment.Center;
lblUserCount.HorizontalAlignment = HorizontalAlignment.Left;
lblUserCount.Content = sort + "层人数:";
myStackPanelWorkTime.Children.Add(lbl);
myStackPanelWorkTime.Children.Add(textBox);
Grid.SetRow(myStackPanelWorkTime, 3 + sortNo);
Grid.SetColumn(myStackPanelWorkTime, 0);
myGrid.Children.Add(myStackPanelWorkTime);
//将工时文本框存储到数据字典中
dynamicWorkTimeTextBoxes.Add(sortNo, textBox);
StackPanel myStackPanelWorkTime2 = new StackPanel(); // 假设已经有一个StackPanel实例
myStackPanelWorkTime2.Orientation = Orientation.Horizontal;
TextBox textBoxUserCount = new TextBox();
textBoxUserCount.TextChanged += UserCount_TextChanged;
textBoxUserCount.FontSize = 24;
textBoxUserCount.Width = 260;
textBoxUserCount.VerticalAlignment = VerticalAlignment.Center;
textBoxUserCount.HorizontalAlignment = HorizontalAlignment.Left;
myStackPanelWorkTime2.Children.Add(lblUserCount);
myStackPanelWorkTime2.Children.Add(textBoxUserCount);
Grid.SetRow(myStackPanelWorkTime2, 3 + sortNo);
Grid.SetColumn(myStackPanelWorkTime2, 1);
myGrid.Children.Add(myStackPanelWorkTime2);
//将人数文本框存储到数据字典中
dynamicUserCountTextBoxes.Add(sortNo, textBox);
//stackPanelFather.Children.Add(myStackPanelWorkTime);
//}
// 递归添加控件
GetSubOrder(dtSubOrders.Rows[0]["workorder_code"].ToString());
//// 递归添加控件
//foreach (DataRow subOrder in dtSubOrders.Rows)
//{
// GetSubOrder(subOrder["workorder_code"].ToString());
//}
}
return true;
}
catch (Exception ex)
{
LogHelper.instance.log.Error(ex.Message);
return false;
}
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
TextBox box = sender as TextBox;
if (!Regex.IsMatch(box.Text, @"^\d+(\.\d+)?$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "工时含有非法字符!";
box.Focus();
return;
}
else
{
this.tbMsg.Content = "";
}
}
private void UserCount_TextChanged(object sender, TextChangedEventArgs e)
{
TextBox box = sender as TextBox;
if (!Regex.IsMatch(box.Text, @"^\d+$"))
{
// 输入是一个有效的数字,包括小数
this.tbMsg.Content = "人数含有非法字符!";
box.Focus();
return;
}
else
{
this.tbMsg.Content = "";
}
}
private void InitConsumeData()
{
DataTable dt = userDbWareHouse.GetCosumeData(_workOrdercode);
@ -348,10 +626,10 @@ namespace XGLFinishPro.Views
//CustomMessageBox.Show("没有维护成本中心,请联系管理员!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
//绑定
dgConsumeInfo.ItemsSource = dt.DefaultView;
}
private void txtQuantity_TextChanged(object sender, TextChangedEventArgs e)
@ -401,10 +679,10 @@ namespace XGLFinishPro.Views
private void InitComBoboxData()
{
DataTable dt = userDbWareHouse.GetCostCenter();
if (dt == null)
DataTable dt = userDbWareHouse.GetCostCenter(_deviceCode);
if (dt == null || dt.Rows.Count == 0)
{
CustomMessageBox.Show("没有维护成本中心,请联系管理员!",CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
CustomMessageBox.Show("没有维护成本中心,请联系管理员!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
@ -418,7 +696,7 @@ namespace XGLFinishPro.Views
comboBoxCostCenter.DisplayMemberPath = "factory_name";
comboBoxCostCenter.SelectedIndex = 0;
}
private void piciInitComBoboxData()
private void piciInitComBoboxData()
{
DataTable dt = userDbWareHouse.piciGetCostCenter(this._workOrderId);
if (dt == null)
@ -426,7 +704,7 @@ namespace XGLFinishPro.Views
CustomMessageBox.Show("没有找到批次号,请联系管理员!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
List<string> strings =new List<string>();
List<string> strings = new List<string>();
strings.Add("");
foreach (System.Data.DataRow row in dt.Rows)
{
@ -454,15 +732,73 @@ namespace XGLFinishPro.Views
private void dgConsumeInfo_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
//dgConsumeInfo.CommitEdit();
if (e.EditAction == DataGridEditAction.Commit)
{
if (e.Column is DataGridTextColumn textColumn && e.EditingElement is TextBox textBox)
{
// 获取当前编辑的单元格的行和列索引
int rowIndex = e.Row.GetIndex();
int colIndex = dgConsumeInfo.Columns.IndexOf(textColumn);
// 获取输入的值
string newValue = textBox.Text;
// 执行你的验证逻辑,这里以整数为例
if (!Regex.IsMatch(newValue, @"^\d+(\.\d+)?$"))
{
// 输入的不是整数,可以执行相应的操作,例如还原之前的值或显示错误消息等
CustomMessageBox.Show("请输入整数或者小数!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
// 还原之前的值
dgConsumeInfo.CancelEdit();
// 或者清除输入的值
textBox.Text = string.Empty;
}
}
}
}
private void xuanze9_Checked(object sender, RoutedEventArgs e)
{
_isEndReport = true;
}
private void xuanze9_Click(object sender, RoutedEventArgs e)
{
if (xuanze9.IsChecked == true)
{
_isEndReport = true;
}
else
{
_isEndReport = false;
}
}
//private void txtFOUserCount_TextChanged(object sender, TextChangedEventArgs e)
//{
// if (!Regex.IsMatch(this.txtFOUserCount.Text, @"^\d+$"))
// {
// // 输入是一个有效的数字,包括小数
// this.tbMsg.Content = "母单人数含有非法字符!";
// this.txtFOUserCount.Focus();
// return;
// }
// else
// {
// this.tbMsg.Content = "";
// }
//}
private void dgConsumeInfo_CurrentCellChanged(object sender, EventArgs e)
{
}
}
public class CostCenter
{
{
public string factory_code { get; set; }
public string factory_name { get; set; }
}

@ -17,7 +17,7 @@
<convert:OrderInOutConverter x:Key="TaskCodeConverter"/>
<convert:BtnBackGroundColorConverter x:Key="ButtonContentToBackgroundColorConverter"/>
<convert:ParentOrderConverter x:Key="ParentOrderConverter"/>
<Style x:Key="CustomCellStyle" TargetType="DataGridCell">
<Setter Property="Foreground" Value="Black" />
<Setter Property="TextBlock.TextAlignment" Value="Center" />
@ -52,6 +52,7 @@
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid Background="LightGray" >
@ -153,290 +154,315 @@
<!--#70B603Background="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content, Converter={StaticResource ButtonContentToBackgroundColorConverter}}"-->
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="2"
Height="90" Visibility="Collapsed">
<Button
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" >
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="注销" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="0"
Height="90">
<Button
x:Name="btnPause1"
Click="btnPause1_Click"
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="开始工单" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="1"
Height="90">
<Button
x:Name="btnPause"
Click="btnPause_Click"
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="暂停生产" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="2"
Height="90">
<Button x:Name="btnRecover"
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" Click="btnRecover_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="恢复生产" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="3"
Height="90">
<Button
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6"
Click="Flow_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="查看工艺" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="4"
Height="90">
<Button
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6"
Click="Material_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="查看物料" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="5"
>
<Button
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
Click="Button_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="查看SOP" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="7"
>
<Button
x:Name="btnCheckLog"
Grid.Row="1" Visibility="Hidden"
Grid.Column="5"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="btnCheckLog_Click" Content="查看接口日志"></Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="8"
>
<Button
x:Name="btnViewPlcvalue"
Grid.Row="1" Visibility="Hidden"
Grid.Column="5"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="btnViewPlcvalue_Click" Content="查看Plc值"></Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="9">
<Button
x:Name="HFPlcvalue"
Grid.Row="1" Visibility="Hidden"
Grid.Column="5"
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Background="#F2F3F5" Grid.Row="0"
Grid.ColumnSpan="10" Grid.Column="0" Width="Auto">
<StackPanel Orientation="Horizontal" >
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="2"
Height="90" Visibility="Collapsed">
<Button
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="HFPlcvalue_Click" Content="查看烘房值"></Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="6"
Height="90" Visibility="Visible">
<Button Style="{StaticResource btnKey}"
x:Name="btnComplete"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" Click="btnComplete_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="报工" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="8"
Height="90" Visibility="Collapsed">
<Button Style="{StaticResource btnKey}"
x:Name="btnCallMaterial"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" Click="btnCallMaterial_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="叫料" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="7"
Height="90">
<Button
x:Name="btnFirstCheck"
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" Click="btnFirstCheck_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="首检确认" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="8"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" >
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="注销" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="0"
Height="90">
<Button
x:Name="btnPause1"
Click="btnPause1_Click"
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="开始工单" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="1"
Height="90">
<Button
x:Name="btnPause"
Click="btnPause_Click"
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="暂停生产" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="2"
Height="90">
<Button x:Name="btnRecover"
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" Click="btnRecover_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="恢复生产" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="3"
Height="90">
<Button
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6"
Click="Flow_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="查看工艺" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="4"
Height="90">
<Button
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6"
Click="Material_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="查看物料" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="5" Visibility="Visible">
<Button
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
Click="Button_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="查看SOP" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="6"
>
<Button
x:Name="btnMachineRepair"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="btnMachineRepair_Click" Content="报修"></Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="9"
>
<Button
x:Name="btnRefresh"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="btnRefresh_Click" Content="刷新"></Button>
</StackPanel>
<Button x:Name="btnSalaryCal"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
Click="btnSalaryCal_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="计件薪酬" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="7"
>
<Button
x:Name="btnCheckLog"
Grid.Row="1" Visibility="Collapsed"
Grid.Column="5"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="btnCheckLog_Click" Content="查看接口日志"></Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="8"
>
<Button
x:Name="btnViewPlcvalue"
Grid.Row="1" Visibility="Collapsed"
Grid.Column="5"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="btnViewPlcvalue_Click" Content="查看Plc值"></Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="9">
<Button
x:Name="HFPlcvalue"
Grid.Row="1" Visibility="Collapsed"
Grid.Column="5"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="HFPlcvalue_Click" Content="查看烘房值"></Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="6"
Height="90" Visibility="Visible">
<Button Style="{StaticResource btnKey}"
x:Name="btnComplete"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" Click="btnComplete_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="报工" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="8"
Height="90" Visibility="Collapsed">
<Button Style="{StaticResource btnKey}"
x:Name="btnCallMaterial"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" Click="btnCallMaterial_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="叫料" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="7"
Height="90">
<Button
x:Name="btnFirstCheck"
Style="{StaticResource btnKey}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#2B7EE6" Click="btnFirstCheck_Click">
<Button.Content>
<TextBlock
VerticalAlignment="Center"
FontSize="20"
Foreground="White"
Text="首检确认" />
</Button.Content>
</Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="8"
>
<Button
x:Name="btnMachineRepair"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="btnMachineRepair_Click" Content="报修"></Button>
</StackPanel>
<StackPanel
Background="#F2F3F5"
Grid.Row="0"
Grid.Column="9"
>
<Button
x:Name="btnRefresh"
Style="{StaticResource btnKey}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="#2B7EE6"
FontSize="20"
Foreground="White"
Click="btnRefresh_Click" Content="刷新"></Button>
</StackPanel>
</StackPanel>
</ScrollViewer>
<DataGrid
x:Name="dgWorkOrderInfo"
Grid.Row="1"
@ -474,15 +500,15 @@
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridTextColumn Width="60" Header="母单" Binding="{Binding parent_order,Converter={StaticResource ParentOrderConverter}}"/>-->
<DataGridTextColumn Width="250" Header="SAP工单" Binding="{Binding workorder_code_sap}"/>
<DataGridTextColumn Width="300" Header="工单/SFC" Binding="{Binding workorder_code}" />
<DataGridTextColumn Width="200" Header="SAP工单" Binding="{Binding workorder_code_sap}"/>
<DataGridTextColumn Width="200" Header="工单/SFC" Binding="{Binding workorder_code}" />
<!--<DataGridTextColumn Width="120" Header="RFID" Binding="{Binding rfid}"/>-->
<DataGridTextColumn Width="480" Header="产品名称" Binding="{Binding product_name}" />
<DataGridTextColumn Width="380" Header="批次号" Binding="{Binding batch_code}" />
<DataGridTextColumn Width="100" Header="订单数量" Binding="{Binding quantity_split}" />
<DataGridTextColumn Width="80" Header="工单状态" Binding="{Binding status,Converter={StaticResource MyConverter}}" >
<DataGridTextColumn Width="80" Header="工单状态" Binding="{Binding status,Converter={StaticResource MyConverter}}" >
<!--<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{Binding status, Converter={StaticResource SyncFlagColorConvert}}" />
@ -505,7 +531,7 @@
</DataGrid.Columns>
</DataGrid>
<StackPanel
Grid.Row="2"
Grid.ColumnSpan="10"
@ -563,6 +589,7 @@
Height="69"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Margin="10,0,0,0"
Background="White"
Click="Paused_Click">
<TextBlock

@ -654,7 +654,7 @@ namespace XGLFinishPro.Views
try
{
string status1 = (dgWorkOrderInfo.SelectedItem as DataRowView)["workorder_code"].ToString();
string status = (dgWorkOrderInfo.SelectedItem as DataRowView)["status"].ToString();
if (!status.Equals("w2"))
@ -778,12 +778,41 @@ namespace XGLFinishPro.Views
private void btnMachineRepair_Click(object sender, RoutedEventArgs e)
{
MachineRepairModel machineRepairModel = new MachineRepairModel();
machineRepairModel.equipmentCode = "";
machineRepairModel.factory = "";
machineRepairModel.userName = "username";
machineRepairModel.phoneNumber = "1234567890";
machineRepairModel.userNickName = "";
//调用首件检验接口
string apiUrl = formingMachineService.GetInterfaceUrl("machineRepair");
MachineRepairWin machineRepairWin = new MachineRepairWin(apiUrl);
machineRepairWin.ShowDialog();
}
private void btnSalaryCal_Click(object sender, RoutedEventArgs e)
{
var selectedRow = (dgWorkOrderInfo.SelectedItem as DataRowView); //dgWorkOrderInfo.SelectedItem as FoamingMacModel;
if (selectedRow == null)
{
//MessageBox.Show("请选择你要报工的工单!", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning);
CustomMessageBox.Show("请选择你要操作的工单!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
if (!selectedRow["status"].ToString().Equals("w2"))
{
CustomMessageBox.Show("你选择的工单不符合条件!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
if (selectedRow["salary_flag"].ToString().Equals("1"))
{
CustomMessageBox.Show("你选择的工单已录入计件薪酬信息,不允许重复录入!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
string prodCode = selectedRow["product_code"].ToString();
string prodName = selectedRow["product_name"].ToString();
string workOrderCode = selectedRow["workorder_code"].ToString();
string sapWorkOrderCode = selectedRow["workorder_code_sap"].ToString();
PieceSalaryCalWin pieceSalaryCalWin = new PieceSalaryCalWin(prodCode, prodName, deviceCode, workOrderCode,sapWorkOrderCode);
pieceSalaryCalWin.ShowDialog();
}
}
public class ReportWorkModel

@ -0,0 +1,417 @@
<Window x:Class="XGLFinishPro.Views.PieceSalaryCalWin"
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"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Title="计件薪资" Height="800" Width="1200" WindowStartupLocation="CenterScreen" WindowStyle="None" Loaded="Window_Loaded" Closing="Window_Closing">
<Window.Resources>
<SolidColorBrush x:Key="EvenRowBackground" Color="#E0E0E0"/>
<SolidColorBrush x:Key="OddRowBackground" Color="#FFFFFF"/>
<Style x:Key="DataGridTextCenterColumnStyle" TargetType="DataGridCell" BasedOn="{StaticResource DataGridCellStyle}">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="ColumnHeaderGripperStyle" TargetType="DataGridColumnHeader"/>
<Style x:Key="DataGridRowStyle" TargetType="DataGridRow">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Background" Value="{StaticResource EvenRowBackground}"/>
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="{StaticResource OddRowBackground}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="CustomCellStyle" TargetType="DataGridCell">
<Setter Property="Foreground" Value="Black" />
<Setter Property="TextBlock.TextAlignment" Value="Center" />
<Setter Property="TextBlock.FontSize" Value="22" />
</Style>
<Style x:Key="ApplicantList_ListBox_Style" TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="#00000000"/>
<Setter Property="BorderBrush" Value="#00000000"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<!--<Setter Property="ItemContainerStyle" Value="{DynamicResource ApplicantList_ListBoxItem_Style}" />-->
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<!--<WrapPanel Orientation="Horizontal" IsItemsHost="True" />-->
<UniformGrid Columns="4"/>
<!--设置横向Horizontal 纵向Vertical显示-->
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="btnKey" TargetType="Button">
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="60" />
<Setter Property="Margin" Value="5.5"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="#2B7EE6" BorderThickness="2" CornerRadius="10">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ApplicantList_ListBoxItem_Style" TargetType="{x:Type ListBoxItem}">
<Setter Property="Margin" Value="10,10,10,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Bd" BorderThickness="3"
Width="120"
Height="40"
Margin="2,0,0,0"
Style="{DynamicResource ListBoxItemNormalBackground_Border_Style}">
<Grid >
<Image Source="../Resources/leaf.png" Margin="223,-82,0,0" Width="50"/>
<TextBlock Text="{Binding childprocess_code}"
VerticalAlignment="Center"
Margin="10,0,0,0" FontWeight="Bold" Foreground="Black"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
<TextBlock Text="{Binding childprocess_name}"
VerticalAlignment="Center"
Margin="35,0,0,0" FontWeight="Bold" Foreground="Black"
Style="{DynamicResource ListBoxItemContent_TextBlock_Style}"/>
<Grid
Margin="-15,12,0,0"
Width="90"
Height="102"
VerticalAlignment="Top"
HorizontalAlignment="Left" >
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-62,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,-22,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,18,0,0"/>
<Image Source="../Resources/circular.png" Width="10" Height="10" Margin="0,56,0,0"/>
<!--<Image Source="../Resources/lanjuLogo.png" VerticalAlignment="Stretch"/>-->
<!--<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding rfid_no}" FontSize="18"
Foreground="{Binding rfid_no,Converter={StaticResource ForeGroundBatchType}}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Image Source="..\Img\1.png"></Image>
</StackPanel>-->
</Grid>
</Grid>
</Border>
<!--控件触发器-->
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<!--LinearGradientBrush,渐变线画笔-->
<LinearGradientBrush
StartPoint="0.4,0"
EndPoint="0.4,1">
<LinearGradientBrush.GradientStops>
<!--GradientStops渐变线停止GradientStopCollection渐变线停止集合点-->
<GradientStopCollection>
<GradientStop
Color="#FFffeeac"
Offset="0" />
<GradientStop
Color="#FFfbe178"
Offset="0.4" />
<GradientStop
Color="#FFfbe178"
Offset="0.6" />
<GradientStop
Color="#FFfffbd9"
Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush" TargetName="Bd" Value="RoyalBlue"></Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="Bd">
<Setter.Value>
<!--LinearGradientBrush,渐变线画笔-->
<LinearGradientBrush
StartPoint="0.4,0"
EndPoint="0.4,1">
<LinearGradientBrush.GradientStops>
<!--GradientStops渐变线停止GradientStopCollection渐变线停止集合点-->
<GradientStopCollection>
<GradientStop
Color="#FFC2E0FF"
Offset="0" />
<GradientStop
Color="#FFC2E0dF"
Offset="0.4" />
<GradientStop
Color="#FFC2E0dF"
Offset="0.6" />
<GradientStop
Color="#FFfffbd9"
Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type Border}" x:Key="ListBoxItemHeadBackground_Border_Style">
<Setter Property="BitmapEffect">
<Setter.Value>
<DropShadowBitmapEffect Color="Black" Direction="340" ShadowDepth="7" Softness="0.1" Opacity="0.3"/>
</Setter.Value>
</Setter>
<Setter Property="Background" >
<Setter.Value>
<LinearGradientBrush
StartPoint="0.4,0"
EndPoint="0.4,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop
Color="#FFffeeac"
Offset="0" />
<GradientStop
Color="#FFfbe178"
Offset="0.4" />
<GradientStop
Color="#FFfbe178"
Offset="0.6" />
<GradientStop
Color="#FFfffbd9"
Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<!--字体样式-->
<Style x:Key="Title_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="34"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
</Style>
<Style x:Key="Copyright_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontFamily" Value="宋体"/>
<Setter Property="Foreground" Value="#FF939393"/>
</Style>
<Style x:Key="ChirdrenControlTitle_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
</Style>
<Style x:Key="ListBoxItemName_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#000000"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<Style x:Key="ListBoxItemContent_TextBlock_Style" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontFamily" Value="微软雅黑"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<!--ListBox元素边框样式-->
<Style x:Key="ListBoxItemNormalBackground_Border_Style" TargetType="{x:Type Border}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="5" />
<Setter Property="BorderBrush" Value="#E1E1E1"/>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint="0.5,0"
EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FFffffff"
Offset="0" />
<GradientStop Color="#FFE4E4E4"
Offset="0.96" />
<GradientStop Color="#FFe4e4e4"
Offset="1" />
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="#9e9e9e"
Direction="315"
ShadowDepth="3"
Opacity="1" />
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid Background="#F2F3F5">
<Grid.RowDefinitions>
<RowDefinition Height="0.1*"/>
<RowDefinition Height="0.45*"></RowDefinition>
<RowDefinition Height="0.45*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!--<Button x:Name="btnStepConfirm1" Style="{StaticResource btnKey}" Background="#2B7EE6" Width="100" Height="40" Click="btnConfirm_Click">
<StackPanel Orientation="Horizontal">
<Image Source="/Resources/green.png" Width="30" Height="30"/>
<TextBlock Text="确认" VerticalAlignment="Center" Margin="15,0,0,0"/>
</StackPanel>
</Button>-->
<CheckBox x:Name="btnSelectStep" Visibility="Collapsed" Grid.Row="0" Content="选择工序" FontSize="16" HorizontalAlignment="Left" Width="100" Height="30" Margin="10,0,0,0" FontWeight="Bold" Background="#2B7EE6"
Click="btnSelectStep_Click">
</CheckBox>
<Popup Grid.Row="1" Grid.RowSpan="2" IsOpen="{Binding ElementName=btnSelectStep,Path=IsChecked,UpdateSourceTrigger=PropertyChanged}" PlacementTarget="{Binding ElementName=btnSelectStep}">
<StackPanel Orientation="Vertical">
<ListBox x:Name="lstBoxStep" Style="{DynamicResource ApplicantList_ListBox_Style}" ItemContainerStyle="{DynamicResource ApplicantList_ListBoxItem_Style}" SelectionMode="Multiple">
</ListBox>
<Button x:Name="btnStepConfirm" Style="{StaticResource btnKey}" Background="#2B7EE6" Content="确认" Width="100" Height="30" Click="btnConfirm_Click"/>
</StackPanel>
</Popup>
<ListBox x:Name="lstSelectedStep" Grid.Row="1" Grid.Column="0" Background="#F2F3F5" Style="{DynamicResource ApplicantList_ListBox_Style}" ItemContainerStyle="{DynamicResource ApplicantList_ListBoxItem_Style}" SelectionMode="Single" SelectionChanged="lstSelectedStep_SelectionChanged">
</ListBox>
<Grid Grid.Row="0" Grid.RowSpan="2" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.15*"/>
<RowDefinition Height="0.85*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<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"/>
<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" Content="关闭" FontWeight="Bold" Width="100" Height="40" Style="{StaticResource btnKey}" Click="btnCloseWin_Click"/>
</StackPanel>
<DataGrid
Grid.Row="1" Grid.Column ="0" Grid.ColumnSpan="2"
x:Name="dgUserInfo"
MinWidth="200"
MinHeight="260"
Width="560"
Height="340"
RowStyle="{StaticResource DataGridRowStyle}"
Margin="10,10,0,5"
MaxHeight="400"
AlternationCount="2"
FontSize="18"
LoadingRow="dgWorkOrderInfo_LoadingRow"
HeadersVisibility="Column"
HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True"
AutoGenerateColumns="False" CanUserAddRows="False" SelectionMode="Extended" SelectionUnit="FullRow" SelectionChanged="dgUserInfo_SelectionChanged">
<DataGrid.ColumnHeaderStyle >
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="48" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#2B7EE6" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<!-- 添加选择列 , RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}IsChecked="{Binding IsSelected ,Mode=TwoWay,RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"-->
<DataGridTemplateColumn Width="50">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="cb_child" Click="cb_child_Click" IsChecked="{Binding IsChecked}" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header=" 序号" Width="80" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="130" Header="用户编码" Binding="{Binding user_name}"/>
<DataGridTextColumn Width="190" Header="用户名称" Binding="{Binding nick_name}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
<GroupBox Grid.Row="2" Grid.Column ="0" Grid.ColumnSpan ="2" Header="已分配的数据">
<DataGrid
x:Name="dgCreatedUserInfo"
MinWidth="400"
MinHeight="320"
RowStyle="{StaticResource DataGridRowStyle}"
Margin="10,0,0,5"
MaxHeight="400"
AlternationCount="2"
FontSize="18"
LoadingRow="dgWorkOrderInfo_LoadingRow"
HeadersVisibility="Column"
HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True"
AutoGenerateColumns="False" CanUserAddRows="False" SelectionMode="Extended" SelectionUnit="FullRow" SelectionChanged="dgUserInfo_SelectionChanged">
<DataGrid.ColumnHeaderStyle >
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Height" Value="48" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#2B7EE6" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<!-- 添加选择列 , RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}IsChecked="{Binding IsSelected ,Mode=TwoWay,RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"-->
<DataGridTemplateColumn Header=" 序号" Width="80" MinWidth="10" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="100" Header="订单编码" Binding="{Binding workorder_code_sap}"/>
<DataGridTextColumn Width="100" Header="用户编码" Binding="{Binding user_name}"/>
<DataGridTextColumn Width="100" Header="用户名称" Binding="{Binding nick_name}"/>
<DataGridTextColumn Width="150" Header="产品编码" Binding="{Binding product_code}"/>
<DataGridTextColumn Width="200" Header="产品名称" Binding="{Binding product_name}"/>
<DataGridTextColumn Width="80" Header="工序编码" Binding="{Binding childprocess_code}"/>
<DataGridTextColumn Width="80" Header="工序名称" Binding="{Binding childprocess_name}"/>
<DataGridTextColumn Width="80" Header="线体" Binding="{Binding line_code}"/>
<DataGridTextColumn Width="185" Header="创建时间" Binding="{Binding create_time, StringFormat={}{0:yyyy-MM-dd HH:mm:ss}}"/>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
<StackPanel Grid.Row="3" Grid.Column ="0" Grid.ColumnSpan ="2" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Margin="5">
<TextBlock x:Name="msgBox" Text="" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="18" Foreground="Red"/>
</StackPanel>
</Grid>
</Window>

@ -0,0 +1,358 @@
using CommonFunc;
using CommonFunc.Tools;
using DevExpress.Data.Browsing.Design;
using DevExpress.Mvvm.Native;
using DevExpress.Office.Utils;
using DevExpress.XtraRichEdit.Layout.Engine;
using HandyControl.Tools.Extension;
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.Shapes;
using XGL.Data;
using XGL.Dats.DBServiceFinishProd;
using XGL.Models.Model;
namespace XGLFinishPro.Views
{
/// <summary>
/// PieceSalaryCalWin.xaml 的交互逻辑
/// </summary>
public partial class PieceSalaryCalWin : Window
{
FinishProdDBService prodDBService = new FinishProdDBService();
string _deviceCode = "", _productCode= "",_workOrderCode="",_sapWorkOrderCode="",_productName="", _childprocessCode="", _childprocessName = "";
public PieceSalaryCalWin()
{
InitializeComponent();
}
public PieceSalaryCalWin(string productCode,string productName,string deviceCode,string workOrderCode,string sapWorkOrderCode)
{
InitializeComponent();
_deviceCode = deviceCode;
_productCode = productCode;
_productName = productName;
_workOrderCode = workOrderCode;
_sapWorkOrderCode = sapWorkOrderCode;
}
private void dgWorkOrderInfo_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}
private void btnConfirm_Click(object sender, RoutedEventArgs e)
{
try
{
List<ChildProcess> listDetail = new List<ChildProcess>();
if (lstBoxStep.SelectedItems.Count > 0)
{
foreach (var item in lstBoxStep.SelectedItems)
{
ChildProcess childProcess = new ChildProcess();
childProcess.childprocess_code = (item as ChildProcess).childprocess_code;
childProcess.childprocess_name = (item as ChildProcess).childprocess_name;
listDetail.Add(childProcess);
}
if (lstSelectedStep.Items.Count > 0)
{
//this.lstSelectedStep.Items.Clear();
this.lstSelectedStep.ItemsSource = null;
lstSelectedStep.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
this.btnSelectStep.IsChecked = false;
}
else
{
lstSelectedStep.ItemsSource = listDetail.OrderBy(a => a.childprocess_code);
this.btnSelectStep.IsChecked = false;
}
}
}
catch (Exception ex)
{
LogHelper.instance.log.Error("计件薪酬选择工序时发生异常:"+ex.Message);
}
}
private void lstSelectedStep_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
this.msgBox.Text = "";
List<ChildProcess> listDetail = new List<ChildProcess>();
if (lstSelectedStep.SelectedItems.Count > 0)
{
_childprocessCode = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_code;
_childprocessName = (lstSelectedStep.SelectedItem as ChildProcess).childprocess_name;
}
// DataTable dt = prodDBService.GetUnitPriceInfo();
this.dgUserInfo.ItemsSource = null;
checkedRowsCache.Clear();
Utils.userList.ForEach(t => t.IsChecked = false);
dataSource = Utils.userList;
this.dgUserInfo.ItemsSource = dataSource;
}
private void dgUserInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// 处理选中行的事件
//foreach (sys_user selectedItem in e.AddedItems)
//{
// // 在这里执行你的操作YourDataType 是你的数据类型
// // selectedItem 包含当前选中行的数据
// selectedItem.IsChecked = true;
// int i = dgUserInfo.Items.IndexOf(selectedItem);
// (dgUserInfo.Items[i] as sys_user).IsChecked = true;
//}
}
private void CheckBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// 阻止事件继续传播,以防止默认行为
e.Handled = true;
}
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
CheckBox CBCheck = (CheckBox)sender;
try
{
List<sys_user> UsersList = dgUserInfo.SelectedItems as List<sys_user>;
if (UsersList != null)
{
foreach (sys_user item in UsersList)
{
if (item.IsChecked == true)
{ item.IsChecked = false; }
else
{ item.IsChecked = true; }
}
}
dgUserInfo.Items.Refresh();
}
catch (Exception ex)
{
}
}
//作为选中行的缓存
List<sys_user> checkedRowsCache = new List<sys_user>();
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.lstSelectedStep.ItemsSource = GetStepData();
GetData();
}
private void GetData()
{
DataTable dt = prodDBService.GetUnitPriceData(_deviceCode);
if (dt == null)
{
this.dgCreatedUserInfo.ItemsSource = null;
CustomMessageBox.Show("请配置工序数据之后再试!!!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Question);
}
else
{
this.dgCreatedUserInfo.ItemsSource = null;
this.dgCreatedUserInfo.ItemsSource = dt.DefaultView;
}
}
private void btnCloseWin_Click(object sender, RoutedEventArgs e)
{
if (CustomMessageBox.Show("确定要关闭此窗口吗?", CustomMessageBoxButton.YesNo, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.No)
return;
this.Close();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
}
List<sys_user> dataSource = new List<sys_user>();
private void cb_child_Click(object sender, RoutedEventArgs e)
{
CheckBox cb = e.Source as CheckBox;
bool isChecked;
isChecked = cb.IsChecked == true ? true : false;
sys_user curRow = (dgUserInfo.CurrentItem as sys_user);
if (isChecked)
{
//this.chkPrintBatch.IsChecked = false;
foreach (var item in dgUserInfo.Items)
{
// DataGridTemplateColumn templeColumn = dgUserInfo.Columns[0] as DataGridTemplateColumn;
// FrameworkElement fwElement = dgUserInfo.Columns[0].GetCellContent(item);
// CheckBox cBox = templeColumn.CellTemplate.FindName("cb_child", fwElement) as CheckBox;
// //循环的行
// //DataRow tempRow = (item as DataRowView).Row;
// cBox.IsChecked = false;
}
checkedRowsCache.Add(curRow);
cb.IsChecked = true;
curRow.IsChecked = true;
}
else
{
checkedRowsCache.Remove(curRow);
cb.IsChecked = false;
curRow.IsChecked = false;
}
}
private void btnQueryUser_Click(object sender, RoutedEventArgs e)
{
string queryP = this.txtP.Text.Trim();
if (string.IsNullOrEmpty(queryP))
{
this.dgUserInfo.ItemsSource = Utils.userList;
return;
}
this.dgUserInfo.ItemsSource = null;
var queryList = Utils.userList.Where(t => t.nick_name.Contains(queryP) || t.user_name.Contains(queryP));
this.dgUserInfo.ItemsSource = queryList;
}
private void txtP_TextChanged(object sender, TextChangedEventArgs e)
{
btnQueryUser_Click(null,null);
}
private void btnUserConfirm_Click(object sender, RoutedEventArgs e)
{
try
{
if (CustomMessageBox.Show("确定要生成该工序的数据吗?", CustomMessageBoxButton.YesNo, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.No)
return;
if (checkedRowsCache.Count == 0)
{
CustomMessageBox.Show("请选择人员", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
List<string> CreateUnitPriceSqlList = new List<string>();
if (prodDBService.IsExistData(_workOrderCode, _childprocessCode, _deviceCode))
{
string delSql = prodDBService.GetDelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
CreateUnitPriceSqlList.Add(delSql);
//prodDBService.DelUnitPriceData(_workOrderCode, _childprocessCode, _deviceCode);
}
foreach (sys_user item in checkedRowsCache)
{
string sql = prodDBService.GetCreateUnitPriceInfo(item, _workOrderCode, _sapWorkOrderCode, _productCode, _productName, _childprocessCode, _childprocessName,_deviceCode);
CreateUnitPriceSqlList.Add(sql);
}
//之前如果已经插入了,先删除,
//暂时不更新工单状态
//string updateSql = prodDBService.GetUpdateUnitPriceSql(_workOrderCode);
//CreateUnitPriceSqlList.Add(updateSql);
if (prodDBService.ExecuteCreateUnitPriceSql(CreateUnitPriceSqlList))
{
CustomMessageBox.Show("插入成功!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
GetData();
foreach (sys_user item in dgUserInfo.Items)
{
if (item.IsChecked == true)
{
item.IsChecked = false;
}
}
}
else
{
CustomMessageBox.Show("插入失败,请重试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
}
}
catch (Exception ex)
{
CustomMessageBox.Show("插入失败:"+ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
LogHelper.instance.log.Error("写入计件薪酬数据时发生异常:"+ex.Message);
}
}
private void btnSelectStep_Click(object sender, RoutedEventArgs e)
{
List<ChildProcess> list = new List<ChildProcess>();
DataTable dt = prodDBService.GetProductStepListInfo(_deviceCode, _productCode);
if (dt == null)
{
lstBoxStep.ItemsSource = null;
lstBoxStep.Items.Clear();
}
else
{
foreach (DataRow item in dt.Rows)
{
list.Add(new ChildProcess()
{
childprocess_code = item["childprocess_code"].ToString(),
childprocess_name = item["childprocess_name"].ToString()
});
}
lstBoxStep.ItemsSource = null;
lstBoxStep.Items.Clear();
lstBoxStep.ItemsSource = list;//dt.DefaultView;
}
}
private List<ChildProcess> GetStepData()
{
List<ChildProcess> list = new List<ChildProcess>();
DataTable dt = prodDBService.GetProductStepListInfo(_deviceCode, _productCode);
if (dt == null)
{
lstBoxStep.ItemsSource = null;
lstBoxStep.Items.Clear();
}
else
{
foreach (DataRow item in dt.Rows)
{
list.Add(new ChildProcess()
{
childprocess_code = item["childprocess_code"].ToString(),
childprocess_name = item["childprocess_name"].ToString()
});
}
}
return list;
}
}
public class ChildProcess
{
public string childprocess_code { get; set; }
public string childprocess_name { get; set; }
}
}

@ -321,6 +321,7 @@
<DependentUpon>ModuleUC.xaml</DependentUpon>
</Compile>
<Compile Include="Tools\BatchStatusValueConverter.cs" />
<Compile Include="Tools\NumericValidationRule.cs" />
<Compile Include="Tools\OrderInOutConverter.cs" />
<Compile Include="Tools\ParentOrderConverter.cs" />
<Compile Include="Tools\SerialHelper.cs" />
@ -330,6 +331,7 @@
<Compile Include="Tools\DeviceNameConverter.cs" />
<Compile Include="Tools\SyncFlagConverter.cs" />
<Compile Include="Tools\UserDatePicker.cs" />
<Compile Include="Tools\ValidationHelper.cs" />
<Compile Include="UControl\ordertj.xaml.cs">
<DependentUpon>ordertj.xaml</DependentUpon>
</Compile>
@ -414,6 +416,9 @@
<Compile Include="Views\HBLogWin.xaml.cs">
<DependentUpon>HBLogWin.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PieceSalaryCalWin.xaml.cs">
<DependentUpon>PieceSalaryCalWin.xaml</DependentUpon>
</Compile>
<Compile Include="Views\QitaoLvUC.xaml.cs">
<DependentUpon>QitaoLvUC.xaml</DependentUpon>
</Compile>
@ -660,6 +665,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\PieceSalaryCalWin.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\QitaoLvUC.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

@ -1,14 +1,23 @@
<?xml version="1.0" standalone="yes"?>
<ConnectionConfig>
<Recommand>强烈建议:对数据库以及本软件的参数更改,不要在此页进行.可以通过系统配置页进行更新.</Recommand>
<!--服务器上的业务数据库-->
<!--<MESNetClientConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THmyUqdarOD4hLgFIvnCg0Z5JcMnCcII6fP2O7usaxD2yxms2iG3eLDUbqRzra4aRVWyptaS06VoI5ijFvcRfLsDJTcpjMhCY6BLuczFcXp04=</MESNetClientConnectionString>-->
<!--云数据库-->
<!--<CloudConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1SeyBo9i02eVJXgQThZLtJ4i8onuEvQtnfNObn1j0jgO</CloudConnectionString>-->
<Recommand>强烈建议:对数据库以及本软件的参数更改,不要在此页进行.可以通过系统配置页进行更新.</Recommand>
<!--本地的业务数据库-->
<MESClientConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S</MESClientConnectionString>
<!--<MESClientConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S</MESClientConnectionString>-->
<!--榄菊业务数据库-->
<MESNetClientConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91A7V9zSnfhmhLWUQKZQdqof6chkC37l6QElb57z876mZdo9764iNmLGULHBiQyMu6PXowBdyaQVt17BPsWFn4EUs7Z7zTZwBP+2iJBVXitA3OF6EZXxAztmeZk/1iCwni+JzeWNpXqeOoGzkmSSzmVQH2Yf9m/mlqag2TbldSCcnUQl6lE7tcGg==</MESNetClientConnectionString>
<!--<MESNetClientConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91A7V9zSnfhmhLWUQKZQdqof6chkC37l6QElb57z876mZdo9764iNmLGULHBiQyMu6PXowBdyaQVt17BPsWFn4EUs7Z7zTZwBP+2iJBVXitA3OF6EZXxAztmeZk/1iCwni+JzeWNpXqeOoGzkmSSzmVQH2Yf9m/mlqag2TbldSCcnUQl6lE7tcGg==</MESNetClientConnectionString>-->
<!--榄菊云数据库-->
<CloudConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91ML11cYCqHcHmTXJFsNQamIbW3UEpkjgNPUcBwRfgP6AWftvk9YFyv7y7/6nzX/c+6z6xMDIdcjYVvfteU+7YtOQhJXTfF5ScosAA0GliBfD8dWAunW+ZCos5LemAj2xb2wvvCxlbnrof8IunWslCaBEAGrdC/KhE0qEfNbxydwc=</CloudConnectionString>
</ConnectionConfig>
<!--<CloudConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91ML11cYCqHcHmTXJFsNQamIbW3UEpkjgNPUcBwRfgP6AWftvk9YFyv7y7/6nzX/c+6z6xMDIdcjYVvfteU+7YtOQhJXTfF5ScosAA0GliBfD8dWAunW+ZCos5LemAj2xb2wvvCxlbnrof8IunWslCaBEAGrdC/KhE0qEfNbxydwc=</CloudConnectionString>-->
<!--本地的业务数据库-->
<MESClientConnectionString>vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S</MESClientConnectionString>
<!--榄菊业务数据库-->
<MESNetClientConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNntlKCeRLc6CBQNAw+bzYK+yDKBny3FzdffaiQ/9ohZ/iFw6P/06Dz1d7Q8OX2fGT3YK8v2yeiGlLhRHNGlkzN6Okv9SEccNYXDHZKQND/31n9bbXRhaFERnPoCp+evwBwpKq0nDcp4lLRNDrJpG2b6nw1popy2st0u+eYfbIYddNpj2jZcnrJXg==</MESNetClientConnectionString>
<!--榄菊云数据库-->
<CloudConnectionString>vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNnXgKYRJ9zN5r4cTE3Hh+JS6lnhIJQCLO5Tn/1DUIbZe8kwpCPuiyxdQS9ApxjjxU3xmhgbAR3NfwaZV2/zLMECLZyTqYXOHwTHdkzxa9RyCzNcbpiSjkFFOVT9SrfkzeVUA+7kogOazAQ7II0ms/Pnls5vU+gUjP9JcI1Q6esb8M=</CloudConnectionString>
</ConnectionConfig>

Binary file not shown.
Loading…
Cancel
Save