This commit is contained in:
zhouz
2024-04-26 13:28:48 +08:00
8 changed files with 144 additions and 23 deletions

View File

@@ -183,4 +183,18 @@ public class AcsToWmsController {
public ResponseEntity<Object> slitterApply(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.slitterApply(param), HttpStatus.OK);
}
@PostMapping("/sendSubVolumeApply")
@Log(value = "二期内包间送子卷请求", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> sendSubVolumeApply(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.sendSubVolumeApply(param), HttpStatus.OK);
}
@PostMapping("/feedbackSubVolumeWeightApply")
@Log(value = "二期ACS反馈子卷重量", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS)
@SaIgnore
public ResponseEntity<Object> feedbackSubVolumeWeightApply(@RequestBody JSONObject param) {
return new ResponseEntity<>(acsToWmsService.feedbackSubVolumeWeightApply(param), HttpStatus.OK);
}
}

View File

@@ -174,4 +174,18 @@ public interface AcsToWmsService {
* @return /
*/
JSONObject slitterApply(JSONObject param);
/**
* 二期内包间送子卷请求
* @param param /
* @return /
*/
JSONObject sendSubVolumeApply(JSONObject param);
/**
* 二期ACS反馈子卷重量
* @param param /
* @return /
*/
JSONObject feedbackSubVolumeWeightApply(JSONObject param);
}

View File

@@ -6,8 +6,10 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import lombok.RequiredArgsConstructor;
@@ -15,6 +17,8 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService;
import org.nl.b_lms.sch.task.dao.SchBaseTask;
@@ -130,6 +134,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
private final SlitterService slitterService;
private final IPdmBiSlittingproductionplanService slittingproductionplanService;
/**
* task_id任务标识
@@ -2104,4 +2110,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return res;
}
@SneakyThrows
@Override
public JSONObject sendSubVolumeApply(JSONObject param) {
log.info("slitterApply请求参数---------------------------------------------{}", param);
JSONObject res = new JSONObject();
String deviceCode = param.getString("device_code");
RLock lock = redissonClient.getLock(deviceCode);
boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS);
try {
if (tryLock) {
res = slitterService.acsSendSubVolume(param);
} else {
log.error("sendSubVolumeApply系统繁忙参数---------------------------------------------{}", param);
throw new BadRequestException("系统繁忙,请稍后再试!");
}
} finally {
if (tryLock) {
lock.unlock();
}
}
return res;
}
@Override
public JSONObject feedbackSubVolumeWeightApply(JSONObject param) {
JSONObject res = new JSONObject();
String subVolume = param.getString("sub_volume");
String weight = param.getString("weight1");
LambdaUpdateWrapper<PdmBiSlittingproductionplan> updateWrapper = new UpdateWrapper<PdmBiSlittingproductionplan>().lambda();
updateWrapper.set(PdmBiSlittingproductionplan::getWeight, weight)
.eq(PdmBiSlittingproductionplan::getContainer_name, subVolume);
boolean update = slittingproductionplanService.update(updateWrapper);
if (update) {
res.put("code", cn.hutool.http.HttpStatus.HTTP_OK);
res.put("message", "更新成功!");
} else {
res.put("code", cn.hutool.http.HttpStatus.HTTP_BAD_REQUEST);
res.put("message", "更新失败!");
}
return res;
}
}