rev:三线半成品acs申请任务
This commit is contained in:
@@ -88,16 +88,17 @@ public class IosHrTask extends AbstractAcsTask {
|
||||
} else if (StrUtil.equals(type, "16")) {
|
||||
/* 4.申请出空箱任务 */
|
||||
|
||||
int qty = json.getIntValue("qty");
|
||||
if (ObjectUtil.isEmpty(qty)) throw new BadRequestException("数量不能为空!");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", device_code1);
|
||||
param.put("barcode", barcode1);
|
||||
|
||||
// 1.调用空托盘出库库服务
|
||||
iStIvtIostorinvEmpBcpService.OutEmp(param);
|
||||
|
||||
// 2.判断device_code2、barcode2 是否为空
|
||||
if (ObjectUtil.isNotEmpty(json.getString("device_code2"))) {
|
||||
param.put("device_code", json.getString("device_code2"));
|
||||
if (qty > 1) {
|
||||
iStIvtIostorinvEmpBcpService.OutEmp(param);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package org.nl.wms.storage_manage.semimanagehr.service.moveInv.impl;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -11,6 +16,8 @@ import org.nl.common.publish.event.PointEvent;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.wms.ext_manage.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.scheduler_manage.service.extendtask.manage.TaskStatusEnum;
|
||||
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
|
||||
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
|
||||
@@ -72,25 +79,34 @@ public class StIvtMoveinvdtlHrBcpServiceImpl extends ServiceImpl<StIvtMoveinvdtl
|
||||
switch (option){
|
||||
|
||||
case "immediateNotifyAcs":
|
||||
// 下发任务
|
||||
StIvtMoveinvdtlHrBcp moveinvdtlCp = list.get(0);
|
||||
PointEvent event = PointEvent.builder()
|
||||
.type(AcsTaskEnum.TASK_STRUCT_BCP_HR_MOVE)
|
||||
.acs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20.getCode())
|
||||
.task_group_id(IdUtil.getStringId())
|
||||
.point_code1(form.getString("turnout_struct_code"))
|
||||
.point_code3(form.getString("turnin_struct_code"))
|
||||
.vehicle_code(form.getString("storagevehicle_code"))
|
||||
.product_area("A3")
|
||||
.callback((Consumer<String>) moveinvdtlCp::setTask_id)
|
||||
.build();
|
||||
BussEventMulticaster.Publish(event);
|
||||
|
||||
// 更新明细
|
||||
this.update(new UpdateWrapper<StIvtMoveinvdtlHrBcp>()
|
||||
.set("task_id",moveinvdtlCp.getTask_id())
|
||||
.set("bill_status", MoveInvEnum.BILL_STATUS.code("移库中"))
|
||||
.eq("moveinv_id", form.getString("moveinv_id")));
|
||||
SchBaseTask taskDao = taskService.getById(form.getString("task_id"));
|
||||
|
||||
if (ObjectUtil.isEmpty(taskDao)) {
|
||||
StIvtMoveinvdtlHrBcp moveinvdtlCp = list.get(0);
|
||||
PointEvent event = PointEvent.builder()
|
||||
.type(AcsTaskEnum.TASK_STRUCT_BCP_HR_MOVE)
|
||||
.acs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20.getCode())
|
||||
.task_group_id(IdUtil.getStringId())
|
||||
.point_code1(form.getString("turnout_struct_code"))
|
||||
.point_code3(form.getString("turnin_struct_code"))
|
||||
.vehicle_code(form.getString("storagevehicle_code"))
|
||||
.product_area("A3")
|
||||
.callback((Consumer<String>) moveinvdtlCp::setTask_id)
|
||||
.build();
|
||||
BussEventMulticaster.Publish(event);
|
||||
|
||||
// 更新明细
|
||||
this.update(new UpdateWrapper<StIvtMoveinvdtlHrBcp>()
|
||||
.set("task_id",moveinvdtlCp.getTask_id())
|
||||
.set("bill_status", MoveInvEnum.BILL_STATUS.code("移库中"))
|
||||
.eq("moveinv_id", form.getString("moveinv_id")));
|
||||
|
||||
this.sendTask(moveinvdtlCp.getTask_id());
|
||||
} else {
|
||||
this.sendTask(taskDao.getTask_id());
|
||||
}
|
||||
|
||||
break;
|
||||
case "forceFinish":
|
||||
param.put("task_id", form.getString("task_id"));
|
||||
@@ -105,4 +121,23 @@ public class StIvtMoveinvdtlHrBcpServiceImpl extends ServiceImpl<StIvtMoveinvdtl
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sendTask(String task_id) {
|
||||
|
||||
SchBaseTask taskDao = taskService.getById(task_id);
|
||||
JSONArray param = new JSONArray();
|
||||
param.add(JSON.parseObject(JSONUtil.toJsonStr(taskDao)));
|
||||
// 1.下发任务
|
||||
WmsToAcsService bean = SpringContextHolder.getBean(WmsToAcsService.class);
|
||||
Map<String, Object> result = bean.issueTaskToAcs4(param);
|
||||
|
||||
// 反馈失败报错
|
||||
if (!ObjectUtil.equal(MapUtil.getStr(result, "status"),"200")) {
|
||||
throw new BadRequestException("下发失败:"+MapUtil.getStr(result, "message"));
|
||||
}
|
||||
|
||||
// 2.更新任务状态
|
||||
taskDao.setTask_status(TaskStatusEnum.ISSUE.getCode());
|
||||
taskService.updateById(taskDao);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user