fix: 解包上料/下料/工单功能

This commit is contained in:
2025-07-25 15:10:43 +08:00
parent 8dfb0a9007
commit 529d697fe8
15 changed files with 369 additions and 313 deletions

View File

@@ -196,7 +196,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
dto.setUpdate_time(now);
dto.setUpdate_id(currentUserId);
dto.setUpdate_name(nickName);
Sectattr sectattr = iSectattrService.findById(dto.getSect_id());
Sectattr sectattr = iSectattrService.findByCode(dto.getSect_id());
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(sectattr.getStor_id());
dto.setSect_code(sectattr.getSect_code());
dto.setSect_name(sectattr.getSect_name());
@@ -409,7 +409,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
Structattr structattr = this.getByCode(changeDto.getStructCode());
for (GroupPlate vehicleMater : groupPlates) {
String vehicleCode = vehicleMater.getStoragevehicle_code();
BigDecimal subtract = vehicleMater.getQty().subtract(vehicleMater.getFrozen_qty());
BigDecimal subtract = vehicleMater.getQty().add(vehicleMater.getFrozen_qty());
//100-出50 = 50
//如果出库是手持库出确认则不在这边变动组盘信息
if (!changeDto.getInBound()) {
@@ -417,7 +417,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
.set("frozen_qty", 0)
.set("qty", subtract)
.set("update_time", now)
.set("status", GROUP_PLATE_STATUS.code("组盘"))
.set("status", GROUP_PLATE_STATUS.code("出库"))
.eq("group_id", vehicleMater.getGroup_id());
iMdPbGroupplateService.update(update);
}

View File

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.decision_manage.service.strategyConfig.decisioner.Decisioner;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.List;

View File

@@ -99,10 +99,8 @@ public class PdaJBServiceImpl implements PdaJBService {
@Transactional(rollbackFor = Exception.class)
public PdaResponse callMaterial(JSONObject whereJson) {
log.info("解包叫料,请求参数:{}", whereJson);
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
// workorder_id、area、point_code
String pointCode = whereJson.getString("point_code");
String workorderId = whereJson.getString("workorder_id");
PdmBdWorkorder workorder = workorderService.getById(workorderId);
if (ObjectUtil.isEmpty(workorder)) {
@@ -127,122 +125,76 @@ public class PdaJBServiceImpl implements PdaJBService {
throw new BadRequestException("托盘[" + outStructAttr.getStoragevehicle_code() + "]组盘信息不存在!");
}
// 1、创建出库单、明细、分配明细
// 1.1 单据表
String invId = IdUtil.getStringId();
IOStorInv ioStorInv = new IOStorInv();
ioStorInv.setIostorinv_id(invId);
ioStorInv.setBill_code(CodeUtil.getNewCode("OUT_STORE_CODE"));
ioStorInv.setBiz_date(DateUtil.format(new Date(), "yyyy-MM-dd"));
ioStorInv.setIo_type(IOSEnum.IO_TYPE.code("出库"));
ioStorInv.setDetail_count(1);
ioStorInv.setCreate_mode(IOSEnum.CREATE_MODE.code("终端产生"));
ioStorInv.setStor_id(outStructAttr.getStor_id());
ioStorInv.setStor_code(outStructAttr.getStor_code());
ioStorInv.setStor_name(outStructAttr.getStor_name());
ioStorInv.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
ioStorInv.setBill_type("1010");
ioStorInv.setIs_delete(BaseDataEnum.IS_YES_NOT.code(""));
ioStorInv.setIs_upload(BaseDataEnum.IS_YES_NOT.code(""));
ioStorInv.setInput_optid(currentUserId);
ioStorInv.setInput_optname(nickName);
ioStorInv.setInput_time(now);
ioStorInv.setUpdate_optid(currentUserId);
ioStorInv.setUpdate_optname(nickName);
ioStorInv.setUpdate_time(now);
ioStorInv.setTotal_qty(BigDecimal.valueOf(1));
ioStorInv.setDetail_count(1);
outBillService.save(ioStorInv);
// 1.2 单据明细
IOStorInvDtl dtl = new IOStorInvDtl();
dtl.setIostorinvdtl_id(IdUtil.getStringId());
dtl.setIostorinv_id(invId);
dtl.setSeq_no("1");
dtl.setMaterial_id(materialbase.getMaterial_id());
dtl.setMaterial_code(materialbase.getMaterial_code());
dtl.setPcsn(groupPlate.getPcsn());
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
dtl.setQty_unit_id(groupPlate.getQty_unit_id());
dtl.setQty_unit_name(groupPlate.getQty_unit_name());
dtl.setPlan_qty(BigDecimal.ONE);
dtl.setAssign_qty(BigDecimal.ONE);
dtl.setUnassign_qty(BigDecimal.ZERO);
ioStorInvDtlMapper.insert(dtl);
// 1.3 分配明细
IOStorInvDis ioStorInvDis = new IOStorInvDis();
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
ioStorInvDis.setIostorinv_id(dtl.getIostorinv_id());
ioStorInvDis.setIostorinvdtl_id(dtl.getIostorinvdtl_id());
ioStorInvDis.setSeq_no("1");
ioStorInvDis.setSect_id(outStructAttr.getSect_id());
ioStorInvDis.setPcsn(groupPlate.getPcsn());
ioStorInvDis.setMaterial_id(materialbase.getMaterial_id());
ioStorInvDis.setMaterial_code(materialbase.getMaterial_code());
ioStorInvDis.setSect_name(outStructAttr.getSect_name());
ioStorInvDis.setSect_code(outStructAttr.getSect_code());
ioStorInvDis.setStruct_id(outStructAttr.getStruct_id());
ioStorInvDis.setStruct_name(outStructAttr.getStruct_name());
ioStorInvDis.setStruct_code(outStructAttr.getStruct_code());
ioStorInvDis.setStoragevehicle_code(outStructAttr.getStoragevehicle_code());
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code(""));
ioStorInvDis.setQty_unit_id(groupPlate.getQty_unit_id());
ioStorInvDis.setQty_unit_name(groupPlate.getQty_unit_name());
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("生成"));
ioStorInvDis.setPlan_qty(groupPlate.getFrozen_qty());
JSONObject insertInvObj = new JSONObject();
JSONArray tableData = new JSONArray();
JSONObject table = new JSONObject();
tableData.add(table);
insertInvObj.put("stor_id", outStructAttr.getStor_id());
insertInvObj.put("stor_code", outStructAttr.getStor_code());
insertInvObj.put("bill_status", "10");
insertInvObj.put("total_qty", workorder.getPlan_weight());
insertInvObj.put("detail_count", 1);
insertInvObj.put("bill_type", "1012");
insertInvObj.put("biz_date", DateUtil.format(new Date(), "yyyy-MM-dd"));
insertInvObj.put("tableData", tableData);
table.put("turnout_struct_code", outStructAttr.getStruct_code());
table.put("turnout_sect_code", outStructAttr.getSect_code());
table.put("turnout_sect_name", outStructAttr.getSect_name());
table.put("sect_id", outStructAttr.getSect_id());
table.put("struct_id", outStructAttr.getStruct_id());
table.put("group_id", groupPlate.getGroup_id());
table.put("storagevehicle_code", outStructAttr.getStoragevehicle_code());
table.put("storagevehicle_type", workorder.getVehicle_type());
table.put("material_id", materialbase.getMaterial_id());
table.put("pcsn", groupPlate.getPcsn());
table.put("qty", groupPlate.getQty());
table.put("qty_unit_id", groupPlate.getQty_unit_id());
table.put("qty_unit_name", groupPlate.getQty_unit_name());
table.put("fronzen_qty", 0);
table.put("status", "01");
table.put("material_code", materialbase.getMaterial_code());
table.put("material_name", materialbase.getMaterial_name());
table.put("material_spec", materialbase.getMaterial_spec());
String invId = outBillService.insertDtl(insertInvObj);
// 调用手工分配
JSONObject param = new JSONObject();
JSONObject row = new JSONObject();
JSONArray rows = new JSONArray();
rows.add(row);
param.put("rows", rows);
IOStorInvDtl dtl = ioStorInvDtlMapper.selectOne(new LambdaQueryWrapper<IOStorInvDtl>()
.eq(IOStorInvDtl::getIostorinv_id, invId));
param.put("row", dtl);
row.put("storagevehicle_code", outStructAttr.getStoragevehicle_code());
row.put("pcsn", groupPlate.getPcsn());
row.put("qty", groupPlate.getQty());
row.put("qty_unit_name", groupPlate.getQty_unit_name());
row.put("frozen_qty", groupPlate.getFrozen_qty());
row.put("struct_id", outStructAttr.getStruct_id());
row.put("struct_code", outStructAttr.getStruct_code());
row.put("struct_name", outStructAttr.getStruct_name());
row.put("sect_id", outStructAttr.getSect_id());
row.put("sect_code", outStructAttr.getSect_code());
row.put("sect_name", outStructAttr.getSect_name());
row.put("material_code", groupPlate.getMaterial_code());
row.put("material_name", groupPlate.getMaterial_name());
row.put("edit", true);
outBillService.manualDiv(param);
// 1.3 仓位锁住
JSONObject lock_map = new JSONObject();
lock_map.put("struct_code", outStructAttr.getStruct_code());
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
lock_map.put("inv_code", ioStorInv.getBill_code());
lock_map.put("inv_type", ioStorInv.getBill_type());
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
iStructattrService.updateStatusByCode("0", lock_map);
//更新组盘表冻结数量状态
iMdPbGroupPlateService.update(new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getFrozen_qty, "1")
.set(GroupPlate::getUpdate_time, now)
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getStoragevehicle_code, outStructAttr.getStoragevehicle_code())
.eq(GroupPlate::getPcsn, groupPlate.getPcsn())
.eq(GroupPlate::getMaterial_id, materialbase.getMaterial_id())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
// 2、创建任务、下发
// 获取工单对应的区域的出入点
SchBasePoint inPoint = pointService.getNotTaskByRegionAndType(workorder.getRegion_code(), "3");
SchBasePoint outPoint = pointService.getNotTaskByRegionAndType(workorder.getRegion_code(), "4");
if (ObjectUtil.isEmpty(inPoint) || ObjectUtil.isEmpty(outPoint)) {
throw new BadRequestException("解包机输送线点位不存在或者存在任务!");
}
JSONObject task_form = new JSONObject();
task_form.put("task_type", "JbUpAgvTask");
task_form.put("group_id", groupPlate.getGroup_id());
task_form.put("order_id", workorder.getWorkorder_id());
task_form.put("TaskCode", CodeUtil.getNewCode("TASK_CODE"));
task_form.put("point_code1", outStructAttr.getStruct_code());
task_form.put("point_code2", inPoint.getPoint_code());
task_form.put("vehicle_code", outStructAttr.getStoragevehicle_code());
if ("2".equals(outPoint.getPoint_status())) {
// 四点任务
task_form.put("point_code3", outPoint.getPoint_code());
task_form.put("point_code4", outStructAttr.getStruct_code());
task_form.put("vehicle_code2", outPoint.getVehicle_code());
}
String task_id = jbUpAgvTask.create(task_form);
ioStorInvDis.setTask_id(task_id);
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code(""));
ioStorInvDis.setPoint_code(outStructAttr.getStruct_code());
ioStorInvDisMapper.insert(ioStorInvDis);
// 创建任务
SchBasePoint outPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getParent_point_code, pointCode)
.eq(SchBasePoint::getRegion_code, "CKQ"));
JSONObject taskParam = new JSONObject();
taskParam.put("order_id", workorderId);
taskParam.put("iostorinv_id", invId);
taskParam.put("point_code", outPoint.getPoint_code());
outBillService.allSetPoint(taskParam);
// 3、工单状态修改设置实际开始时间
workorder.setWorkorder_status("3");
workorder.setRealproducestart_date(DateUtil.now());
workorderService.updateById(workorder);
inPoint.setIng_task_code(task_id);
if ("2".equals(outPoint.getPoint_status())) {
outPoint.setIng_task_code(task_id);
}
pointService.updateBatchById(Arrays.asList(inPoint, outPoint));
return PdaResponse.requestOk();
}

View File

@@ -68,6 +68,11 @@ public class SchBasePointController {
public ResponseEntity<Object> getPointList(@RequestBody(required = false) SchBasePoint region) {
return new ResponseEntity<>(schBasePointService.getPointList(region), HttpStatus.OK);
}
@PostMapping("/getPointList2")
@Log("获取区域下拉框")
public ResponseEntity<Object> getPointList2(@RequestBody(required = false) SchBasePoint region) {
return new ResponseEntity<>(schBasePointService.getPointList2(region), HttpStatus.OK);
}
@Log("锁定与解锁")
@PostMapping("/changeLock")

View File

@@ -115,4 +115,6 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
* @return
*/
List<SchBasePoint> getCanUseCFGJs(SchBasePoint parentPoint, String pointStatus);
List<SchBasePoint> getPointList2(SchBasePoint region);
}

View File

@@ -296,4 +296,14 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
return this.baseMapper.getCanUseCFGJs(parentPoint, pointStatus);
}
@Override
public List<SchBasePoint> getPointList2(SchBasePoint region) {
if (ObjectUtil.isEmpty(region)) {
return this.list();
}
return pointMapper.selectList(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getRegion_code, region.getRegion_code())
.eq(SchBasePoint::getIs_has_workder, true));
}
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
@@ -11,6 +12,7 @@ import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBasePointService;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
@@ -41,6 +43,8 @@ public class JbDownAgvTask extends AbstractTask {
private IInBillService inBillService;
@Resource
private IOStorInvDisMapper ioStorInvDisMapper;
@Resource
private ISchBasePointService pointService;
@Override
public String create(JSONObject param) {
// 改造:多条任务
@@ -122,12 +126,36 @@ public class JbDownAgvTask extends AbstractTask {
private void finishTask(SchBaseTask taskObj) {
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("已完成");
taskService.updateById(taskObj);
if ("3".equals(taskObj.getTask_group_seq().toString())) {
inBillService.taskFinish(taskObj);
taskObj.setRemark("等待最后一条任务完成");
if ("1".equals(taskObj.getTask_group_seq().toString())) {
// 开盖设置成有盖
SchBasePoint khgPoint = pointService.getById(taskObj.getPoint_code2());
khgPoint.setPoint_status("2");
khgPoint.setUpdate_time(DateUtil.now());
pointService.updateById(khgPoint);
}
if ("2".equals(taskObj.getTask_group_seq().toString())) {
SchBasePoint jbjPoint = pointService.getById(taskObj.getPoint_code1());
jbjPoint.setPoint_status("2");
jbjPoint.setVehicle_code(taskObj.getVehicle_code());
jbjPoint.setUpdate_time(DateUtil.now());
pointService.updateById(jbjPoint);
}
if ("3".equals(taskObj.getTask_group_seq().toString())) {
// 开盖设置成有盖
SchBasePoint khgPoint = pointService.getById(taskObj.getPoint_code2());
khgPoint.setPoint_status("2");
khgPoint.setUpdate_time(DateUtil.now());
pointService.updateById(khgPoint);
SchBaseTask task = new SchBaseTask();
task.setTask_status(TaskStatus.FINISHED.getCode());
task.setRemark("任务执行完毕");
taskService.update(task, new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getTask_group_id, taskObj.getTask_group_id()));
inBillService.taskFinish(taskObj);
return;
}
taskService.updateById(taskObj);
}
@Override

View File

@@ -7,7 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
import org.nl.wms.basedata_manage.service.IStructattrService;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.pm_manage.service.IPdmBdWorkorderService;
import org.nl.wms.pm_manage.service.dao.PdmBdWorkorder;
import org.nl.wms.sch_manage.enums.TaskStatus;
@@ -23,13 +24,13 @@ import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 解包上料AGV任务
*
* @Author: lyd
* @Date: 2025/7/22
*/
@@ -47,6 +48,9 @@ public class JbUpAgvTask extends AbstractTask {
private ISchBasePointService pointService;
@Resource
private IMdPbGroupplateService groupplateService;
@Resource
private IStructattrService structattrService;
@Override
public String create(JSONObject json) {
SchBaseTask task = new SchBaseTask();
@@ -103,17 +107,17 @@ public class JbUpAgvTask extends AbstractTask {
// 取消任务
taskService.update(new LambdaUpdateWrapper<SchBaseTask>()
.set(SchBaseTask::getTask_status, TaskStatus.CANCELED.getCode())
.set(SchBaseTask::getRemark,"已取消")
.eq(SchBaseTask::getTask_id,taskObj.getTask_id())
.set(SchBaseTask::getRemark, "已取消")
.eq(SchBaseTask::getTask_id, taskObj.getTask_id())
);
//分配表清除任务
ioStorInvDisMapper.update(new IOStorInvDis(),new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getTask_id,null)
.set(IOStorInvDis::getPoint_code,null)
.set(IOStorInvDis::getIs_issued,0)
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<>(IOStorInvDis.class)
.set(IOStorInvDis::getTask_id, null)
.set(IOStorInvDis::getPoint_code, null)
.set(IOStorInvDis::getIs_issued, 0)
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("未生成"))
.eq(IOStorInvDis::getTask_id,taskObj.getTask_id())
.eq(IOStorInvDis::getTask_id, taskObj.getTask_id())
);
}
@@ -126,16 +130,18 @@ public class JbUpAgvTask extends AbstractTask {
// 工单完成
JSONObject requestParam = JSONObject.parseObject(taskObj.getRequest_param());
String orderId = requestParam.getString("order_id");
workorderService.update(new LambdaUpdateWrapper<PdmBdWorkorder>()
.set(PdmBdWorkorder::getWorkorder_status, "4")
.set(PdmBdWorkorder::getReal_qty, 1)
.set(PdmBdWorkorder::getRealproduceend_date, DateUtil.now())
.eq(PdmBdWorkorder::getWorkorder_id, orderId));
if (ObjectUtil.isNotEmpty(orderId)) {
workorderService.update(new LambdaUpdateWrapper<PdmBdWorkorder>()
.set(PdmBdWorkorder::getWorkorder_status, "4")
.set(PdmBdWorkorder::getReal_qty, 1)
.set(PdmBdWorkorder::getRealproduceend_date, DateUtil.now())
.eq(PdmBdWorkorder::getWorkorder_id, orderId));
}
// 点位设置值
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
.set(SchBasePoint::getPoint_status, "3")
.set(SchBasePoint::getIng_task_code, "")
.set(SchBasePoint::getIng_task_code, null)
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
.set(SchBasePoint::getUpdate_time, DateUtil.now())
@@ -143,22 +149,18 @@ public class JbUpAgvTask extends AbstractTask {
if (ObjectUtil.isNotEmpty(taskObj.getPoint_code3())) {
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
.set(SchBasePoint::getVehicle_code, "")
.set(SchBasePoint::getIng_task_code, "")
.set(SchBasePoint::getIng_task_code, null)
.set(SchBasePoint::getPoint_status, "1")
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
.set(SchBasePoint::getUpdate_time, DateUtil.now())
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
// 仓位设置空托盘
structattrService.update(new LambdaUpdateWrapper<Structattr>()
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code2())
.set(Structattr::getOccupancy_state, 2)
.eq(Structattr::getStruct_code, taskObj.getPoint_code4()));
}
groupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getFrozen_qty, "1")
.set(GroupPlate::getUpdate_time, DateUtil.now())
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getStoragevehicle_code, taskObj.getVehicle_code())
// .eq(GroupPlate::getPcsn, w.getPcsn())
// .eq(GroupPlate::getMaterial_id, materialbase.getMaterial_id())
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库")));
}
@Override

View File

@@ -556,8 +556,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
SchBasePoint intoPoint = pointService.getNotTaskByRegionAndType(parentPoint.getRegion_code(), "2");
SchBasePoint emptyPoint = pointService.getNotTaskByRegionAndType(parentPoint.getRegion_code(), "5");
SchBasePoint fullPoint = pointService.getNotTaskByRegionAndType(parentPoint.getRegion_code(), "6");
// 获取盖子的对应的点位
List<SchBasePoint> canUseCFGJs = pointService.getCanUseCFGJs(parentPoint, "2");
// 获取盖子的对应的点位
List<SchBasePoint> canUseCFGJs = pointService.getCanUseCFGJs(parentPoint, "1");
if (canUseCFGJs.size() == 0) {
throw new BadRequestException("找不到可用的拆封盖机");
}
@@ -619,7 +619,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
List<JSONObject> jsonObjects = Arrays.asList(task1, task2, task3);
JSONObject requestTaskParam = new JSONObject();
requestTaskParam.put("tasks", jsonObjects);
jbDownAgvTask.create(requestTaskParam);
task_id = jbDownAgvTask.create(requestTaskParam);
} else {
//创建任务
JSONObject task_form = new JSONObject();

View File

@@ -28,11 +28,13 @@ import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam;
import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto;
import org.nl.wms.sch_manage.enums.TaskStatus;
import org.nl.wms.sch_manage.service.ISchBasePointService;
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
import org.nl.wms.sch_manage.service.util.tasks.StOutTask;
import org.nl.wms.sch_manage.service.util.tasks.jb.JbUpAgvTask;
import org.nl.wms.warehouse_manage.enums.IOSConstant;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
@@ -46,6 +48,7 @@ import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMappe
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -69,6 +72,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
@Resource
private IStructattrService iStructattrService;
@Resource
private ISchBasePointService pointService;
/**
* 载具扩展属性mapper
@@ -94,6 +99,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
@Resource
private IMdPbGroupplateService iMdPbGroupPlateService;
@Autowired
private JbUpAgvTask jbUpAgvTask;
@Override
@@ -575,7 +582,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis.setSect_id(outAllocation.getSect_id());
ioStorInvDis.setPcsn(outAllocation.getPcsn());
ioStorInvDis.setMaterial_id(outAllocation.getMaterial_id());
ioStorInvDis.setMaterial_code(outAllocation.getMaterial_code());
// ioStorInvDis.setMaterial_code(outAllocation.getMaterial_code());
ioStorInvDis.setSect_name(outAllocation.getSect_name());
ioStorInvDis.setSect_code(outAllocation.getSect_code());
ioStorInvDis.setStruct_id(outAllocation.getStruct_id());
@@ -753,7 +760,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
double allocation_canuse_qty = 0;
for (int i = 0; i < rows.size(); i++){
JSONObject ivt = rows.getJSONObject(i);
double canuse_qty = ivt.getDoubleValue("canuse_qty");
double canuse_qty = ivt.getDoubleValue("qty");
//分配明细
IOStorInvDis ioStorInvDis = new IOStorInvDis();
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId());
@@ -763,6 +770,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
ioStorInvDis.setSect_id(ivt.getString("sect_id"));
ioStorInvDis.setPcsn(ivt.getString("pcsn"));
ioStorInvDis.setMaterial_id(dtl.getMaterial_id());
ioStorInvDis.setMaterial_code(dtl.getMaterial_code());
ioStorInvDis.setSect_name(ivt.getString("sect_name"));
ioStorInvDis.setSect_code(ivt.getString("sect_code"));
ioStorInvDis.setStruct_id(ivt.getString("struct_id"));
@@ -952,19 +960,49 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
if (ObjectUtil.isEmpty(ioStorInvDisList)){
throw new BadRequestException("当前没有可设置的分配明细");
}
String task_id = "";
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
//创建任务
JSONObject task_form = new JSONObject();
task_form.put("task_type", "STOutTask");
task_form.put("TaskCode",CodeUtil.getNewCode("TASK_CODE"));
task_form.put("PickingLocation", ioStorInvDis.getStruct_code());
task_form.put("PlacedLocation", point_code);
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
if ("1012".equals(ioStorInv.getBill_type())) {
// 解包需要单独操作
SchBasePoint ckPoint = pointService.getById(point_code);
SchBasePoint outPointP = pointService.getById(ckPoint.getParent_point_code());
SchBasePoint inPoint = pointService.getNotTaskByRegionAndType(outPointP.getRegion_code(), "3");
SchBasePoint outPoint = pointService.getNotTaskByRegionAndType(outPointP.getRegion_code(), "4");
if (ObjectUtil.isEmpty(inPoint) || ObjectUtil.isEmpty(outPoint)) {
throw new BadRequestException("解包机输送线点位不存在或者存在任务!");
}
JSONObject task_form = new JSONObject();
task_form.put("task_type", "JbUpAgvTask");
task_form.put("order_id", whereJson.getString("order_id"));
task_form.put("TaskCode", CodeUtil.getNewCode("TASK_CODE"));
task_form.put("point_code1", ioStorInvDis.getStruct_code());
task_form.put("point_code2", inPoint.getPoint_code());
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
if ("2".equals(outPoint.getPoint_status())) {
// 四点任务
task_form.put("point_code3", outPoint.getPoint_code());
task_form.put("point_code4", ioStorInvDis.getStruct_code());
task_form.put("vehicle_code2", outPoint.getVehicle_code());
}
task_id = jbUpAgvTask.create(task_form);
inPoint.setIng_task_code(task_id);
if ("2".equals(outPoint.getPoint_status())) {
outPoint.setIng_task_code(task_id);
}
pointService.updateBatchById(Arrays.asList(inPoint, outPoint));
} else {
//创建任务
JSONObject task_form = new JSONObject();
task_form.put("task_type", "STOutTask");
task_form.put("TaskCode",CodeUtil.getNewCode("TASK_CODE"));
task_form.put("PickingLocation", ioStorInvDis.getStruct_code());
task_form.put("PlacedLocation", point_code);
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask");
String task_id = stOutTask.create(task_form);
task_id = stOutTask.create(task_form);
}
//分配明细表更新任务相关数据
IOStorInvDis dis = new IOStorInvDis();