opt:优化二楼扫码单据出库查询,任务申请失败返回400;
This commit is contained in:
@@ -56,7 +56,7 @@ public class InterationUtil {
|
||||
}else {
|
||||
error = response.getString("msg");
|
||||
}
|
||||
throw new BadRequestException("acs申请任务失败:"+error);
|
||||
throw new BadRequestException("acs返回错误:"+error);
|
||||
}
|
||||
return response.toJavaObject(TableDataInfo.class);
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -3,13 +3,12 @@ package org.nl.wms.decision_manage.handler.decisioner.impl.diy;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.decision_manage.handler.decisioner.Decisioner;
|
||||
import org.nl.wms.stor_manage.struct.service.IStIvtStructattrService;
|
||||
import org.nl.wms.stor_manage.struct.service.dao.StIvtStructattr;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -24,34 +23,36 @@ public class DepthPriorityHandler extends Decisioner<StIvtStructattr, JSONObject
|
||||
//现场1/4排深位
|
||||
@Override
|
||||
public List<StIvtStructattr> handler(List<StIvtStructattr> list, JSONObject param) {
|
||||
//深货位
|
||||
List<StIvtStructattr> depCollect = list.stream().filter(a -> a.getRow_num() == 1 || a.getRow_num() == 4).collect(Collectors.toList());
|
||||
//浅货位
|
||||
List<StIvtStructattr> shallowCollect = list.stream().filter(a -> a.getRow_num() == 2 || a.getRow_num() == 3).collect(Collectors.toList());
|
||||
List<StIvtStructattr> matchingCollect = new ArrayList<>();
|
||||
depCollect.forEach(r -> {
|
||||
shallowCollect.forEach(s -> {
|
||||
long startTime1 = System.currentTimeMillis();
|
||||
// 深货位
|
||||
List<StIvtStructattr> depCollect = list.stream()
|
||||
.filter(a -> a.getRow_num() == 1 || a.getRow_num() == 4)
|
||||
.collect(Collectors.toList());
|
||||
// 浅货位
|
||||
List<StIvtStructattr> shallowCollect = list.stream()
|
||||
.filter(a -> a.getRow_num() == 2 || a.getRow_num() == 3)
|
||||
.collect(Collectors.toList());
|
||||
for (StIvtStructattr r : depCollect) {
|
||||
for (StIvtStructattr s : shallowCollect) {
|
||||
String depCode = r.getCol_num() + "-" + r.getLayer_num();
|
||||
String shallowCode = s.getCol_num() + "-" + s.getLayer_num();
|
||||
if (r.getRow_num() == 1 && s.getRow_num() == 2) {
|
||||
if ((r.getRow_num() == 1 && s.getRow_num() == 2) ||
|
||||
(r.getRow_num() == 4 && s.getRow_num() == 3)) {
|
||||
if (depCode.equals(shallowCode)) {
|
||||
matchingCollect.add(r);
|
||||
}
|
||||
} else if (r.getRow_num() == 4 && s.getRow_num() == 3) {
|
||||
if (depCode.equals(shallowCode)) {
|
||||
matchingCollect.add(r);
|
||||
log.info("深位优先分配结果: 存在深位并对应浅位无货的库位,分配结果:" + r.getStruct_code());
|
||||
log.info("获取深货位且浅货位无货仓位耗时:{}", System.currentTimeMillis() - startTime1);
|
||||
return Collections.singletonList(r);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(matchingCollect)) {
|
||||
log.info("深位优先分配结果: 存在深位并对应浅位无货的库位,分配结果:" + matchingCollect.get(0).getStruct_code());
|
||||
return matchingCollect;
|
||||
} else if (!CollectionUtils.isEmpty(depCollect)) {
|
||||
}
|
||||
}
|
||||
if (!depCollect.isEmpty()) {
|
||||
log.info("深位优先分配结果: 存在深位但对应浅位有货的库位,分配结果:" + depCollect.get(0).getStruct_code());
|
||||
log.info("获取深货位且浅货位有货仓位耗时:{}", System.currentTimeMillis() - startTime1);
|
||||
return depCollect;
|
||||
}
|
||||
log.info("深位优先分配结果: 不存在深位库位,分配结果:" + list.get(0).getStruct_code());
|
||||
log.info("获取深货位有货且浅货位无货仓位:{}", System.currentTimeMillis() - startTime1);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,9 +92,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(shelfCodePointList)) {
|
||||
if (!shelfCodePointList.get(0).getLock_type().equals(StatusEnum.LOCK.code("无锁"))) {
|
||||
throw new BadRequestException("该货架正在执行输送任务,状态为锁定,请等任务完成再解绑!");
|
||||
throw new BadRequestException("该货架正在执行输送任务,状态为锁定,请等任务完成再绑定!");
|
||||
}
|
||||
//解锁
|
||||
//解锁货架,清空货架库存
|
||||
LambdaUpdateWrapper<SchBasePoint> wrapper1 = new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getVehicle_code, shelfCode)
|
||||
.set(SchBasePoint::getVehicle_code, null)
|
||||
@@ -145,13 +145,13 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
if (StringUtils.isNotBlank(pointCode)) {
|
||||
queryWrapper.eq(SchBasePoint::getCode, pointCode);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(getLockType)) {
|
||||
if (StringUtils.isNotBlank(getLockType)) {
|
||||
queryWrapper.eq(SchBasePoint::getLock_type, getLockType);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(pointType)) {
|
||||
if (StringUtils.isNotBlank(pointType)) {
|
||||
queryWrapper.eq(SchBasePoint::getPoint_type, pointType);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(vehicleIsNull)) {
|
||||
if (StringUtils.isNotBlank(vehicleIsNull)) {
|
||||
boolean isNull = Boolean.parseBoolean(vehicleIsNull);
|
||||
if (isNull) {
|
||||
queryWrapper.isNull(SchBasePoint::getVehicle_code);
|
||||
|
||||
@@ -109,8 +109,8 @@ public class SecondFloorOutStorageTask extends AbstractTask {
|
||||
// 分配料架起点
|
||||
List<StructattrVechielDto> starIvtList = iStIvtStructattrService.getStructFromBillCode(Arrays.asList(billCode.split(",")), vehicleCode);
|
||||
if (ObjectUtils.isEmpty(starIvtList)) {
|
||||
log.error("CTU出库任务,该单据载具:{}的物料在CTU库查找不到仓位信息,请检查", vehicleCode);
|
||||
throw new BadRequestException("CTU出库任务,该单据载具:" + vehicleCode + "的物料在CTU库查找不到仓位信息,请检查");
|
||||
log.error("CTU出库任务,该物料在CTU库中找不到料箱:{},请检查", vehicleCode);
|
||||
throw new BadRequestException("CTU出库任务,该物料在CTU库中找不到料箱:" + vehicleCode + ",请检查");
|
||||
}
|
||||
StructattrVechielDto structattrVechielDto = starIvtList.get(0);
|
||||
if (StringUtils.isBlank(structattrVechielDto.getStruct_code()) || Objects.equals(structattrVechielDto.getQty(), BigDecimal.ZERO)) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.base_manage.vehicle.service.IBmVehicleInfoService;
|
||||
import org.nl.wms.base_manage.vehicle.service.dao.BmVehicleInfo;
|
||||
import org.nl.wms.dispatch_manage.task.handler.impl.SecondFloorOutStorageTask;
|
||||
import org.nl.wms.dispatch_manage.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.external_system.acs.service.AcsToWmsService;
|
||||
import org.nl.wms.external_system.dto.InteracteDto;
|
||||
@@ -41,10 +40,10 @@ public class GateWayService {
|
||||
String service = param.getService();
|
||||
String type = param.getType();
|
||||
//根据服务拆分不同的业务
|
||||
|
||||
if (service.equals("InStorage")){
|
||||
RedissonUtils.lock(()->{
|
||||
acsToWmsService.applyTask(param.getService(), type, jsonObject);
|
||||
String taskCode = acsToWmsService.applyTask(param.getService(), type, jsonObject);
|
||||
result.put("taskCode", taskCode);
|
||||
},param.getService() + param.getType(),null);
|
||||
}
|
||||
if (service.equals("Task")){
|
||||
|
||||
@@ -1,27 +1,16 @@
|
||||
package org.nl.wms.external_system.acs.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.InterationUtil;
|
||||
import org.nl.common.utils.SpringContextHolder;
|
||||
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.dao.SchBaseTask;
|
||||
import org.nl.wms.external_system.dto.InteracteDto;
|
||||
import org.nl.wms.flow_manage.flow.framework.process.nodeType.source.impl.MappingSourceDataTypeHandler;
|
||||
import org.nl.wms.sync_manage.service.form_mapping.ISyncFormMappingService;
|
||||
import org.nl.wms.sync_manage.service.form_mapping.dao.SyncFormMapping;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
@@ -47,18 +36,23 @@ public class AcsToWmsService {
|
||||
@Autowired
|
||||
private ISchBaseTaskService iSchBaseTaskService;
|
||||
|
||||
public void applyTask(String service,String type,JSONObject data){
|
||||
if (service.equals("InStorage")){
|
||||
applyTaskMap.get(type).createTask(data);
|
||||
public String applyTask(String service, String type, JSONObject data) {
|
||||
if ("InStorage".equals(service)) {
|
||||
JSONObject task = applyTaskMap.get(type).createTask(data);
|
||||
if (task != null) {
|
||||
return task.getString("task_code");
|
||||
} else {
|
||||
throw new BadRequestException("出现异常,任务申请失败,申请参数为:" + type + ":" + JSON.toJSONString(data) + ",请查看错误日志");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
public void updateTask(String type,JSONObject data){
|
||||
|
||||
public void updateTask(String type, JSONObject data) {
|
||||
String task_code = data.getString("task_code");
|
||||
SchBaseTask task = iSchBaseTaskService.getOne(new QueryWrapper<SchBaseTask>().eq("task_code", task_code)
|
||||
.lt("status", StatusEnum.FORM_STATUS.code("完成")));
|
||||
if (task == null){
|
||||
if (task == null) {
|
||||
throw new BadRequestException("更新失败:当前执行中的任务不存在");
|
||||
}
|
||||
applyTaskMap.get(task.getTask_type()).updateStatus(data);
|
||||
|
||||
@@ -194,7 +194,6 @@
|
||||
LEFT JOIN
|
||||
bm_measure_unit u ON v.unit_id = u.unit_id
|
||||
<where>
|
||||
v.is_delete = '0'
|
||||
<if test="query.bill_code != null and query.bill_code != ''">
|
||||
AND v.prd_ppbom_no = #{query.bill_code}
|
||||
</if>
|
||||
|
||||
@@ -147,6 +147,11 @@ public class PmFormDataDto implements Serializable {
|
||||
* 批次号
|
||||
*/
|
||||
private String product_area;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
/**
|
||||
* 载具
|
||||
*/
|
||||
|
||||
@@ -305,15 +305,18 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
||||
Page page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
List<PmFormDataDto> pmFormDataList = this.baseMapper.queryCtuOrderList(query);
|
||||
pmFormDataList.forEach(r -> {
|
||||
if (r.getQty().compareTo(BigDecimal.ZERO)<=0) {
|
||||
if (r.getQty().compareTo(BigDecimal.ZERO)<=0&& "1".equals(r.getIs_delete())) {
|
||||
r.setStatus("3");
|
||||
r.setMaterial_status("已出库");
|
||||
} else if (r.getFrozen_qty().compareTo(BigDecimal.ZERO) > 0) {
|
||||
r.setMaterial_status("已扫码从产线取走");
|
||||
} else if (r.getFrozen_qty().compareTo(BigDecimal.ZERO) > 0&& "0".equals(r.getIs_delete())) {
|
||||
r.setStatus("2");
|
||||
r.setMaterial_status("正在出库");
|
||||
} else {
|
||||
r.setMaterial_status("正在进行出库搬运");
|
||||
} else if (r.getQty().compareTo(BigDecimal.ZERO) > 0&& "0".equals(r.getIs_delete())) {
|
||||
r.setStatus("1");
|
||||
r.setMaterial_status("未出库");
|
||||
r.setMaterial_status("物料未出库");
|
||||
} else {
|
||||
r.setStatus("4");
|
||||
r.setMaterial_status("物料异常,请联系仓管员");
|
||||
}
|
||||
});
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<PmFormDataDto> dtoPage = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page.getPages(), page.getPageSize(), page.getTotal());
|
||||
|
||||
@@ -335,7 +335,7 @@ export default {
|
||||
setDefaultDate() {
|
||||
const now = new Date()
|
||||
const lastWeek = new Date()
|
||||
lastWeek.setDate(now.getDate() - 3)
|
||||
lastWeek.setDate(now.getDate() - 1)
|
||||
const format = (date, time) => {
|
||||
const yyyy = date.getFullYear()
|
||||
const mm = String(date.getMonth() + 1).padStart(2, '0')
|
||||
|
||||
@@ -281,7 +281,7 @@ export default {
|
||||
setDefaultDate() {
|
||||
const now = new Date()
|
||||
const lastWeek = new Date()
|
||||
lastWeek.setDate(now.getDate() - 3)
|
||||
lastWeek.setDate(now.getDate() - 1)
|
||||
const format = (date, time) => {
|
||||
const yyyy = date.getFullYear()
|
||||
const mm = String(date.getMonth() + 1).padStart(2, '0')
|
||||
|
||||
Reference in New Issue
Block a user