| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import zy.cloud.wms.common.config.CodeCoolException; |
| | | import zy.cloud.wms.common.model.BillDto; |
| | | import zy.cloud.wms.common.model.MatnrDto; |
| | | import zy.cloud.wms.common.model.OrderStoDto; |
| | | import zy.cloud.wms.common.service.MainService; |
| | | import zy.cloud.wms.common.service.asrs.AsrsService; |
| | |
| | | private ErpService erpService; |
| | | @Autowired |
| | | private CheckService checkService; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R stockPakin(PakinParam param, Long userId) { |
| | | Node node = nodeService.selectByUuid(param.getNodeId()); |
| | | if (node == null) { |
| | | return R.error("货位不存在"); |
| | | } |
| | | if (Cools.isEmpty(param.getMats())) { |
| | | return R.error("入库物料不能为空"); |
| | | } |
| | | Date now = new Date(); |
| | | for (MatnrDto dto : param.getMats()) { |
| | | Mat mat = matService.selectByMatnr(dto.getMatnr()); |
| | | if (mat == null) { |
| | | throw new CoolException("物料数据错误,请联系管理员"); |
| | | } |
| | | LocDetl locDetl = locDetlService.getLocDetl(node.getId(), dto.getMatnr()); |
| | | if (locDetl == null) { |
| | | // 更新货位库存明细 |
| | | locDetl = new LocDetl(); |
| | | locDetl.setLocNo(node.getName()); |
| | | locDetl.setNodeId(node.getId()); |
| | | locDetl.setZpallet(""); |
| | | locDetl.setAnfme(dto.getCount()); |
| | | VersionUtils.setLocDetl(locDetl, mat); |
| | | // locDetl.setDocId(param.getDocType().longValue()); |
| | | // locDetl.setDocNum(docNum); |
| | | locDetl.setStatus(1); |
| | | locDetl.setCreateBy(userId); |
| | | locDetl.setCreateTime(now); |
| | | locDetl.setUpdateBy(userId); |
| | | locDetl.setUpdateTime(now); |
| | | boolean insert = locDetlService.insert(locDetl); |
| | | if (!insert) { |
| | | throw new CoolException("新增库存明细档失败"); |
| | | } |
| | | } else { |
| | | if (!locDetlService.incrementStock(node.getId(), dto.getMatnr(), dto.getCount())) { |
| | | throw new CoolException("新增库存明细档失败"); |
| | | } |
| | | } |
| | | } |
| | | return R.ok("入库成功"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | dto.getCount(), // 商品数量 |
| | | dto.getCount(), // 总数量 |
| | | Cools.isEmpty(mat.getName())?0.0D:Double.parseDouble(mat.getName()), // 商品单价 |
| | | null, // 商品明细行号 |
| | | null, // 商品备注[空] |
| | | 1, // 状态 |
| | | now, // 添加时间 |