【问题标题】:How to get count of wod_qty_req?如何获得 wod_qty_req 的计数?
【发布时间】:2016-05-27 05:21:22
【问题描述】:

表:wod_det 在 wod_det 表中,我想计算所有订单的 wod_qty_req 意味着 wod_nbr 是每个订单的工作订单,那里会有组件项目,即这些 wod_part 的 wod_part 会有 wod_qty_req 所以我想要的是每个工作订单,我需要计算我尝试过的所有 wod_part 的 wod_qty_req 数量

{us/mf/mfdtitle.i}
def var site like si_site no-undo.
for first si_mstr no-lock where si_mstr.si_domain = global_domain:
      site = si_site.
end.
for each wod_det where wod_domain = global_domain and wod_site = site no-lock break by wod_nbr by wod_part:

        if first-of(wod_nbr) then
        do:
            accumulate wod_qty_req (count).
            if last-of(wod_part) then
                do:
                    disp wod_nbr wod_part wod_qty_req (accum count wod_qty_req).
                end.
        end.

end.

我不知道这是否正确,但我没有得到任何输出,请帮我解决这个问题? 提前谢谢..

Here is the Image of table wod_det

答案:

define variable iCount as integer no-undo.                                      
{us/mf/mfdtitle.i}                                                              
def var site like si_site no-undo.                                              
def var total like wod_qty_req initial 0 no-undo.                               
  for first si_mstr no-lock where si_mstr.si_domain = global_domain:              
      site = si_site.                                                              
  end.                                                                                      
      for each wod_det no-lock where wod_domain = global_domain              
                          and wod_site = site break by wod_nbr: 
          disp wod_nbr wod_part wod_qty_req(total by wod_nbr).                        
      end.

【问题讨论】:

    标签: progress-4gl openedge


    【解决方案1】:

    已编辑:基于更多信息。

    我个人从不使用ACCUMACCUMULATE 等功能,但这可能是我个人的喜好。

    注意:我不确切知道哪些字段对应于图像中的信息,因此我将在“伪”代码中对此进行描述。交换 [WORK_ORDER_FIELD] 字段名称以匹配数据库中的正确字段!

    define variable iCount as integer no-undo.
    {us/mf/mfdtitle.i}
    def var site like si_site no-undo.
    for first si_mstr no-lock where si_mstr.si_domain = global_domain:
       site = si_site.
    end.
    
    for each wod_det no-lock where wod_domain = global_domain 
                               and wod_site = site 
                               break by wod_det.[WORK_ORDER_FIELD]:
    
        iCount = 0.
        if first-of(wod_det.[WORK_ORDER_FIELD]) then do: 
            iCount = iCount + 1.
        end.
        display od_det.[WORK_ORDER_FIELD] iCount.
    end.
    

    【讨论】:

    • 我附上了有问题的 wod_det 表格图像,你可以看到我想要的详细信息:如果你观察工单 1139,那里有 6 件物品,还有相应的数量需求,所以我需要计算数量工单 1139 的所有 6 项的要求都清除了吗?
    • @LovelyBobby 有帮助吗?
    • 不幸的是它不起作用 ** 在“站点中断”之后无法理解。 (247) ** 无法识别 BY 关键字后的字段或表达式。 (411) ** 第 10 行——无效的 FOR、DO、REPEAT 或 EDITING 语句。 (194) 我在编译时遇到错误
    • 也许您可以将新代码添加到原始问题中?
    • 但是你的程序只会给出我想要每个工单中每个项目的 wod_qty_req 总数
    猜你喜欢
    • 2018-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-17
    • 1970-01-01
    • 1970-01-01
    • 2015-05-17
    • 2015-01-21
    相关资源
    最近更新 更多