diff --git a/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs b/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs index d9db4e5..f64e37d 100644 --- a/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs +++ b/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs @@ -94,7 +94,21 @@ namespace XGL.Dats.DBServiceFinishProd /// public DataTable GetUserInfoFromCloudServer(string userID) { - string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and pe_snr like '%{userID}%'"; + string sql = $@"SELECT + su.user_name, + su.nick_name, + su.sex, + sp.post_name +FROM + sys_user su +LEFT JOIN + sys_post sp +ON + su.post = sp.post_code +WHERE + su.del_flag = '0' + AND su.pe_snr LIKE '{userID}'; +"; DataSet dtset = Utils.cloudDBHelper.getDataSet(sql); if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0) { @@ -109,8 +123,21 @@ namespace XGL.Dats.DBServiceFinishProd /// public DataTable GetUserCodeServer(string userID) { - string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and user_name = '{userID}'"; - DataSet dtset = Utils.cloudDBHelper.getDataSet(sql); + string sql = $@"SELECT + su.user_name, + su.nick_name, + su.sex, + sp.post_name +FROM + sys_user su +LEFT JOIN + sys_post sp +ON + su.post = sp.post_code +WHERE + su.del_flag = '0' + AND su.user_name = '{userID}'; +"; DataSet dtset = Utils.cloudDBHelper.getDataSet(sql); if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0) { return dtset.Tables[0]; @@ -134,17 +161,17 @@ namespace XGL.Dats.DBServiceFinishProd return null; } - public bool InsertAttendanceRecord(string userID, string userName, string sex, string deviceCode) + public bool InsertAttendanceRecord(string userID, string userName, string sex,string post, string deviceCode) { string attendanceTime = LoginUser.Start_Time + "-" + LoginUser.End_Time; string sql = $@" INSERT INTO [dbo].[mes_attendance_records] ([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]) + [attendance_date], [work_hours], [create_time],[post]) VALUES ('{Common.GetUUID()}', '{userID}', '{userName}', '正常', '{sex}', 18, null, GetDate(), '{deviceCode}', null, null, '{attendanceTime}', - CONVERT(VARCHAR(10), GetDate() , 120), 0, GetDate());"; + CONVERT(VARCHAR(10), GetDate() , 120), 0, GetDate(),'{post}');"; int ret = Utils.netClientDBHelper.executeUpdate(sql); return ret > 0 ? true : false; } @@ -187,6 +214,7 @@ WHERE user_id = '{userID}' attendance_date, work_hours, create_time, +post, CONVERT(DECIMAL(12, 2), CASE WHEN end_time IS NOT NULL THEN DATEDIFF(MINUTE, start_time, end_time) / 60.00 @@ -708,9 +736,9 @@ where 1=1 and /// public DataTable GetUnitPriceData(string deviceCode ,string sheredata) { - 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] ,[attr1],[attr2] + 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], [post],[line_code] ,[attr1],[attr2] from mes_unitprice_report -where line_code = '{deviceCode}' AND create_time BETWEEN '{sheredata} 00:00:00' AND '{sheredata} 23:59:59' ORDER BY childprocess_code,create_time"; +where line_code = '{deviceCode}' AND work_order_product_date BETWEEN '{sheredata} 00:00:00' AND '{sheredata} 23:59:59' 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) @@ -762,20 +790,20 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C /// /// /// - public string GetCreateUnitPriceInfo(sys_user item,string workorderCode, string sapWorkorderCode,string productCode,string productName,string childProcessCode,string childProcessName,string deviceCode,string number,string credata,string attr2) + public string GetCreateUnitPriceInfo(sys_user item,string workorderCode, string sapWorkorderCode,string productCode,string productName,string childProcessCode,string childProcessName,string deviceCode,string number,string credata,string attr2, string post) { 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] + [update_time], [remark] ,[post],[line_code],[work_order_product_date] ) VALUES ( '{Common.GetUUID()}', '{workorderCode}','{sapWorkorderCode}', '{productName}', '{productCode}', N'{item.user_name}', N'{item.nick_name}', N'{childProcessCode}', N'{childProcessName}',' {number}', - {attr2}, NULL, '{LoginUser.UserName}', '{credata} 00:00:00', NULL, - NULL, NULL,'{deviceCode}' );"; + {attr2}, NULL, '{LoginUser.UserName}', '{DateTime.Now.ToString("G")}', NULL, + NULL, NULL,'{post}','{deviceCode}','{credata} 00:00:00' );"; return sql; } @@ -795,7 +823,8 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C public List GetOnWorkUserList(string deviceCode,string shereDate) { - string sql = $"WITH RankedRecords AS (\r\n SELECT \r\n user_id as user_name,\r\n user_name as nick_name,\r\n sex,\r\n age,\r\n create_time,\r\n ROW_NUMBER() OVER (PARTITION BY user_name ORDER BY create_time DESC) as rn\r\n FROM [dbo].[mes_attendance_records]\r\n WHERE start_addr = '{deviceCode}' \r\n AND create_time BETWEEN '{shereDate} 00:00:00' AND '{shereDate} 23:59:59'\r\n)\r\nSELECT \r\n user_name,\r\n nick_name,\r\n sex,\r\n age,\r\n create_time\r\nFROM RankedRecords\r\nWHERE rn = 1\r\nORDER BY create_time DESC;"; + string sql = $"\r\n SELECT \r\n user_id as user_name,\r\n user_name as nick_name,\r\n sex,\r\n age,\r\n\t\t\t\tpost, \r\n create_time FROM mes_attendance_records WHERE start_addr = '{deviceCode}' \r\n AND create_time BETWEEN '{shereDate} 00:00:00' AND '{shereDate} 23:59:59' ORDER BY create_time DESC;"; + // string sql = $"WITH RankedRecords AS (\r\n SELECT \r\n user_id as user_name,\r\n user_name as nick_name,\r\n sex,\r\n post,\r\n age,\r\n create_time,\r\n ROW_NUMBER() OVER (PARTITION BY user_name ORDER BY create_time DESC) as rn\r\n FROM [dbo].[mes_attendance_records]\r\n WHERE start_addr = '{deviceCode}' \r\n AND create_time BETWEEN '{shereDate} 00:00:00' AND '{shereDate} 23:59:59'\r\n)\r\nSELECT \r\n user_name,\r\n nick_name,\r\n post, sex,\r\n age,\r\n create_time\r\nFROM RankedRecords\r\nWHERE rn = 1\r\nORDER BY create_time DESC;"; DataTable dt = Utils.netClientDBHelper.getDataSet(sql).Tables[0]; diff --git a/shangjian/XGL.Model/Model/sys_user.cs b/shangjian/XGL.Model/Model/sys_user.cs index 958283e..301cc64 100644 --- a/shangjian/XGL.Model/Model/sys_user.cs +++ b/shangjian/XGL.Model/Model/sys_user.cs @@ -27,7 +27,10 @@ namespace XGL.Models.Model /// 编码 /// public int user_id { get; set; } - + /// + /// 岗位 + /// + public string post { get; set; } /// /// 部门编码 /// diff --git a/shangjian/XGLFinishPro/App.config b/shangjian/XGLFinishPro/App.config index 2de7c83..11adb0f 100644 --- a/shangjian/XGLFinishPro/App.config +++ b/shangjian/XGLFinishPro/App.config @@ -10,7 +10,7 @@ - + diff --git a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml index e1ac715..ccec373 100644 --- a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml +++ b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml @@ -237,11 +237,11 @@ - + - + diff --git a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml.cs b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml.cs index 938be23..79a3e76 100644 --- a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml.cs +++ b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml.cs @@ -655,8 +655,14 @@ namespace XGLFinishPro.Views lbl.FontSize = 24; lbl.VerticalAlignment = VerticalAlignment.Center; lbl.HorizontalAlignment = HorizontalAlignment.Left; - lbl.Content = sort + "层工时:"; - + if (sort=="一") + { + lbl.Content = "半品工单工时:"; + }else if (sort == "二") + { + lbl.Content = "子半品工单工时:"; + } + TextBox textBox = new TextBox(); textBox.FontSize = 24; textBox.Width = 260; @@ -669,7 +675,15 @@ namespace XGLFinishPro.Views lblUserCount.FontSize = 24; lblUserCount.VerticalAlignment = VerticalAlignment.Center; lblUserCount.HorizontalAlignment = HorizontalAlignment.Left; - lblUserCount.Content = sort + "层人数:"; + if (sort == "一") + { + lblUserCount.Content = "半品工单人数:"; + } + else if (sort == "二") + { + lblUserCount.Content = "子半品工单工时人数:"; + } + myStackPanelWorkTime.Children.Add(lbl); myStackPanelWorkTime.Children.Add(textBox); Grid.SetRow(myStackPanelWorkTime, 3 + sortNo); diff --git a/shangjian/XGLFinishPro/Views/LanJu_User.xaml.cs b/shangjian/XGLFinishPro/Views/LanJu_User.xaml.cs index 3889df3..9803f0c 100644 --- a/shangjian/XGLFinishPro/Views/LanJu_User.xaml.cs +++ b/shangjian/XGLFinishPro/Views/LanJu_User.xaml.cs @@ -1,5 +1,6 @@ using CommonFunc; using CommonFunc.Tools; +using HandyControl.Tools.Extension; using System; using System.Collections.Generic; using System.Data; @@ -7,6 +8,7 @@ using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; +using System.Web.Services.Description; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -94,6 +96,7 @@ namespace XGLFinishPro.Views string userCode = dtUserInfo.Rows[0]["user_name"].ToString(); string userName = dtUserInfo.Rows[0]["nick_name"].ToString(); string sex = dtUserInfo.Rows[0]["sex"].ToString(); + string post = dtUserInfo.Rows[0]["post_name"].ToString(); DataTable dt = finishProdDBService.GetExistAttendanceRecord(deviceCode,LoginUser.WorkDate); if (dt != null && dt.Select($"user_id = '" + userCode + "' AND end_time IS NULL and start_addr='"+ deviceCode + "'").Length > 0) { @@ -113,7 +116,7 @@ namespace XGLFinishPro.Views } else { - bool isSucc = finishProdDBService.InsertAttendanceRecord(userCode, userName, sex, deviceCode); + bool isSucc = finishProdDBService.InsertAttendanceRecord(userCode, userName,sex, post, deviceCode); if (isSucc) { CustomMessageBox.Show("打卡成功,祝您工作愉快!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success,1500); @@ -167,6 +170,7 @@ namespace XGLFinishPro.Views string userCode = dtUserInfo.Rows[0]["user_name"].ToString(); string userName = dtUserInfo.Rows[0]["nick_name"].ToString(); string sex = dtUserInfo.Rows[0]["sex"].ToString(); + string post = dtUserInfo.Rows[0]["post_name"].ToString(); DataTable dt = finishProdDBService.GetExistAttendanceRecord(deviceCode,LoginUser.WorkDate); if (dt != null && dt.Select($"user_id = '" + userCode + "' AND end_time IS NULL and start_addr='" + deviceCode + "'").Length > 0) { @@ -187,7 +191,7 @@ namespace XGLFinishPro.Views } else { - bool isSucc = finishProdDBService.InsertAttendanceRecord(userCode, userName, sex, deviceCode); + bool isSucc = finishProdDBService.InsertAttendanceRecord(userCode, userName, sex, post, deviceCode); if (isSucc) { CustomMessageBox.Show("打卡成功,祝您工作愉快!", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success, 1500); diff --git a/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml b/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml index 0460cbd..09ab577 100644 --- a/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml +++ b/shangjian/XGLFinishPro/Views/LanJu_UserRecord.xaml @@ -67,6 +67,7 @@ + diff --git a/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml b/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml index 13bebdd..2439027 100644 --- a/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml +++ b/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml @@ -396,17 +396,18 @@ - + - - - - + + + + + @@ -447,6 +448,7 @@ + diff --git a/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml.cs b/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml.cs index d109768..f722029 100644 --- a/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml.cs +++ b/shangjian/XGLFinishPro/Views/PieceSalaryCalWin.xaml.cs @@ -460,7 +460,7 @@ namespace XGLFinishPro.Views { item.attr2 = "0"; } - string sql = prodDBService.GetCreateUnitPriceInfo(item, _workOrderCode, _sapWorkOrderCode, _productCode, _productName, _childprocessCode, _childprocessName, sapCode, item.number,LoginUser.WorkDate,item.attr2); + string sql = prodDBService.GetCreateUnitPriceInfo(item, _workOrderCode, _sapWorkOrderCode, _productCode, _productName, _childprocessCode, _childprocessName, sapCode, item.number,LoginUser.WorkDate,item.attr2,item.post); CreateUnitPriceSqlList.Add(sql); } //if (!name.IsNullOrEmpty())