| | |
| | | private LocDetlMapper locDetlMapper; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | @RequestMapping(value = "/locDetl/update") |
| | | public R update1() { |
| | |
| | | // wrapper.and() |
| | | // .where("loc_no like '" +row +"%'"); |
| | | // } |
| | | return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | R r = R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | return r; |
| | | } |
| | | |
| | | |
| | |
| | | locDetl.sync(mat); |
| | | } |
| | | } |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | return R.ok().add(stockStatis); |
| | | } |
| | | |
| | |
| | | @RequestMapping("/locDetl/count") |
| | | public R getAllCount(){ |
| | | Integer sum = locDetlService.sum(); |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | return R.ok(sum); |
| | | } |
| | | |
| | |
| | | import com.zy.asrs.entity.param.LocMastInitParam; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.MonitorLocMapCacheService; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.Shelves; |
| | | import com.zy.common.web.BaseController; |
| | |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | @RequestMapping(value = "/locMast/init/pwd") |
| | | public R locMastInitPwd(@RequestParam(required = false) String pwd) { |
| | |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | R r = R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | return r; |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.service.MonitorLocMapCacheService; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | @PostMapping("/order/matSync/default/v1") |
| | | @AppAuth(memo = "商品信息同步接口") |
| | |
| | | public R queryStock(@RequestHeader(required = false) String appkey, |
| | | HttpServletRequest request) { |
| | | auth(appkey, null, request); |
| | | return R.ok().add(openService.queryStock()); |
| | | R r = R.ok().add(openService.queryStock()); |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | return r; |
| | | } |
| | | |
| | | private void auth(String appkey, Object obj, HttpServletRequest request) { |
| | |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.MonitorLocMapCacheService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | //------------------库位使用统计-------------------------------------- |
| | | @RequestMapping("/viewStockUseList.action") |
| | |
| | | Page<ViewStockUseBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | return R.ok(page); |
| | | } |
| | | |
| | |
| | | @Select("select lev1,loc_sts as locSts from asr_loc_mast where row1=#{row1} and bay1=#{bay1} order by bay1") |
| | | public List<ViewLocMapDto> getViewLocLevs(@Param("row1") int row1, @Param("bay1") int bay1); |
| | | |
| | | |
| | | //分页查询站点入出库次数统计 |
| | | public List<ViewInOutBean> queryViewInOutList(ViewInOutBean viewInOut); |
| | | public int getViewInOutCount(ViewInOutBean viewInOut); |
| New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | /** |
| | | * 监控库位热力图 Redis 缓存清理 |
| | | */ |
| | | public interface MonitorLocMapCacheService { |
| | | |
| | | void clearQuietly(); |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.MonitorLocMapCacheService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | |
| | | |
| | | @Service("locDetlService") |
| | | public class LocDetlServiceImpl extends ServiceImpl<LocDetlMapper, LocDetl> implements LocDetlService { |
| | | |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | @Override |
| | | public boolean insert(LocDetl entity) { |
| | | boolean ok = super.insert(entity); |
| | | if (ok) { |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | return ok; |
| | | } |
| | | |
| | | @Override |
| | | public boolean delete(Wrapper<LocDetl> wrapper) { |
| | | boolean ok = super.delete(wrapper); |
| | | if (ok) { |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | return ok; |
| | | } |
| | | |
| | | @Override |
| | | public Page<LocDetl> getPage(Page<LocDetl> page) { |
| | |
| | | |
| | | @Override |
| | | public boolean updateAnfme(Double anfme, String locNo, String matnr, String batch) { |
| | | boolean ok; |
| | | if (anfme <= 0) { |
| | | return this.baseMapper.deleteItem(locNo, matnr, batch) > 0; |
| | | ok = this.baseMapper.deleteItem(locNo, matnr, batch) > 0; |
| | | } else { |
| | | return baseMapper.updateAnfme(anfme, locNo, matnr, batch) > 0; |
| | | ok = baseMapper.updateAnfme(anfme, locNo, matnr, batch) > 0; |
| | | } |
| | | if (ok) { |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | return ok; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public boolean updateLocNo(String newLocNo, String oldLocNo) { |
| | | return baseMapper.updateLocNo(newLocNo, oldLocNo) > 0; |
| | | boolean ok = baseMapper.updateLocNo(newLocNo, oldLocNo) > 0; |
| | | if (ok) { |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | return ok; |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.MonitorLocMapCacheService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service("locMastService") |
| | | public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService { |
| | | |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | @Override |
| | | public boolean updateById(LocMast entity) { |
| | | boolean updated = super.updateById(entity); |
| | | if (updated) { |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | return updated; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateAllColumnById(LocMast entity) { |
| | | boolean updated = super.updateAllColumnById(entity); |
| | | if (updated) { |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | return updated; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> queryGroupEmptyStock(String sourceLocNo) { |
| New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.service.MonitorLocMapCacheService; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class MonitorLocMapCacheServiceImpl implements MonitorLocMapCacheService { |
| | | |
| | | /** 与 WCS MonitorReportServiceImpl 写入键一致 */ |
| | | private static final String LOC_MAP_CACHE_KEY_PREFIX = "monitor:loc:map:row:"; |
| | | |
| | | private static final String[] LOC_MAP_CACHE_PATTERNS = { |
| | | "monitor:loc:map:*", |
| | | "*monitor:loc:map:*", |
| | | }; |
| | | |
| | | @Autowired(required = false) |
| | | private RedisUtil redisUtil; |
| | | @Autowired(required = false) |
| | | private ReportQueryMapper reportQueryMapper; |
| | | |
| | | @Override |
| | | public void clearQuietly() { |
| | | if (redisUtil == null) { |
| | | return; |
| | | } |
| | | try { |
| | | Set<String> toDelete = new HashSet<>(); |
| | | for (String pattern : LOC_MAP_CACHE_PATTERNS) { |
| | | Set<?> keys = redisUtil.keys(pattern); |
| | | if (keys == null || keys.isEmpty()) { |
| | | continue; |
| | | } |
| | | for (Object key : keys) { |
| | | if (key != null) { |
| | | toDelete.add(String.valueOf(key)); |
| | | } |
| | | } |
| | | } |
| | | toDelete.add(LOC_MAP_CACHE_KEY_PREFIX + "1"); |
| | | if (reportQueryMapper != null) { |
| | | List<Integer> rows = reportQueryMapper.getViewLocRowTotal(); |
| | | if (rows != null) { |
| | | for (Integer row : rows) { |
| | | if (row != null) { |
| | | toDelete.add(LOC_MAP_CACHE_KEY_PREFIX + row); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (toDelete.isEmpty()) { |
| | | return; |
| | | } |
| | | redisUtil.del(toDelete.toArray(new String[0])); |
| | | } catch (Exception e) { |
| | | log.warn("清理库位热力图缓存失败,继续业务", e); |
| | | } |
| | | } |
| | | } |
| | |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | wrkMast.setExitMk("N"); // 退出 |
| | | wrkMast.setEmptyMk("Y"); // 空板 |
| | | wrkMast.setLinkMis("N"); |
| | | wrkMast.setBarcode(locMast.getBarcode()); |
| | | wrkMast.setAppeUser(userId); |
| | | wrkMast.setAppeTime(now); |
| | | wrkMast.setModiUser(userId); |
| | |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("修改工作档失败"); |
| | | } |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (!wrkMastRes || !locMastRes) { |
| | | throw new CoolException("保存数据失败"); |
| | | } |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.mapper.WrkMastMapper; |
| | | import com.zy.asrs.service.MonitorLocMapCacheService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | @Service("wrkMastService") |
| | | public class WrkMastServiceImpl extends ServiceImpl<WrkMastMapper, WrkMast> implements WrkMastService { |
| | | |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | @Override |
| | | public boolean insert(WrkMast entity) { |
| | | boolean ok = super.insert(entity); |
| | | if (ok) { |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | } |
| | | return ok; |
| | | } |
| | | |
| | | @Override |
| | | public int getWorkingMast(Integer devpNo) { |
| | | return selectCount(new EntityWrapper<WrkMast>().eq("source_sta_no", devpNo).in("wrk_sts", 1, 6)); |
| | |
| | | private WrkMastLogService wrkMastLogService; |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | @Autowired |
| | | private MonitorLocMapCacheService monitorLocMapCacheService; |
| | | |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | // 4.入库完成 |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | return SUCCESS; |
| | | } |
| | | |
| | |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | | monitorLocMapCacheService.clearQuietly(); |
| | | return SUCCESS; |
| | | } |
| | | |
| | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.PropertyAccessor; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.boot.autoconfigure.data.redis.RedisProperties; |
| | | import org.springframework.cache.annotation.CachingConfigurerSupport; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.connection.RedisPassword; |
| | | import org.springframework.data.redis.connection.RedisStandaloneConfiguration; |
| | | import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; |
| | | import org.springframework.data.redis.core.*; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | |
| | | * Redis配置类 |
| | | * Created by vincent on 2019-12-23 |
| | | */ |
| | | //@Configuration |
| | | @Configuration |
| | | //@EnableCaching // 开启数据缓存机制 |
| | | public class RedisConfig extends CachingConfigurerSupport { |
| | | |
| | | /** |
| | | * 使用 application.yml 中 spring.redis(含 database) |
| | | */ |
| | | @Bean |
| | | @Primary |
| | | public LettuceConnectionFactory redisConnectionFactory(RedisProperties redisProperties) { |
| | | RedisStandaloneConfiguration standalone = new RedisStandaloneConfiguration(); |
| | | standalone.setHostName(redisProperties.getHost()); |
| | | standalone.setPort(redisProperties.getPort()); |
| | | standalone.setDatabase(redisProperties.getDatabase()); |
| | | if (StringUtils.hasText(redisProperties.getPassword())) { |
| | | standalone.setPassword(RedisPassword.of(redisProperties.getPassword())); |
| | | } |
| | | return new LettuceConnectionFactory(standalone); |
| | | } |
| | | |
| | | /** |
| | | * RedisTemplate相关配置 |
| | |
| | | url: jdbc:sqlserver://127.0.0.1:52840;databasename=shhtgcasrs |
| | | username: sa |
| | | password: sa@123 |
| | | redis: |
| | | host: localhost |
| | | port: 6379 |
| | | database: 0 |
| | | # password: xltys1995 |
| | | mvc: |
| | | static-path-pattern: /** |
| | | servlet: |
| | |
| | | case 'complete': |
| | | layer.confirm('确认完成该笔工作档?', {title: '工作号:'+data.wrkNo, shadeClose: true}, function(){ |
| | | http.post(baseUrl+"/hand/control/wrkMast", {workNo: data.wrkNo, type:1}, function (res) { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(data.wrkNo + res.msg); |
| | | // $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(data.wrkNo + res.msg, {time: 1000}, function () { location.reload(); }); |
| | | }) |
| | | layer.closeAll(); |
| | | |
| | |
| | | if (data.pdcType === "Y") { |
| | | layer.confirm('当前任务关联ERP销售单,取消将重新生成出库作业,是否继续?', {title: '工作号:'+data.wrkNo, shadeClose: true}, function(){ |
| | | http.post(baseUrl+"/hand/control/wrkMast", {workNo: data.wrkNo, type:2}, function (res) { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(data.wrkNo + res.msg); |
| | | // $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(data.wrkNo + res.msg, {time: 1000}, function () { location.reload(); }); |
| | | }) |
| | | layer.closeAll(); |
| | | }); |
| | | } else { |
| | | layer.confirm('确认取消该笔工作档?', {title: '工作号:'+data.wrkNo, shadeClose: true}, function(){ |
| | | http.post(baseUrl+"/hand/control/wrkMast", {workNo: data.wrkNo, type:2}, function (res) { |
| | | $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(data.wrkNo + res.msg); |
| | | // $(".layui-laypage-btn")[0].click(); |
| | | layer.msg(data.wrkNo + res.msg, {time: 1000}, function () { location.reload(); }); |
| | | }) |
| | | layer.closeAll(); |
| | | }); |