New file |
| | |
| | | package com.zy.asrs.common.domain.dto; |
| | | |
| | | import com.zy.asrs.common.wms.entity.WrkDetl; |
| | | import lombok.Data; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/5/13 |
| | | */ |
| | | @Data |
| | | public class WrkDto { |
| | | |
| | | private Integer wrkNo; |
| | | |
| | | private List<WrkDetl> wrkDetls = new ArrayList<>(); |
| | | |
| | | public WrkDto() { |
| | | } |
| | | |
| | | public WrkDto(Integer wrkNo, WrkDetl wrkDetl) { |
| | | this.wrkNo = wrkNo; |
| | | this.wrkDetls .add(wrkDetl); |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.common.domain.entity; |
| | | |
| | | import com.zy.asrs.common.wms.entity.WrkDetl; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/4/13 |
| | | */ |
| | | @Data |
| | | public class MobileAdjustResult { |
| | | |
| | | private Integer staNo; |
| | | |
| | | private Integer wrkNo; |
| | | |
| | | private List<WrkDetl> wrkDetls; |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.common.domain.param; |
| | | |
| | | import com.zy.asrs.common.wms.entity.WrkDetl; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/4/13 |
| | | */ |
| | | @Data |
| | | public class MobileAdjustParam { |
| | | |
| | | private Integer staNo; |
| | | |
| | | private Integer wrkNo; |
| | | |
| | | private List<WrkDetl> wrkDetls; |
| | | |
| | | } |
| | |
| | | //组托物料 |
| | | private List<CombMat> combMats; |
| | | |
| | | //仓库ID |
| | | private Long hostId; |
| | | |
| | | @Data |
| | | public static class CombMat { |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | public Double getEnableQty() { |
| | | if (null != this.anfme && this.qty != null) { |
| | | return this.anfme - this.qty; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void sync(Object source) { |
| | | Synchro.Copy(source, this); |
| | | } |
| | |
| | | @ApiModelProperty(value= "授权商户") |
| | | private Long hostId; |
| | | |
| | | @ApiModelProperty(value= "oveMk") |
| | | private String oveMk; |
| | | |
| | | @ApiModelProperty(value= "invWh") |
| | | private String invWh; |
| | | |
| | | public WrkMast() {} |
| | | |
| | | public WrkMast(Integer wrkNo,Long wrkSts,Integer ioType,Double ioPri,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String picking,String exitMk,Integer pltType,String emptyMk,Date ioTime,Integer ctnType,String modiUser,Date modiTime,String appeUser,Date appeTime,Date errorTime,String errorMemo,String manuType,String memo,String barcode,String fullPlt,Long hostId) { |
| | |
| | | @ApiModelProperty(value= "授权商户") |
| | | private Long hostId; |
| | | |
| | | @ApiModelProperty(value= "oveMk") |
| | | private String oveMk; |
| | | |
| | | @ApiModelProperty(value= "invWh") |
| | | private String invWh; |
| | | |
| | | public WrkMastLog() {} |
| | | |
| | | public WrkMastLog(Long id,Integer wrkNo,Long wrkSts,Integer ioType,Double ioPri,String locNo,Integer staNo,Integer sourceStaNo,String sourceLocNo,String picking,String exitMk,Integer pltType,String emptyMk,Date ioTime,Integer ctnType,String modiUser,Date modiTime,String appeUser,Date appeTime,Date errorTime,String errorMemo,String manuType,String memo,String barcode,String fullPlt,Long hostId) { |
| | |
| | | @Repository |
| | | public interface OrderDetlMapper extends BaseMapper<OrderDetl> { |
| | | |
| | | List<OrderDetl> selectWorkingDetls(Long orderId); |
| | | |
| | | OrderDetl selectItem(@Param("orderId") Long orderId, @Param("matnr") String matnr, @Param("batch") String batch); |
| | | |
| | | IPage<OrderDetl> getPakoutPage(Page<OrderDetl> page ,Map<String, Object> map); |
| | |
| | | |
| | | List<WrkDetl> selectAndLogByOrderNo(String orderNo, Long hostId); |
| | | |
| | | List<WrkDetl> selectPakoutQuery(@Param("staNo") Integer staNo, @Param("matnr") String matnr, @Param("hostId") Long hostId); |
| | | |
| | | int updateInspect(@Param("wrkNo") Integer wrkNo, @Param("matnr") String matnr, @Param("batch") String batch, @Param("hostId") Long hostId); |
| | | |
| | | int deleteItem(@Param("wrkNo") Integer wrkNo, @Param("matnr") String matnr, @Param("batch") String batch, @Param("hostId") Long hostId); |
| | | |
| | | int updateAnfme(@Param("anfme") Double anfme, @Param("wrkNo") Integer wrkNo, @Param("matnr") String matnr, @Param("batch") String batch, @Param("hostId") Long hostId); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.common.wms.service; |
| | | |
| | | import com.zy.asrs.common.domain.param.MobileAdjustParam; |
| | | import com.zy.asrs.common.openapi.entity.param.CombParam; |
| | | |
| | | public interface MobileService { |
| | | |
| | | /** |
| | | * 组托 |
| | | */ |
| | | void comb(CombParam param, Long userId, Long hostId); |
| | | |
| | | /** |
| | | * 盘点 |
| | | */ |
| | | void adjust(MobileAdjustParam param, Long userId, Long hostId); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.common.wms.entity.Order; |
| | | import com.zy.asrs.common.wms.entity.OrderDetl; |
| | | import com.zy.asrs.common.wms.entity.WrkDetl; |
| | | import com.zy.asrs.common.wms.entity.WrkMast; |
| | | |
| | |
| | | |
| | | public interface OrderService extends IService<Order> { |
| | | |
| | | List<OrderDetl> selectWorkingDetls(Long orderId); |
| | | |
| | | void updateOrder1(Long orderId,Long userId); |
| | | |
| | | Order selectByNo(String orderNo, Long hostId); |
| | |
| | | |
| | | List<WrkDetl> selectAndLogByOrderNo(String orderNo, Long hostId); |
| | | |
| | | List<WrkDetl> selectPakoutQuery(Integer staNo, String matnr, Long hostId); |
| | | |
| | | boolean updateInspect(Integer wrkNo, String matnr, String batch, Long hostId); |
| | | |
| | | boolean updateAnfme(Double anfme, Integer wrkNo, String matnr, String batch, Long hostId); |
| | | |
| | | } |
| | |
| | | |
| | | List<WrkMast> selectToBeHistoryData(); |
| | | |
| | | WrkMast selectByBarcode(String barcode, Long hostId); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.common.wms.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.common.domain.dto.DetlDto; |
| | | import com.zy.asrs.common.domain.param.MobileAdjustParam; |
| | | import com.zy.asrs.common.openapi.entity.param.CombParam; |
| | | import com.zy.asrs.common.wms.entity.*; |
| | | import com.zy.asrs.common.wms.service.*; |
| | | import com.zy.asrs.framework.common.BaseRes; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 移动端服务核心类 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class MobileServiceImpl implements MobileService { |
| | | |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void comb(CombParam param, Long userId, Long hostId) { |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.count(new LambdaQueryWrapper<WaitPakin>(). |
| | | eq(WaitPakin::getZpallet, param.getBarcode()).eq(WaitPakin::getIoStatus, "N")) > 0) { |
| | | throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | } |
| | | Date now = new Date(); |
| | | |
| | | // 无单组托 |
| | | if (Cools.isEmpty(param.getOrderNo())) { |
| | | |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); |
| | | assert one != null; |
| | | one.setAnfme(one.getAnfme() + detlDto.getAnfme()); |
| | | } else { |
| | | detlDtos.add(detlDto); |
| | | } |
| | | }); |
| | | |
| | | |
| | | for (DetlDto detlDto : detlDtos) { |
| | | Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, detlDto.getMatnr()).eq(Mat::getHostId, hostId)); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setBatch(detlDto.getBatch()); |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(detlDto.getAnfme()); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | if (!waitPakinService.save(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | // 关联组托 |
| | | } else { |
| | | Order order = orderService.selectByNo(param.getOrderNo(), hostId); |
| | | if (order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | |
| | | // 订单明细数量校验 |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); |
| | | if (elem.getAnfme() > orderDetl.getEnableQty()) { |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | | // 修改订单明细数量 |
| | | if (!orderDetlService.increase(order.getId(), hostId, elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { |
| | | throw new CoolException("修改单据明细数量失败"); |
| | | } |
| | | |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); |
| | | assert one != null; |
| | | one.setAnfme(one.getAnfme() + detlDto.getAnfme()); |
| | | } else { |
| | | detlDtos.add(detlDto); |
| | | } |
| | | }); |
| | | for (DetlDto detlDto : detlDtos) { |
| | | Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, detlDto.getMatnr()).eq(Mat::getHostId, hostId)); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setOrderNo(order.getOrderNo()); // 单据编号 |
| | | waitPakin.setBatch(detlDto.getBatch()); // 序列码 |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(detlDto.getAnfme()); // 数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | if (!waitPakinService.save(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | orderService.updateSettle(order.getId(), 2L, userId, hostId); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void adjust(MobileAdjustParam param, Long userId, Long hostId) { |
| | | BasDevp basDevp = basDevpService.getOne(new LambdaQueryWrapper<BasDevp>().eq(BasDevp::getDevNo, param.getStaNo()).eq(BasDevp::getHostId, hostId)); |
| | | if (null == basDevp || basDevp.getWrkNo() == null) { |
| | | throw new CoolException(param.getStaNo() + "盘点站无效"); |
| | | } |
| | | if (!param.getWrkNo().equals(basDevp.getWrkNo())) { |
| | | throw new CoolException(param.getStaNo() + "盘点站更新,请重新检索"); |
| | | } |
| | | WrkMast wrkMast = wrkMastService.getOne(new LambdaQueryWrapper<WrkMast>().eq(WrkMast::getWrkNo, param.getWrkNo()).eq(WrkMast::getHostId, hostId)); |
| | | if (wrkMast.getWrkSts() < 10) { |
| | | throw new CoolException("盘点无效,任务已盘点再入库"); |
| | | } |
| | | Date now = new Date(); |
| | | List<WrkDetl> wrkDetls = wrkDetlService.list(new LambdaQueryWrapper<WrkDetl>().eq(WrkDetl::getWrkNo, wrkMast.getWrkNo()).eq(WrkDetl::getHostId, hostId)); |
| | | |
| | | List<WrkDetl> list = param.getWrkDetls(); |
| | | |
| | | // 修改数量 |
| | | Iterator<WrkDetl> iterator = wrkDetls.iterator(); |
| | | while (iterator.hasNext()) { |
| | | WrkDetl wrkDetl = iterator.next(); |
| | | Iterator<WrkDetl> iterator1 = list.iterator(); |
| | | while (iterator1.hasNext()) { |
| | | WrkDetl wrkDetl1 = iterator1.next(); |
| | | if (wrkDetl1.getAnfme() == 0) { |
| | | iterator1.remove(); |
| | | } |
| | | if (wrkDetl.getMatnr().equals(wrkDetl1.getMatnr()) && Cools.eq(wrkDetl.getBatch(), wrkDetl1.getBatch())) { |
| | | if (!wrkDetl.getAnfme().equals(wrkDetl1.getAnfme())) { |
| | | // todo 盘点记录、保存调整记录 |
| | | // 修改明细 |
| | | if (!wrkDetlService.updateAnfme(wrkDetl1.getAnfme(), wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), hostId)) { |
| | | throw new CoolException(wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品," + wrkDetl.getBatch() + "序列码修改数量失败"); |
| | | } |
| | | } |
| | | iterator.remove(); |
| | | iterator1.remove(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 删除明细 |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | // todo 盘点记录、保存调整记录 |
| | | if (!wrkDetlService.updateAnfme(-1.0D, wrkMast.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), hostId)) { |
| | | throw new CoolException("删除" + wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品," + wrkDetl.getBatch() + "序列码任务明细失败"); |
| | | } |
| | | } |
| | | |
| | | // 添加明细 |
| | | for (WrkDetl wrkDetl : list) { |
| | | if (wrkDetl.getAnfme() == 0.0D) { continue; } |
| | | // todo 盘点记录、保存调整记录 |
| | | String orderNo = wrkDetl.getOrderNo(); |
| | | Mat mat = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, wrkDetl.getMatnr()).eq(Mat::getHostId, hostId)); |
| | | wrkDetl.sync(mat); |
| | | wrkDetl.setOrderNo(orderNo); |
| | | wrkDetl.setModiTime(now); |
| | | wrkDetl.setModiUser(userId); |
| | | wrkDetl.setAppeTime(now); |
| | | wrkDetl.setAppeUser(userId); |
| | | if (!wrkDetlService.save(wrkDetl)) { |
| | | throw new CoolException("添加" + wrkMast.getWrkNo() + "盘点任务," + wrkDetl.getMatnr() + "商品," + wrkDetl.getBatch() + "序列码任务明细失败"); |
| | | } |
| | | } |
| | | |
| | | // 修改盘点任务主档状态 |
| | | wrkMast.setFullPlt(wrkDetlService.count(new LambdaQueryWrapper<WrkDetl>().eq(WrkDetl::getWrkNo, wrkMast.getWrkNo()).eq(WrkDetl::getHostId, hostId)) != 0 ? "Y" : "N"); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setModiUser(String.valueOf(userId)); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("修改盘点任务主档失败"); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | private DocTypeService docTypeService; |
| | | |
| | | @Override |
| | | public List<OrderDetl> selectWorkingDetls(Long orderId) { |
| | | return orderDetlMapper.selectWorkingDetls(orderId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateOrder1(Long orderId,Long userId) { |
| | | this.baseMapper.updateOrder1(orderId, userId); |
| | | } |
| | |
| | | public List<WrkDetl> selectAndLogByOrderNo(String orderNo, Long hostId) { |
| | | return this.baseMapper.selectAndLogByOrderNo(orderNo, hostId); |
| | | } |
| | | |
| | | @Override |
| | | public List<WrkDetl> selectPakoutQuery(Integer staNo, String matnr, Long hostId) { |
| | | return this.baseMapper.selectPakoutQuery(staNo, matnr, hostId); |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateInspect(Integer wrkNo, String matnr, String batch, Long hostId) { |
| | | return this.baseMapper.updateInspect(wrkNo, matnr, batch, hostId) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateAnfme(Double anfme, Integer wrkNo, String matnr, String batch, Long hostId) { |
| | | if (anfme <= 0) { |
| | | return this.baseMapper.deleteItem(wrkNo, matnr, batch, hostId) > 0; |
| | | } else { |
| | | return baseMapper.updateAnfme(anfme, wrkNo, matnr, batch, hostId) > 0; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.common.wms.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.common.wms.mapper.WrkMastMapper; |
| | | import com.zy.asrs.common.wms.entity.WrkMast; |
| | | import com.zy.asrs.common.wms.service.WrkMastService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | return this.baseMapper.selectToBeHistoryData(); |
| | | } |
| | | |
| | | @Override |
| | | public WrkMast selectByBarcode(String barcode, Long hostId) { |
| | | List<WrkMast> wrkMasts = this.list(new LambdaQueryWrapper<WrkMast>().eq(WrkMast::getBarcode, barcode).eq(WrkMast::getHostId, hostId)); |
| | | if (Cools.isEmpty(wrkMasts)) { |
| | | return null; |
| | | } |
| | | return wrkMasts.get(0); |
| | | } |
| | | } |
| | |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="selectWorkingDetls" resultType="com.zy.asrs.common.wms.entity.OrderDetl"> |
| | | select * from wms_order_detl |
| | | where 1=1 |
| | | and order_id = #{orderId} |
| | | and qty < anfme |
| | | </select> |
| | | |
| | | <select id="selectItem" resultType="com.zy.asrs.common.wms.entity.OrderDetl"> |
| | | select * from wms_order_detl |
| | | where 1=1 |
| | |
| | | and (awml.manu_type is null or awml.manu_type != '手动取消') |
| | | </select> |
| | | |
| | | <select id="selectPakoutQuery" resultType="com.zy.asrs.common.wms.entity.WrkDetl"> |
| | | select |
| | | awd.* |
| | | from wms_wrk_detl awd |
| | | left join asr_wrk_mast awm on awd.wrk_no = awm.wrk_no |
| | | where 1=1 |
| | | and awm.wrk_sts = 199 |
| | | and (awd.inspect is null or awd.inspect = 0) |
| | | and awm.sta_no = #{staNo} |
| | | and awd.matnr + '-' + awd.batch = #{matnr} |
| | | </select> |
| | | |
| | | <update id="updateInspect"> |
| | | update wms_wrk_detl |
| | | set inspect = 1 |
| | | where 1=1 |
| | | and wrk_no = #{wrkNo} |
| | | and matnr = #{matnr} |
| | | and host_id = #{hostId} |
| | | <include refid="batchSeq"></include> |
| | | </update> |
| | | |
| | | <delete id="deleteItem"> |
| | | delete from wms_wrk_detl |
| | | where 1=1 |
| | | and wrk_no = #{wrkNo} |
| | | and matnr = #{matnr} |
| | | and host_id = #{hostId} |
| | | <include refid="batchSeq"></include> |
| | | </delete> |
| | | |
| | | <update id="updateAnfme"> |
| | | update wms_wrk_detl |
| | | set anfme = #{anfme} |
| | | , modi_time = getdate() |
| | | where 1=1 |
| | | and wrk_no = #{wrkNo} |
| | | and matnr = #{matnr} |
| | | and host_id = #{hostId} |
| | | <include refid="batchSeq"></include> |
| | | </update> |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.zy.asrs.wms.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.common.domain.dto.WrkDto; |
| | | import com.zy.asrs.common.domain.entity.MobileAdjustResult; |
| | | import com.zy.asrs.common.domain.param.MobileAdjustParam; |
| | | import com.zy.asrs.common.openapi.entity.param.CombParam; |
| | | import com.zy.asrs.common.web.BaseController; |
| | | import com.zy.asrs.common.wms.entity.*; |
| | | import com.zy.asrs.common.wms.service.*; |
| | | import com.zy.asrs.framework.annotations.ManagerAuth; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 移动端接口控制器 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("mobile") |
| | | public class MobileController extends BaseController { |
| | | |
| | | @Autowired |
| | | private MobileService mobileService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | /** |
| | | * 根据单号检索单据数据 |
| | | */ |
| | | @RequestMapping("/order/search/orderNo/auth") |
| | | @ManagerAuth |
| | | public R orderSearchByBarcode(@RequestParam String orderNo){ |
| | | Order order = orderService.selectByNo(orderNo, getHostId()); |
| | | if (order == null) { |
| | | return R.ok(); |
| | | } |
| | | DocType docType = docTypeService.getById(order.getDocType()); |
| | | if (docType.getPakin() == null || docType.getPakin() != 1) { |
| | | return R.ok(); |
| | | } |
| | | if (order.getSettle() > 2) { |
| | | return R.ok(); |
| | | } |
| | | List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId()); |
| | | if (Cools.isEmpty(orderDetls)) { |
| | | return R.ok(); |
| | | } |
| | | return R.ok().add(orderDetls); |
| | | } |
| | | |
| | | @RequestMapping("/comb/auth") |
| | | @ManagerAuth(memo = "组托") |
| | | public R comb(@RequestBody CombParam combParam){ |
| | | mobileService.comb(combParam, getUserId(), getHostId()); |
| | | return R.ok("组托成功"); |
| | | } |
| | | |
| | | @RequestMapping("/pakout/query/auth") |
| | | @ManagerAuth |
| | | @Deprecated |
| | | public R pakoutQuery(@RequestParam(required = false) String barcode, |
| | | @RequestParam(required = false) Integer staNo, |
| | | @RequestParam(required = false) String matnr){ |
| | | if (Cools.isEmpty(barcode) && Cools.isEmpty(matnr)) { |
| | | return R.ok(); |
| | | } |
| | | Long hostId = getHostId(); |
| | | if (!Cools.isEmpty(barcode)) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.list(new LambdaQueryWrapper<WrkDetl>().eq(WrkDetl::getZpallet, barcode).eq(WrkDetl::getHostId, hostId)); |
| | | return R.ok().add(wrkDetls); |
| | | } |
| | | if (!Cools.isEmpty(matnr)) { |
| | | if (!Cools.isEmpty(staNo)) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectPakoutQuery(staNo, matnr, hostId); |
| | | return R.ok().add(wrkDetls); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 出库确认 - 扫托盘码 |
| | | * 1.全板 返回 101 |
| | | * 2.拣料 返回 103 |
| | | */ |
| | | @RequestMapping("/pakout/confirm/barcode/auth") |
| | | @ManagerAuth |
| | | public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode){ |
| | | if (Cools.isEmpty(barcode)) { |
| | | return R.ok(); |
| | | } |
| | | Long hostId = getHostId(); |
| | | WrkMast wrkMast = wrkMastService.selectByBarcode(barcode, hostId); |
| | | if (wrkMast != null) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.list(new LambdaQueryWrapper<WrkDetl>().eq(WrkDetl::getWrkNo, wrkMast.getWrkNo()).eq(WrkDetl::getHostId, hostId)); |
| | | // 去除已出库确认的明细 |
| | | wrkDetls.removeIf(wrkDetl -> wrkDetl.getInspect() != null && wrkDetl.getInspect() != 0); |
| | | return R.ok().add(Cools.add("wrkNo", wrkMast.getWrkNo()).add("ioType", wrkMast.getIoType()).add("list", wrkDetls)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 出库确认 - 拣料出库 - 选择具体条码商品 |
| | | */ |
| | | @RequestMapping("/pakout/confirm/pick/auth") |
| | | @ManagerAuth |
| | | public R pakoutQueryByBarcode(@RequestParam(required = false) Integer wrkNo |
| | | , @RequestParam(required = false) String matnr){ |
| | | if (Cools.isEmpty(wrkNo)) { |
| | | return R.ok(); |
| | | } |
| | | if (Cools.isEmpty(matnr)) { |
| | | return R.ok(); |
| | | } |
| | | Long hostId = getHostId(); |
| | | WrkMast wrkMast = wrkMastService.getOne(new LambdaQueryWrapper<WrkMast>().eq(WrkMast::getWrkNo, wrkNo).eq(WrkMast::getHostId, hostId)); |
| | | if (wrkMast == null) { |
| | | return R.ok(); |
| | | } |
| | | String orderNo = null; |
| | | List<WrkDetl> wrkDetls = wrkDetlService.list(new LambdaQueryWrapper<WrkDetl>().eq(WrkDetl::getWrkNo, wrkMast.getWrkNo()).eq(WrkDetl::getHostId, hostId)); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (Cools.isEmpty(orderNo)) { |
| | | orderNo = wrkDetl.getOrderNo(); |
| | | } |
| | | if ((wrkDetl.getMatnr() + "-" + wrkDetl.getBatch()).equals(matnr)) { |
| | | return R.ok().add(wrkDetl); |
| | | } |
| | | } |
| | | // 替换 明细 |
| | | List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocNo, wrkMast.getSourceLocNo()).eq(LocDetl::getHostId, hostId)); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if ((locDetl.getMatnr() + "-" + locDetl.getBatch()).equals(matnr)) { |
| | | WrkDetl wrkDetl = new WrkDetl(); |
| | | wrkDetl.sync(locDetl); |
| | | wrkDetl.setOrderNo(orderNo); |
| | | wrkDetl.setIoTime(wrkMast.getIoTime()); |
| | | wrkDetl.setWrkNo(wrkNo); |
| | | return R.ok().add(wrkDetl); |
| | | } |
| | | } |
| | | return R.error("系统错误,条码不存在"); |
| | | } |
| | | |
| | | @RequestMapping("/pakout/confirm/auth") |
| | | @ManagerAuth |
| | | @Transactional |
| | | public R pakoutConfirm(@RequestBody List<WrkDetl> list) { |
| | | if (Cools.isEmpty(list)) { |
| | | return R.ok(); |
| | | } |
| | | Long hostId = getHostId(); |
| | | Set<Integer> wrkNos = new HashSet<>(); |
| | | List<WrkDto> dtos = new ArrayList<>(); |
| | | for (WrkDetl wrkDetl : list) { |
| | | if (wrkNos.contains(wrkDetl.getWrkNo())) { |
| | | for (WrkDto dto : dtos) { |
| | | if (dto.getWrkNo().equals(wrkDetl.getWrkNo())) { |
| | | dto.getWrkDetls().add(wrkDetl); |
| | | break; |
| | | } |
| | | } |
| | | } else { |
| | | wrkNos.add(wrkDetl.getWrkNo()); |
| | | dtos.add(new WrkDto(wrkDetl.getWrkNo(), wrkDetl)); |
| | | } |
| | | } |
| | | |
| | | for (WrkDto dto : dtos) { |
| | | WrkMast wrkMast = wrkMastService.getOne(new LambdaQueryWrapper<WrkMast>().eq(WrkMast::getWrkNo, dto.getWrkNo()).eq(WrkMast::getHostId, hostId)); |
| | | if (wrkMast != null) { |
| | | // 101 |
| | | if (wrkMast.getIoType() == 101) { |
| | | for (WrkDetl wrkDetl : dto.getWrkDetls()) { |
| | | wrkDetlService.updateInspect(wrkDetl.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), hostId); |
| | | } |
| | | } |
| | | // 103 |
| | | if (wrkMast.getIoType() == 103) { |
| | | if (!wrkDetlService.remove(new LambdaQueryWrapper<WrkDetl>().eq(WrkDetl::getWrkNo, wrkMast.getWrkNo()).eq(WrkDetl::getHostId, hostId))) { |
| | | throw new CoolException("拣料出库确认失败"); |
| | | } |
| | | for (WrkDetl wrkDetl : dto.getWrkDetls()) { |
| | | wrkDetl.setInspect(1); |
| | | if (!wrkDetlService.save(wrkDetl)) { |
| | | throw new CoolException("拣料出库确认失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (Integer wrkNo : wrkNos) { |
| | | WrkMast wrkMast = wrkMastService.getOne(new LambdaQueryWrapper<WrkMast>().eq(WrkMast::getWrkNo, wrkNo).eq(WrkMast::getHostId, hostId)); |
| | | if (wrkMast.getWrkSts() == 14 && (Cools.isEmpty(wrkMast.getInvWh()) || wrkMast.getInvWh().equals("N"))) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.list(new LambdaQueryWrapper<WrkDetl>().eq(WrkDetl::getWrkNo, wrkNo).eq(WrkDetl::getHostId, hostId)); |
| | | boolean complete = true; |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | if (wrkDetl.getInspect() == null || wrkDetl.getInspect() == 0) { |
| | | complete = false; |
| | | break; |
| | | } |
| | | } |
| | | if (complete) { |
| | | wrkMast.setInvWh("Y"); |
| | | wrkMast.setModiTime(new Date()); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("修改工作档" + wrkNo + "失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return R.ok("完成确认"); |
| | | } |
| | | |
| | | // 盘点 ---------------------------------------------------------------------------------------------------- |
| | | |
| | | @RequestMapping("/checkDetl/auth") |
| | | @ManagerAuth |
| | | public R getCheckDetl(@RequestParam(required = false) Integer staNo) { |
| | | if (null == staNo || staNo == 0) { |
| | | return R.ok(); |
| | | } |
| | | Long hostId = getHostId(); |
| | | BasDevp basDevp = basDevpService.getOne(new LambdaQueryWrapper<BasDevp>().eq(BasDevp::getDevNo, staNo).eq(BasDevp::getHostId, hostId)); |
| | | if (null != basDevp && basDevp.getWrkNo() != null) { |
| | | WrkMast wrkMast = wrkMastService.getOne(new LambdaQueryWrapper<WrkMast>().eq(WrkMast::getWrkNo, basDevp.getWrkNo()).eq(WrkMast::getHostId, hostId)); |
| | | if (wrkMast != null && wrkMast.getIoType() == 107) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.list(new LambdaQueryWrapper<WrkDetl>().eq(WrkDetl::getWrkNo, wrkMast.getWrkNo()).eq(WrkDetl::getHostId, hostId)); |
| | | if (!Cools.isEmpty(wrkDetls)) { |
| | | MobileAdjustResult result = new MobileAdjustResult(); |
| | | result.setStaNo(staNo); |
| | | result.setWrkNo(wrkMast.getWrkNo()); |
| | | result.setWrkDetls(wrkDetls); |
| | | return R.ok().add(result); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping("/adjust/auth") |
| | | @ManagerAuth(memo = "盘点") |
| | | public R adjust(@RequestBody MobileAdjustParam combParam){ |
| | | mobileService.adjust(combParam, getUserId(), getHostId()); |
| | | return R.ok("盘点成功"); |
| | | } |
| | | |
| | | } |