33 changed files with 713 additions and 328 deletions
Binary file not shown.
@ -0,0 +1,48 @@ |
|||||
|
package org.nl.wms.ext.handheld.controller; |
||||
|
|
||||
|
import cn.dev33.satoken.annotation.SaIgnore; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.common.logging.annotation.Log; |
||||
|
import org.nl.wms.ext.handheld.service.HandheldService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
*/ |
||||
|
@RestController |
||||
|
@Api(tags = "手持") |
||||
|
@RequestMapping("/api/") |
||||
|
@Slf4j |
||||
|
@SaIgnore |
||||
|
public class HandheldController { |
||||
|
|
||||
|
@Autowired |
||||
|
private HandheldService handheldService; |
||||
|
|
||||
|
@PostMapping("/task") |
||||
|
@Log("手持创建去地面点位任务") |
||||
|
@ApiOperation("手持创建去地面点位任务") |
||||
|
@SaIgnore |
||||
|
public ResponseEntity<Object> applyGroundTask(@RequestBody JSONObject param) { |
||||
|
return new ResponseEntity<>(handheldService.applyTask(param), HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/emptyVehicle") |
||||
|
@Log("呼叫地面空载具点位") |
||||
|
@ApiOperation("呼叫地面空载具点位") |
||||
|
@SaIgnore |
||||
|
public ResponseEntity<Object> applyEmptyVehicle(@RequestBody JSONObject param) { |
||||
|
return new ResponseEntity<>(handheldService.applyEmptyVehicle(param), HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package org.nl.wms.ext.handheld.service; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
*/ |
||||
|
public interface HandheldService { |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 手持申请去地面点位任务 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
Object applyTask(JSONObject param); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 手持呼叫空载具地面点位 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
Object applyEmptyVehicle(JSONObject param); |
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
package org.nl.wms.ext.handheld.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.collection.CollUtil; |
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import nl.basjes.shaded.org.springframework.util.Assert; |
||||
|
import org.nl.common.exception.BadRequestException; |
||||
|
import org.nl.wms.ext.handheld.service.HandheldService; |
||||
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
||||
|
import org.nl.wms.sch.task_manage.AbstractTask; |
||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition; |
||||
|
import org.nl.wms.sch.task_manage.task.TaskFactory; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
*/ |
||||
|
@Service |
||||
|
public class HandheldServiceImpl implements HandheldService { |
||||
|
|
||||
|
@Autowired |
||||
|
private ISchBasePointService iSchBasePointService; |
||||
|
|
||||
|
@Autowired |
||||
|
private TaskFactory taskFactory; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public Object applyTask(JSONObject param) { |
||||
|
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_list") |
||||
|
, param.getString("vehicle_type")}, "参数不能为空!"); |
||||
|
String vehicle_list = param.getString("vehicle_list"); |
||||
|
String region_code = param.getString("region_code"); |
||||
|
|
||||
|
String device_code = param.getString("device_code"); |
||||
|
String vehicle_type = param.getString("vehicle_type"); |
||||
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
||||
|
boolean equals = StrUtil.equals(schBasePoint.getPoint_type(), vehicle_type); |
||||
|
if (ObjectUtil.isEmpty(schBasePoint) || !equals) throw new BadRequestException("设备点位不存在!"); |
||||
|
AbstractTask connectorTask = taskFactory.getTask("HHTask"); |
||||
|
// 准备参数:设备编码
|
||||
|
JSONObject jo = new JSONObject(); |
||||
|
jo.put("device_code", device_code); |
||||
|
jo.put("config_code", "HHTask"); |
||||
|
jo.put("create_mode", GeneralDefinition.AUTO_CREATION); |
||||
|
jo.put("vehicle_qty", BeanUtil.toBean(vehicle_list, List.class).size()); |
||||
|
jo.put("vehicles", BeanUtil.toBean(vehicle_list, List.class)); |
||||
|
jo.put("vehicle_type", vehicle_type); |
||||
|
jo.put("ext_data", param); |
||||
|
connectorTask.apply(jo); |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Object applyEmptyVehicle(JSONObject param) { |
||||
|
Assert.noNullElements(new Object[]{param.getString("device_code"), param.getString("vehicle_type")}, "参数不能为空!"); |
||||
|
String device_code = param.getString("device_code"); |
||||
|
String vehicle_type = param.getString("vehicle_type"); |
||||
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(device_code); |
||||
|
boolean equals = StrUtil.equals(schBasePoint.getPoint_type(), vehicle_type); |
||||
|
if (ObjectUtil.isEmpty(schBasePoint) || !equals) throw new BadRequestException("设备点位不存在!"); |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,104 @@ |
|||||
|
package org.nl.wms.sch.task_manage.task.tasks.handheld; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import org.nl.common.enums.GoodsEnum; |
||||
|
import org.nl.common.enums.region.RegionEnum; |
||||
|
import org.nl.common.exception.BadRequestException; |
||||
|
import org.nl.system.service.notice.ISysNoticeService; |
||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; |
||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
||||
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
||||
|
import org.nl.wms.sch.task_manage.AbstractTask; |
||||
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
||||
|
import org.nl.wms.sch.task_manage.task.core.TaskType; |
||||
|
import org.nl.wms.util.PointUtils; |
||||
|
import org.nl.wms.util.TaskUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
*/ |
||||
|
@Component("HHTask") |
||||
|
public class HHTask extends AbstractTask { |
||||
|
|
||||
|
|
||||
|
private static final String TASK_CONFIG_CODE = "HHTask"; |
||||
|
@Autowired |
||||
|
private ISchBasePointService pointService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskService taskService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskconfigService taskConfigService; |
||||
|
@Autowired |
||||
|
private ISysNoticeService noticeService; |
||||
|
@Autowired |
||||
|
private ISchBasePointService schBasePointService; |
||||
|
@Autowired |
||||
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService; |
||||
|
|
||||
|
@Override |
||||
|
protected void create() throws BadRequestException { |
||||
|
// 获取任务
|
||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
||||
|
// 配置信息
|
||||
|
for (SchBaseTask task : tasks) { |
||||
|
TaskUtils.setUpdateByAcs(task); |
||||
|
// 查询终点
|
||||
|
SchBasePoint schBasePoint = schBasePointService.selectByVehicleQty(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(),task.getVehicle_type()); |
||||
|
if (TaskType.CARRY_TASK.getValue().equals(task.getTask_type())) { |
||||
|
schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code()); |
||||
|
} else if (TaskType.REASSIGN_TASK.getValue().equals(task.getTask_type())) { |
||||
|
schBasePoint = schBasePointService.selectByReassign(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code()); |
||||
|
} |
||||
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
||||
|
task.setRemark("未找到所需点位!"); |
||||
|
taskService.updateById(task); |
||||
|
// 消息通知
|
||||
|
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(), |
||||
|
NoticeTypeEnum.WARN.getCode()); |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
// 设置终点并修改创建成功状态
|
||||
|
task.setPoint_code2(schBasePoint.getPoint_code()); |
||||
|
task.setVehicle_type(schBasePoint.getCan_vehicle_type()); |
||||
|
task.setRemark(""); |
||||
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
||||
|
taskService.updateById(task); |
||||
|
|
||||
|
schBasePoint.setIng_task_code(task.getTask_code()); |
||||
|
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); |
||||
|
PointUtils.setUpdateByAcs(schBasePoint); |
||||
|
pointService.updateById(schBasePoint); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void updateStatus(String task_code, TaskStatus status) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void forceFinish(String task_code) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void cancel(String task_code) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
||||
|
|
||||
|
} |
||||
|
} |
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -1,186 +1,110 @@ |
|||||
import request from '@/utils/request' |
import request from '@/utils/request' |
||||
|
|
||||
export function add(data) { |
// 设备工序列表
|
||||
|
export function regionList() { |
||||
return request({ |
return request({ |
||||
url: 'api/produceTask/add', |
url: 'api/fab/regionList', |
||||
method: 'post', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function del(ids) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/', |
|
||||
method: 'delete', |
|
||||
data: ids |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function edit(data) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask', |
|
||||
method: 'put', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function getDevice() { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/getDevice', |
|
||||
method: 'get' |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function getMaterial() { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/getMaterial', |
|
||||
method: 'get' |
method: 'get' |
||||
}) |
}) |
||||
} |
} |
||||
|
// export function regionList() {
|
||||
export function getProduceStatus() { |
// const res = [
|
||||
return request({ |
// { value: '111-02', label: 'TP5000冲床加工' },
|
||||
url: 'api/produceTask/getProduceStatus', |
// { value: '111 03', label: '警平' },
|
||||
|
// { value: '111-04', label: '激光切闻' },
|
||||
|
// { value: '111-05', label: '复合机' },
|
||||
|
// { value: '111-06', label: 'Amada 801冲床' },
|
||||
|
// { value: '111-07', label: 'TruBend 7038' },
|
||||
|
// { value: '111-08', label: 'TruBend 5170' },
|
||||
|
// { value: '111 09', label: 'TruBend Cell 7000' },
|
||||
|
// { value: '111-10', label: 'LAG Robot Bending Cell' },
|
||||
|
// { value: '111-12', label: '气保焊' },
|
||||
|
// { value: '111-13', label: '姆柱焊、点焊' },
|
||||
|
// { value: '111-14', label: '林肯焊接机器人' },
|
||||
|
// { value: '111-15', label: '铜冲机' },
|
||||
|
// { value: '111-16', label: '铜弯机' },
|
||||
|
// { value: '111-22', label: '钳床' },
|
||||
|
// { value: '111-23', label: '压铆机' },
|
||||
|
// { value: '111-24', label: '斯图加特焊接机器人' }
|
||||
|
// ]
|
||||
|
// return new Promise((resolve, reject) => {
|
||||
|
// resolve(res)
|
||||
|
// })
|
||||
|
// }
|
||||
|
|
||||
|
// 根据工序获取设备点位信息
|
||||
|
export function regionPoints(code) { |
||||
|
return request({ |
||||
|
url: 'api/fab/regionPoints?regionCode=' + code, |
||||
method: 'get' |
method: 'get' |
||||
}) |
}) |
||||
} |
} |
||||
|
// export function regionPoints(code) {
|
||||
|
// let res = {'OUT3': '1234', 'OUT2': '2234', 'N1': '123', 'N2': '223'}
|
||||
|
// return new Promise((resolve, reject) => {
|
||||
|
// resolve(res)
|
||||
|
// })
|
||||
|
// }
|
||||
|
|
||||
export function importExcel(id) { |
// 根据工序查询订单
|
||||
|
export function regionOrder(code) { |
||||
return request({ |
return request({ |
||||
url: 'api/produceTask/importExcel/' + id, |
url: 'api/fab/regionOrder?regionCode=' + code, |
||||
method: 'get' |
method: 'get' |
||||
}) |
}) |
||||
} |
} |
||||
|
// export function regionOrder(code) {
|
||||
|
// const res = {
|
||||
|
// content: [{ order_code: '800034202869', region_code: '111-07', material_id: 'A7E0019008760_00', material_type: 'S39_SA01', custom: 'BBC支撑板后上', material_qty: '120', plan_date: '2024/8/11' }]
|
||||
|
// }
|
||||
|
// return new Promise((resolve, reject) => {
|
||||
|
// resolve(res)
|
||||
|
// })
|
||||
|
// }
|
||||
|
|
||||
export function queryTask(device_code) { |
// 根据工单查询匹配库存
|
||||
debugger |
export function getMaterListByOrder(code, order) { |
||||
return request({ |
return request({ |
||||
url: 'api/produceTask/queryTask/' + device_code, |
url: 'api/fab/getMaterListByOrder?regionCode=' + code + '&?order=' + order, |
||||
method: 'get' |
method: 'get' |
||||
}) |
}) |
||||
} |
} |
||||
|
// export function getMaterListByOrder(code, order) {
|
||||
|
// let res = {
|
||||
|
// content: [{ point_code: 'XXS23023012334', region_code: '800034202869', point_type: '120', point_status: '2' }]
|
||||
|
// }
|
||||
|
// return new Promise((resolve, reject) => {
|
||||
|
// resolve(res)
|
||||
|
// })
|
||||
|
// }
|
||||
|
|
||||
export function querAllTask() { |
// 呼叫库存物料
|
||||
|
export function callMater(data) { |
||||
return request({ |
return request({ |
||||
url: 'api/produceTask/querAllTask', |
url: 'api/fab/callMater', |
||||
method: 'get' |
method: 'post', |
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function callMaterial(data) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/callMaterial', |
|
||||
method: 'put', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function finish(data) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/finish', |
|
||||
method: 'put', |
|
||||
data |
data |
||||
}) |
}) |
||||
} |
} |
||||
|
|
||||
export function materialBack(data) { |
// 呼叫空料框
|
||||
|
export function callEmp(data) { |
||||
return request({ |
return request({ |
||||
url: 'api/produceTask/materialBack', |
url: 'api/fab/callEmp', |
||||
method: 'put', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
export function emptyVehicleBack(data) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/emptyVehicleBack', |
|
||||
method: 'post', |
method: 'post', |
||||
data |
data |
||||
}) |
}) |
||||
} |
} |
||||
|
|
||||
export function queryIdDevice(id) { |
// 工序下料
|
||||
|
export function sendMater(data) { |
||||
return request({ |
return request({ |
||||
url: 'api/produceTask/' + id, |
url: 'api/fab/sendMater', |
||||
method: 'get' |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function popSeek(code) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/popSeek/' + code, |
|
||||
method: 'get' |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function queryOne() { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/queryOne', |
|
||||
method: 'get' |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function saveOrder(data) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/saveOrder', |
|
||||
method: 'put', |
|
||||
data: data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function forceFinish(data) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/forceFinish', |
|
||||
method: 'post', |
|
||||
data: data |
|
||||
}) |
|
||||
} |
|
||||
export function queryIvtByPscn(data) { |
|
||||
return request({ |
|
||||
url: 'api/produceTask/queryIvtByPscn', |
|
||||
method: 'post', |
method: 'post', |
||||
data: data |
data |
||||
}) |
}) |
||||
} |
} |
||||
|
|
||||
export const machine = () => { |
|
||||
const res = [ |
|
||||
{ value: '111-02', label: 'TP5000冲床加工' }, |
|
||||
{ value: '111 03', label: '警平' }, |
|
||||
{ value: '111-04', label: '激光切闻' }, |
|
||||
{ value: '111-05', label: '复合机' }, |
|
||||
{ value: '111-06', label: 'Amada 801冲床' }, |
|
||||
{ value: '111-07', label: 'TruBend 7038' }, |
|
||||
{ value: '111-08', label: 'TruBend 5170' }, |
|
||||
{ value: '111 09', label: 'TruBend Cell 7000' }, |
|
||||
{ value: '111-10', label: 'LAG Robot Bending Cell' }, |
|
||||
{ value: '111-12', label: '气保焊' }, |
|
||||
{ value: '111-13', label: '姆柱焊、点焊' }, |
|
||||
{ value: '111-14', label: '林肯焊接机器人' }, |
|
||||
{ value: '111-15', label: '铜冲机' }, |
|
||||
{ value: '111-16', label: '铜弯机' }, |
|
||||
{ value: '111-22', label: '钳床' }, |
|
||||
{ value: '111-23', label: '压铆机' }, |
|
||||
{ value: '111-24', label: '斯图加特焊接机器人' } |
|
||||
] |
|
||||
return res |
|
||||
} |
|
||||
|
|
||||
export const n1list = () => { |
|
||||
const res = [ |
|
||||
{ order: '800034202869', work_code: '111-07', material_code: 'A7E0019008760_00', material_type: 'S39_SA01', material_name: 'BBC支撑板后上', qty: '120', plan_date: '2024/8/11' } |
|
||||
] |
|
||||
return res |
|
||||
} |
|
||||
|
|
||||
export const n1list2 = () => { |
|
||||
const res = [ |
|
||||
{ vehicle_code: 'XXS23023012334', order: '800034202869', qty: '120', point_code: 'ZW01-03-02' } |
|
||||
] |
|
||||
return res |
|
||||
} |
|
||||
|
|
||||
export default { |
export default { |
||||
add, edit, del, getDevice, getMaterial, |
regionList, regionPoints, regionOrder, getMaterListByOrder, callMater, callEmp, sendMater |
||||
getProduceStatus, importExcel, queryTask, querAllTask, |
|
||||
callMaterial, finish, queryIdDevice, popSeek, queryOne, saveOrder, forceFinish, materialBack, queryIvtByPscn, emptyVehicleBack |
|
||||
} |
} |
||||
|
Loading…
Reference in new issue