From caec1d4bd0de590690afae07c1c776b87491e563 Mon Sep 17 00:00:00 2001 From: chenhao Date: Wed, 31 Dec 2025 17:08:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(finance):=20=E6=96=B0=E5=A2=9E=E8=B4=A2?= =?UTF-8?q?=E5=8A=A1=E8=AE=A1=E6=94=B6=E6=A8=A1=E5=9D=97=E5=B9=B6=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增财务计收API接口文件,包含查询、新增、修改、删除等操作 - 创建财务计收页面组件,实现列表展示、搜索、导出等功能 - 配置财务计收路由,添加菜单权限控制 - 在订单页面添加申请计收按钮,实现订单与计收关联 - 完善库存发货服务,在发货完成时自动创建计收数据 - 新增财务计收相关实体类、服务接口和数据访问层 - 添加库存信息按订单编号查询功能 - 修复内部库存页面数量验证逻辑问题 - 优化发货表单中序列号列表加载时机 --- oms_web/oms_vue/src/api/finance/charge.js | 72 +++ oms_web/oms_vue/src/router/index.js | 7 + .../src/views/finance/charge/index.vue | 280 ++++++++++++ .../src/views/inventory/inner/index.vue | 2 +- .../outer/components/GenerateDeliveryForm.vue | 2 + .../oms_vue/src/views/project/order/index.vue | 10 + .../src/views/project/order/orderFinance.vue | 38 ++ .../OmsFinanceChargeController.java | 131 ++++++ .../com/ruoyi/sip/domain/InventoryInfo.java | 1 + .../ruoyi/sip/domain/OmsFinanceCharge.java | 125 ++++++ .../com/ruoyi/sip/domain/ProductInfo.java | 1 + .../ruoyi/sip/domain/ProjectOrderInfo.java | 6 + .../ruoyi/sip/mapper/InventoryInfoMapper.java | 2 + .../sip/mapper/OmsFinanceChargeMapper.java | 68 +++ .../sip/mapper/OmsPayableBillMapper.java | 5 + .../sip/service/IInventoryInfoService.java | 2 + .../sip/service/IOmsFinanceChargeService.java | 69 +++ .../sip/service/IOmsPayableBillService.java | 5 + .../impl/InventoryDeliveryServiceImpl.java | 12 +- .../impl/InventoryInfoServiceImpl.java | 5 + .../impl/OmsFinanceChargeServiceImpl.java | 253 +++++++++++ .../impl/OmsInventoryInnerServiceImpl.java | 10 +- .../impl/OmsPayableBillServiceImpl.java | 17 + .../mapper/finance/OmsFinanceChargeMapper.xml | 413 ++++++++++++++++++ .../mapper/finance/OmsPayableBillMapper.xml | 17 + .../mapper/inventory/InventoryInfoMapper.xml | 13 +- .../mapper/sip/ProjectOrderInfoMapper.xml | 2 + 27 files changed, 1563 insertions(+), 5 deletions(-) create mode 100644 oms_web/oms_vue/src/api/finance/charge.js create mode 100644 oms_web/oms_vue/src/views/finance/charge/index.vue create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/controller/OmsFinanceChargeController.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OmsFinanceCharge.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsFinanceChargeMapper.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsFinanceChargeService.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsFinanceChargeServiceImpl.java create mode 100644 ruoyi-sip/src/main/resources/mapper/finance/OmsFinanceChargeMapper.xml diff --git a/oms_web/oms_vue/src/api/finance/charge.js b/oms_web/oms_vue/src/api/finance/charge.js new file mode 100644 index 00000000..354b963b --- /dev/null +++ b/oms_web/oms_vue/src/api/finance/charge.js @@ -0,0 +1,72 @@ +import request from '@/utils/request' + +// 查询财务计收列表 +export function listCharge(query) { + return request({ + url: '/finance/charge/list', + method: 'get', + params: query + }) +} + +// 查询财务计收详细 +export function getCharge(id) { + return request({ + url: '/finance/charge/' + id, + method: 'get' + }) +} + +// 新增财务计收 +export function addCharge(data) { + return request({ + url: '/finance/charge', + method: 'post', + data: data + }) +} + +// 修改财务计收 +export function updateCharge(data) { + return request({ + url: '/finance/charge', + method: 'put', + data: data + }) +} +export function revokeCharge(data) { + return request({ + url: '/finance/charge/revoke', + method: 'put', + data: data + }) +} + +// 删除财务计收 +export function delCharge(id) { + return request({ + url: '/finance/charge/' + id, + method: 'delete' + }) +} +export function applyChargeBiz(data) { + return request({ + url: '/finance/charge/applyBiz' , + method: 'put', + data + }) +} +export function returnApplyBiz(data) { + return request({ + url: '/finance/charge/returnApplyBiz' , + method: 'put', + data + }) +} +export function applyCharge(data) { + return request({ + url: '/finance/charge/apply' , + method: 'put', + data + }) +} diff --git a/oms_web/oms_vue/src/router/index.js b/oms_web/oms_vue/src/router/index.js index db6984e1..33829094 100644 --- a/oms_web/oms_vue/src/router/index.js +++ b/oms_web/oms_vue/src/router/index.js @@ -214,6 +214,13 @@ export const dynamicRoutes = [ component: () => import('@/views/finance/payment/index'), name: 'Payment', meta: { title: '付款单', icon: 'form' } + }, + { + path: 'charge', + component: () => import('@/views/finance/charge/index'), + name: 'Charge', + meta: { title: '财务计收', icon: 'money' }, + permissions: ['finance:charge:list'] } ] }, diff --git a/oms_web/oms_vue/src/views/finance/charge/index.vue b/oms_web/oms_vue/src/views/finance/charge/index.vue new file mode 100644 index 00000000..bafc18a4 --- /dev/null +++ b/oms_web/oms_vue/src/views/finance/charge/index.vue @@ -0,0 +1,280 @@ + + + diff --git a/oms_web/oms_vue/src/views/inventory/inner/index.vue b/oms_web/oms_vue/src/views/inventory/inner/index.vue index 43d06e24..99854442 100644 --- a/oms_web/oms_vue/src/views/inventory/inner/index.vue +++ b/oms_web/oms_vue/src/views/inventory/inner/index.vue @@ -541,7 +541,7 @@ export default { this.$modal.msgWarning("请至少添加一条产品信息"); return; } - if (this.form.quantity!==this.form.inventoryInfoList.length){ + if (this.form.quantity!==this.form.inventoryInfoList.length && !this.isServiceIn){ this.$modal.msgWarning("采购数量与入库数量不一致"); return; } diff --git a/oms_web/oms_vue/src/views/inventory/outer/components/GenerateDeliveryForm.vue b/oms_web/oms_vue/src/views/inventory/outer/components/GenerateDeliveryForm.vue index 25822be2..c775702b 100644 --- a/oms_web/oms_vue/src/views/inventory/outer/components/GenerateDeliveryForm.vue +++ b/oms_web/oms_vue/src/views/inventory/outer/components/GenerateDeliveryForm.vue @@ -156,7 +156,9 @@ export default { this.queryParams.pageSize = productRow.quantity - productRow.deliveryGenerateQuantity - productRow.deliveryConfirmQuantity; this.isInitialLoad = true; + this.$nextTick(() => { this.getSnList(); + }) this.visible = true; }, getSnList() { diff --git a/oms_web/oms_vue/src/views/project/order/index.vue b/oms_web/oms_vue/src/views/project/order/index.vue index ecff0c7b..fe16834e 100644 --- a/oms_web/oms_vue/src/views/project/order/index.vue +++ b/oms_web/oms_vue/src/views/project/order/index.vue @@ -120,6 +120,7 @@ 编辑 删除 + 申请计收 @@ -142,6 +143,7 @@ import { listOrder, delOrder, exportOrder } from "@/api/project/order"; import OrderDetail from './OrderDetail.vue'; import OrderDetailDrawer from './OrderDetailDrawer.vue'; import ProjectDetailDrawer from '../info/ProjectDetailDrawer.vue'; +import {applyChargeBiz} from "@/api/finance/charge"; export default { name: "Order", @@ -235,6 +237,14 @@ export default { this.queryParams.pageNum = 1; this.getList(); }, + applyCharge(row){ + applyChargeBiz({orderCode:row.orderCode}).then(response => { + this.$message.success("申请计收成功"); + this.getList(); + }).catch(error => { + this.$message.error("申请计收失败"); + }); + }, /** 重置按钮操作 */ resetQuery() { this.dateRange = []; diff --git a/oms_web/oms_vue/src/views/project/order/orderFinance.vue b/oms_web/oms_vue/src/views/project/order/orderFinance.vue index bea9cd11..3cbb6a9e 100644 --- a/oms_web/oms_vue/src/views/project/order/orderFinance.vue +++ b/oms_web/oms_vue/src/views/project/order/orderFinance.vue @@ -150,6 +150,13 @@ + + + + + @@ -183,6 +204,7 @@ import { listOrder, updateFinanceStatus } from "@/api/project/order"; import ProjectDetailDrawer from '../info/ProjectDetailDrawer.vue'; import OrderDetailDrawer from './OrderDetailDrawer.vue'; +import {applyCharge, returnApplyBiz} from "@/api/finance/charge"; export default { name: "OrderFinance", @@ -243,6 +265,22 @@ export default { this.getList(); }, methods: { + handleApplyCharge(row){ + applyCharge({orderCode:row.orderCode}).then(response => { + this.$message.success("计收成功"); + this.getList(); + }).catch(error => { + this.$message.error("计收失败"); + }) + }, + handleApplyChargeBack(row){ + returnApplyBiz({orderCode:row.orderCode}).then(response => { + this.$message.success("申请计收退回成功"); + this.getList(); + }).catch(error => { + this.$message.error("申请计收退回失败"); + }) + }, /** 查询订单管理列表 */ getList() { this.loading = true; diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/OmsFinanceChargeController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/OmsFinanceChargeController.java new file mode 100644 index 00000000..758a1d1d --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/OmsFinanceChargeController.java @@ -0,0 +1,131 @@ +package com.ruoyi.sip.controller; + +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.sip.domain.OmsFinanceCharge; +import com.ruoyi.sip.service.IOmsFinanceChargeService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 财务计收Controller + * + * @author ruoyi + * @date 2025-12-30 + */ +@RestController +@RequestMapping("/finance/charge") +public class OmsFinanceChargeController extends BaseController +{ + @Autowired + private IOmsFinanceChargeService omsFinanceChargeService; + + /** + * 查询财务计收列表 + */ + @RequiresPermissions("finance:charge:list") + @GetMapping("/list") + public TableDataInfo list(OmsFinanceCharge omsFinanceCharge) + { + startPage(); + List list = omsFinanceChargeService.selectOmsFinanceChargeList(omsFinanceCharge); + return getDataTable(list); + } + + /** + * 导出财务计收列表 + */ + @RequiresPermissions("finance:charge:export") + @Log(title = "财务计收", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, OmsFinanceCharge omsFinanceCharge) + { + List list = omsFinanceChargeService.selectOmsFinanceChargeList(omsFinanceCharge); + ExcelUtil util = new ExcelUtil(OmsFinanceCharge.class); + util.exportExcel(response, list, "财务计收数据"); + } + + /** + * 获取财务计收详细信息 + */ + + @RequiresPermissions("finance:charge:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(omsFinanceChargeService.selectOmsFinanceChargeById(id)); + } + + /** + * 新增财务计收 + */ + @RequiresPermissions("finance:charge:add") + @Log(title = "财务计收", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody OmsFinanceCharge omsFinanceCharge) + { + return toAjax(omsFinanceChargeService.insertOmsFinanceCharge(omsFinanceCharge)); + } + + /** + * 修改财务计收 + */ + @RequiresPermissions("finance:charge:edit") + @Log(title = "财务计收", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody OmsFinanceCharge omsFinanceCharge) + { + return toAjax(omsFinanceChargeService.updateOmsFinanceCharge(omsFinanceCharge)); + } + @RequiresPermissions("finance:charge:edit") + @Log(title = "申请计收", businessType = BusinessType.UPDATE) + @PutMapping("applyBiz") + public AjaxResult applyBiz(@RequestBody OmsFinanceCharge omsFinanceCharge) + { + omsFinanceCharge.setChargeStatus(OmsFinanceCharge.ChargeStatusEnum.APPLY_CHARGE.getCode()); + omsFinanceCharge.setBizChargeDate(DateUtils.getNowDate()); + return toAjax(omsFinanceChargeService.updateOmsFinanceChargeByOrderCode(omsFinanceCharge)); + } + @RequiresPermissions("finance:charge:edit") + @Log(title = "退回申请计收", businessType = BusinessType.UPDATE) + @PutMapping("returnApplyBiz") + public AjaxResult returnApplyBiz(@RequestBody OmsFinanceCharge omsFinanceCharge) + { + omsFinanceCharge.setChargeStatus(OmsFinanceCharge.ChargeStatusEnum.WAIT_APPLY_CHARGE.getCode()); + return toAjax(omsFinanceChargeService.returnApplyBiz(omsFinanceCharge)); + } + @RequiresPermissions("finance:charge:edit") + @Log(title = "财务计收", businessType = BusinessType.UPDATE) + @PutMapping("apply") + public AjaxResult completedCharge(@RequestBody OmsFinanceCharge omsFinanceCharge) + { + + return toAjax(omsFinanceChargeService.completedCharge(omsFinanceCharge)); + } + + /** + * 删除财务计收 + */ + @RequiresPermissions("finance:charge:remove") + @Log(title = "财务计收", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(omsFinanceChargeService.deleteOmsFinanceChargeByIds(ids)); + } + @Log(title = "财务计收", businessType = BusinessType.DELETE) + @PutMapping("/revoke") + public AjaxResult revoke(@RequestBody OmsFinanceCharge omsFinanceCharge) + { + return toAjax(omsFinanceChargeService.revoke(omsFinanceCharge)); + } +} \ No newline at end of file diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/InventoryInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/InventoryInfo.java index 86567599..43f69b1f 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/InventoryInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/InventoryInfo.java @@ -64,6 +64,7 @@ public class InventoryInfo extends BaseEntity /** 出库价 */ @Excel(name = "出库价") private BigDecimal outerPrice; + private String productType; @Getter public enum InventoryStatusEnum { diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OmsFinanceCharge.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OmsFinanceCharge.java new file mode 100644 index 00000000..a9cd6d4e --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OmsFinanceCharge.java @@ -0,0 +1,125 @@ +package com.ruoyi.sip.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.Getter; +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; + +/** + * 财务计收对象 oms_finance_charge + * + * @author ruoyi + * @date 2025-12-30 + */ +@Data +public class OmsFinanceCharge extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 订单编号 */ + @Excel(name = "订单编号") + private String orderCode; + + /** 业务计收时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "业务计收时间", width = 15, dateFormat = "yyyy-MM-dd") + private Date bizChargeDate; + + /** 财务计收时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "财务计收时间", width = 15, dateFormat = "yyyy-MM-dd") + private Date financeChargeDate; + + /** 收入-含税总价 */ + @Excel(name = "收入-含税总价") + private BigDecimal incomeWithTaxTotal; + + /** 收入-未税总价 */ + @Excel(name = "收入-未税总价") + private BigDecimal incomeWithoutTaxTotal; + + /** 成本-软件未税总价 */ + @Excel(name = "成本-软件未税总价") + private BigDecimal costSoftwareWithoutTax; + + /** 成本-软件含税总价 */ + @Excel(name = "成本-软件含税总价") + private BigDecimal costSoftwareWithTax; + + /** 成本-硬件未税总价 */ + @Excel(name = "成本-硬件未税总价") + private BigDecimal costHardwareWithoutTax; + + /** 成本-硬件含税总价 */ + @Excel(name = "成本-硬件含税总价") + private BigDecimal costHardwareWithTax; + + /** 成本-软件维保未税总价 */ + @Excel(name = "成本-软件维保未税总价") + private BigDecimal costSoftwareMaintWithoutTax; + + /** 成本-软件维保含税总价 */ + @Excel(name = "成本-软件维保含税总价") + private BigDecimal costSoftwareMaintWithTax; + + /** 成本-硬件维保未税总价 */ + @Excel(name = "成本-硬件维保未税总价") + private BigDecimal costHardwareMaintWithoutTax; + + /** 成本-硬件维保含税总价 */ + @Excel(name = "成本-硬件维保含税总价") + private BigDecimal costHardwareMaintWithTax; + + /** 成本-省代服务含税总价 */ + @Excel(name = "成本-省代服务含税总价") + private BigDecimal costProvinceServiceWithTax; + + /** 成本-省代服务未税总价 */ + @Excel(name = "成本-省代服务未税总价") + private BigDecimal costProvinceServiceWithoutTax; + + /** 成本-其它含税总价 */ + @Excel(name = "成本-其它含税总价") + private BigDecimal costOtherWithTax; + + /** 成本-其它未税总价 */ + @Excel(name = "成本-其它未税总价") + private BigDecimal costOtherWithoutTax; + + /** 备注 */ + @Excel(name = "备注") + private String remark; + + /** 计收状态 0:等待收款完成 1:可申请计收 2:已申请计收 3:已完成计收 */ + @Excel(name = "计收状态", readConverterExp = "0=等待收款完成,1=可申请计收,2=已申请计收,3=已完成计收") + private String chargeStatus; + @Getter + public enum ChargeStatusEnum { + + /** 付款单 */ + WAIT_RECEIPT("0", "等待收款"), + WAIT_APPLY_CHARGE("1", "可申请计收"), + APPLY_CHARGE("2", "已申请计收"), + COMPLETE_CHARGE("3", "已完成计收"), + + + + + ; + private final String code; + private final String desc; + ChargeStatusEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + } + +} \ No newline at end of file diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProductInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProductInfo.java index e855d6d0..71993267 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProductInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProductInfo.java @@ -91,6 +91,7 @@ public class ProductInfo extends BaseEntity * 硬件维保 */ HARDWARE_MAINTENANCE("22","硬件维保"), + PROVINCE_SERVICE("70", "省代服务"), /** * 其它 */ diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectOrderInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectOrderInfo.java index 6984418f..0927c36b 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectOrderInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/ProjectOrderInfo.java @@ -167,6 +167,10 @@ public class ProjectOrderInfo extends BaseEntity { @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @Excel(name = "执行单有效截止时间", width = 30, dateFormat = "yyyy-MM-dd") private Date orderEndTime; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date bizChargeDate; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date financeChargeDate; private Date orderEndTimeStart; private Date orderEndTimeEnd; private Date updateTimeStart; @@ -253,6 +257,8 @@ public class ProjectOrderInfo extends BaseEntity { private String approve; private String approveLog; private String approveNode; + //计收状态 + private String chargeStatus; /** * 付款方式 diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/InventoryInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/InventoryInfoMapper.java index a95e9d0d..2acfdc06 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/InventoryInfoMapper.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/InventoryInfoMapper.java @@ -77,4 +77,6 @@ public interface InventoryInfoMapper List listByProductSnList(List productSnList); List listByDeliveryId(Long id); + + List selectInventoryInfoByOrderCode(List strings); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsFinanceChargeMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsFinanceChargeMapper.java new file mode 100644 index 00000000..9d81bbb5 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsFinanceChargeMapper.java @@ -0,0 +1,68 @@ +package com.ruoyi.sip.mapper; + +import java.util.List; +import com.ruoyi.sip.domain.OmsFinanceCharge; + +/** + * 财务计收Mapper接口 + * + * @author ruoyi + * @date 2025-12-30 + */ +public interface OmsFinanceChargeMapper +{ + /** + * 查询财务计收 + * + * @param id 财务计收主键 + * @return 财务计收 + */ + public OmsFinanceCharge selectOmsFinanceChargeById(Long id); + + /** + * 查询财务计收列表 + * + * @param omsFinanceCharge 财务计收 + * @return 财务计收集合 + */ + public List selectOmsFinanceChargeList(OmsFinanceCharge omsFinanceCharge); + + /** + * 新增财务计收 + * + * @param omsFinanceCharge 财务计收 + * @return 结果 + */ + public int insertOmsFinanceCharge(OmsFinanceCharge omsFinanceCharge); + + /** + * 修改财务计收 + * + * @param omsFinanceCharge 财务计收 + * @return 结果 + */ + public int updateOmsFinanceCharge(OmsFinanceCharge omsFinanceCharge); + + /** + * 删除财务计收 + * + * @param id 财务计收主键 + * @return 结果 + */ + public int deleteOmsFinanceChargeById(Long id); + + /** + * 批量删除财务计收 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteOmsFinanceChargeByIds(Long[] ids); + + int updateOmsFinanceChargeByOrderCode(OmsFinanceCharge omsFinanceCharge); + + int returnApplyBiz(OmsFinanceCharge omsFinanceCharge); + + int revoke(OmsFinanceCharge omsFinanceCharge); + +} \ No newline at end of file diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsPayableBillMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsPayableBillMapper.java index cc589a7a..2a6e399e 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsPayableBillMapper.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OmsPayableBillMapper.java @@ -70,4 +70,9 @@ public interface OmsPayableBillMapper Integer selectMaxCodeByPrefix(String codePrefix); int updateBatchPayableBillTicketInfo(List omsPayableBills); + + List checkDelete(List inventoryCodeList); + + void deleteByInventoryCode(List inventoryCodeList); + } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IInventoryInfoService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IInventoryInfoService.java index f468e3e9..bc3ca79e 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IInventoryInfoService.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IInventoryInfoService.java @@ -87,4 +87,6 @@ public interface IInventoryInfoService void recallByOrderCode(List orderCode); List listByDeliveryId(Long id); + + List selectInventoryInfoByOrderCode(List strings); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsFinanceChargeService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsFinanceChargeService.java new file mode 100644 index 00000000..3ed3ee3c --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsFinanceChargeService.java @@ -0,0 +1,69 @@ +package com.ruoyi.sip.service; + +import java.util.List; +import com.ruoyi.sip.domain.OmsFinanceCharge; + +/** + * 财务计收Service接口 + * + * @author ruoyi + * @date 2025-12-30 + */ +public interface IOmsFinanceChargeService +{ + /** + * 查询财务计收 + * + * @param id 财务计收主键 + * @return 财务计收 + */ + public OmsFinanceCharge selectOmsFinanceChargeById(Long id); + + /** + * 查询财务计收列表 + * + * @param omsFinanceCharge 财务计收 + * @return 财务计收集合 + */ + public List selectOmsFinanceChargeList(OmsFinanceCharge omsFinanceCharge); + + /** + * 新增财务计收 + * + * @param omsFinanceCharge 财务计收 + * @return 结果 + */ + public int insertOmsFinanceCharge(OmsFinanceCharge omsFinanceCharge); + + /** + * 修改财务计收 + * + * @param omsFinanceCharge 财务计收 + * @return 结果 + */ + public int updateOmsFinanceCharge(OmsFinanceCharge omsFinanceCharge); + + /** + * 批量删除财务计收 + * + * @param ids 需要删除的财务计收主键集合 + * @return 结果 + */ + public int deleteOmsFinanceChargeByIds(Long[] ids); + + /** + * 删除财务计收信息 + * + * @param id 财务计收主键 + * @return 结果 + */ + public int deleteOmsFinanceChargeById(Long id); + + int updateOmsFinanceChargeByOrderCode(OmsFinanceCharge omsFinanceCharge); + + int completedCharge(OmsFinanceCharge omsFinanceCharge); + + int returnApplyBiz(OmsFinanceCharge omsFinanceCharge); + + int revoke(OmsFinanceCharge omsFinanceCharge); +} \ No newline at end of file diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsPayableBillService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsPayableBillService.java index 67997dd0..3cbf9f76 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsPayableBillService.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IOmsPayableBillService.java @@ -82,4 +82,9 @@ public interface IOmsPayableBillService public int updateTicketAmount(List idList); OmsPayableBill query(Long id); + + List checkDelete(List collect); + + void deleteByInventoryCode(List collect); + } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.java index 5ae29af9..c1f7aa2f 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.java @@ -55,7 +55,8 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService { @Autowired @Lazy private IVendorInfoService vendorInfoService; - + @Autowired + private IOmsFinanceChargeService omsFinanceChargeService; @Autowired private IOmsInventoryDeliveryDetailService deliveryDetailService; @Autowired @@ -229,6 +230,15 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService { updateOrder.setUpdateBy(ShiroUtils.getUserId().toString()); updateOrder.setDeliveryStatus(sum == allSum ? ProjectOrderInfo.DeliveryStatusEnum.ALL_DELIVERY.getCode() : ProjectOrderInfo.DeliveryStatusEnum.PART_DELIVERY.getCode()); projectOrderInfoService.updateProjectOrderInfoByCode(updateOrder); + //新增计收数据 + if (sum==allSum){ + //新增计收数据 + OmsFinanceCharge omsFinanceCharge = new OmsFinanceCharge(); + omsFinanceCharge.setOrderCode(inventoryDelivery.getOrderCode()); + omsFinanceCharge.setChargeStatus(OmsFinanceCharge.ChargeStatusEnum.WAIT_RECEIPT.getCode()); + omsFinanceCharge.setCreateBy(ShiroUtils.getUserId().toString()); + omsFinanceChargeService.insertOmsFinanceCharge(omsFinanceCharge); + } //修改累计发货数量 productInfoService.updateCumulativeCount(outerSum, inventoryDelivery.getProductCode()); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryInfoServiceImpl.java index a2fdbd93..5780175f 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryInfoServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryInfoServiceImpl.java @@ -212,5 +212,10 @@ public class InventoryInfoServiceImpl implements IInventoryInfoService { return inventoryInfoMapper.listByDeliveryId(id); } + @Override + public List selectInventoryInfoByOrderCode(List strings) { + return inventoryInfoMapper.selectInventoryInfoByOrderCode(strings); + } + } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsFinanceChargeServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsFinanceChargeServiceImpl.java new file mode 100644 index 00000000..c4e34989 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsFinanceChargeServiceImpl.java @@ -0,0 +1,253 @@ +package com.ruoyi.sip.service.impl; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Collectors; + +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.sip.domain.*; +import com.ruoyi.sip.mapper.OmsInventoryInnerMapper; +import com.ruoyi.sip.service.*; +import org.apache.shiro.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import com.ruoyi.sip.mapper.OmsFinanceChargeMapper; + +/** + * 财务计收Service业务层处理 + * + * @author ruoyi + * @date 2025-12-30 + */ +@Service +public class OmsFinanceChargeServiceImpl implements IOmsFinanceChargeService { + @Autowired + private OmsFinanceChargeMapper omsFinanceChargeMapper; + + @Autowired + private IProjectProductInfoService projectProductInfoService; + + @Autowired + private IOmsPayableBillService payableBillService; + @Autowired + private OmsInventoryInnerMapper innerMapper; + @Autowired + private IInventoryInfoService inventoryInfoService; + @Value("${oms.inventory.innerTax:0.13}") + private String defaultTax; + + /** + * 查询财务计收 + * + * @param id 财务计收主键 + * @return 财务计收 + */ + @Override + public OmsFinanceCharge selectOmsFinanceChargeById(Long id) { + return omsFinanceChargeMapper.selectOmsFinanceChargeById(id); + } + + /** + * 查询财务计收列表 + * + * @param omsFinanceCharge 财务计收 + * @return 财务计收 + */ + @Override + public List selectOmsFinanceChargeList(OmsFinanceCharge omsFinanceCharge) { + omsFinanceCharge.setChargeStatus(OmsFinanceCharge.ChargeStatusEnum.COMPLETE_CHARGE.getCode()); + return omsFinanceChargeMapper.selectOmsFinanceChargeList(omsFinanceCharge); + } + + /** + * 新增财务计收 + * + * @param omsFinanceCharge 财务计收 + * @return 结果 + */ + @Override + public int insertOmsFinanceCharge(OmsFinanceCharge omsFinanceCharge) { + return omsFinanceChargeMapper.insertOmsFinanceCharge(omsFinanceCharge); + } + + /** + * 修改财务计收 + * + * @param omsFinanceCharge 财务计收 + * @return 结果 + */ + @Override + public int updateOmsFinanceCharge(OmsFinanceCharge omsFinanceCharge) { + return omsFinanceChargeMapper.updateOmsFinanceCharge(omsFinanceCharge); + } + + /** + * 批量删除财务计收 + * + * @param ids 需要删除的财务计收主键集合 + * @return 结果 + */ + @Override + public int deleteOmsFinanceChargeByIds(Long[] ids) { + return omsFinanceChargeMapper.deleteOmsFinanceChargeByIds(ids); + } + + /** + * 删除财务计收信息 + * + * @param id 财务计收主键 + * @return 结果 + */ + @Override + public int deleteOmsFinanceChargeById(Long id) { + return omsFinanceChargeMapper.deleteOmsFinanceChargeById(id); + } + + @Override + public int updateOmsFinanceChargeByOrderCode(OmsFinanceCharge omsFinanceCharge) { + if (StringUtils.isEmpty(omsFinanceCharge.getOrderCode())) { + return 0; + } + return omsFinanceChargeMapper.updateOmsFinanceChargeByOrderCode(omsFinanceCharge); + } + + @Override + public int completedCharge(OmsFinanceCharge omsFinanceCharge) { + if (StringUtils.isEmpty(omsFinanceCharge.getOrderCode())) { + return 0; + } + omsFinanceCharge.setChargeStatus(OmsFinanceCharge.ChargeStatusEnum.COMPLETE_CHARGE.getCode()); + omsFinanceCharge.setFinanceChargeDate(DateUtils.getNowDate()); + //计算对应数据 + List projectProductInfos = projectProductInfoService.selectProjectProductInfoListByOrderCode(Collections.singletonList(omsFinanceCharge.getOrderCode())); + // + + OmsInventoryInner omsInventoryInner = new OmsInventoryInner(); + omsInventoryInner.setOrderCode(omsFinanceCharge.getOrderCode()); + List omsInventoryInners = innerMapper.selectOmsInventoryInnerList(omsInventoryInner); + Map innerMap = omsInventoryInners.stream().collect(Collectors.toMap(OmsInventoryInner::getProductCode, Function.identity())); + boolean allMatch = projectProductInfos.stream().filter(item -> !item.getType().equals(ProductInfo.ProductTypeEnum.HARDWARE.getType()) && !item.getType().equals(ProductInfo.ProductTypeEnum.SOFTWARE.getType())) + .allMatch(item -> innerMap.containsKey(item.getProductCode())); + if (!allMatch) { + throw new ServiceException("服务未进行入库绑定,无法计算成本,计收失败"); + } + //计算收入 + BigDecimal incomeWithoutTaxTotal = BigDecimal.ZERO; + BigDecimal incomeWithTaxTotal = BigDecimal.ZERO; + + + //特殊处理 projectProductInfo 税率为 百分比 + BigDecimal defaultTaxRate = new BigDecimal(defaultTax); + for (ProjectProductInfo projectProductInfo : projectProductInfos) { + BigDecimal taxRate = projectProductInfo.getTaxRate()==null?defaultTaxRate:projectProductInfo.getTaxRate().divide(new BigDecimal("100"),4, RoundingMode.HALF_UP); + BigDecimal allPrice = projectProductInfo.getAllPrice(); + incomeWithTaxTotal = incomeWithTaxTotal.add(allPrice); + BigDecimal withOutTax = allPrice.divide(BigDecimal.ONE.add(taxRate), 2, RoundingMode.HALF_UP); + incomeWithoutTaxTotal = incomeWithoutTaxTotal.add(withOutTax); + + } + omsFinanceCharge.setIncomeWithoutTaxTotal(incomeWithoutTaxTotal); + omsFinanceCharge.setIncomeWithTaxTotal(incomeWithTaxTotal); + + //计算成本 软硬件从库存中取 不从应付单取的原因如下 1: 应付单有可能是入库单生成 然后入库生成时可能是全部数据 但发到某个项目只有一部分 所以无法从应付单取数 + BigDecimal costSoftwareWithoutTax = BigDecimal.ZERO; + BigDecimal costSoftwareWithTax = BigDecimal.ZERO; + BigDecimal costHardwareWithoutTax = BigDecimal.ZERO; + BigDecimal costHardwareWithTax = BigDecimal.ZERO; + List inventoryInfos = inventoryInfoService.selectInventoryInfoByOrderCode(Collections.singletonList(omsFinanceCharge.getOrderCode())); + + for (InventoryInfo inventoryInfo : inventoryInfos) { + BigDecimal taxRate = inventoryInfo.getTaxRate() == null ? defaultTaxRate : inventoryInfo.getTaxRate(); + if (inventoryInfo.getProductType().equals(ProductInfo.ProductTypeEnum.SOFTWARE.getType())) { + costSoftwareWithTax = costSoftwareWithTax.add(inventoryInfo.getInnerPrice()); + costSoftwareWithoutTax = costSoftwareWithoutTax.add(inventoryInfo.getInnerPrice().divide(BigDecimal.ONE.add(taxRate), 2, RoundingMode.HALF_UP)); + } else if (inventoryInfo.getProductType().equals(ProductInfo.ProductTypeEnum.HARDWARE.getType())) { + costHardwareWithTax = costHardwareWithTax.add(inventoryInfo.getInnerPrice()); + costHardwareWithoutTax = costHardwareWithoutTax.add(inventoryInfo.getInnerPrice().divide(BigDecimal.ONE.add(taxRate), 2, RoundingMode.HALF_UP)); + } + } + omsFinanceCharge.setCostSoftwareWithoutTax(costSoftwareWithoutTax); + omsFinanceCharge.setCostSoftwareWithTax(costSoftwareWithTax); + omsFinanceCharge.setCostHardwareWithoutTax(costHardwareWithoutTax); + omsFinanceCharge.setCostHardwareWithTax(costHardwareWithTax); + + + //服务从入库单取应付单的数据 因为服务是出入库一起 必须要绑定项目 + BigDecimal costSoftwareMaintWithoutTax = BigDecimal.ZERO; + BigDecimal costSoftwareMaintWithTax = BigDecimal.ZERO; + BigDecimal costHardwareMaintWithoutTax = BigDecimal.ZERO; + BigDecimal costHardwareMaintWithTax = BigDecimal.ZERO; + BigDecimal costProvinceServiceWithoutTax = BigDecimal.ZERO; + BigDecimal costProvinceServiceWithTax = BigDecimal.ZERO; + BigDecimal costOtherWithoutTax = BigDecimal.ZERO; + BigDecimal costOtherWithTax = BigDecimal.ZERO; + OmsPayableBill queryBill = new OmsPayableBill(); + queryBill.setOrderCode(omsFinanceCharge.getOrderCode()); + List omsPayableBills = payableBillService.selectOmsPayableBillList(queryBill); + for (OmsPayableBill omsPayableBill : omsPayableBills) { + if (omsPayableBill.getProductType().equals(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType())){ + costSoftwareMaintWithTax = costSoftwareMaintWithTax.add(omsPayableBill.getTotalPriceWithTax()); + costSoftwareMaintWithoutTax = costSoftwareMaintWithoutTax.add(omsPayableBill.getTotalPriceWithoutTax()); + }else if (omsPayableBill.getProductType().equals(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType())){ + costHardwareMaintWithTax = costHardwareMaintWithTax.add(omsPayableBill.getTotalPriceWithTax()); + costHardwareMaintWithoutTax = costHardwareMaintWithoutTax.add(omsPayableBill.getTotalPriceWithoutTax()); + }else if (omsPayableBill.getProductType().equals(ProductInfo.ProductTypeEnum.PROVINCE_SERVICE.getType())){ + costProvinceServiceWithTax = costProvinceServiceWithTax.add(omsPayableBill.getTotalPriceWithTax()); + costProvinceServiceWithoutTax = costProvinceServiceWithoutTax.add(omsPayableBill.getTotalPriceWithoutTax()); + }else if (omsPayableBill.getProductType().equals(ProductInfo.ProductTypeEnum.OTHER.getType())){ + costOtherWithTax = costOtherWithTax.add(omsPayableBill.getTotalPriceWithTax()); + costOtherWithoutTax = costOtherWithoutTax.add(omsPayableBill.getTotalPriceWithoutTax()); + } + } + omsFinanceCharge.setCostSoftwareMaintWithoutTax(costSoftwareMaintWithoutTax); + omsFinanceCharge.setCostSoftwareMaintWithTax(costSoftwareMaintWithTax); + omsFinanceCharge.setCostHardwareMaintWithoutTax(costHardwareMaintWithoutTax); + omsFinanceCharge.setCostHardwareMaintWithTax(costHardwareMaintWithTax); + omsFinanceCharge.setCostProvinceServiceWithoutTax(costProvinceServiceWithoutTax); + omsFinanceCharge.setCostProvinceServiceWithTax(costProvinceServiceWithTax); + omsFinanceCharge.setCostOtherWithoutTax(costOtherWithoutTax); + omsFinanceCharge.setCostOtherWithTax(costOtherWithTax); + return omsFinanceChargeMapper.updateOmsFinanceChargeByOrderCode(omsFinanceCharge); + } + + @Override + public int returnApplyBiz(OmsFinanceCharge omsFinanceCharge) { + return omsFinanceChargeMapper.returnApplyBiz(omsFinanceCharge); + } + + @Override + public int revoke(OmsFinanceCharge omsFinanceCharge) { + omsFinanceCharge.setChargeStatus(OmsFinanceCharge.ChargeStatusEnum.APPLY_CHARGE.getCode()); + omsFinanceCharge.setFinanceChargeDate(null); + omsFinanceCharge.setIncomeWithTaxTotal(BigDecimal.ZERO); + omsFinanceCharge.setIncomeWithoutTaxTotal(BigDecimal.ZERO); + omsFinanceCharge.setCostSoftwareWithoutTax(BigDecimal.ZERO); + omsFinanceCharge.setCostSoftwareWithTax(BigDecimal.ZERO); + omsFinanceCharge.setCostHardwareWithoutTax(BigDecimal.ZERO); + omsFinanceCharge.setCostHardwareWithTax(BigDecimal.ZERO); + omsFinanceCharge.setCostSoftwareMaintWithoutTax(BigDecimal.ZERO); + omsFinanceCharge.setCostSoftwareMaintWithTax(BigDecimal.ZERO); + omsFinanceCharge.setCostHardwareMaintWithoutTax(BigDecimal.ZERO); + omsFinanceCharge.setCostHardwareMaintWithTax(BigDecimal.ZERO); + omsFinanceCharge.setCostProvinceServiceWithoutTax(BigDecimal.ZERO); + omsFinanceCharge.setCostProvinceServiceWithTax(BigDecimal.ZERO); + omsFinanceCharge.setCostOtherWithoutTax(BigDecimal.ZERO); + omsFinanceCharge.setCostOtherWithTax(BigDecimal.ZERO); + omsFinanceCharge.setCostOtherWithoutTax(BigDecimal.ZERO); + omsFinanceCharge.setCostOtherWithTax(BigDecimal.ZERO); + omsFinanceCharge.setRemark(""); + omsFinanceCharge.setUpdateTime(DateUtils.getNowDate()); + omsFinanceCharge.setUpdateBy(ShiroUtils.getUserId().toString()); + return omsFinanceChargeMapper.revoke(omsFinanceCharge); + } +} \ No newline at end of file diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsInventoryInnerServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsInventoryInnerServiceImpl.java index 20276719..23a142e8 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsInventoryInnerServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsInventoryInnerServiceImpl.java @@ -146,7 +146,7 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService { OmsPayableBill payableBill = new OmsPayableBill(); VendorInfo vendorInfo = vendorInfoService.selectVendorInfoByVendorCode(vendorCode); - if (vendorInfo != null && VendorInfo.PayTypeEnum.INNER_PAY.getCode().equals(vendorInfo.getPayType())) { + if ((vendorInfo != null && VendorInfo.PayTypeEnum.INNER_PAY.getCode().equals(vendorInfo.getPayType())) || !Arrays.asList("1", "2").contains(omsInventoryInner.getProductType())) { BigDecimal reduce = inventoryInfoList.stream().map(InventoryInfo::getInnerPrice).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); //服务金额为单价* 数量 没有具体的详情 BigDecimal totalPriceWithTax = Arrays.asList("11", "22").contains(omsInventoryInner.getProductType()) ? @@ -158,6 +158,9 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService { payableBill.setProductType(productInfos.get(0).getType()); payableBill.setProductCode(omsInventoryInner.getProductCode()); payableBill.setTotalPriceWithTax(totalPriceWithTax); + payableBill.setOrderCode(omsInventoryInner.getOrderCode()); + payableBill.setProjectCode(omsInventoryInner.getProductCode()); + payableBill.setProjectName(omsInventoryInner.getProjectName()); String purchaseNo = omsInventoryInner.getPurchaseNo(); BigDecimal taxRate = null; if (StringUtils.isNotEmpty(purchaseNo)) { @@ -225,9 +228,12 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService { if (CollUtil.isNotEmpty(innerCodeList)){ throw new ServiceException(StrUtil.format("已发货的入库单[{}]不能删除", String.join(",",innerCodeList))); } + List omsInventoryInners = omsInventoryInnerMapper.listById(idArray); + //删除对应的应付单 + payableBillService.deleteByInventoryCode(omsInventoryInners.stream().map(OmsInventoryInner::getInnerCode).collect(Collectors.toList())); inventoryInfoService.deleteInventoryInfoByInnerIds(idArray); //还原入库数量 - List omsInventoryInners = omsInventoryInnerMapper.listById(idArray); + List omsPurchaseOrderItems = omsInventoryInners.stream().map(item -> { OmsPurchaseOrderItem omsPurchaseOrderItem = new OmsPurchaseOrderItem(); omsPurchaseOrderItem.setInnerQuantity(BigDecimal.valueOf(item.getQuantity())); diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java index ca30f560..eee34f42 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/OmsPayableBillServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.sip.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; @@ -554,5 +555,21 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService { return omsPayableBill; } + + @Override + public List checkDelete(List inventoryCodeList) { + return omsPayableBillMapper.checkDelete(inventoryCodeList); + } + + @Override + public void deleteByInventoryCode(List inventoryCodeList) { + List payableInnerCodeList = omsPayableBillMapper.checkDelete(inventoryCodeList); + if (CollUtil.isNotEmpty(payableInnerCodeList)){ + throw new ServiceException(StrUtil.format("入库单[{}]关联的应付单已执行付款或收票操作不能删除", + String.join(",",payableInnerCodeList))); + } + omsPayableBillMapper.deleteByInventoryCode(inventoryCodeList); + + } } diff --git a/ruoyi-sip/src/main/resources/mapper/finance/OmsFinanceChargeMapper.xml b/ruoyi-sip/src/main/resources/mapper/finance/OmsFinanceChargeMapper.xml new file mode 100644 index 00000000..003f3636 --- /dev/null +++ b/ruoyi-sip/src/main/resources/mapper/finance/OmsFinanceChargeMapper.xml @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, order_code, biz_charge_date, finance_charge_date, + income_with_tax_total, income_without_tax_total, + cost_software_without_tax, cost_software_with_tax, + cost_hardware_without_tax, cost_hardware_with_tax, + cost_software_maint_without_tax, cost_software_maint_with_tax, + cost_hardware_maint_without_tax, cost_hardware_maint_with_tax, + cost_province_service_with_tax, cost_province_service_without_tax, + cost_other_with_tax, cost_other_without_tax, + remark, create_time, update_time,update_by, charge_status + from oms_finance_charge + + + + + + + + insert into oms_finance_charge + + + order_code, + + + biz_charge_date, + + + finance_charge_date, + + + income_with_tax_total, + + + income_without_tax_total, + + + cost_software_without_tax, + + + cost_software_with_tax, + + + cost_hardware_without_tax, + + + cost_hardware_with_tax, + + + cost_software_maint_without_tax, + + + cost_software_maint_with_tax, + + + cost_hardware_maint_without_tax, + + + cost_hardware_maint_with_tax, + + + cost_province_service_with_tax, + + + cost_province_service_without_tax, + + + cost_other_with_tax, + + + cost_other_without_tax, + + + remark, + + + charge_status, + + create_time, + update_time + + + + #{orderCode}, + + + #{bizChargeDate}, + + + #{financeChargeDate}, + + + #{incomeWithTaxTotal}, + + + #{incomeWithoutTaxTotal}, + + + #{costSoftwareWithoutTax}, + + + #{costSoftwareWithTax}, + + + #{costHardwareWithoutTax}, + + + #{costHardwareWithTax}, + + + #{costSoftwareMaintWithoutTax}, + + + #{costSoftwareMaintWithTax}, + + + #{costHardwareMaintWithoutTax}, + + + #{costHardwareMaintWithTax}, + + + #{costProvinceServiceWithTax}, + + + #{costProvinceServiceWithoutTax}, + + + #{costOtherWithTax}, + + + #{costOtherWithoutTax}, + + + #{remark}, + + + #{chargeStatus}, + + now(), + now() + + on duplicate key update charge_status=values(charge_status) + + + + update oms_finance_charge + + + order_code = #{orderCode}, + + + biz_charge_date = #{bizChargeDate}, + + + finance_charge_date = #{financeChargeDate}, + + + income_with_tax_total = #{incomeWithTaxTotal}, + + + income_without_tax_total = #{incomeWithoutTaxTotal}, + + + cost_software_without_tax = #{costSoftwareWithoutTax}, + + + cost_software_with_tax = #{costSoftwareWithTax}, + + + cost_hardware_without_tax = #{costHardwareWithoutTax}, + + + cost_hardware_with_tax = #{costHardwareWithTax}, + + + cost_software_maint_without_tax = #{costSoftwareMaintWithoutTax}, + + + cost_software_maint_with_tax = #{costSoftwareMaintWithTax}, + + + cost_hardware_maint_without_tax = #{costHardwareMaintWithoutTax}, + + + cost_hardware_maint_with_tax = #{costHardwareMaintWithTax}, + + + cost_province_service_with_tax = #{costProvinceServiceWithTax}, + + + cost_province_service_without_tax = #{costProvinceServiceWithoutTax}, + + + cost_other_with_tax = #{costOtherWithTax}, + + + cost_other_without_tax = #{costOtherWithoutTax}, + + + remark = #{remark}, + + + charge_status = #{chargeStatus}, + + + update_by = #{updateBy}, + + update_time = now() + + where id = #{id} + + + update oms_finance_charge + + + + biz_charge_date = #{bizChargeDate}, + + + finance_charge_date = #{financeChargeDate}, + + + income_with_tax_total = #{incomeWithTaxTotal}, + + + income_without_tax_total = #{incomeWithoutTaxTotal}, + + + cost_software_without_tax = #{costSoftwareWithoutTax}, + + + cost_software_with_tax = #{costSoftwareWithTax}, + + + cost_hardware_without_tax = #{costHardwareWithoutTax}, + + + cost_hardware_with_tax = #{costHardwareWithTax}, + + + cost_software_maint_without_tax = #{costSoftwareMaintWithoutTax}, + + + cost_software_maint_with_tax = #{costSoftwareMaintWithTax}, + + + cost_hardware_maint_without_tax = #{costHardwareMaintWithoutTax}, + + + cost_hardware_maint_with_tax = #{costHardwareMaintWithTax}, + + + cost_province_service_with_tax = #{costProvinceServiceWithTax}, + + + cost_province_service_without_tax = #{costProvinceServiceWithoutTax}, + + + cost_other_with_tax = #{costOtherWithTax}, + + + cost_other_without_tax = #{costOtherWithoutTax}, + + + remark = #{remark}, + + + charge_status = #{chargeStatus}, + + + update_by = #{updateBy}, + + update_time = now() + + where order_code = #{orderCode} + + + update oms_finance_charge + set charge_status=#{chargeStatus}, + biz_charge_date=null, + update_time=now() + where order_code = #{orderCode} + + + update oms_finance_charge set + finance_charge_date = #{financeChargeDate}, + income_with_tax_total = #{incomeWithTaxTotal}, + income_without_tax_total = #{incomeWithoutTaxTotal}, + cost_software_without_tax = #{costSoftwareWithoutTax}, + cost_software_with_tax = #{costSoftwareWithTax}, + cost_hardware_without_tax = #{costHardwareWithoutTax}, + cost_hardware_with_tax = #{costHardwareWithTax}, + cost_software_maint_without_tax = #{costSoftwareMaintWithoutTax}, + cost_software_maint_with_tax = #{costSoftwareMaintWithTax}, + cost_hardware_maint_without_tax = #{costHardwareMaintWithoutTax}, + cost_hardware_maint_with_tax = #{costHardwareMaintWithTax}, + cost_province_service_with_tax = #{costProvinceServiceWithTax}, + cost_province_service_without_tax = #{costProvinceServiceWithoutTax}, + cost_other_with_tax = #{costOtherWithTax}, + cost_other_without_tax = #{costOtherWithoutTax}, + remark = #{remark}, + charge_status = #{chargeStatus}, + update_by = #{updateBy}, + update_time = now() + where id = #{id} + + + + delete from oms_finance_charge where id = #{id} + + + + delete from oms_finance_charge where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-sip/src/main/resources/mapper/finance/OmsPayableBillMapper.xml b/ruoyi-sip/src/main/resources/mapper/finance/OmsPayableBillMapper.xml index 55337217..9afea7bb 100644 --- a/ruoyi-sip/src/main/resources/mapper/finance/OmsPayableBillMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/finance/OmsPayableBillMapper.xml @@ -182,6 +182,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from oms_payable_bill where payable_bill_code like concat(#{prefix}, '%') + insert into oms_payable_bill @@ -275,6 +286,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + delete from oms_payable_bill where inventory_code in + + #{item} + + diff --git a/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml index 5557a031..0c78f000 100644 --- a/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/inventory/InventoryInfoMapper.xml @@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select t1.id, t1.product_code, t1.product_sn, t1.inventory_status, t1.inner_code, t1.outer_code, t1.warehouse_id, t1.inner_price,t1.tax_rate, t1.outer_price, t1.create_by, t1.create_time, t1.update_by, t1.update_time , - t2.warehouse_name,t3.description as 'product_desc',t3.model + t2.warehouse_name,t3.description as 'product_desc',t3.model,t3.type as product_type from oms_inventory_info t1 left join oms_warehouse_info t2 on t1.warehouse_id = t2.id left join product_info t3 on t1.product_code = t3.product_code @@ -100,6 +100,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select product_sn from oms_inventory_delivery_detail where delivery_id = #{id} ) + diff --git a/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml index fdf7ce25..6ed6f7f9 100644 --- a/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/sip/ProjectOrderInfoMapper.xml @@ -60,12 +60,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ,t3.partner_name,t3.level,t3.system_user_id,t3.address partner_address ,t4.agent_name ,t5.user_name as duty_name + ,t6.charge_status,t6.biz_charge_date,t6.finance_charge_date from project_order_info t1 left join project_info t2 on t1.project_id = t2.id left join partner_info t3 on t1.partner_code=t3.partner_code left join agent_info t4 on t2.agent_code=t4.agent_code left join sys_user t5 on t1.duty=t5.user_id + left join oms_finance_charge t6 on t1.order_code=t6.order_code