Browse Source

feat(srm): 添加供应商默认始发港字段支持

- 在 SrmSupplier 实体类中新增 defaultOriginPort 字段
- 更新数据库映射文件中的查询和更新语句以包含新字段
- 修改 updateProductionLeadTime 方法支持同时更新生产 Lead Time 和默认始发港
- 在服务层实现中添加对默认始发港字段的处理逻辑
- 确保空字符串自动转换为 null 以便正确清空数据库字段
master
qiankanghui 2 months ago
parent
commit
3789ebc737
  1. 5
      src/main/java/com/xujie/modules/srm/entity/SrmSupplier.java
  2. 3
      src/main/java/com/xujie/modules/srm/mapper/SrmSupplierMapper.java
  3. 9
      src/main/java/com/xujie/modules/srm/service/impl/SrmSupplierServiceImpl.java
  4. 13
      src/main/resources/mapper/srm/SrmSupplierMapper.xml

5
src/main/java/com/xujie/modules/srm/entity/SrmSupplier.java

@ -157,4 +157,9 @@ public class SrmSupplier extends QueryPage {
* 生产 Lead Time(srm_supplier.production_lead_time),由 Lead Time 维护页单独编辑。
*/
private Integer productionLeadTime;
/**
* 默认始发港(srm_supplier.default_origin_port),非必填。
*/
private String defaultOriginPort;
}

3
src/main/java/com/xujie/modules/srm/mapper/SrmSupplierMapper.java

@ -50,11 +50,12 @@ public interface SrmSupplierMapper extends BaseMapper<SrmSupplier> {
void updateSrmSupplier(SrmSupplier supplier);
/**
* Lead Time 维护页专用:按 site + supplierNo 单独更新 production_lead_time(允许 null 清空)。
* Lead Time 维护页专用:按 site + supplierNo 单独更新 production_lead_time 与 default_origin_port(均允许 null 清空)。
*/
int updateProductionLeadTime(@Param("site") String site,
@Param("supplierNo") String supplierNo,
@Param("productionLeadTime") Integer productionLeadTime,
@Param("defaultOriginPort") String defaultOriginPort,
@Param("updateBy") String updateBy);
SrmSupplier selectSrmSupplierById(@Param("id") Integer id);

9
src/main/java/com/xujie/modules/srm/service/impl/SrmSupplierServiceImpl.java

@ -360,12 +360,21 @@ public class SrmSupplierServiceImpl extends ServiceImpl<SrmSupplierMapper, SrmSu
if (leadTime != null && leadTime < 0) {
throw new RuntimeException("生产Lead Time不能小于0");
}
// 默认始发港:空串归一为 null,便于清空该字段
String originPort = supplier.getDefaultOriginPort();
if (originPort != null) {
originPort = originPort.trim();
if (originPort.isEmpty()) {
originPort = null;
}
}
SysUserEntity currentUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
String updateBy = currentUser == null ? null : currentUser.getUsername();
int rows = srmSupplierMapper.updateProductionLeadTime(
supplier.getSite().trim(),
supplier.getSupplierNo().trim(),
leadTime,
originPort,
updateBy
);
if (rows == 0) {

13
src/main/resources/mapper/srm/SrmSupplierMapper.xml

@ -7,7 +7,7 @@
id,site,supplier_no,supplier_name,supplier_group,create_date,create_by,update_date,update_by,supplier_doc_type,
TaxCode,FaxNo,PhoneNo,Contact,Address,PaymentTerm,DeliveryTerm,Buyer,Currency,ABC,Active,CreateDate,BankName,BankAccount,
TaxNo,Email,Memo,CustomerAddress,Tax,Email2,PhoneNo2,PhoneNo3,SourcingStaff,Other_contact1,Other_contact2,Other_contact3,
c_short_office,c_short_npc,planner,status,min_ship_account,handling_charge,production_lead_time
c_short_office,c_short_npc,planner,status,min_ship_account,handling_charge,production_lead_time,default_origin_port
</sql>
@ -59,7 +59,8 @@
<!-- rqrq - 最低出货金额为字典值,排在小单费前;小单费由 Service 去尾零 -->
s.min_ship_account AS minShipAccount,
s.handling_charge as handlingCharge,
s.production_lead_time AS productionLeadTime
s.production_lead_time AS productionLeadTime,
s.default_origin_port AS defaultOriginPort
FROM srm_supplier s
LEFT JOIN sys_dict_data sg ON sg.dict_value = s.supplier_group
AND sg.dict_type='supplier_group'
@ -395,7 +396,7 @@
Other_contact1,
Other_contact2,
Other_contact3,
Memo,c_short_office,c_short_npc,planner,min_ship_account,handling_charge <!-- rqrq - 新增写入最低出货金额、小单费 -->
Memo,c_short_office,c_short_npc,planner,min_ship_account,handling_charge,default_origin_port <!-- rqrq - 新增写入最低出货金额、小单费 -->
) VALUES (
#{site},
#{supplierNo},
@ -430,7 +431,7 @@
#{otherContact1},
#{otherContact2},
#{otherContact3},
#{memo},#{cShortOffice},#{cShortNpc},#{planner},#{minShipAccount},#{handlingCharge}
#{memo},#{cShortOffice},#{cShortNpc},#{planner},#{minShipAccount},#{handlingCharge},#{defaultOriginPort}
)
</insert>
@ -441,7 +442,8 @@
phoneNo = #{phoneNo},phoneNo2 = #{phoneNo2},phoneNo3 = #{phoneNo3},email = #{email}, email2 = #{email2},faxNo = #{faxNo},Other_contact1 = #{otherContact1},Other_contact2 = #{otherContact2},
Other_contact3 = #{otherContact3},bankName= #{bankName},bankAccount = #{bankAccount}, address = #{address},memo = #{memo},c_short_office=#{cShortOffice},c_short_npc=#{cShortNpc},planner=#{planner},
min_ship_account = #{minShipAccount}, <!-- rqrq - 编辑回写最低出货金额 -->
handling_charge = #{handlingCharge}
handling_charge = #{handlingCharge},
default_origin_port = #{defaultOriginPort}
WHERE id = #{id}
</update>
@ -451,6 +453,7 @@
<update id="updateProductionLeadTime">
UPDATE srm_supplier
SET production_lead_time = #{productionLeadTime,jdbcType=INTEGER},
default_origin_port = #{defaultOriginPort,jdbcType=VARCHAR},
update_date = GETDATE(),
update_by = #{updateBy}
WHERE site = #{site}

Loading…
Cancel
Save