zy-asrs-common/src/main/java/com/zy/asrs/common/wms/mapper/LocMastMapper.java
@@ -3,10 +3,16 @@ import com.zy.asrs.common.wms.entity.LocMast; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; import java.util.List; @Mapper @Repository public interface LocMastMapper extends BaseMapper<LocMast> { @Select("select loc_no from common_loc_mast where 1=1 and loc_sts = 'O' and host_id = #{hostId}") List<String> queryGroupEmptyStock(Long hostId); } zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/LocMastService.java
@@ -3,6 +3,16 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.zy.asrs.common.wms.entity.LocMast; import java.util.List; public interface LocMastService extends IService<LocMast> { /** * 获取同组货架的空库位 * * @param sourceLocNo 源库位 * @return 同组空库位集合 */ List<String> queryGroupEmptyStock(String sourceLocNo, Long hostId); } zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/WorkService.java
@@ -47,5 +47,10 @@ */ void adjustLocDetl(LocDetlAdjustParam param, Long userId, Long hostId); /** * 库位移转 */ void locMove(String sourceLocNo, String locNo, Long userId, Long hostId); } zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/LocMastServiceImpl.java
@@ -1,12 +1,30 @@ package com.zy.asrs.common.wms.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.common.wms.mapper.LocMastMapper; import com.zy.asrs.common.wms.entity.LocMast; import com.zy.asrs.common.wms.service.LocMastService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zy.asrs.framework.common.Cools; import org.springframework.stereotype.Service; import java.util.List; @Service("locMastService") public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService { @Override public List<String> queryGroupEmptyStock(String sourceLocNo, Long hostId) { if (Cools.isEmpty(sourceLocNo)) { return null; } LocMast sourceStock = this.getOne(new LambdaQueryWrapper<LocMast>() .eq(LocMast::getLocNo, sourceLocNo) .eq(LocMast::getHostId, hostId)); if (Cools.isEmpty(sourceStock)) { return null; } return this.baseMapper.queryGroupEmptyStock(hostId); } } zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/WorkServiceImpl.java
@@ -163,6 +163,7 @@ } @Override @Transactional public void stockOut(Integer staNo, List<LocDetlDto> locDetlDtos, IoWorkType ioWorkType, Long userId, Long hostId) { Date now = new Date(); // 合并同类项 @@ -535,6 +536,7 @@ } @Override @Transactional public void adjustLocDetl(LocDetlAdjustParam param, Long userId, Long hostId) { param.integrate(); LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, param.getLocNo()).eq(LocMast::getHostId, hostId)); @@ -656,4 +658,92 @@ throw new CoolException("更新库位状态失败"); } } @Override @Transactional public void locMove(String sourceLocNo, String locNo, Long userId, Long hostId) { LocMast sourceLoc = locMastService.getOne(new LambdaQueryWrapper<LocMast>() .eq(LocMast::getLocNo, sourceLocNo) .eq(LocMast::getHostId, hostId)); List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>() .eq(LocDetl::getLocNo, sourceLocNo) .eq(LocDetl::getHostId, hostId)); if (Cools.isEmpty(sourceLoc)){ throw new CoolException("未找到库位"); } LocMast loc = locMastService.getOne(new LambdaQueryWrapper<LocMast>() .eq(LocMast::getLocNo, locNo) .eq(LocMast::getHostId, hostId)); if (Cools.isEmpty(loc)){ throw new CoolException("未找到库位"); } if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) { // throw new CoolException("移转库位属于不同堆垛机"); todo:luxiaotao } Date now = new Date(); // 获取工作号 int workNo = commonService.getWorkNo(WorkNoType.PICK.type); // 保存工作档 WrkMast wrkMast = new WrkMast(); wrkMast.setWrkNo(workNo); wrkMast.setIoTime(now); wrkMast.setWrkSts(101L); // 工作状态:101.生成出库任务 wrkMast.setIoType(11); // 入出库状态: 11.库格移载 wrkMast.setIoPri(10D); wrkMast.setSourceLocNo(sourceLocNo); // 源库位 wrkMast.setLocNo(locNo); // 目标库位 wrkMast.setFullPlt(Cools.isEmpty(locDetls)?"N":"Y"); // 满板:Y wrkMast.setPicking("N"); // 拣料 wrkMast.setExitMk("N"); // 退出 wrkMast.setEmptyMk(sourceLoc.getLocSts().equals("D")?"Y":"N"); // 空板 wrkMast.setBarcode(sourceLoc.getBarcode()); // 托盘码 wrkMast.setAppeUser(String.valueOf(userId)); wrkMast.setAppeTime(now); wrkMast.setModiUser(String.valueOf(userId)); wrkMast.setModiTime(now); wrkMast.setHostId(hostId); boolean res = wrkMastService.save(wrkMast); if (!res) { throw new CoolException("保存工作档失败"); } // 工作档明细保存 for (LocDetl locDetl : locDetls) { WrkDetl wrkDetl = new WrkDetl(); wrkDetl.sync(locDetl); wrkDetl.setWrkNo(workNo); wrkDetl.setIoTime(now); wrkDetl.setAnfme(locDetl.getAnfme()); wrkDetl.setAppeTime(now); wrkDetl.setAppeUser(userId); wrkDetl.setModiTime(now); wrkDetl.setModiUser(userId); wrkDetl.setHostId(hostId); wrkDetl.setWrkMastId(wrkMast.getId()); if (!wrkDetlService.save(wrkDetl)) { throw new CoolException("保存工作档明细失败"); } } // 修改源库位状态 if (sourceLoc.getLocSts().equals("D") || sourceLoc.getLocSts().equals("F")) { sourceLoc.setLocSts("R"); // R.出库预约 sourceLoc.setModiUser(userId); sourceLoc.setModiTime(now); if (!locMastService.updateById(sourceLoc)){ throw new CoolException("更新源库位状态失败"); } } else { throw new CoolException(sourceLoc.getLocNo() + "源库位出库失败,状态:"+sourceLoc.getLocSts$()); } // 修改目标库位状态 if (loc.getLocSts().equals("O")) { loc.setLocSts("S"); // S.入库预约 loc.setModiTime(now); loc.setModiUser(userId); if (!locMastService.updateById(loc)) { throw new CoolException("更新目标库位状态失败"); } } else { throw new CoolException("移转失败,目标库位状态:"+loc.getLocSts$()); } } } zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/LocDetlController.java
@@ -51,8 +51,8 @@ wrapper.ge(LocDetl::getAppeTime, DateUtils.convert(range[0])); wrapper.le(LocDetl::getAppeTime, DateUtils.convert(range[1])); } if (!Cools.isEmpty(param.get("loc_no"))) { wrapper.eq(LocDetl::getLocNo, param.get("loc_no")); if (!Cools.isEmpty(param.get("locNo"))) { wrapper.eq(LocDetl::getLocNo, param.get("locNo")); } return R.ok(locDetlService.page(new Page<>(curr, limit), wrapper)); } zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/LocMastController.java
@@ -60,6 +60,12 @@ return R.ok(locMastService.page(new Page<>(curr, limit), wrapper)); } @PostMapping(value = "/group/empty/stock") @ManagerAuth(memo = "获取同组货架的空库位") public R getGroupEmptyStock(@RequestParam(required = false) String sourceLocNo) { return R.ok().add(locMastService.queryGroupEmptyStock(sourceLocNo, getHostId())); } @RequestMapping(value = "/locMast/add/auth") @ManagerAuth zy-asrs-wms/src/main/java/com/zy/asrs/wms/controller/WorkController.java
@@ -111,4 +111,12 @@ return R.ok("库存调整成功"); } @RequestMapping("/loc/move/start") @ManagerAuth(memo = "库位移转") public synchronized R locMoveStart(@RequestParam String sourceLocNo, @RequestParam String targetLocNo) { workService.locMove(sourceLocNo, targetLocNo, getUserId(), getHostId()); return R.ok("移库启动成功"); } } zy-asrs-wms/src/main/webapp/static/js/pakStore/locMove.js
@@ -59,7 +59,7 @@ // 搜索库位物料 function getLoc(el) { tableIns.reload({ url: baseUrl+'/locDetl/list/auth' url: baseUrl+'/locDetl/page/auth' , where: {loc_no: el.value} , done:function (res) { limit(); zy-asrs-wms/src/main/webapp/views/locDetl/locDetl.html
@@ -16,7 +16,7 @@ <div id="search-box" class="layui-form layui-card-header"> <div class="layui-inline"> <div class="layui-input-inline"> <input class="layui-input" type="text" name="loc_no" placeholder="库位号" autocomplete="off"> <input class="layui-input" type="text" name="locNo" placeholder="库位号" autocomplete="off"> </div> </div> <div class="layui-inline">