mirror of https://github.com/elunez/eladmin
发货单
parent
e66523c346
commit
a0106efcb4
|
@ -22,7 +22,7 @@ import java.time.format.DateTimeFormatter;
|
|||
* @author jie
|
||||
* @date 2019-08-27
|
||||
*/
|
||||
@Api(tags = "SInvoice管理")
|
||||
@Api(tags = "发货单管理")
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class InvoiceController {
|
||||
|
@ -32,18 +32,18 @@ public class InvoiceController {
|
|||
|
||||
@Log("分页查询销售发货单")
|
||||
@ApiOperation(value = "分页查询销售发货单")
|
||||
@GetMapping(value = "/querySaleInvoicePage")
|
||||
@GetMapping(value = "/queryInvoicePage")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','SINVOICE_ALL','SINVOICE_SELECT')")
|
||||
public ResponseEntity querySaleInvoicePage(InvoiceQueryCriteria criteria, Pageable pageable){
|
||||
public ResponseEntity queryInvoicePage(InvoiceQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity(invoiceService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@Log("查询销售发货单列表")
|
||||
@ApiOperation(value = "查询销售发货单列表")
|
||||
@GetMapping(value = "/querySaleInvoiceList")
|
||||
@GetMapping(value = "/queryInvoiceList")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','SINVOICE_ALL','SINVOICE_SELECT')")
|
||||
public ResponseEntity querySaleInvoiceList(InvoiceQueryCriteria criteria){
|
||||
public ResponseEntity queryInvoiceList(InvoiceQueryCriteria criteria){
|
||||
return new ResponseEntity(invoiceService.queryAll(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
@ -80,4 +80,10 @@ public class InvoiceController {
|
|||
String supplierCode = "INVOICE"+ LocalDateTime.now().format(fmt);
|
||||
return new ResponseEntity(supplierCode,HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("查看发货单详情")
|
||||
@GetMapping(value = "/invoice/{id}")
|
||||
public ResponseEntity getInvoiceInfo(@PathVariable Long id){
|
||||
return new ResponseEntity(invoiceService.findById(id), HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,9 @@ package me.zhengjie.modules.wms.invoice.service.impl;
|
|||
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.wms.bd.domain.CustomerInfo;
|
||||
import me.zhengjie.modules.wms.bd.domain.ProductInfo;
|
||||
import me.zhengjie.modules.wms.bd.repository.CustomerInfoRepository;
|
||||
import me.zhengjie.modules.wms.bd.repository.ProductInfoRepository;
|
||||
import me.zhengjie.modules.wms.customerOrder.domain.CustomerOrder;
|
||||
import me.zhengjie.modules.wms.customerOrder.domain.CustomerOrderProduct;
|
||||
import me.zhengjie.modules.wms.customerOrder.service.dto.CustomerOrderProductDTO;
|
||||
|
@ -63,6 +65,9 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||
@Autowired
|
||||
private InvoiceProductRepository invoiceProductRepository;
|
||||
|
||||
@Autowired
|
||||
private ProductInfoRepository productInfoRepository;
|
||||
|
||||
@Override
|
||||
public Object queryAll(InvoiceQueryCriteria criteria, Pageable pageable){
|
||||
Page<Invoice> page = invoiceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
|
@ -136,6 +141,15 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||
|
||||
for(InvoiceProduct invoiceProduct : invoiceProductRequestList){
|
||||
invoiceProduct.setInvoiceId(invoice.getId());
|
||||
String productCode = invoiceProduct.getProductCode();
|
||||
if(StringUtils.isEmpty(productCode)){
|
||||
throw new BadRequestException("产品编号不能为空!");
|
||||
}
|
||||
ProductInfo productInfo = productInfoRepository.findByProductCode(productCode);
|
||||
if(null == productInfo){
|
||||
throw new BadRequestException("产品编号" + productInfo.getProductCode() + "对应的产品不存在!");
|
||||
}
|
||||
invoiceProduct.setProductId(productInfo.getId());
|
||||
invoiceProductRepository.save(invoiceProduct);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package me.zhengjie.modules.wms.sr.productCount.service.impl;
|
||||
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.modules.wms.bd.domain.ProductInfo;
|
||||
import me.zhengjie.modules.wms.bd.repository.ProductInfoRepository;
|
||||
import me.zhengjie.modules.wms.bd.service.mapper.ProductInfoMapper;
|
||||
import me.zhengjie.modules.wms.sr.productCount.domain.ProductCount;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.modules.wms.sr.productCount.repository.ProductCountRepository;
|
||||
|
@ -31,6 +35,12 @@ public class ProductCountServiceImpl implements ProductCountService {
|
|||
@Autowired
|
||||
private ProductCountMapper productCountMapper;
|
||||
|
||||
@Autowired
|
||||
private ProductInfoMapper productInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private ProductInfoRepository productInfoRepository;
|
||||
|
||||
@Override
|
||||
public Object queryAll(ProductCountQueryCriteria criteria, Pageable pageable){
|
||||
Page<ProductCount> page = productCountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
|
@ -52,6 +62,19 @@ public class ProductCountServiceImpl implements ProductCountService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ProductCountDTO create(ProductCount resources) {
|
||||
Long productId = resources.getProductId();
|
||||
if(null == productId){
|
||||
throw new BadRequestException("产品主键不能为空!");
|
||||
}
|
||||
Optional<ProductInfo> productInfoOptional = productInfoRepository.findById(productId);
|
||||
if(null == productInfoOptional){
|
||||
throw new BadRequestException("产品不存在 !");
|
||||
}
|
||||
ProductInfo productInfo = productInfoOptional.get();
|
||||
if(null == productInfo){
|
||||
throw new BadRequestException("产品不存在 !");
|
||||
}
|
||||
resources.setProductName(productInfo.getName());
|
||||
return productCountMapper.toDto(productCountRepository.save(resources));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue