以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]根据车间工价输入车间  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=85931)

--  作者:syjylyq
--  发布时间:2016/6/6 9:54:00
--  [求助]根据车间工价输入车间

订单信息表中有车间名,如何根据车间输入工价之后在“生产车间”这一列输入相关的车间,比如一个订单涉及到一车间、二车间、四车间,“生产车间”这一单元格中填入:一.二.四.

以下代码对吗?应该写在哪个事件中?

Dim nms() As String = {"横机","半圆机","一","二","三","定型","四","五","手缝","整烫","四包","五包","六","七"}
Dim r As DataRow = DataTables("订单信息").Current.DataRow
e.DataRow("生产车间")= IIF(r.isnull(nms(0) = False,"横机.") & IIF(r.isnull(nms(1)) = False,"半圆.") & IIF(r.Isnull(nms(2)) = False,"一.") & IIF(r.isnull(nms(3)) = False,"二.") & IIF(r.isnull(nms(4)) = False,"三.") & IIF(r.isnull(nms(5)) = False,"定.") & IIF(r.isnull(nms(6)) = False,"四.") & IIF(r.isnull(nms(7)) = False,"五.") & IIF(r.isnull(nms(8)) = False,"手.") & IIF(r.isnull(nms(9)) = False,"蒸.") & IIF(r.isnull(nms(10)) = False,"4包.") & IIF(r.isnull(nms(11)) = False,"5包.") & IIF(r.isnull(nms(12)) = False,"6.") & IIF(r.isnull(nms(13)) = False,"7.")


--  作者:大红袍
--  发布时间:2016/6/6 10:00:00
--  

DataColChanged事件

 

Dim nms() As String = {"横机","半圆机","一","二","三","定型","四","五","手缝","整烫","四包","五包","六","七"}
If array.Indexof(nms, e.DataCol.name) >= 0 Then
    Dim r As DataRow = e.DataRow
    Dim str As String = ""
    For Each c As String In nms
        If r.IsNull(c) = False Then
            str &= c & "."
        End If
    Next
    e.DataRow("生产车间")=str.trim(".")
End If