Commit 48206af9 LN

hotayi接口修改。

地址改为:F1_EstablishConnection/F2_GetMachineStatus/F4_StockOut
1 个父辈 c06c7945
......@@ -59,6 +59,17 @@ public class HotayiApi extends BaseSmfApiListener {
return apiName != null && apiName.equalsIgnoreCase("20057");
}
// api:
// name: 20057
// codeResolveUrl: http://srvpcs-1:8383/SolderPasteStorageSvc/F3_StockIn
// inNotifyUrl: http://srvpcs-1:8383/SolderPasteStorageSvc/F5_Notification
// outNotifyUrl: http://srvpcs-1:8383/SolderPasteStorageSvc/F5_Notification
// loginCheckUrl: http://srvpcs-1:8383/SolderPasteStorageSvc/F11_LoginAuthentication
// hotayi:
// MachineID:
// IPAddress:
// api:
// name: "20057"
// codeResolveUrl: "http://203.106.167.221:8383/SolderPasteStorageSvc/F3_StockIn"
......
......@@ -2,8 +2,11 @@ package com.neotel.smfcore.custom.hotayi20057;
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.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.po.Barcode;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.core.order.LiteOrderCache;
......@@ -48,6 +51,9 @@ public class HotayiController {
@Autowired
private TaskService taskService;
@Autowired
private IBarcodeManager barcodeManager;
/**
* 收到M1返回M2
* M2 Machine Information
......@@ -77,7 +83,7 @@ public class HotayiController {
* “SpecID”: 100 }
* }
*/
@RequestMapping("/m1")
@RequestMapping("/F1_EstablishConnection")
@AnonymousAccess
public HotayiBean m1(@RequestBody HotayiBean hotayiBean) {
log.info("收到M1请求数据为:{}", JsonUtil.toJsonStr(hotayiBean));
......@@ -120,7 +126,7 @@ public class HotayiController {
* @param hotayiBean
* @return
*/
@RequestMapping("/m3")
@RequestMapping("/F2_GetMachineStatus")
@AnonymousAccess
public HotayiBean m3(@RequestBody HotayiBean hotayiBean) {
log.info("收到M3请求数据为:{}", JsonUtil.toJsonStr(hotayiBean));
......@@ -150,87 +156,55 @@ public class HotayiController {
}
// Stock Out
// Message send by MES to request machine operation
// Direction: MES → Machine
// Fields Type Range Optional Description
// Barcode String Any No Solder Paste
// Barcode
// Request Date Datetime Any No Start Process
// Output Date
// (Include Cycle
//Time & Standby
// Hour etc.)
// Format: yyyymm-dd hh:mm
// MixerBySecond Int 1 ~ n No Mixer Time
// Standby Hour Int 1 ~ n No Standby Time
// Sample:
// {
// “Info”: {
//“MachineID”: “00001”,
//“IPAddress”: “192.168.0.1”,
//“MessageNo”: “M5”
// },
//“Data”: {
// “Barcode”: “A005$$A”,
//“RequestDate”: “2022-01-01 19:00”,
//“MixerBySecond”: 120,
//“StandbyHour”: 4
// }
// }
@RequestMapping("/m7")
@RequestMapping("/F4_StockOut")
@AnonymousAccess
public HotayiBean m7(@RequestBody HotayiBean hotayiBean) {
log.info("收到M7请求数据为:{0}", JsonUtil.toJsonStr(hotayiBean));
String barcode = hotayiBean.getInfoItem("Barcode");
String RequestDate = hotayiBean.getInfoItem("RequestDate");
String MixerBySecond = hotayiBean.getInfoItem("MixerBySecond");
String StandbyHour = hotayiBean.getInfoItem("StandbyHour");
log.info("收到M7请求数据为: "+ JsonUtil.toJsonStr(hotayiBean));
// { "Info": {"MachineID": "0001","IPAddress": "192.168.0.1","MessageNo": "M7"},
// "Data": {"Barcode": "A069-O9","RequestDate": "2023-04-12 17:20","MixerBySecond": "0","StandbyHour": 0}}
String barcode = hotayiBean.getDataItem("Barcode");
String RequestDate = hotayiBean.getDataItem("RequestDate");
String MixerBySecond = hotayiBean.getDataItem("MixerBySecond");
Integer StandbyHour = hotayiBean.getDataItem("StandbyHour");
Date outDate=DateUtil.toDate(RequestDate,"yyyy-MM-dd HH:mm");
if(outDate==null){
log.info("M7: requestDate==null 重置为当前时间");
outDate= new Date();
}
Locale locale = new Locale("en", "US");
StoragePos pos = storagePosManager.getByBarcode(barcode);
if (pos == null) {
String msg = MessageUtils.getText("smfcore.queryPos.cannotFindBarcode", locale, "cannot find barcode ["+barcode+"] In storage");
String msg = MessageUtils.getText("smfcore.queryPos.cannotFindBarcode",new String[]{barcode}, locale, "cannot find barcode ["+barcode+"] In storage");
hotayiBean.setM90(71, msg);
log.info("M7返回M90,数据为:"+JsonUtil.toJsonStr(hotayiBean));
return hotayiBean;
}
// //判断是否在出库中
// try {
//
// } catch (ValidateException ex) {
// String msg = MessageUtils.getText(ex.getMsgKey(), locale, ex.getDefaultMsg());
// hotayiBean.setM90(72, msg);
// log.info("M7返回M90,数据为:"+JsonUtil.toJsonStr(hotayiBean));
// return hotayiBean;
// }
String sStatus=pos.getBarcode().getSolderStatus();
if(sStatus.equals(SOLDER_STATUS.RETREAT_STORAGE.name())|| sStatus.equals(SOLDER_STATUS.UNDER_REFRIGERATION.name())|| sStatus.equals(SOLDER_STATUS.NONE.name()) ){
} else {
String msg = MessageUtils.getText("smfcore.queryPos.solderOutFail",new String[]{barcode,sStatus}, locale, " ["+barcode+"] checkOut fail,currStatus ["+sStatus+"]");
hotayiBean.setM90(72, msg);
log.info("M7返回M90,数据为:"+JsonUtil.toJsonStr(hotayiBean));
return hotayiBean;
}
Storage storage=dataCache.getStorageById(pos.getStorageId());
String result = taskService.checkout(pos,true,null,false);
if (ObjectUtil.isNotEmpty(result)) {
String msg = MessageUtils.getText(result, locale, "barcode [" + barcode + "] checkOut fail");
//需要定时出库
// String result = taskService.checkout(pos,true,null,false);
boolean result = setOutDate(pos,outDate);
if (!result) {
String msg = MessageUtils.getText("smfcore.operationFailure", locale, "Operation failed");
hotayiBean.setM90(73, msg);
log.info("M7返回M90,数据为:"+JsonUtil.toJsonStr(hotayiBean));
return hotayiBean;
}
// M8 Action Status
// Direction: MES  Machine
// Fields Type Range Optional Description
// Message String String No Error Message
// Success Message
// Sample:
// {
// “Info”: {
//“MachineID”: “00001”,
//“IPAddress”: “192.168.0.1”,
//“MessageNo”: “M8”
// },
//“Data”: {
// “Message”: “Standby Success”
// }
// }
hotayiBean.addInfo("MessageNo", "M8");
Map<String, Object> resultData = new HashMap<>();
resultData.put("Message", "Standby Success");
......@@ -239,6 +213,22 @@ public class HotayiController {
return hotayiBean;
}
private boolean setOutDate( StoragePos pos, Date outDate) {
Barcode barcode = pos.getBarcode();
if (barcode != null) {
log.info("设定仓位【" + pos.getPosName() + "】中的锡膏[" + barcode.getBarcode() + "]出库时间:" + DateUtil.toDateTimeString(outDate));
try {
barcode.setSolderStatus(SOLDER_STATUS.TO_BE_REWARM.name());
barcode.setNeedOutDate(outDate);
barcodeManager.save(barcode);
pos.setBarcode(barcode);
storagePosManager.save(pos);
return true;
} catch (ValidateException e) {
log.error("设定锡膏出库时间出错", e);
}
}
return false;
}
}
......@@ -16,6 +16,7 @@
package com.neotel.smfcore.security.rest;
import com.neotel.smfcore.common.utils.*;
import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.security.annotation.AnonymousDeleteMapping;
import com.neotel.smfcore.security.annotation.AnonymousGetMapping;
import com.neotel.smfcore.security.annotation.AnonymousPostMapping;
......@@ -59,6 +60,7 @@ import java.util.Map;
public class AuthorizationController {
private final SecurityProperties properties;
private final SmfApi smfApi;
@Autowired
private OnlineUserService onlineUserService;
......@@ -83,6 +85,8 @@ public class AuthorizationController {
// if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) {
// throw new BadRequestException("验证码错误");
// }
smfApi.canLogin(authUser.getUsername(),"123456");
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(authUser.getUsername(), password);
Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
......
......@@ -41,11 +41,9 @@ import java.util.stream.Collectors;
public class UserDetailsServiceImpl implements UserDetailsService {
private final IUserManager userManager;
private final IMenuManager menuManager;
private final SmfApi smfApi;
@Override
public JwtUserDto loadUserByUsername(String username) {
smfApi.canLogin(username,"");
boolean searchDb = true;
JwtUserDto jwtUserDto = null;
if (searchDb) {
......
......@@ -341,6 +341,9 @@ smfcore.selfAudit.notFind=\u672A\u627E\u5230\u76D8\u70B9\u4FE1\u606F
smfcore.selfAudit.pause=\u76D8\u70B9{0}\u5DF2\u6682\u505C
smfcore.shelf.error.orderError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u5DE5\u5355[{0}]\u4E0D\u4E00\u81F4
smfcore.shelf.error.storageError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u6599\u67B6[{0}]\u4E0D\u4E00\u81F4
order.error.executing={0}\u5DF2\u5728\u4EFB\u52A1\u5217\u8868\u4E2D
smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
#smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0}
#smfclient.nlp.cannotFindPos={0}\u672A\u627E\u5230\u5E93\u4F4D:{1}
#smfclient.nlp.inputOk={0}\u5165\u5E93\u5230{1}\u6210\u529F
......
......@@ -339,4 +339,7 @@ smfcore.selfAudit.hasEnd=[{0}] self audit is complete
smfcore.selfAudit.notFind=self audit is not found
smfcore.selfAudit.pause=self audit {0} has Paused
smfcore.shelf.error.orderError=Task does not match the assigned work order [{0}]
smfcore.shelf.error.storageError=Task does not match the specified shelf [{0}]
\ No newline at end of file
smfcore.shelf.error.storageError=Task does not match the specified shelf [{0}]
order.error.executing= {0} Already in the task list
smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}]
smfcore.operationFailure=Operation failed
\ No newline at end of file
......@@ -336,4 +336,7 @@ smfcore.selfAudit.hasEnd=[{0}]\u30A4\u30F3\u30D9\u30F3\u30C8\u30EA\u30FC\u5B8C\u
smfcore.selfAudit.notFind=\u30A4\u30F3\u30D9\u30F3\u30C8\u30EA\u60C5\u5831\u304C\u898B\u3064\u304B\u3089\u306A\u3044
smfcore.selfAudit.pause=\u30BB\u30EB\u30D5\u30C6\u30B9\u30C8{0}\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F
smfcore.shelf.error.orderError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u5DE5\u5355[{0}]\u4E0D\u4E00\u81F4
smfcore.shelf.error.storageError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u6599\u67B6[{0}]\u4E0D\u4E00\u81F4
\ No newline at end of file
smfcore.shelf.error.storageError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u6599\u67B6[{0}]\u4E0D\u4E00\u81F4
order.error.executing={0}\u5DF2\u5728\u4EFB\u52A1\u5217\u8868\u4E2D
smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
\ No newline at end of file
......@@ -336,4 +336,7 @@ smfcore.selfAudit.hasEnd=[{0}]\u76D8\u70B9\u5DF2\u5B8C\u6210
smfcore.selfAudit.notFind=\u672A\u627E\u5230\u76D8\u70B9\u4FE1\u606F
smfcore.selfAudit.pause=\u76D8\u70B9{0}\u5DF2\u6682\u505C
smfcore.shelf.error.orderError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u5DE5\u5355[{0}]\u4E0D\u4E00\u81F4
smfcore.shelf.error.storageError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u6599\u67B6[{0}]\u4E0D\u4E00\u81F4
\ No newline at end of file
smfcore.shelf.error.storageError=\u4EFB\u52A1\u4E0E\u6307\u5B9A\u6599\u67B6[{0}]\u4E0D\u4E00\u81F4
order.error.executing={0}\u5DF2\u5728\u4EFB\u52A1\u5217\u8868\u4E2D
smfcore.queryPos.solderOutFail=[{0}]\u51FA\u5E93\u5931\u8D25\uFF0C\u5F53\u524D\u72B6\u6001\uFF1A[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
\ No newline at end of file
......@@ -337,4 +337,7 @@ smfcore.selfAudit.hasEnd=[{0}]\u76E4\u9EDE\u5DF2\u5B8C\u6210
smfcore.selfAudit.notFind=\u672A\u627E\u5230\u76E4\u9EDE\u4FE1\u606F
smfcore.selfAudit.pause=\u76E4\u9EDE{0}\u5DF2\u66AB\u505C
smfcore.shelf.error.orderError=\u4EFB\u52D9\u8207\u6307\u5B9A\u5DE5\u55AE[{0}]\u4E0D\u4E00\u81F4
smfcore.shelf.error.storageError=\u4EFB\u52D9\u8207\u6307\u5B9A\u6599\u67B6[{0}]\u4E0D\u4E00\u81F4
\ No newline at end of file
smfcore.shelf.error.storageError=\u4EFB\u52D9\u8207\u6307\u5B9A\u6599\u67B6[{0}]\u4E0D\u4E00\u81F4
order.error.executing={0}\u5DF2\u5728\u4EFB\u52D9\u5217\u8868\u4E2D
smfcore.queryPos.solderOutFail=[{0}]\u51FA\u5E93\u5931\u8D25\uFF0C\u5F53\u524D\u72B6\u6001\uFF1A[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!