Foxtable(狐表)用户栏目专家坐堂 → SystemReady


  共有1288人关注过本帖树形打印复制链接

主题:SystemReady

帅哥哟,离线,有人找我吗?
creastzh
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:297 积分:2187 威望:0 精华:0 注册:2023/1/11 7:15:00
SystemReady  发帖心情 Post By:2024/3/20 18:04:00 [只看该作者]

老师,您好,向您了解一个问题的解决方案:
此前一直运行良好的的程序,近日出现一个异常, 在运行完毕后,无论我怎样设置,窗口上的页面总是没有动作, 检查发现此时的SystemReady=false, 所以我在程序中增加了一个"Try...Catch Ex...,End Try程序段,结果发现没有效果, 我就又在程序末尾增加了一个SystemReady=True程序段, 然后加了一个Messagebox.show(SystemReady)指令确认其程序结束后是否为"True", 结果显示正常了,
图片点击可在新窗口打开查看

但问题来了, 只要我点击一下窗口,窗口立即变更为行号为不显示, 然后检查此时的 SystemReady又变回了False, 我以为是这个窗口有问题,就事先将其置于其它窗口,然后运行程序,结果发现其它窗口情况一样.
但当我重启项目,如果没有运行该程序时,这个问题却又没有发现, 窗口点击一切正常,

由于出现该问题后,软件无法进行如何操作,实在是百思不得其解,我已经自行查找了该问题2~3天了, 还是找不出问题所在, 所以请老师能帮我看一下, 不甚感激!
[此贴子已经被作者于2024/3/20 20:41:07编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
creastzh
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:297 积分:2187 威望:0 精华:0 注册:2023/1/11 7:15:00
  发帖心情 Post By:2024/3/20 18:08:00 [只看该作者]

'Append_OutSPackAndOthers_Process_In_Process")  '增加例如包装、校直工序
'基本说明:
'1) 从补充工序中增加未完成委外工序的包装等工序; 

Dim s1 As Date = Date.Now
Dim yn1, yn2, yn3 As Integer
Try
    '1) 基于工序计划表未完工工单零件号组合==>读取补充工序零件号对应工序列表;
    '2) 在INISecondarySchedule 表中循环,
    
    'WorkorderStatus, INISecondarySchedule 中新增数据行
    If Not DataTables.Contains("WOrkOrderStatus") Then
        DataTables.Load("WOrkOrderStatus")
    End If
    DataTables("WorkOrderStatus").SQLDeleteFor("WO is Null")
    If Not DataTables.Contains("INISecondarySchedule") Then
        DataTables.Load("INISecondarySchedule")
    End If
    DataTables("INISecondarySchedule").SQLDeleteFor("WO is Null")
    DataTables("INISecondarySchedule").LoadFilter = "WOStatus <>'C'"
    DataTables("INISecondarySchedule").Load
    Dim PNs As String = DataTables("INISecondarySchedule").GetComboListString("PartNumber", "WOStatus<>'C' and WOStatus<>'N'").Replace("|", "','")
    If PNs > "" Then
        PNs = "('" & PNs & "')" '未完工的工单,对应的产品明细
    End If 
    If Not DataTables.Contains("Special_OP") Then
        DataTables.Load("Special_OP")
    End If
    DataTables("Special_OP").LoadFilter = "PartNumber in " & PNs
    DataTables("Special_OP").Load
    Dim PN3s As List(Of String) = DataTables("Special_OP").GetValues("PartNumber", "PartNumber in " & PNs, "PartNumber") '存在需要补充工序的产品集合    
    '按制定产品测试
    'PN3s.Clear
    'PN3s.Add("M463000B114")
    '***********
    
    Dim PNOP As String
    'MessageBox.Show("PN3s.Count:" & PN3s.Count)
    
    '将存在补充工序的不同产品进行展开, 然后到INISecondarySchedule中
    Dim d2 As New Dictionary(Of String, DataRow) 'INISecondarySchedule
    Dim d2n As New Dictionary(Of DataRow, DataRow)
    Dim d2w As New Dictionary(Of DataRow, DataRow)
    Dim d1n As New Dictionary(Of DataRow, DataRow) 'WOrkOrderStatus
    Dim d1w As New Dictionary(Of DataRow, DataRow)
    'Return Nothing
    SystemReady = False
    For Each PN As String In PN3s 
        Dim dr3s As List(Of DataRow) = DataTables("Special_Op").Select("PartNumber ='" & PN & "'", "OP")
        Dim WOs As List(Of String) = DataTables("INISecondarySchedule").GetValues("WO", "PartNumber = '" & PN & "' and WOStatus<>'C'", "WO")
        'Output.Show("SpecialOP 中, " & PN & "的工序有" & dr3s.Count & "条, 在INISecondarySchedule中存在该产品的工单有" & WOs.Count & "条")
        Dim n As Integer
        For Each wo As String In WOs
            'Output.Show("接下来进行  " & wo & "  " & PN & "的数据处理")
            Dim WORs2 As List(Of DataRow) = DataTables("INISecondarySchedule").Select("Wo ='" & wo & "'" , "OP Desc") 
            For Each dr2 As DataRow In WORs2
                PNOP = dr2("PartNumber") & "|" & dr2("OP")
                If Not d2.ContainsKey(PNOP) Then
                    d2.Add(pnop, dr2)
                End If 
            Next
            
            If WORs2.Count > 3 Then '工序数>3 , 这是为了防错而设
                For Each dr3 As DataRow In dr3s 'SpecialOP
                    PNOP = dr3("PartNumber") & "|" & dr3("OP")
                    If Not d2.ContainsKey(PNOP) Then
                        'Output.Show("新增数据行:" & wo & " : " & PNOP)
                        
                        Dim dr2n As DataRow = DataTables("INISecondarySchedule").AddNew
                        d2n.Add(dr2n, dr3)
                        Dim dr2_Next As DataRow = DataTables("INISecondarySchedule").Find("WO = '" & wo & "' and OP> " & dr3("OP"), "OP")
                        If dr2_Next Is Nothing Then
                            'MessageBox.Show(PNOP & "数据行不正常")
                        Else
                            'MessageBox.Show("当前插入行OP" & dr3("OP") & "的下一行为  " & dr2_Next("OP") &  "  "  & dr2_Next("ResID"))
                        End If 
                        d2w.Add(dr2n, dr2_next) 'dr2_next,下一工序信息
                        
                        Dim dr1n As DataRow = DataTables("WorkOrderStatus").AddNew
                        d1n.Add(dr1n, dr3)
                        d1w.Add(dr1n, dr2_next) '                
                    End If 
                Next
            End If
            ' If n > 10 Then GoTo 1
        Next 
    Next 
    'Return Nothing '************************
    1:
    'INISecondarySchedule 的处理
    If d2n.Keys.Count > 0 Then
        For Each dr2n As DataRow In d2n.Keys
            Dim dr3 As DataRow = d2n(dr2n)
            Dim dr2w As DataRow = d2w(dr2n)
            dr2n("PartNumber") = dr3("PartNumber")
            dr2n("WO") = dr2w("WO")
            dr2n("EST_QTY_IN") = dr2w("EST_QTY_IN")
            dr2n("EST_QTY_OUT") = dr2w("EST_QTY_OUT")
            dr2n("ACT_IN_QTY") = dr2w("ACT_IN_QTY")
            dr2n("ESTHrs_SETUP") = dr3("调试时间_Hrs")
            Dim Cyt As Double = dr3("装夹和机器时间_Min")
            Dim Unit As String = dr3("工时单位")
            If Unit = "MIN/PC" Then
                dr2n("Calculated_TotalHours_Required") = Round2(Cyt * dr2n("Act_IN_Qty") / 60, 2) '需求小时
            Else
                dr2n("Calculated_TotalHours_Required") = 2
            End If 
            dr2n("NPI") = dr2w("NPI")
            'dr2n("OPCategory") = dr3("OPDes")
            'dr2n("STD_LT_Days") = dr2w("")
            dr2n("OP") = dr3("OP")
            dr2n("ResID") = dr3("ResID")
            dr2n("OPQty") = dr2w("OPQty")
            'dr2n("ShiftWorkingSystem") = dr2w("")
            ' dr2n("EfficiencyFactor") =dr2w("")
            dr2n("DeliveryDate") = dr2w("DeliveryDate")
            dr2n("Adj_Remark") = "增加过程"
            If dr2w("OPStatus").contains("C") Then
                dr2n("OPstatus") = "CM"
            Else
                dr2n("OPStatus") = "F"
            End If
            dr2n("ShippingRowSign") = dr2w("ShippingRowSign")
            dr2n("BomLevel") = dr2w("BomLevel")
            dr2n("SalesOrder") = dr2w("SalesOrder")
            dr2n("WOStatus") = dr2w("WOStatus") 
        Next
        
        'WOrkOrderStatus的处理
        For Each dr1n As DataRow In d1n.Keys
            Dim dr3 As DataRow = d1n(dr1n)
            Dim dr2w As DataRow = d1w(dr1n)
            dr1n("PartNumber") = dr3("PartNumber")
            dr1n("WO") = dr2w("WO")
            dr1n("ESTQTY_IN") = dr2w("EST_QTY_IN")
            dr1n("ESTQTY_OUT") = dr2w("EST_QTY_OUT")
            dr1n("ACTQty_IN") = dr2w("ACT_IN_QTY")
            dr1n("ESTHrs_SETUP") = dr3("调试时间_Hrs")
            
            dr1n("OP") = dr3("OP")
            dr1n("ResID") = dr3("ResID") 
            dr1n("DeliveryDate") = dr2w("DeliveryDate")
            dr1n("ProcessRunDescription") = "增加过程"
            
            If dr2w("OPStatus").contains("C") Then
                dr1n("OPstatus") = "CM"
            Else
                dr1n("OPStatus") = "F"
            End If
            
            dr1n("WOStatus") = dr2w("WOStatus") 
        Next
    End If 
    
    
    DataTables("WorkOrderstatus").Save
    DataTables("INISecondarySchedule").Save
    
    SystemReady = True
    Dim s2 As Date = Date.now
    Dim s3 As TimeSpan = S2 - S1
    Output.Show(s1 & "--------" & s2 & ",程序 (Append_OutSPackAndOthers_Process_In_Process) 运行期间经历时间:" & s3.TotalSeconds)
Catch ex As Exception 
    MessageBox.Show("程序运行异常Append_OutSPackAndOthers_Process_In_Process,已终止")
End Try
MessageBox.Show(SystemReady)

黄色的程序段均是我后加的, 此前运行没有出现问题,我已经将Bin 目录下的文件清空尝试了好几次, 也没有办法, 此外我用系统管理员身份登录也尝试了,也没有用.
程序版本为高级开发版, 项目文件存储在硬盘上, 数据库为Sql Server 2019 商业版


 回到顶部
帅哥,在线噢!
有点蓝
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110528 积分:562524 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2024/3/21 8:28:00 [只看该作者]

Catch ex As Exception 
SystemReady = True
MessageBox.Show("程序运行异常Append_OutSPackAndOthers_Process_In_Process,已终止") End Try

 回到顶部