Commit 49bc9c0c LN

锡膏料仓接口调试修改

1 个父辈 9c89f8fc
......@@ -26,4 +26,5 @@ public class CodeValidateParam implements Serializable {
private List<Storage> storageList = new ArrayList<>();
private String code;
private String token;
private Integer weight;//锡膏料仓重量
}
......@@ -127,15 +127,19 @@ public abstract class BaseSmfApiListener implements ISmfApiListener {
}
}
protected Integer getIntData(Map<String, Object> dataMap, String dataKey,Integer defValue) {
try {
Object data = dataMap.get(dataKey);
if (data == null) {
return defValue;
} else {
if(Strings.isNotBlank(data.toString())){
if (Strings.isNotBlank(data.toString())) {
int value = Integer.valueOf(data.toString());
return value;
}
}
} catch (Exception ex) {
log.error("getIntData error :" + ex.toString());
}
return defValue;
}
}
......@@ -415,9 +415,9 @@ public class BoxKanbanController {
}
}
if(storage.isSolderPaste()){
outTask=solderBoxCache.getSpTaskCount(storage.getId());
}
// if(storage.isSolderPaste()){
// outTask=solderBoxCache.getSpTaskCount(storage.getId());
// }
int allCount = inTask + outTask;
BoxStatusDto boxDto = new BoxStatusDto(storage.getId(), storage.getName(), storage.getCid(), false, 0,
"0", "0","0", "", allCount, inTask, outTask,
......
......@@ -178,14 +178,15 @@ public class SpBoxHandler extends BaseDeviceHandler {
protected StatusBean putInBoxSp(Storage storage, StatusBean statusBean) {
try {
String codeStr = statusBean.getCode();
int weight = statusBean.getWeight();
CodeValidateParam params = new CodeValidateParam("",storage.getGroupId(),storage.getId(),codeStr,"");
params.setWeight(weight);
Barcode barcodeSave = smfApi.canPutInBeforeResolve(params);
if(barcodeSave == null){
barcodeSave = codeResolve.resolveOneValideBarcode(codeStr,COMPONENT_TYPE.SOLDERPASTE);
}
// Barcode barcodeSave = codeResolve.resolveOneValideBarcode(codeStr);
int weight = statusBean.getWeight();
barcodeSave.setAmount(weight);
//从API验证
......
package com.neotel.smfcore.custom.sp;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.HttpHelper;
......@@ -7,6 +8,8 @@ import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.core.api.bean.ApiResult;
import com.neotel.smfcore.core.api.bean.CodeValidateParam;
import com.neotel.smfcore.core.api.listener.BaseSmfApiListener;
import com.neotel.smfcore.core.barcode.bean.BarcodeRule;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
......@@ -28,46 +31,54 @@ public class SpApi extends BaseSmfApiListener {
public boolean isForThisApi(String apiName) {
return apiName != null && apiName.equalsIgnoreCase("sp");
}
@Override
public Barcode canPutInAfterResolve(String inCheckUrl, CodeValidateParam params, Barcode barcode) throws ValidateException {
public Barcode canPutInBeforeResolve(String codeResolveUrl, CodeValidateParam params) throws ValidateException {
Map<String, Object> paramMap = new HashMap<>();
//锡膏发送 fullCode和weight
paramMap.put("fullCode", barcode.getFullCode());
int amount=barcode.getAmount();
//锡膏发送 fullCode和weight =1+0x0-67x77=2023053100010X##
CodeBean codeBean = BarcodeRule.splitCodeAndSize(params.getCode());
String fullCode = codeBean.getCodeStr();
if (fullCode.endsWith("##")) {
fullCode = fullCode.substring(0, fullCode.length() - 2);
}
paramMap.put("fullCode", fullCode);
int amount = params.getWeight();
paramMap.put("weight", amount);
log.info(barcode.getBarcode() + "入库验证,参数" + JsonUtil.toJsonStr(paramMap));
log.info(fullCode + "canPutInBeforeResolve,参数" + JsonUtil.toJsonStr(paramMap));
String result = "";
try {
result = HttpHelper.postJson(inCheckUrl, paramMap);
result = HttpHelper.postJson(codeResolveUrl, paramMap);
} catch (Exception e) {
log.error("入库验证接口出错:" + e.getMessage());
throw new ValidateException("smfcore.mesApi.inCheck.error", "MES inCheckUrl ERROR:" + e.getMessage());
log.error("canPutInBeforeResolve 接口出错:" + e.getMessage());
throw new ValidateException("smfcore.mesApi.codeResolveUrl.error", "MES codeResolveUrl ERROR:" + e.getMessage(),new String[]{e.getMessage()});
}
log.info(barcode.getBarcode() + "入库验证返回" + result);
log.info(fullCode + "canPutInBeforeResolve 返回" + result);
ApiResult apiResult = JsonUtil.toObj(result, ApiResult.class);
if (apiResult.isOk()) {
Map<String, Object> dataMap = (Map<String, Object>) apiResult.getData();
String reelId = getData(dataMap, "reelId");
if (Strings.isNotBlank(reelId)) {
//从数据库重新查找条码
Barcode newBarcode =barcodeManager.findByBarcode(reelId);
if(newBarcode!=null){
log.info("SpApi: 切换reelID:["+barcode.getBarcode()+"]->["+reelId+"]");
barcode=newBarcode;
barcode.setAmount(amount);
}else{
barcode.setBarcode(reelId);
if (ObjectUtil.isEmpty(reelId)) {
throw new ValidateException("smfcore.mesApi.codeResolveUrl.paramNull", "reelId 不能为空",new String[]{"reelId"});
}
//从数据库重新查找条码
Barcode barcode = barcodeManager.findByBarcode(reelId);
if (barcode == null) {
barcode = new Barcode();
barcode.setPlateSize(codeBean.getReelWidth());
barcode.setHeight(codeBean.getReelHeight());
}
barcode.setBarcode(reelId);
barcode.setAmount(amount);
String partNum = getData(dataMap, "partNum");
if (Strings.isNotBlank(partNum)) {
barcode.setPartNumber(partNum);
} else {
throw new ValidateException("smfcore.mesApi.codeResolveUrl.paramNull", "reelId 不能为空",new String[]{"partNum"});
}
Integer weight = getIntData(dataMap, "weight", 0);
......@@ -101,10 +112,86 @@ public class SpApi extends BaseSmfApiListener {
return barcode;
} else {
// throw new ValidateException("smfcore.mesApi.inCheck.ng", "MES验证失败:" + apiResult.getMsg());
throw new ValidateException("smfcore.mesApi.inCheck.ng", apiResult.getMsg());
throw new ValidateException("smfcore.mesApi.codeResolveUrl.error", apiResult.getMsg());
}
}
//
// @Override
// public Barcode canPutInAfterResolve(String inCheckUrl, CodeValidateParam params, Barcode barcode) throws ValidateException {
// Map<String, Object> paramMap = new HashMap<>();
//
// //锡膏发送 fullCode和weight
// paramMap.put("fullCode", barcode.getFullCode());
// int amount=barcode.getAmount();
// paramMap.put("weight", amount);
//
// log.info(barcode.getBarcode() + "入库验证,参数" + JsonUtil.toJsonStr(paramMap));
// String result = "";
// try {
// result = HttpHelper.postJson(inCheckUrl, paramMap);
// } catch (Exception e) {
// log.error("入库验证接口出错:" + e.getMessage());
// throw new ValidateException("smfcore.mesApi.inCheck.error", "MES inCheckUrl ERROR:" + e.getMessage());
// }
// log.info(barcode.getBarcode() + "入库验证返回" + result);
// ApiResult apiResult = JsonUtil.toObj(result, ApiResult.class);
// if (apiResult.isOk()) {
// Map<String, Object> dataMap = (Map<String, Object>) apiResult.getData();
// String reelId = getData(dataMap, "reelId");
// if (Strings.isNotBlank(reelId)) {
//
// //从数据库重新查找条码
// Barcode newBarcode =barcodeManager.findByBarcode(reelId);
// if(newBarcode!=null){
// log.info("SpApi: 切换reelID:["+barcode.getBarcode()+"]->["+reelId+"]");
// barcode=newBarcode;
// barcode.setAmount(amount);
// }else{
// barcode.setBarcode(reelId);
// }
// }
//
// String partNum = getData(dataMap, "partNum");
// if (Strings.isNotBlank(partNum)) {
// barcode.setPartNumber(partNum);
// }
//
// Integer weight = getIntData(dataMap, "weight", 0);
// if (weight > 0) {
// barcode.setAmount(weight);
// }
//
// Integer mixTime = getIntData(dataMap, "mixTime", 0);
// if (mixTime > 0) {
// barcode.setMixTime(mixTime * 60);
// }
//
// Integer warmTime = getIntData(dataMap, "warmTime", 0);
// if (warmTime > 0) {
// barcode.setWarmTime(warmTime);
// }
// String produceDateStr = getData(dataMap, "produceDate");
// if (Strings.isNotBlank(produceDateStr)) {
// Date produceDate = DateUtil.toDate(produceDateStr, "yyyy-MM-dd HH:mm:ss");
// barcode.setProduceDate(produceDate);
// }
//
// String expireDateStr = getData(dataMap, "expireDate");
// if (Strings.isNotBlank(expireDateStr)) {
// Date expireDate = DateUtil.toDate(expireDateStr, "yyyy-MM-dd HH:mm:ss");
// barcode.setExpireDate(expireDate);
// }
//
// resolveComponent(barcode, COMPONENT_TYPE.SOLDERPASTE);
// barcode = barcodeManager.saveBarcode(barcode);
// return barcode;
// } else {
//// throw new ValidateException("smfcore.mesApi.inCheck.ng", "MES验证失败:" + apiResult.getMsg());
// throw new ValidateException("smfcore.mesApi.inCheck.ng", apiResult.getMsg());
// }
//
// }
@Override
public void inTaskStatusChange(String inNotifyUrl, DataLog task){
......
......@@ -6,7 +6,9 @@ import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.JsonUtil;
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.device.util.DataCache;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
......@@ -34,6 +36,9 @@ public class SpController {
@Autowired
private IBarcodeManager barcodeManager;
@Autowired
private IComponentManager componentManager;
@ApiOperation("6.1.锡膏出库")
@RequestMapping("/spOut")
......@@ -58,10 +63,19 @@ public class SpController {
Integer mixTime = 0;
Integer warmTime = 0;
if (paramMap.get("mixTime") != null) {
try {
mixTime = Integer.parseInt(paramMap.get("mixTime").toString());
}catch (Exception ex){
log.info("mixTime 获取出错:"+ex.toString());
}
}
if (paramMap.get("warmTime") != null) {
try {
warmTime = Integer.parseInt(paramMap.get("warmTime").toString());
} catch (Exception ex) {
log.info("warmTime 获取出错:"+ex.toString());
}
}
Locale locale = new Locale("en", "US");
StoragePos pos = storagePosManager.getByBarcode(reelId);
......@@ -91,15 +105,30 @@ public class SpController {
}
}
private void setOutDate( StoragePos pos, Date outDate,Integer mixTime,Integer warmTime ) {
private void setOutDate( StoragePos pos, Date outDate,int mixTime,int warmTime ) {
Barcode barcode = pos.getBarcode();
if (barcode != null) {
log.info("设定仓位【" + pos.getPosName() + "】中的锡膏[" + barcode.getBarcode() + "]出库时间:"
+ DateUtil.toDateTimeString(outDate) + ",mixTime=" + mixTime + ",warmTime=" + warmTime);
mixTime=mixTime * 60;
if(mixTime<=0||warmTime<=0){
Component component=componentManager.findOneByPN(barcode.getPartNumber());
if(component!=null){
if(mixTime<=0&&component.getMixTime()>0){
mixTime=component.getMixTime();
log.info("锡膏[" + barcode.getBarcode() + "]搅拌时间 更改为PN["+barcode.getPartNumber()+"]中设置的 mixTime=["+mixTime+"]");
}
if(warmTime<=0&&component.getWarmTime()>0){
warmTime=component.getWarmTime();
log.info("锡膏[" + barcode.getBarcode() + "]回温时间 更改为PN["+barcode.getPartNumber()+"]中设置的 warmTime=["+warmTime+"]");
}
}
}
barcode.setSolderStatus(SOLDER_STATUS.TO_BE_REWARM.name());
barcode.setNeedOutDate(outDate);
barcode.setMixTime(mixTime * 60);
barcode.setMixTime(mixTime);
barcode.setWarmTime(warmTime);
barcodeManager.save(barcode);
pos.setBarcode(barcode);
......@@ -141,7 +170,7 @@ public class SpController {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("reelId", barcode.getBarcode());
resultMap.put("parmNum", barcode.getPartNumber());
resultMap.put("partNum", barcode.getPartNumber());
resultMap.put("weight", barcode.getAmount());
resultMap.put("status",status);
if(ObjectUtil.isNotEmpty(barcode.getPutInDate())) {
......
......@@ -364,3 +364,5 @@ smfcore.selfAudit.hasOutTask=\u5E93\u4F4D[{0}]\u5DF2\u6709\u51FA\u5E93\u4EFB\u52
#smfclient.checkingMaterialOk=checking material is ok:{0}
#smfclient.checkNg=checking material is ng:{0}
smfcore.order.out.barcode=\u51FA\u5E93\u7269\u6599\u8BE6\u60C5
smfcore.mesApi.codeResolveUrl.error=\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.codeResolveUrl.paramNull={0}\u4E0D\u80FD\u4E3A\u7A7A
\ No newline at end of file
......@@ -353,3 +353,5 @@ smfcore.lockMaterials=Locking Materials
smfcore.storage.error.posNameExist=Bin number already exists in other bins\uFF1A{0}
smfcore.selfAudit.hasOutTask=The location [{0}] already has a release task
smfcore.order.out.barcode=Out Barcode Detail
smfcore.mesApi.codeResolveUrl.error=MES codeResolveUrl ERROR\uFF1A{0}
smfcore.mesApi.codeResolveUrl.paramNull={0} canot null
\ No newline at end of file
......@@ -350,3 +350,5 @@ smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
smfcore.storage.error.posNameExist=\u5E93\u4F4D\u53F7\u5DF2\u5728\u5176\u4ED6\u6599\u4ED3\u5B58\u5728\uFF1A{0}
smfcore.selfAudit.hasOutTask=\u5E93\u4F4D[{0}]\u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1
smfcore.order.out.barcode=\u51FA\u5EAB\u54C1\u76EE\u306E\u8A73\u7D30
smfcore.mesApi.codeResolveUrl.error=\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.codeResolveUrl.paramNull={0}\u4E0D\u80FD\u4E3A\u7A7A
\ No newline at end of file
......@@ -350,3 +350,5 @@ smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
smfcore.storage.error.posNameExist=\u5E93\u4F4D\u53F7\u5DF2\u5728\u5176\u4ED6\u6599\u4ED3\u5B58\u5728\uFF1A{0}
smfcore.selfAudit.hasOutTask=\u5E93\u4F4D[{0}]\u5DF2\u6709\u51FA\u5E93\u4EFB\u52A1
smfcore.order.out.barcode=\u51FA\u5E93\u7269\u6599\u8BE6\u60C5
smfcore.mesApi.codeResolveUrl.error=\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.codeResolveUrl.paramNull={0}\u4E0D\u80FD\u4E3A\u7A7A
\ No newline at end of file
......@@ -351,3 +351,5 @@ smfcore.lockMaterials=\u9396\u5B9A\u7269\u6599
smfcore.storage.error.posNameExist=\u5EAB\u4F4D\u865F\u5DF2\u5728\u5176\u4ED6\u6599\u5009\u5B58\u5728\uFF1A{0}
smfcore.selfAudit.hasOutTask=\u5EAB\u4F4D[{0}]\u5DF2\u6709\u51FA\u5EAB\u4EFB\u52D9
smfcore.order.out.barcode=\u51FA\u5EAB\u7269\u6599\u8A73\u60C5
smfcore.mesApi.codeResolveUrl.error=\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.codeResolveUrl.paramNull={0}\u4E0D\u80FD\u4E3A\u7A7A
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!