Browse Source

[feat]财务管理:

新增结案功能
新增根据financialReceivablesId修改结案状态
判断如果修改结案状态为已结案,则不会出现结案按钮
dev
liuxiaoxu 5 months ago
parent
commit
0e74fdf1d5
  1. 12
      ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialReceivablesController.java
  2. 12
      ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialReceivablesMapper.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java
  4. 9
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java
  5. 4
      ruoyi-admin/src/main/resources/mapper/financial/FinancialReceivablesMapper.xml
  6. 42
      ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html

12
ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialReceivablesController.java

@ -164,6 +164,18 @@ public class FinancialReceivablesController extends BaseController
return toAjax(financialReceivablesService.updateFinancialReceivables(financialReceivables));
}
/**
* 结案
*/
@RequiresPermissions("financial:receivables:receivablesClosing")
@Log(title = "财务应收账款", businessType = BusinessType.UPDATE)
@GetMapping( "/receivablesClosing/{financialReceivablesId}")
@ResponseBody
public AjaxResult receivablesClosing(@PathVariable("financialReceivablesId") Long financialReceivablesId){
return toAjax(financialReceivablesService.closingFinancialReceivablesById(financialReceivablesId));
}
/**
* 删除财务应收账款
*/

12
ruoyi-admin/src/main/java/com/ruoyi/financial/mapper/FinancialReceivablesMapper.java

@ -84,12 +84,8 @@ public interface FinancialReceivablesMapper
public String findMaxRoundCode(@Param("prefix") String prefix);
// /**
// * 查询财务应收账款
// *
// * @param financialReceivablesId 财务应收账款ID
// * @return 财务应收账款
// */
// 查询非销售订单财务应收账款
// FinancialReceivables selectFinancialReceivablesNoSalesById(Long financialReceivablesId);
/**
* 结案
*/
public int updateReceivablesClosingStatusById(Long financialReceivablesId);
}

6
ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java

@ -72,4 +72,10 @@ public interface IFinancialReceivablesService
* @return
*/
int restoreFinancialReceivablesById(Long financialReceivablesId);
/**
* 结案
* */
int closingFinancialReceivablesById(Long financialReceivablesId);
}

9
ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java

@ -169,6 +169,15 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer
return financialReceivablesMapper.restoreFinancialReceivablesById(financialReceivablesId);
}
/*
* 结案
* */
@Override
public int closingFinancialReceivablesById(Long financialReceivablesId) {
int result = financialReceivablesMapper.updateReceivablesClosingStatusById(financialReceivablesId);
return result;
}
/**
*应收单号生产规则

4
ruoyi-admin/src/main/resources/mapper/financial/FinancialReceivablesMapper.xml

@ -171,6 +171,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<update id="updateReceivablesClosingStatusById" parameterType="Long">
update financial_receivables set receivables_closing_status = '2' where financial_receivables_id = #{financialReceivablesId}
</update>
<update id="cancelFinancialReceivablesById" parameterType="Long">
update financial_receivables set del_flag = '1' where financial_receivables_id = #{financialReceivablesId}
</update>

42
ruoyi-admin/src/main/resources/templates/financial/receivables/receivables.html

@ -101,6 +101,7 @@
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('financial:receivables:edit')}]];
var closingFlag = [[${@permission.hasPermi('financial:receivables:receivablesClosing')}]];
var addReceivablesVoucherFlag=[[${@permission.hasPermi('financial:receivables:addReceivablesVoucher')}]];
var receivablesClosingStatusDatas = [[${@dict.getType('receivables_closing_status')}]];
var currencyTypeDatas = [[${@dict.getType('sys_common_currency')}]];
@ -219,9 +220,10 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
//actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + addReceivablesVoucherFlag + '" href="javascript:void(0)" onclick="addReceivablesVoucher(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>创建收款凭证</a> ');
if (row.receivablesClosingStatus !== '2') {
actions.push('<a class="btn btn-success btn-xs ' + closingFlag + '" href="javascript:void(0)" onclick="confirmAndClose(\'' + row.financialReceivablesId + '\')"><i class="fa fa-edit"></i>结案</a> ');
}
return actions.join('');
}
}]
@ -240,6 +242,42 @@
var url = ctx+'financial/receivables/addReceivablesVoucher/'+financialReceivablesId;
$.modal.open("创建收款凭证",url);
}
//结案
function confirmAndClose(financialReceivablesId) {
// 使用layer.confirm替代alert,以实现确认功能
layer.confirm("确定要结案吗?", {
title: "系统提示",
btn: ['确定', '取消'], // 自定义按钮文本
yes: function(index, layero) {
// 用户点击确定后的操作
$.ajax({
url: ctx + 'financial/receivables/receivablesClosing/' + financialReceivablesId,
type: 'GET',
dataType: 'json',
success: function(data) {
if (data.code == web_status.SUCCESS) {
// 成功后提示
layer.close(index); // 关闭当前confirm对话框
$.modal.alert("结案成功。");
$('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格
} else {
layer.close(index); // 关闭当前confirm对话框
$.modal.alertError(data.msg);
}
},
error: function(error) {
layer.close(index); // 关闭当前confirm对话框
$.modal.alertError("结案失败。");
}
});
},
cancel: function(index, layero) {
// 用户点击取消的操作,通常无需处理,直接关闭对话框即可
layer.close(index);
}
});
}
</script>
</body>
</html>
Loading…
Cancel
Save