Commit 17974676 LN

西门子入库增加 checkIn 接口

1 个父辈 169373a4
......@@ -295,7 +295,7 @@ public class CodeResolve {
return null;
}
private Collection<CodeBean> resolveCodeStr(String codeStr,int type){
public Collection<CodeBean> resolveCodeStr(String codeStr,int type){
List<CodeBean> codeBeans = Lists.newArrayList();
//Map<String, CodeBean> codeBeanMap = Maps.newHashMap();
if(!Strings.isNullOrEmpty(codeStr)){
......
......@@ -3,18 +3,15 @@ package com.neotel.smfcore.core.device.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.enums.SOLDER_STATUS;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.manager.IComponentManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.barcode.service.po.Component;
import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.api.IOpAuthApi;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
......@@ -25,7 +22,6 @@ import com.neotel.smfcore.core.device.handler.IDeviceHandler;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.enums.ORDER_COLOR;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
import com.neotel.smfcore.core.storage.enums.DeviceType;
......@@ -35,7 +31,6 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.bean.OrderSetting;
import com.neotel.smfcore.core.system.service.dao.IAlarmInfoDao;
import com.neotel.smfcore.core.system.service.dao.IDataLogDao;
import com.neotel.smfcore.core.system.service.manager.IHumitureManager;
import com.neotel.smfcore.core.system.service.po.AlarmInfo;
import com.neotel.smfcore.core.system.service.po.DataLog;
......@@ -44,10 +39,9 @@ import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.service.manager.IGroupManager;
import com.neotel.smfcore.siemens.SiemensApi;
import lombok.Data;
import com.neotel.smfcore.siemens.bean.LotCheckInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.web.csrf.CsrfTokenRepository;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
......@@ -93,6 +87,9 @@ public class BaseDeviceHandler implements IDeviceHandler {
@Autowired
protected LiteOrderCache liteOrderCache;
@Autowired
protected IComponentManager componentManager;
/**
* CID的服务器消息(key 为 cid)
*/
......@@ -231,6 +228,66 @@ public class BaseDeviceHandler implements IDeviceHandler {
}
}
protected Barcode siemensCheckCode(String codeStr,int type) {
try {
Collection<CodeBean> codeBeans = codeResolve.resolveCodeStr(codeStr, type);
// Collection<CodeBean> codeBeans = codeResolve.resolveCodeStr("=1+0x0-7x8=5YM05960654", COMPONENT_TYPE.COMPONENT);
boolean ok = false;
for (CodeBean codebean :
codeBeans) {
if (codebean.hasReelSizeInfo()) {
LotCheckInfo info = SiemensApi.lotCheckIn(codebean.getCodeStr());
if (info != null && info.isStatus() && ObjectUtil.isNotEmpty(info.getPartnum()) && ObjectUtil.isNotEmpty(info.getQuantity())) {
//查找元器件是否存在
Component component = componentManager.findOneByPN(info.getPartnum());
if (component == null) {
//新建元器件和条码
component = new Component();
component.setPartNumber(info.getPartnum());
component.setAmount(info.getQuantity());
component.setHeight(codebean.getReelHeight());
component.setPlateSize(codebean.getReelWidth());
component = componentManager.saveComponent(component);
log.info("siemensCheckCode 新增 元器件:[" + component.getPartNumber() + "][" + component.getAmount() + "][" + component.getPlateSize() + "]X[" + component.getHeight() + "]");
} else if (component.getAmount() != info.getQuantity()) {
component.setAmount(info.getQuantity());
component = componentManager.saveComponent(component);
log.info("siemensCheckCode 修改 元器件:[" + component.getPartNumber() + "]数量为[" + component.getAmount() + "] ");
}
//判断条码是否存在
Barcode barcode = barcodeManager.get(codebean.getCodeStr());
if (barcode == null) {
barcode = new Barcode();
barcode.setPlateSize(component.getPlateSize());
barcode.setHeight(component.getHeight());
barcode.setBarcode(codebean.getCodeStr());
barcode.setAmount(component.getAmount());
barcode.setFullCode(codebean.getCodeStr());
barcode.setPartNumber(component.getPartNumber());
barcode = barcodeManager.saveBarcode(barcode);
log.info("siemensCheckCode 新增 条码:[" + barcode.getBarcode() + "] ");
}else if(!barcode.getPartNumber().equals(component.getPartNumber())){
barcode.setPlateSize(component.getPlateSize());
barcode.setHeight(component.getHeight());
barcode.setBarcode(codebean.getCodeStr());
barcode.setAmount(component.getAmount());
barcode.setPartNumber(component.getPartNumber());
log.info("siemensCheckCode 修改 条码:[" + barcode.getBarcode() + "] pn为 ["+barcode.getPartNumber()+"] ");
}
return barcode;
}
}
}
} catch (Exception ex) {
log.info("siemensCheckCode 验证条码 [" + codeStr + "] 出错:", ex);
}
return null;
}
/**
* 流水线入库:优先查找空闲BOX中同尺寸的,如果找不到,再查找可入库 BOX(可用且不是出库状态) 同尺寸或比盘尺寸大的仓位
*/
......@@ -241,7 +298,16 @@ public class BaseDeviceHandler implements IDeviceHandler {
type=COMPONENT_TYPE.FIXTURE;
}
String codeStr = statusBean.getCode();
Barcode barcodeSave = codeResolve.resolveOneValideBarcode(codeStr,type);
Barcode barcodeSave =null;
try{
barcodeSave = codeResolve.resolveOneValideBarcode(codeStr,type);
}catch (ValidateException validateException) {
barcodeSave = siemensCheckCode(codeStr,type);
if (barcodeSave == null) {
throw validateException;
}
}
// Barcode barcodeSave = codeResolve.resolveOneValideBarcode(codeStr,type);
//本地难条码是否可以入库
verifyBarcodePutIn(Lists.<Storage>newArrayList(storage), barcodeSave);
//从API验证
......
......@@ -3,10 +3,9 @@ package com.neotel.smfcore.siemens;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.XmlUtil;
import com.neotel.smfcore.core.system.listener.ITaskListener;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.siemens.util.WSClientUtil;
import com.neotel.smfcore.siemens.bean.LotCheckInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -37,7 +36,8 @@ public class SiemensApi implements ITaskListener {
public static boolean lotInOut(String lot,int inoutType) {
if (ObjectUtil.isEmpty(config.url)) {
String url=config.url;
if (ObjectUtil.isEmpty(url)) {
log.info("没有配置Siemens,无需通知");
return true;
}
......@@ -45,21 +45,21 @@ public class SiemensApi implements ITaskListener {
if (inoutType == 2) {
action = "OUT";
}
log.info("Siemens[" + config.url + "]:料盘[" + lot + "][" + action + "]完成");
log.info("Siemens[" + url + "]:料盘[" + lot + "][" + action + "]完成");
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("LotID", lot);
params.put("ACTION", action);
String result = HttpHelper.postJson(config.url, params);
log.info("Siemens[" + config.url + "]返回料盘[" + lot + "]的[" + action + "]结果:" + result);
String result = HttpHelper.postJson(url, params);
log.info("Siemens[" + url + "]返回料盘[" + lot + "]的[" + action + "]结果:" + result);
Map<String,Object> returnMap= JsonUtil.toMap(result);
if(returnMap!=null&&returnMap.containsKey("Status")) {
boolean res = Boolean.parseBoolean(returnMap.get("Status").toString());
return res;
}
} catch (Exception e) {
log.error("Siemens[" + config.url + "]:料盘[" + lot + "][" + action + "]完成 出错:", e);
log.error("Siemens[" + url + "]:料盘[" + lot + "][" + action + "]完成 出错:", e);
}
return false;
// lot进tower:
......@@ -90,263 +90,304 @@ public class SiemensApi implements ITaskListener {
// }
}
private static boolean getMaterialLot(int inoutType,String storageId,String storageName,String materialLot){
if(ObjectUtil.isEmpty(config.url)){
return true;
public static LotCheckInfo lotCheckIn(String lot) {
String url = config.url_checkIn;
if (ObjectUtil.isEmpty(url)) {
log.info("没有配置Siemens,无需验证");
return null;
}
String action = "checkIn";
log.info("Siemens[" + url + "]:料盘[" + lot + "][" + action + "]");
try {
String action=config.action_GetMaterialLot;
String msg="getMaterialLot ["+inoutType+"]["+storageId+"]["+storageName+"]["+materialLot+"] :";
String soap=buildGetLotXml(action, inoutType,storageId,storageName,materialLot);
// //XML测试
// String text= XmlUtil.getElementByNode("a:Action", soap );
// String text2= XmlUtil.getNodeBody("a:Action", soap );
// String text3= XmlUtil.getNodeAttribute("DataArea","xmlns", soap );
String returnData= WSClientUtil.sendSoap(config.host,config.GetPort(), config.url,soap);
if(ObjectUtil.isEmpty(returnData)){
log.error(msg+"未收到结果");
return true;
}else {
//2 facts server反馈的actionCode为Accepted时,执行步骤3, actionCode为Rejected时不允许出库
String actionCode = XmlUtil.getNodeAttribute("ResponseExpression", "actionCode", returnData);
String msgBody=XmlUtil.getNodeBody("ResponseExpression", returnData );
if (ObjectUtil.isNotEmpty(actionCode)) {
if (actionCode.equals("Accepted")) {
log.info(msg + " 返回,actionCode = " + actionCode+","+msgBody);
return true;
Map<String, Object> params = new HashMap<String, Object>();
params.put("LotID", lot);
params.put("ACTION", action);
String result = HttpHelper.postJson(url, params);
log.info("Siemens[" + url + "]返回料盘[" + lot + "]的[" + action + "]结果:" + result);
Map<String, Object> returnMap = JsonUtil.toMap(result);
if (returnMap != null && returnMap.containsKey("Status")) {
// LotCheckInfo obj = JsonUtil.toObj(result, LotCheckInfo.class);
LotCheckInfo obj= LotCheckInfo.toObj(lot, result);
if (obj != null) {
return obj;
}
}
log.info(msg + " 返回,actionCode = " + actionCode+","+msgBody);
return false;
} catch (Exception e) {
log.error("Siemens[" + url + "]:料盘[" + lot + "][" + action + "]出错:", e);
}
//   参数如下:
//    Action: http://siplace.com/facts/materiallot/2010/01/MaterialLot/GetMaterialLot
//    MaterialLot的ID为料盘的唯一码
// String soap="<a:Action s:mustUnderstand=\"1\">"+action+"</a:Action>"
// + "<DataArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
// + "<Get>"
// + "<Expression>Get</Expression>"
// + "</Get>"
// + "<MaterialLot>"
// + "<ID>"
// + "<Value>"+MaterialLot+"</Value>"
// + "</ID>"
// + "</MaterialLot>"
// + "</DataArea>";
return null;
// {
// "LotID": "M03289629",
// "ACTION": "checkIn"
// }
// {
// "Status": true,
// "Message": "OK",
// "Code": 0/非0,
// "partnum": A5EXXXX,
// "quantity": 1000,
// }
}
private static boolean processMaterialLot(int inoutType,String storageId,String storageName,String materialLot){
if(ObjectUtil.isEmpty(config.url)){
return true;
}
String action=config.action_ProcessMaterialLot;
String msg="processMaterialLot ["+inoutType+"]["+storageId+"]["+storageName+"]["+materialLot+"] :";
String soap=buildProcessXml(action, inoutType,storageId,storageName,materialLot);
String returnData= WSClientUtil.sendSoap(config.host,config.GetPort(), config.url,soap);
if(ObjectUtil.isEmpty(returnData)){
log.error(msg+"未收到结果");
return true;
}else {
//facts server收到信息后,反回OK,出库流程结束
String actionCode = XmlUtil.getNodeAttribute("ResponseExpression", "actionCode", returnData);
String msgBody=XmlUtil.getNodeBody("ResponseExpression", returnData );
if (ObjectUtil.isNotEmpty(actionCode)) {
if (actionCode.equals("Accepted")) {
log.info(msg + " 返回,actionCode = " + actionCode+","+msgBody);
return true;
}
}
log.info(msg + " 返回,actionCode = " + actionCode+","+msgBody);
return false;
}
// String soap="<a:Action s:mustUnderstand=\"1\">"+action+"</a:Action>"
// + "<DataArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
// private static boolean getMaterialLot(int inoutType,String storageId,String storageName,String materialLot){
//
// if(ObjectUtil.isEmpty(config.url)){
// return true;
// }
//
// String action=config.action_GetMaterialLot;
// String msg="getMaterialLot ["+inoutType+"]["+storageId+"]["+storageName+"]["+materialLot+"] :";
// String soap=buildGetLotXml(action, inoutType,storageId,storageName,materialLot);
//
//
//// //XML测试
//// String text= XmlUtil.getElementByNode("a:Action", soap );
//// String text2= XmlUtil.getNodeBody("a:Action", soap );
//// String text3= XmlUtil.getNodeAttribute("DataArea","xmlns", soap );
//
// String returnData= WSClientUtil.sendSoap(config.host,config.GetPort(), config.url,soap);
// if(ObjectUtil.isEmpty(returnData)){
// log.error(msg+"未收到结果");
// return true;
// }else {
//
// //2 facts server反馈的actionCode为Accepted时,执行步骤3, actionCode为Rejected时不允许出库
// String actionCode = XmlUtil.getNodeAttribute("ResponseExpression", "actionCode", returnData);
// String msgBody=XmlUtil.getNodeBody("ResponseExpression", returnData );
// if (ObjectUtil.isNotEmpty(actionCode)) {
// if (actionCode.equals("Accepted")) {
// log.info(msg + " 返回,actionCode = " + actionCode+","+msgBody);
// return true;
// }
// }
//
// log.info(msg + " 返回,actionCode = " + actionCode+","+msgBody);
// return false;
// }
//
////   参数如下:
////    Action: http://siplace.com/facts/materiallot/2010/01/MaterialLot/GetMaterialLot
////    MaterialLot的ID为料盘的唯一码
//// String soap="<a:Action s:mustUnderstand=\"1\">"+action+"</a:Action>"
//// + "<DataArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
//// + "<Get>"
//// + "<Expression>Get</Expression>"
//// + "</Get>"
//// + "<MaterialLot>"
//// + "<ID>"
//// + "<Value>"+MaterialLot+"</Value>"
//// + "</ID>"
//// + "</MaterialLot>"
//// + "</DataArea>";
//
//
// }
//
//
// private static boolean processMaterialLot(int inoutType,String storageId,String storageName,String materialLot){
//
// if(ObjectUtil.isEmpty(config.url)){
// return true;
// }
// String action=config.action_ProcessMaterialLot;
// String msg="processMaterialLot ["+inoutType+"]["+storageId+"]["+storageName+"]["+materialLot+"] :";
// String soap=buildProcessXml(action, inoutType,storageId,storageName,materialLot);
// String returnData= WSClientUtil.sendSoap(config.host,config.GetPort(), config.url,soap);
// if(ObjectUtil.isEmpty(returnData)){
// log.error(msg+"未收到结果");
// return true;
// }else {
//
// //facts server收到信息后,反回OK,出库流程结束
// String actionCode = XmlUtil.getNodeAttribute("ResponseExpression", "actionCode", returnData);
// String msgBody=XmlUtil.getNodeBody("ResponseExpression", returnData );
// if (ObjectUtil.isNotEmpty(actionCode)) {
// if (actionCode.equals("Accepted")) {
// log.info(msg + " 返回,actionCode = " + actionCode+","+msgBody);
// return true;
// }
// }
//
// log.info(msg + " 返回,actionCode = " + actionCode+","+msgBody);
// return false;
// }
//// String soap="<a:Action s:mustUnderstand=\"1\">"+action+"</a:Action>"
//// + "<DataArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
//// +"<Process>"
//// +"<ActionCriteria>"
//// +"<ActionExpression actionCode=\""+action+"\"/>"
//// +"</ActionCriteria>"
//// +"</Process>"
//// + "<MaterialLot>"
//// + "<ID>"
//// + "<Value>"+materialLot+"</Value>"
//// + "</ID>"
//// + "<Location>"
//// + "<EquipmentID>"
//// + "<Value>"+storageName+"</Value>"
//// + "</EquipmentID>"
//// + "</Location>"
//// + "</MaterialLot>"
//// + "</DataArea>";
//
////    Action: http://siplace.com/facts/materiallot/2010/01/MaterialLot/ProcessMaterialLot
//
////    actionCode: 入库为Charge, 出库为DisCharge
////    MaterialLot 的ID为料盘的唯一码
////    EquipmentID为Tower设备的编号(每台Tower不一样) //料仓名称
//
// }
// private static String buildGetLotXml(String actionCode,int inoutType,String storageId,String storageName,String materialLot ){
//
// //1=入库,2=出库
// String inoutTypeStr="Charge";
// if(inoutType==2){
// inoutTypeStr="DisCharge";
// }
// // <?xml version="1.0"?>
// // -<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
// // -<s:Header>
// //<a:Action s:mustUnderstand="1">http://siplace.com/facts/materiallot/2010/01/MaterialLot/GetMaterialLot</a:Action>
// //<a:MessageID>urn:uuid:b8c29254-908b-4de5-ba48-380b98e92917</a:MessageID>
// // -<a:ReplyTo>
// //<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
// //</a:ReplyTo>
// //<CallerId xmlns="http://siplace.com/facts">7edb7be7-61ba-4195-8dd7-d14272dca591</CallerId>
// //<CallerName xmlns="http://siplace.com/facts">Rojonic</CallerName>
// //<Signature xmlns="http://siplace.com/facts">62C28B8F3033423c9286658A67D67674</Signature>
// //<a:To s:mustUnderstand="1">http://cnctu04053.cn104.local/FactsWebServices/MaterialLot.svc</a:To>
// //</s:Header>
// // -<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
// // -<GetMaterialLotType xmlns="http://siplace.com/facts/materiallot/2010/01" versionID="2.0.0.1642" releaseID="2.0.0.1642">
// // -<ApplicationArea xmlns="http://www.wbf.org/xml/b2mml-v0400">
// // -<Sender>
// // -<LogicalID>
// //<Value>RoyoTech</Value>
// //</LogicalID>
// // -<ComponentID>
// //<Value>d876c072-a937-410b-9d74-cb29a98e8cbe</Value>
// // </ComponentID>
// //<ConfirmationCode languageID="de-DE">Always</ConfirmationCode>
// //</Sender>
// //<CreationDateTime>2022-05-12T10:57:09.3614178+08:00</CreationDateTime>
// //</ApplicationArea>
// // -<DataArea xmlns="http://www.wbf.org/xml/b2mml-v0400">
// // -<Get>
// //<Expression>Get</Expression>
// //</Get>
// // -<MaterialLot>
// // -<ID>
// //<Value>M05720728</Value>
// //</ID>
// //</MaterialLot>
// //</DataArea>
// //</GetMaterialLotType>
// //</s:Body>
// //</s:Envelope>
// String soap="<?xml version=\"1.0\"?>"
// + "<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">"
// + "<s:Header>"
// + "<a:Action s:mustUnderstand=\"1\">"+actionCode+"</a:Action>"
// + "<a:MessageID>urn:uuid:9a3a1214-eb2a-4e87-a5b8-94f71e540f59</a:MessageID><a:ReplyTo>"
// + "<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>"
// + "</a:ReplyTo>"
// + "<CallerId xmlns=\"http://siplace.com/facts\">8100449b-4b84-450b-aaab-48a419b13787</CallerId>"
// + "<CallerName xmlns=\"http://siplace.com/facts\">Rojonic</CallerName>"
// + "<Signature xmlns=\"http://siplace.com/facts\">62C28B8F3033423c9286658A67D67674</Signature>"
// + "<a:To s:mustUnderstand=\"1\">"+config.url+"</a:To>"
//// + "<a:To s:mustUnderstand=\"1\">http://cnctu04053.cn104.local/FactsWebServices/MaterialLot.svc</a:To>"
// + "</s:Header>"
// + "<s:Body xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
// + "<GetMaterialLotType xmlns=\"http://siplace.com/facts/materiallot/2010/01\" versionID=\"2.0.0.1642\" releaseID=\"2.0.0.1642\">"
// + "<ApplicationArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
// +"<Sender>"
// +"<LogicalID>"
// +"<Value>"+storageName+"</Value>"
// +"</LogicalID>"
// +"<ComponentID>"
// +"<Value>"+storageId+"</Value>"
// +"</ComponentID>"
// +"<ConfirmationCode languageID=\"de-DE\">Always</ConfirmationCode>"
// +"</Sender>"
// +"<CreationDateTime>2022-01-27T17:13:30.2032951+08:00</CreationDateTime>"
// +"</ApplicationArea>"
// +"<DataArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
// +"<Get>"
// +"<Expression>Get</Expression>"
// +"</Get>"
// +"<MaterialLot>"
// +"<ID>"
// +"<Value>"+materialLot+"</Value>"
// +"</ID>"
// +"</MaterialLot>"
// +"</DataArea>"
// +"</GetMaterialLotType>"
// +"</s:Body>"
// +"</s:Envelope>";
//
// return soap;
// }
//
// private static String buildProcessXml(String actionCode,int inoutType,String storageId,String storageName,String materialLot ){
//
// //1=入库,2=出库
// String inoutTypeStr="Charge";
// if(inoutType==2){
// inoutTypeStr="DisCharge";
// }
// String soap="<?xml version=\"1.0\"?>"
// + "<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">"
// + "<s:Header>"
// + "<a:Action s:mustUnderstand=\"1\">"+actionCode+"</a:Action>"
// + "<a:MessageID>urn:uuid:9a3a1214-eb2a-4e87-a5b8-94f71e540f59</a:MessageID><a:ReplyTo>"
// + "<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>"
// + "</a:ReplyTo>"
// + "<CallerId xmlns=\"http://siplace.com/facts\">8100449b-4b84-450b-aaab-48a419b13787</CallerId>"
// + "<CallerName xmlns=\"http://siplace.com/facts\">Rojonic</CallerName>"
// + "<Signature xmlns=\"http://siplace.com/facts\">62C28B8F3033423c9286658A67D67674</Signature>"
// + "<a:To s:mustUnderstand=\"1\">"+config.url+"</a:To>"
//// + "<a:To s:mustUnderstand=\"1\">http://cnctu04053.cn104.local/FactsWebServices/MaterialLot.svc</a:To>"
// + "</s:Header>"
// + "<s:Body xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
// + "<ProcessMaterialLotType xmlns=\"http://siplace.com/facts/materiallot/2010/01\" versionID=\"2.0.0.1642\" releaseID=\"2.0.0.1642\">"
// + "<ApplicationArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
// +"<Sender>"
// +"<LogicalID>"
// +"<Value>"+storageName+"</Value>"
// +"</LogicalID>"
// +"<ComponentID>"
// +"<Value>"+storageId+"</Value>"
// +"</ComponentID>"
// +"<ConfirmationCode languageID=\"de-DE\">Always</ConfirmationCode>"
// +"</Sender>"
// +"<CreationDateTime>2022-01-27T17:13:30.2032951+08:00</CreationDateTime>"
// +"</ApplicationArea>"
// +"<DataArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
// +"<Process>"
// +"<ActionCriteria>"
// +"<ActionExpression actionCode=\""+action+"\"/>"
// +"<ActionExpression actionCode=\""+inoutTypeStr+"\"/>"
// +"</ActionCriteria>"
// +"</Process>"
// + "<MaterialLot>"
// + "<ID>"
// + "<Value>"+materialLot+"</Value>"
// + "</ID>"
// + "<Location>"
// + "<EquipmentID>"
// + "<Value>"+storageName+"</Value>"
// + "</EquipmentID>"
// + "</Location>"
// + "</MaterialLot>"
// + "</DataArea>";
//    Action: http://siplace.com/facts/materiallot/2010/01/MaterialLot/ProcessMaterialLot
//    actionCode: 入库为Charge, 出库为DisCharge
//    MaterialLot 的ID为料盘的唯一码
//    EquipmentID为Tower设备的编号(每台Tower不一样) //料仓名称
}
private static String buildGetLotXml(String actionCode,int inoutType,String storageId,String storageName,String materialLot ){
//1=入库,2=出库
String inoutTypeStr="Charge";
if(inoutType==2){
inoutTypeStr="DisCharge";
}
// <?xml version="1.0"?>
// -<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
// -<s:Header>
//<a:Action s:mustUnderstand="1">http://siplace.com/facts/materiallot/2010/01/MaterialLot/GetMaterialLot</a:Action>
//<a:MessageID>urn:uuid:b8c29254-908b-4de5-ba48-380b98e92917</a:MessageID>
// -<a:ReplyTo>
//<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
//</a:ReplyTo>
//<CallerId xmlns="http://siplace.com/facts">7edb7be7-61ba-4195-8dd7-d14272dca591</CallerId>
//<CallerName xmlns="http://siplace.com/facts">Rojonic</CallerName>
//<Signature xmlns="http://siplace.com/facts">62C28B8F3033423c9286658A67D67674</Signature>
//<a:To s:mustUnderstand="1">http://cnctu04053.cn104.local/FactsWebServices/MaterialLot.svc</a:To>
//</s:Header>
// -<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
// -<GetMaterialLotType xmlns="http://siplace.com/facts/materiallot/2010/01" versionID="2.0.0.1642" releaseID="2.0.0.1642">
// -<ApplicationArea xmlns="http://www.wbf.org/xml/b2mml-v0400">
// -<Sender>
// -<LogicalID>
//<Value>RoyoTech</Value>
//</LogicalID>
// -<ComponentID>
//<Value>d876c072-a937-410b-9d74-cb29a98e8cbe</Value>
// </ComponentID>
//<ConfirmationCode languageID="de-DE">Always</ConfirmationCode>
//</Sender>
//<CreationDateTime>2022-05-12T10:57:09.3614178+08:00</CreationDateTime>
//</ApplicationArea>
// -<DataArea xmlns="http://www.wbf.org/xml/b2mml-v0400">
// -<Get>
//<Expression>Get</Expression>
//</Get>
// -<MaterialLot>
// -<ID>
//<Value>M05720728</Value>
//</ID>
//</MaterialLot>
//</DataArea>
//</GetMaterialLotType>
//</s:Body>
//</s:Envelope>
String soap="<?xml version=\"1.0\"?>"
+ "<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">"
+ "<s:Header>"
+ "<a:Action s:mustUnderstand=\"1\">"+actionCode+"</a:Action>"
+ "<a:MessageID>urn:uuid:9a3a1214-eb2a-4e87-a5b8-94f71e540f59</a:MessageID><a:ReplyTo>"
+ "<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>"
+ "</a:ReplyTo>"
+ "<CallerId xmlns=\"http://siplace.com/facts\">8100449b-4b84-450b-aaab-48a419b13787</CallerId>"
+ "<CallerName xmlns=\"http://siplace.com/facts\">Rojonic</CallerName>"
+ "<Signature xmlns=\"http://siplace.com/facts\">62C28B8F3033423c9286658A67D67674</Signature>"
+ "<a:To s:mustUnderstand=\"1\">"+config.url+"</a:To>"
// + "<a:To s:mustUnderstand=\"1\">http://cnctu04053.cn104.local/FactsWebServices/MaterialLot.svc</a:To>"
+ "</s:Header>"
+ "<s:Body xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+ "<GetMaterialLotType xmlns=\"http://siplace.com/facts/materiallot/2010/01\" versionID=\"2.0.0.1642\" releaseID=\"2.0.0.1642\">"
+ "<ApplicationArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
+"<Sender>"
+"<LogicalID>"
+"<Value>"+storageName+"</Value>"
+"</LogicalID>"
+"<ComponentID>"
+"<Value>"+storageId+"</Value>"
+"</ComponentID>"
+"<ConfirmationCode languageID=\"de-DE\">Always</ConfirmationCode>"
+"</Sender>"
+"<CreationDateTime>2022-01-27T17:13:30.2032951+08:00</CreationDateTime>"
+"</ApplicationArea>"
+"<DataArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
+"<Get>"
+"<Expression>Get</Expression>"
+"</Get>"
+"<MaterialLot>"
+"<ID>"
+"<Value>"+materialLot+"</Value>"
+"</ID>"
+"</MaterialLot>"
+"</DataArea>"
+"</GetMaterialLotType>"
+"</s:Body>"
+"</s:Envelope>";
return soap;
}
private static String buildProcessXml(String actionCode,int inoutType,String storageId,String storageName,String materialLot ){
//1=入库,2=出库
String inoutTypeStr="Charge";
if(inoutType==2){
inoutTypeStr="DisCharge";
}
String soap="<?xml version=\"1.0\"?>"
+ "<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">"
+ "<s:Header>"
+ "<a:Action s:mustUnderstand=\"1\">"+actionCode+"</a:Action>"
+ "<a:MessageID>urn:uuid:9a3a1214-eb2a-4e87-a5b8-94f71e540f59</a:MessageID><a:ReplyTo>"
+ "<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>"
+ "</a:ReplyTo>"
+ "<CallerId xmlns=\"http://siplace.com/facts\">8100449b-4b84-450b-aaab-48a419b13787</CallerId>"
+ "<CallerName xmlns=\"http://siplace.com/facts\">Rojonic</CallerName>"
+ "<Signature xmlns=\"http://siplace.com/facts\">62C28B8F3033423c9286658A67D67674</Signature>"
+ "<a:To s:mustUnderstand=\"1\">"+config.url+"</a:To>"
// + "<a:To s:mustUnderstand=\"1\">http://cnctu04053.cn104.local/FactsWebServices/MaterialLot.svc</a:To>"
+ "</s:Header>"
+ "<s:Body xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+ "<ProcessMaterialLotType xmlns=\"http://siplace.com/facts/materiallot/2010/01\" versionID=\"2.0.0.1642\" releaseID=\"2.0.0.1642\">"
+ "<ApplicationArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
+"<Sender>"
+"<LogicalID>"
+"<Value>"+storageName+"</Value>"
+"</LogicalID>"
+"<ComponentID>"
+"<Value>"+storageId+"</Value>"
+"</ComponentID>"
+"<ConfirmationCode languageID=\"de-DE\">Always</ConfirmationCode>"
+"</Sender>"
+"<CreationDateTime>2022-01-27T17:13:30.2032951+08:00</CreationDateTime>"
+"</ApplicationArea>"
+"<DataArea xmlns=\"http://www.wbf.org/xml/b2mml-v0400\">"
+"<Process>"
+"<ActionCriteria>"
+"<ActionExpression actionCode=\""+inoutTypeStr+"\"/>"
+"</ActionCriteria>"
+"</Process>"
+"<MaterialLot>"
+"<ID>"
+"<Value>"+materialLot+"</Value>"
+"</ID>"
+"<Location>"
+"<EquipmentID>"
+"<Value>"+storageName+"</Value>"
+"</EquipmentID>"
+"</Location>"
+"</MaterialLot>"
+"</DataArea>"
+"</ProcessMaterialLotType>"
+"</s:Body>"
+"</s:Envelope>";
return soap;
}
// +"<MaterialLot>"
// +"<ID>"
// +"<Value>"+materialLot+"</Value>"
// +"</ID>"
// +"<Location>"
// +"<EquipmentID>"
// +"<Value>"+storageName+"</Value>"
// +"</EquipmentID>"
// +"</Location>"
// +"</MaterialLot>"
// +"</DataArea>"
// +"</ProcessMaterialLotType>"
// +"</s:Body>"
// +"</s:Envelope>";
//
// return soap;
// }
}
......@@ -19,13 +19,15 @@ public class SiemensConfig {
@Value("${siemens.url:}")
public String url = "";
@Value("${siemens.url_checkIn:}")
public String url_checkIn = "";
@Value("${siemens.action.GetMaterialLot:}")
public String action_GetMaterialLot = "";
@Value("${siemens.action.ProcessMaterialLot:}")
public String action_ProcessMaterialLot = "";
// @Value("${siemens.action.GetMaterialLot:}")
// public String action_GetMaterialLot = "";
//
//
// @Value("${siemens.action.ProcessMaterialLot:}")
// public String action_ProcessMaterialLot = "";
public int GetPort(){
try{
......@@ -48,6 +50,6 @@ public class SiemensConfig {
// action_ProcessMaterialLot = dataCache.GetConfigCache("siemens.action.ProcessMaterialLot", "siemens.action.ProcessMaterialLot", action_ProcessMaterialLot);
log.info("siemens服务器rul:" + url + ",GetMaterialLot=" + action_GetMaterialLot + ",ProcessMaterialLot=" + action_ProcessMaterialLot);
log.info("siemens服务器rul:" + url + ",url_checkIn=" + url_checkIn );
}
}
package com.neotel.smfcore.siemens.bean;
import com.neotel.smfcore.common.utils.JsonUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
import java.util.Map;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Slf4j
public class LotCheckInfo implements Serializable {
// {"Status":true,"Message":"OK","Code":0,"partnum":"A5E00119983","quantity":10000}
private boolean Status=false;
private String Message;
private String Code;
private String lotId;
private String partnum;
private Integer quantity;
public static LotCheckInfo toObj(String lotId,String result) {
try {
Map<String, Object> map = JsonUtil.toMap(result);
if (map.containsKey("Status")) {
boolean s = Boolean.parseBoolean(map.get("Status").toString());
LotCheckInfo lotCheckInfo = new LotCheckInfo();
lotCheckInfo.setStatus(s);
lotCheckInfo.setLotId(lotId);
if (map.containsKey("Message")) {
lotCheckInfo.setMessage(map.get("Message").toString());
}
if (map.containsKey("Code")) {
lotCheckInfo.setCode(map.get("Code").toString());
}
if (map.containsKey("partnum")) {
lotCheckInfo.setPartnum(map.get("partnum").toString());
}
if (map.containsKey("quantity")) {
lotCheckInfo.setQuantity(Integer.parseInt(map.get("quantity").toString()));
}
return lotCheckInfo;
}
} catch (Exception ex) {
log.error("LotCheckInfo [" + result + "] toObj 出错:", ex);
}
return null;
}
}
......@@ -6,9 +6,13 @@ hella:
port: 3333
siemens:
host: "127.0.0.1"
port: 3333
# url: "http://cnctu041p059.cn104.local/Production/WebServices/MaterialLot.svc"
#host: "140.231.193.101"
port:
#url: "http://cnctu04053:8014/api/JsonC"
#url_checkIn: "http://cnctu04053:8014/api/JsonC"
#url: "http://cnctu041p059:8014/api/JsonC"
#url: "http://cnctu04053:8014/api/JsonC"
action:
GetMaterialLot: "http://siplace.com/facts/materiallot/2010/01/MaterialLot/GetMaterialLot"
ProcessMaterialLot: "http://siplace.com/facts/materiallot/2010/01/MaterialLot/ProcessMaterialLot"
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!