代码更新

This commit is contained in:
lyd
2022-10-26 16:52:50 +08:00
parent 1b7a2db6ea
commit af8bf152f7
13 changed files with 191 additions and 123 deletions

View File

@@ -233,6 +233,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
param.put("io_type", "2");
param.put("vehicle_type", vehicle_type);
param.put("vehicle_code", vehicle_code);
param.put("material_num", material_num);
// 创建任务
YqxCallMaterialTask taskBean = SpringContextHolder.getBean(YqxCallMaterialTask.class);
String task_id = taskBean.createTask(param);

View File

@@ -104,4 +104,12 @@ public class PointController {
pointService.changeUsed(jsonObject);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("锁定与解锁")
@PostMapping("/changeLock")
@ApiOperation("锁定与解锁")
public ResponseEntity<Object> changeLock(@RequestBody JSONObject jsonObject) {
pointService.changeLock(jsonObject);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

View File

@@ -90,4 +90,10 @@ public interface PointService {
* @param jsonObject
*/
void changeUsed(JSONObject jsonObject);
/**
* 改变锁定类型
* @param jsonObject
*/
void changeLock(JSONObject jsonObject);
}

View File

@@ -49,6 +49,9 @@ public class PointDto implements Serializable {
/** MES设备编码 */
private String mes_device_code;
/** 物料标识 */
private Long material_id;
/** 允许的载具类型 */
private String can_vehicle_type;
@@ -108,4 +111,4 @@ public class PointDto implements Serializable {
/** 修改时间 */
private String update_time;
}
}

View File

@@ -153,6 +153,14 @@ public class PointServiceImpl implements PointService {
throw new BadRequestException("被删除或无权限,操作失败!");
}
String pointStatus = dto.getPoint_status();
if (ObjectUtil.isNotEmpty(pointStatus) && pointStatus.equals("1")) {
entity.setMaterial_id(null);
entity.setVehicle_type(null);
entity.setVehicle_code(null);
entity.setVehicle_qty(null);
}
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
@@ -275,6 +283,24 @@ public class PointServiceImpl implements PointService {
}
}
/**
* 改变锁定类型
*
* @param jsonObject
*/
@Override
public void changeLock(JSONObject jsonObject) {
WQLObject wo = WQLObject.getWQLObject("sch_base_Point");
JSONArray data = jsonObject.getJSONArray("data");
String lock = jsonObject.getString("lock_type");
for ( int i = 0; i < data.size(); i++ ) {
JSONObject object = data.getJSONObject(i);
if (lock.equals("1")) object.put("lock_type", 1);
else object.put("lock_type", 2);
wo.update(object);
}
}
//根据重量返回最大的 级数
public String getLoadSeriesByqty(Double qty) {
JSONArray dictArr = WQLObject.getWQLObject("sys_dict_detail").query("dict_id ='108'", "label").getResultJSONArray(0);

View File

@@ -43,7 +43,8 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
String task_id = task.getString("task_id");
JSONObject taskObj = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
// 物料点
JSONObject material_point = pointTab.query("point_code = '" + taskObj.getString("point_code1") + "'").uniqueResult(0);
//任务取消
if (StrUtil.equals(status, "0")) {
// 取消删除任务
@@ -61,6 +62,11 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode());
taskObj.put("remark", "已取消");
taskTab.update(taskObj);
// 点位解锁 并设置空位
material_point.put("lock_type", "1");
material_point.put("point_status", "1");
pointTab.update(material_point);
}
if ("1".equals(status)) {
@@ -77,18 +83,7 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
String point_code3 = taskObj.getString("point_code3");
if (ObjectUtil.isEmpty(point_code3)) point_code3 = taskObj.getString("point_code2"); // 终点
JSONObject point3Obj = pointTab.query("point_code = '" + point_code3 + "'").uniqueResult(0);
JSONObject requestObj = task.getJSONObject("request_param");
//工单标识
String workorder_id = requestObj.getString("material_info_id");
//生产工单表【PDM_BD_WorkOrder】
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONObject workorderObj = workOrderTab.query("workorder_id", workorder_id).uniqueResult(0);
JSONObject point3 = pointTab.query("point_code = '" + point_code3 + "'").uniqueResult(0);
//区域出入表【st_ivt_regionIO】
WQLObject regionIoTab = WQLObject.getWQLObject("st_ivt_regionIO");
@@ -97,15 +92,15 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
regionIoObj.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE"));
regionIoObj.put("buss_date", DateUtil.today());
regionIoObj.put("io_type", "2");
regionIoObj.put("region_id", point3.getString("region_id"));
regionIoObj.put("region_code", point3.getString("region_code"));
regionIoObj.put("region_name", point3.getString("region_name"));
regionIoObj.put("region_id", material_point.getString("region_id"));
regionIoObj.put("region_code", material_point.getString("region_code"));
regionIoObj.put("region_name", material_point.getString("region_name"));
regionIoObj.put("material_id", taskObj.getString("material_id"));
regionIoObj.put("vehicle_code", taskObj.getString("vehicle_code"));
regionIoObj.put("qty", requestObj.getString("qty"));
regionIoObj.put("qty", requestObj.getString("material_num"));
regionIoObj.put("bill_status", "3");
regionIoObj.put("start_point_code", taskObj.getString("point_code1"));
regionIoObj.put("end_point_code", taskObj.getString("point_code3"));
regionIoObj.put("end_point_code", taskObj.getString("point_code2"));
regionIoObj.put("create_mode", "2");
regionIoObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd"));
regionIoObj.put("create_id", SecurityUtils.getCurrentUserId());
@@ -113,14 +108,12 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
regionIoObj.put("create_time", DateUtil.now());
regionIoTab.insert(regionIoObj);
//完成后将仓位库存删掉
//仓位库存表【ST_IVT_StructIvt】
WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt");
ivtTab.delete("point_code = '" + taskObj.getString("point_code1") + "'");
// 点位解锁 并设置空位
JSONObject material_point = pointTab.query("point_code = '" + taskObj.getString("point_code1") + "'").uniqueResult(0);
material_point.put("lock_type", "1");
material_point.put("point_status", "1");
pointTab.update(material_point);
@@ -148,33 +141,17 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
//1、根据物料id查找养生A区物料点
JSONObject json1 = WQL.getWO("QSCH_yqxCallMAterial_01").addParamMap(param1).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(json1)) {
Integer block_num = json1.getInteger("block_num");
Integer row_num = json1.getInteger("row_num");
Integer col_num = json1.getInteger("col_num");
// 拿到点位
JSONObject material_point = pointTab.query("point_id = '" + json1.getString("point_id") + "' and lock_type = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(material_point)) throw new BadRequestException("数据错误,请校验!");
// 物料点位上锁
material_point.put("lock_type", 2);
material_point.put("lock_type", "2");
pointTab.update(material_point);
//需要设置等待点
if (row_num < 9) {
//二楼终点追加任务taskObj的code2存叫料点
JSONObject jsonObject = pointTab.query("block_num = '" + block_num + "' and col_num = '" + col_num + "' and row_num ='9'").uniqueResult(0);
taskObj.put("point_code1", taskObj.getString("point_code2")); // 叫料点
taskObj.put("point_code2", jsonObject.getString("point_code")); // 等待点
taskObj.put("point_code3", material_point.getString("point_code")); // 物料点
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
taskObj.put("acs_task_type", "4");
taskObj.put("update_time", DateUtil.now());
} else if (row_num == 9) {
//二楼普通任务
taskObj.put("point_code1", material_point.getString("point_code"));
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
taskObj.put("acs_task_type", "2");
taskObj.put("update_time", DateUtil.now());
}
taskObj.put("point_code1", material_point.getString("point_code"));
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
taskObj.put("acs_task_type", "2");
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
} else {
taskObj.put("remark", "养生A区无所需物料");
@@ -220,14 +197,18 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
String point_code2 = whereJson.getString("point_code2");
String vehicle_type = whereJson.getString("vehicle_type");
String vehicle_code = whereJson.getString("vehicle_code");
String qty = whereJson.getString("qty");
String qty = whereJson.getString("material_num");
//生产工单表【PDM_BD_WorkOrder】
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
//任务表【SCH_BASE_Task】
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
//判断当前点是否有未完成的任务
JSONObject taskObj = taskTab.query("is_delete='0' and point_code2 = '" + point_code2 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code2 + "存在未完成的任务");
//点位基础表【SCH_BASE_Point】
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
String device_code = pointTab.query("point_code = '" + point_code2 + "'").uniqueResult(0).getString("device_code");
JSONObject workOrderObj = workOrderTab.query("device_code = '" + device_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
@@ -247,8 +228,6 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
.create_time(DateUtil.now())
.request_param(whereJson.toJSONString())
.build();
//任务表【SCH_BASE_Task】
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
taskTab.insert(json);
@@ -263,41 +242,17 @@ public class YqxCallMaterialTask extends AbstractAcsTask {
JSONObject taskObj = taskTab.query("task_id = '" + task_id + "' and is_delete = '0' and task_status <> " + TaskStatusEnum.FINISHED.getCode()).uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj))
this.updateTaskStatus(taskObj,"2");
else {
throw new BadRequestException("未找到该任务或者任务已完成");
}
}
@Override
public void cancel(String task_id) {
}
@Transactional(rollbackFor = Exception.class)
@Override
public String againApply(String task_id) {
/*
* 再次下发任务处理方法
* 涉及业务:入空载具、出空载具、入物料、出物料
*/
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
// WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表
JSONObject taskObj = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0);
// JSONObject jsonPoint2 = pointTab.query("point_code = '" + taskObj.getString("point_code1") + "'").uniqueResult(0); //
// code1是叫料点code3是物料点 -> code1是物料点code2是等待点code3是叫料点
String askPoint = taskObj.getString("point_code1");
taskObj.put("point_code1", taskObj.getString("point_code3"));
taskObj.put("point_code3", askPoint);
taskObj.put("remark", "二次申请货位");
taskObj.put("update_time", DateUtil.now());
taskTab.update(taskObj);
//养生A区发给ACS需要新的点位(2101-03-1----->21011-03-1)
String point_code =taskObj.getString("point_code3");
String newPoint = point_code.substring(0, 4) + "1" + point_code.substring(4, 9);
return newPoint;
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
JSONObject taskObj = taskTab.query("task_id = '" + task_id + "' and is_delete = '0' and task_status <> " + TaskStatusEnum.FINISHED.getCode()).uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj))
this.updateTaskStatus(taskObj,"0");
}
}

View File

@@ -65,7 +65,7 @@
OPTION 输入.vehicle_type <> ""
p.can_vehicle_type like 输入.vehicle_type
ENDOPTION
ORDER BY block_num,col_num
ORDER BY block_num,row_num desc,col_num
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -104,7 +104,7 @@ public class CpOutTask extends AbstractAcsTask {
point1Obj.put("lock_type", "1");
point1Obj.put("point_status", "1");
point2Obj.put("lock_type", "1");
point2Obj.put("point_status", "1");
point2Obj.put("point_status", "3");
pointTab.update(point1Obj);
pointTab.update(point2Obj);
}

View File

@@ -158,7 +158,7 @@ public class RegionIoServiceImpl implements RegionIoService {
// param.put("vehicle_type", vehicle_type);
param.put("iostorinv_id", dtoJSONObject.getString("iostorinv_id"));
CpOutTask taskBean = SpringContextHolder.getBean(CpOutTask.class);
String task_id = taskBean.createTask(param);
// String task_id = taskBean.createTask(param);
}
}

View File

@@ -244,11 +244,6 @@ public class StructivtServiceImpl implements StructivtService {
JSONObject structivts = jsonArray.getJSONObject(i);
// 如果是空位或者锁定就跳过
if (structivts.getString("lock_type").equals("2") || !structivts.getString("point_status").equals("3")) continue;
// 找到任務
JSONObject taskObj = taskTab.query("task_id = '" + structivts.getString("task_id") + "'").uniqueResult(0);
String end_point_code = taskObj.getString("point_code3");
if (ObjectUtil.isEmpty(end_point_code)) end_point_code = taskObj.getString("point_code2");
// 插入regionIO - 未锁定,有料位
JSONObject regionIoObj = new JSONObject();
regionIoObj.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
@@ -264,8 +259,6 @@ public class StructivtServiceImpl implements StructivtService {
regionIoObj.put("start_point_code", structivts.getString("point_code")); // 起点
String start_region_id = pointTab.query("point_code = '" + structivts.getString("point_code") + "'").uniqueResult(0).getString("region_id");
if (ObjectUtil.isNotEmpty(start_region_id))
// regionIoObj.put("start_region_id", start_region_id);
regionIoObj.put("task_id", structivts.getString("task_id"));
regionIoObj.put("region_id", structivts.getString("region_id"));
regionIoObj.put("region_code", structivts.getString("region_code"));
regionIoObj.put("region_name", structivts.getString("region_name"));

View File

@@ -48,48 +48,48 @@
IF 输入.flag = "1"
PAGEQUERY
SELECT
cppoint.*,
str.stockrecord_id,
str.pcsn,
str.material_id,
str.ivt_qty,
str.qty_unit_id,
str.instorage_time,
str.standing_time
str.*,
point.vehicle_type,
point.layer_num,
point.row_num,
point.col_num,
point.is_used,
point.lock_type,
point.point_status
FROM
st_ivt_structivt str
LEFT JOIN sch_base_point cppoint ON str.point_id = cppoint.point_id
LEFT JOIN sch_base_point point ON str.point_id = point.point_id
WHERE
cppoint.region_code IN 输入.region_code
point.region_code IN 输入.region_code
OPTION 输入.point_code <> ""
point_code LIKE 输入.point_code
point.point_code LIKE 输入.point_code
ENDOPTION
OPTION 输入.point_status <> ""
point_status = 输入.point_status
point.point_status = 输入.point_status
ENDOPTION
OPTION 输入.vehicle_type <> ""
vehicle_type = 输入.vehicle_type
point.vehicle_type = 输入.vehicle_type
ENDOPTION
OPTION 输入.layer_num <> ""
cppoint.layer_num = 输入.layer_num
point.layer_num = 输入.layer_num
ENDOPTION
OPTION 输入.row_num <> ""
row_num = 输入.row_num
point.row_num = 输入.row_num
ENDOPTION
OPTION 输入.col_num <> ""
col_num = 输入.col_num
point.col_num = 输入.col_num
ENDOPTION
OPTION 输入.lock_type <> ""
lock_type = 输入.lock_type
point.lock_type = 输入.lock_type
ENDOPTION
OPTION 输入.is_used <> ""
is_used = 输入.is_used
point.is_used = 输入.is_used
ENDOPTION
OPTION 输入.begin_time <> ""
instorage_time >= 输入.begin_time
str.instorage_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
instorage_time <= 输入.end_time
str.instorage_time <= 输入.end_time
ENDOPTION
ENDSELECT
ENDPAGEQUERY