Browse Source

fix: 优化呼叫托盘,同类型托盘可出

wang.sq@aliyun.com 6 months ago
parent
commit
d28c455401

File diff suppressed because it is too large
+ 513 - 512
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java


+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskNodeServiceImpl.java

@@ -1696,6 +1696,7 @@ public class TaskNodeServiceImpl extends SuperServiceImpl<TaskNodeMapper, TaskNo
         if(null == lg){
             return R.fail("指令和数据一致性不正确");
         }
+        lg.setSendStatus("2");
 
         String bizCallBackData = jsonParam;
 

+ 5 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/dao/TrayMapper.java

@@ -10,6 +10,8 @@ import com.github.zuihou.database.mybatis.auth.DataScope;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
  * <p>
  * Mapper 接口
@@ -25,4 +27,7 @@ public interface TrayMapper extends SuperMapper<Tray> {
      * 分页
      */
     IPage<Tray> pageList(IPage page, @Param(Constants.WRAPPER) Wrapper<Tray> queryWrapper, DataScope dataScope);
+
+    List<Tray> selectUsersByIds(@Param("ids") List<Long> ids);
+
 }

+ 0 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/MToolClampService.java

@@ -50,5 +50,4 @@ public interface MToolClampService extends SuperService<MToolClamp> {
      * @return
      */
     Boolean delete(MToolClamp model);
-
 }

+ 4 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/TrayService.java

@@ -7,6 +7,8 @@ import com.github.zuihou.business.productionReadyCenter.dto.TrayUpdateDTO;
 import com.github.zuihou.business.productionReadyCenter.entity.Tray;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 
+import java.util.List;
+
 /**
  * <p>
  * 业务接口
@@ -46,4 +48,6 @@ public interface TrayService extends SuperService<Tray> {
     Boolean delete(Tray model);
 
     public Boolean check(TraySaveDTO model);
+
+    List<Tray> selectUsersByIds(List<Long> ids);
 }

+ 5 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/TrayServiceImpl.java

@@ -120,4 +120,9 @@ public class TrayServiceImpl extends SuperServiceImpl<TrayMapper, Tray> implemen
         if (null!=model.getNo()) return super.count(Wraps.<Tray>lbQ().eq(Tray::getNo, model.getNo())) > 0;
         return false;
     }
+
+    @Override
+    public List<Tray> selectUsersByIds(List<Long> ids) {
+        return baseMapper.selectUsersByIds(ids);
+    }
 }

+ 27 - 4
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/RobotNodeServiceImpl2.java

@@ -1034,20 +1034,43 @@ public class RobotNodeServiceImpl2 implements NodeOperationService {
      * @return
      */
     private List<StockInfo> getProductionLineXbkStockList(TaskNode nextTaskNode,TTask task) {
-        List<StockInfo> returnList = null;
+        List<StockInfo> returnList = new ArrayList<>();
 
         List<Productionresource> productionresources = productionresourceBizMapper.selectList(Wraps.<Productionresource>lbQ().like(Productionresource::getCode,DictionaryKey.YJ_ZONE_XBK.get(bomzZone.getName())));
         List<Long> productionresourceIds = productionresources.stream().map(t->t.getId()).collect(Collectors.toList());
         List<ProductionresourcePosition> startProductionresourcePositions = productionresourcePositionMapper.selectList(Wraps.<ProductionresourcePosition>lbQ().in(ProductionresourcePosition::getResourceId, productionresourceIds).eq(ProductionresourcePosition::getStatus,"0"));
         List<Long> startProductionresourcePositionIds = startProductionresourcePositions.stream().map(t->t.getStorgeId()).collect(Collectors.toList());
 
-
+        // 工序托盘夹具,根据绑定得托盘编码查询出所需要得托盘类型,根据托盘类型找出库里空的托盘夹具
         List<BomProcedureTray>trayList = procedureTrayService.list(Wraps.<BomProcedureTray>lbQ().eq(BomProcedureTray::getProcedureId, task.getProcedureId()).orderByAsc(BomProcedureTray::getBizType));
         List<Long>trayIdList = trayList.stream().map(t->t.getTrayId()).collect(Collectors.toList());
+
+        // 查询出同类型,并且同一条产线的托盘信息
+        List<Tray> newTrayList = trayService.selectUsersByIds(trayIdList);
+
+        // 查询出同类型,并且同一条产线的工装信息
+        List<String> trayNoList = newTrayList.stream().map(t->t.getNo()).collect(Collectors.toList());
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.in("no" , trayNoList);
+        List<MToolClamp> mToolClamplist = toolClampService.list(queryWrapper);
+
+        // 合并托盘,工装id集合,查询库存满足的信息
+        List<Long> trayAndMToolClamplist = newTrayList.stream().map(t->t.getId()).collect(Collectors.toList());
+        trayAndMToolClamplist.addAll(mToolClamplist.stream().map(t->t.getId()).collect(Collectors.toList()));
+
         // 判断夹具是否有可用的,查询线边库位信息中是否还有夹具
-        List<StockInfo> allStockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().in(StockInfo::getGoodsId,trayIdList).in(StockInfo::getStorgeId,startProductionresourcePositionIds).eq(StockInfo::getLockStatus, "1").orderByAsc(StockInfo::getGoodsType));
+        List<StockInfo> allStockInfos = stockInfoMapper.selectList(Wraps.<StockInfo>lbQ().in(StockInfo::getGoodsId,trayAndMToolClamplist).in(StockInfo::getStorgeId,startProductionresourcePositionIds).eq(StockInfo::getLockStatus, "1").orderByAsc(StockInfo::getGoodsType));
+
+        // 根据集合数据,比对根据零件配置的工装夹具数量是不相等
+        Map<Long, List<StockInfo>> collect = allStockInfos.stream().collect(groupingBy(StockInfo::getStorgeId));
+        collect.forEach((aLong, stockInfos) -> {
+            if(stockInfos.size() == trayList.size()){
+                returnList.addAll(stockInfos);
+            }
 
-        return allStockInfos;
+        });
+
+        return returnList;
     }
 
 

+ 21 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionReadyCenter/TrayMapper.xml

@@ -41,4 +41,25 @@
       ) s ${ew.customSqlSegment}
     </select>
 
+    <!-- 查询托盘集合 -->
+    <select id="selectUsersByIds" resultMap="BaseResultMap">
+
+        SELECT
+        a.*,
+        b.positionSort
+        FROM
+        `imcs_t_tray` a
+        INNER JOIN imcs_t_tray b ON b.production_type = a.production_type
+        LEFT JOIN ( SELECT tray_id, GROUP_CONCAT( position_sort ) AS positionSort FROM imcs_t_tray_position GROUP BY tray_id ) b ON a.id = b.tray_id
+        WHERE
+        a.zone_id = b.zone_id
+        <if test="ids != null and ids.size() > 0">
+            AND b.id IN
+            <foreach item="id" collection="ids" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+
+    </select>
+
 </mapper>

+ 8 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/productionReadyCenter/entity/AAutoNodeLog.java

@@ -95,6 +95,14 @@ public class AAutoNodeLog extends Entity<Long> {
     @Excel(name = "处理状态(1-已处理0-未处理)")
     private String status;
 
+    /**
+     * 处理状态(1-已处理0-未处理)
+     */
+    @ApiModelProperty(value = "发送状态(2返回成功,1 已发送 0未发送)  任务下发给CCS,且CCS返回成功标识")
+    @TableField(value = "send_status")
+    @Excel(name = "发送状态")
+    private String sendStatus;
+
 
     /**
      * 是否人工处理(1-是0-否)

Some files were not shown because too many files changed in this diff