Browse Source

[feat] 销售管理

销售订单实体类新增:客户收货人(Bill to)、客户收货人电话(Bill to)、交货地点(Bill to)
销售出货通知前端列表新增;动态查询收货联系人(Bill To)js方法、新增收货电话(Bill To)、新增收货地址(Bill To)
销售出货通知实体类:新增customerContactBillto、contactNumberBillto、contactAddressBillto
修改保存发起出货后端接口:新增 如果子表中有申请出货数为空的数据,不能提交保存的判断条件
SysSalesShippingInformMapper.xml新增:contactAddressBillto、customerContactBillto和 contactNumberBillto属性;修改里面的 查询接口、新增接口、修改接口都加上上面的三个属性
dev
liuxiaoxu 3 months ago
parent
commit
ff601878f9
  1. 39
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesOrder.java
  2. 50
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java
  3. 11
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java
  4. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java
  5. 17
      ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformMapper.xml
  6. 95
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesDeliverGoods.html

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

@ -81,8 +81,17 @@ public class SysSalesOrder extends BaseEntity {
private String deliveryTime;
/*客户收货人*/
private String customerDelivery;
/*客户收货人(Bill to)*/
private String customerDeliveryBillto;
/*客户收货人电话*/
private String deliveryPhone;
/*客户收货人电话(Bill to)*/
private String deliveryPhoneBillto;
/* 交货条件*/
@Excel(name = "交货条件")
private String deliveryConditions;
@ -92,6 +101,11 @@ public class SysSalesOrder extends BaseEntity {
/*交货地点*/
@Excel(name = "交货地点")
private String deliveryAddress;
/*交货地点(Bill to)*/
private String deliveryAddressBillto;
/*付款条件*/
@Excel(name = "付款条件")
private String paymentTerms;
@ -678,6 +692,31 @@ public class SysSalesOrder extends BaseEntity {
this.enterpriseMaterialNo = enterpriseMaterialNo;
}
public String getCustomerDeliveryBillto() {
return customerDeliveryBillto;
}
public void setCustomerDeliveryBillto(String customerDeliveryBillto) {
this.customerDeliveryBillto = customerDeliveryBillto;
}
public String getDeliveryPhoneBillto() {
return deliveryPhoneBillto;
}
public void setDeliveryPhoneBillto(String deliveryPhoneBillto) {
this.deliveryPhoneBillto = deliveryPhoneBillto;
}
public String getDeliveryAddressBillto() {
return deliveryAddressBillto;
}
public void setDeliveryAddressBillto(String deliveryAddressBillto) {
this.deliveryAddressBillto = deliveryAddressBillto;
}
@Override
public String toString() {
return Objects.toStringHelper(this)

50
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSalesShippingInform.java

@ -71,17 +71,34 @@ public class SysSalesShippingInform extends BaseEntity
private Integer enterpriseSum;
/** 收货联系人 */
@Excel(name = "收货联系人")
@Excel(name = "收货联系人(Ship To)")
private String customerContact;
/** 联系电话 */
@Excel(name = "联系电话")
@Excel(name = "收货联系人(Ship To)")
private String contactNumber;
/** 收货地址 */
@Excel(name = "收货地址")
@Excel(name = "收货地址(Ship To)")
private String customerContactAddress;
/** 收货联系人 */
@Excel(name = "收货联系人(Bill To)")
private String customerContactBillto;
/** 联系电话 */
@Excel(name = "联系电话(Bill To)")
private String contactNumberBillto;
/** 收货地址 */
@Excel(name = "收货地址(Bill To)")
private String contactAddressBillto;
/** 不含税总价(RMB) */
@Excel(name = "不含税总价", readConverterExp = "R=MB")
private BigDecimal allPriceExcludingTaxRmb;
@ -337,6 +354,30 @@ public class SysSalesShippingInform extends BaseEntity
this.shippingInformDetailList = shippingInformDetailList;
}
public String getCustomerContactBillto() {
return customerContactBillto;
}
public void setCustomerContactBillto(String customerContactBillto) {
this.customerContactBillto = customerContactBillto;
}
public String getContactNumberBillto() {
return contactNumberBillto;
}
public void setContactNumberBillto(String contactNumberBillto) {
this.contactNumberBillto = contactNumberBillto;
}
public String getContactAddressBillto() {
return contactAddressBillto;
}
public void setContactAddressBillto(String contactAddressBillto) {
this.contactAddressBillto = contactAddressBillto;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -355,6 +396,9 @@ public class SysSalesShippingInform extends BaseEntity
.append("customerContact", getCustomerContact())
.append("contactNumber", getContactNumber())
.append("customerContactAddress", getCustomerContactAddress())
.append("customerContactBillto", getCustomerContactBillto())
.append("contactNumberBillto", getContactNumberBillto())
.append("contactAddressBillto", getContactAddressBillto())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())

11
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesOrderServiceImpl.java

@ -385,7 +385,16 @@ public class SysSalesOrderServiceImpl implements ISysSalesOrderService
sysSalesOrder.setUpdateBy(loginName);
sysSalesOrder.setUpdateTime(new Date());
for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrder.getSysSalesOrderChildList()) {
List<SysSalesOrderChild> sysSalesOrderChildList = sysSalesOrder.getSysSalesOrderChildList();
//如果子表中有申请出货数为空的数据,不能提交保存
boolean applyShippingNumHasNull = sysSalesOrderChildList.stream().anyMatch(sysSalesOrderChild -> sysSalesOrderChild.getApplyShippingNum() == null);
if (applyShippingNumHasNull){
throw new BusinessException("申请出货数不能为空,请检查");
}
for (SysSalesOrderChild sysSalesOrderChild : sysSalesOrderChildList) {
sysSalesOrderChild.setUpdateTime(new Date());
sysSalesOrderChild.setUpdateBy(loginName);

5
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSalesShippingInformServiceImpl.java

@ -207,10 +207,13 @@ public class SysSalesShippingInformServiceImpl implements ISysSalesShippingInfor
sysSalesShippingInform.setMaterialSum(Math.toIntExact(sysSalesOrderVo.getMaterialSum()));
//更新数量合计
sysSalesShippingInform.setEnterpriseSum(Math.toIntExact(sysSalesOrderVo.getEnterpriseSum()));
sysSalesShippingInform.setCustomerContact(sysSalesOrderVo.getCustomerDelivery());
sysSalesShippingInform.setContactNumber(sysSalesOrderVo.getDeliveryPhone());
sysSalesShippingInform.setCustomerContactAddress(sysSalesOrderVo.getDeliveryAddress());
sysSalesShippingInform.setCustomerContactBillto(sysSalesOrder.getCustomerDeliveryBillto());
sysSalesShippingInform.setContactNumberBillto(sysSalesOrder.getDeliveryPhoneBillto());
sysSalesShippingInform.setContactAddressBillto(sysSalesOrder.getDeliveryAddressBillto());
//更新销售出库详情数据

17
ruoyi-admin/src/main/resources/mapper/system/SysSalesShippingInformMapper.xml

@ -20,6 +20,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="customerContact" column="customer_contact" />
<result property="contactNumber" column="contact_number" />
<result property="customerContactAddress" column="customer_contact_address" />
<result property="contactAddressBillto" column="contact_address_billto" />
<result property="customerContactBillto" column="customer_contact_billto"/>
<result property="contactNumberBillto" column="contact_number_billto"/>
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
@ -36,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSysSalesShippingInformVo">
select shipping_inform_id, out_order_code, warehouse_out_status, sales_order_code, warehouse_out_type, warehouse_order_type, customer_id, customer_name, business_members, sales_order_number, material_sum, enterprise_sum, customer_contact, contact_number, customer_contact_address, create_time, create_by, update_by, update_time, remark, all_price_excluding_tax_rmb, all_price_excluding_tax_dollar, all_price_includes_tax, planned_delivery_time, acceptance_time, payment_condition, delivery_condition, deliver_time from sys_sales_shipping_inform
select shipping_inform_id, out_order_code, warehouse_out_status, sales_order_code, warehouse_out_type, warehouse_order_type, customer_id, customer_name, business_members, sales_order_number, material_sum, enterprise_sum, customer_contact, contact_number, customer_contact_address, contact_address_billto, customer_contact_billto, contact_number_billto, create_time, create_by, update_by, update_time, remark, all_price_excluding_tax_rmb, all_price_excluding_tax_dollar, all_price_includes_tax, planned_delivery_time, acceptance_time, payment_condition, delivery_condition, deliver_time from sys_sales_shipping_inform
</sql>
<select id="selectSysSalesShippingInformList" parameterType="SysSalesShippingInform" resultMap="SysSalesShippingInformResult">
@ -78,6 +81,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerContact != null">customer_contact,</if>
<if test="contactNumber != null">contact_number,</if>
<if test="customerContactAddress != null">customer_contact_address,</if>
<if test="contactAddressBillto != null">contact_address_billto,</if>
<if test="customerContactBillto != null">customer_contact_billto,</if>
<if test="contactNumberBillto != null">contact_number_billto,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
@ -107,6 +113,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerContact != null">#{customerContact},</if>
<if test="contactNumber != null">#{contactNumber},</if>
<if test="customerContactAddress != null">#{customerContactAddress},</if>
<if test="contactAddressBillto != null">#{contactAddressBillto},</if>
<if test="customerContactBillto != null">#{customerContactBillto},</if>
<if test="contactNumberBillto != null">#{contactNumberBillto},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
@ -140,6 +149,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerContact != null">customer_contact = #{customerContact},</if>
<if test="contactNumber != null">contact_number = #{contactNumber},</if>
<if test="customerContactAddress != null">customer_contact_address = #{customerContactAddress},</if>
<if test="contactAddressBillto != null">contact_address_billto = #{contactAddressBillto},</if>
<if test="customerContactBillto != null">customer_contact_billto = #{customerContactBillto},</if>
<if test="contactNumberBillto != null">contact_number_billto = #{contactNumberBillto},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
@ -174,6 +186,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="customerContact != null">customer_contact = #{customerContact},</if>
<if test="contactNumber != null">contact_number = #{contactNumber},</if>
<if test="customerContactAddress != null">customer_contact_address = #{customerContactAddress},</if>
<if test="contactAddressBillto != null">contact_address_billto = #{contactAddressBillto},</if>
<if test="customerContactBillto != null">customer_contact_billto = #{customerContactBillto},</if>
<if test="contactNumberBillto != null">contact_number_billto = #{contactNumberBillto},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>

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

@ -61,21 +61,49 @@
<div class="form-group">
<label class="col-sm-3 control-label">收货电话(Ship To):</label>
<div class="col-sm-8">
<input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" disabled>
<input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货地址(Ship To):</label>
<div class="col-sm-8">
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" disabled>
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货联系人(Bill To):</label>
<div class="col-sm-8">
<select class="form-control" name="customerDeliveryBillto" th:field="*{customerDeliveryBillto}" id="customerDeliveryBillto" required>
<!-- 这里动态生成生产单号选项 -->
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货电话(Bill To):</label>
<div class="col-sm-8">
<input name="deliveryPhoneBillto" th:field="*{deliveryPhoneBillto}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收货地址(Bill To):</label>
<div class="col-sm-8">
<input name="deliveryAddressBillto" th:field="*{deliveryAddressBillto}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>
</form>
<!--物料信息-->
<div class="container">
@ -205,6 +233,69 @@
loadCustomerDeliveryBillto();
//获取已经选择客户Id相关的生产单号
function loadCustomerDeliveryBillto() {
const url = ctx + 'system/customer/shippingList';
const data = {
enterpriseCode: sysSalesOrder.enterpriseCode,
};
// 使用 $.ajax 发送请求
$.ajax({
type: 'POST',
url: url,
dataType: 'json',
data: data,
success: function(response) {
console.log("response:", response);
if (response.code === 0 && Array.isArray(response.rows) && response.rows.length > 0) {
const selectElement = $('#customerDeliveryBillto');
selectElement.empty();
// 存储每个客户名称对应的信息
const customerDataMap = {};
// 遍历返回的数据,添加为下拉框的选项并存储数据
$.each(response.rows, function(index, item) {
const customerName = item.customerName;
customerDataMap[customerName] = item; // 存储数据
// 添加选项到下拉框
selectElement.append($('<option>', {value: customerName}).text(customerName));
});
// 监听下拉框的选择变化
selectElement.on('change', function() {
const selectedCustomerName = $(this).val();
if (selectedCustomerName in customerDataMap) {
const selectedCustomer = customerDataMap[selectedCustomerName];
$('#deliveryPhoneBillto').val(selectedCustomer.customerPhone);
$('#deliveryAddressBillto').val(selectedCustomer.deliveryAddress);
}
});
// 如果已经有了默认选项,则设置默认值
if (selectElement.children('option').length > 0) {
selectElement.trigger('change');
}
} else {
// 显示错误消息
$.modal.alertWarning("数据为空");
}
},
error: function(xhr, status, error) {
// 处理错误情况
console.error('AJAX Error:', error);
$.modal.alertWarning("请求失败,请稍后再试。");
},
});
}
//物料信息展示列表
$(function() {
var options = {

Loading…
Cancel
Save