外协审批添加提交erp

liweidong
李涛 21 hours ago
parent 09340cb0a7
commit 189f1cfba4
  1. 38
      blade-service/blade-erpdata/src/main/java/org/springblade/erpdata/service/impl/ErpDataOemServiceImpl.java

@ -43,21 +43,33 @@ public class ErpDataOemServiceImpl implements IErpDataOemService {
@Override
public void closeErpOrder(String woCode, String memo) {
log.info("关闭erp外协订单 - 单号:{},备注:{}", woCode, memo);
try {
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate)
// 指定存储过程名(包含 DB Link)
.withProcedureName("dba_mgr.pro_rbclswxdata")
// 建议关闭元数据访问(通过 DB Link 访问时可避免权限/性能问题)
.withoutProcedureColumnMetaDataAccess()
// 显式声明参数
.declareParameters(
new SqlParameter("v_wono", Types.VARCHAR), // IN
new SqlParameter("v_rsn", Types.VARCHAR), // IN
new SqlParameter("v_clsdat", Types.DATE), // IN
new SqlOutParameter("v_excnote", Types.VARCHAR),// OUT
new SqlOutParameter("v_excflag", Types.VARCHAR) // OUT
);
// 2. 封装输入参数
Map<String, Object> inParams = new HashMap<>();
inParams.put("v_wono", woCode);
inParams.put("v_rsn", memo);
inParams.put("v_clsdat", new Date());
String sql = "{call pro_rbclswxdata(" +
":v_wono, :v_rsn, :v_clsdat)}";
try (Connection conn = dataSource.getConnection();
CallableStatement cs = conn.prepareCall(sql)) {
cs.setString("v_wono", woCode);
cs.setString("v_rsn", memo);
cs.setTimestamp("v_clsdat", new Timestamp(System.currentTimeMillis()));
// 执行
cs.execute();
log.info("关闭erp外协订单成功 - 单号:{},备注:{}", woCode, memo);
// 3. 执行并获取结果 Map
Map<String, Object> resultMap = jdbcCall.execute(inParams);
// 4. 提取输出参数
String excflag = (String) resultMap.get("v_excflag");
String excnote = (String) resultMap.get("v_excnote");
log.info("关闭erp外协订单返回结果:excflag-{},内容:excnote-{}", excflag, excnote);
} catch (Exception e) {
log.error("关闭erp外协订单失败 - 单号:{},备注:{}", woCode, memo, e);
}

Loading…
Cancel
Save