Explorar o código

优化排程提示信息

fangpy hai 1 ano
pai
achega
1915fcc407

+ 6 - 3
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsBlankOrderDao.java

@@ -31,9 +31,12 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
     @Select("select a.*,b.DELIVERYDATE,b.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID where a.PRODUCTIONORDERID=#{orderId} and a.DELETED='0' and b.DELETED='0'")
     List<ApsBlankOrderVo> getByOrderId(@Param("orderId") String orderId);
 
-    @Select("select a.*,b.DELIVERYDATE,b.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID " +
-            "where (a.LOCKMARK is null or a.LOCKMARK='n') and a.DELETED='0' and b.DELETED='0' and b.PRODUCTIONSTATUS='20' and a.ID not in (${hasIds})")
-    List<ApsBlankOrderVo> getFbNotLock(@Param("hasIds") String hasIds);
+    @Select("<script>select a.*,b.DELIVERYDATE,b.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID " +
+            "where (a.LOCKMARK is null or a.LOCKMARK='n') and a.DELETED='0' and b.DELETED='0' and b.PRODUCTIONSTATUS='20' and a.ID not in (${hasIds}) " +
+            "<if test='tenantId != null and tenantId != &apos;&apos;'> " +
+            "  and  b.TENANTID = #{tenantId} " +
+            "</if></script>")
+    List<ApsBlankOrderVo> getFbNotLock(@Param("hasIds") String hasIds,@Param("tenantId") String tenantId);
 
     @Select("select a.*,b.DELIVERYDATE,b.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID " +
             "where b.PRODUCTIONSTATUS='20' and (a.LOCKMARK='n' or a.LOCKMARK is null) and a.DELETED='0' and b.DELETED='0' and b.TENANTID = #{tenantId}")

+ 7 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java

@@ -460,13 +460,16 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void blankOrderAps(List<ApsBlankOrderVo> apsBlankOrders) {
+        // 当前等路人所属工厂
+        SysUserVo currentUser = CXCommonUtils.getCurrentUser();
+        String tenantId = currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1];
         assert apsBlankOrders != null : "排程订单不能为空";
         // 合并待发布未锁定的订单一起排程
         List<String> hasIds = apsBlankOrders.stream().map(v -> v.getId()).collect(Collectors.toList());
         String idStrs = CollUtil.join(hasIds, "','");
         idStrs = "'" + idStrs + "'";
         // 查询存在未锁定的作业坯料计划
-        List<ApsBlankOrderVo> fbNotLock = apsBlankOrderDao.getFbNotLock(idStrs);
+        List<ApsBlankOrderVo> fbNotLock = apsBlankOrderDao.getFbNotLock(idStrs,tenantId);
         if (fbNotLock != null && fbNotLock.size() > 0) {
             apsBlankOrders.addAll(fbNotLock);
         }
@@ -482,6 +485,9 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         logger.info("排程数据:" + JSONUtil.toJsonStr(productionScheduleVo, jsonConfig));
         // APS平台排程接口调用
         ProductionScheduleRetVo productionScheduleRetVo = rwApsServer.productionSchedule(productionScheduleVo);
+        if(!"200".equals(productionScheduleRetVo.getCode())){
+            throw new CustomException(productionScheduleRetVo.getMsg());
+        }
         // 排程结果保存
         List<ApsProcessOperationProcessEquDo> apsProcessOperationProcessEquDos = new ArrayList<>();
         // 最后节点集合

+ 9 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/ProductionScheduleRetVo.java

@@ -7,6 +7,15 @@ import java.util.List;
 @Data
 public class ProductionScheduleRetVo {
 
+    /**
+     * 返回状态码
+     */
+    private String code;
+    /**
+     * 返回错误信息
+     */
+    private String msg;
+
     private String scoreResult;
 
     /**