|
@@ -20,13 +20,12 @@ import com.zkqy.business.service.IProductInvoiceService;
|
|
|
|
|
|
/**
|
|
|
* 产品发货单Service业务层处理
|
|
|
- *
|
|
|
+ *
|
|
|
* @author zkqy
|
|
|
* @date 2024-04-11
|
|
|
*/
|
|
|
@Service
|
|
|
-public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
-{
|
|
|
+public class ProductInvoiceServiceImpl implements IProductInvoiceService {
|
|
|
@Autowired
|
|
|
private ProductInvoiceMapper productInvoiceMapper;
|
|
|
|
|
@@ -47,37 +46,34 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
|
|
|
/**
|
|
|
* 查询产品发货单
|
|
|
- *
|
|
|
+ *
|
|
|
* @param id 产品发货单主键
|
|
|
* @return 产品发货单
|
|
|
*/
|
|
|
@Override
|
|
|
- public ProductInvoice selectProductInvoiceById(Long id)
|
|
|
- {
|
|
|
+ public ProductInvoice selectProductInvoiceById(Long id) {
|
|
|
return productInvoiceMapper.selectProductInvoiceById(id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询产品发货单列表
|
|
|
- *
|
|
|
+ *
|
|
|
* @param productInvoice 产品发货单
|
|
|
* @return 产品发货单
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<ProductInvoice> selectProductInvoiceList(ProductInvoice productInvoice)
|
|
|
- {
|
|
|
+ public List<ProductInvoice> selectProductInvoiceList(ProductInvoice productInvoice) {
|
|
|
return productInvoiceMapper.selectProductInvoiceList(productInvoice);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 新增产品发货单
|
|
|
- *
|
|
|
+ *
|
|
|
* @param productInvoice 产品发货单
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int insertProductInvoice(ProductInvoice productInvoice)
|
|
|
- {
|
|
|
+ public int insertProductInvoice(ProductInvoice productInvoice) {
|
|
|
productInvoice.setCreateTime(DateUtils.getNowDate());
|
|
|
productInvoice.setCreateBy(SecurityUtils.getUsername());
|
|
|
productInvoice.setCreateById(SecurityUtils.getUserId());
|
|
@@ -86,13 +82,12 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
|
|
|
/**
|
|
|
* 修改产品发货单
|
|
|
- *
|
|
|
+ *
|
|
|
* @param productInvoice 产品发货单
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int updateProductInvoice(ProductInvoice productInvoice)
|
|
|
- {
|
|
|
+ public int updateProductInvoice(ProductInvoice productInvoice) {
|
|
|
productInvoice.setUpdateTime(DateUtils.getNowDate());
|
|
|
productInvoice.setUpdateById(SecurityUtils.getUserId());
|
|
|
productInvoice.setUpdateBy(SecurityUtils.getUsername());
|
|
@@ -101,25 +96,24 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
|
|
|
/**
|
|
|
* 批量删除产品发货单
|
|
|
- *
|
|
|
+ *
|
|
|
* @param ids 需要删除的产品发货单主键
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deleteProductInvoiceByIds(Long[] ids)
|
|
|
+ public int deleteProductInvoiceByIds(List<Long> ids)
|
|
|
{
|
|
|
return productInvoiceMapper.deleteProductInvoiceByIds(ids);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除产品发货单信息
|
|
|
- *
|
|
|
+ *
|
|
|
* @param id 产品发货单主键
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deleteProductInvoiceById(Long id)
|
|
|
- {
|
|
|
+ public int deleteProductInvoiceById(Long id) {
|
|
|
return productInvoiceMapper.deleteProductInvoiceById(id);
|
|
|
}
|
|
|
|
|
@@ -129,66 +123,66 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
ProductInvoiceVO vo = new ProductInvoiceVO();
|
|
|
// 顶部数据回显
|
|
|
ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceBySaleOrderNo(saleOrderNo);
|
|
|
- if(productInvoice != null){
|
|
|
+ if (productInvoice != null) {
|
|
|
BeanUtils.copyProperties(productInvoice, vo);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
SaleOrder saleOrder = saleOrderMapper.selectSaleOrderBySaleNo(saleOrderNo);
|
|
|
vo.setCustomerNo(saleOrder.getSaleCustomNo());
|
|
|
}
|
|
|
|
|
|
- //表格数据
|
|
|
-
|
|
|
- //查询所有订单货品信息
|
|
|
- List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
|
|
|
+ //表格数据
|
|
|
|
|
|
- if(productInvoice != null){
|
|
|
- //根据通知单号查询货品信息
|
|
|
- List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList1 = saleProductsMapper.selectSaleProductsInfo2(productInvoice.getNoticeNumber());
|
|
|
+ //查询所有订单货品信息
|
|
|
+ List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList = saleProductsMapper.selectSaleProductsInfo1(saleOrderNo);
|
|
|
|
|
|
- List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
|
|
|
- saleProductInfoList2.addAll(saleProductInfoList);
|
|
|
+ if (productInvoice != null) {
|
|
|
+ //根据通知单号查询货品信息
|
|
|
+ List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList1 = saleProductsMapper.selectSaleProductsInfo2(productInvoice.getNoticeNumber());
|
|
|
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2){
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1){
|
|
|
- if(saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())){
|
|
|
- saleProductInfoList.remove(saleProductInfo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if(saleProductInfoList.size() > 0){
|
|
|
- saleProductInfoList.forEach(saleProductInfo -> {
|
|
|
- saleProductInfo.setBoxNum(0);
|
|
|
- saleProductInfo.setWeight(0.0);
|
|
|
- });
|
|
|
- saleProductInfoList1.addAll(saleProductInfoList);
|
|
|
- }
|
|
|
+ List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
|
|
|
+ saleProductInfoList2.addAll(saleProductInfoList);
|
|
|
|
|
|
- vo.setSaleProductInfoList(saleProductInfoList1);
|
|
|
- if(saleProductInfoList1.size() > 0){
|
|
|
- ProductInventory productInventory1 = new ProductInventory();
|
|
|
- productInventory1.setProductId(saleProductInfoList1.get(0).getProductId());
|
|
|
- productInventory1.setLotNum(saleProductInfoList1.get(0).getLotNum());
|
|
|
- ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
|
|
|
- if(productInventory != null){
|
|
|
- vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
|
|
|
- vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
|
|
|
- }else {
|
|
|
- vo.setInventoryBoxNum(0);
|
|
|
- vo.setInventoryWeight(0.0);
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2) {
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1) {
|
|
|
+ if (saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())) {
|
|
|
+ saleProductInfoList.remove(saleProductInfo);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- }else {
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList){
|
|
|
+ }
|
|
|
+ if (saleProductInfoList.size() > 0) {
|
|
|
+ saleProductInfoList.forEach(saleProductInfo -> {
|
|
|
saleProductInfo.setBoxNum(0);
|
|
|
saleProductInfo.setWeight(0.0);
|
|
|
+ });
|
|
|
+ saleProductInfoList1.addAll(saleProductInfoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ vo.setSaleProductInfoList(saleProductInfoList1);
|
|
|
+ if (saleProductInfoList1.size() > 0) {
|
|
|
+ ProductInventory productInventory1 = new ProductInventory();
|
|
|
+ productInventory1.setProductId(saleProductInfoList1.get(0).getProductId());
|
|
|
+ productInventory1.setLotNum(saleProductInfoList1.get(0).getLotNum());
|
|
|
+ ProductInventory productInventory = productInventoryMapper.selectProductInventoryByLotNumAndProductId(productInventory1);
|
|
|
+ if (productInventory != null) {
|
|
|
+ vo.setInventoryBoxNum(productInventory.getTotalBoxNum());
|
|
|
+ vo.setInventoryWeight(handlingWeight(productInventory.getTotalSuttle()));
|
|
|
+ } else {
|
|
|
+ vo.setInventoryBoxNum(0);
|
|
|
+ vo.setInventoryWeight(0.0);
|
|
|
}
|
|
|
- vo.setInventoryBoxNum(0);
|
|
|
- vo.setInventoryWeight(0.0);
|
|
|
- vo.setSaleProductInfoList(saleProductInfoList);
|
|
|
}
|
|
|
- //客户编号
|
|
|
- vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
|
|
|
+
|
|
|
+ } else {
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList) {
|
|
|
+ saleProductInfo.setBoxNum(0);
|
|
|
+ saleProductInfo.setWeight(0.0);
|
|
|
+ }
|
|
|
+ vo.setInventoryBoxNum(0);
|
|
|
+ vo.setInventoryWeight(0.0);
|
|
|
+ vo.setSaleProductInfoList(saleProductInfoList);
|
|
|
+ }
|
|
|
+ //客户编号
|
|
|
+ vo.setCustomerId(saleOrderMapper.selectCustomerIdBySaleNo(saleOrderNo));
|
|
|
|
|
|
return vo;
|
|
|
}
|
|
@@ -212,14 +206,14 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
List<ProductInvoiceVO.SaleProductInfo> saleProductInfoList2 = new ArrayList<>();
|
|
|
saleProductInfoList2.addAll(saleProductInfoList);
|
|
|
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2){
|
|
|
- for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1){
|
|
|
- if(saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())){
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo : saleProductInfoList2) {
|
|
|
+ for (ProductInvoiceVO.SaleProductInfo saleProductInfo1 : saleProductInfoList1) {
|
|
|
+ if (saleProductInfo1.getProductId().equals(saleProductInfo.getProductId()) && saleProductInfo1.getProductColor().equals(saleProductInfo.getProductColor())) {
|
|
|
saleProductInfoList.remove(saleProductInfo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(saleProductInfoList.size() > 0){
|
|
|
+ if (saleProductInfoList.size() > 0) {
|
|
|
saleProductInfoList.forEach(saleProductInfo -> {
|
|
|
saleProductInfo.setBoxNum(0);
|
|
|
saleProductInfo.setWeight(0.0);
|
|
@@ -233,7 +227,7 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
vo.setSaleProductInfoList(saleProductInfoList1);
|
|
|
return vo;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public ProductInvoice selectProductInvoiceBySaleOrderNo(String saleOrderNo) {
|
|
@@ -245,7 +239,7 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
ProductInvoiceVO vo = new ProductInvoiceVO();
|
|
|
// 查询发货通知单详情
|
|
|
ProductInvoice productInvoice = productInvoiceMapper.selectProductInvoiceById(id);
|
|
|
- BeanUtils.copyProperties(productInvoice,vo);
|
|
|
+ BeanUtils.copyProperties(productInvoice, vo);
|
|
|
//查询发货货品详情
|
|
|
List<ProductCodeListVO> productCodeListVOS = productOutboundRecordMapper.selectOutboundProduct(productInvoice.getNoticeNumber());
|
|
|
vo.setProductCodeListVOList(productCodeListVOS);
|
|
@@ -253,17 +247,17 @@ public class ProductInvoiceServiceImpl implements IProductInvoiceService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String, Object>> financialStatementList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo) {
|
|
|
+ public List<Map<String, Object>> financialStatementList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo) {
|
|
|
return productInvoiceMapper.financialStatementList(productInvoiceFinancialExportVo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<ProductInvoiceFinancialExportVo> financialStatementExportList(ProductInvoiceFinancialExportVo productInvoiceFinancialExportVo) {
|
|
|
- return null;
|
|
|
+ return productInvoiceMapper.financialStatementExportList(productInvoiceFinancialExportVo);
|
|
|
}
|
|
|
|
|
|
//保留两位小数
|
|
|
- public Double handlingWeight(Double weight){
|
|
|
+ public Double handlingWeight(Double weight) {
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
return Double.parseDouble(df.format(weight));
|
|
|
}
|