Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dev
zhangsiqi 5 months ago
parent
commit
4847a4e6db
  1. 5
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/IFinancialReceivablesService.java
  2. 61
      ruoyi-admin/src/main/java/com/ruoyi/financial/service/impl/FinancialReceivablesServiceImpl.java
  3. 9
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java
  4. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java
  5. 9
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
  6. 2
      ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml
  7. 3
      ruoyi-admin/src/main/resources/templates/system/makeorder/bmzgqr.html
  8. 6
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

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

@ -82,4 +82,9 @@ public interface IFinancialReceivablesService
* 应收账款详情
* */
int financialReceivablesDetail(FinancialReceivables financialReceivables);
/*
* 销售订单审批完成后根据销售单号生成财务应收账款
* */
int generateReceivablesBySalesOrderCode(String salesOrderCode);
}

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

@ -1,5 +1,6 @@
package com.ruoyi.financial.service.impl;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -12,6 +13,11 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.financial.domain.FinancialReceivablesRecords;
import com.ruoyi.financial.domain.VO.FinancialReceivablesRecordsVO;
import com.ruoyi.financial.mapper.FinancialReceivablesRecordsMapper;
import com.ruoyi.system.domain.SysCustomerVo;
import com.ruoyi.system.domain.SysSalesOrderVo;
import com.ruoyi.system.mapper.SysCustomerMapper;
import com.ruoyi.system.mapper.SysSalesOrderMapper;
import com.ruoyi.system.service.ISysSalesOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -34,8 +40,15 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer
@Autowired
private FinancialReceivablesMapper financialReceivablesMapper;
@Autowired
private SysSalesOrderMapper sysSalesOrderMapper;
@Autowired
private FinancialReceivablesRecordsMapper receivablesRecordsMapper;
@Autowired
private SysCustomerMapper sysCustomerMapper;
/**
* 查询财务应收账款
*
@ -137,6 +150,54 @@ public class FinancialReceivablesServiceImpl implements IFinancialReceivablesSer
}
/*
* 销售订单审批完成后根据销售单号生成财务应收账款
* */
@Override
public int generateReceivablesBySalesOrderCode(String salesOrderCode) {
FinancialReceivables financialReceivables = new FinancialReceivables();
FinancialReceivablesRecords receivablesRecords = new FinancialReceivablesRecords();
// 更改日期格式以提高可读性
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String datePart = df.format(new Date());
// 移除日期中的分隔符以便于后续处理
String prefix = "YS" + datePart.replace("-", "");
// 查询数据库中当前最大编号
String maxCode = financialReceivablesMapper.findMaxRoundCode(prefix);
String newCode = generateNewCode(prefix, maxCode);
SysSalesOrderVo sysSalesOrderVo = sysSalesOrderMapper.selectSysSalesOrderBySalesOrderCode(salesOrderCode);
SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByEnterpriseCode(sysSalesOrderVo.getEnterpriseCode());
financialReceivables.setSalesOrderCode(salesOrderCode);
//自动生成 应收单号
financialReceivables.setFinancialReceivablesCode(newCode);
financialReceivables.setReceivablesClosingStatus("0");
financialReceivables.setCreditAccount("客户");
financialReceivables.setCreditDetail(sysCustomerVo.getEnterpriseName());
financialReceivables.setOpenBank(sysCustomerVo.getDepositBank());
financialReceivables.setOpenAccount(sysCustomerVo.getBankAccount());
financialReceivables.setCustomerId(sysCustomerVo.getEnterpriseCode());
financialReceivables.setCurrencyType(sysSalesOrderVo.getCommonCurrency());
financialReceivables.setPriceExcludingTax(BigDecimal.valueOf(sysSalesOrderVo.getNoRmbSum()));
financialReceivables.setPriceIncludesTax(BigDecimal.valueOf(sysSalesOrderVo.getRmbTaxSum()));
financialReceivables.setPaymentCondition(sysSalesOrderVo.getPaymentTerms());
financialReceivables.setBusinessMembers(sysSalesOrderVo.getBusinessMembers());
financialReceivables.setFinancialDeliverStatus("0");
financialReceivables.setCreateTime(new Date());
financialReceivables.setCreateBy(ShiroUtils.getLoginName());
//插入数据到应收款明细中
receivablesRecords.setFinancialReceivablesCode(newCode);
receivablesRecords.setReceivablesClosingStatus("0");
receivablesRecords.setSalesOrderCode(salesOrderCode);
receivablesRecords.setCreateTime(new Date());
receivablesRecords.setCreateBy(ShiroUtils.getLoginName());
receivablesRecordsMapper.insertFinancialReceivablesRecords(receivablesRecords);
return financialReceivablesMapper.insertFinancialReceivables(financialReceivables);
}
/**
* 删除财务应收账款对象

9
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSalesOrderController.java

@ -21,6 +21,7 @@ import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.financial.service.IFinancialReceivablesService;
import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.exportDto.SysSalesFinishDto;
@ -90,6 +91,10 @@ public class SysSalesOrderController extends BaseController
@Autowired
private SysSalesOrderMapper sysSalesOrderMapper;
@Autowired
private IFinancialReceivablesService financialReceivablesService;
@RequiresPermissions("system:salesOrder:view")
@GetMapping()
public String salesOrder(ModelMap mmap)
@ -453,6 +458,10 @@ public class SysSalesOrderController extends BaseController
SysSalesOrderVo sysSalesOrderVo1 = sysSalesOrderService.selectSysSalesOrderById(sysSalesOrderVo.getSalesOrderId());
//生产订单生成
sysMakeOrderService.generateMakeOrderBySalesOrderCode(sysSalesOrderVo1.getSalesOrderCode());
//生成财务应收账款
financialReceivablesService.generateReceivablesBySalesOrderCode(sysSalesOrderVo1.getSalesOrderCode());
// 提交
if("submit".equals(instanceType)){
// 使用状态-是

6
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java

@ -57,7 +57,7 @@ public class SysSalesOrder extends BaseEntity {
/*客户电话*/
private String customerPhone;
/*物料合计*/
private Double materialSum;
private Long materialSum;
/*数量合计*/
private Long enterpriseSum;
/*不含税单价(RMB)*/
@ -297,11 +297,11 @@ public class SysSalesOrder extends BaseEntity {
this.customerPhone = customerPhone;
}
public Double getMaterialSum() {
public Long getMaterialSum() {
return materialSum;
}
public void setMaterialSum(Double materialSum) {
public void setMaterialSum(Long materialSum) {
this.materialSum = materialSum;
}

9
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java

@ -195,6 +195,15 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
// 是
makeOrder.setUseStatus("1");
makeOrder.setSaleNo(salesOrderCode);
makeOrder.setMakeStatus("0");
makeOrder.setSalesman(sysSalesOrderVo.getBusinessMembers());
makeOrder.setSaleNo(sysSalesOrderVo.getSalesOrderCode());
makeOrder.setOrderType(sysSalesOrderVo.getSalesOrderType());
makeOrder.setCustomerId(sysSalesOrderVo.getEnterpriseCode());
makeOrder.setCustomerName(sysSalesOrderVo.getEnterpriseName());
makeOrder.setCustomerOderCode(sysSalesOrderVo.getSalesOrderNumber());
makeOrder.setMaterialSum(sysSalesOrderVo.getEnterpriseSum());
makeOrder.setMaterial(String.valueOf(sysSalesOrderVo.getMaterialSum()));
String makeNo = redisCache.generateBillNo("PO");
makeOrder.setMakeNo(makeNo);
insertSysMakeOrder(makeOrder);

2
ruoyi-admin/src/main/resources/mapper/system/SysSalesOrderMapper.xml

@ -126,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyTime != null and applyTime != ''"> and s.apply_time = #{applyTime}</if>
<if test="applyTitle != null and applyTitle != ''"> and s.apply_title = #{applyTitle}</if>
</where>
order by s.apply_time desc
order by s.create_time desc
</select>
<select id="selectSysSalesOrderById" parameterType="Long" resultMap="SysSalesOrderResult">

3
ruoyi-admin/src/main/resources/templates/system/makeorder/bmzgqr.html

@ -35,7 +35,6 @@
</select>
</div>
</div>
</form>
<div class="container">
<div class="row">
<div class="col-sm-12 select-table table-striped">
@ -43,6 +42,8 @@
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />

6
ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

@ -228,6 +228,7 @@
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
cancelUrl: prefix + "/cancel/{id}",
detailUrl: prefix + "/detail/{id}",
pagination: true,
pageList: [5, 10, 25, 50],
@ -353,6 +354,11 @@
// 进度查看
actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="showProcessImgDialog(\'' + row.instanceId + '\')"><i class="fa fa-image"></i> 进度查看</a> ');
}
if (row.makeStatus == "0" || row.makeStatus == "1"){
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.salesOrderId + '\')"><i class="fa fa-edit"></i> 出货</a> ');
}
// 详情
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.salesOrderId + '\')"><i class="fa fa-eye"></i> 详情</a> ');
return actions.join('');

Loading…
Cancel
Save