diff --git a/shangjian/CommonFunc/Tools/PlcHelper.cs b/shangjian/CommonFunc/Tools/PlcHelper.cs index 13dd43c..514b03b 100644 --- a/shangjian/CommonFunc/Tools/PlcHelper.cs +++ b/shangjian/CommonFunc/Tools/PlcHelper.cs @@ -22,7 +22,7 @@ namespace CommonFunc.Tools { int Result; int Rack = 0; - int Slot = 0; + int Slot = 1; Result = Client.ConnectTo(ipaddress, Rack, Slot); if (Result == 0) diff --git a/shangjian/XGL.Data/DBService/FormingMachineService.cs b/shangjian/XGL.Data/DBService/FormingMachineService.cs index 2cef18e..62af791 100644 --- a/shangjian/XGL.Data/DBService/FormingMachineService.cs +++ b/shangjian/XGL.Data/DBService/FormingMachineService.cs @@ -3,6 +3,7 @@ using CommonFunc.Tools; using System; using System.Collections.Generic; using System.Data; +using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -273,8 +274,7 @@ where res.taskcode = '0' and equipmentCode = 'C6' and res.OrderCode is not null ('{CommonFunc.Common.GetUUID()}', '{LoginUser.UserId}', '{LoginUser.UserName}', '{type}', GetDate(), '工单状态更新-暂停', 'w2', '{status}', '{deviceCode}','{remark}','{orderCode}');"; } - string sql = $@"update pro_order_workorder set status = '{status}' where workorder_code = '{orderCode}'"; - sqlList.Add(sql); + sqlList.Add(logSql); bool issucc = Utils.netClientDBHelper.executeBatchSql(sqlList); @@ -1222,7 +1222,7 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC"; string date = DateTime.Parse(workDate).ToString("yyyy-MM-dd"); string sql = $@"select workorder_id,product_name,product_code from pro_order_workorder - where prod_line_code like '%{deviceCode}%' and product_date='{date}' and parent_order='0' order by parent_order"; + where prod_line_code like '%{deviceCode}%' and product_date='{date}' and status='w2' and del_flag='0' and parent_order='0' order by parent_order"; //string sql = $@"select workorder_id,product_name // from pro_order_workorder // where prod_line_code like '%{deviceCode}% and status='w2''"; @@ -1561,7 +1561,7 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC"; return null; } - public void UpdateMesTableSelf(string id, string text, string text1,string isFinal) + public void UpdateMesTableSelf(string id, string text, string text1, string isFinal) { string sql = $@"update [dbo].[mes_table_self] set bz='{text}',create_by='{text1}',is_final='{isFinal}' where id='{id}'"; Utils.netClientDBHelper.executeUpdate(sql); @@ -1569,7 +1569,8 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC"; public List GetBatchCode(string workId) { - string sql = $@"select batch_code from pro_order_workorder_batch where workorder_id='{workId}'"; + //string sql = $@"select batch_code from pro_order_workorder_batch where workorder_id='{workId}'"; + string sql = $@"select a.batch_code from pro_order_workorder_batch a join pro_order_workorder b on a.workorder_id=b.workorder_id where b.workorder_id='{workId}' and b.status='w2' and a.del_flag='0'"; DataSet ds = Utils.netClientDBHelper.getDataSet(sql); List list = new List(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) @@ -1589,18 +1590,110 @@ where machine_code = 'X1' and bind_status = '0' order by update_time DESC"; return Utils.netClientDBHelper.executeUpdate(sql); } - public string GetProOrderWorkorderBatchStatusById(string workorderId,string batch_code) + public string GetProOrderWorkorderBatchStatusById(string workorderId, string batch_code) { string sql = $@"select qc_status from [dbo].[pro_order_workorder_batch] where workorder_id='{workorderId}' and batch_code='{batch_code}' and del_flag='0'"; DataSet ds = Utils.netClientDBHelper.getDataSet(sql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { return ds.Tables[0].Rows[0]["qc_status"].ToString(); - }else + } + else { return ""; } } + + public DataTable GetBaseProduct(string productCode) + { + string sql = $@"select product_desc_en,box_type,umrez from base_product where product_code='{productCode}'"; + DataSet ds = Utils.netClientDBHelper.getDataSet(sql); + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0]; + } + return null; + } + + public DataTable GetBaseProductAtt(string productCode) + { + string adjustedProductCode = productCode.Length > 7 ? productCode.Substring(7) : productCode; + string sql = $@"select pack_type from base_product_attached where product_code='{adjustedProductCode}'"; + DataSet ds = Utils.netClientDBHelper.getDataSet(sql); + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0]; + } + return null; + } + + public bool UpdateProWorkBatchInWork(string lineCode, string batchCode, string workorderCode, string productCode, string productName, string productdescen, string boxType, string packType, string umrez, string status, string productDate) + { + string sql = $@"update pro_workbatch_inwork set workorder_code='{workorderCode}',batch='{batchCode}',product_code='{productCode}',status='{status}',product_name='{productName}',product_name_en='{productdescen}',box_type='{boxType}',pack_type='{packType}',umrez='{umrez}',product_date='{productDate}' where line_code='{lineCode}' "; + return Utils.netClientDBHelper.executeUpdate(sql) > 0; + } + + public DataTable GetProductSize(string productCode) + { + string sql = $"SELECT length,width,height from base_product where product_code='{productCode}'"; + DataSet ds = Utils.netClientDBHelper.getDataSet(sql); + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0]; + } + return null; + } + + public DataTable GetWcsPlcPoint(string[] plcPointNo, string equip) + { + string plcPointNoStr = ""; + foreach (string item in plcPointNo) + { + plcPointNoStr += $"'{item}',"; + } + plcPointNoStr = plcPointNoStr.TrimEnd(','); + string sql = $"SELECT * FROM wcs_plc_point WHERE plc_point_no IN ({plcPointNoStr}) and equip='{equip}'"; + DataSet ds = Utils.netClientDBHelper.getDataSet(sql); + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0]; + } + return null; + } + + public bool UpdateProWorkBatchInWorkStatus(string lineCode, string status) + { + string sql = $@"update pro_workbatch_inwork set status='{status}' where line_code='{lineCode}' "; + return Utils.netClientDBHelper.executeUpdate(sql) > 0; + } + + public bool UpdateProWorkBatchInWorkBatchCode(string lineCode, string batchCode, string status,string productCode,string productName) + { + string sql = $@"update pro_workbatch_inwork set batch='{batchCode}',product_code='{productCode}',product_name='{productName}',status='{status}' where line_code='{lineCode}' "; + return Utils.netClientDBHelper.executeUpdate(sql) > 0; + } + + public DataTable GetMesBoxInfo(string box_type) + { + string sql = $"select * from mes_box where box_type='{box_type}' and del_flag='0'"; + DataSet ds = Utils.netClientDBHelper.getDataSet(sql); + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0]; + } + return null; + } + + public string GetWorkOrderParentStatus(string workorderCode) + { + string sql = $@"select status from pro_order_workorder where workorder_code='{workorderCode}' and parent_order='0'"; + DataSet ds = Utils.netClientDBHelper.getDataSet(sql); + if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) + { + return ds.Tables[0].Rows[0]["status"].ToString(); + } + return ""; + } } public class MesTableSelfDetialModel { diff --git a/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs b/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs index a3b6e1e..98a4b4a 100644 --- a/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs +++ b/shangjian/XGL.Data/DBServiceFinishProd/FinishProdDBService.cs @@ -752,11 +752,27 @@ where product_code = '{productCode.Replace("0000000", "")}' and line_code = '{de return null; } + public DataTable GetOrderInfo(string workorderID) + { + 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,workorder.belong_work_order +from pro_order_workorder workorder +left JOIN base_shifts_t shifts on workorder.shift_id = shifts.shift_id +where 1=1 and + workorder.workorder_code ='{workorderID}'"; + 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) { 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 +product_spc,shifts.shift_desc,prod_line_code,workorder.status,route_code,quantity_split,unit,workorder.shift_id,workorder.belong_work_order from pro_order_workorder workorder left JOIN base_shifts_t shifts on workorder.shift_id = shifts.shift_id where 1=1 and @@ -1113,7 +1129,17 @@ where detail.parent_work_order = '{processid}'"; //where CONVERT(VARCHAR(10), w return Utils.netClientDBHelper.executeUpdate(sql1) > 0 ? true : false; } + /// + /// 更新湿料计划同步状态、工单状态 + /// + /// + public bool UpdateSycnFlagByBelongWorkOrder(string belongWorkOrderId, string deviceCode, string user, string status) + { + string sql1 = $@"update pro_order_workorder set status = '{status}',workorder_name = '{deviceCode}', update_by = '{LoginUser.UserName}',attr3='{user}',update_time = GETDATE(),start_work_time = GETDATE() where belong_work_order = '{belongWorkOrderId}' "; + LogHelper.instance.log.Info("开始工单SQl:" + sql1); + return Utils.netClientDBHelper.executeUpdate(sql1) > 0 ? true : false; + } /// /// 删除薪酬录入 /// @@ -1168,7 +1194,11 @@ where detail.parent_work_order = '{processid}'"; //where CONVERT(VARCHAR(10), w ('{CommonFunc.Common.GetUUID()}', '{LoginUser.UserId}', '{LoginUser.UserName}', '{type}', GetDate(), '工单报工', 'w2', '{status}', '{deviceCode}','{remark}','{orderCode}','{materialCode}','{materialDesc}','{LoginUser.Version}','{LoginUser.CurrDeviceIP}');"; } - + //if (status == "w3") + //{ + // string sql = $@"update pro_order_workorder set status = '{status}',update_time = GETDATE(),end_work_time = GETDATE() where workorder_code = '{orderCode}'"; + // sqlList.Add(sql); + //} sqlList.Add(logSql); bool issucc = Utils.netClientDBHelper.executeBatchSql(sqlList); diff --git a/shangjian/XGL/App.config b/shangjian/XGL/App.config index c5eaaa5..d2b4db4 100644 --- a/shangjian/XGL/App.config +++ b/shangjian/XGL/App.config @@ -10,9 +10,9 @@ - + - + diff --git a/shangjian/XGL/App.xaml.cs b/shangjian/XGL/App.xaml.cs index d47e18f..046b475 100644 --- a/shangjian/XGL/App.xaml.cs +++ b/shangjian/XGL/App.xaml.cs @@ -37,7 +37,7 @@ namespace XGL AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; //Task线程内未捕获异常处理事件 TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;//Task异常 - + Common.ApplicationDicStr = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); Common.ThriftConfigIp = ConfigurationManager.AppSettings["thriftIp"]; Common.ThriftConfigPort = ConfigurationManager.AppSettings["thriftPort"]; diff --git a/shangjian/XGL/LoginPage.xaml.cs b/shangjian/XGL/LoginPage.xaml.cs index bb987ff..1f4d7f7 100644 --- a/shangjian/XGL/LoginPage.xaml.cs +++ b/shangjian/XGL/LoginPage.xaml.cs @@ -97,13 +97,21 @@ namespace XGL private void InitVersion() { - string fileName = "vsion.txt"; // 指定要操作的文件名 - string filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName); // 构建完整的文件路径 + try + { + string fileName = "vsion.txt"; // 指定要操作的文件名 + string filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName); // 构建完整的文件路径 - string fileContent = File.ReadAllText(filePath); + string fileContent = File.ReadAllText(filePath); - lbVersion.Content = fileContent; - LoginUser.Version = fileContent; + lbVersion.Content = fileContent; + LoginUser.Version = fileContent; + } + catch + { + + } + } private void btnlogin_Click(object sender, RoutedEventArgs e) diff --git a/shangjian/XGL/config/ConnectionConfig.Config b/shangjian/XGL/config/ConnectionConfig.Config index 66aee6d..70edcf5 100644 --- a/shangjian/XGL/config/ConnectionConfig.Config +++ b/shangjian/XGL/config/ConnectionConfig.Config @@ -3,15 +3,15 @@ 强烈建议:对数据库以及本软件的参数更改,不要在此页进行.可以通过系统配置页进行更新. - vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNnL+PpPtMzMa3twenC59knc+hzG9+/BpVUziKe0re5+K7EarPL+O+z1yYkea4KSxvd0pYaBws8NBUfRakxq8PBtNc1SFWCuPGjfGL/ZHZr/yKO3oLzGk4KHKBgHdnI182Gw68ADwmuC5BzxvlYPefyby8TkSEmemNvt81w7QBmU5M= + - vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlF0tM4FO8qPh090fSbocpFrq1jWXNjwNnXgKYRJ9zN5oAHgVngDpmr/dw8Hc1dHuNE73NlxQdTq/+57SfWg+Ya5uD7N8RaXKNRAP0mCGTNtIXcAyKOR1JdH+n1t3euTba + vadMWi9D6ZBkwIr78LoLmGwiSCvVnpY3nMB7IyQlxFiV2OD5s5WUgOabwGwWK3THofFvPL2rHpOvJVIvtz0oZU/NFQyT8KQlbk0rHjUXoU7wgRdUumDJ1RrSFmIjPm8S - + vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91w41/fcxqaq/+4SEgJrXDqR11H6yLI6j0e+twOEf+dgxO2izAFRQ8gHi3LlPP+MhoPB53b/3a/Jd77lDX8gemUvFsAcxEIF0V/c/nkoIAT6M+WIrSSS1icw6HuVSEjGl1zPqinhBhfvehu5cxP02aD/dmOZJEXtBdPUgLuwVFLRI= - + vadMWi9D6ZC3usVUY51rbTRH8TjL6CxlHbduXNDkc8suJwqe10me6ktk8XD3QU91ML11cYCqHcHmTXJFsNQamIbW3UEpkjgNPUcBwRfgP6AWftvk9YFyv7y7/6nzX/c+6z6xMDIdcjYVvfteU+7YtOQhJXTfF5ScosAA0GliBfD8dWAunW+ZCos5LemAj2xb2wvvCxlbnrof8IunWslCaBEAGrdC/KhE0qEfNbxydwc= \ No newline at end of file diff --git a/shangjian/XGLFinishPro/App.config b/shangjian/XGLFinishPro/App.config index 11adb0f..db5af69 100644 --- a/shangjian/XGLFinishPro/App.config +++ b/shangjian/XGLFinishPro/App.config @@ -10,7 +10,7 @@ - + @@ -94,6 +94,10 @@ + + + + diff --git a/shangjian/XGLFinishPro/LoginPage.xaml.cs b/shangjian/XGLFinishPro/LoginPage.xaml.cs index c29a229..c3c48cd 100644 --- a/shangjian/XGLFinishPro/LoginPage.xaml.cs +++ b/shangjian/XGLFinishPro/LoginPage.xaml.cs @@ -1,4 +1,5 @@ -using CommonFunc; +using CentralControl.BaseData; +using CommonFunc; using CommonFunc.Tools; using System; using System.Collections.Generic; @@ -158,6 +159,7 @@ namespace XGLFinishPro private int LoginStatus = 0; private int JudgeLogin() { + DateTime dt1 = DateTime.Now; try { diff --git a/shangjian/XGLFinishPro/Tools/SerialHelper.cs b/shangjian/XGLFinishPro/Tools/SerialHelper.cs index 3fbbc46..42848e9 100644 --- a/shangjian/XGLFinishPro/Tools/SerialHelper.cs +++ b/shangjian/XGLFinishPro/Tools/SerialHelper.cs @@ -131,7 +131,7 @@ namespace XGLFinishPro.Tools /// 启停状态 public void DOControl(DOName dOName, DOOnOff dOOnOff) { - //ComOn(); + ComOn(); serialPort.Write(new byte[] { 0xE3, 0x01, 0x09, (byte)dOName, (byte)dOOnOff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0, 12); } diff --git a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml index 800787e..4422ff2 100644 --- a/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml +++ b/shangjian/XGLFinishPro/Views/ExecReportWorkWin.xaml @@ -1,65 +1,92 @@ - + - - - - - + + - + - - + + - - - + + + - - +