Browse Source

rev:修改出入库操作逻辑

master
龚宝雄 7 months ago
parent
commit
a566334050
  1. 3
      lms/.idea/inspectionProfiles/Project_Default.xml
  2. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java
  3. 107
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/srm/WmsToSrmService.java
  4. 7
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

3
lms/.idea/inspectionProfiles/Project_Default.xml

@ -1,6 +1,9 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,cn.hutool.http.HttpRequest,execute" />
</inspection_tool>
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile> </profile>
</component> </component>

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java

@ -262,7 +262,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
for (EasOutInBillDto bill : bills) { for (EasOutInBillDto bill : bills) {
try { try {
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue); String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
wmsToSrmService.sendWebService(billJson); wmsToSrmService.sendWebPostData(billJson);
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").eq("djid", bill.getBillId())); easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").eq("djid", bill.getBillId()));
} catch (Exception e) { } catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString()); log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());

107
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/srm/WmsToSrmService.java

@ -1,6 +1,7 @@
package org.nl.wms.ext.srm; package org.nl.wms.ext.srm;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -28,64 +29,58 @@ public class WmsToSrmService {
@Value("${srmConfig.host}") @Value("${srmConfig.host}")
private String host; private String host;
@Value("${srmConfig.user}") public void sendWebPostData(String json) throws ServiceException, RemoteException {
private String user; com.alibaba.fastjson.JSONObject result;
String resultMsg = HttpRequest.post(host)
@Value("${srmConfig.password}") .body(json)
private String password; .execute().body();
result = com.alibaba.fastjson.JSONObject.parseObject(resultMsg);
@Value("${srmConfig.datacenter}") log.error("sendWebPostData接口请求成功,输出参数为:-------------------" + result.toString());
private String datacenter; }
@Value("${srmConfig.wsdlService}")
private String wsdlService;
@Value("${srmConfig.operationName}")
private String operationName;
public void sendWebService(String json) throws ServiceException, RemoteException { public void sendWebService(String json) throws ServiceException, RemoteException {
Service s = new Service(); // Service s = new Service();
Call call = (Call) s.createCall(); // Call call = (Call) s.createCall();
call.setReturnType(new QName("urn:client", "WSContext")); // call.setReturnType(new QName("urn:client", "WSContext"));
//本地根据wsdl文件建立的返回对象 // //本地根据wsdl文件建立的返回对象
call.setReturnClass(WSContext.class); // call.setReturnClass(WSContext.class);
// call.setOperationName("login"); // // call.setOperationName("login");
// //登录的webservice的wsdl的地址 // // //登录的webservice的wsdl的地址
// call.setTargetEndpointAddress(host + "EASLogin?wsdl"); // // call.setTargetEndpointAddress(host + "EASLogin?wsdl");
// call.setReturnQName(new QName("", "loginReturn")); // // call.setReturnQName(new QName("", "loginReturn"));
// //超时时间 自由配置 // // //超时时间 自由配置
// call.setTimeout(1000 * 60); // // call.setTimeout(1000 * 60);
// call.setMaintainSession(true); // // call.setMaintainSession(true);
// //解决方案:eas // // //解决方案:eas
// //语言:L2 简体中文 L3 繁体中文 // // //语言:L2 简体中文 L3 繁体中文
// //数据库类型:0 SQL Server 1 Oracle 2 DB2 // // //数据库类型:0 SQL Server 1 Oracle 2 DB2
// result = (WSContext) call.invoke(new Object[]{user, password, "eas", datacenter, "L2", 1, "BaseDB"}); // // result = (WSContext) call.invoke(new Object[]{user, password, "eas", datacenter, "L2", 1, "BaseDB"});
// //关键点,获取登录时返回的sessionid // // //关键点,获取登录时返回的sessionid
// String sessionId = result.getSessionId(); // // String sessionId = result.getSessionId();
// System.out.println(sessionId); // // System.out.println(sessionId);
// //登录失败抛出异常 // // //登录失败抛出异常
// if (sessionId == null) { // // if (sessionId == null) {
// log.error("sendWebService调用结果" + "login Eas Fail"); // // log.error("sendWebService调用结果" + "login Eas Fail");
// throw new Exception("login Eas Fail"); // // throw new Exception("login Eas Fail");
// } // // }
// call.clearOperation(); // // call.clearOperation();
//超时时间 自由配置 // //超时时间 自由配置
call.setTimeout(1000 * 60); // call.setTimeout(1000 * 60);
call.setMaintainSession(true); // call.setMaintainSession(true);
call.setTargetEndpointAddress(host + wsdlService + "?wsdl"); // call.setTargetEndpointAddress(host + wsdlService + "?wsdl");
call.setReturnQName(new QName("", "dealTaskReturn")); // call.setReturnQName(new QName("", "dealTaskReturn"));
//具体某个方法 // //具体某个方法
call.setOperationName(operationName); // call.setOperationName(operationName);
//关键点 传sessionid // //关键点 传sessionid
//call.addHeader(new SOAPHeaderElement("http://login.webservice.bos.kingdee.com", "SessionId")); // //call.addHeader(new SOAPHeaderElement("http://login.webservice.bos.kingdee.com", "SessionId"));
//接口报文 // //接口报文
Object invoke = call.invoke(new Object[]{json}); // Object invoke = call.invoke(new Object[]{json});
JSONObject jsonObject = JSON.parseObject((String) invoke); // JSONObject jsonObject = JSON.parseObject((String) invoke);
int results = jsonObject.getIntValue("result"); // int results = jsonObject.getIntValue("result");
log.error("sendWebService调用:" + "调用成功!"); // log.error("sendWebService调用:" + "调用成功!");
log.error("sendWebService调用结果:" + invoke.toString()); // log.error("sendWebService调用结果:" + invoke.toString());
log.error("sendWebService调用结果:" + results); // log.error("sendWebService调用结果:" + results);
System.out.println(invoke); // System.out.println(invoke);
} }
} }

7
lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -199,9 +199,4 @@ easConfig:
wsdlService: WSNLMESFacade wsdlService: WSNLMESFacade
operationName: dealTask operationName: dealTask
srmConfig: srmConfig:
host: http://192.168.100.100:8080/ormrpc/services/ host: http://10.10.188.30:8080/nuoli-srm/wmsBaseApi/receiveWmsInWhOrderAck
user: user
password: Noble123!9
datacenter: test
wsdlService: WSNLMESFacade
operationName: dealTask

Loading…
Cancel
Save