|  |  | 
 |  |  |  | 
 |  |  | @Data | 
 |  |  | public class TagParam { | 
 |  |  |     private String parentTagName; | 
 |  |  |     private String tagName; | 
 |  |  |     private String ItemClassId; | 
 |  |  |     private String ParentItemClassId; | 
 |  |  |     private String Name; | 
 |  |  |     private String SysActive; | 
 |  |  |     private String ParentName; | 
 |  |  |  | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     List<WrkDetl> selectAndLogByOrderNoGroupByMatnrOfSum(String orderNo); | 
 |  |  |  | 
 |  |  |     int updateIoTimeWms(@Param("workNo") Integer workNo, @Param("ioTime") Date ioTime); | 
 |  |  |  | 
 |  |  |     int updateIoTime(@Param("workNo") Integer workNo, @Param("ioTime") Date ioTime); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     List<WrkMast> selectToShuttleTask(); | 
 |  |  |  | 
 |  |  |     List<WrkMast> selectToShuttleOutTask(); | 
 |  |  |  | 
 |  |  |     @Insert("insert into asr_wrk_detl_log select * from asr_wrk_detl where wrk_no=#{workNo}") | 
 |  |  |     int saveWrkDetlLog(Integer workNo); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     List<WrkDetl> selectAndLogByOrderNoGroupByMatnrOfSum(String orderNo); | 
 |  |  |  | 
 |  |  |     boolean updateIoTimeWms(Integer workNo, Date ioTime); | 
 |  |  |  | 
 |  |  |     boolean updateIoTime(Integer workNo, Date ioTime); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  | 
 |  |  | import com.baomidou.mybatisplus.service.IService; | 
 |  |  | import com.zy.asrs.entity.WrkMast; | 
 |  |  | import org.apache.ibatis.annotations.Insert; | 
 |  |  |  | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     List<WrkMast> selectToShuttleTask(); | 
 |  |  |     List<WrkMast> selectToShuttleOutTask(); | 
 |  |  |  | 
 |  |  |     @Insert("insert into asr_wrk_detl_log select * from asr_wrk_detl where wrk_no=#{workNo}") | 
 |  |  |     int saveWrkDetlLog(Integer workNo); | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     @Transactional | 
 |  |  |     public void syncTag(List<TagParam> param) { | 
 |  |  |  | 
 |  |  |         param.forEach(tag-> { | 
 |  |  |             // 分类 | 
 |  |  |             Long tagId; | 
 |  |  |             Date now = new Date(); | 
 |  |  |             if (Cools.isEmpty(tag.getParentItemClassId())){ | 
 |  |  |                 Tag priTag = tagService.selectByName("全部", 1); | 
 |  |  |  | 
 |  |  |                 // 二级分类 | 
 |  |  |                 Tag secTag = tagService.selectByName(tag.getName(), 2); | 
 |  |  |                 if (secTag == null) { | 
 |  |  |                     NodeUtils nodeUtils = new NodeUtils(); | 
 |  |  |                     nodeUtils.executePath(priTag.getId()); | 
 |  |  |                     secTag = new Tag( | 
 |  |  |                             null,    // 编号 | 
 |  |  |                             tag.getName(),    // 名称 | 
 |  |  |                             priTag.getId(),    // 父级 | 
 |  |  |                             priTag.getName(),    // 父级名称 | 
 |  |  |                             nodeUtils.path.toString(),    // 关联路径 | 
 |  |  |                             nodeUtils.pathName.toString(),    // 关联路径名 | 
 |  |  |                             0,    // 类型 | 
 |  |  |                             null,    // 负责人 | 
 |  |  |                             null,    // 图片 | 
 |  |  |                             null,    // 简要描述 | 
 |  |  |                             null,    // 数量 | 
 |  |  |                             2,    // 等级 | 
 |  |  |                             null,    // 排序 | 
 |  |  |                             1,    // 状态 | 
 |  |  |                             now,    // 添加时间 | 
 |  |  |                             null,    // 添加人员 | 
 |  |  |                             now,    // 修改时间 | 
 |  |  |                             null,    // 修改人员 | 
 |  |  |                             tag.getItemClassId()    // 备注 | 
 |  |  |                     ); | 
 |  |  |                     if (tagMapper.insert(secTag) == 0) { | 
 |  |  |                         throw new CoolException("服务器内部错误,请联系管理员"); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             }else { | 
 |  |  |                 Tag priTag =tagService.selectOne(new EntityWrapper<Tag>().eq("memo", tag.getParentItemClassId())); | 
 |  |  |                 if (priTag == null) { | 
 |  |  |                     Tag top = tagService.getTop(); | 
 |  |  |                     NodeUtils nodeUtils = new NodeUtils(); | 
 |  |  |                     nodeUtils.executePath(top.getId()); | 
 |  |  |                     priTag = new Tag( | 
 |  |  |                             null,    // 编号 | 
 |  |  |                             tag.getParentName(),    // 名称 | 
 |  |  |                             top.getId(),    // 父级 | 
 |  |  |                             top.getName(),    // 父级名称 | 
 |  |  |                             nodeUtils.path.toString(),    // 关联路径 | 
 |  |  |                             nodeUtils.pathName.toString(),    // 关联路径名 | 
 |  |  |                             0,    // 类型 | 
 |  |  |                             null,    // 负责人 | 
 |  |  |                             null,    // 图片 | 
 |  |  |                             null,    // 简要描述 | 
 |  |  |                             null,    // 数量 | 
 |  |  |                             2,    // 等级 | 
 |  |  |                             null,    // 排序 | 
 |  |  |                             1,    // 状态 | 
 |  |  |                             now,    // 添加时间 | 
 |  |  |                             null,    // 添加人员 | 
 |  |  |                             now,    // 修改时间 | 
 |  |  |                             null,    // 修改人员 | 
 |  |  |                             tag.getParentItemClassId()    // 备注 | 
 |  |  |                     ); | 
 |  |  |                     if (tagMapper.insert(priTag) == 0) { | 
 |  |  |                         throw new CoolException("服务器内部错误,请联系管理员"); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     public boolean updateIoTimeWms(Integer workNo, Date ioTime) { | 
 |  |  |         return this.baseMapper.updateIoTimeWms(workNo, ioTime) > 0; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public boolean updateIoTime(Integer workNo, Date ioTime) { | 
 |  |  |         return this.baseMapper.updateIoTime(workNo, ioTime) > 0; | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     public List<WrkMast> selectToShuttleOutTask() { | 
 |  |  |         return this.baseMapper.selectToShuttleOutTask(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public int saveWrkDetlLog(Integer workNo) { | 
 |  |  |         return this.baseMapper.saveWrkDetlLog(workNo); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | import org.springframework.transaction.interceptor.TransactionAspectSupport; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private StaDescService staDescService; | 
 |  |  |  | 
 |  |  |     @PostMapping | 
 |  |  |     @Transactional | 
 |  |  |     public synchronized R getLocNo3(@RequestBody SearchLocParam param){ | 
 |  |  |         log.info("收到WCS拣料入库接口请求====>>入参:{}", param); | 
 |  |  |         WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode())); | 
 |  |  |         if (Cools.isEmpty(wrkMast)){ | 
 |  |  |             return R.error("未找到任务"); | 
 |  |  |         } | 
 |  |  |         StartupDto dto = null; | 
 |  |  |         // 获取目标站 | 
 |  |  |         Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() | 
 |  |  |                 .eq("type_no", wrkMast.getIoType() - 50) | 
 |  |  |                 .eq("stn_no", 31002) // 作业站点 = 拣料出库的目标站 | 
 |  |  |                 .eq("crn_no", wrkMast.getCrnNo()); // 堆垛机号 | 
 |  |  |         StaDesc staDesc = staDescService.selectOne(wrapper); | 
 |  |  |         if (Cools.isEmpty(staDesc)){ | 
 |  |  |             return R.error("未找到站点路径"); | 
 |  |  |         } | 
 |  |  |         if (wrkMast.getWrkSts() == 14 && wrkMast.getIoType() == 103){ | 
 |  |  |             try { | 
 |  |  |                 // 保存工作明细档历史档 | 
 |  |  |                 if (wrkMastService.saveWrkDetlLog(wrkMast.getWrkNo()) == 0) { | 
 |  |  |                     throw new CoolException("保存工作明细档历史档失败"); | 
 |  |  |                 } | 
 |  |  |                 // 保存工作主档历史档 | 
 |  |  |                 if (wrkMastService.saveWrkMastLog(wrkMast.getWrkNo()) == 0) { | 
 |  |  |                     throw new CoolException("保存工作主档历史档失败"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 Date now = new Date(); | 
 |  |  |                 // 堆垛机站点(目标站) | 
 |  |  |                 Integer staNo = staDesc.getCrnStn(); | 
 |  |  |                 // 更新工作档数据状态 | 
 |  |  |                 wrkMast.setIoTime(now); | 
 |  |  |                 wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57 | 
 |  |  |                 wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走 | 
 |  |  |                 wrkMast.setSourceStaNo(wrkMast.getStaNo()); // 源站 | 
 |  |  |                 wrkMast.setStaNo(staNo); // 目标站 | 
 |  |  |                 wrkMast.setLocNo(wrkMast.getSourceLocNo()); // 目标库位 = 出库时的源库位 | 
 |  |  |                 wrkMast.setSourceLocNo(""); // 源库位清空 | 
 |  |  |                 wrkMast.setModiTime(now); | 
 |  |  |                 if (wrkMastService.updateById(wrkMast)) { | 
 |  |  |                     throw new CoolException("更新工作档数据状态失败"); | 
 |  |  |                 } | 
 |  |  |                 // 更新明细档io_time (历史档关联使用) | 
 |  |  |                 wrkDetlService.updateIoTime(wrkMast.getWrkNo(), now); | 
 |  |  |                 // 修改库位状态 Q.拣料/盘点/并板再入库 | 
 |  |  |                 LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); | 
 |  |  |                 locMast.setLocSts("Q"); | 
 |  |  |                 locMast.setModiTime(new Date()); | 
 |  |  |                 if (!locMastService.updateById(locMast)) { | 
 |  |  |                     throw new CoolException("修改库位状态失败"); | 
 |  |  |                 } | 
 |  |  |                 dto.setWorkNo(wrkMast.getWrkNo()); | 
 |  |  |                 dto.setLocNo(wrkMast.getLocNo()); | 
 |  |  |                 return R.ok(dto); | 
 |  |  |             } catch (Exception e) { | 
 |  |  |                return R.error(e.getMessage()); | 
 |  |  |             } | 
 |  |  |         }else { | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         return R.error(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/pakin2/loc/v1") | 
 |  |  |     @ResponseBody | 
 |  |  |     @Transactional | 
 
 |  |  | 
 |  |  |         where 1=1 | 
 |  |  |           and wrk_no = #{workNo} | 
 |  |  |     </update> | 
 |  |  |     <update id="updateIoTime"> | 
 |  |  |         update asr_wrk_detl | 
 |  |  |         set io_time = #{ioTime} | 
 |  |  |         where 1=1 | 
 |  |  |           and wrk_no = #{workNo} | 
 |  |  |     </update> | 
 |  |  |  | 
 |  |  |     <select id="selectPakoutQuery" resultMap="BaseResultMap"> | 
 |  |  |         select |