Browse Source

乐观锁

master
常熟吴彦祖 5 months ago
parent
commit
56e3e3fcb9
  1. 9
      src/main/java/com/gaotao/modules/automatedWarehouse/controller/WcsIntegrationController.java
  2. 2
      src/main/java/com/gaotao/modules/automatedWarehouse/service/WcsIntegrationService.java
  3. 14
      src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java

9
src/main/java/com/gaotao/modules/automatedWarehouse/controller/WcsIntegrationController.java

@ -62,15 +62,14 @@ public class WcsIntegrationController {
@PostMapping(value="/checkPalletExists") @PostMapping(value="/checkPalletExists")
@ResponseBody @ResponseBody
public R checkPalletExists(@RequestBody Map<String, Object> params) { public R checkPalletExists(@RequestBody Map<String, Object> params) {
try {
Map<String, Object> result = wcsIntegrationService.checkPalletExists(params); Map<String, Object> result = wcsIntegrationService.checkPalletExists(params);
return R.ok() return R.ok()
.put("positions", result.get("positions")) .put("positions", result.get("positions"))
.put("palletType", result.get("palletType")) .put("palletType", result.get("palletType"))
.put("locationCode", result.get("locationCode"));
} catch (Exception e) {
return R.error(e.getMessage());
}
.put("locationCode", result.get("locationCode"))
.put("palletId", result.get("palletId"));
} }
/** /**

2
src/main/java/com/gaotao/modules/automatedWarehouse/service/WcsIntegrationService.java

@ -17,7 +17,7 @@ public interface WcsIntegrationService {
/** /**
* 检查栈板是否存在并获取位置信息 - AI制作 * 检查栈板是否存在并获取位置信息 - AI制作
*/ */
Map<String, Object> checkPalletExists(Map<String, Object> params) throws Exception;
Map<String, Object> checkPalletExists(Map<String, Object> params) ;
/** /**
* 获取栈板明细 - AI制作 * 获取栈板明细 - AI制作

14
src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java

@ -133,24 +133,26 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService {
// ==================== 打托相关方法实现 - AI制作 ==================== // ==================== 打托相关方法实现 - AI制作 ====================
@Override @Override
public Map<String, Object> checkPalletExists(Map<String, Object> params) throws Exception {
public Map<String, Object> checkPalletExists(Map<String, Object> params) {
String site = (String) params.get("site"); String site = (String) params.get("site");
String palletId = (String) params.get("palletId"); String palletId = (String) params.get("palletId");
if (palletId.length() > 6) {
palletId = palletId.substring(0, 6);
}
if (!StringUtils.hasText(site) || !StringUtils.hasText(palletId)) { if (!StringUtils.hasText(site) || !StringUtils.hasText(palletId)) {
throw new Exception("参数不能为空");
throw new RuntimeException("参数不能为空");
} }
// 检查栈板是否存在 // 检查栈板是否存在
Map<String, Object> palletInfo = wcsIntegrationMapper.getPalletInfo(site, palletId); Map<String, Object> palletInfo = wcsIntegrationMapper.getPalletInfo(site, palletId);
if (palletInfo == null) { if (palletInfo == null) {
throw new Exception("栈板不存在");
throw new RuntimeException("栈板不存在");
} }
// 检查栈板是否正在被调用 // 检查栈板是否正在被调用
String callingFlag = (String) palletInfo.get("calling_flag"); String callingFlag = (String) palletInfo.get("calling_flag");
if ("Y".equals(callingFlag)) { if ("Y".equals(callingFlag)) {
throw new Exception("栈板正在被调用中,无法进行打托操作");
throw new RuntimeException("栈板正在被调用中,无法进行打托操作");
} }
// 获取栈板类型的位置信息 // 获取栈板类型的位置信息
@ -162,7 +164,7 @@ public class WcsIntegrationServiceImpl implements WcsIntegrationService {
result.put("positions", positions); result.put("positions", positions);
result.put("palletType", palletType); result.put("palletType", palletType);
result.put("locationCode", locationCode); // 添加栈板位置信息 result.put("locationCode", locationCode); // 添加栈板位置信息
result.put("palletId", palletId);
return result; return result;
} }

Loading…
Cancel
Save