| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | 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.erp.ErpService; |
| | | import zy.cloud.wms.common.utils.VersionUtils; |
| | | import zy.cloud.wms.manager.entity.*; |
| | | import zy.cloud.wms.manager.entity.param.*; |
| | |
| | | private ItemService itemService; |
| | | @Autowired |
| | | private CstmrService cstmrService; |
| | | @Autowired |
| | | private ErpService erpService; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | throw new CoolException("新增库存明细档失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 上报给erp |
| | | List<BillDto> dtos = new ArrayList<>(); |
| | | for (MatnrDto dto : param.getMats()) { |
| | | BillDto billDto = new BillDto(); |
| | | billDto.setMatnr(dto.getMatnr()); |
| | | billDto.setQty(dto.getCount()); |
| | | dtos.add(billDto); |
| | | } |
| | | Integer docId = Optional.ofNullable(param.getDocType()).orElse(34); |
| | | String docNum = String.valueOf(snowflakeIdWorker.nextId()); |
| | | switch (docId) { |
| | | case 34: // 采购单 |
| | | docNum = "PU-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15); |
| | | break; |
| | | case 45: // 销售退货单 |
| | | docNum = "SR-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | if (!erpService.uploadBill(dtos, docId, docNum)) { |
| | | throw new CoolException("无法上报至erp"); |
| | | } |
| | | |
| | | return R.ok("入库成功"); |
| | |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | // 上报给erp |
| | | List<BillDto> dtos = new ArrayList<>(); |
| | | for (Comb comb : combs) { |
| | | BillDto billDto = new BillDto(); |
| | | billDto.setMatnr(comb.getMatnr()); |
| | | billDto.setQty(comb.getAnfme()); |
| | | dtos.add(billDto); |
| | | } |
| | | if (!erpService.uploadBill(dtos, param.getDocType(), docNum)) { |
| | | throw new CoolException("无法上报至erp"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | if (!checkService.updateById(check)) { |
| | | throw new CoolException("修改盘点记录状态失败"); |
| | | } |
| | | |
| | | // 上报给erp |
| | | List<BillDto> dtos = new ArrayList<>(); |
| | | BillDto billDto = new BillDto(); |
| | | billDto.setMatnr(check.getMatnr()); |
| | | billDto.setQty(Math.abs(check.getDiffQty())); |
| | | dtos.add(billDto); |
| | | if (!erpService.uploadBill(dtos, docId.intValue(), docNum)) { |
| | | throw new CoolException("无法上报至erp"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |