| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.ManLocDetl; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.LocDetlAdjustParam; |
| | | import com.zy.asrs.entity.result.StockVo; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.ManLocDetlService; |
| | | import com.zy.asrs.service.MatService; |
| | | import com.zy.asrs.service.NodeService; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | @Service("manLocDetlService") |
| | | public class ManLocDetlServiceImpl extends ServiceImpl<ManLocDetlMapper, ManLocDetl> implements ManLocDetlService{ |
| | | |
| | | |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private NodeService nodeService; |
| | | |
| | | @Override |
| | | public Page<ManLocDetl> getPage(Page<ManLocDetl> page) { |
| | |
| | | |
| | | /** |
| | | * 获取库存总数 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | |
| | | return manLocDetlPage; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void adjustLocDetl(LocDetlAdjustParam param, Long userId) { |
| | | Date now = new Date(); |
| | | this.baseMapper.delete(new EntityWrapper<ManLocDetl>() |
| | | .eq("loc_no", param.getLocNo())); |
| | | for (LocDetlAdjustParam.LocDetlAdjust locDetlAdjust : param.getList()) { |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>() |
| | | .eq("matnr", locDetlAdjust.getMatnr())); |
| | | if (mat == null) { |
| | | throw new CoolException("无法找到需要调整的物料,请联系管理员"); |
| | | } |
| | | Node node = nodeService.selectOne(new EntityWrapper<Node>() |
| | | .eq("uuid", param.getLocNo())); |
| | | if (node == null) { |
| | | throw new CoolException("无法找到需要调整的库位,请联系管理员"); |
| | | |
| | | } |
| | | ManLocDetl manLocDetl = new ManLocDetl(); |
| | | manLocDetl.setLocNo(param.getLocNo()); |
| | | manLocDetl.setNodeId(node.getId()); |
| | | manLocDetl.setZpallet(mat.getBarcode()); |
| | | manLocDetl.setAnfme(locDetlAdjust.getCount()); |
| | | manLocDetl.setMatnr(mat.getMatnr()); |
| | | manLocDetl.setMaktx(mat.getMaktx()); |
| | | manLocDetl.setName(mat.getName()); |
| | | manLocDetl.setSpecs(mat.getSpecs()); |
| | | manLocDetl.setModel(mat.getModel()); |
| | | manLocDetl.setBatch(locDetlAdjust.getBatch()); |
| | | manLocDetl.setUnit(mat.getUnit()); |
| | | manLocDetl.setBarcode(mat.getBarcode()); |
| | | manLocDetl.setPrice(mat.getPrice()); |
| | | SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme()); |
| | | this.baseMapper.insert(manLocDetl); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Page<ManLocDetl> selectAllPage(Page<ManLocDetl> param) { |
| | | Map<String, Object> condition = param.getCondition(); |
| | | List<ManLocDetl> manLocDetls = baseMapper.selectAllPage(condition); |
| | | param.setRecords(manLocDetls); |
| | | param.setTotal(baseMapper.selectAllPageSize(condition)); |
| | | return param; |
| | | } |
| | | |
| | | |
| | | } |