| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.api.MesApiUtils; |
| | | import com.ruoyi.inspect.pojo.IfsSplitOrderRecord; |
| | | import com.ruoyi.inspect.service.IfsSplitOrderRecordService; |
| | |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.AfterReturning; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 执行ifs移库操作后,同步推送mes实时库存 |
| | |
| | | |
| | | private final static String LOCATION_NO = "WG-02-001";//mes外购合格库位 |
| | | |
| | | public static final int DIGIT = 6; |
| | | public static final String PREFIX ="KC"; |
| | | |
| | | @AfterReturning(value = "execution(* com.ruoyi.inspect.service.impl.InsOrderServiceImpl.moveRawMaterial(..))") |
| | | @Before(value = "execution(* com.ruoyi.inspect.service.impl.InsOrderServiceImpl.moveRawMaterial(..))") |
| | | @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) |
| | | public void doAfterReturning(JoinPoint joinPoint) { |
| | | Object[] args = joinPoint.getArgs(); |
| | |
| | | .last("limit 1") |
| | | ); |
| | | if(Objects.nonNull(one)){ |
| | | //生成系统编号 |
| | | |
| | | //查询对应记录相同批号和零件且已同步的订单记录 |
| | | List<IfsSplitOrderRecord> quantityList = ifsSplitOrderRecordService.list(Wrappers.<IfsSplitOrderRecord>lambdaQuery() |
| | | .eq(IfsSplitOrderRecord::getPartNo,one.getPartNo()) |
| | | .eq(IfsSplitOrderRecord::getLotBatchNo,one.getLotBatchNo()) |
| | | .ne(IfsSplitOrderRecord::getId,one.getId()) |
| | | .eq(IfsSplitOrderRecord::getSyncStatus,1) |
| | | ); |
| | | if(!quantityList.isEmpty()){ |
| | | //使用相同的系统编号 |
| | | one.setSystemNo(quantityList.get(0).getSystemNo()); |
| | | } |
| | | //同步MES实时库存 |
| | | Map<String, Object> requestMap = new HashMap<>(); |
| | | requestMap.put("partNo", one.getPartNo()); // 零件编号 |
| | | requestMap.put("systemNo", one.getSystemNo()); // 系统编号 |
| | | requestMap.put("newSystemNo", one.getSystemNo()); // 新系统编号 |
| | | requestMap.put("spec", one.getSpec()); // 规格 |
| | | requestMap.put("partBatchNo", one.getLotBatchNo()); // 零件批号 |
| | | requestMap.put("newPartBatchNo", one.getLotBatchNo()); // 新零件批号 |
| | | requestMap.put("stockQuantity", one.getLength()); // 库存数量1 |
| | | requestMap.put("qty", one.getQtyStock()); // 库存数量2 |
| | | requestMap.put("insulationColor", one.getInsulationColor()); // 绝缘颜色 |
| | |
| | | requestMap.put("remark", one.getRemark()); // 备注 |
| | | |
| | | String jsonStr = JSONUtil.toJsonStr(Collections.singletonList(requestMap)); |
| | | log.info("同步MES实时库存请求参数-->{}",jsonStr); |
| | | boolean b = mesApiUtils.batchAddStock(jsonStr); |
| | | //同步成功,更新同步状态 |
| | | if(b){ |