opt:单据同步优化;

This commit is contained in:
2024-12-06 17:20:28 +08:00
parent 10ca271230
commit d3db0e396c
4 changed files with 30 additions and 24 deletions

View File

@@ -45,7 +45,7 @@ public class InterationUtil {
if (execute.getStatus() != 200){ if (execute.getStatus() != 200){
throw new BadRequestException("acs申请失败"+response.getString("message")); throw new BadRequestException("acs申请失败"+response.getString("message"));
} }
if (!response.getString("code").equals("200")){ if (!"200".equals(response.getString("code"))){
String error = ""; String error = "";
if (response.get("data")!=null){ if (response.get("data")!=null){
JSONArray data = response.getJSONArray("data"); JSONArray data = response.getJSONArray("data");

View File

@@ -17,8 +17,6 @@ import org.nl.wms.dispatch_manage.task.handler.AbstractTask;
import org.nl.wms.dispatch_manage.task.service.ISchBaseTaskService; import org.nl.wms.dispatch_manage.task.service.ISchBaseTaskService;
import org.nl.wms.dispatch_manage.task.service.dao.SchBaseTask; import org.nl.wms.dispatch_manage.task.service.dao.SchBaseTask;
import org.nl.wms.flow_manage.flow.service.execution.IActRuExecutionService; import org.nl.wms.flow_manage.flow.service.execution.IActRuExecutionService;
import org.nl.wms.flow_manage.flow.service.execution.dao.ActRuExecution;
import org.nl.wms.flow_manage.monitor.event.FlowContinueEvent;
import org.nl.wms.flow_manage.monitor.event.FlowStartEvent; import org.nl.wms.flow_manage.monitor.event.FlowStartEvent;
import org.nl.wms.md_manage.group_dick.service.IMdGruopDickService; import org.nl.wms.md_manage.group_dick.service.IMdGruopDickService;
import org.nl.wms.md_manage.group_dick.service.dao.MdGruopDick; import org.nl.wms.md_manage.group_dick.service.dao.MdGruopDick;
@@ -105,14 +103,17 @@ public class PalletInStorageTask extends AbstractTask {
}else { }else {
String groupId = vehicleMaterVo.getGroup_id(); String groupId = vehicleMaterVo.getGroup_id();
MdGruopDick mst = iMdGruopDickService.getById(groupId); MdGruopDick mst = iMdGruopDickService.getById(groupId);
if (mst == null) {
throw new BadRequestException("申请任务失败,载具没有组盘信息!");
}
SchBaseTask schBaseTask = iSchBaseTaskService.getOne(new QueryWrapper<SchBaseTask>() SchBaseTask schBaseTask = iSchBaseTaskService.getOne(new QueryWrapper<SchBaseTask>()
.eq("vehicle_code", vehicle_code).select("task_code") .eq("vehicle_code", vehicle_code).select("task_code")
.lt("status",StatusEnum.FORM_STATUS.code("完成"))); .lt("status", StatusEnum.FORM_STATUS.code("完成")));
if (schBaseTask!=null){ if (schBaseTask != null) {
throw new BadRequestException("申请任务失败:载具"+vehicle_code+"已经存任务"+schBaseTask.getTask_code()); throw new BadRequestException("申请任务失败:载具" + vehicle_code + "已经存任务" + schBaseTask.getTask_code());
} }
iBmVehicleInfoService.update(new UpdateWrapper<BmVehicleInfo>() iBmVehicleInfoService.update(new UpdateWrapper<BmVehicleInfo>()
.set("h",Integer.valueOf(h)) .set("h", Integer.valueOf(h))
.set("update_time", DateUtil.now()) .set("update_time", DateUtil.now())
.set("update_name", "ACS托盘入库申请") .set("update_name", "ACS托盘入库申请")
.eq("vehicle_code",vehicle_code)); .eq("vehicle_code",vehicle_code));

View File

@@ -316,28 +316,32 @@ public class CockpitServiceImpl implements CockpitService {
r.setProduct_area(pointInfo.getProduct_area()); r.setProduct_area(pointInfo.getProduct_area());
} }
} }
InteracteDto<Object> dto = InteracteDto.builder()
.service("wmsToAcsService")
.trace_id(MDC.get("trace_id"))
.type("getWeight")
.data(new JSONObject().fluentPut("device_code", code)) // 使用 fluentPut 提高代码简洁性
.build();
//查询称重重量
TableDataInfo result = InterationUtil.notifyExt("/api/wmsToAcs/apply", (JSONObject) JSON.toJSON(dto));
BigDecimal theoryQty = BigDecimal.ZERO; BigDecimal theoryQty = BigDecimal.ZERO;
BigDecimal actual_weight = BigDecimal.ZERO; BigDecimal actual_weight = BigDecimal.ZERO;
if ("200".equals(result.getCode())) { try {
Object dataObj = result.getData(); InteracteDto<Object> dto = InteracteDto.builder()
if (dataObj != null) { .service("wmsToAcsService")
JSONObject data = JSONObject.parseObject(dataObj.toString()); .trace_id(MDC.get("trace_id"))
if (data != null && data.containsKey("weight")) { .type("getWeight")
String weightStr = data.getString("weight"); .data(new JSONObject().fluentPut("device_code", code))
if (ObjectUtil.isNotEmpty(weightStr)) { .build();
// 转换为 BigDecimal //查询称重重量
actual_weight = new BigDecimal(weightStr.trim()); TableDataInfo result = InterationUtil.notifyExt("/api/wmsToAcs/apply", (JSONObject) JSON.toJSON(dto));
if ("200".equals(result.getCode())) {
Object dataObj = result.getData();
if (dataObj != null) {
JSONObject data = JSONObject.parseObject(dataObj.toString());
if (data != null && data.containsKey("weight")) {
String weightStr = data.getString("weight");
if (ObjectUtil.isNotEmpty(weightStr)) {
// 转换为 BigDecimal
actual_weight = new BigDecimal(weightStr.trim());
}
} }
} }
} }
} catch (Exception ex) {
log.error(ex.getMessage());
} }
r.setActual_weight(actual_weight); r.setActual_weight(actual_weight);
//根据称重信息计算理论数量 //根据称重信息计算理论数量

View File

@@ -52,6 +52,7 @@ public class PdaOutController {
@GetMapping("order") @GetMapping("order")
@Log("出库单据列表") @Log("出库单据列表")
@SaIgnore @SaIgnore
public ResponseEntity<List<Map>> orderType() { public ResponseEntity<List<Map>> orderType() {
List<Map> result = new ArrayList<>(); List<Map> result = new ArrayList<>();
List<BmFormStruc> list = iBmFormStrucService.list(new QueryWrapper<BmFormStruc>() List<BmFormStruc> list = iBmFormStrucService.list(new QueryWrapper<BmFormStruc>()