|
@ -2,13 +2,10 @@ package org.nl.wms.pda_manage.ios_manage.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import cn.hutool.http.HttpStatus; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
import org.nl.common.exception.BadRequestException; |
|
|
import org.nl.common.utils.CodeUtil; |
|
|
import org.nl.common.utils.CodeUtil; |
|
|
import org.nl.common.utils.IdUtil; |
|
|
import org.nl.common.utils.IdUtil; |
|
@ -16,27 +13,17 @@ import org.nl.common.utils.MapOf; |
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
import org.nl.config.SpringContextHolder; |
|
|
import org.nl.config.SpringContextHolder; |
|
|
import org.nl.wms.basedata_manage.enums.BaseDataEnum; |
|
|
import org.nl.wms.basedata_manage.enums.BaseDataEnum; |
|
|
import org.nl.wms.basedata_manage.service.IBsrealStorattrService; |
|
|
|
|
|
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService; |
|
|
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService; |
|
|
import org.nl.wms.basedata_manage.service.ISectattrService; |
|
|
|
|
|
import org.nl.wms.basedata_manage.service.IStructattrService; |
|
|
import org.nl.wms.basedata_manage.service.IStructattrService; |
|
|
import org.nl.wms.basedata_manage.service.dao.*; |
|
|
import org.nl.wms.basedata_manage.service.dao.*; |
|
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; |
|
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; |
|
|
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO; |
|
|
|
|
|
import org.nl.wms.basedata_manage.service.dto.StrategyStructParam; |
|
|
|
|
|
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService; |
|
|
import org.nl.wms.pda_manage.ios_manage.service.PdaIosOutService; |
|
|
import org.nl.wms.pda_manage.util.PdaResponse; |
|
|
import org.nl.wms.pda_manage.util.PdaResponse; |
|
|
import org.nl.wms.sch_manage.enums.StatusEnum; |
|
|
import org.nl.wms.sch_manage.enums.StatusEnum; |
|
|
import org.nl.wms.sch_manage.enums.TaskEnum; |
|
|
|
|
|
import org.nl.wms.sch_manage.service.ISchBasePointService; |
|
|
import org.nl.wms.sch_manage.service.ISchBasePointService; |
|
|
import org.nl.wms.sch_manage.service.dao.SchBasePoint; |
|
|
import org.nl.wms.sch_manage.service.dao.SchBasePoint; |
|
|
import org.nl.wms.sch_manage.service.util.AbstractTask; |
|
|
|
|
|
import org.nl.wms.sch_manage.service.util.tasks.PdaPointTask; |
|
|
|
|
|
import org.nl.wms.sch_manage.service.util.tasks.StOutTask; |
|
|
import org.nl.wms.sch_manage.service.util.tasks.StOutTask; |
|
|
import org.nl.wms.sch_manage.service.util.tasks.VehicleOutTask; |
|
|
|
|
|
import org.nl.wms.warehouse_manage.enums.IOSConstant; |
|
|
|
|
|
import org.nl.wms.warehouse_manage.enums.IOSEnum; |
|
|
import org.nl.wms.warehouse_manage.enums.IOSEnum; |
|
|
import org.nl.wms.warehouse_manage.service.IRawAssistIStorService; |
|
|
|
|
|
import org.nl.wms.warehouse_manage.service.dao.GroupPlate; |
|
|
import org.nl.wms.warehouse_manage.service.dao.GroupPlate; |
|
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInv; |
|
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInv; |
|
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInvDis; |
|
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInvDis; |
|
@ -45,17 +32,11 @@ import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvDisMapper; |
|
|
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvDtlMapper; |
|
|
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvDtlMapper; |
|
|
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvMapper; |
|
|
import org.nl.wms.warehouse_manage.service.dao.mapper.IOStorInvMapper; |
|
|
import org.nl.wms.warehouse_manage.service.dao.mapper.MdPbGroupplateMapper; |
|
|
import org.nl.wms.warehouse_manage.service.dao.mapper.MdPbGroupplateMapper; |
|
|
import org.nl.wms.warehouse_manage.service.util.UpdateIvtUtils; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS; |
|
|
import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS; |
|
|
|
|
|
|
|
@ -69,29 +50,21 @@ import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS; |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
@Autowired |
|
|
|
|
|
private Map<String, AbstractTask> applyTaskMap; |
|
|
|
|
|
/** |
|
|
/** |
|
|
* 组盘记录mapper |
|
|
* 组盘记录mapper |
|
|
*/ |
|
|
*/ |
|
|
@Autowired |
|
|
@Resource |
|
|
private MdPbGroupplateMapper mdPbGroupplateMapper; |
|
|
private MdPbGroupplateMapper mdPbGroupplateMapper; |
|
|
/** |
|
|
/** |
|
|
* 库区服务 |
|
|
* 点位服务 |
|
|
*/ |
|
|
*/ |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ISectattrService iSectattrService; |
|
|
private ISchBasePointService iSchBasePointService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 出入库单主表 |
|
|
* 出入库单主表 |
|
|
*/ |
|
|
*/ |
|
|
@Resource |
|
|
@Resource |
|
|
private IOStorInvMapper ioStorInvMapper; |
|
|
private IOStorInvMapper ioStorInvMapper; |
|
|
/** |
|
|
|
|
|
* 仓库服务 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IBsrealStorattrService iSrealStorattrService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 基础物料服务 |
|
|
* 基础物料服务 |
|
@ -101,15 +74,9 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
/** |
|
|
/** |
|
|
* 载具扩展属性服务 |
|
|
* 载具扩展属性服务 |
|
|
*/ |
|
|
*/ |
|
|
@Autowired |
|
|
@Resource |
|
|
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper; |
|
|
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper; |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 点位服务 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private ISchBasePointService iSchBasePointService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 仓位服务 |
|
|
* 仓位服务 |
|
|
*/ |
|
|
*/ |
|
@ -119,41 +86,15 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
/** |
|
|
/** |
|
|
* 出入库单明细mapper |
|
|
* 出入库单明细mapper |
|
|
*/ |
|
|
*/ |
|
|
@Autowired |
|
|
@Resource |
|
|
private IOStorInvDtlMapper ioStorInvDtlMapper; |
|
|
private IOStorInvDtlMapper ioStorInvDtlMapper; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 出入库单分配明细mapper |
|
|
* 出入库单分配明细mapper |
|
|
*/ |
|
|
*/ |
|
|
@Autowired |
|
|
@Resource |
|
|
private IOStorInvDisMapper ioStorInvDisMapper; |
|
|
private IOStorInvDisMapper ioStorInvDisMapper; |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 更新库存服务 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private UpdateIvtUtils updateIvtUtils; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 出库任务类 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private StOutTask stOutTask; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 手持任务 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private PdaPointTask pdaPointTask; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 入库服务服务 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IRawAssistIStorService iRawAssistIStorService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PdaResponse getDtl(JSONObject whereJson) { |
|
|
public PdaResponse getDtl(JSONObject whereJson) { |
|
|
return PdaResponse.requestParamOk(mdPbStoragevehicleextMapper.getIosDtl(whereJson)); |
|
|
return PdaResponse.requestParamOk(mdPbStoragevehicleextMapper.getIosDtl(whereJson)); |
|
@ -161,14 +102,17 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PdaResponse getMaterialDtl(JSONObject whereJson) { |
|
|
public JSONObject getMaterialDtl(JSONObject whereJson) { |
|
|
List<StructattrVechielDto> list = iStructattrService.collectVechicle( |
|
|
List<JSONObject> list = iStructattrService.collectVechicle2( |
|
|
MapOf.of("search", whereJson.getString("search"), |
|
|
MapOf.of("search", whereJson.getString("search"), |
|
|
"stor_code", "XB01", |
|
|
"sect_id", whereJson.getString("sect_id"), |
|
|
"status", GROUP_PLATE_STATUS.code("入库"), |
|
|
"status", GROUP_PLATE_STATUS.code("入库"), |
|
|
"is_lock", "false", |
|
|
|
|
|
"order_by", "gro.create_time asc")); |
|
|
"order_by", "gro.create_time asc")); |
|
|
return PdaResponse.requestParamOk(list); |
|
|
JSONObject ret = new JSONObject(); |
|
|
|
|
|
ret.put("status", String.valueOf(HttpStatus.HTTP_OK)); |
|
|
|
|
|
ret.put("message","查询成功"); |
|
|
|
|
|
ret.put("data",list); |
|
|
|
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -183,140 +127,67 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public PdaResponse materialConfirm(JSONObject whereJson) { |
|
|
public JSONObject callMaterialConfirm(JSONObject param) { |
|
|
|
|
|
//出库输送线点
|
|
|
|
|
|
String outPoint = param.getString("siteCode"); |
|
|
|
|
|
if (ObjectUtil.isEmpty(outPoint)) { |
|
|
|
|
|
throw new BadRequestException("点位不能为空!"); |
|
|
|
|
|
} |
|
|
|
|
|
//校验点位是否存在
|
|
|
|
|
|
SchBasePoint schBasePoint = iSchBasePointService |
|
|
|
|
|
.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, outPoint)); |
|
|
|
|
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
|
|
|
|
|
throw new BadRequestException("点位不存在:"+outPoint); |
|
|
|
|
|
} |
|
|
|
|
|
//载具信息
|
|
|
|
|
|
JSONObject obj = param.getJSONObject("obj"); |
|
|
//创建出库单/明细/分配
|
|
|
//创建出库单/明细/分配
|
|
|
GroupPlate plateDao = mdPbGroupplateMapper.selectOne( |
|
|
GroupPlate plateDao = mdPbGroupplateMapper.selectOne( |
|
|
new LambdaQueryWrapper<GroupPlate>() |
|
|
new LambdaQueryWrapper<GroupPlate>() |
|
|
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id"))); |
|
|
.eq(GroupPlate::getGroup_id, obj.getString("group_id"))); |
|
|
Structattr sectDao = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>() |
|
|
Structattr sectDao = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>() |
|
|
.eq(Structattr::getStruct_code, whereJson.getString("struct_code"))); |
|
|
.eq(Structattr::getStruct_code, obj.getString("struct_code"))); |
|
|
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_id()); |
|
|
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_id()); |
|
|
whereJson.put("material_id", materDao.getMaterial_id()); |
|
|
obj.put("material_id", materDao.getMaterial_id()); |
|
|
whereJson.put("material_code", materDao.getMaterial_code()); |
|
|
obj.put("material_code", materDao.getMaterial_code()); |
|
|
whereJson.put("store_id", sectDao.getStor_id()); |
|
|
obj.put("store_id", sectDao.getStor_id()); |
|
|
whereJson.put("store_code", sectDao.getStor_code()); |
|
|
obj.put("store_code", sectDao.getStor_code()); |
|
|
whereJson.put("store_name", sectDao.getStor_name()); |
|
|
obj.put("store_name", sectDao.getStor_name()); |
|
|
whereJson.put("sec", sectDao.getSect_id()); |
|
|
obj.put("sec", sectDao.getSect_id()); |
|
|
whereJson.put("qty", plateDao.getQty()); |
|
|
obj.put("qty", plateDao.getQty()); |
|
|
whereJson.put("pcsn", plateDao.getPcsn()); |
|
|
obj.put("unit_id", plateDao.getQty_unit_id()); |
|
|
whereJson.put("unit_id", plateDao.getQty_unit_id()); |
|
|
obj.put("unit_name", plateDao.getQty_unit_name()); |
|
|
whereJson.put("unit_name", plateDao.getQty_unit_name()); |
|
|
|
|
|
//创建出库单据
|
|
|
//创建出库单据
|
|
|
String disId = createOutBills(whereJson); |
|
|
String disId = createOutBills(obj); |
|
|
//锁定货位
|
|
|
//锁定货位
|
|
|
JSONObject lock_map = new JSONObject(); |
|
|
JSONObject lock_map = new JSONObject(); |
|
|
lock_map.put("struct_code", whereJson.getString("struct_code")); |
|
|
lock_map.put("struct_code", obj.getString("struct_code")); |
|
|
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁")); |
|
|
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁")); |
|
|
iStructattrService.updateStatusByCode("0", lock_map); |
|
|
iStructattrService.updateStatusByCode("0", lock_map); |
|
|
//创建任务
|
|
|
//创建任务
|
|
|
JSONObject taskForm = new JSONObject(); |
|
|
JSONObject taskForm = new JSONObject(); |
|
|
taskForm.put("task_type", "STOutTask"); |
|
|
taskForm.put("task_type", "STOutTask"); |
|
|
taskForm.put("TaskCode", CodeUtil.getNewCode("TASK_CODE")); |
|
|
taskForm.put("TaskCode", CodeUtil.getNewCode("TASK_CODE")); |
|
|
taskForm.put("PickingLocation", whereJson.getString("struct_code")); |
|
|
taskForm.put("PickingLocation", obj.getString("struct_code")); |
|
|
taskForm.put("PlacedLocation", whereJson.getString("siteCode")); |
|
|
taskForm.put("PlacedLocation",outPoint); |
|
|
taskForm.put("vehicle_code", whereJson.getString("storagevehicle_code")); |
|
|
taskForm.put("vehicle_code", obj.getString("storagevehicle_code")); |
|
|
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask"); |
|
|
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask"); |
|
|
String taskId = stOutTask.create(taskForm); |
|
|
String taskId = stOutTask.create(taskForm); |
|
|
//更新任务id
|
|
|
//更新任务id
|
|
|
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<IOStorInvDis>() |
|
|
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<IOStorInvDis>() |
|
|
.set(IOStorInvDis::getTask_id, taskId) |
|
|
.set(IOStorInvDis::getTask_id, taskId) |
|
|
|
|
|
.set(IOStorInvDis::getPoint_code,outPoint) |
|
|
.eq(IOStorInvDis::getIostorinvdis_id, disId) |
|
|
.eq(IOStorInvDis::getIostorinvdis_id, disId) |
|
|
); |
|
|
); |
|
|
//更新组盘记录表
|
|
|
//更新组盘记录表
|
|
|
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class) |
|
|
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class) |
|
|
.set(GroupPlate::getFrozen_qty, plateDao.getQty()) |
|
|
.set(GroupPlate::getFrozen_qty, plateDao.getQty()) |
|
|
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id")) |
|
|
.eq(GroupPlate::getGroup_id, obj.getString("group_id")) |
|
|
); |
|
|
); |
|
|
return PdaResponse.requestOk(); |
|
|
JSONObject ret = new JSONObject(); |
|
|
} |
|
|
ret.put("status", String.valueOf(HttpStatus.HTTP_OK)); |
|
|
|
|
|
ret.put("message","操作成功"); |
|
|
|
|
|
return ret; |
|
|
/** |
|
|
|
|
|
* 空载具出库 |
|
|
|
|
|
* 1:托盘2料箱 |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public PdaResponse vehicleOutConfirm(JSONObject whereJson) { |
|
|
|
|
|
long qty = 1L; |
|
|
|
|
|
LambdaQueryWrapper<MdMeMaterialbase> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
//空料箱出库
|
|
|
|
|
|
if (StringUtils.isNotBlank(whereJson.getString("qty"))) { |
|
|
|
|
|
qty = whereJson.getLongValue("qty"); |
|
|
|
|
|
if (qty > 6) { |
|
|
|
|
|
throw new BadRequestException("一次性只能输入小于7以内的载具数量"); |
|
|
|
|
|
} |
|
|
|
|
|
queryWrapper.eq(MdMeMaterialbase::getMaterial_id, StatusEnum.VEHICLE_TYPE.code("空料箱")); |
|
|
|
|
|
} else { |
|
|
|
|
|
queryWrapper.eq(MdMeMaterialbase::getMaterial_id, StatusEnum.VEHICLE_TYPE.code("空托盘")); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getOne(queryWrapper); |
|
|
|
|
|
if (materDao == null) { |
|
|
|
|
|
throw new BadRequestException("未找到空载具物料信息!"); |
|
|
|
|
|
} |
|
|
|
|
|
whereJson.put("material_id", materDao.getMaterial_id()); |
|
|
|
|
|
whereJson.put("material_code", materDao.getMaterial_code()); |
|
|
|
|
|
Sectattr sectattr = iSectattrService.getById(new LambdaQueryWrapper<>(Sectattr.class) |
|
|
|
|
|
.eq(Sectattr::getSect_id, whereJson.getString("sect_id")) |
|
|
|
|
|
.eq(Sectattr::getIs_used, BaseDataEnum.IS_YES_NOT.code("是")) |
|
|
|
|
|
); |
|
|
|
|
|
if (ObjectUtil.isEmpty(sectattr)) { |
|
|
|
|
|
throw new BadRequestException("该仓位所属的库区已禁用,请先启用该库区!"); |
|
|
|
|
|
} |
|
|
|
|
|
BsrealStorattr storeDao = iSrealStorattrService.getById(sectattr.getStor_id()); |
|
|
|
|
|
whereJson.put("stor_code", storeDao.getStor_code()); |
|
|
|
|
|
whereJson.put("sect_code", sectattr.getSect_code()); |
|
|
|
|
|
StrategyStructParam strategyStructParam = StrategyStructParam.builder() |
|
|
|
|
|
.ioType(whereJson.getString(StatusEnum.STRATEGY_TYPE.code("出库"))) |
|
|
|
|
|
.sect_code(whereJson.getString("sect_code")) |
|
|
|
|
|
.stor_code(whereJson.getString("stor_code")) |
|
|
|
|
|
.material_code(whereJson.getString("material_id")) |
|
|
|
|
|
.material_code(whereJson.getString("material_code")) |
|
|
|
|
|
.qty(BigDecimal.valueOf(qty)) |
|
|
|
|
|
.build(); |
|
|
|
|
|
List<StrategyStructMaterialVO> structList = iStructattrService.outBoundSectDiv(strategyStructParam); |
|
|
|
|
|
if (CollectionUtils.isEmpty(structList)) { |
|
|
|
|
|
throw new BadRequestException("无可用库存!"); |
|
|
|
|
|
} |
|
|
|
|
|
structList.forEach(r -> { |
|
|
|
|
|
//创建任务
|
|
|
|
|
|
JSONObject taskForm = new JSONObject(); |
|
|
|
|
|
taskForm.put("task_type", IOSConstant.VEHICLE_OUT_TASK); |
|
|
|
|
|
taskForm.put("config_code", IOSConstant.VEHICLE_IN_TASK); |
|
|
|
|
|
taskForm.put("TaskCode", CodeUtil.getNewCode("TASK_CODE")); |
|
|
|
|
|
taskForm.put("PickingLocation", r.getStruct_code()); |
|
|
|
|
|
taskForm.put("PlacedLocation", whereJson.getString("siteCode")); |
|
|
|
|
|
taskForm.put("vehicle_code", r.getStoragevehicle_code()); |
|
|
|
|
|
VehicleOutTask vehicleOutTask = SpringContextHolder.getBean("VehicleOutTask"); |
|
|
|
|
|
applyTaskMap.get(IOSConstant.VEHICLE_IN_TASK).create(whereJson); |
|
|
|
|
|
vehicleOutTask.create(taskForm); |
|
|
|
|
|
}); |
|
|
|
|
|
//更新组盘记录表
|
|
|
|
|
|
Set<String> vehicleCodeSet = structList.stream() |
|
|
|
|
|
.map(StrategyStructMaterialVO::getStoragevehicle_code) |
|
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
mdPbGroupplateMapper.update( |
|
|
|
|
|
new GroupPlate(), |
|
|
|
|
|
new LambdaUpdateWrapper<GroupPlate>() |
|
|
|
|
|
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")) |
|
|
|
|
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")) |
|
|
|
|
|
.in(GroupPlate::getStoragevehicle_code, vehicleCodeSet) |
|
|
|
|
|
); |
|
|
|
|
|
//锁定仓位
|
|
|
|
|
|
Set<String> structCodeSet = structList.stream() |
|
|
|
|
|
.map(StrategyStructMaterialVO::getStruct_code) |
|
|
|
|
|
.collect(Collectors.toSet()); |
|
|
|
|
|
iStructattrService.update( |
|
|
|
|
|
new LambdaUpdateWrapper<Structattr>() |
|
|
|
|
|
.set(Structattr::getInv_id, null) |
|
|
|
|
|
.set(Structattr::getInv_code, null) |
|
|
|
|
|
.set(Structattr::getInv_type, null) |
|
|
|
|
|
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("出库锁")) |
|
|
|
|
|
.in(Structattr::getStruct_code, structCodeSet) |
|
|
|
|
|
); |
|
|
|
|
|
return PdaResponse.requestOk(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private String createOutBills(JSONObject whereJson) { |
|
|
private String createOutBills(JSONObject whereJson) { |
|
@ -358,7 +229,6 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
ioStorInvDtl.put("seq_no", "1"); |
|
|
ioStorInvDtl.put("seq_no", "1"); |
|
|
ioStorInvDtl.put("material_id", whereJson.get("material_id")); |
|
|
ioStorInvDtl.put("material_id", whereJson.get("material_id")); |
|
|
ioStorInvDtl.put("material_code", whereJson.get("material_code")); |
|
|
ioStorInvDtl.put("material_code", whereJson.get("material_code")); |
|
|
ioStorInvDtl.put("Pcsn", whereJson.get("pcsn")); |
|
|
|
|
|
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); |
|
|
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); |
|
|
ioStorInvDtl.put("qty_unit_id", whereJson.get("unit_id")); |
|
|
ioStorInvDtl.put("qty_unit_id", whereJson.get("unit_id")); |
|
|
ioStorInvDtl.put("qty_unit_name", whereJson.get("unit_name")); |
|
|
ioStorInvDtl.put("qty_unit_name", whereJson.get("unit_name")); |
|
@ -375,7 +245,6 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
dis.put("seq_no", 1); |
|
|
dis.put("seq_no", 1); |
|
|
dis.put("material_id", whereJson.get("material_id")); |
|
|
dis.put("material_id", whereJson.get("material_id")); |
|
|
dis.put("material_code", whereJson.get("material_code")); |
|
|
dis.put("material_code", whereJson.get("material_code")); |
|
|
dis.put("pcsn", whereJson.get("pcsn")); |
|
|
|
|
|
dis.put("storagevehicle_code", whereJson.get("storagevehicle_code")); |
|
|
dis.put("storagevehicle_code", whereJson.get("storagevehicle_code")); |
|
|
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("执行中")); |
|
|
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("执行中")); |
|
|
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否")); |
|
|
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否")); |
|
@ -386,124 +255,4 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
return disId; |
|
|
return disId; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public PdaResponse bindOrUnbind(JSONObject whereJson) { |
|
|
|
|
|
SchBasePoint sitePoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, whereJson.getString("siteCode")).eq(SchBasePoint::getIs_used, true)); |
|
|
|
|
|
if (sitePoint == null) { |
|
|
|
|
|
throw new BadRequestException("输入的站点编号有误或被禁用,请检查!"); |
|
|
|
|
|
} |
|
|
|
|
|
List<SchBasePoint> cxPointLists = iSchBasePointService.checkEndPointTask( |
|
|
|
|
|
null, |
|
|
|
|
|
null, |
|
|
|
|
|
StatusEnum.SORT_TYPE.code("升序"), null, sitePoint.getPoint_code(), null, false); |
|
|
|
|
|
if (ObjectUtils.isNotEmpty(cxPointLists)) { |
|
|
|
|
|
throw new BadRequestException("该货架正在执行输送任务,状态为锁定,请等任务完成再做绑定或解绑!"); |
|
|
|
|
|
} |
|
|
|
|
|
LambdaUpdateWrapper<SchBasePoint> wrapper = new LambdaUpdateWrapper<SchBasePoint>() |
|
|
|
|
|
.eq(SchBasePoint::getPoint_code, whereJson.getString("siteCode")); |
|
|
|
|
|
if ("1" .equals(whereJson.getString("mode"))) { |
|
|
|
|
|
if (StringUtils.isNotBlank(sitePoint.getVehicle_code())) { |
|
|
|
|
|
throw new BadRequestException("当前站点已绑定货架:" + sitePoint.getVehicle_code() + ",请先解绑:" + sitePoint.getVehicle_code()); |
|
|
|
|
|
} |
|
|
|
|
|
//校验是否在其他站点绑定
|
|
|
|
|
|
SchBasePoint shelfPoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getVehicle_code, whereJson.getString("shelfCode"))); |
|
|
|
|
|
if (shelfPoint != null) { |
|
|
|
|
|
throw new BadRequestException("当前货架已绑定在站点:" + sitePoint.getPoint_code() + ",请先解绑。"); |
|
|
|
|
|
} |
|
|
|
|
|
wrapper.set(SchBasePoint::getVehicle_code, whereJson.getString("shelfCode")) |
|
|
|
|
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("有货")); |
|
|
|
|
|
} else { |
|
|
|
|
|
wrapper.set(SchBasePoint::getVehicle_code, null) |
|
|
|
|
|
.set(SchBasePoint::getPoint_status, IOSEnum.POINT_STATUS.code("无货")); |
|
|
|
|
|
} |
|
|
|
|
|
wrapper.set(SchBasePoint::getUpdate_time, DateUtil.now()) |
|
|
|
|
|
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName()); |
|
|
|
|
|
iSchBasePointService.update(wrapper); |
|
|
|
|
|
return PdaResponse.requestOk(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 1.库存载具绑定到出库点位 |
|
|
|
|
|
* 2.更新组盘记录为出库 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public PdaResponse outStorageConfirm(JSONObject whereJson) { |
|
|
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
|
|
String now = DateUtil.now(); |
|
|
|
|
|
//获取终点
|
|
|
|
|
|
SchBasePoint pointDao = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getVehicle_code, whereJson.getString("storagevehicle_code"))); |
|
|
|
|
|
if (ObjectUtil.isEmpty(pointDao)) { |
|
|
|
|
|
throw new BadRequestException("未找到载具所在的点位信息,请检查"); |
|
|
|
|
|
} |
|
|
|
|
|
GroupPlate groupPlate = mdPbGroupplateMapper.selectById(whereJson.getString("group_id")); |
|
|
|
|
|
//更新组盘信息
|
|
|
|
|
|
LambdaUpdateWrapper<GroupPlate> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
|
|
//出库确认
|
|
|
|
|
|
if ("1".equals(whereJson.getString("type"))) { |
|
|
|
|
|
BigDecimal qty = groupPlate.getQty().subtract(groupPlate.getFrozen_qty()).abs(); |
|
|
|
|
|
updateWrapper.set(GroupPlate::getQty, qty).set(GroupPlate::getFrozen_qty, 0); |
|
|
|
|
|
} else { |
|
|
|
|
|
//强制确认
|
|
|
|
|
|
updateWrapper.set(GroupPlate::getQty, 0).set(GroupPlate::getFrozen_qty, 0); |
|
|
|
|
|
} |
|
|
|
|
|
updateWrapper.set(GroupPlate::getUpdate_id, currentUserId + "") |
|
|
|
|
|
.set(GroupPlate::getUpdate_name, nickName) |
|
|
|
|
|
.set(GroupPlate::getUpdate_time, now) |
|
|
|
|
|
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")) |
|
|
|
|
|
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id")); |
|
|
|
|
|
//更新组盘记录表
|
|
|
|
|
|
mdPbGroupplateMapper.update(new GroupPlate(), updateWrapper); |
|
|
|
|
|
//库存绑定到出库点。
|
|
|
|
|
|
iSchBasePointService.update(new SchBasePoint(), new LambdaUpdateWrapper<>(SchBasePoint.class) |
|
|
|
|
|
.set(SchBasePoint::getVehicle_code, groupPlate.getStoragevehicle_code()) |
|
|
|
|
|
.set(SchBasePoint::getIos_id, BaseDataEnum.IS_YES_NOT.code("是")) |
|
|
|
|
|
.eq(SchBasePoint::getPoint_code, pointDao.getPoint_code()) |
|
|
|
|
|
); |
|
|
|
|
|
return PdaResponse.requestOk(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public PdaResponse transferConfirm(JSONObject whereJson) { |
|
|
|
|
|
if (StringUtils.isBlank(whereJson.getString("region_code")) && StringUtils.isBlank(whereJson.getString("siteCode"))) { |
|
|
|
|
|
throw new BadRequestException("请选择目标站点或区域!"); |
|
|
|
|
|
} |
|
|
|
|
|
String pointCode = whereJson.getString("siteCode"); |
|
|
|
|
|
if (StringUtils.isBlank(pointCode)) { |
|
|
|
|
|
List<SchBasePoint> pointList = iSchBasePointService.list(new LambdaQueryWrapper<SchBasePoint>() |
|
|
|
|
|
.eq(SchBasePoint::getRegion_code, whereJson.getString("region_code")) |
|
|
|
|
|
.eq(SchBasePoint::getIs_used, 1) |
|
|
|
|
|
.isNull(SchBasePoint::getVehicle_code) |
|
|
|
|
|
.orderByAsc(SchBasePoint::getIn_order_seq)); |
|
|
|
|
|
if (CollectionUtils.isEmpty(pointList)) { |
|
|
|
|
|
throw new BadRequestException("该区域无可用空余点位!"); |
|
|
|
|
|
} |
|
|
|
|
|
pointCode = pointList.get(0).getPoint_code(); |
|
|
|
|
|
} |
|
|
|
|
|
//确定起点
|
|
|
|
|
|
SchBasePoint schBasePoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getVehicle_code, whereJson.getString("vehicle_code"))); |
|
|
|
|
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
|
|
|
|
|
throw new BadRequestException("未找到载具所在的点位信息,请检查"); |
|
|
|
|
|
} |
|
|
|
|
|
// 生成转运任务
|
|
|
|
|
|
JSONObject task = new JSONObject(); |
|
|
|
|
|
task.put("config_code", IOSConstant.PDA_POINT_TASK); |
|
|
|
|
|
task.put("point_code1", schBasePoint.getPoint_code()); |
|
|
|
|
|
task.put("point_code2", pointCode); |
|
|
|
|
|
task.put("vehicle_code", whereJson.getString("storagevehicle_code")); |
|
|
|
|
|
task.put("Priority", TaskEnum.ACS_PRIORITY.code("1")); |
|
|
|
|
|
pdaPointTask.create(task); |
|
|
|
|
|
// 更新起点绑定id
|
|
|
|
|
|
iSchBasePointService.update( |
|
|
|
|
|
new UpdateWrapper<SchBasePoint>().lambda() |
|
|
|
|
|
.set(SchBasePoint::getIos_id, null) |
|
|
|
|
|
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code()) |
|
|
|
|
|
); |
|
|
|
|
|
return PdaResponse.requestOk(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|