修改分配规则,增加半托缓存强制去包装
This commit is contained in:
@@ -32,7 +32,8 @@ public class PointUpdateUtil {
|
||||
String device_code = pointjo.getString("device_code");
|
||||
//物料类型
|
||||
String weight = pointjo.getString("weight");
|
||||
|
||||
//物料
|
||||
String material_code = pointjo.getString("material");
|
||||
//将托盘类型123,改为 03,04,05,默认给01
|
||||
String pallet_type = "01";
|
||||
if (!StrUtil.equals("0", pointjo.getString("pallet_type"))) {
|
||||
@@ -42,12 +43,12 @@ public class PointUpdateUtil {
|
||||
if (StrUtil.equals(vehicle_code, "0")) {
|
||||
vehicle_code = "";
|
||||
}
|
||||
|
||||
JSONObject pointObj = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0);
|
||||
pointObj.put("vehicle_code", vehicle_code);
|
||||
pointObj.put("point_status", point_status);
|
||||
pointObj.put("vehicle_type", pallet_type);
|
||||
pointObj.put("material_type", weight);
|
||||
pointObj.put("material_code", material_code);
|
||||
pointObj.put("mode", mode);
|
||||
pointTable.update(pointObj);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,9 @@ public class StructFindUtil {
|
||||
JSONObject materialObj = materialTable.query("material_id ='" + material_id + "'").uniqueResult(0);
|
||||
//获取可以用的输送线数组
|
||||
JSONObject result = WQL.getWO("QSTRUCT_RULE").addParam("flag", "6")
|
||||
.addParam("material_type", materialObj.getString("material_type")).process().uniqueResult(0);
|
||||
.addParam("material_type", materialObj.getString("material_type"))
|
||||
.addParam("material_code", materialObj.getString("material_code"))
|
||||
.process().uniqueResult(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
输入.group_device TYPEAS s_string
|
||||
输入.point_code TYPEAS s_string
|
||||
输入.material_type TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -217,10 +218,14 @@ IF 输入.flag = "6"
|
||||
AND point.MODE <> '0'
|
||||
AND ( point.vehicle_code = '' OR point.vehicle_code IS NULL )
|
||||
AND task.task_code IS NULL
|
||||
AND point.point_status ='00'
|
||||
AND point.point_status = '00'
|
||||
and point.material_code<>'0'
|
||||
OPTION 输入.material_type <> ""
|
||||
point.material_type = 输入.material_type
|
||||
ENDOPTION
|
||||
OPTION 输入.material_code <> ""
|
||||
point.material_code = 输入.material_code
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -423,6 +428,9 @@ IF 输入.flag = "14"
|
||||
OPTION 输入.material_type <> ""
|
||||
material.material_type = 输入.material_type
|
||||
ENDOPTION
|
||||
OPTION 输入.material_code <> ""
|
||||
material.material_code = 输入.material_code
|
||||
ENDOPTION
|
||||
order by ruledis.out_seq_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
|
||||
@@ -52,6 +52,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private final ToConveyorTask toConveyorTask;
|
||||
private final TaskService taskService;
|
||||
private final ToPackIngTask toPackIngTask;
|
||||
private final FmjToPackIngTask fmjToPackIngTask;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -143,6 +144,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
toPackIngTask.createTask((JSONObject) JSON.toJSON(jsonObject));
|
||||
break;
|
||||
}
|
||||
//假如是半托缓存的几个位置,强制去包装
|
||||
if (StrUtil.equals(area_type, AreaEnum.MTPQ.getCode())) {
|
||||
fmjToPackIngTask.createTask((JSONObject) JSON.toJSON(jsonObject));
|
||||
}
|
||||
//假如是分拣机械手的下料位置,则需要将点位上的托盘号写入
|
||||
if (StrUtil.equals(area_type, AreaEnum.FJQY.getCode())) {
|
||||
String vehicle_code = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0).getString("vehicle_code");
|
||||
@@ -159,6 +164,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
WmsToJnServiceImpl wmsToJnService = new WmsToJnServiceImpl();
|
||||
// wmsToJnService.feedBackQualityInfo(record_id);
|
||||
}
|
||||
|
||||
break;
|
||||
case "2":
|
||||
//叫料出库
|
||||
@@ -294,7 +300,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
//产品编码
|
||||
String product_code = String.valueOf(jsonObject.get("product_code"));
|
||||
//String material_code = (String) jsonObject.get("material_code");
|
||||
if (StrUtil.isEmpty(product_code)){
|
||||
if (StrUtil.isEmpty(product_code)) {
|
||||
throw new BadRequestException("产品编号不能为空!");
|
||||
}
|
||||
produceInfoByCode = this.getProduceInfoByCode(device_code);
|
||||
@@ -459,18 +465,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String device_id = pointTable.query("point_code ='" + device_code + "'").uniqueResult(0).getString("device_id");
|
||||
String next_point_code = pointTable.query("device_id ='" + device_id + "' and device_point_type ='02'").uniqueResult(0).getString("point_code");
|
||||
param.put("next_point_code", next_point_code);
|
||||
String conveyorTask_id = task.createTask(param);
|
||||
JSONObject conveyorTaskObj = WQLObject.getWQLObject("sch_base_task").query("task_id='" + conveyorTask_id + "'").uniqueResult(0);
|
||||
|
||||
AcsTaskDto taskDto = new AcsTaskDto();
|
||||
// String conveyorTask_id = task.createTask(param);
|
||||
// JSONObject conveyorTaskObj = WQLObject.getWQLObject("sch_base_task").query("task_id='" + conveyorTask_id + "'").uniqueResult(0);
|
||||
/*AcsTaskDto taskDto = new AcsTaskDto();
|
||||
taskDto.setExt_task_uuid(conveyorTaskObj.getString("task_id"));
|
||||
taskDto.setTask_code(conveyorTaskObj.getString("task_code"));
|
||||
taskDto.setRoute_plan_code("normal");
|
||||
taskDto.setStart_device_code(conveyorTaskObj.getString("start_point_code"));
|
||||
taskDto.setNext_device_code(conveyorTaskObj.getString("next_point_code"));
|
||||
taskDto.setVehicle_code(conveyorTaskObj.getString("vehicle_code"));
|
||||
|
||||
data = (JSONObject) JSONObject.parse(JSON.toJSONString(taskDto));
|
||||
data = (JSONObject) JSONObject.parse(JSON.toJSONString(taskDto));*/
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
|
||||
@@ -105,18 +105,7 @@ public class CallMaterialTask extends AbstractAcsTask {
|
||||
endpointObj.put("point_status", "02");
|
||||
endpointObj.put("vehicle_code", vehicle_code);
|
||||
pointTab.update(endpointObj);
|
||||
//如果起点静置货架,则考虑是不是最后一拖,如果是则考虑改变系统参数
|
||||
String start_area = startPointDto.getArea_type();
|
||||
if (StrUtil.equals(start_area, AreaEnum.RYHCHJ.getCode())) {
|
||||
//查询有没有可以出库的货物 如果没有则需要改变系统参数
|
||||
JSONObject outCacheStruct = StructFindUtil.getOutCacheStruct();
|
||||
if (ObjectUtil.isEmpty(outCacheStruct)) {
|
||||
WQLObject paramTable = WQLObject.getWQLObject("sys_param");
|
||||
JSONObject paramObj = paramTable.query("code='is_canToConveyor'").uniqueResult(0);
|
||||
paramObj.put("value", "1");
|
||||
paramTable.update(paramObj);
|
||||
}
|
||||
}
|
||||
|
||||
////如果终点是分拣区域,则更新木托盘铁托盘记录表
|
||||
String next_area = nextPointDto.getArea_type();
|
||||
if (StrUtil.equals(next_area, AreaEnum.FJQY.getCode())) {
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
package org.nl.wms.sch.manage.buss;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.WorkProcedureEnum;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.BillTypeEnum;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
import org.nl.wms.sch.service.impl.PointServiceImpl;
|
||||
import org.nl.wms.st.ivt.IvtChangeTypeEnum;
|
||||
import org.nl.wms.st.ivt.StoreIvtServiceImpl;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class FmjToPackIngTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = FmjToPackIngTask.class.getName();
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
/**
|
||||
*改变任务状态
|
||||
**/
|
||||
String task_id = taskObj.getString("task_id");
|
||||
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject jsonTask = taskTab.query("task_id='" + task_id + "'").uniqueResult(0);
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
//更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
HashMap map = new HashMap();
|
||||
map.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
map.put("update_optname", SecurityUtils.getNickName());
|
||||
map.put("update_time", DateUtil.now());
|
||||
map.put("bill_status", "40");
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").update(map, "task_id='" + jsonTask.getString("task_id") + "'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.FINISHED.getCode().equals(status)) {
|
||||
// 更新任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("taskfinish_mode", taskObj.getString("taskfinish_mode"));
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
jsonTask.put("remark", "任务执行完成");
|
||||
taskTab.update(jsonTask);
|
||||
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", "");
|
||||
pointTab.update(startPointObj);
|
||||
///审核单据 增加库存 改变出入库表的状态
|
||||
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_workProcedureIOS");
|
||||
JSONObject mstObj = mstTab.query("task_id='" + task_id + "' and is_delete='0'").uniqueResult(0);
|
||||
//审核 加库存可和用数量
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
mstObj.put("bill_status", "50");
|
||||
mstObj.put("confirm_optid", SecurityUtils.getCurrentUserId());
|
||||
mstObj.put("confirm_optname", SecurityUtils.getNickName());
|
||||
mstObj.put("confirm_time", DateUtil.now());
|
||||
mstTab.update(mstObj);
|
||||
|
||||
String iostorinv_id = mstObj.getString("iostorinv_id");
|
||||
String next_point_code = mstObj.getString("end_point_code");
|
||||
String start_point_code = mstObj.getString("start_point_code");
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", mstObj.getString("material_id"));
|
||||
param.put("bill_id", iostorinv_id);
|
||||
param.put("qty_unit_id", mstObj.getString("qty_unit_id"));
|
||||
param.put("pcsn", mstObj.getString("pcsn"));
|
||||
param.put("change_qty", mstObj.getString("qty"));
|
||||
param.put("vehicle_code", mstObj.getString("vehicle_code"));
|
||||
param.put("workprocedure_id", mstObj.getString("ivt_workprocedure_id"));
|
||||
PointServiceImpl pointService = SpringContextHolder.getBean(PointServiceImpl.class);
|
||||
PointDto nextPointDto = pointService.findByCode(next_point_code);
|
||||
if (ObjectUtil.isNull(nextPointDto)) {
|
||||
throw new BadRequestException("未找到可用点位:" + next_point_code);
|
||||
}
|
||||
PointDto startPointDto = pointService.findByCode(start_point_code);
|
||||
if (ObjectUtil.isNull(startPointDto)) {
|
||||
throw new BadRequestException("未找到可用点位:" + start_point_code);
|
||||
}
|
||||
param.put("struct_id", startPointDto.getPoint_id());
|
||||
ivtService.addIvtFlow(param, IvtChangeTypeEnum.SUB_IVT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findStartPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public String createTask(JSONObject form) {
|
||||
String start_point_code = form.getString("start_point_code");
|
||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||
WQLObject ivt_table = WQLObject.getWQLObject("st_ivt_structivt");
|
||||
JSONObject start_pointObj = point_table.query("point_code='" + start_point_code + "'").uniqueResult(0);
|
||||
String struct_id = start_pointObj.getString("point_id");
|
||||
JSONObject ivtObj = ivt_table.query("struct_id ='" + struct_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(ivtObj)) {
|
||||
throw new BadRequestException("仓位为'" + start_point_code + "'未找到库存信息!");
|
||||
}
|
||||
String next_point_code = "BZSLW";
|
||||
String material_id = ivtObj.getString("material_id");
|
||||
String is_full = ivtObj.getString("is_full");
|
||||
String qty = ivtObj.getString("qty");
|
||||
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("起点不能为空!");
|
||||
}
|
||||
//判断起点有没有未完成的指令
|
||||
JSONObject beforTaskObj = taskTable.
|
||||
query("is_delete='0' and start_point_code='" + start_point_code + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'")
|
||||
.uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(beforTaskObj)) {
|
||||
throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
}
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
//创建出库单据
|
||||
JSONObject iosObj = new JSONObject();
|
||||
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
iosObj.put("iostorinv_id", iostorinv_id);
|
||||
iosObj.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
iosObj.put("io_type", "1");
|
||||
iosObj.put("bill_type", BillTypeEnum.FJCK.getCode());
|
||||
iosObj.put("workprocedure_id", WorkProcedureEnum.BZGX.getId());
|
||||
iosObj.put("ivt_workprocedure_id", WorkProcedureEnum.FJGX.getId());
|
||||
iosObj.put("material_id", material_id);
|
||||
iosObj.put("vehicle_code", vehicle_code);
|
||||
iosObj.put("producetask_id", ivtObj.getString("producetask_id"));
|
||||
iosObj.put("qty", qty);
|
||||
iosObj.put("qty_unit_id", ivtObj.getString("qty_unit_id"));
|
||||
//默认是分配状态
|
||||
iosObj.put("bill_status", "20");
|
||||
iosObj.put("start_point_code", start_point_code);
|
||||
iosObj.put("end_point_code", next_point_code);
|
||||
iosObj.put("start_area", start_pointObj.getString("area_type"));
|
||||
iosObj.put("end_area", "28");
|
||||
iosObj.put("create_mode", "01");
|
||||
iosObj.put("task_id", task_id);
|
||||
iosObj.put("pcsn", pcsn);
|
||||
iosObj.put("create_id", "1");
|
||||
iosObj.put("create_name", "管理员");
|
||||
iosObj.put("create_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_workProcedureIOS").insert(iosObj);
|
||||
//加锁
|
||||
HashMap lock_map = new HashMap();
|
||||
lock_map.put("lock_type", "01");
|
||||
WQLObject.getWQLObject("sch_base_point").update(lock_map, "point_code = '" + start_point_code + "'");
|
||||
//减少库存可用数量
|
||||
StoreIvtServiceImpl ivtService = new StoreIvtServiceImpl();
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("material_id", material_id);
|
||||
param.put("bill_id", iostorinv_id);
|
||||
param.put("qty_unit_id", ivtObj.getString("qty_unit_id"));
|
||||
param.put("change_qty", qty);
|
||||
param.put("struct_id", start_pointObj.getString("point_id"));
|
||||
param.put("vehicle_code", vehicle_code);
|
||||
param.put("workprocedure_id", WorkProcedureEnum.FJGX.getId());
|
||||
ivtService.addIvtFlow(param, IvtChangeTypeEnum.SUB_CAN_USE);
|
||||
|
||||
PointService pointService = SpringContextHolder.getBean(PointService.class);
|
||||
PointDto startPoint = pointService.findByCode(start_point_code);
|
||||
String task_status = TaskStatusEnum.START_AND_POINT.getCode();
|
||||
PointDto nextPoint = pointService.findByCode(next_point_code);
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_id", task_id);
|
||||
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
taskObj.put("task_type", "00");
|
||||
taskObj.put("acs_task_type", "1");
|
||||
taskObj.put("task_status", task_status);
|
||||
taskObj.put("start_point_code", start_point_code);
|
||||
taskObj.put("start_area", startPoint.getArea_type());
|
||||
taskObj.put("request_param", form.toJSONString());
|
||||
taskObj.put("next_point_code", next_point_code);
|
||||
taskObj.put("next_area", nextPoint.getArea_type());
|
||||
taskObj.put("vehicle_code", vehicle_code);
|
||||
taskObj.put("handle_class", THIS_CLASS);
|
||||
taskObj.put("is_auto_issue", "1");
|
||||
taskObj.put("create_name", SecurityUtils.getCurrentUsername());
|
||||
taskObj.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
taskObj.put("create_time", DateUtil.now());
|
||||
taskObj.put("is_delete", "0");
|
||||
taskTable.insert(taskObj);
|
||||
return task_id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -44,7 +44,14 @@ public class AutoOutStructTask {
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject jo = arr.getJSONObject(i);
|
||||
String material_type = jo.getString("material_type");
|
||||
JSONObject outObj = WQL.getWO("QSTRUCT_RULE").addParam("flag", "14").addParam("material_type", material_type).process().uniqueResult(0);
|
||||
String material_code = jo.getString("material_code");
|
||||
if (StrUtil.equals(material_code, "0")) {
|
||||
material_code = "";
|
||||
}
|
||||
JSONObject outObj = WQL.getWO("QSTRUCT_RULE").addParam("flag", "14")
|
||||
.addParam("material_type", material_type)
|
||||
.addParam("material_code", material_code)
|
||||
.process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(outObj)) {
|
||||
material_id = outObj.getString("material_id");
|
||||
vehicle_code = outObj.getString("vehicle_code");
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user