Merge branch 'master' of http://42.192.7.176:3000/suojin/jonhon-mes-svr into liweidong
commit
a47571643b
15 changed files with 491 additions and 16 deletions
@ -0,0 +1,62 @@ |
||||
package org.springblade.erpdata.feign; |
||||
|
||||
import org.springblade.common.constant.LauncherConstant; |
||||
import org.springblade.common.exception.BusinessException; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.wms.pojo.entity.StRealtimeStock; |
||||
import org.springframework.cloud.openfeign.FeignClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @version 1.0 |
||||
* @program: jonhon-mes-svr |
||||
* @ClassName IErpDataWmsClient |
||||
* @description: |
||||
* @autor: WuSiYu |
||||
* @create 2026-04-28 11:32 |
||||
**/ |
||||
@FeignClient( |
||||
value = LauncherConstant.APPLICATION_ERP_DATA_NAME |
||||
) |
||||
public interface IErpDataWmsClient { |
||||
|
||||
String API_PREFIX = "/feign/erpdata/wms"; |
||||
|
||||
String SEND_ST_SUBMISSION = API_PREFIX + "/sendStSubmission"; |
||||
|
||||
String SEND_ERP_BUY_REQUEST = API_PREFIX + "/sendErpBuyRequest"; |
||||
|
||||
String CREATE_MOLD_PLAN = API_PREFIX + "/createMoldPlan"; |
||||
|
||||
String DELETE_MOLD_PLAN = API_PREFIX + "/deleteMoldPlan"; |
||||
|
||||
/** |
||||
* 到期送检发送erp |
||||
*/ |
||||
@GetMapping(SEND_ST_SUBMISSION) |
||||
R<String> sendStSubmission(@RequestParam("stRealtimeStock")StRealtimeStock stRealtimeStock, @RequestParam("goodsCode")String goodsCode, @RequestParam("userName")String userName) throws BusinessException; |
||||
|
||||
/** |
||||
* 仓库提请发送erp |
||||
*/ |
||||
@GetMapping(SEND_ERP_BUY_REQUEST) |
||||
R<String> sendErpBuyRequest(@RequestParam("extraBill")String extraBill, @RequestParam("qty")Double qty, @RequestParam("ldapName")String ldapName) throws BusinessException; |
||||
|
||||
/** |
||||
* 工装计划申报发送erp |
||||
*/ |
||||
@GetMapping(CREATE_MOLD_PLAN) |
||||
R<String> createMoldPlan(@RequestParam("partCode")String partCode, @RequestParam("moCode")String moCode, @RequestParam("plantype")String plantype, @RequestParam("quantity")Double quantity, |
||||
@RequestParam("needDate")Date needDate, @RequestParam("level")String level, @RequestParam("keeper")String keeper, @RequestParam("createMan")String createMan, |
||||
@RequestParam("memo")String memo, @RequestParam("urgentType")String urgentType, @RequestParam("erpWoCode")String erpWoCode) throws BusinessException; |
||||
|
||||
/** |
||||
* 工装计划申报删除发送erp |
||||
*/ |
||||
@GetMapping(DELETE_MOLD_PLAN) |
||||
R<String> deleteMoldPlan(@RequestParam("erpWoCode")String erpWoCode) throws BusinessException; |
||||
|
||||
} |
||||
@ -0,0 +1,41 @@ |
||||
package org.springblade.erpdata.feign; |
||||
|
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.wms.pojo.entity.StRealtimeStock; |
||||
import org.springframework.stereotype.Component; |
||||
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @version 1.0 |
||||
* @program: jonhon-mes-svr |
||||
* @ClassName IErpDataWmsClientFallback |
||||
* @description: |
||||
* @autor: WuSiYu |
||||
* @create 2026-04-28 14:18 |
||||
**/ |
||||
@Component |
||||
public class IErpDataWmsClientFallback implements IErpDataWmsClient{ |
||||
@Override |
||||
public R<String> sendStSubmission(@RequestParam("stRealtimeStock") StRealtimeStock stRealtimeStock, @RequestParam("goodsCode")String goodsCode, @RequestParam("userName")String userName) { |
||||
return R.fail("获取数据失败"); |
||||
} |
||||
|
||||
@Override |
||||
public R<String> sendErpBuyRequest(@RequestParam("extraBill")String extraBill, @RequestParam("qty")Double qty, @RequestParam("ldapName")String ldapName) { |
||||
return R.fail("获取数据失败"); |
||||
} |
||||
|
||||
@Override |
||||
public R<String> createMoldPlan(@RequestParam("partCode")String partCode, @RequestParam("moCode")String moCode, @RequestParam("plantype")String plantype, @RequestParam("quantity")Double quantity, |
||||
@RequestParam("needDate") Date needDate, @RequestParam("level")String level, @RequestParam("keeper")String keeper, @RequestParam("createMan")String createMan, |
||||
@RequestParam("memo")String memo, @RequestParam("urgentType")String urgentType, @RequestParam("erpWoCode")String erpWoCode) { |
||||
return R.fail("获取数据失败"); |
||||
} |
||||
|
||||
@Override |
||||
public R<String> deleteMoldPlan(@RequestParam("erpWoCode")String erpWoCode) { |
||||
return R.fail("获取数据失败"); |
||||
} |
||||
} |
||||
@ -0,0 +1,50 @@ |
||||
package org.springblade.erpdata.feign; |
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.common.exception.BusinessException; |
||||
import org.springblade.core.tenant.annotation.NonDS; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.erpdata.service.IErpDataWmsService; |
||||
import org.springblade.wms.pojo.entity.StRealtimeStock; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @version 1.0 |
||||
* @program: jonhon-mes-svr |
||||
* @ClassName ErpDataWmsClient |
||||
* @description: |
||||
* @autor: WuSiYu |
||||
* @create 2026-04-28 11:30 |
||||
**/ |
||||
@NonDS |
||||
@Hidden |
||||
@RestController |
||||
@AllArgsConstructor |
||||
public class ErpDataWmsClient implements IErpDataWmsClient{ |
||||
|
||||
private final IErpDataWmsService erpDataWmsService; |
||||
@Override |
||||
public R<String> sendStSubmission(StRealtimeStock stRealtimeStock, String goodsCode, String userName) throws BusinessException { |
||||
return R.data(erpDataWmsService.sendStSubmission(stRealtimeStock, goodsCode, userName)); |
||||
} |
||||
|
||||
@Override |
||||
public R<String> sendErpBuyRequest(String extraBill, Double qty, String ldapName) throws BusinessException { |
||||
return R.data(erpDataWmsService.sendErpBuyRequest(extraBill, qty, ldapName)); |
||||
} |
||||
|
||||
@Override |
||||
public R<String> createMoldPlan(String partCode, String moCode, String plantype, Double quantity, Date needDate, String level, |
||||
String keeper, String createMan, String memo, String urgentType, String erpWoCode) throws BusinessException { |
||||
return R.data(erpDataWmsService.createMoldPlan(partCode, moCode, plantype, quantity, needDate, level, |
||||
keeper, createMan, memo, urgentType, erpWoCode)); |
||||
} |
||||
|
||||
@Override |
||||
public R<String> deleteMoldPlan(String erpWoCode) throws BusinessException { |
||||
return R.data(erpDataWmsService.deleteMoldPlan(erpWoCode)); |
||||
} |
||||
} |
||||
@ -0,0 +1,26 @@ |
||||
package org.springblade.erpdata.service; |
||||
|
||||
import org.springblade.common.exception.BusinessException; |
||||
import org.springblade.wms.pojo.entity.StRealtimeStock; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @version 1.0 |
||||
* @program: jonhon-mes-svr |
||||
* @ClassName IErpDataWmsService |
||||
* @description: |
||||
* @autor: WuSiYu |
||||
* @create 2026-04-28 11:24 |
||||
**/ |
||||
|
||||
public interface IErpDataWmsService { |
||||
|
||||
String sendStSubmission(StRealtimeStock stRealtimeStock, String goodsCode, String userName) throws BusinessException; |
||||
|
||||
String sendErpBuyRequest(String extraBill, Double qty, String ldapName) throws BusinessException; |
||||
|
||||
String createMoldPlan(String partCode, String moCode, String plantype, Double quantity, Date needDate, String level, String keeper, String createMan, String memo, String urgentType, String erpWoCode) throws BusinessException; |
||||
|
||||
String deleteMoldPlan(String erpWoCode) throws BusinessException; |
||||
} |
||||
@ -0,0 +1,212 @@ |
||||
package org.springblade.erpdata.service.impl; |
||||
|
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springblade.common.exception.BusinessException; |
||||
import org.springblade.erpdata.service.IErpDataWmsService; |
||||
import org.springblade.wms.pojo.entity.StRealtimeStock; |
||||
import org.springframework.jdbc.core.JdbcTemplate; |
||||
import org.springframework.jdbc.core.SqlOutParameter; |
||||
import org.springframework.jdbc.core.SqlParameter; |
||||
import org.springframework.jdbc.core.simple.SimpleJdbcCall; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.sql.Types; |
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @version 1.0 |
||||
* @program: jonhon-mes-svr |
||||
* @ClassName ErpDataWmsServiceImpl |
||||
* @description: |
||||
* @autor: WuSiYu |
||||
* @create 2026-04-28 11:23 |
||||
**/ |
||||
|
||||
@Slf4j |
||||
@RequiredArgsConstructor |
||||
@Service |
||||
public class ErpDataWmsServiceImpl implements IErpDataWmsService { |
||||
|
||||
private final JdbcTemplate jdbcTemplate; |
||||
|
||||
@Override |
||||
public String sendStSubmission(StRealtimeStock stRealtimeStock, String goodsCode, String userName) throws BusinessException { |
||||
|
||||
// 1. 创建存储过程调用
|
||||
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate) |
||||
// 存储过程名 + DBLink
|
||||
.withProcedureName("dba_mgr.pro_rbprtchk") |
||||
// 关闭元数据(DBLink必须加)
|
||||
.withoutProcedureColumnMetaDataAccess() |
||||
// 声明参数:顺序必须和存储过程一致!
|
||||
.declareParameters( |
||||
new SqlParameter("v_prtno", Types.VARCHAR), // IN 物料号
|
||||
new SqlParameter("v_prtlotno", Types.VARCHAR), // IN 生产标识
|
||||
new SqlParameter("v_barcode", Types.VARCHAR), // IN 库存条码值
|
||||
new SqlParameter("v_invqty", Types.DOUBLE), // IN 库存数量
|
||||
new SqlParameter("v_splycode", Types.VARCHAR), // IN 供方代码
|
||||
new SqlParameter("v_qutno", Types.VARCHAR), // IN 检验编号
|
||||
new SqlParameter("v_chkname", Types.VARCHAR), // IN 送检人员
|
||||
new SqlOutParameter("v_excnote", Types.VARCHAR), // OUT 错误信息
|
||||
new SqlOutParameter("v_excflag", Types.VARCHAR), // OUT 状态
|
||||
new SqlOutParameter("v_prtchno", Types.VARCHAR) // OUT 送检单号
|
||||
); |
||||
|
||||
// 2. 封装输入参数
|
||||
Map<String, Object> inParams = new HashMap<>(); |
||||
inParams.put("v_prtno", goodsCode); |
||||
inParams.put("v_prtlotno", stRealtimeStock.getQuantityLevel()); |
||||
inParams.put("v_barcode", stRealtimeStock.getBarCode()); |
||||
inParams.put("v_invqty", stRealtimeStock.getQuantity()); |
||||
inParams.put("v_splycode", StringUtils.isNotBlank(stRealtimeStock.getSplyCode()) ? stRealtimeStock.getSplyCode() : ""); |
||||
inParams.put("v_qutno", stRealtimeStock.getCheckCode()); |
||||
inParams.put("v_chkname", userName); |
||||
|
||||
// 3. 执行存储过程
|
||||
Map<String, Object> resultMap = jdbcCall.execute(inParams); |
||||
|
||||
// 4. 获取输出参数
|
||||
String excflag = (String) resultMap.get("v_excflag"); |
||||
String excnote = (String) resultMap.get("v_excnote"); |
||||
String wsCode = (String) resultMap.get("v_prtchno"); |
||||
|
||||
// 5. 业务判断
|
||||
if ("0".equals(excflag)) { |
||||
throw new BusinessException("到期送检发送失败,请联系信息部!!! " + excnote); |
||||
} |
||||
|
||||
return wsCode; |
||||
} |
||||
|
||||
@Override |
||||
public String sendErpBuyRequest(String extraBill, Double qty, String ldapName) throws BusinessException{ |
||||
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate) |
||||
// 指定存储过程名(包含 DB Link)
|
||||
.withProcedureName("dba_mgr.pro_rbinvdeptreqmtn") |
||||
// 关闭元数据访问(DBLink 必须加)
|
||||
.withoutProcedureColumnMetaDataAccess() |
||||
// 显式声明参数(顺序必须和存储过程一致)
|
||||
.declareParameters( |
||||
new SqlParameter("v_wono", Types.VARCHAR), // IN
|
||||
new SqlParameter("v_applyqty", Types.DOUBLE), // IN
|
||||
new SqlParameter("v_mtnman", Types.VARCHAR), // 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", extraBill == null ? "" : extraBill); |
||||
inParams.put("v_applyqty", qty == null ? 0D : qty); |
||||
inParams.put("v_mtnman", ldapName == null ? "" : ldapName); |
||||
|
||||
// 3. 执行并获取结果 Map
|
||||
Map<String, Object> resultMap = jdbcCall.execute(inParams); |
||||
|
||||
// 4. 提取输出参数
|
||||
String excflag = (String) resultMap.get("v_excflag"); |
||||
String excnote = (String) resultMap.get("v_excnote"); |
||||
|
||||
// 5. 业务判断
|
||||
if ("0".equals(excflag)) { |
||||
throw new BusinessException("申报信息发送erp失败!" + excnote); |
||||
} |
||||
|
||||
return excflag; |
||||
} |
||||
|
||||
@Override |
||||
public String createMoldPlan(String partCode, String moCode, String plantype, Double quantity, Date needDate, String level, |
||||
String keeper, String createMan, String memo, String urgentType, String erpWoCode) throws BusinessException{ |
||||
|
||||
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate) |
||||
// 指定存储过程名(包含 DB Link)
|
||||
.withProcedureName("dba_mgr.pro_rbtoolreqm") |
||||
// 关闭元数据访问(DBLink 必须加)
|
||||
.withoutProcedureColumnMetaDataAccess() |
||||
// 显式声明参数(顺序必须和存储过程一致)
|
||||
.declareParameters( |
||||
new SqlParameter("v_prtno", Types.VARCHAR), |
||||
new SqlParameter("v_toolcode", Types.VARCHAR), |
||||
new SqlParameter("v_plntype", Types.VARCHAR), |
||||
new SqlParameter("v_tlreqqty", Types.INTEGER), |
||||
new SqlParameter("v_tlreqdat", Types.DATE), |
||||
new SqlParameter("v_prtmdept", Types.VARCHAR), |
||||
new SqlParameter("v_prtlotno", Types.VARCHAR), |
||||
new SqlParameter("v_WARCTLR", Types.VARCHAR), |
||||
new SqlParameter("v_operator", Types.VARCHAR), |
||||
new SqlParameter("v_remark", Types.VARCHAR), |
||||
new SqlParameter("v_stat", Types.VARCHAR), |
||||
new SqlParameter("v_toolid1", Types.VARCHAR), |
||||
new SqlOutParameter("v_excnote", Types.VARCHAR), |
||||
new SqlOutParameter("v_excflag", Types.VARCHAR), |
||||
new SqlOutParameter("v_toolid", Types.VARCHAR) |
||||
); |
||||
|
||||
// 2. 封装输入参数
|
||||
Map<String, Object> inParams = new HashMap<>(); |
||||
inParams.put("v_prtno", partCode); |
||||
inParams.put("v_toolcode", moCode); |
||||
inParams.put("v_plntype", plantype); |
||||
inParams.put("v_tlreqqty", quantity); |
||||
inParams.put("v_tlreqdat", needDate); |
||||
inParams.put("v_prtmdept", "3600"); |
||||
inParams.put("v_prtlotno", level); |
||||
inParams.put("v_WARCTLR", keeper); |
||||
inParams.put("v_operator", createMan); |
||||
inParams.put("v_remark", StringUtils.isBlank(memo) ? "" : memo); |
||||
inParams.put("v_stat", urgentType); |
||||
inParams.put("v_toolid1", StringUtils.isNotBlank(erpWoCode) ? erpWoCode : ""); |
||||
|
||||
// 3. 执行并获取结果 Map
|
||||
Map<String, Object> resultMap = jdbcCall.execute(inParams); |
||||
|
||||
// 4. 提取输出参数
|
||||
String excflag = (String) resultMap.get("v_excflag"); |
||||
String excnote = (String) resultMap.get("v_excnote"); |
||||
String wxno = (String) resultMap.get("v_toolid"); |
||||
|
||||
// 5. 业务判断
|
||||
if ("0".equals(excflag)) { |
||||
throw new BusinessException("模具计划发送erp" + excnote); |
||||
} |
||||
|
||||
return wxno; |
||||
} |
||||
|
||||
@Override |
||||
public String deleteMoldPlan(String erpWoCode) throws BusinessException { |
||||
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate) |
||||
// 指定存储过程名(包含 DB Link)
|
||||
.withProcedureName("dba_mgr.pro_rbtooldel") |
||||
// 关闭元数据访问(DBLink 必须加)
|
||||
.withoutProcedureColumnMetaDataAccess() |
||||
// 显式声明参数
|
||||
.declareParameters( |
||||
new SqlParameter("v_toolid", Types.VARCHAR), // 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_toolid", erpWoCode); |
||||
|
||||
// 3. 执行并获取结果 Map
|
||||
Map<String, Object> resultMap = jdbcCall.execute(inParams); |
||||
|
||||
// 4. 提取输出参数
|
||||
String excflag = (String) resultMap.get("v_excflag"); |
||||
String excnote = (String) resultMap.get("v_excnote"); |
||||
|
||||
// 5. 业务判断
|
||||
if ("0".equals(excflag)) { |
||||
throw new BusinessException("删除工装计划失败" + excnote); |
||||
} |
||||
return excflag; |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue