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


  共有1772人关注过本帖平板打印复制链接

主题:求助

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


加好友 发短信
等级:一尾狐 帖子:412 积分:2665 威望:0 精华:0 注册:2015/10/2 23:48:00
求助  发帖心情 Post By:2017/3/3 15:14:00 [只看该作者]

现有一个出库窗口,在窗口中有一个控件是出库数量,在TextChanged 中想实现如果出库数量小于该商品号所在的其中一个库位中的数量,直接遍历赋值,再扣减库存,假如出库数量大于任何一个其中的库位,则按入库日期秉承先进先出原则,若干个库位中的库存相加满足出库量则止,并把这些库位列出到窗口库位控件中,以便接下来打印出库单。我写了些代码,接下来的要怎样完成,望指导。
 代码如下:
Dim pbx As WinForm.PictureBox
pbx = e.form.Controls("提示")
Dim sl As Double = val(e.Sender.text)
Dim kykc As Double = val(e.form.Controls("可用库存").text)
Dim dj As Double = val(e.form.Controls("单价").value)
If sl = Nothing Then
    e.Form.Controls("出库数量").text = "0 " 
    pbx.Image = GetImage("Images\exclamation.gif")
    e.Form.Controls("提示信息").text = "请输入出库数量,不能为空!"
    e.Form.Controls("提示信息").ForeColor = Color.Red
    e.Form.Controls("增加").Enabled = False
    Return
End If
If sl = 0 Then
    e.Form.Controls("出库数量").text = "0 " 
    pbx.Image = GetImage("Images\exclamation.gif")
    e.Form.Controls("提示信息").text = "出库数量必须大于 0"
    e.Form.Controls("提示信息").ForeColor = Color.Red
    e.Form.Controls("增加").Enabled = False
    Return
ElseIf sl > kykc Then
    e.Form.Controls("出库数量").text = "0 " 
    pbx.Image = GetImage("Images\exclamation.gif")
    e.Form.Controls("提示信息").text = "库存可用数量不足本次出库!"
    e.Form.Controls("提示信息").ForeColor = Color.Red
    e.Form.Controls("增加").Enabled = False
    Return
else
e.Form.Controls("出库数量").text = sl 

Dim dr As DataRow = DataTables("商品库存明细").Find("Item = '" & e.Form.Controls("商品编号").text & "'")

 

If dr IsNot Nothing Then

Dim wz As Integer = Tables("商品库存明细").FindRow(dr)

        If wz >= 0 Then

            Tables("商品库存明细").Position = wz

        End If

If dr("可用库存") sl Then

        

        e.Form.Controls("单价").text = dr("单价") & " 元"

        e.Form.Controls("总价").text = Format(dr(“单价”) * sl,"n")  & " 元

        If dr("生产日期") = Nothing Then

            e.Form.Controls("生产日期").text = "未知"

        Else

            e.Form.Controls("生产日期").text = dr("生产日期")

        End If

        If dr("有效期至") = Nothing Then

            e.Form.Controls("有效期至").text = "未知"

        Else

           e.Form.Controls("有效期至").text = dr("有效期至")

        End If

        e.Form.Controls("规格").text = dr("Pack Size")

        e.Form.Controls("商品状态").text = dr("商品状态")

        e.Form.Controls("库位").text = dr("库位")

       

    End If

End If

End if

If dj = Nothing Then
    pbx.Image = GetImage("Images\exclamation.gif")
    e.Form.Controls("提示信息").text = "商品单价为空,请尽量完善!"
    e.Form.Controls("提示信息").ForeColor = Color.Red
    e.Form.Controls("增加").Enabled = True
    Return
End If
If dj = 0 Then
    pbx.Image = GetImage("Images\exclamation.gif")
    e.Form.Controls("提示信息").text = "商品单价为 0 ,请尽量完善!"
    e.Form.Controls("提示信息").ForeColor = Color.Red
    e.Form.Controls("增加").Enabled = True
    Return
End If
e.Form.Controls("增加").Enabled = True
pbx.Image = GetImage("Images\payment_card.png")
e.Form.Controls("提示信息").text = "金额小计: " & Format(dj * sl,"n")  & " 元"
e.Form.Controls("提示信息").ForeColor = Color.black

 回到顶部