opt: 取消NDC任务,手持下发任务优化

This commit is contained in:
yanps
2024-11-18 14:34:11 +08:00
parent 3937ed3a3b
commit d92ec484fa
7 changed files with 47 additions and 22 deletions

View File

@@ -69,7 +69,7 @@ public class NDCAgvServiceImpl implements NDCAgvService {
};
log.info("下发删除AGV指令--{}", Bytes2HexString(b));
// NDCSocketConnectionAutoRun.write(b);
OneNDCSocketConnectionAutoRun.write(b);
System.out.println("下发删除agv指令数据:" + Bytes2HexString(b));
}

View File

@@ -60,9 +60,9 @@ public class WmsToConnectorServiceImpl implements WmsToConnectorService {
materials.forEach(material -> {
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
JSONObject jsonObject1 = JSONObject.parseObject(replace);
jsonObject1.put("due_date", "2000-10-01 00:00:00 ");
jsonObject1.put("due_date", "2000-10-01 00:00:00");
jsonObject1.put("next_region_code", "");
jsonObject1.put("priority", "5");
jsonObject1.put("priority", "");
objects.add(jsonObject1);
});
jsonObject.put("data", objects);

View File

@@ -108,6 +108,7 @@ public class HandheldServiceImpl implements HandheldService {
private void applyDeliveryRacks(String vehicle, String device_code, JSONObject param) {
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code);
if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("设备点位不存在!");
if (schBasePoint.getIs_lock()) throw new BadRequestException("当前点位存在任务!");
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(vehicle);
if (ObjectUtil.isEmpty(mdBaseVehicle))
throw new BadRequestException("载具不存在!");
@@ -127,7 +128,9 @@ public class HandheldServiceImpl implements HandheldService {
jo.put("vehicle_type", mdBaseVehicle.getVehicle_type());
jo.put("ext_data", param);
connectorTask.apply(jo);
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
.set(SchBasePoint::getIs_lock, true));
}
/**
@@ -285,7 +288,7 @@ public class HandheldServiceImpl implements HandheldService {
/**
* connector下料入库
*
* @param schBasePoint
* @param
* @param param
* @param region_code
* @param device_code
@@ -305,9 +308,7 @@ public class HandheldServiceImpl implements HandheldService {
connectorTask.apply(jo);
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, device_code)
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
.set(SchBasePoint::getIs_lock, true)
.set(SchBasePoint::getVehicle_code, null));
.set(SchBasePoint::getIs_lock, true));
}
/**
@@ -330,12 +331,12 @@ public class HandheldServiceImpl implements HandheldService {
if (StrUtil.isBlank(region_code)) {
JSONObject json = new JSONObject();
JSONArray jsonArray = new JSONArray();
HashMap<String, Object> map = new HashMap<>();
materials.stream().forEach(material2 -> {
boolean material_code = ObjectUtil.isEmpty(((LinkedHashMap) material2).get("material_code"));
if (material_code) {
((LinkedHashMap) material2).remove("material_code");
}
HashMap<String, Object> map = new HashMap<>();
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(material2);
map.put("order_code", jsonObject.get("order_code"));
map.put("qty", jsonObject.get("material_qty"));
@@ -428,9 +429,7 @@ public class HandheldServiceImpl implements HandheldService {
connectorTask.apply(jo);
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, device_code)
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
.set(SchBasePoint::getIs_lock, true)
.set(SchBasePoint::getVehicle_code, null));
.set(SchBasePoint::getIs_lock, true));
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
materials.stream().forEach(material -> {

View File

@@ -78,7 +78,7 @@
ROW_NUMBER() OVER (PARTITION BY vg.vehicle_code ORDER BY vg.due_date) AS rn
FROM
sch_base_vehiclematerialgroup vg
where 1=1
where vg.is_delete = 0
<if test="query.vehicle_code != null">
AND vg.vehicle_code = #{query.vehicle_code}
</if>
@@ -97,6 +97,7 @@
<if test="query.material_id != null">
AND vg.material_id like CONCAT('%', #{query.material_id}, '%')
</if>
order by vg.region_code desc
)
SELECT *
FROM RankedVehicles

View File

@@ -77,7 +77,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
if (StrUtil.isNotBlank(item.getRegion_code())) {
item.setRegion_name(item.getRegion_code());
} else {
item.setRegion_name("未知");
item.setRegion_code("未知");
}
SchBasePoint one = pointService.getOne(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getVehicle_code, item.getVehicle_code()));
@@ -170,7 +170,7 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
if (CollUtil.isNotEmpty(order_code)) {
orderList.put("region_code", order_code.get(0).getRegion_code());
orderList.put("due_date", order_code.get(0).getDue_date());
orderList.put("priority",order_code.get(0).getPriority());
orderList.put("priority", order_code.get(0).getPriority());
}
});
maps = maps.stream().sorted(Comparator.comparingLong(order -> {
@@ -193,6 +193,10 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
@Override
public Object createTask(JSONObject entity) {
Assert.noNullElements(new Object[]{entity.get("point_code2"), entity.get("vehicle_code")}, "载具号不能为空!");
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(entity.getString("point_code2"));
if (ObjectUtil.isEmpty(schBasePoint) || schBasePoint.getIs_lock()) {
throw new BadRequestException("当前点位不存在或点位正在执行任务");
}
JSONObject param = new JSONObject();
param.put("device_code", entity.get("point_code2"));
param.put("config_code", "PcOperationCMTask");
@@ -201,7 +205,6 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl<SchBaseV
pcOperationCMTask.apply(param);
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, entity.get("point_code2"))
.eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
.set(SchBasePoint::getIs_lock, true));
this.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class)
.eq(SchBaseVehiclematerialgroup::getVehicle_code, entity.get("vehicle_code"))

View File

@@ -293,7 +293,8 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override
public SchBasePoint selectByPointCode(String start_device_code) {
return pointMapper.selectOne(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getPoint_code, start_device_code)
return pointMapper.selectOne(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getPoint_code, start_device_code)
.eq(SchBasePoint::getIs_used, true));
}

View File

@@ -267,8 +267,8 @@
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogVisible" title="物料图片">
<img :src="imageUrl" alt="物料图片" style="max-width: 100%;">
<el-dialog :visible.sync="dialogVisible1" title="物料图片">
<img :src="errGif" alt="物料图片" style="max-width: 100%;">
</el-dialog>
<el-dialog
title="创建任务"
@@ -322,10 +322,23 @@
<el-table-column type="selection" width="55" />
<el-table-column v-if="false" prop="group_id" label="组盘编码" :min-width="flexWidth('group_id',crud.data,'组盘编码')" />
<el-table-column prop="vehicle_code" label="载具编码" width="100" />
<el-table-column prop="region_code" label="下道工序" :min-width="flexWidth('region_name',crud.data,'下道工序')" />
<el-table-column prop="region_code" label="下道工序" :min-width="flexWidth('region_code',crud.data,'下道工序')" />
<el-table-column prop="order_code" label="工单编码" :min-width="flexWidth('order_code',crud.data,'工单编码')" />
<el-table-column v-if="false" prop="material_name" label="物料名称" show-overflow-tooltip :min-width="flexWidth('material_name',crud.data,'物料数量')" />
<el-table-column prop="material_id" label="物料编码" show-overflow-tooltip :min-width="flexWidth('material_id',crud.data,'物料编码')" @click="showImage" />
<el-table-column prop="material_id" label="物料编码" show-overflow-tooltip :min-width="flexWidth('material_id',crud.data,'物料编码')">
<template slot-scope="scope">
<el-tooltip
class="item"
effect="dark"
content="点击查看图片"
placement="top"
>
<div @click="showImage(scope.row.material_id)">
{{ scope.row.material_id }}
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="material_qty" label="物料数量" show-overflow-tooltip :min-width="flexWidth('material_qty',crud.data,'物料数量')" />
<el-table-column prop="job_name" label="jobName" show-overflow-tooltip :min-width="flexWidth('job_name',crud.data,'jobName')" />
<el-table-column prop="due_date" label="交期时间" show-overflow-tooltip :min-width="flexWidth('due_date',crud.data,'交期时间')" />
@@ -375,6 +388,7 @@ import MaterialDialog from '@/views/wms/sch/group/MaterialDialog.vue'
import WorkOrderDialog from '@/views/wms/sch/group/WorkOrderDialog.vue'
import crudSchBasePoint from '@/views/wms/sch/point/schBasePoint'
import crudSchBaseRegion from '@/views/wms/sch/region/schBaseRegion'
import errGif from '@/assets/images/background2.jpg'
const defaultForm = {
group_id: null,
@@ -451,11 +465,13 @@ export default {
materialDialog: false,
workOrderDialog: false,
dialogVisible: false,
dialogVisible1: false,
newTask: {
point_code2: '',
vehicle_code: '',
point_code1: ''
}
},
errGif: errGif
}
},
created() {
@@ -468,6 +484,11 @@ export default {
[CRUD.HOOK.beforeRefresh]() {
return true
},
showImage(materialId) {
console.log('Clicked material_id:', materialId)
this.dialogVisible1 = true
// 在这里处理点击逻辑,例如弹出图片、显示详情等
},
getWorkShopList() { // 获取车间列表
crudMdBaseWorkShop.getWorkShopList().then(res => {
this.workShopList = res