大家好,
问题描述:
一个设备从输入节点流入系统,经过一个或多个测试站点,最后根据以下规则在输出节点离开:
- 如果设备在到达终点前未通过测试,则必须重新测试。
- 不能使用已经访问过的同一测试站点。
系统的物料流如下所示:
问题:
在我描述已经尝试过的方法之前,先明确一下我的问题:
- 如何阻止具有特定属性值的产品?
- 如何使用 Python API 管理匹配的需求和供料连接?
- 另外,是否可以创建一个自定义的vcProductFilter对象,允许我们根据自己的逻辑接受或拒绝产品实例?
我尝试过的方法…
根据 VC 帮助文档中关于vcProductMatcher的内容,它说:
如果需求与供料的流程组 ID 匹配,需求接受产品类型(在 vcProductFilter 中定义),并且在运输节点之间存在有效的运输解决方案,则可以建立匹配。
基于此,我尝试在设备上创建一个名为Use_Site的属性,用于记录它已经使用过的测试站点。
然后,我在每个站点的流程语句中设置了一个产品过滤器。
然而,我不确定如何编写正确的表达式,甚至不知道应该使用哪种类型的过滤器。
似乎过滤器表达式不允许像 "str" not in "str" 这样的语法。
在语句过滤器中使用表达式时,我遇到了一个错误。提示信息如下:
Error in . Expression '"Test Site #22" not in Product.Component.Use_Site' refers to the variable itself.
我还尝试通过 Python API 处理需求/供料匹配。
我调用了 match.tryCancelMatch(),但它返回了 None,并且匹配状态仍然保持在已创建。
嗯… 看起来匹配并不能像我希望的那样被取消。
def register_match(new_):
"""
Register a match event for need/feed and handle the match logic.
"""
def need_feed_match(match): # type: (vcProductNeedFeedMatch) -> Any
transport_ = next(x for x in transport_items if x.need_item == new_ or x.feed_item == new_) # type: TransportItem
if not transport_:
error('No TransportItem found!')
return
#mo
print("==========================================")
if match.State == VC_MATCH_STATE_CREATED:
match_state = "Created"
elif match.State == VC_MATCH_STATE_CANCELLED:
match_state = "Cancelled"
elif match.State == VC_MATCH_STATE_FINALIZED:
match_state = "Finalized"
elif match.State == VC_MATCH_STATE_DISPOSED:
match_state = "Disposed"
print("This Match Object Type: {}".format(match_state))
print("Matched Need's "
"Target Node: {}".format(match.MatchedNeed.TargetNode.Component.Name))
print("Matched Feed's "
"Source Node: {}".format(match.MatchedFeed.SourceNode.Component.Name))
print("Matched Product Instance:\n\t"
"Product's Mark: {}\n\t"
"Product's Used Site: {}".format(match.MatchedFeed.Product.Component.Mark,
match.MatchedFeed.Product.Component.Use_Site))
if comp.Name in match.MatchedFeed.Product.Component.Use_Site and transport_.type == 'need':
print("This matched need feed should be canceled!")
print(match.tryCancelMatch())
print("This Match Object Type: {}".format(match_state))
print("==========================================")
return
else:
print("==========================================")
transport_.need_item = match.MatchedNeed
transport_.feed_item = match.MatchedFeed
transport_.match_item = match
transport_.match_time = sim.SimTime
transport_.product = match.MatchedFeed.Product
create_transport_target(transport_, match.MatchedFeed.Product, transport_.type)
if transport_.type == 'feed':
solution = transport_system.findSolution(
transport_.feed_item.SourceNode,
transport_.need_item.TargetNode,
transport_.product.ProductType.FlowGroup
)
transport_.product.TransportSolution = solution
transport_node.beginTransportOut(transport_.product)
match.finalizeMatch()
return need_feed_match
VC OUTPUT PANEL: ========================================== This Match Object Type: Created Matched Need's Target Node: SLT Trolley Test Unit #22 Matched Feed's Source Node: PlatformBase Matched Product Instance: Product's Mark: R0 Product's Used Site: SLT Trolley Test Unit #22, This matched need feed should be canceled! None This Match Object Type: Created ==========================================


微信扫一扫,打赏作者吧~







