上料检查

master
philip 3 years ago
parent 9d0786e2e2
commit b71d147f33

@ -20,4 +20,6 @@ import java.util.List;
public interface LoadInventoryMapper extends BaseMapper<LoadInventory> { public interface LoadInventoryMapper extends BaseMapper<LoadInventory> {
List<LoadInventoryDto> getLoadInventoryList(@Param("site") String site, @Param("resrce") String resrce, @Param("language") String language); List<LoadInventoryDto> getLoadInventoryList(@Param("site") String site, @Param("resrce") String resrce, @Param("language") String language);
Integer findBomComponent(@Param("site")String site, @Param("resrce")String resrce, @Param("itemBo")String itemBo);
} }

@ -119,6 +119,11 @@ public class LoadInventoryServiceImpl extends ServiceImpl<LoadInventoryMapper, L
if (inventory.getQtyOnHand().compareTo(loadQty)<0){ if (inventory.getQtyOnHand().compareTo(loadQty)<0){
throw new BaseException("上料数量不能大于剩余数量"+inventory.getQtyOnHand()); throw new BaseException("上料数量不能大于剩余数量"+inventory.getQtyOnHand());
} }
//设备派工单组件是否包含
Integer bomComponent = loadInventoryMapper.findBomComponent(site, resrce, inventory.getItemBo());
if (bomComponent<1){
throw new BaseException("不是设备上产品需要的物料");
}
BigDecimal remainQty = inventory.getQtyOnHand().subtract(loadQty); BigDecimal remainQty = inventory.getQtyOnHand().subtract(loadQty);
//扣减库存 //扣减库存
commonService.updateInventory(site,inventoryId,remainQty); commonService.updateInventory(site,inventoryId,remainQty);

@ -423,4 +423,13 @@
LEFT JOIN CUSTOM_FIELDS cf3 ON cf.HANDLE=IT.HANDLE AND CF."ATTRIBUTE"='MAT_SPEC' LEFT JOIN CUSTOM_FIELDS cf3 ON cf.HANDLE=IT.HANDLE AND CF."ATTRIBUTE"='MAT_SPEC'
WHERE ZLI.RESRCE=#{resrce} AND ZLI.SITE=#{site} ORDER BY ZLI.CREATED_DATE_TIME WHERE ZLI.RESRCE=#{resrce} AND ZLI.SITE=#{site} ORDER BY ZLI.CREATED_DATE_TIME
</select> </select>
<select id="findBomComponent" resultType="java.lang.Integer">
SELECT COUNT(BC.HANDLE) FROM Z_SFC_DISPATCH zsd
JOIN SFC S ON S.SFC = zsd.SFC AND zsd.SITE=S.SITE
JOIN SFC_BOM SB ON SB.SFC_BO = S.HANDLE
JOIN BOM_COMPONENT BC ON BC.BOM_BO = SB.BOM_BO
LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = BC.COMPONENT_GBO AND CF."ATTRIBUTE" = 'ACCESSORY_TYPE' AND (CF.VALUE = '0' OR CF.VALUE = NULL)
WHERE zsd.SITE=#{site} AND zsd.DISPATCH_STATUS!='COMPLETE' AND zsd.DISPATCH_STATUS!='CANCEL' AND zsd.RESRCE=#{resrce} AND BC.COMPONENT_GBO=#{itemBo}
</select>
</mapper> </mapper>

Loading…
Cancel
Save