diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesComplaintNotice.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesComplaintNotice.java index 219883f8..3c8e4b41 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesComplaintNotice.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesComplaintNotice.java @@ -51,11 +51,11 @@ public class AftersalesComplaintNotice extends BaseEntity /** 物料合计 */ @Excel(name = "物料合计") - private String materialSum; + private Integer materialSum; /** 数量合计 */ @Excel(name = "数量合计") - private String enterpriseSum; + private Integer enterpriseSum; /** 交货数量 */ private String deliveryGoodsNum; @@ -146,25 +146,25 @@ public class AftersalesComplaintNotice extends BaseEntity this.materialName = materialName; } - public String getMaterialName() + public String getMaterialName() { return materialName; } - public void setMaterialSum(String materialSum) + public void setMaterialSum(Integer materialSum) { this.materialSum = materialSum; } - public String getMaterialSum() + public Integer getMaterialSum() { return materialSum; } - public void setEnterpriseSum(String enterpriseSum) + public void setEnterpriseSum(Integer enterpriseSum) { this.enterpriseSum = enterpriseSum; } - public String getEnterpriseSum() + public Integer getEnterpriseSum() { return enterpriseSum; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesComplaintNoticeDetail.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesComplaintNoticeDetail.java index 14591d71..4383aa60 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesComplaintNoticeDetail.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/domain/AftersalesComplaintNoticeDetail.java @@ -102,14 +102,14 @@ public class AftersalesComplaintNoticeDetail extends BaseEntity /** 已出库数量 */ @Excel(name = "交货数量",sort = 8) - private String shippedGoodsSum; + private Integer shippedGoodsSum; /** 物料数合计 */ - private String materialSum; + private Integer materialSum; /** 数量合计 */ @Excel(name = "客诉数量",sort = 9) - private String enterpriseSum; + private Integer enterpriseSum; /** 备注 */ @Excel(name = "备注", sort = 14) @@ -324,30 +324,30 @@ public class AftersalesComplaintNoticeDetail extends BaseEntity { return materialProcessMethod; } - public void setShippedGoodsSum(String shippedGoodsSum) + public void setShippedGoodsSum(Integer shippedGoodsSum) { this.shippedGoodsSum = shippedGoodsSum; } - public String getShippedGoodsSum() + public Integer getShippedGoodsSum() { return shippedGoodsSum; } - public void setMaterialSum(String materialSum) + public void setMaterialSum(Integer materialSum) { this.materialSum = materialSum; } - public String getMaterialSum() + public Integer getMaterialSum() { return materialSum; } - public void setEnterpriseSum(String enterpriseSum) + public void setEnterpriseSum(Integer enterpriseSum) { this.enterpriseSum = enterpriseSum; } - public String getEnterpriseSum() + public Integer getEnterpriseSum() { return enterpriseSum; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java index ed533449..253806fa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/mapper/AfterSalesShippingDeviceMapper.java @@ -119,5 +119,5 @@ public interface AfterSalesShippingDeviceMapper /* * 根据sn号查询出货设备信息列表 * */ - List selectShippingDeviceListBySnCodeAndMaterialNo(String[] snCode,String materialNo); + List selectShippingDeviceListBySnCodeAndMaterialNo(String[] snCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAfterSalesShippingDeviceService.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAfterSalesShippingDeviceService.java index 2f58f853..f1abeedb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAfterSalesShippingDeviceService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/IAfterSalesShippingDeviceService.java @@ -111,5 +111,5 @@ public interface IAfterSalesShippingDeviceService /* * 根据sn号查询出货设备信息列表 * */ - List selectShippingDeviceListBySnCode(String[] snCode,String materialNo); + List selectShippingDeviceListBySnCode(String[] snCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AfterSalesShippingDeviceServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AfterSalesShippingDeviceServiceImpl.java index 816e0bb6..cdf63a43 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AfterSalesShippingDeviceServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AfterSalesShippingDeviceServiceImpl.java @@ -251,7 +251,7 @@ public class AfterSalesShippingDeviceServiceImpl implements IAfterSalesShippingD } @Override - public List selectShippingDeviceListBySnCode(String[] snCode,String materialNo) { - return afterSalesShippingDeviceMapper.selectShippingDeviceListBySnCodeAndMaterialNo(snCode,materialNo); + public List selectShippingDeviceListBySnCode(String[] snCode) { + return afterSalesShippingDeviceMapper.selectShippingDeviceListBySnCodeAndMaterialNo(snCode); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeDetailServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeDetailServiceImpl.java index 9b215048..00de6a31 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeDetailServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeDetailServiceImpl.java @@ -5,14 +5,21 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Optional; +import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; import com.ruoyi.aftersales.domain.AftersalesComplaintNotice; import com.ruoyi.aftersales.domain.vo.AftersalesMaterialVO; import com.ruoyi.aftersales.mapper.AftersalesComplaintNoticeMapper; +import com.ruoyi.aftersales.service.IAfterSalesShippingDeviceService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysMakeorderBom; +import com.ruoyi.warehouse.domain.WarehouseOutOrder; +import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; +import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; +import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -38,6 +45,12 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo @Autowired private AftersalesComplaintNoticeMapper complaintNoticeMapper; + @Autowired + private IAfterSalesShippingDeviceService afterSalesShippingDeviceService; + + @Autowired + private WarehouseOutOrderMapper warehouseOutOrderMapper; + /** * 查询售后客诉通知单详情 * @@ -61,10 +74,41 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo { return aftersalesComplaintNoticeDetailMapper.selectAftersalesComplaintNoticeDetailList(aftersalesComplaintNoticeDetail); } - - @Override + /** + * 导出售后客诉通知单详情列表 + */ + @Override public List selectDetailListByNoticeCodes(String[] complaintNoticeCodes) { - return aftersalesComplaintNoticeDetailMapper.selectDetailListByNoticeCodes(complaintNoticeCodes); + List complaintNoticeDetailList = aftersalesComplaintNoticeDetailMapper.selectDetailListByNoticeCodes(complaintNoticeCodes); + List exportDetailList = new ArrayList<>(); + for (AftersalesComplaintNoticeDetail noticeDetail:complaintNoticeDetailList) { + String snCodes = noticeDetail.getSnCode(); + String[] snCodeArray = snCodes.split(","); + List salesShippingDeviceList = afterSalesShippingDeviceService.selectShippingDeviceListBySnCode(snCodeArray); + for (String snCode:snCodeArray) { + AftersalesComplaintNoticeDetail exportDetail = new AftersalesComplaintNoticeDetail(); + Optional matchingDevice = salesShippingDeviceList.stream() + .filter(detail -> detail.getSnCode().equals(snCode)) + .findFirst(); + matchingDevice.ifPresent(detail -> { + exportDetail.setCustomerId(noticeDetail.getCustomerId()); + exportDetail.setCustomerName(noticeDetail.getCustomerName()); + exportDetail.setDeviceModelCode(detail.getDeviceModelCode()); + exportDetail.setDeviceModelName(detail.getMaterialName()); + exportDetail.setMakeNo(detail.getSalesOrderCode()); + exportDetail.setDeviceRunningNumber(detail.getDeviceRunningNumber()); + exportDetail.setShippedGoodsSum(noticeDetail.getShippedGoodsSum()); + exportDetail.setEnterpriseSum(1); + exportDetail.setComplaintProblem(noticeDetail.getComplaintProblem()); + exportDetail.setAdverseReportUrl(noticeDetail.getAdverseReportUrl()); + exportDetail.setEmergencyDegree(noticeDetail.getEmergencyDegree()); + exportDetail.setClosingProcedures(noticeDetail.getClosingProcedures()); + exportDetail.setRemark(noticeDetail.getRemark()); + }); + exportDetailList.add(exportDetail); + } + } + return exportDetailList; } /** @@ -95,35 +139,43 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo String loginName = ShiroUtils.getLoginName(); complaintNoticeDetail.setCreateBy(loginName); complaintNoticeDetail.setCreateTime(DateUtils.getNowDate()); - + String makeNo = complaintNoticeDetail.getMakeNo(); //保存信息到AftersalesComplaintNotice数据表中 complaintNotice.setComplaintNoticeCode(newCode); complaintNotice.setCreateBy(loginName); - complaintNotice.setCreateTime(new Date()); + complaintNotice.setCreateTime(DateUtils.getNowDate()); complaintNotice.setMakeNo(complaintNoticeDetail.getMakeNo()); complaintNotice.setCustomerId(complaintNoticeDetail.getCustomerId()); complaintNotice.setCustomerName(complaintNoticeDetail.getCustomerName()); + complaintNotice.setClosingProcedures("1"); complaintNotice.setEmergencyDegree(complaintNoticeDetail.getEmergencyDegree()); - complaintNoticeMapper.insertAftersalesComplaintNotice(complaintNotice); + if(complaintNoticeDetail.getAftersalesMaterialVOs()!=null){ + complaintNotice.setMaterialSum(complaintNoticeDetail.getAftersalesMaterialVOs().size()); + } List aftersalesMaterialVOs = complaintNoticeDetail.getAftersalesMaterialVOs(); if (StringUtils.isEmpty(aftersalesMaterialVOs)){ - return aftersalesComplaintNoticeDetailMapper.insertAftersalesComplaintNoticeDetail(complaintNoticeDetail); - } - for (AftersalesMaterialVO aftersalesMaterialVO : aftersalesMaterialVOs) { - complaintNoticeDetail.setMaterialType(aftersalesMaterialVO.getMaterialType()); - complaintNoticeDetail.setMaterialUnit(aftersalesMaterialVO.getMaterialUnit()); - complaintNoticeDetail.setMaterialProcessMethod(aftersalesMaterialVO.getMaterialProcessMethod()); - complaintNoticeDetail.setMaterialName(aftersalesMaterialVO.getMaterialName()); - complaintNoticeDetail.setMaterialDescribe(aftersalesMaterialVO.getMaterialDescribe()); - complaintNoticeDetail.setMaterialNo(aftersalesMaterialVO.getMaterialNo()); - complaintNoticeDetail.setMaterialPhotourl(aftersalesMaterialVO.getMaterialPhotourl()); - complaintNoticeDetail.setMaterialBrand(aftersalesMaterialVO.getMaterialBrand()); - complaintNoticeDetail.setComplaintProblem(aftersalesMaterialVO.getComplaintProblem()); - complaintNoticeDetail.setSnCode(aftersalesMaterialVO.getSnCode()); - complaintNoticeDetail.setAdverseReportUrl(aftersalesMaterialVO.getAdverseReportUrl()); aftersalesComplaintNoticeDetailMapper.insertAftersalesComplaintNoticeDetail(complaintNoticeDetail); - } + }else{ + for (AftersalesMaterialVO aftersalesMaterialVO : aftersalesMaterialVOs) { + complaintNoticeDetail.setMaterialNo(aftersalesMaterialVO.getMaterialNo()); + complaintNoticeDetail.setMaterialName(aftersalesMaterialVO.getMaterialName()); + complaintNoticeDetail.setMaterialType(aftersalesMaterialVO.getMaterialType()); + complaintNoticeDetail.setMaterialUnit(aftersalesMaterialVO.getMaterialUnit()); + complaintNoticeDetail.setMaterialDescribe(aftersalesMaterialVO.getMaterialDescribe()); + complaintNoticeDetail.setMaterialPhotourl(aftersalesMaterialVO.getMaterialPhotourl()); + complaintNoticeDetail.setMaterialBrand(aftersalesMaterialVO.getMaterialBrand()); + complaintNoticeDetail.setSnCode(aftersalesMaterialVO.getSnCode()); + complaintNoticeDetail.setClosingProcedures("1"); + complaintNoticeDetail.setComplaintProblem(aftersalesMaterialVO.getComplaintProblem()); + complaintNoticeDetail.setAdverseReportUrl(aftersalesMaterialVO.getAdverseReportUrl()); +// int totalQuantity = warehouseOutOrderMapper.sumOutOrderQuantityByMakeNo(makeNo); + complaintNoticeDetail.setShippedGoodsSum(aftersalesMaterialVO.getShippedGoodsSum()); + complaintNotice.setEnterpriseSum(aftersalesMaterialVO.getShippedGoodsSum()); + aftersalesComplaintNoticeDetailMapper.insertAftersalesComplaintNoticeDetail(complaintNoticeDetail); + } + } + complaintNoticeMapper.insertAftersalesComplaintNotice(complaintNotice); return 1; } @@ -142,7 +194,7 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo //更新主表内容 aftersalesComplaintNotice.setComplaintNoticeCode(aftersalesComplaintNoticeDetail.getComplaintNoticeCode()); aftersalesComplaintNotice.setUpdateBy(loginName); - aftersalesComplaintNotice.setUpdateTime(new Date()); + aftersalesComplaintNotice.setUpdateTime(DateUtils.getNowDate()); aftersalesComplaintNotice.setMakeNo(aftersalesComplaintNoticeDetail.getMakeNo()); aftersalesComplaintNotice.setEmergencyDegree(aftersalesComplaintNoticeDetail.getEmergencyDegree()); aftersalesComplaintNotice.setRemark(aftersalesComplaintNoticeDetail.getRemark()); @@ -166,7 +218,7 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo complaintNoticeDetail.setCreateBy(aftersalesComplaintNoticeDetail.getCreateBy()); complaintNoticeDetail.setCreateTime(aftersalesComplaintNoticeDetail.getCreateTime()); complaintNoticeDetail.setUpdateBy(loginName); - complaintNoticeDetail.setUpdateTime(new Date()); + complaintNoticeDetail.setUpdateTime(DateUtils.getNowDate()); complaintNoticeDetail.setCustomerId(aftersalesComplaintNoticeDetail.getCustomerId()); complaintNoticeDetail.setCustomerName(aftersalesComplaintNoticeDetail.getCustomerName()); complaintNoticeDetail.setEmergencyDegree(aftersalesComplaintNoticeDetail.getEmergencyDegree()); @@ -183,6 +235,8 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo complaintNoticeDetail.setComplaintProblem(aftersalesMaterialVO.getComplaintProblem()); complaintNoticeDetail.setSnCode(aftersalesMaterialVO.getSnCode()); complaintNoticeDetail.setAdverseReportUrl(aftersalesMaterialVO.getAdverseReportUrl()); + complaintNoticeDetail.setShippedGoodsSum(aftersalesMaterialVO.getShippedGoodsSum()); + complaintNoticeDetail.setClosingProcedures("1"); aftersalesComplaintNoticeDetailMapper.insertAftersalesComplaintNoticeDetail(complaintNoticeDetail); } return 1; @@ -261,6 +315,8 @@ public class AftersalesComplaintNoticeDetailServiceImpl implements IAftersalesCo aftersalesMaterialVO.setMaterialUnit(complaintNoticeDetail.getMaterialUnit()); aftersalesMaterialVO.setMaterialType(complaintNoticeDetail.getMaterialType()); aftersalesMaterialVO.setComplaintProblem(complaintNoticeDetail.getComplaintProblem()); + aftersalesMaterialVO.setShippedGoodsSum(complaintNoticeDetail.getShippedGoodsSum()); + aftersalesMaterialVO.setEmergencyDegree(complaintNoticeDetail.getEmergencyDegree()); aftersalesMaterialVO.setSnCode(complaintNoticeDetail.getSnCode()); aftersalesMaterialVO.setAdverseReportUrl(complaintNoticeDetail.getAdverseReportUrl()); aftersalesMaterialVOs.add(aftersalesMaterialVO); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeServiceImpl.java index fe9a0305..8d446930 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/aftersales/service/impl/AftersalesComplaintNoticeServiceImpl.java @@ -16,10 +16,13 @@ import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.domain.SysMakeorderBom; +import com.ruoyi.system.domain.SysSalesOrderChild; import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.mapper.SysMakeorderBomMapper; +import com.ruoyi.system.mapper.SysSalesOrderChildMapper; import com.ruoyi.warehouse.domain.WarehouseOutOrderDetail; import com.ruoyi.warehouse.mapper.WarehouseOutOrderDetailMapper; +import com.ruoyi.warehouse.mapper.WarehouseOutOrderMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -49,7 +52,10 @@ public class AftersalesComplaintNoticeServiceImpl implements IAftersalesComplain private SysMakeorderBomMapper sysMakeorderBomMapper; @Autowired - private WarehouseOutOrderDetailMapper warehouseOutOrderDetailMapper; + private WarehouseOutOrderMapper warehouseOutOrderMapper; + + @Autowired + private SysSalesOrderChildMapper sysSalesOrderChildMapper; /** * 查询售后客诉通知单 @@ -191,34 +197,33 @@ public class AftersalesComplaintNoticeServiceImpl implements IAftersalesComplain public List selectMaterialInfoByMakeNo(String makeNo) { ArrayList aftersalesMaterialVOs = new ArrayList<>(); - List sysMakeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomByMakeNo(makeNo); - if (StringUtils.isEmpty(sysMakeorderBoms)){ +// List sysMakeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomByMakeNo(makeNo); +// if (StringUtils.isEmpty(sysMakeorderBoms)){ +// // 记录日志 +// log.warn("未查找到与生产订单关联的物料相关数据, 生产订单号: {}", makeNo); +// } + SysMakeOrder sysMakeOrder = sysMakeOrderMapper.selectSaleNoByMakeNo(makeNo); + if (StringUtils.isEmpty(sysMakeOrder.getSaleNo())){ + log.warn("未查找到与生产订单关联的销售订单, 生产订单号: {}", makeNo); + } + List sysSalesOrderChildList = sysSalesOrderChildMapper.selectSysSalesOrderChildByQuoteId(sysMakeOrder.getSaleNo()); + + if (StringUtils.isEmpty(sysSalesOrderChildList)){ // 记录日志 - log.warn("未查找到与生产订单关联的物料相关数据, 生产订单号: {}", makeNo); + log.warn("未查找到与销售订单关联的物料相关数据, 销售订单号: {}", sysMakeOrder.getSaleNo()); } - List outOrderDetails = warehouseOutOrderDetailMapper.selectOutOrderDetailListByMakeNo(makeNo); - for (SysMakeorderBom sysMakeorderBom : sysMakeorderBoms) { + int totalQuantity = warehouseOutOrderMapper.sumOutOrderQuantityByMakeNo(makeNo); + for (SysSalesOrderChild salesOrderChild : sysSalesOrderChildList) { AftersalesMaterialVO aftersalesMaterialVO = new AftersalesMaterialVO(); - aftersalesMaterialVO.setMaterialNo(sysMakeorderBom.getMaterialNo()); - if (StringUtils.isEmpty(outOrderDetails)){ - aftersalesMaterialVO.setShippedGoodsSum(0); - }else { - Optional matchingDetail = outOrderDetails.stream() - .filter(detail -> detail.getMaterialNo().equals(sysMakeorderBom.getMaterialNo())) - .findFirst(); - - matchingDetail.ifPresent(detail -> { - int sum = detail.getHasOutOrderSum(); - aftersalesMaterialVO.setShippedGoodsSum(detail.getHasOutOrderSum()==null?0:detail.getHasOutOrderSum()); - }); - } - aftersalesMaterialVO.setMaterialBrand(sysMakeorderBom.getBrand()); - aftersalesMaterialVO.setMaterialDescribe(sysMakeorderBom.getDescribe()); - aftersalesMaterialVO.setMaterialName(sysMakeorderBom.getMaterialName()); - aftersalesMaterialVO.setMaterialProcessMethod(sysMakeorderBom.getProcessMethod()); - aftersalesMaterialVO.setMaterialPhotourl(sysMakeorderBom.getPhotoUrl()); - aftersalesMaterialVO.setMaterialUnit(sysMakeorderBom.getUnit()); - aftersalesMaterialVO.setMaterialType(sysMakeorderBom.getMaterialType()); + aftersalesMaterialVO.setMaterialNo(salesOrderChild.getMaterialCode()); + aftersalesMaterialVO.setShippedGoodsSum(totalQuantity); + aftersalesMaterialVO.setMaterialBrand(salesOrderChild.getBrand()); + aftersalesMaterialVO.setMaterialDescribe(salesOrderChild.getDescribe()); + aftersalesMaterialVO.setMaterialName(salesOrderChild.getMaterialName()); + aftersalesMaterialVO.setMaterialProcessMethod(salesOrderChild.getProcessMethod()); + aftersalesMaterialVO.setMaterialPhotourl(salesOrderChild.getPhotoUrl()); + aftersalesMaterialVO.setMaterialUnit(salesOrderChild.getUnit()); + aftersalesMaterialVO.setMaterialType(salesOrderChild.getMaterialType()); aftersalesMaterialVOs.add(aftersalesMaterialVO); } return aftersalesMaterialVOs; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialTaxInvoiceController.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialTaxInvoiceController.java index 9696e92f..1e877bd5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialTaxInvoiceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialTaxInvoiceController.java @@ -1,15 +1,14 @@ package com.ruoyi.financial.controller; import java.util.List; + +import com.ruoyi.financial.domain.FinancialTaxInvoiceMaterial; +import com.ruoyi.financial.service.IFinancialTaxInvoiceMaterialService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.financial.domain.FinancialTaxInvoice; @@ -34,6 +33,10 @@ public class FinancialTaxInvoiceController extends BaseController @Autowired private IFinancialTaxInvoiceService financialTaxInvoiceService; + @Autowired + private IFinancialTaxInvoiceMaterialService taxInvoiceMaterialService; + + @RequiresPermissions("financial:taxInvoice:view") @GetMapping() public String taxInvoice() @@ -89,6 +92,50 @@ public class FinancialTaxInvoiceController extends BaseController return toAjax(financialTaxInvoiceService.insertFinancialTaxInvoice(financialTaxInvoice)); } + /** + * 审核国税发票弹窗页面 + */ + @GetMapping("/auditInvoice/{taxInvoiceId}") + public String auditInvoice(@PathVariable("taxInvoiceId") Long taxInvoiceId, ModelMap mmap) + { + FinancialTaxInvoice taxInvoice = financialTaxInvoiceService.selectFinancialTaxInvoiceById(taxInvoiceId); + String commonCurrency = taxInvoice.getCommonCurrency(); + mmap.put("taxInvoice", taxInvoice); + if ("1".equals(commonCurrency)){ + return prefix + "/auditInvoiceRMB"; + }else { + return prefix + "/auditInvoiceUSD"; + } + + } + + + /** + * 审核国税发票 + */ + @RequiresPermissions("financial:taxInvoice:auditInvoice") + @Log(title = "国税发票", businessType = BusinessType.INSERT) + @PostMapping("/auditInvoice") + @ResponseBody + public AjaxResult auditInvoiceSave(FinancialTaxInvoice financialTaxInvoice,@RequestParam("taxInvoiceStatus") String taxInvoiceStatus) + { + return toAjax(financialTaxInvoiceService.auditInvoiceFinancialTaxInvoice(financialTaxInvoice,taxInvoiceStatus)); + } + + + /** + * 国税发票物料列表展示 + */ + @ResponseBody + @PostMapping("/getInvoiceMaterialListByCode") + public TableDataInfo getInvoiceMaterialListByCode(@RequestParam("taxInvoiceCode") String taxInvoiceCode){ + startPage(); + List list = taxInvoiceMaterialService.getInvoiceMaterialListByCode(taxInvoiceCode); + return getDataTable(list); + } + + + /** * 修改国税发票 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialTaxInvoice.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialTaxInvoice.java index 14e14bd9..ac8e9a8d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialTaxInvoice.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialTaxInvoice.java @@ -130,8 +130,12 @@ public class FinancialTaxInvoice extends BaseEntity @Excel(name = "开票额度比例") private BigDecimal invoiceQuotaRatio; - /** 开票金额 */ - private BigDecimal invoiceAmount; + /** 开票金额(RMB) */ + private BigDecimal invoiceAmountRmb; + + /** 开票金额(美元) */ + private BigDecimal invoiceAmountUsd; + /** 实际开票金额 */ @Excel(name = "实际开票金额") @@ -455,16 +459,16 @@ public class FinancialTaxInvoice extends BaseEntity { return invoiceQuotaRatio; } - public void setInvoiceAmount(BigDecimal invoiceAmount) - { - this.invoiceAmount = invoiceAmount; + + public BigDecimal getInvoiceAmountRmb() { + return invoiceAmountRmb; } - public BigDecimal getInvoiceAmount() - { - return invoiceAmount; + public void setInvoiceAmountRmb(BigDecimal invoiceAmountRmb) { + this.invoiceAmountRmb = invoiceAmountRmb; } - public void setActualInvoiceAmount(BigDecimal actualInvoiceAmount) + + public void setActualInvoiceAmount(BigDecimal actualInvoiceAmount) { this.actualInvoiceAmount = actualInvoiceAmount; } @@ -473,7 +477,17 @@ public class FinancialTaxInvoice extends BaseEntity { return actualInvoiceAmount; } - public void setActualInvoiceAmountRmb(BigDecimal actualInvoiceAmountRmb) + + + public BigDecimal getInvoiceAmountUsd() { + return invoiceAmountUsd; + } + + public void setInvoiceAmountUsd(BigDecimal invoiceAmountUsd) { + this.invoiceAmountUsd = invoiceAmountUsd; + } + + public void setActualInvoiceAmountRmb(BigDecimal actualInvoiceAmountRmb) { this.actualInvoiceAmountRmb = actualInvoiceAmountRmb; } @@ -597,7 +611,8 @@ public class FinancialTaxInvoice extends BaseEntity .append("usdTaxSum", getUsdTaxSum()) .append("invoiceEmail", getInvoiceEmail()) .append("invoiceQuotaRatio", getInvoiceQuotaRatio()) - .append("invoiceAmount", getInvoiceAmount()) + .append("invoiceAmountRmb", getInvoiceAmountRmb()) + .append("invoiceAmountUsd", getInvoiceAmountUsd()) .append("actualInvoiceAmount", getActualInvoiceAmount()) .append("actualInvoiceAmountRmb", getActualInvoiceAmountRmb()) .append("actualInvoiceAmountUsd", getActualInvoiceAmountUsd()) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialTaxInvoiceHistory.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialTaxInvoiceHistory.java new file mode 100644 index 00000000..60208ce2 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/domain/FinancialTaxInvoiceHistory.java @@ -0,0 +1,197 @@ +package com.ruoyi.financial.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 国税发票历史记录对象 financial_tax_invoice_history + * + * @author 刘晓旭 + * @date 2024-08-14 + */ +public class FinancialTaxInvoiceHistory extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 国税发票历史id */ + private Long invoiceHistoryId; + + /** 国税发票单号 */ + @Excel(name = "国税发票单号") + private String taxInvoiceCode; + + /** 销售订单编号 */ + private String salesOrderCode; + + /** 发票状态(0待审核、1待开具、2已开具、3审核拒绝) */ + @Excel(name = "发票状态(0待审核、1待开具、2已开具、3审核拒绝)") + private String taxInvoiceStatus; + + /** 申请时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date applyTime; + + /** 财务员 */ + @Excel(name = "财务员") + private String financeMembers; + + /** 开票额度比例 */ + @Excel(name = "开票额度比例") + private BigDecimal invoiceQuotaRatio; + + /** 开票金额(RMB) */ + @Excel(name = "开票金额(RMB)") + private BigDecimal invoiceAmountRmb; + + /** 开票金额(美元) */ + @Excel(name = "开票金额(美元)") + private BigDecimal invoiceAmountUsd; + + /** 开票用途 */ + @Excel(name = "开票用途") + private String invoicePurpose; + + /** 使用状态(1是、0否、2已作废) */ + private String useStatus; + + /** 删除标志 0正常 1删除 */ + private String delFlag; + + public void setInvoiceHistoryId(Long invoiceHistoryId) + { + this.invoiceHistoryId = invoiceHistoryId; + } + + public Long getInvoiceHistoryId() + { + return invoiceHistoryId; + } + public void setTaxInvoiceCode(String taxInvoiceCode) + { + this.taxInvoiceCode = taxInvoiceCode; + } + + public String getTaxInvoiceCode() + { + return taxInvoiceCode; + } + public void setSalesOrderCode(String salesOrderCode) + { + this.salesOrderCode = salesOrderCode; + } + + public String getSalesOrderCode() + { + return salesOrderCode; + } + public void setTaxInvoiceStatus(String taxInvoiceStatus) + { + this.taxInvoiceStatus = taxInvoiceStatus; + } + + public String getTaxInvoiceStatus() + { + return taxInvoiceStatus; + } + public void setApplyTime(Date applyTime) + { + this.applyTime = applyTime; + } + + public Date getApplyTime() + { + return applyTime; + } + public void setFinanceMembers(String financeMembers) + { + this.financeMembers = financeMembers; + } + + public String getFinanceMembers() + { + return financeMembers; + } + public void setInvoiceQuotaRatio(BigDecimal invoiceQuotaRatio) + { + this.invoiceQuotaRatio = invoiceQuotaRatio; + } + + public BigDecimal getInvoiceQuotaRatio() + { + return invoiceQuotaRatio; + } + public void setInvoiceAmountRmb(BigDecimal invoiceAmountRmb) + { + this.invoiceAmountRmb = invoiceAmountRmb; + } + + public BigDecimal getInvoiceAmountRmb() + { + return invoiceAmountRmb; + } + public void setInvoiceAmountUsd(BigDecimal invoiceAmountUsd) + { + this.invoiceAmountUsd = invoiceAmountUsd; + } + + public BigDecimal getInvoiceAmountUsd() + { + return invoiceAmountUsd; + } + public void setInvoicePurpose(String invoicePurpose) + { + this.invoicePurpose = invoicePurpose; + } + + public String getInvoicePurpose() + { + return invoicePurpose; + } + public void setUseStatus(String useStatus) + { + this.useStatus = useStatus; + } + + public String getUseStatus() + { + return useStatus; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("invoiceHistoryId", getInvoiceHistoryId()) + .append("taxInvoiceCode", getTaxInvoiceCode()) + .append("salesOrderCode", getSalesOrderCode()) + .append("taxInvoiceStatus", getTaxInvoiceStatus()) + .append("applyTime", getApplyTime()) + .append("financeMembers", getFinanceMembers()) + .append("invoiceQuotaRatio", getInvoiceQuotaRatio()) + .append("invoiceAmountRmb", getInvoiceAmountRmb()) + .append("invoiceAmountUsd", getInvoiceAmountUsd()) + .append("invoicePurpose", getInvoicePurpose()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .append("useStatus", getUseStatus()) + .append("delFlag", getDelFlag()) + .toString(); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialTaxInvoiceHistoryMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialTaxInvoiceHistoryMapper.java new file mode 100644 index 00000000..d0dffa28 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialTaxInvoiceHistoryMapper.java @@ -0,0 +1,93 @@ +package com.ruoyi.financial.mapper; + +import java.util.List; +import com.ruoyi.financial.domain.FinancialTaxInvoiceHistory; + +/** + * 国税发票历史记录Mapper接口 + * + * @author 刘晓旭 + * @date 2024-08-14 + */ +public interface FinancialTaxInvoiceHistoryMapper +{ + /** + * 查询国税发票历史记录 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 国税发票历史记录 + */ + public FinancialTaxInvoiceHistory selectFinancialTaxInvoiceHistoryById(Long invoiceHistoryId); + + /** + * 查询国税发票历史记录列表 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 国税发票历史记录集合 + */ + public List selectFinancialTaxInvoiceHistoryList(FinancialTaxInvoiceHistory financialTaxInvoiceHistory); + + /** + * 新增国税发票历史记录 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 结果 + */ + public int insertFinancialTaxInvoiceHistory(FinancialTaxInvoiceHistory financialTaxInvoiceHistory); + + /** + * 修改国税发票历史记录 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 结果 + */ + public int updateFinancialTaxInvoiceHistory(FinancialTaxInvoiceHistory financialTaxInvoiceHistory); + + /** + * 删除国税发票历史记录 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 结果 + */ + public int deleteFinancialTaxInvoiceHistoryById(Long invoiceHistoryId); + + /** + * 批量删除国税发票历史记录 + * + * @param invoiceHistoryIds 需要删除的数据ID + * @return 结果 + */ + public int deleteFinancialTaxInvoiceHistoryByIds(String[] invoiceHistoryIds); + + /** + * 作废国税发票历史记录 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 结果 + */ + public int cancelFinancialTaxInvoiceHistoryById(Long invoiceHistoryId); + + /** + * 恢复国税发票历史记录 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 结果 + */ + public int restoreFinancialTaxInvoiceHistoryById(Long invoiceHistoryId); + + /** + * 根据销售订单编号查询发票历史记录集合 + * + * @param salesOrderCode 销售订单编号 + * @return 结果 + */ + List selectInvoiceHistoryListBySalesOrderCode(String salesOrderCode); + + /** + * 根据发票编号查询发票历史记录 + * + * @param taxInvoiceCode 发票编号 + * @return 结果 + */ + FinancialTaxInvoiceHistory selectInvoiceHistoryByInvoiceCode(String taxInvoiceCode); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialTaxInvoiceMaterialMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialTaxInvoiceMaterialMapper.java index 6b21f08b..5e107814 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialTaxInvoiceMaterialMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialTaxInvoiceMaterialMapper.java @@ -84,4 +84,12 @@ public interface FinancialTaxInvoiceMaterialMapper * @return 结果 */ public int restoreFinancialTaxInvoiceMaterialById(Long invoiceMaterialId); + + /** + * 根据发票单号获取发票物料信息集合 + * + * @param taxInvoiceCode 发票单号 + * @return 结果 + */ + List selectFinancialTaxInvoiceMaterialByCode(String taxInvoiceCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceHistoryService.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceHistoryService.java new file mode 100644 index 00000000..59c8ccbe --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceHistoryService.java @@ -0,0 +1,82 @@ +package com.ruoyi.financial.service; + +import java.util.List; +import com.ruoyi.financial.domain.FinancialTaxInvoiceHistory; + +/** + * 国税发票历史记录Service接口 + * + * @author 刘晓旭 + * @date 2024-08-14 + */ +public interface IFinancialTaxInvoiceHistoryService +{ + /** + * 查询国税发票历史记录 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 国税发票历史记录 + */ + public FinancialTaxInvoiceHistory selectFinancialTaxInvoiceHistoryById(Long invoiceHistoryId); + + /** + * 查询国税发票历史记录列表 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 国税发票历史记录集合 + */ + public List selectFinancialTaxInvoiceHistoryList(FinancialTaxInvoiceHistory financialTaxInvoiceHistory); + + /** + * 新增国税发票历史记录 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 结果 + */ + public int insertFinancialTaxInvoiceHistory(FinancialTaxInvoiceHistory financialTaxInvoiceHistory); + + /** + * 修改国税发票历史记录 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 结果 + */ + public int updateFinancialTaxInvoiceHistory(FinancialTaxInvoiceHistory financialTaxInvoiceHistory); + + /** + * 批量删除国税发票历史记录 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteFinancialTaxInvoiceHistoryByIds(String ids); + + /** + * 删除国税发票历史记录信息 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 结果 + */ + public int deleteFinancialTaxInvoiceHistoryById(Long invoiceHistoryId); + + /** + * 作废国税发票历史记录 + * @param invoiceHistoryId 国税发票历史记录ID + * @return + */ + int cancelFinancialTaxInvoiceHistoryById(Long invoiceHistoryId); + + /** + * 恢复国税发票历史记录 + * @param invoiceHistoryId 国税发票历史记录ID + * @return + */ + int restoreFinancialTaxInvoiceHistoryById(Long invoiceHistoryId); + + /** + * 根据销售订单编号查询发票历史记录集合 + * @param salesOrderCode 销售订单编号 + * @return + */ + List selectInvoiceHistoryListBySalesOrderCode(String salesOrderCode); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceMaterialService.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceMaterialService.java index 1e1ba507..afcc6912 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceMaterialService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceMaterialService.java @@ -81,4 +81,11 @@ public interface IFinancialTaxInvoiceMaterialService * @return */ int restoreFinancialTaxInvoiceMaterialById(Long invoiceMaterialId); + + /** + * 根据发票单号获取发票物料集合 + * @param taxInvoiceCode 发票单号 + * @return + */ + List getInvoiceMaterialListByCode(String taxInvoiceCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceService.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceService.java index 1899df70..52436aa2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialTaxInvoiceService.java @@ -87,4 +87,9 @@ public interface IFinancialTaxInvoiceService * @return */ int makeInvoiceSave(FinancialTaxInvoice financialTaxInvoice); + + /** + * 审核国税发票 + */ + int auditInvoiceFinancialTaxInvoice(FinancialTaxInvoice financialTaxInvoice,String taxInvoiceStatus); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceHistoryServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceHistoryServiceImpl.java new file mode 100644 index 00000000..46e4e3f9 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceHistoryServiceImpl.java @@ -0,0 +1,140 @@ +package com.ruoyi.financial.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.financial.mapper.FinancialTaxInvoiceHistoryMapper; +import com.ruoyi.financial.domain.FinancialTaxInvoiceHistory; +import com.ruoyi.financial.service.IFinancialTaxInvoiceHistoryService; +import com.ruoyi.common.core.text.Convert; + +/** + * 国税发票历史记录Service业务层处理 + * + * @author 刘晓旭 + * @date 2024-08-14 + */ +@Service +public class FinancialTaxInvoiceHistoryServiceImpl implements IFinancialTaxInvoiceHistoryService +{ + @Autowired + private FinancialTaxInvoiceHistoryMapper financialTaxInvoiceHistoryMapper; + + /** + * 查询国税发票历史记录 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 国税发票历史记录 + */ + @Override + public FinancialTaxInvoiceHistory selectFinancialTaxInvoiceHistoryById(Long invoiceHistoryId) + { + return financialTaxInvoiceHistoryMapper.selectFinancialTaxInvoiceHistoryById(invoiceHistoryId); + } + + /** + * 查询国税发票历史记录列表 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 国税发票历史记录 + */ + @Override + public List selectFinancialTaxInvoiceHistoryList(FinancialTaxInvoiceHistory financialTaxInvoiceHistory) + { + return financialTaxInvoiceHistoryMapper.selectFinancialTaxInvoiceHistoryList(financialTaxInvoiceHistory); + } + + /** + * 新增国税发票历史记录 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 结果 + */ + @Override + public int insertFinancialTaxInvoiceHistory(FinancialTaxInvoiceHistory financialTaxInvoiceHistory) + { + String loginName = ShiroUtils.getLoginName(); + financialTaxInvoiceHistory.setCreateBy(loginName); + financialTaxInvoiceHistory.setCreateTime(DateUtils.getNowDate()); + return financialTaxInvoiceHistoryMapper.insertFinancialTaxInvoiceHistory(financialTaxInvoiceHistory); + } + + /** + * 修改国税发票历史记录 + * + * @param financialTaxInvoiceHistory 国税发票历史记录 + * @return 结果 + */ + @Override + public int updateFinancialTaxInvoiceHistory(FinancialTaxInvoiceHistory financialTaxInvoiceHistory) + { + String loginName = ShiroUtils.getLoginName(); + financialTaxInvoiceHistory.setUpdateBy(loginName); + financialTaxInvoiceHistory.setUpdateTime(DateUtils.getNowDate()); + return financialTaxInvoiceHistoryMapper.updateFinancialTaxInvoiceHistory(financialTaxInvoiceHistory); + } + + /** + * 删除国税发票历史记录对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteFinancialTaxInvoiceHistoryByIds(String ids) + { + return financialTaxInvoiceHistoryMapper.deleteFinancialTaxInvoiceHistoryByIds(Convert.toStrArray(ids)); + } + + /** + * 删除国税发票历史记录信息 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 结果 + */ + @Override + public int deleteFinancialTaxInvoiceHistoryById(Long invoiceHistoryId) + { + return financialTaxInvoiceHistoryMapper.deleteFinancialTaxInvoiceHistoryById(invoiceHistoryId); + } + + /** + * 作废国税发票历史记录 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 结果 + */ + @Override + public int cancelFinancialTaxInvoiceHistoryById(Long invoiceHistoryId) + { + return financialTaxInvoiceHistoryMapper.cancelFinancialTaxInvoiceHistoryById(invoiceHistoryId); + } + + /** + * 恢复国税发票历史记录信息 + * + * @param invoiceHistoryId 国税发票历史记录ID + * @return 结果 + */ + @Override + public int restoreFinancialTaxInvoiceHistoryById(Long invoiceHistoryId) + { + return financialTaxInvoiceHistoryMapper.restoreFinancialTaxInvoiceHistoryById(invoiceHistoryId); + } + + + /** + * 根据销售订单编号查询历史记录集合 + * + * @param salesOrderCode 销售订单编号 + * @return 结果 + */ + @Override + public List selectInvoiceHistoryListBySalesOrderCode(String salesOrderCode) { + + List list = financialTaxInvoiceHistoryMapper.selectInvoiceHistoryListBySalesOrderCode(salesOrderCode); + return list; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceMaterialServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceMaterialServiceImpl.java index a5084197..ff2f5e95 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceMaterialServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceMaterialServiceImpl.java @@ -143,4 +143,17 @@ public class FinancialTaxInvoiceMaterialServiceImpl implements IFinancialTaxInvo { return financialTaxInvoiceMaterialMapper.restoreFinancialTaxInvoiceMaterialById(invoiceMaterialId); } + + + /** + * 根据发票单号获取发票物料信息集合 + * + * @param taxInvoiceCode 发票单号 + * @return 结果 + */ + @Override + public List getInvoiceMaterialListByCode(String taxInvoiceCode) { + + return financialTaxInvoiceMaterialMapper.selectFinancialTaxInvoiceMaterialByCode(taxInvoiceCode); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java index 12abd152..8d9c3494 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialTaxInvoiceServiceImpl.java @@ -3,11 +3,15 @@ package com.ruoyi.financial.service.impl; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.financial.domain.FinancialTaxInvoiceHistory; import com.ruoyi.financial.domain.FinancialTaxInvoiceMaterial; +import com.ruoyi.financial.mapper.FinancialTaxInvoiceHistoryMapper; import com.ruoyi.financial.mapper.FinancialTaxInvoiceMaterialMapper; import com.ruoyi.financial.service.IFinancialTaxInvoiceMaterialService; import com.ruoyi.system.domain.SysCustomerVo; @@ -20,6 +24,7 @@ import com.ruoyi.financial.domain.FinancialTaxInvoice; import com.ruoyi.financial.service.IFinancialTaxInvoiceService; import com.ruoyi.common.core.text.Convert; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; /** * 国税发票Service业务层处理 @@ -39,12 +44,16 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi @Autowired private IFinancialTaxInvoiceMaterialService invoiceMaterialService; + @Autowired + private FinancialTaxInvoiceHistoryMapper invoiceHistoryMapper; + @Autowired private SysCustomerMapper sysCustomerMapper; @Autowired private RedisCache redisCache; + /** * 查询国税发票 * @@ -165,6 +174,7 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi financialTaxInvoice.setContactNumber(sysSalesOrder.getContactNumber()); financialTaxInvoice.setEnterpriseSum(sysSalesOrder.getEnterpriseSum()); financialTaxInvoice.setMaterialSum(sysSalesOrder.getMaterialSum()); +// financialTaxInvoice.setTaxRate(BigDecimal.valueOf(sysSalesOrder.getTaxRate())); financialTaxInvoice.setRmbTaxSum(BigDecimal.valueOf(sysSalesOrder.getRmbTaxSum())); financialTaxInvoice.setNoRmbSum(BigDecimal.valueOf(sysSalesOrder.getNoRmbSum())); financialTaxInvoice.setUsdTaxSum(BigDecimal.valueOf(sysSalesOrder.getUsdTaxSum())); @@ -174,10 +184,7 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi financialTaxInvoice.setInvoiceCompanyName(sysCustomerVo.getInvoicingCompanyName()); financialTaxInvoice.setBankAccount(sysCustomerVo.getBankAccount()); financialTaxInvoice.setDepositBank(sysCustomerVo.getDepositBank()); - - - - + financialTaxInvoice.setTaxRate(BigDecimal.valueOf(sysCustomerVo.getTaxRate())); return financialTaxInvoice; } @@ -193,6 +200,8 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi public int makeInvoiceSave(FinancialTaxInvoice financialTaxInvoice) { String loginName = ShiroUtils.getLoginName(); + String salesOrderCode = financialTaxInvoice.getSalesOrderCode(); + financialTaxInvoice.setCreateBy(loginName); financialTaxInvoice.setCreateTime(new Date()); String taxInvoiceCode = redisCache.generateBillNo("FP"); @@ -201,14 +210,85 @@ public class FinancialTaxInvoiceServiceImpl implements IFinancialTaxInvoiceServi financialTaxInvoice.setApplyUser(loginName); financialTaxInvoice.setBusinessMembers(loginName); + //填充国税发票物料数据 List invoiceMaterialList = financialTaxInvoice.getInvoiceMaterialList(); invoiceMaterialList.parallelStream().forEach(invoiceMaterial -> { invoiceMaterial.setTaxInvoiceCode(taxInvoiceCode); - invoiceMaterial.setSalesOrderCode(financialTaxInvoice.getSalesOrderCode()); + invoiceMaterial.setSalesOrderCode(salesOrderCode); invoiceMaterial.setCreateBy(loginName); invoiceMaterial.setCreateTime(new Date()); }); invoiceMaterialMapper.insertFinancialTaxInvoiceMaterialBatch(invoiceMaterialList); + + + //获取历史开票信息 + List financialTaxInvoiceHistories = invoiceHistoryMapper.selectInvoiceHistoryListBySalesOrderCode(salesOrderCode); + //获取除了被审核拒接的历史开票信息 + List filterInvoiceHistories = financialTaxInvoiceHistories.stream().filter(item -> !item.getTaxInvoiceStatus().equals("3")).collect(Collectors.toList()); + //判断历史开票信息是否超出开票限额 + if (!CollectionUtils.isEmpty(filterInvoiceHistories)){ + BigDecimal totalInvoiceQuotaRatio = filterInvoiceHistories.stream().map(FinancialTaxInvoiceHistory::getInvoiceQuotaRatio) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + //判断累计开票比例是否超出开票限额 + if (totalInvoiceQuotaRatio.add(financialTaxInvoice.getInvoiceQuotaRatio()).compareTo(new BigDecimal("100")) > 0 ){ + throw new BusinessException("累计开票比例超出开票限额100%"); + } + + } + + + //填充国税发票历史数据 + FinancialTaxInvoiceHistory financialTaxInvoiceHistory = new FinancialTaxInvoiceHistory(); + financialTaxInvoiceHistory.setTaxInvoiceCode(taxInvoiceCode); + financialTaxInvoiceHistory.setSalesOrderCode(salesOrderCode); + + if ("1".equals(financialTaxInvoice.getCommonCurrency())){ + financialTaxInvoiceHistory.setInvoiceAmountRmb(financialTaxInvoice.getInvoiceAmountRmb()); + }else { + financialTaxInvoiceHistory.setInvoiceAmountUsd(financialTaxInvoice.getInvoiceAmountUsd()); + } + + financialTaxInvoiceHistory.setInvoicePurpose(financialTaxInvoice.getInvoicePurpose()); + financialTaxInvoiceHistory.setInvoiceQuotaRatio(financialTaxInvoice.getInvoiceQuotaRatio()); + financialTaxInvoiceHistory.setTaxInvoiceStatus("0");//待审核 + financialTaxInvoiceHistory.setApplyTime(new Date()); + financialTaxInvoiceHistory.setCreateBy(loginName); + financialTaxInvoiceHistory.setCreateTime(new Date()); + invoiceHistoryMapper.insertFinancialTaxInvoiceHistory(financialTaxInvoiceHistory); + return financialTaxInvoiceMapper.insertFinancialTaxInvoice(financialTaxInvoice); } + + + /** + * 审核国税发票 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public int auditInvoiceFinancialTaxInvoice(FinancialTaxInvoice financialTaxInvoice, String taxInvoiceStatus) { + String loginName = ShiroUtils.getLoginName(); + String taxInvoiceCode = financialTaxInvoice.getTaxInvoiceCode(); + FinancialTaxInvoiceHistory invoiceHistory = invoiceHistoryMapper.selectInvoiceHistoryByInvoiceCode(taxInvoiceCode); + invoiceHistory.setUpdateTime(new Date()); + invoiceHistory.setUpdateBy(loginName); + + financialTaxInvoice.setUpdateTime(new Date()); + financialTaxInvoice.setUpdateBy(loginName); + if ("1".equals(taxInvoiceStatus)) { + //审核通过 + invoiceHistory.setTaxInvoiceStatus(taxInvoiceStatus); + invoiceHistoryMapper.updateFinancialTaxInvoiceHistory(invoiceHistory); + + financialTaxInvoice.setTaxInvoiceStatus(taxInvoiceStatus); + return financialTaxInvoiceMapper.updateFinancialTaxInvoice(financialTaxInvoice); + } else { + //审核拒绝 + invoiceHistory.setTaxInvoiceStatus(taxInvoiceStatus); + invoiceHistoryMapper.updateFinancialTaxInvoiceHistory(invoiceHistory); + + financialTaxInvoice.setTaxInvoiceStatus(taxInvoiceStatus); + return financialTaxInvoiceMapper.updateFinancialTaxInvoice(financialTaxInvoice); + } + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java index ba3d6190..167a7301 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java @@ -22,7 +22,9 @@ import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.erp.domain.ErpMaterialVo; import com.ruoyi.financial.domain.FinancialTaxInvoice; +import com.ruoyi.financial.domain.FinancialTaxInvoiceHistory; import com.ruoyi.financial.service.IFinancialReceivablesService; +import com.ruoyi.financial.service.IFinancialTaxInvoiceHistoryService; import com.ruoyi.financial.service.IFinancialTaxInvoiceService; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.system.domain.*; @@ -101,6 +103,10 @@ public class SysSalesOrderController extends BaseController @Autowired private IFinancialTaxInvoiceService taxInvoiceService; + @Autowired + private IFinancialTaxInvoiceHistoryService invoiceHistoryService; + + @RequiresPermissions("system:salesOrder:view") @GetMapping() public String salesOrder(ModelMap mmap) @@ -623,11 +629,27 @@ public class SysSalesOrderController extends BaseController */ @ResponseBody - @PostMapping("/getSalesOrderCodeChildListByCode") - public TableDataInfo getSalesOrderCodeChildListByCode(@RequestParam("salesOrderCode") String salesOrderCode) + @PostMapping("/getSalesOrderChildListByCode") + public TableDataInfo getSalesOrderChildListByCode(@RequestParam("salesOrderCode") String salesOrderCode) { startPage(); List list = sysSalesOrderChildService.selectOrderChildListBySalesOrderCode(salesOrderCode); return getDataTable(list); } + + + /** + * 查询开票历史记录列表 + */ + + @ResponseBody + @PostMapping("/getInvoiceHistoryListBySalesOrderCode") + public TableDataInfo getInvoiceHistoryListBySalesOrderCode(@RequestParam("salesOrderCode") String salesOrderCode) + { + startPage(); + List list = invoiceHistoryService.selectInvoiceHistoryListBySalesOrderCode(salesOrderCode); + return getDataTable(list); + } + + } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java index 2a6525fd..2c5352db 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java @@ -88,7 +88,7 @@ public class SysCustomer extends BaseEntity /** 税率 */ @Excel(name = "税率") - private String taxRate; + private Double taxRate; /** 诚信评级 */ @Excel(name = "诚信评级") @@ -556,16 +556,15 @@ public class SysCustomer extends BaseEntity { return confirmTax; } - public void setTaxRate(String taxRate) - { - this.taxRate = taxRate; - } - public String getTaxRate() - { + public Double getTaxRate() { return taxRate; } + public void setTaxRate(Double taxRate) { + this.taxRate = taxRate; + } + public Long getDeliveryAddressId() { return deliveryAddressId; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/exportDto/SysCustomerDto.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/exportDto/SysCustomerDto.java index 933d9003..8e9c4ce3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/exportDto/SysCustomerDto.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/exportDto/SysCustomerDto.java @@ -190,7 +190,7 @@ public class SysCustomerDto extends SysCustomer /** 税率 */ @ExcelProperty("税率") - private String taxRate; + private Double taxRate; /** 国家/地区编号 */ @ExcelProperty("国家/地区编号") @@ -574,16 +574,19 @@ public class SysCustomerDto extends SysCustomer { return confirmTax; } - public void setTaxRate(String taxRate) - { - this.taxRate = taxRate; - } - public String getTaxRate() - { + + @Override + public Double getTaxRate() { return taxRate; } - public void setCountryNumber(String countryNumber) + + @Override + public void setTaxRate(Double taxRate) { + this.taxRate = taxRate; + } + + public void setCountryNumber(String countryNumber) { this.countryNumber = countryNumber; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderMapper.java index 5960c0fc..2aac61f5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseOutOrderMapper.java @@ -104,4 +104,9 @@ public interface WarehouseOutOrderMapper * */ WarehouseOutOrder selectWarehouseOutOrderByShippingDeviceId(String shippingDeviceId); + /* + * 根据生产单号查询出库单数据 + * */ + public int sumOutOrderQuantityByMakeNo(String makeNo); + } diff --git a/ruoyi-admin/src/main/resources/FinancialReceiptVoucherTemplate.xlsx b/ruoyi-admin/src/main/resources/FinancialReceiptVoucherTemplate.xlsx new file mode 100644 index 00000000..306bb184 Binary files /dev/null and b/ruoyi-admin/src/main/resources/FinancialReceiptVoucherTemplate.xlsx differ diff --git a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml index 8a497ec5..4fc93874 100644 --- a/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/aftersales/AfterSalesShippingDeviceMapper.xml @@ -124,7 +124,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{snCode} - and material_no = #{materialNo} diff --git a/ruoyi-admin/src/main/resources/mapper/financial/FinancialTaxInvoiceHistoryMapper.xml b/ruoyi-admin/src/main/resources/mapper/financial/FinancialTaxInvoiceHistoryMapper.xml new file mode 100644 index 00000000..9e16e0de --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/financial/FinancialTaxInvoiceHistoryMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + select invoice_history_id, tax_invoice_code, sales_order_code, tax_invoice_status, apply_time, finance_members, invoice_quota_ratio, invoice_amount_rmb, invoice_amount_usd, invoice_purpose, create_by, create_time, update_by, update_time, remark, use_status, del_flag from financial_tax_invoice_history + + + + + + + + + + + + insert into financial_tax_invoice_history + + tax_invoice_code, + sales_order_code, + tax_invoice_status, + apply_time, + finance_members, + invoice_quota_ratio, + invoice_amount_rmb, + invoice_amount_usd, + invoice_purpose, + create_by, + create_time, + update_by, + update_time, + remark, + use_status, + del_flag, + + + #{taxInvoiceCode}, + #{salesOrderCode}, + #{taxInvoiceStatus}, + #{applyTime}, + #{financeMembers}, + #{invoiceQuotaRatio}, + #{invoiceAmountRmb}, + #{invoiceAmountUsd}, + #{invoicePurpose}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + #{useStatus}, + #{delFlag}, + + + + + update financial_tax_invoice_history + + tax_invoice_code = #{taxInvoiceCode}, + sales_order_code = #{salesOrderCode}, + tax_invoice_status = #{taxInvoiceStatus}, + apply_time = #{applyTime}, + finance_members = #{financeMembers}, + invoice_quota_ratio = #{invoiceQuotaRatio}, + invoice_amount_rmb = #{invoiceAmountRmb}, + invoice_amount_usd = #{invoiceAmountUsd}, + invoice_purpose = #{invoicePurpose}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + use_status = #{useStatus}, + del_flag = #{delFlag}, + + where invoice_history_id = #{invoiceHistoryId} + + + + delete from financial_tax_invoice_history where invoice_history_id = #{invoiceHistoryId} + + + + delete from financial_tax_invoice_history where invoice_history_id in + + #{invoiceHistoryId} + + + + + update financial_tax_invoice_history set del_flag = '1' where invoice_history_id = #{invoiceHistoryId} + + + + update financial_tax_invoice_history set del_flag = '0' where invoice_history_id = #{invoiceHistoryId} + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/financial/FinancialTaxInvoiceMapper.xml b/ruoyi-admin/src/main/resources/mapper/financial/FinancialTaxInvoiceMapper.xml index f6f096d5..3545cd82 100644 --- a/ruoyi-admin/src/main/resources/mapper/financial/FinancialTaxInvoiceMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/financial/FinancialTaxInvoiceMapper.xml @@ -36,7 +36,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + @@ -55,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select tax_invoice_id, tax_invoice_code, tax_invoice_status, use_status, sales_order_code, sales_order_number, sales_order_type, tax_invoice_type, tax_invoice_class, tax_invoice_title, business_members, apply_user, enterprise_code, enterprise_name, contact_number, enterprise_address, common_currency, invoice_company_name, invoice_company_code, deposit_bank, bank_account, tax_rate, usd_tax, material_sum, enterprise_sum, noRmbSum, rmbTaxSum, noUsdSum, usdTaxSum, invoice_email, invoice_quota_ratio, invoice_amount, actual_invoice_amount, actual_invoice_amount_rmb, actual_invoice_amount_usd, invoice_purpose, business_remark, invoice_remark, invoice_data, invoice_code, invoice_phone, create_by, create_time, update_by, update_time, remark, del_flag from financial_tax_invoice + select tax_invoice_id, tax_invoice_code, tax_invoice_status, use_status, sales_order_code, sales_order_number, sales_order_type, tax_invoice_type, tax_invoice_class, tax_invoice_title, business_members, apply_user, enterprise_code, enterprise_name, contact_number, enterprise_address, common_currency, invoice_company_name, invoice_company_code, deposit_bank, bank_account, tax_rate, usd_tax, material_sum, enterprise_sum, noRmbSum, rmbTaxSum, noUsdSum, usdTaxSum, invoice_email, invoice_quota_ratio, invoice_amount_rmb, invoice_amount_usd, actual_invoice_amount, actual_invoice_amount_rmb, actual_invoice_amount_usd, invoice_purpose, business_remark, invoice_remark, invoice_data, invoice_code, invoice_phone, create_by, create_time, update_by, update_time, remark, del_flag from financial_tax_invoice - + + + insert into financial_tax_invoice_material diff --git a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderMapper.xml index be21c038..c0b4b63f 100644 --- a/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseOutOrderMapper.xml @@ -102,6 +102,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where shipping_device_id = #{shippingDeviceId} + insert into warehouse_out_order diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/add.html b/ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/add.html index b9df29dc..bdd1cb2f 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/add.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/add.html @@ -331,6 +331,16 @@ field: 'snCode', editable: { type: 'text', // 表示该列可以被编辑为文本 + validate: function(value, row) { + // 检查 SN 号是否已存在 + // var materialNo = row.materialNo; + // checkSnCodeExists(materialNo, value, function(exists) { + // if (!exists) { + // // 如果 SN 号不存在,则返回错误信息 + // return '该SN号不存在!'; + // } + // }); + } }, }, @@ -342,13 +352,13 @@ }, }, { - title: '售后问题', - field: 'adverseReportUrl', - editable: { - type: 'text', // 表示该列可以被编辑为文本 - - // 可以在这里定义更多编辑行为,比如验证、提交等 - }, + // title: '售后问题', + // field: 'adverseReportUrl', + // editable: { + // type: 'text', // 表示该列可以被编辑为文本 + // + // // 可以在这里定义更多编辑行为,比如验证、提交等 + // }, }, { title: '不良报告', @@ -385,7 +395,20 @@ }; $.table.init(options); }) - + function checkSnCodeExists(materialNo,snCode, callback) { + $.ajax({ + url: ctx + 'aftersales/complaintNotice/checkSnCode', + method: 'POST', + data: { materialNo: materialNo,snCode: snCode }, + success: function(response) { + callback(response.exists); // 假设响应中有一个布尔值表示是否存在 + }, + error: function(xhr, status, error) { + console.error(error); + callback(false); // 如果出现错误,默认认为不存在 + } + }); + } function doSubmit(index, layero,uniqueId){ console.log(uniqueId); diff --git a/ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/edit.html b/ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/edit.html index 559c0e95..d2138439 100644 --- a/ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/edit.html +++ b/ruoyi-admin/src/main/resources/templates/aftersales/complaintNotice/edit.html @@ -100,6 +100,7 @@ "materialUnit": item.materialUnit, "materialBrand": item.materialBrand, "materialDescribe": item.materialDescribe, + "shippedGoodsSum": item.shippedGoodsSum, "snCode": item.snCode, "complaintProblem": item.complaintProblem, // "emergencyDegree": item.emergencyDegree, @@ -283,6 +284,10 @@ title: '描述', field: 'materialDescribe', }, + { + title: '已出库数', + field: 'shippedGoodsSum', + }, { title: 'SN号', field: 'snCode', @@ -299,13 +304,18 @@ }, }, { - title: '售后问题', + title: '不良报告', field: 'adverseReportUrl', editable: { type: 'text', // 表示该列可以被编辑为文本 // 可以在这里定义更多编辑行为,比如验证、提交等 }, }, + { + title: '是否结案', + field: 'closingProcedures', + visible: false, + }, { title: '操作', align: 'center', diff --git a/ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html b/ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html index 62c3c562..8d5cbc84 100644 --- a/ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html +++ b/ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html @@ -72,9 +72,9 @@
  • - + - - +
  •  搜索 @@ -89,6 +89,9 @@ 添加应收账款 + + 导出收款凭证 + 导出应收账单 @@ -108,7 +111,6 @@ var currencyTypeDatas = [[${@dict.getType('sys_common_currency')}]]; var financialDeliverStatusDatas = [[${@dict.getType('financial_deliver_status')}]]; var prefix = ctx + "financial/receivables"; - $(function() { var options = { url: prefix + "/list", @@ -119,116 +121,41 @@ restoreUrl: prefix + "/restore/{id}", exportUrl: prefix + "/export", modalName: "财务应收账款", - columns: [{ - checkbox: true - }, - { - title: '财务应收账款id', - field: 'financialReceivablesId', - visible: false - }, - { - title: '应收单号', - field: 'financialReceivablesCode', - }, - { - title: '收款结案状态', - field: 'receivablesClosingStatus', - formatter: function(value, row, index) { - return $.table.selectDictLabel(receivablesClosingStatusDatas, value); - } - }, - { - title: '关联单号', - field: 'salesOrderCode', - }, - { - title: '贷方科目', - field: 'creditAccount', - }, - { - title: '贷方明细', - field: 'creditDetail', - }, - { - title: '开户银行', - field: 'openBank', - }, - { - title: '开户账号', - field: 'openAccount', - }, - { - title: '客户ID', - field: 'customerId', - }, - { - title: '合同编号', - field: 'contractNumber', - }, - { - title: '币种', - field: 'currencyType', - formatter: function(value, row, index) { - return $.table.selectDictLabel(currencyTypeDatas, value); - } - }, - { - title: '不含税金额', - field: 'priceExcludingTax', - }, - { - title: '含税金额', - field: 'priceIncludesTax', - }, - { - title: '付款条件', - field: 'paymentCondition', - }, - { - title: '实收含税金额', - field: 'receivedIncludesTax', - }, - { - title: '未收含税金额', - field: 'notReceivedIncludesTax', - }, - { - title: '业务员', - field: 'businessMembers', - }, - { - title: '发货状态', - field: 'financialDeliverStatus', - formatter: function(value, row, index) { - return $.table.selectDictLabel(financialDeliverStatusDatas, value); - } - }, - { - title: '录入时间', - field: 'createTime', - }, - { - title: '更新人', - field: 'updateBy', - }, - { - title: '上次更新时间', - field: 'updateTime', - }, - { - title: '操作', - align: 'center', - formatter: function(value, row, index) { - var actions = []; - actions.push('创建收款凭证 '); - if (row.receivablesClosingStatus !== '2') { - actions.push('结案 '); + columns: [ + {checkbox: true}, + {title: '财务应收账款id', field: 'financialReceivablesId', visible: false}, + {title: '应收单号', field: 'financialReceivablesCode',}, + {title: '收款结案状态', field: 'receivablesClosingStatus', formatter: function(value, row, index) {return $.table.selectDictLabel(receivablesClosingStatusDatas, value);}}, + {title: '关联单号', field: 'salesOrderCode',}, + {title: '贷方科目', field: 'creditAccount',}, + {title: '贷方明细', field: 'creditDetail',}, + {title: '开户银行', field: 'openBank',}, + {title: '开户账号', field: 'openAccount',}, + {title: '客户ID', field: 'customerId',}, + {title: '合同编号', field: 'contractNumber',}, + {title: '币种', field: 'currencyType', formatter: function(value, row, index) {return $.table.selectDictLabel(currencyTypeDatas, value);}}, + {title: '不含税金额', field: 'priceExcludingTax',}, + {title: '含税金额', field: 'priceIncludesTax',}, + {title: '付款条件', field: 'paymentCondition',}, + {title: '实收含税金额', field: 'receivedIncludesTax',}, + {title: '未收含税金额', field: 'notReceivedIncludesTax',}, + {title: '业务员', field: 'businessMembers',}, + {title: '发货状态', field: 'financialDeliverStatus', formatter: function(value, row, index) {return $.table.selectDictLabel(financialDeliverStatusDatas, value);}}, + {title: '录入时间', field: 'createTime',}, + {title: '更新人', field: 'updateBy',}, + {title: '上次更新时间', field: 'updateTime',}, + {title: '操作', align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('创建收款凭证 '); + if (row.receivablesClosingStatus !== '2') { + actions.push('结案 '); + } + actions.push('详情 '); + return actions.join(''); } - actions.push('详情 '); - return actions.join(''); } - }] + ] }; $.table.init(options); }); @@ -286,6 +213,17 @@ } }); } + + //导出应收款账单收款凭证,单个导出 + function exportReceivablesVoucher() { + var bootstrpa = $("#bootstrap-table").bootstrapTable('getSelections'); + var financialReceivablesId = bootstrpa[0].financialReceivablesId; + if (bootstrpa.length !== 1) { + $.modal.alertWarning("请选择一条数据"); + return; + } + window.location.href = ctx + "financial/receivables/excelReceivablesVoucher/" + financialReceivablesId; + } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRMB.html b/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRMB.html new file mode 100644 index 00000000..4b31eb8d --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRMB.html @@ -0,0 +1,342 @@ + + + + + + + +
    +
    + + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + % +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    + + +
    + +
    +
    + + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +

    开票物料

    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +

    开票额度

    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + % +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    +
    + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUSD.html b/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUSD.html new file mode 100644 index 00000000..720f89c2 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUSD.html @@ -0,0 +1,337 @@ + + + + + + + +
    +
    + + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + % +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    + + +
    + +
    +
    + + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +

    开票物料

    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +

    开票额度

    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + % +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    +
    + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/taxInvoice.html b/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/taxInvoice.html index 242e2de3..12df03f4 100644 --- a/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/taxInvoice.html +++ b/ruoyi-admin/src/main/resources/templates/financial/taxInvoice/taxInvoice.html @@ -99,25 +99,22 @@ \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html index 57039a5c..21ce9766 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceRMB.html @@ -25,13 +25,15 @@
    -
    - - -
    +
    + + +
    @@ -89,7 +91,10 @@
    +
    + % +
    @@ -174,7 +179,7 @@
    - +
    @@ -194,16 +199,16 @@
    - + %
    - +
    - +
    @@ -213,9 +218,6 @@
    - - - @@ -224,6 +226,7 @@ var materialProcessMethodDatas = [[${@dict.getType('processMethod')}]]; var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; + var taxInvoiceStatusDatas = [[${@dict.getType('tax_invoice_status')}]]; var taxInvoice = [[${taxInvoice}]]; @@ -273,11 +276,11 @@ } - + //开票物料 $(function() { var options = { id: 'bootstrap-table-material', - url: prefix + "/getSalesOrderCodeChildListByCode", + url: prefix + "/getSalesOrderChildListByCode", queryParams: function(params) { return { salesOrderCode: $("#salesOrderCode").val(), @@ -364,6 +367,84 @@ }); + //开票历史 + $(function() { + var options = { + id: 'bootstrap-table-history', + url: prefix + "/getInvoiceHistoryListBySalesOrderCode", + queryParams: function(params) { + return { + salesOrderCode: $("#salesOrderCode").val(), + } + }, + showSearch: false, + showRefresh: false, + showToggle: false, + showColumns: false, + pagination: false, // 设置不分页 + modalName: "国税发票历史记录", + columns: [{ + checkbox: true + }, + { + title: '国税发票历史id', + field: 'invoiceHistoryId', + visible: false + }, + { + title: '申请时间', + field: 'applyTime', + }, + { + title: '国税发票单号', + field: 'taxInvoiceCode', + }, + { + title: '开票额度比例', + field: 'invoiceQuotaRatio', + formatter: function (value,row,index){ + if (value == null || value == ''){ + return '/'; + }else{ + return value + "%"; + } + } + }, + { + title: '开票金额(RMB)', + field: 'invoiceAmountRmb', + }, + + { + title: '开票用途', + field: 'invoicePurpose', + }, + { + title: '发票状态', //(0待审核、1待开具、2已开具、3审核拒绝) + field: 'taxInvoiceStatus', + formatter: function(value, row, index) { + return $.table.selectDictLabel(taxInvoiceStatusDatas, value); + } + }, + { + title: '财务员', + field: 'financeMembers', + }, + { + title: '操作', + align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('详情 '); + return actions.join(''); + } + }] + }; + $.table.init(options); + }); + + + //获取客户发票信息 $(document).ready(function() { @@ -407,6 +488,7 @@ $('input[name="invoiceCompanyCode"]').val(details.invoiceCompanyCode); $('input[name="depositBank"]').val(details.depositBank); $('input[name="bankAccount"]').val(details.bankAccount); + $('input[name="taxRate"]').val(details.taxRate); } // 封装清空发票详情的函数 @@ -414,6 +496,7 @@ $('input[name="invoiceCompanyCode"]').val(''); $('input[name="depositBank"]').val(''); $('input[name="bankAccount"]').val(''); + $('input[name="taxRate"]').val(''); } @@ -457,6 +540,29 @@ } + + //通过监听额度比例输入框的值,动态计算开票金额 + $(document).ready(function() { + + var invoiceAmountRmbInput = $('#invoiceAmountRmbInput'); + var invoiceQuotaRatioInput = $('#invoiceQuotaRatioInput'); + var rmbTaxSumInput = $('#rmbTaxSumInput'); + + //监听开票额度比例输入框的变化 + invoiceQuotaRatioInput.on('input', function() { + var rmbTaxSum = parseFloat(rmbTaxSumInput.val()); + var invoiceQuotaRatio = parseFloat($(this).val()); + if (!isNaN(rmbTaxSum) && !isNaN(invoiceQuotaRatio)) { + //计算开票金额 = 税前总额 * 开票比例 + var invoiceAmountRmb = rmbTaxSum * (invoiceQuotaRatio / 100); + //更新开票金额输入框 + invoiceAmountRmbInput.val(invoiceAmountRmb.toFixed(2)); + } else { + invoiceAmountRmbInput.val(''); + } + }); + }); + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceUSD.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceUSD.html new file mode 100644 index 00000000..d236090d --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/makeInvoiceUSD.html @@ -0,0 +1,566 @@ + + + + + + + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + + + + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + % +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    + +
    + +
    +
    + + +
    +
    +
    + + +
    + +
    +
    + + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +

    开票物料

    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +

    开票历史

    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +

    开票额度

    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + % +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    + + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html index ea52f23d..a246d4aa 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html @@ -419,22 +419,29 @@ // 定义状态码常量 const AUDIT_STATUS_APPROVED = "1";//审核通过 const INVOICE_ALLOWED = "1";//允许开票 + const DELETE_FLAG = "2"; //作废 // 检查是否选择了恰好一行数据 if (selectedRows.length === 1) { const row = selectedRows[0]; - // 检查是否已审核 - if (row.auditStatus === AUDIT_STATUS_APPROVED) { - // 检查是否允许开票 - if (row.invoice === INVOICE_ALLOWED) { - const invoiceUrl = prefix + "/makeInvoice/" + row.salesOrderId; - $.modal.open("开票", invoiceUrl); + // 检查是否已作废 + if (row.useStatus === DELETE_FLAG) { + showWarning("该订单已作废"); + + }else { + // 检查是否已审核 + if (row.auditStatus === AUDIT_STATUS_APPROVED) { + // 检查是否允许开票 + if (row.invoice === INVOICE_ALLOWED) { + const invoiceUrl = prefix + "/makeInvoice/" + row.salesOrderId; + $.modal.open("开票", invoiceUrl); + } else { + showWarning("该订单不允许开票"); + } } else { - showWarning("该订单不允许开票"); + showWarning("请先审核"); } - } else { - showWarning("请先审核"); } } else { showWarning("请先选择一条销售订单");