fix超越

This commit is contained in:
2026-05-22 22:04:31 +08:00
parent 7108454c59
commit 1fd62929af
3 changed files with 6 additions and 9 deletions
+3 -4
View File
@@ -791,7 +791,7 @@ class _ProductionDataCache:
def get_peg_by_demand(self, demand_no: str) -> List[str]:
"""根据 DemandNo 获取对应的 S_SupplyNo 列表"""
"""根据 DemandNo 获取对应的 S_SupplyNo 列表,也可用于获取前置工单号"""
if self._is_cache_expired(CacheItem.PEG.value):
self._stats['total_misses'] += 1
return []
@@ -806,7 +806,7 @@ class _ProductionDataCache:
def get_peg_by_supply(self, supply_no: str) -> List[str]:
"""根据 S_SupplyNo 获取对应的 DemandNo 列表"""
"""根据 S_SupplyNo 获取对应的 DemandNo 列表,也可用于获取后续工单号"""
if self._is_cache_expired(CacheItem.PEG.value):
self._stats['total_misses'] += 1
return []
@@ -1601,13 +1601,12 @@ class ApsPayloadSponsor:
filter_string=f"`SupplyNo`='{supplyno}'"
)
if result.success and result.meta.get('total') == 1: # 筛选到唯一的工单,则补充工序信息(v_orderwc)
if result.success and result.meta.get('affected_rows') == 1: # 筛选到唯一的工单,则补充工序信息(v_orderwc)
result.data[0]['orderwc'] = await get_orderwc(mono=supplyno)
vendorno = result.data[0].get('vendorno')
if origin_so and result.data[0].get('category') == 'MTO' and vendorno:
result.data[0]['so'] = await get_so(vendorno)
if prev_mo:
result.data[0]['prev_mo'] = await get_prev_mo(supplyno)
if next_mo:
+1 -3
View File
@@ -227,7 +227,6 @@ class MoPushModel(PydanticModel):
mopd = []
if orderwc_list:
i = 1
for orderwc in orderwc_list:
mopd.append({
'Inventory': {'Code': orderwc['materialno']},
@@ -236,9 +235,8 @@ class MoPushModel(PydanticModel):
'Quantity': orderwc['orderqty'],
'ProcessingType': {"Code": ""},
'Process': {"Code": orderwc['itemno']},
'SequenceNumber': i,
'SequenceNumber': orderwc['sortno'],
})
i += 1
momd = []
if demand_list:
+2 -2
View File
@@ -139,9 +139,9 @@ def create_custom_mo_push_model(_aps: ApsPayloadSponsor):
mo_details['DynamicPropertyKeys'] = []
mo_details['DynamicPropertyValues'] = []
# 构建后续工单关系
next_mos: list[dict] = values.get('next_mo')
next_mos: list[str] = _aps._production_cache.get_peg_by_supply(values['supplyno'])
if next_mos:
next_mo_sn = ','.join([_['supplyno'] for _ in next_mos])
next_mo_sn = ','.join(next_mos)
if next_mo_sn:
mo_details['DynamicPropertyKeys'].append('priuserdefnvc1') # 存入自定义字段
mo_details['DynamicPropertyValues'].append(next_mo_sn)