|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.LocDetlAdjustParam; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.service.MatService; | 
|---|
|  |  |  | import com.zy.asrs.service.NodeService; | 
|---|
|  |  |  | import com.zy.asrs.utils.SaasUtils; | 
|---|
|  |  |  | import com.zy.system.entity.User; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<ManLocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos) { | 
|---|
|  |  |  | return this.baseMapper.queryStock(matnr, batch, orderNo, locNos); | 
|---|
|  |  |  | public List<ManLocDetl> queryStock(String matnr,String batch) { | 
|---|
|  |  |  | return this.baseMapper.queryStock(matnr,batch); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void adjustLocDetl(LocDetlAdjustParam param, Long userId) { | 
|---|
|  |  |  | public void adjustLocDetl(LocDetlAdjustParam param, Long userId, User user) { | 
|---|
|  |  |  | Date now = new Date(); | 
|---|
|  |  |  | this.baseMapper.delete(new EntityWrapper<ManLocDetl>() | 
|---|
|  |  |  | .eq("loc_no", param.getLocNo())); | 
|---|
|  |  |  | for (LocDetlAdjustParam.LocDetlAdjust locDetlAdjust : param.getList()) { | 
|---|
|  |  |  | ManLocDetl manLocDetl = this.baseMapper.selectItem(param.getLocNo(), locDetlAdjust.getMatnr(), locDetlAdjust.getBatch()); | 
|---|
|  |  |  | this.baseMapper.delete(new EntityWrapper<ManLocDetl>() | 
|---|
|  |  |  | .eq("loc_no", param.getLocNo()).eq("matnr",locDetlAdjust.getMatnr())); | 
|---|
|  |  |  | Mat mat = matService.selectOne(new EntityWrapper<Mat>() | 
|---|
|  |  |  | .eq("matnr", locDetlAdjust.getMatnr())); | 
|---|
|  |  |  | if (mat == 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()); | 
|---|
|  |  |  | manLocDetl.setUpdateBy(userId); | 
|---|
|  |  |  | manLocDetl.setModiTime(now); | 
|---|
|  |  |  | SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme(),user.getUsername(), | 
|---|
|  |  |  | null,null,null,null, null,null); | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public ManLocDetl selectInventory(String LocNo, String Matnr, String batch) { | 
|---|
|  |  |  | return baseMapper.selectInventory(LocNo,Matnr,batch); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public int deleteDatailed(String locNo, String matnr, String batch) { | 
|---|
|  |  |  | return baseMapper.deleteDatailed(locNo,matnr,batch); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public int increase(Double anfme,String locNo, String matnr, String batch,Double weight) { | 
|---|
|  |  |  | return baseMapper.increase(anfme,locNo,matnr,batch,weight); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<LocDetlWarningDTO> selectAllWarning() { | 
|---|
|  |  |  | return baseMapper.selectAllWarning(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<LocDetl> selectByLocNo(String locNo) { | 
|---|
|  |  |  | return this.baseMapper.selectByLocNo(locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public int updateStockFreeze(String matnr, String locNo, Integer stockFreeze) { | 
|---|
|  |  |  | return this.baseMapper.updateStockFreeze(matnr, locNo, stockFreeze); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|