Browse Source

fix:混碾,压制载具盅的新旧统一由载具表维护。创建工单时会确认时新料还是旧料

master
zhangzhiqiang 2 years ago
parent
commit
2b63bed458
  1. 23
      lms/nladmin-system/src/main/java/org/nl/config/ConfigParam.java
  2. 2
      lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java
  3. 2
      lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/wql/QSCH_hnCallEmptyVehicle_01.wql
  4. 61
      lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/YzjCallMaterialTask.java
  5. 4
      lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/wql/QSCH_yzjCallMaterial_01.wql
  6. 9
      lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YzjSendEmpVehicleTask.java

23
lms/nladmin-system/src/main/java/org/nl/config/ConfigParam.java

@ -0,0 +1,23 @@
package org.nl.config;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
/*
* @author ZZQ
* @Date 2022/11/16 4:32 下午
*/
@Configuration
public class ConfigParam {
//旧料盅叫料跟空盅入库都从公共点位回去
public static Map<String,String> YZJ_OLD_POINT = new HashMap<>();
@PostConstruct
public void initData(){
//数据库更新该配置数据YZJ_OLD_POINT
}
}

2
lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/HnCallEmptyVehicleTask.java

@ -166,7 +166,7 @@ public class HnCallEmptyVehicleTask extends AbstractAcsTask {
.point_code2(point_code2) .point_code2(point_code2)
.acs_task_type("2") .acs_task_type("2")
.vehicle_code(form.getString("vehicle_code")) .vehicle_code(form.getString("vehicle_code"))
.vehicle_type(workOrderObj.getString("vehicle_type")) .vehicle_type(workOrderObj.getString("vehicle_type"))//载具类型统一用载具表维护
.vehicle_qty(form.getIntValue("qty")) .vehicle_qty(form.getIntValue("qty"))
.task_group_id(org.nl.wms.util.IdUtil.getLongId()) .task_group_id(org.nl.wms.util.IdUtil.getLongId())
.handle_class(THIS_CLASS) .handle_class(THIS_CLASS)

2
lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callEmpty/wql/QSCH_hnCallEmptyVehicle_01.wql

@ -58,7 +58,7 @@ IF 输入.flag = "1"
p.region_code = 输入.region_code p.region_code = 输入.region_code
ENDOPTION ENDOPTION
OPTION 输入.is_new <> "" OPTION 输入.is_new <> ""
vehicle.is_new = 输入.is_new vehicle.vehicle_type = 输入.is_new
ENDOPTION ENDOPTION
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY

61
lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/YzjCallMaterialTask.java

@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.nl.config.ConfigParam;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
@ -116,29 +117,30 @@ public class YzjCallMaterialTask extends AbstractAcsTask {
JSONObject requestObj = task.getJSONObject("request_param"); JSONObject requestObj = task.getJSONObject("request_param");
//区域出入表【st_ivt_regionIO】 插入区域表:{
WQLObject regionIoTab = WQLObject.getWQLObject("st_ivt_regionIO"); //区域出入表【st_ivt_regionIO】
JSONObject regionIoObj = new JSONObject(); WQLObject regionIoTab = WQLObject.getWQLObject("st_ivt_regionIO");
regionIoObj.put("iostorinv_id", IdUtil.getLongId()); JSONObject regionIoObj = new JSONObject();
regionIoObj.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE")); regionIoObj.put("iostorinv_id", IdUtil.getLongId());
regionIoObj.put("buss_date", DateUtil.today()); regionIoObj.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE"));
regionIoObj.put("io_type", "2"); // 出库 regionIoObj.put("buss_date", DateUtil.today());
regionIoObj.put("region_id", material_point.getString("region_id")); regionIoObj.put("io_type", "2"); // 出库
regionIoObj.put("region_code", material_point.getString("region_code")); regionIoObj.put("region_id", material_point.getString("region_id"));
regionIoObj.put("region_name", material_point.getString("region_name")); regionIoObj.put("region_code", material_point.getString("region_code"));
regionIoObj.put("material_id", taskObj.getString("material_id")); regionIoObj.put("region_name", material_point.getString("region_name"));
regionIoObj.put("vehicle_code", taskObj.getString("vehicle_code")); regionIoObj.put("material_id", taskObj.getString("material_id"));
regionIoObj.put("qty", requestObj.getString("qty")); regionIoObj.put("vehicle_code", taskObj.getString("vehicle_code"));
regionIoObj.put("bill_status", "3"); regionIoObj.put("qty", requestObj.getString("qty"));
regionIoObj.put("start_point_code", taskObj.getString("point_code1")); regionIoObj.put("bill_status", "3");
regionIoObj.put("end_point_code", taskObj.getString("point_code2")); regionIoObj.put("start_point_code", taskObj.getString("point_code1"));
regionIoObj.put("create_mode", "2"); regionIoObj.put("end_point_code", taskObj.getString("point_code2"));
regionIoObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd")); regionIoObj.put("create_mode", "2");
regionIoObj.put("create_id", SecurityUtils.getCurrentUserId()); regionIoObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd"));
regionIoObj.put("create_name", SecurityUtils.getCurrentNickName()); regionIoObj.put("create_id", SecurityUtils.getCurrentUserId());
regionIoObj.put("create_time", DateUtil.now()); regionIoObj.put("create_name", SecurityUtils.getCurrentNickName());
regionIoTab.insert(regionIoObj); regionIoObj.put("create_time", DateUtil.now());
regionIoTab.insert(regionIoObj);
}
//完成后 //完成后
// 物料点位解锁 并设置空位 // 物料点位解锁 并设置空位
material_point.put("lock_type", "1"); material_point.put("lock_type", "1");
@ -179,7 +181,7 @@ public class YzjCallMaterialTask extends AbstractAcsTask {
String device_code = pointTab.query("point_code = '" + point_code2 + "'").uniqueResult(0).getString("device_code"); 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); 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("该设备当前未生产或者已删除"); if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
String oldMatSendPoint = YZJ_OLD_POINT.get(point_code2);//旧料盅终点 String oldMatSendPoint = ConfigParam.YZJ_OLD_POINT.get(point_code2);//旧料盅终点
if (StringUtils.isNotEmpty(oldMatSendPoint)){ if (StringUtils.isNotEmpty(oldMatSendPoint)){
point_code2=oldMatSendPoint; point_code2=oldMatSendPoint;
} }
@ -220,9 +222,17 @@ public class YzjCallMaterialTask extends AbstractAcsTask {
*/ */
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表 WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder"); // 工单表
JSONArray taskArr = taskTab.query("handle_class = '" + THIS_CLASS + "'and is_delete = '0' and task_status = '" + TaskStatusEnum.SURE_END.getCode() + "'").getResultJSONArray(0); JSONArray taskArr = taskTab.query("handle_class = '" + THIS_CLASS + "'and is_delete = '0' and task_status = '" + TaskStatusEnum.SURE_END.getCode() + "'").getResultJSONArray(0);
for (int i = 0; i < taskArr.size(); i++) { for (int i = 0; i < taskArr.size(); i++) {
JSONObject taskObj = taskArr.getJSONObject(i); JSONObject taskObj = taskArr.getJSONObject(i);
// 获取工单
String point_code2 = taskObj.getString("point_code2");
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);
String material_id = taskObj.getString("material_id"); String material_id = taskObj.getString("material_id");
String vehicle_type = taskObj.getString("vehicle_type"); String vehicle_type = taskObj.getString("vehicle_type");
JSONObject queryParam = new JSONObject(); JSONObject queryParam = new JSONObject();
@ -230,7 +240,8 @@ public class YzjCallMaterialTask extends AbstractAcsTask {
queryParam.put("material_id", material_id); queryParam.put("material_id", material_id);
queryParam.put("region_code", "KLHJ"); queryParam.put("region_code", "KLHJ");
queryParam.put("vehicle_type", "%" + vehicle_type + "%"); queryParam.put("vehicle_type", "%" + vehicle_type + "%");
//1、 queryParam.put("is_new", workOrderObj.getString("is_new"));
//TODO: 如果点位表载具类型没有维护新旧盅,就从载具表关联
JSONObject json1 = WQL.getWO("QSCH_yzjCallMaterial_01").addParamMap(queryParam).process().uniqueResult(0); JSONObject json1 = WQL.getWO("QSCH_yzjCallMaterial_01").addParamMap(queryParam).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(json1)) { if (ObjectUtil.isNotEmpty(json1)) {
// 拿到点位 // 拿到点位

4
lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/callMaterial/wql/QSCH_yzjCallMaterial_01.wql

@ -51,6 +51,7 @@
p.row_num p.row_num
FROM FROM
SCH_BASE_Point p SCH_BASE_Point p
LEFT JOIN md_pb_vehicle veh ON p.vehicle_code = veh.vehicle_code
WHERE WHERE
p.is_used = '1' p.is_used = '1'
AND standing_time is not null AND standing_time is not null
@ -67,6 +68,9 @@
OPTION 输入.vehicle_type <> "" OPTION 输入.vehicle_type <> ""
p.can_vehicle_type like 输入.vehicle_type p.can_vehicle_type like 输入.vehicle_type
ENDOPTION ENDOPTION
OPTION 输入.is_new <> ""
vehicle.vehicle_type = 输入.is_new
ENDOPTION
ORDER BY col_num desc,row_num,layer_num ORDER BY col_num desc,row_num,layer_num
ENDSELECT ENDSELECT
ENDQUERY ENDQUERY

9
lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/sendEmpty/YzjSendEmpVehicleTask.java

@ -8,6 +8,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.config.ConfigParam;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil; import org.nl.modules.system.util.CodeUtil;
@ -69,7 +71,7 @@ public class YzjSendEmpVehicleTask extends AbstractAcsTask {
* @param status 代表wcs任务完成状态 //0:acs,取消,:执行中,2:完成 * @param status 代表wcs任务完成状态 //0:acs,取消,:执行中,2:完成
* @return * @return
* @discription wcs请求wms任务完成状态反馈接口, 比如agv从a点往b点走生成任务的时候绑定b的物料信息任务完成的时候清除a的物料信息 * @discription wcs请求wms任务完成状态反馈接口, 比如agv从a点往b点走生成任务的时候绑定b的物料信息任务完成的时候清除a的物料信息
* @author ldjun * @author ldjun 载具类型由载具表维护
* @created 2019年4月17日 下午8:51:50 * @created 2019年4月17日 下午8:51:50
*/ */
@Override @Override
@ -145,7 +147,10 @@ public class YzjSendEmpVehicleTask extends AbstractAcsTask {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
String point_code1 = form.getString("point_code1"); String point_code1 = form.getString("point_code1");
String oldMatSendPoint = ConfigParam.YZJ_OLD_POINT.get(point_code1);//旧空料盅的回库的话从公共点位返回
if (StringUtils.isNotEmpty(oldMatSendPoint)){
point_code1=oldMatSendPoint;
}
SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId()) SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE")) .task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("") .task_type("")

Loading…
Cancel
Save