diff --git a/shangjian/CommonFunc/HMessageBox.xaml.cs b/shangjian/CommonFunc/HMessageBox.xaml.cs index a6ec737..2809c86 100644 --- a/shangjian/CommonFunc/HMessageBox.xaml.cs +++ b/shangjian/CommonFunc/HMessageBox.xaml.cs @@ -13,6 +13,7 @@ using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using System.Windows.Threading; namespace CommonFunc { @@ -52,12 +53,26 @@ namespace CommonFunc /// public CustomMessageBoxResult Result { get; set; } + private DispatcherTimer _closeTimer; + #endregion public HMessageBox() { InitializeComponent(); } + public HMessageBox(int closeAfterMilliseconds) + { + InitializeComponent(); + + if (closeAfterMilliseconds > 0) + { + _closeTimer = new DispatcherTimer(); + _closeTimer.Interval = TimeSpan.FromMilliseconds(closeAfterMilliseconds); + _closeTimer.Tick += CloseTimer_Tick; + _closeTimer.Start(); + } + } public void SetControl() { OkButton.Visibility = OkButtonVisibility; @@ -72,6 +87,12 @@ namespace CommonFunc } + private void CloseTimer_Tick(object sender, EventArgs e) + { + _closeTimer.Stop(); + this.Close(); + } + private void Window_Closed(object sender, EventArgs e) { this.Close(); diff --git a/shangjian/CommonFunc/Tools/CustomMessageBox.cs b/shangjian/CommonFunc/Tools/CustomMessageBox.cs index 49a8ce4..feb41be 100644 --- a/shangjian/CommonFunc/Tools/CustomMessageBox.cs +++ b/shangjian/CommonFunc/Tools/CustomMessageBox.cs @@ -71,6 +71,64 @@ namespace CommonFunc.Tools } + public static CustomMessageBoxResult Show(string messageBoxText, CustomMessageBoxButton messageBoxButton, CustomMessageBoxIcon messageBoxImage, int closeAfterMilliseconds = 0) + { + HMessageBox window = new HMessageBox(closeAfterMilliseconds); + try + { + window.MessageBoxText = messageBoxText; + window.OkButtonVisibility = Visibility.Hidden; + window.CancelButtonVisibility = Visibility.Hidden; + window.YesButtonVisibility = Visibility.Hidden; + window.NoButtonVisibility = Visibility.Hidden; + switch (messageBoxImage) + { + case CustomMessageBoxIcon.Question: + window.ImagePath = @"Resources/alert.png"; + break; + case CustomMessageBoxIcon.Error: + window.ImagePath = @"Resources/Error.png"; + break; + case CustomMessageBoxIcon.Warning: + window.ImagePath = @"Resources/alert.png"; + break; + case CustomMessageBoxIcon.Success: + window.ImagePath = @"Resources/Success.png"; + break; + } + switch (messageBoxButton) + { + case CustomMessageBoxButton.OK: + window.OkButtonVisibility = Visibility.Visible; + break; + case CustomMessageBoxButton.OKCancel: + window.OkButtonVisibility = Visibility.Visible; + window.CancelButtonVisibility = Visibility.Visible; + break; + case CustomMessageBoxButton.YesNo: + window.YesButtonVisibility = Visibility.Visible; + window.NoButtonVisibility = Visibility.Visible; + break; + case CustomMessageBoxButton.YesNoCancel: + window.YesButtonVisibility = Visibility.Visible; + window.NoButtonVisibility = Visibility.Visible; + window.CancelButtonVisibility = Visibility.Visible; + break; + default: + window.OkButtonVisibility = Visibility.Visible; + break; + } + window.SetControl(); + window.ShowDialog(); + } + catch (Exception ex) + { + LogHelper.instance.log.Error("调用弹出消息 异常:" + ex.Message); + } + return window.Result; + } + + public static CustomMessageBoxResult Show(string messageBoxText) { HMessageBox window = new HMessageBox(); diff --git a/shangjian/XGL.Data/DBService/FormingMachineService.cs b/shangjian/XGL.Data/DBService/FormingMachineService.cs index 82744bd..2d322ef 100644 --- a/shangjian/XGL.Data/DBService/FormingMachineService.cs +++ b/shangjian/XGL.Data/DBService/FormingMachineService.cs @@ -20,7 +20,7 @@ namespace XGL.Data.DBService /// /// public DataTable GetFormingMachineInfo(string devicecode, string workDate) - { + { //过于复杂,给数据库造成了压力,经常死锁 // string sql = $@"SELECT DISTINCT // ord.workorder_id, @@ -67,16 +67,19 @@ namespace XGL.Data.DBService LEFT JOIN base_shifts_t shift WITH (NOLOCK) on ord.shift_id = shift.Shift_Id WHERE CONVERT(VARCHAR(10), ord.product_date , 120) = CONVERT(VARCHAR(10), '{workDate}', 120 ) - And ord.prod_line_code like '%{devicecode}%' "; + And ord.prod_line_code like '%{devicecode}%' AND ord.del_flag='0'"; DataSet dtset = Utils.netClientDBHelper.getDataSet(sql); if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0) { foreach (DataRow item in dtset.Tables[0].Rows) { string work0rderID = item["workorder_id"].ToString(); - string totalcountSql = $@" select count(*) as totalCount from mes_material_transfer_result WITH (NOLOCK) - where CONVERT(VARCHAR(10), work_date , 120) = CONVERT(VARCHAR(10),'{workDate}', 120) and equipmentCode = '{devicecode}' and OrderCode = '{work0rderID}' group by OrderCode "; - DataSet dtsetTotalCount = Utils.netClientDBHelper.getDataSet(totalcountSql); + string totalsql = $"SELECT count(*) FROM mes_material_transfer_result result WHERE result.equipmentCode =" + + $" '{devicecode}' AND result.update_time >= ( SELECT TOP 1 create_time FROM mes_changeshift_info WHERE device_code" + + $" = '{devicecode}' ORDER BY create_time DESC ) AND result.rfid_status='1' ;"; + // string totalcountSql = $@" select count(*) as totalCount from mes_material_transfer_result WITH (NOLOCK) + //where CONVERT(VARCHAR(10), work_date , 120) = CONVERT(VARCHAR(10),'{workDate}', 120) and equipmentCode = '{devicecode}' and OrderCode = '{work0rderID}' group by OrderCode "; + DataSet dtsetTotalCount = Utils.netClientDBHelper.getDataSet(totalsql); if (dtsetTotalCount != null && dtsetTotalCount.Tables.Count > 0 && dtsetTotalCount.Tables[0].Rows.Count > 0) { item["totalCount"] = dtsetTotalCount.Tables[0].Rows[0][0]; @@ -133,6 +136,25 @@ namespace XGL.Data.DBService return null; } + /// + /// 获取接口URL + /// + /// + /// + /// + public string InterfaceUrl( string url_type) + { + string sql = $@"select url FROM mes_interface_url WHERE url_type='{url_type}'"; + + DataSet dtset = Utils.netClientDBHelper.getDataSet(sql); + if (dtset != null && dtset.Tables.Count > 0) + { + // 获取查询结果中的计数值并转换为字符串 + string countAsString = dtset.Tables[0].Rows[0][0].ToString(); + return countAsString; + } + return null; + } /// /// 获取成型机状态 @@ -929,6 +951,39 @@ VALUES return null; } + /// + /// 获取工单 + /// + /// + /// + public DataTable Getorderworkorder(string orderCode) + { + string sql = $@"select * from pro_order_workorder WHERE workorder_code='{orderCode}' AND 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]; + } + return null; + } + /// + /// 获取所在车间 + /// + /// + /// + public DataTable GetWorkShop(string eqment) + { + string sql = $@"select * from base_equipment WHERE equipment_code='{eqment}' AND 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]; + } + return null; + } + /// /// 获取报工总数量 /// diff --git a/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs b/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs index 5e19593..4693537 100644 --- a/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs +++ b/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs @@ -93,7 +93,7 @@ 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 (user_name = '{userID}' or pe_snr = '{userID}')"; + string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and pe_snr = '{userID}'"; DataSet dtset = Utils.cloudDBHelper.getDataSet(sql); if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0) { @@ -137,12 +137,37 @@ WHERE user_id = '{userID}' return ret > 0 ? true : false; } - public DataTable GetAttendanceRecord(string v) + public DataTable GetAttendanceRecord(string v,string data) { - 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,Convert(DECIMAL(12,2),DATEDIFF((MINUTE), start_time, GetDate()) / 60.00) as diff - from mes_attendance_records where start_addr = '{v}' and attendance_date = CONVERT(VARCHAR(10), GetDate() , 120) order by create_time desc"; + 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, + CONVERT(DECIMAL(12, 2), + CASE + WHEN end_time IS NOT NULL THEN DATEDIFF(MINUTE, start_time, end_time) / 60.00 + ELSE DATEDIFF(MINUTE, start_time, GetDate()) / 60.00 + END) AS diff +FROM + mes_attendance_records +WHERE + start_addr = '{v}' + AND create_time BETWEEN '{data} 00:00:00' AND '{data} 23:59:59' +ORDER BY + create_time DESC; +"; DataSet dtset = Utils.netClientDBHelper.getDataSet(sql); if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0) { @@ -578,9 +603,11 @@ select a.TrayCode,a.ProductBarNo,a.carcode,a.createtime,a.lineno,b.HadNumber { 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,isnull(batch.qc_result,'') qc_result,batch.status as batchStatus,workorder_code_sap,salary_flag,qty.batchQty,batch.batch_quantity - qty.batchQty as diffQty +unit,workorder.shift_id ,batch.batch_code,batch.batch_quantity,sort_no, workorder.parent_order,batch.qc_status,isnull(batch.qc_result,'') qc_result,batch.status as batchStatus,workorder_code_sap,salary_flag,qty.batchQty,batch.batch_quantity - qty.batchQty as diffQty, chack.create_time, + chack.check_status from pro_order_workorder workorder WITH (NOLOCK) left JOIN base_shifts_t shifts WITH (NOLOCK) on workorder.shift_id = shifts.shift_id +LEFT JOIN (SELECT create_time,check_status,order_no FROM qc_check_task WHERE check_type='checkTypeCP' ) chack ON workorder.workorder_code = chack.order_no left JOIN pro_order_workorder_batch batch WITH (NOLOCK) on workorder.workorder_id = batch.workorder_id left join (SELECT sum(quantity_feedback) as batchQty,workorder_code,batch FROM [dbo].[mes_report_work] where del_flag = 0 GROUP BY workorder_code,batch) qty on qty.workorder_code = workorder.workorder_code and batch.batch_code = qty.batch where 1=1 and batch.del_flag = 0 and workorder.del_flag = 0 and @@ -638,7 +665,7 @@ where 1=1 and /// 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] + 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] 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"; @@ -651,6 +678,20 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C } + public string GetUsernumbereData(string deviceCode) + { + string sql = $@"SELECT SUM(quantity_feedback) as total_quantity FROM mes_report_work WHERE workorder_code='{deviceCode}'"; + + DataSet dtset = Utils.netClientDBHelper.getDataSet(sql); + if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0) + { + DataTable dt = dtset.Tables[0]; + return dt.Rows[0]["total_quantity"].ToString(); + } + return null; + } + + /// /// 根据线体、产品获取工序列表 /// @@ -676,7 +717,7 @@ 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) + public string GetCreateUnitPriceInfo(sys_user item,string workorderCode, string sapWorkorderCode,string productCode,string productName,string childProcessCode,string childProcessName,string deviceCode,string number) { string sql = $@"INSERT INTO [dbo].[mes_unitprice_report] ( [id],[workorder_code], [workorder_code_sap], [product_name], [product_code], @@ -687,7 +728,7 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C VALUES ( '{Common.GetUUID()}', '{workorderCode}','{sapWorkorderCode}', '{productName}', '{productCode}', - N'{item.user_name}', N'{item.nick_name}', N'{childProcessCode}', N'{childProcessName}', NULL, + N'{item.user_name}', N'{item.nick_name}', N'{childProcessCode}', N'{childProcessName}',' {number}', NULL, NULL, '{LoginUser.UserName}', getdate(), NULL, NULL, NULL,'{deviceCode}' );"; @@ -709,7 +750,7 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C public List 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) ;"; + 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) order by create_time desc ;"; DataTable dt = Utils.netClientDBHelper.getDataSet(sql).Tables[0]; @@ -958,6 +999,18 @@ where detail.parent_work_order = '{processid}'"; //where CONVERT(VARCHAR(10), w } + /// + /// 删除薪酬录入 + /// + /// + public bool Updateremuneration(string workOrdercode, string nickName,string attr1,string childprocess_code) + { + string sql1 = $@"DELETE FROM mes_unitprice_report WHERE workorder_code_sap='{workOrdercode}' AND nick_name='{nickName}' AND attr1='{attr1}' and childprocess_code='{childprocess_code}' "; + + return Utils.netClientDBHelper.executeUpdate(sql1) > 0 ? true : false; + + } + /// /// 写入开始、报工状态 /// diff --git a/shangjian/XGL.Model/Model/sys_user.cs b/shangjian/XGL.Model/Model/sys_user.cs index d2dd128..a7bbbdc 100644 --- a/shangjian/XGL.Model/Model/sys_user.cs +++ b/shangjian/XGL.Model/Model/sys_user.cs @@ -11,6 +11,10 @@ namespace XGL.Models.Model /// public class sys_user { + /// + /// 报工数量 + /// + public string number { get; set; } /// /// 选中状态 /// diff --git a/shangjian/XGL/App.config b/shangjian/XGL/App.config index 361d988..d49924b 100644 --- a/shangjian/XGL/App.config +++ b/shangjian/XGL/App.config @@ -10,9 +10,9 @@ - + - + diff --git a/shangjian/XGL/config/ConnectionConfig.Config b/shangjian/XGL/config/ConnectionConfig.Config index 39ab7ff..c1b3110 100644 --- a/shangjian/XGL/config/ConnectionConfig.Config +++ b/shangjian/XGL/config/ConnectionConfig.Config @@ -1,10 +1,10 @@  强烈建议:对数据库以及本软件的参数更改,不要在此页进行.可以通过系统配置页进行更新. - - - - + vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S diff --git a/shangjian/XGLFinishPro/App.config b/shangjian/XGLFinishPro/App.config index 11adb0f..a50ba33 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 916acb1..4cbf8ed 100644 --- a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml +++ b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml @@ -259,7 +259,7 @@ - + @@ -333,7 +333,7 @@ - --> - - - + - +