📄 bos_balancebill.cls
字号:
InitComm '初始化comm端口
afterOpenBill '打开单据后的一些按钮,字段事件
End If
'**********************************************
'单据状态为完成,判断当前用户是否为本单子的司磅员,
'设置单子是否锁定。
If rs.Fields("FBillStatus") = 1 And rs.Fields("FStatus_WL") = 0 And rs.Fields("FDeductWeight") = 0 Then
If m_BillInterface.GetFieldValue("FTareOP") <> g_StrUserName And _
m_BillInterface.GetFieldValue("FGrossOP") <> g_StrUserName Then
m_BillInterface.LockBill
EnableToolBar "mnuReSelect", False
EnableToolBar "mnuGetTareWeight", False
EnableToolBar "mnuGetGrossWeight", False
Else
afterOpenBill '打开单据后的一些按钮,字段事件
End If
End If
'**********************************************
'如果单据为新增的单据,设置按钮可用
If m_BillInterface.BillStatus = Enu_BillStatusExt_New Then
EnableToolBar "mnuGetTareWeight", True
EnableToolBar "mnuGetGrossWeight", True
End If
'*********************************************
Set rs = Nothing
Exit Sub
err:
MsgBox err.Description, vbCritical, "提示:"
End Sub
Private Sub afterOpenBill()
On Error GoTo err
'060321zjmodify让钢卷ID不可见 在afterloadbill,afterselbill,afternewbill中分别加入
m_BillInterface.BillHeads(1).BOSFields("fpihao").Visible = False
'060321zjmodify让钢卷ID不可见 在afterloadbill,afterselbill,afternewbill中分别加入
m_BillInterface.BillHeads(1).BOSFields("fpihao").Visible = False
Select Case m_BillInterface.GetFieldValue("FBillType") '根据不同的检斤类型,再修改时判断是否
'销售出库
Case "1" '可以更改物料和辅助属性。
EableOrDisableField 1
EnableToolBarProcess 1
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = True
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = True
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = True
Case "2" '外购入库
EableOrDisableField 2
EnableToolBarProcess 2
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = True
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = True
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = True
Case "3" '调拨检斤
EableOrDisableField 3
EnableToolBarProcess 3
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = True
Case "4" '委外检斤(入)
EableOrDisableField 4
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = False
Case "5" '工艺检斤
EableOrDisableField 5
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = False
Case "6" '成品入库
EableOrDisableField 6
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = False
Case "7" '运输检斤
EableOrDisableField 7
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = True
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = True
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = True
Case "8" '委外检斤(出)
EableOrDisableField 8
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = False
Case "9" '其他检斤
EableOrDisableField 9
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = False
Case "0" '销售退货
EableOrDisableField -1
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = False
Case "-1"
EableOrDisableField 9
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = False
Case Else
EableOrDisableField 9
EnableToolBarProcess 4
m_BillInterface.BillEntrys(1).BOSFields("Fmateriel").FieldLock = False
m_BillInterface.BillEntrys(1).BOSFields("FAuxProperty").FieldLock = False
m_BillInterface.BillHeads(1).BOSFields.Item("FBillType").FieldLock = False
End Select
Exit Sub
err:
MsgBox err.Description, vbCritical, "提示"
End Sub
'设置工具栏按钮是否可用
Private Sub EnableToolBar(ByVal strName As String, ByVal bFlag As Boolean)
Dim oBand As K3ClassEvents.BOSBand
On Error GoTo err
Set oBand = m_BillInterface.MenuBar.BOSBands("BandToolBar")
oBand.BOSTools(strName).Enabled = bFlag
Exit Sub
err:
MsgBox err.Description, vbCritical, "提示:"
End Sub
Private Sub m_BillInterface_AfterNewBill()
'TODO: 请在此处添加代码响应事件 AfterNewBill
'设置计数字段不可用,毛重,皮重按钮可用,复选按钮不可用,初始化comm端口
On Error GoTo err
'060321zjmodify让钢卷ID不可见 在afterloadbill,afterselbill,afternewbill中分别加入
m_BillInterface.BillHeads(1).BOSFields("fpihao").Visible = False
'060321zjmodify让钢卷ID不可见 在afterloadbill,afterselbill,afternewbill中分别加入
m_BillInterface.BillHeads(1).BOSFields("FCurrentNum").FieldLock = True
'060317zjmodify 由于在BOS中将皮重时间和毛重时间放开所以须在插件中锁定
m_BillInterface.BillEntrys(1).BOSFields("Ftarebalancetime").FieldLock = True
m_BillInterface.BillEntrys(1).BOSFields("Fgrossbalancetime").FieldLock = True
'060317zjmodify 0321李伟修改 由于在BOS中将皮重时间和毛重时间放开所以须在插件中锁定
EnableToolBar "mnuGetTareWeight", True
EnableToolBar "mnuGetGrossWeight", True
EnableToolBar "mnuReSelect", False
InitComm
Exit Sub
err:
MsgBox err.Description, vbCritical, "提示:"
End Sub
Private Sub m_BillInterface_AfterSave(bCancel As Boolean)
Dim strSql As String
Dim rs As ADODB.Recordset
On Error GoTo errAfterSave
' '060325_060418zjmodify,将入库重量加在这里,这一句在beforesave事件中已有
' With m_BillInterface
' Dim xx, yy As String
' Dim rr As ADODB.Recordset
' Dim zz As Double
' xx = "select fnetweight from t_ST_SC_BalanceBillentry where fid=" & .currentid
' Set rr = .K3Lib.GetData(xx)
' If Not rr.EOF And Not rr.BOF Then
' '.SetFieldValue "FInStockWeight", .GetFieldValue("FNetWeight") / 1000 '入库重量=净重/1000
' '.SetFieldValue "FInStockWeight", rr.Fields(0) / 1000 '入库重量=净重/1000
' zz = rr.Fields(0)
' yy = "update t_ST_SC_BalanceBillentry set finstockweight=zz where fid=" & .CurBillID
' .K3Lib.GetData ("yy")
' End If
'
' End With
' '060325_060418zjmodify,将入库重量加在这里,这一句在beforesave事件中已有
'zj060422modify
m_BillInterface.K3Lib.GetData ("exec recalcnet " & m_BillInterface.CurBillID)
'zj060422modify
'保存皮重信息
SaveTareWeight
'对于调拨检斤,运输检斤,委外检斤(出/入)将源单类型写入,由于没有办法用钩籍,只能用复制,然后再这样实现。
If SelBill_Flag = True Then
If m_BillInterface.GetFieldValue("FBillType") = "3" Then
strSql = "UPdate t_ST_SC_BalanceBillEntry Set FID_SRC= " & g_lngFID & ",FENtryID_SRC= " & g_lngFEntryID & "where FID=" & m_BillInterface.CurBillID & vbCrLf & _
"Update t_ST_SC_BalanceBillEntry set FClassID_SRC=200000137 where FID=" & m_BillInterface.CurBillID
m_BillInterface.K3Lib.GetData (strSql)
End If
If m_BillInterface.GetFieldValue("FBillType") = "7" Then
strSql = "UPdate t_ST_SC_BalanceBillEntry Set FID_SRC= " & g_lngFID & ",FENtryID_SRC= " & g_lngFEntryID & "where FID=" & m_BillInterface.CurBillID & vbCrLf & _
"Update t_ST_SC_BalanceBillEntry set FClassID_SRC=200000160 where FID=" & m_BillInterface.CurBillID
m_BillInterface.K3Lib.GetData (strSql)
End If
'###############################1215zj修改##########################################
If m_BillInterface.GetFieldValue("fbilltype") = "8" Then
strSql = "UPdate t_ST_SC_BalanceBillEntry Set FID_SRC= " & g_lngFID & ",FENtryID_SRC= " & g_lngFEntryID & "where FID=" & m_BillInterface.CurBillID & vbCrLf & _
"Update t_ST_SC_BalanceBillEntry set FClassID_SRC=200000191 where FID=" & m_BillInterface.CurBillID
m_BillInterface.K3Lib.GetData (strSql)
End If
'由于委外检斤入,可以不选单,所以在下面的条件中加了一个and
If m_BillInterface.GetFieldValue("fbilltype") = "4" And Len(m_BillInterface.GetFieldValue("FBillNo_SRC")) > 0 Then
strSql = "UPdate t_ST_SC_BalanceBillEntry Set FID_SRC= " & g_lngFID & ",FENtryID_SRC= " & g_lngFEntryID & "where FID=" & m_BillInterface.CurBillID & vbCrLf & _
"Update t_ST_SC_BalanceBillEntry set FClassID_SRC=200000192 where FID=" & m_BillInterface.CurBillID
m_BillInterface.K3Lib.GetData (strSql)
End If
'###############################1215zj修改##########################################
SelBill_Flag = False
End If
'******************************
'控制打印
If CDbl(m_BillInterface.GetFieldValue("FNetWeight")) <> 0 Then
m_BillInterface.K3Lib.GetData ("update t_ST_SC_BalanceBill set FPrint=1 Where FID=" & m_BillInterface.CurBillID)
m_BillInterface.RefreshBill
End If
'******************************
'flagg用于供beforesave事件调用(指对面磅一次过磅保存后没有退出,而一段时间又没车,有车后在保存导致时间戳变化的bug)**************************
'##############################1219zjmodify于1222注释掉%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' If m_BillInterface.GetFieldValue("fnetweight") = 0 Then
' flagg = 10
' carno = m_BillInterface.GetFieldValue("fcarno")
' billid = m_BillInterface.CurBillID
' Else
' flagg = 11
' carno = m_BillInterface.GetFieldValue("fcarno")
' billid = m_BillInterface.CurBillID
' End If
'原先这段语句放在aftersave事件的最后面,后来发现由于下面的语句中有以下一个条件
'If CDbl(m_BillInterface.GetFieldValue("FNetWeight")) = 0 Or CLng(rs.Fields(0)) = 1 Then Exit Sub
'会导致不执行上面的语句,所以又将其放在这里
'##############################1219zjmodify于1222note掉%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -