缓存线盘点-设满箱和空箱、删除

This commit is contained in:
2023-03-27 19:52:13 +08:00
parent 015ed75171
commit 6cc9ac75fe
4 changed files with 46 additions and 44 deletions

View File

@@ -195,6 +195,14 @@ public class CacheLineHandController{
return RestBusinessTemplate.execute(() -> cacheLineHandService.setEmptyBox(param));
}
@PostMapping("/deleteBox")
@Log("删除箱子")
@ApiOperation("删除箱子")
public CommonResult<Void> deleteBox(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [设置空框] 接口被请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> cacheLineHandService.deleteBox(param));
}
@PostMapping("/agvInBoxExceptionQuery")
@Log("AGV入箱异常-查询")
@ApiOperation("AGV入箱异常-查询")

View File

@@ -273,4 +273,10 @@ public interface CacheLineHandService{
* @return
*/
JSONArray getProductArea();
/**
* 删除箱子
* @param param
*/
void deleteBox(JSONObject param);
}

View File

@@ -2,6 +2,7 @@ package org.nl.wms.pda.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -259,16 +260,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
public void setfullBox(JSONObject param) {
//物料ID
String semimanufactures_uuid = param.getString("material_uuid");
// 缓存线位置编码
String position_code = param.getString("position_code");
// 料箱码
String vehicle_code = param.getString("vehicle_code");
// 层数
String layer_num = param.getString("layer_num");
// 顺序号
String seat_order_num = param.getString("seat_order_num");
//工序
String workprocedure_code = param.getString("workprocedure_uuid");
String workprocedure_code = param.getString("workprocedure_code");
// 缓存线
String wcsdevice_code = param.getString("wcsdevice_code");
String cacheLine_code = param.getString("cacheLine_code");
String weight = param.getString("weight");
String quantity = param.getString("quantity");
if(StringUtils.isEmpty(quantity) || param.getInteger("quantity") <= 0) {
@@ -276,30 +275,20 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
//缓存线位置表
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
JSONObject vehiobj = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
// 缓存线位置
JSONObject vehiobj = positionTab.query("position_code = '" + position_code + "'").uniqueResult(0);
if(vehiobj == null) {
throw new BadRequestException("位置不存在,设置有误!");
}
// 判断物料去的缓存线是否正确
//物料分类表
WQLObject corrTab = WQLObject.getWQLObject("md_pb_classstandard");
//工序表
WQLObject wpTab = WQLObject.getWQLObject("pdm_bi_workprocedure");
//物料表
WQLObject meTab = WQLObject.getWQLObject("md_me_materialbase");
// 查询工序信息
JSONObject wpObj = wpTab.query("workprocedure_code = '" + workprocedure_code + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(wpObj)) throw new BadRequestException("工序查询错误,请检查工序");
JSONObject meObj = meTab.query("material_id = '" + semimanufactures_uuid + "'").uniqueResult(0);
//查找物料分类信息
String materialprocess_series = corrTab.query("class_id = '" + meObj.getString("material_type_id") + "'").uniqueResult(0).getString("class_name");
//TOFIX
// AgvTwoInst inst = new AgvTwoInst();
// String cachelineCode2 = inst.getCachelineCode(materialprocess_series, wpObj.getString("workprocedure_code"));
// 1.检查该缓存线位置是否存放非法物料
// if(!wcsdevice_code.equals(cachelineCode2)) {
// String materialprocess_seriesname = WQLObject.getWQLObject("PF_PB_SysDicInfo").query("sysdic_type = 'IF_WCS_DEVICESERIES' and sysdic_code = '" + materialprocess_series + "'").uniqueResult(0).getString("sysdic_name");
// throw new BadRequestException("该缓存线【" + wcsdevice_code + "】不能存放【" + materialprocess_seriesname + "】物料,操作失败!");
// }
if (ObjectUtil.isEmpty(meObj)) throw new BadRequestException("物料查询错误,请检查物料");
vehiobj.put("vehicle_code", vehicle_code);
//2.缓存线位置通过扫码绑定料箱条码
positionTab.update(vehiobj);
@@ -311,7 +300,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
HashMap<String,String> json = new HashMap<>();
json.put("vehmaterial_id", IdUtil.getStringId());
json.put("vehicle_code", vehicle_code);
json.put("cacheLine_code", wcsdevice_code);
json.put("cacheLine_code", cacheLine_code);
json.put("material_uuid", meObj.getString("material_id"));
json.put("material_code", meObj.getString("material_code"));
json.put("material_spec", meObj.getString("material_spec"));
@@ -321,7 +310,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("workprocedure_code", wpObj.getString("workprocedure_code"));
json.put("workprocedure_name", wpObj.getString("workprocedure_name"));
//有箱有料
json.put("vehicle_status", "02");
json.put("vehicle_status", StatusEnum.CACHE_VEL_FULL.getCode());
json.put("create_time", DateUtil.now());
//4.重新新建该缓存线位置上的料箱为满箱及所属工序,生产区域等信息
ivtTab.insert(json);
@@ -330,32 +319,24 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
@Override
@Transactional(rollbackFor = Exception.class)
public void setEmptyBox(JSONObject param) {
// 层数
String layer_num = param.getString("layer_num");
// 顺序号
String seat_order_num = param.getString("seat_order_num");
// 缓存线位置编码
String position_code = param.getString("position_code");
// 载具条码
String vehicle_code = param.getString("vehicle_code");
// 缓存线编码
String wcsdevice_code = param.getString("wcsdevice_code");
// 缓存线载具物料表
WQLObject ivtTab = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
// 缓存线位置表
WQLObject positionTab = WQLObject.getWQLObject("sch_cacheline_position");
JSONObject vehiobj = positionTab.query("order_no = " + seat_order_num + " and layer_num = " + layer_num + " and cacheLine_code like '%" + wcsdevice_code + "%'").uniqueResult(0);
JSONObject vehiobj = positionTab.query("position_code = '" + position_code + "'").uniqueResult(0);
if(vehiobj == null) {
throw new BadRequestException("位置不存在,设置有误!");
}
//1.缓存线位置通过扫码绑定料箱条码
vehiobj.put("vehicle_code", vehicle_code);
positionTab.update(vehiobj);
//2.先删除料箱的所有关联信息,包括物料,工序,生产区域
ivtTab.delete("vehicle_code = '" + vehicle_code + "'");
JSONObject json = new JSONObject();
json.put("vehmaterial_id", IdUtil.getStringId());
json.put("vehicle_code", vehicle_code);
json.put("cacheLine_code", wcsdevice_code);
json.put("vehicle_status", "01");
//2.清空
JSONObject json = ivtTab.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
json.put("vehicle_status", StatusEnum.CACHE_VEL_EMT.getCode());
json.put("material_uuid", "");
json.put("material_code", "");
json.put("material_spec", "");
@@ -364,9 +345,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json.put("quantity", "0");
json.put("workprocedure_code", "");
json.put("workprocedure_name", "");
json.put("create_time", DateUtil.now());
// 3.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
ivtTab.insert(json);
json.put("update_time", DateUtil.now());
ivtTab.update(json);
}
@Override
@@ -770,7 +750,6 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
public JSONArray getCacheLine(JSONObject param) {
// 生产区域
String product_area = param.getString("product_area");
String where = "region_code = 'A1_HCX'";
JSONArray resultJSONArray = WQL.getWO("PDA_QUERY")
.addParamMap(MapOf.of("flag", "7", "product_area", product_area))
.process()
@@ -799,4 +778,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
.getResultJSONArray(0);
return res;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteBox(JSONObject param) {
WQLObject cvTab = WQLObject.getWQLObject("SCH_CacheLine_VehileMaterial");
String vehicleCode = param.getString("vehicle_code");
if (ObjectUtil.isNotEmpty(vehicleCode)) cvTab.delete("vehicle_code = '" + vehicleCode + "'");
}
}

View File

@@ -153,13 +153,13 @@
QUERY
SELECT
p.point_code as value,
p.point_name as text,
p.point_name as text
FROM
sch_base_point p
WHERE
p.region_code = 'A1_HCX'
OPTION 输入.product_area <> ""
cv.product_area = 输入.product_area
p.product_area = 输入.product_area
ENDOPTION
ORDER BY
p.point_code
@@ -171,6 +171,7 @@
SELECT
sch_cacheline_position.cacheLine_code,
sch_cacheline_position.position_code,
sch_cacheline_position.position_name,
sch_cacheline_position.vehicle_code,
sch_cacheline_position.layer_num,
sch_cacheline_position.positionOrder_no,
@@ -182,7 +183,7 @@
sch_cacheline_vehilematerial.material_spec,
sch_cacheline_vehilematerial.quantity,
sch_cacheline_vehilematerial.weight,
IF (length(sch_cacheline_position.vehicle_code) > 0, IFNULL( sch_cacheline_vehilematerial.vehicle_status, 4), 5) AS vehicle_status
IF(length(sch_cacheline_position.vehicle_code) > 0, IFNULL(sch_cacheline_vehilematerial.vehicle_status, 4), 5) AS vehicle_status
FROM
sch_cacheline_position
LEFT JOIN sch_cacheline_vehilematerial ON sch_cacheline_position.vehicle_code = sch_cacheline_vehilematerial.vehicle_code
@@ -203,7 +204,7 @@
QUERY
SELECT
d.value,
d.label as text,
d.label as text
FROM
sys_dict d
WHERE