代码修改

This commit is contained in:
ludj
2023-06-25 16:44:07 +08:00
parent 2c4820fff7
commit 60414655e7
11 changed files with 218 additions and 27 deletions

View File

@@ -42,7 +42,7 @@ public class KilnUtil {
KilnQueue.offer(vehicle_code);
//更新窑设备记录表
WQLObject recordTable = WQLObject.getWQLObject("pdm_bi_kilnrecord");
JSONObject vehicleObj = recordTable.query("vehicle_code='"+vehicle_code+"'and out_time=''").uniqueResult(0);
JSONObject vehicleObj = recordTable.query("vehicle_code='"+vehicle_code+"'and out_time=''","in_time desc").uniqueResult(0);
if (ObjectUtil.isEmpty(vehicleObj)) {
throw new BadRequestException("未找到信息");
}

View File

@@ -137,4 +137,14 @@ public class AcsToWmsController {
public ResponseEntity<Object> deleteTask(@RequestBody Map whereJson) {
return new ResponseEntity<>(acsToWmsService.deleteTask(whereJson), HttpStatus.OK);
}
@PostMapping("/switchStation")
//@Log("ACS机械手给WMS发送任务")
@ApiOperation("ACS分拣机械手切换工位")
public ResponseEntity<Object> switchStation(@RequestBody Map whereJson) {
return new ResponseEntity<>( acsToWmsService.switchStation(whereJson),HttpStatus.OK);
}
}

View File

@@ -130,4 +130,12 @@ public interface AcsToWmsService {
*/
Map<String, Object> deleteTask(Map jsonObject);
/**
* 切盘操作
* @return Map<String, Object>
*/
Map<String, Object> switchStation(Map jsonObject);
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -110,6 +111,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
jsonObject.put("start_point_code", device_code);
jsonObject.put("create_mode", "01");
jsonObject.put("group_id", group_id);
// 假如是半托缓存的几个位置,强制去包装
String area_type = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0).getString("area_type");
if (StrUtil.equals(area_type, AreaEnum.BTHCQ.getCode())) {
@@ -151,6 +154,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (StrUtil.isEmpty(vehicle_code)) {
throw new BadRequestException("载具不能为空!");
}
KilnUtil.outKiln(vehicle_code);
JSONObject vehicleObj = WQLObject.getWQLObject("st_buss_vehiclegroup").query("vehicle_code='" + vehicle_code + "'", "create_time desc").uniqueResult(0);
if (ObjectUtil.isEmpty(vehicleObj)) {
throw new BadRequestException("为找到载具号为'" + vehicle_code + "'的组盘信息!");
@@ -995,6 +999,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return result;
}
public static JSONObject getProduceInfoByCode(String code) {
// 根据 设备点位去找生产任务信息
// 1 根据点位去找设备,去找对应的设备信息
@@ -1008,4 +1013,119 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
return productTaskObj;
}
@Transactional
@Override
public Map<String, Object> switchStation(Map jsonObject) {
log.debug("ACS的switchStation请求参数为:" + jsonObject);
//载具点位记录表【SCH_BASE_vehiclePointRecord】
WQLObject recordTab = WQLObject.getWQLObject("SCH_BASE_vehiclePointRecord");
//机械手编码
String point_code = MapUtil.getStr(jsonObject, "device_code");
//当前码垛位
String present_palleting_station = MapUtil.getStr(jsonObject, "present_palleting_station");
//当前拆垛位
String present_stripping_station = MapUtil.getStr(jsonObject, "present_stripping_station");
//上一个拆剁位,=0 时表示未开始抓取
String last_stripping_station = MapUtil.getStr(jsonObject, "last_stripping_station"); //上一个拆剁位,=0 时表示未开始抓取
//上一次码垛位
String last_palleting_station = MapUtil.getStr(jsonObject, "last_palleting_station");
//FJJXS1 拆 FJJXS2 码垛位 FJJXS3 拆码垛
//托盘物料组盘表【st_buss_vehiclegroup】
WQLObject groupTab = WQLObject.getWQLObject("st_buss_vehiclegroup");
//点位基础表【SCH_BASE_Point】
WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point");
//更新上一个拆剁位或者码垛位结束时间
if (!StrUtil.equals("0", last_stripping_station) && StrUtil.isNotEmpty(last_stripping_station)) {
JSONObject point = pointTab.query("point_code = '" + last_stripping_station + "'").uniqueResult(0);
JSONObject p1 = recordTab.query("is_delete = '0' and vehicle_code = '" + point.getString("vehicle_code") + "' and (end_time = '' or end_time is null)").uniqueResult(0);
if (ObjectUtil.isNotEmpty(p1)) {
p1.put("end_time", DateUtil.now());
recordTab.update(p1);
}
}
//更新上一个拆剁位或者码垛位结束时间
if (!StrUtil.equals("0", last_palleting_station) && StrUtil.isNotEmpty(last_palleting_station)) {
JSONObject point = pointTab.query("point_code = '" + last_palleting_station + "'").uniqueResult(0);
JSONObject p1 = recordTab.query("is_delete = '0' and vehicle_code = '" + point.getString("vehicle_code") + "' and (end_time = '' or end_time is null)").uniqueResult(0);
if (ObjectUtil.isNotEmpty(p1)) {
p1.put("end_time", DateUtil.now());
recordTab.update(p1);
}
}
// 分拣机械手拆码垛(上料)位(钢托盘组盘信息)
if (StrUtil.equals("FJJXSSLW101", present_stripping_station) || StrUtil.equals("FJJXSSLW102", present_stripping_station) || StrUtil.equals("FJJXSSLW301", present_stripping_station) || StrUtil.equals("FJJXSSLW302", present_stripping_station)) {
JSONObject point = pointTab.query("point_code = '" + present_stripping_station + "'").uniqueResult(0);
JSONObject param = new JSONObject();
param.put("record_id", IdUtil.getSnowflake(1, 1).nextId());
param.put("point_code", present_stripping_station);
param.put("vehicle_code", point.getString("vehicle_code"));
//根据载具号获取到组盘信息
JSONObject groupObj = groupTab.query("vehicle_code = '" + point.getString("vehicle_code") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(groupObj)) {
param.put("material_move_id", groupObj.getString("material_move_id"));
param.put("producetask_id", groupObj.getString("producetask_id"));
}
param.put("start_time", DateUtil.now());
recordTab.insert(param);
//根据上料位钢托盘物料信息更新下料位木托盘信息
if (StrUtil.equals("FJJXSSLW101", present_stripping_station) || StrUtil.equals("FJJXSSLW102", present_stripping_station)) {
JSONObject record1 = recordTab.query("is_delete='0' and (point_code='FJJXSXLW201' or point_code='FJJXSXLW202') and (end_time = '' or end_time is null)").uniqueResult(0);
if (ObjectUtil.isNotEmpty(record1)) {
record1.put("source_record_id", param.getString("record_id"));
recordTab.update(record1);
}
} else {
JSONObject record1 = recordTab.query("is_delete='0' and (point_code='FJJXSXLW301' or point_code='FJJXSXLW301') and (end_time = '' or end_time is null)").uniqueResult(0);
if (ObjectUtil.isNotEmpty(record1)) {
record1.put("source_record_id", param.getString("record_id"));
recordTab.update(record1);
}
}
}
//分拣机械手下料(码垛)位
if (StrUtil.equals("FJJXSXLW201", present_palleting_station) || StrUtil.equals("FJJXSXLW202", present_palleting_station) || StrUtil.equals("FJJXSXLW301", present_palleting_station) || StrUtil.equals("FJJXSXLW302", present_palleting_station)) {
//根据上料位钢托盘物料信息更新下料位木托盘信息
String source_record_id = "";
if (StrUtil.equals("FJJXSXLW201", present_palleting_station) || StrUtil.equals("FJJXSXLW202", present_palleting_station)) {
JSONObject record1 = recordTab.query("is_delete='0' and (point_code='FJJXSSLW101' or point_code='FJJXSSLW102') and (end_time = '' or end_time is null)").uniqueResult(0);
if (ObjectUtil.isNotEmpty(record1)) source_record_id = record1.getString("record_id");
} else {
JSONObject record1 = recordTab.query("is_delete='0' and (point_code='FJJXSSLW301' or point_code='FJJXSSLW302') and (end_time = '' or end_time is null)").uniqueResult(0);
if (ObjectUtil.isNotEmpty(record1)) source_record_id = record1.getString("record_id");
}
JSONObject point = pointTab.query("point_code = '" + present_palleting_station + "'").uniqueResult(0);
JSONObject param = new JSONObject();
param.put("record_id", IdUtil.getSnowflake(1, 1).nextId());
param.put("source_record_id", source_record_id);
param.put("point_code", present_palleting_station);
param.put("vehicle_code", point.getString("vehicle_code"));
param.put("start_time", DateUtil.now());
recordTab.insert(param);
}
JSONObject result = new JSONObject();
result.put("status", HttpStatus.OK.value());
result.put("message", "机械手切换申请成功!");
result.put("data", new JSONObject());
return result;
}
}

View File

@@ -18,6 +18,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -571,10 +572,16 @@ public class WmsToJnServiceImpl implements WmsToJnService {
.addParam("vehicle_code", vehicle_code)
.process()
.uniqueResult(0);
Date date = DateUtil.date();
//产品入库批次号(唯一)
String pc = DateUtil.format(date, "yyyyMMddHHmmss");
mstObj.put("PC",pc);
mstObj.put("RECORD_TIME",DateUtil.now());
JSONArray dtlarr =
WQL.getWO("WMSTOJN_001")
.addParam("flag", "8")
.addParam("record_id", mstObj.getString("record_id"))
.addParam("vehicle_code", vehicle_code)
.process()
.getResultJSONArray(0);
mstObj.put("DETAILS", dtlarr);

View File

@@ -84,6 +84,7 @@
OPTION 输入.vehicle_code <> ""
kiln.vehicle_code = 输入.vehicle_code
ENDOPTION
ORDER BY in_time desc
ENDSELECT
ENDQUERY
ENDIF
@@ -170,20 +171,16 @@ IF 输入.flag = "5"
IF 输入.flag = "8"
QUERY
SELECT
dtl.material_move_id AS ID,
task.ext_shoporder_no AS SHOPORDERNO,
dtl.vehicle_code AS STOCKNO,
"0" AS QTY
FROM
st_buss_vehiclerelarecordtl dtl
LEFT JOIN st_buss_vehicleRelaRecord mst ON mst.record_id = dtl.record_id
LEFT JOIN pdm_mg_producetask task ON task.producetask_id = dtl.producetask_id
where
1=1
OPTION 输入.record_id <> ""
record.record_id = 输入.record_id
ENDOPTION
SELECT
r.material_move_id as ID ,
t.ext_shoporder_no as SHOPORDERNO,
r.vehicle_code as STOCKNO,
0 as QTY
FROM
SCH_BASE_vehiclePointRecord r
LEFT JOIN pdm_mg_producetask t on r.producetask_id=t.producetask_id
WHERE
record_id IN ( SELECT source_record_id FROM SCH_BASE_vehiclePointRecord WHERE vehicle_code = 输入.vehicle_code )
ENDSELECT
ENDQUERY
ENDIF
@@ -193,19 +190,17 @@ IF 输入.flag = "8"
IF 输入.flag = "9"
QUERY
SELECT
material.material_code AS ITEMCODE,
mst.pc AS pc,
mst.vehicle_code AS PROD_STOCKNO,
mst.packing_time AS RECORD_TIME,
vehiclegroup.qty AS TOTALQTY
'' as SHOPORDERNO,
v.material_code as ITEMCODE,
r.vehicle_code as PROD_STOCKNO,
v.qty as TOTALQTY
FROM
st_buss_vehicleRelaRecord mst
LEFT JOIN st_buss_vehiclegroup vehiclegroup ON vehiclegroup.vehicle_code = mst.vehicle_code
LEFT JOIN md_me_material material ON material.material_id = mst.material_id
SCH_BASE_vehiclePointRecord r
LEFT JOIN st_buss_vehiclegroup v ON v.vehicle_code = r.vehicle_code
where
1=1
OPTION 输入.vehicle_code <> ""
mst.vehicle_code = 输入.vehicle_code
r.vehicle_code = 输入.vehicle_code
ENDOPTION
ENDSELECT
ENDQUERY

View File

@@ -107,6 +107,8 @@ public class FmjToPackIngTask extends AbstractAcsTask {
}
param.put("struct_id", startPointDto.getPoint_id());
ivtService.addIvtFlow(param, IvtChangeTypeEnum.SUB_IVT);
//调用mes接口
HashMap map = new HashMap();
map.put("vehicle_code",jsonTask.getString("vehicle_code"));
@@ -143,6 +145,8 @@ public class FmjToPackIngTask extends AbstractAcsTask {
String pcsn = ivtObj.getString("pcsn");
String vehicle_code = ivtObj.getString("vehicle_code");
WQLObject taskTable = WQLObject.getWQLObject("SCH_BASE_Task");
if (StrUtil.isEmpty(start_point_code)) {
throw new BadRequestException("起点不能为空!");
}
@@ -218,6 +222,17 @@ public class FmjToPackIngTask extends AbstractAcsTask {
taskObj.put("create_time", DateUtil.now());
taskObj.put("is_delete", "0");
taskTable.insert(taskObj);
//结束木托和钢托绑定时间
// 载具点位记录表【SCH_BASE_vehiclePointRecord】
WQLObject recordTab = WQLObject.getWQLObject("SCH_BASE_vehiclePointRecord");
JSONObject record1 = recordTab.query("is_delete='0' and point_code = '"+start_point_code+"' and (end_time = '' or end_time is null)","start_time desc").uniqueResult(0);
if (ObjectUtil.isNotEmpty(record1)){
record1.put("end_time", DateUtil.now());
recordTab.update(record1);
}
return task_id;
}

View File

@@ -158,6 +158,15 @@ public class SendEmptyVehicleTask extends AbstractAcsTask {
taskObj.put("create_time", DateUtil.now());
taskObj.put("is_delete", "0");
taskTable.insert(taskObj);
//结束木托和钢托绑定时间
// 载具点位记录表【SCH_BASE_vehiclePointRecord】
WQLObject recordTab = WQLObject.getWQLObject("SCH_BASE_vehiclePointRecord");
JSONObject record1 = recordTab.query("is_delete='0' and point_code = '"+start_point_code+"' and (end_time = '' or end_time is null)","start_time desc").uniqueResult(0);
if (ObjectUtil.isNotEmpty(record1)){
record1.put("end_time", DateUtil.now());
recordTab.update(record1);
}
return task_id;
}

View File

@@ -260,6 +260,7 @@ public class SendMaterialTask extends AbstractAcsTask {
qty_unit_id = BussConstant.YZ_IN_QTY_UNIT_ID;
bill_type = BillTypeEnum.SZRK.getCode();
endArea_type = AreaEnum.CYHCHJ.getCode();
break;
// 分拣工序
case FJGX:
@@ -357,6 +358,15 @@ public class SendMaterialTask extends AbstractAcsTask {
groupTable.update(groupInfo);
}
}
//结束木托和钢托绑定时间
// 载具点位记录表【SCH_BASE_vehiclePointRecord】
WQLObject recordTab = WQLObject.getWQLObject("SCH_BASE_vehiclePointRecord");
JSONObject record1 = recordTab.query("is_delete='0' and point_code = '"+start_point_code+"' and (end_time = '' or end_time is null)","start_time desc").uniqueResult(0);
if (ObjectUtil.isNotEmpty(record1)){
record1.put("end_time", DateUtil.now());
recordTab.update(record1);
}
return task_id;
}

View File

@@ -60,8 +60,15 @@ public class ToPackIngTask extends AbstractAcsTask {
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
// 将起点的载具清除
JSONObject startPointObj = pointTab.query("point_code='" + jsonTask.getString("start_point_code") + "'").uniqueResult(0);
// 假如起点是码垛位置则不需要更新
startPointObj.put("lock_type", "00");
startPointObj.put("point_status", "00");
startPointObj.put("vehicle_code", "");
startPointObj.put("update_time", DateUtil.now());
pointTab.update(startPointObj);
/* // 假如起点是码垛位置则不需要更新
if (!(StrUtil.equals(jsonTask.getString("start_point_code"), "FJJXSXLW201")
|| StrUtil.equals(jsonTask.getString("start_point_code"), "FJJXSXLW202")
|| StrUtil.equals(jsonTask.getString("start_point_code"), "FJJXSXLW301")
|| StrUtil.equals(jsonTask.getString("start_point_code"), "FJJXSXLW302"))) {
@@ -71,7 +78,17 @@ public class ToPackIngTask extends AbstractAcsTask {
startPointObj.put("vehicle_code", "");
startPointObj.put("update_time", DateUtil.now());
pointTab.update(startPointObj);
}*/
//结束木托和钢托绑定时间
// 载具点位记录表【SCH_BASE_vehiclePointRecord】
WQLObject recordTab = WQLObject.getWQLObject("SCH_BASE_vehiclePointRecord");
JSONObject record1 = recordTab.query("is_delete='0' and point_code = '"+jsonTask.getString("start_point_code")+"' and (end_time = '' or end_time is null) and vehicle_code = '"+jsonTask.getString("vehicle_code")+"'","start_time desc").uniqueResult(0);
if (ObjectUtil.isNotEmpty(record1)){
record1.put("end_time", DateUtil.now());
recordTab.update(record1);
}
// 调用mes接口
HashMap map = new HashMap();
map.put("vehicle_code", jsonTask.getString("vehicle_code"));
@@ -82,7 +99,7 @@ public class ToPackIngTask extends AbstractAcsTask {
WQLObject group_Table = WQLObject.getWQLObject("st_buss_vehiclegroup");
JSONObject groupObj = group_Table.query("vehicle_code='" + jsonTask.getString("vehicle_code") + "' and is_delete='0'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(groupObj)) {
groupObj.put("is_delete", "0");
groupObj.put("is_delete", "1");
group_Table.update(groupObj);
}
}