计件薪酬和人员刷卡改动

master
zhaoaomin 2 years ago
parent 9fe5e82fb3
commit e9bdecf486

@ -13,7 +13,6 @@ using MySql.Data.MySqlClient;
using CommonFunc.Tools;
using XGL.Models.Model;
using XGL.Models;
using System.Threading;
namespace XGL.Dats.DBServiceFinishProd
{
@ -87,9 +86,14 @@ namespace XGL.Dats.DBServiceFinishProd
return Items;
}
/// <summary>
/// 刷卡功能变更为取pe_snr的值
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public DataTable GetUserInfoFromCloudServer(string userID)
{
string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and user_name = '{userID}'";
string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and (user_name = '{userID}' or pe_snr = '{userID}')";
DataSet dtset = Utils.cloudDBHelper.getDataSet(sql);
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
{
@ -138,6 +142,7 @@ namespace XGL.Dats.DBServiceFinishProd
public DataTable GetExistAttendanceRecord(string v)
{
//不会存在一个人俩个班次工作的情况
string sql = $@" select id, user_id, user_name, attendance_status, sex, age,
id_number, start_time, start_addr, end_time, end_addr, attendance_time,
attendance_date, work_hours, create_time
@ -689,6 +694,21 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C
}
return null;
}
public List<sys_user> GetOnWorkUserList(string deviceCode)
{
string sql = $"SELECT user_id as user_name,user_name as nick_name,sex,age FROM [dbo].[mes_attendance_records] where start_addr = '{deviceCode}' and CONVERT(VARCHAR(10), create_time , 120) = CONVERT(VARCHAR(10), GETDATE() , 120) ;";
DataTable dt = Utils.netClientDBHelper.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 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}' ";
@ -3416,6 +3436,36 @@ left join basedata_plcsetting f on a.PlcId5=f.Id
public void InsertCheckTaskDetail(string value,string where)
{
//StringBuilder strSql = new StringBuilder();
//strSql.Append("UPDATE qc_check_task_detail ");
//strSql.Append("SET actual_value =");
//if (value == null)
//StringBuilder strSql = new StringBuilder();
//strSql.Append("UPDATE qc_check_task_detail ");
//strSql.Append("SET actual_value =");
//if (value==null)
//{
// strSql.Append("NULL");
//}
//else
//{
// strSql.Append($"'{value}'");
//}
//strSql.Append(" WHERE record_id =");
//strSql.Append($"'{where}'");
//Utils.netClientDBHelper.executeUpdate(strSql.ToString());
//strSql.Append(" WHERE record_id =");
//strSql.Append($"'{where}'");
//int rowsAffected = Utils.netClientDBHelper.executeUpdate(strSql.ToString());
StringBuilder strSql = new StringBuilder();
strSql.Append("UPDATE qc_check_task_detail ");
strSql.Append("SET actual_value =");
@ -3431,6 +3481,7 @@ left join basedata_plcsetting f on a.PlcId5=f.Id
strSql.Append(" WHERE record_id =");
strSql.Append($"'{where}'");
Utils.netClientDBHelper.executeUpdate(strSql.ToString());
}
// /// <summary>

@ -12,7 +12,7 @@
<!--设备编码-->
<add key="DeviceCode" value="XL01" />
<!--上位机类型 0:工单准备1成型机\shoupei2烘房,3:人员登录,4:称重系统-->
<add key="ClientMode" value="4" />
<add key="ClientMode" value="1" />
<add key="SerialPort" value="COM5" />
<add key="weigh" value="COM12" />

@ -16,9 +16,9 @@
<Setter Property="TextBlock.TextAlignment" Value="Center" />
<Setter Property="TextBlock.FontSize" Value="22" />
</Style>
<!--<convert:MyValueConverter x:Key="MyConverter"/>
<convert:MyValueConverter x:Key="MyConverter"/>
<convert:OrderInOutConverter x:Key="TaskCodeConverter"/>
<convert:BtnBackGroundColorConverter x:Key="ButtonContentToBackgroundColorConverter"/>-->
<convert:BtnBackGroundColorConverter x:Key="ButtonContentToBackgroundColorConverter"/>
<SolidColorBrush x:Key="EvenRowBackground" Color="#E0E0E0"/>
<SolidColorBrush x:Key="OddRowBackground" Color="#FFFFFF"/>
<Style x:Key="DataGridRowStyle" TargetType="DataGridRow">

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

@ -82,9 +82,10 @@ namespace XGLFinishPro.Views
CustomMessageBox.Show("找不到该账户,请重试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
string userCode = dtUserInfo.Rows[0]["user_name"].ToString();
string userName = dtUserInfo.Rows[0]["nick_name"].ToString();
string sex = dtUserInfo.Rows[0]["sex"].ToString();
bool isSucc = finishProdDBService.InsertAttendanceRecord(userID, userName, sex,deviceCode);
bool isSucc = finishProdDBService.InsertAttendanceRecord(userCode, userName, sex,deviceCode);
if (isSucc)
{
CustomMessageBox.Show("打卡成功,祝您工作愉快!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
@ -113,12 +114,19 @@ namespace XGLFinishPro.Views
try
{
string userID = txtOffWorkUserID.Text;
DataTable dt = finishProdDBService.GetExistAttendanceRecord(deviceCode);
if (dt!=null && dt.Select("user_id = '" + userID + "'").Length > 0)
DataTable dtUserInfo = finishProdDBService.GetUserInfoFromCloudServer(userID);
if (dtUserInfo == null || dtUserInfo.Rows.Count <= 0)
{
if (dt.Select("user_id = '" + userID + "' and start_addr = '" + deviceCode + "'").Length > 0)
CustomMessageBox.Show("找不到该账户,请重试!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
string userCode = dtUserInfo.Rows[0]["user_name"].ToString();
DataTable dt = finishProdDBService.GetExistAttendanceRecord(deviceCode);
if (dt!=null && dt.Select("user_id = '" + userCode + "'").Length > 0)
{
if (dt.Select("user_id = '" + userCode + "' and start_addr = '" + deviceCode + "'").Length > 0)
{
bool isSucc = finishProdDBService.UpdateAttendanceRecord(userID, deviceCode);
bool isSucc = finishProdDBService.UpdateAttendanceRecord(userCode, deviceCode);
if (isSucc)
{
CustomMessageBox.Show("打卡成功,再见!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
@ -127,7 +135,7 @@ namespace XGLFinishPro.Views
}
else
{
string start_addr = dt.Select("user_id = '" + userID + "'")[0]["start_addr"].ToString();
string start_addr = dt.Select("user_id = '" + userCode + "'")[0]["start_addr"].ToString();
CustomMessageBox.Show("打卡失败,您的打卡地址在" + start_addr + "", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}

@ -29,6 +29,7 @@ namespace XGLFinishPro.Views
{
FinishProdDBService prodDBService = new FinishProdDBService();
string _deviceCode = "", _productCode= "",_workOrderCode="",_sapWorkOrderCode="",_productName="", _childprocessCode="", _childprocessName = "";
string _LineCode = "";
public PieceSalaryCalWin()
{
InitializeComponent();
@ -37,6 +38,7 @@ namespace XGLFinishPro.Views
public PieceSalaryCalWin(string productCode,string productName,string deviceCode,string workOrderCode,string sapWorkOrderCode)
{
InitializeComponent();
_LineCode = deviceCode;
_deviceCode = deviceCode;
_productCode = productCode;
_productName = productName;
@ -99,8 +101,9 @@ namespace XGLFinishPro.Views
this.dgUserInfo.ItemsSource = null;
checkedRowsCache.Clear();
Utils.userList.ForEach(t => t.IsChecked = false);
dataSource = Utils.userList;
//Utils.userList.ForEach(t => t.IsChecked = false);
OnWorkUserList.ForEach(t => t.IsChecked = false);
dataSource = OnWorkUserList;// Utils.userList;
this.dgUserInfo.ItemsSource = dataSource;
}
@ -149,6 +152,8 @@ namespace XGLFinishPro.Views
}
//从上下班的名单中找
List<sys_user> OnWorkUserList = new List<sys_user>();
//作为选中行的缓存
List<sys_user> checkedRowsCache = new List<sys_user>();
@ -163,9 +168,20 @@ namespace XGLFinishPro.Views
}
_deviceCode = ds.Tables[0].Rows[0][0].ToString();
this.lstSelectedStep.ItemsSource = GetStepData();
GetUserData();
GetData();
}
private void GetUserData()
{
OnWorkUserList = prodDBService.GetOnWorkUserList(_LineCode);
if (OnWorkUserList == null || OnWorkUserList.Count <= 0)
{
CustomMessageBox.Show("没有找到上班的人员信息!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Warning);
return;
}
}
private void GetData()
{
DataTable dt = prodDBService.GetUnitPriceData(_deviceCode);
@ -233,11 +249,11 @@ namespace XGLFinishPro.Views
string queryP = this.txtP.Text.Trim();
if (string.IsNullOrEmpty(queryP))
{
this.dgUserInfo.ItemsSource = Utils.userList;
this.dgUserInfo.ItemsSource = OnWorkUserList;//Utils.userList;
return;
}
this.dgUserInfo.ItemsSource = null;
var queryList = Utils.userList.Where(t => t.nick_name.Contains(queryP) || t.user_name.Contains(queryP));
var queryList = OnWorkUserList.Where(t => t.nick_name.Contains(queryP) || t.user_name.Contains(queryP));//Utils.userList.Where(t => t.nick_name.Contains(queryP) || t.user_name.Contains(queryP));
this.dgUserInfo.ItemsSource = queryList;
}
@ -251,7 +267,7 @@ namespace XGLFinishPro.Views
{
try
{
if (CustomMessageBox.Show("确定要生成该工序的数据吗?", CustomMessageBoxButton.YesNo, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.No)
if (CustomMessageBox.Show("确定要生成该工序的数据吗?", CustomMessageBoxButton.OKCancel, CustomMessageBoxIcon.Question) == CustomMessageBoxResult.Cancel)
return;
if (checkedRowsCache.Count == 0)
{

Loading…
Cancel
Save