|
@ -1,32 +1,52 @@ |
|
|
package org.nl.wms.pda.ios_manage.service.impl; |
|
|
package org.nl.wms.pda.ios_manage.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
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.MapOf; |
|
|
import org.nl.common.utils.MapOf; |
|
|
|
|
|
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.service.IMdMeMaterialbaseService; |
|
|
import org.nl.wms.basedata_manage.service.IStructattrService; |
|
|
import org.nl.wms.basedata_manage.service.IStructattrService; |
|
|
|
|
|
import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase; |
|
|
|
|
|
import org.nl.wms.basedata_manage.service.dao.Structattr; |
|
|
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto; |
|
|
import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto; |
|
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; |
|
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; |
|
|
import org.nl.wms.pda.ios_manage.service.PdaIosOutService; |
|
|
import org.nl.wms.pda.ios_manage.service.PdaIosOutService; |
|
|
import org.nl.wms.pda.util.PdaResponse; |
|
|
import org.nl.wms.pda.util.PdaResponse; |
|
|
|
|
|
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.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.warehouse_management.enums.IOSConstant; |
|
|
import org.nl.wms.warehouse_management.enums.IOSEnum; |
|
|
import org.nl.wms.warehouse_management.enums.IOSEnum; |
|
|
import org.nl.wms.warehouse_management.service.IRawAssistIStorService; |
|
|
import org.nl.wms.warehouse_management.service.IRawAssistIStorService; |
|
|
import org.nl.wms.warehouse_management.service.dao.GroupPlate; |
|
|
import org.nl.wms.warehouse_management.service.dao.GroupPlate; |
|
|
|
|
|
import org.nl.wms.warehouse_management.service.dao.IOStorInv; |
|
|
|
|
|
import org.nl.wms.warehouse_management.service.dao.IOStorInvDis; |
|
|
|
|
|
import org.nl.wms.warehouse_management.service.dao.IOStorInvDtl; |
|
|
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper; |
|
|
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDisMapper; |
|
|
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper; |
|
|
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvDtlMapper; |
|
|
|
|
|
import org.nl.wms.warehouse_management.service.dao.mapper.IOStorInvMapper; |
|
|
import org.nl.wms.warehouse_management.service.dao.mapper.MdPbGroupplateMapper; |
|
|
import org.nl.wms.warehouse_management.service.dao.mapper.MdPbGroupplateMapper; |
|
|
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils; |
|
|
import org.nl.wms.warehouse_management.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 java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
@ -48,7 +68,17 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private MdPbGroupplateMapper mdPbGroupplateMapper; |
|
|
private MdPbGroupplateMapper mdPbGroupplateMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 出入库单主表 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Resource |
|
|
|
|
|
private IOStorInvMapper ioStorInvMapper; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 基础物料服务 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IMdMeMaterialbaseService iMdMeMaterialbaseService; |
|
|
/** |
|
|
/** |
|
|
* 载具扩展属性服务 |
|
|
* 载具扩展属性服务 |
|
|
*/ |
|
|
*/ |
|
@ -91,6 +121,13 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private StOutTask stOutTask; |
|
|
private StOutTask stOutTask; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 手持任务 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private PdaPointTask pdaPointTask; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 入库服务服务 |
|
|
* 入库服务服务 |
|
|
*/ |
|
|
*/ |
|
@ -128,6 +165,56 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public PdaResponse materialConfirm(JSONObject whereJson) { |
|
|
public PdaResponse materialConfirm(JSONObject whereJson) { |
|
|
|
|
|
//创建出库单/明细/分配
|
|
|
|
|
|
GroupPlate plateDao = mdPbGroupplateMapper.selectOne( |
|
|
|
|
|
new LambdaQueryWrapper<GroupPlate>() |
|
|
|
|
|
.eq(GroupPlate::getStoragevehicle_code, whereJson.getString("group_id"))); |
|
|
|
|
|
Structattr sectDao = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>() |
|
|
|
|
|
.eq(Structattr::getStruct_code, whereJson.getString("struct_code"))); |
|
|
|
|
|
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_id()); |
|
|
|
|
|
whereJson.put("material_id", materDao.getMaterial_id()); |
|
|
|
|
|
whereJson.put("material_code", materDao.getMaterial_code()); |
|
|
|
|
|
whereJson.put("store_id", sectDao.getStor_id()); |
|
|
|
|
|
whereJson.put("store_code", sectDao.getStor_code()); |
|
|
|
|
|
whereJson.put("store_name", sectDao.getStor_name()); |
|
|
|
|
|
whereJson.put("sec", sectDao.getSect_id()); |
|
|
|
|
|
whereJson.put("qty", plateDao.getQty()); |
|
|
|
|
|
whereJson.put("pcsn", plateDao.getPcsn()); |
|
|
|
|
|
whereJson.put("unit_id", plateDao.getQty_unit_id()); |
|
|
|
|
|
whereJson.put("unit_name", plateDao.getQty_unit_name()); |
|
|
|
|
|
//创建出库单据
|
|
|
|
|
|
String disId = createOutBills(whereJson); |
|
|
|
|
|
//锁定货位
|
|
|
|
|
|
JSONObject lock_map = new JSONObject(); |
|
|
|
|
|
lock_map.put("struct_code", whereJson.getString("struct_code")); |
|
|
|
|
|
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁")); |
|
|
|
|
|
iStructattrService.updateStatusByCode("0", lock_map); |
|
|
|
|
|
//创建任务
|
|
|
|
|
|
JSONObject taskForm = new JSONObject(); |
|
|
|
|
|
taskForm.put("task_type", "STOutTask"); |
|
|
|
|
|
taskForm.put("TaskCode", CodeUtil.getNewCode("TASK_CODE")); |
|
|
|
|
|
taskForm.put("PickingLocation", whereJson.getString("struct_code")); |
|
|
|
|
|
taskForm.put("PlacedLocation", whereJson.getString("siteCode")); |
|
|
|
|
|
taskForm.put("vehicle_code", whereJson.getString("storagevehicle_code")); |
|
|
|
|
|
StOutTask stOutTask = SpringContextHolder.getBean("STOutTask"); |
|
|
|
|
|
String taskId = stOutTask.create(taskForm); |
|
|
|
|
|
//更新任务id
|
|
|
|
|
|
ioStorInvDisMapper.update(new IOStorInvDis(), new LambdaUpdateWrapper<IOStorInvDis>() |
|
|
|
|
|
.set(IOStorInvDis::getTask_id, taskId) |
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id, disId) |
|
|
|
|
|
); |
|
|
|
|
|
//更新组盘记录表
|
|
|
|
|
|
mdPbGroupplateMapper.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class) |
|
|
|
|
|
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")) |
|
|
|
|
|
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id")) |
|
|
|
|
|
); |
|
|
|
|
|
return PdaResponse.requestOk(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public PdaResponse vehicleOutConfirm(JSONObject whereJson) { |
|
|
//锁定货位
|
|
|
//锁定货位
|
|
|
JSONObject lock_map = new JSONObject(); |
|
|
JSONObject lock_map = new JSONObject(); |
|
|
lock_map.put("struct_code", whereJson.getString("struct_code")); |
|
|
lock_map.put("struct_code", whereJson.getString("struct_code")); |
|
@ -151,6 +238,110 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
return PdaResponse.requestOk(); |
|
|
return PdaResponse.requestOk(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String createOutBills(JSONObject whereJson) { |
|
|
|
|
|
String now = DateUtil.now(); |
|
|
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId(); |
|
|
|
|
|
String nickName = SecurityUtils.getCurrentNickName(); |
|
|
|
|
|
//主单
|
|
|
|
|
|
JSONObject io_mst = new JSONObject(); |
|
|
|
|
|
String iostorinv_id = IdUtil.getStringId(); |
|
|
|
|
|
String bill_code = CodeUtil.getNewCode("IN_STORE_CODE"); |
|
|
|
|
|
io_mst.put("iostorinv_id", iostorinv_id); |
|
|
|
|
|
io_mst.put("bill_code", bill_code); |
|
|
|
|
|
io_mst.put("io_type", IOSEnum.IO_TYPE.code("出库")); |
|
|
|
|
|
io_mst.put("bill_type", StatusEnum.IOBILL_TYPE_OUT.code("生产出库")); |
|
|
|
|
|
io_mst.put("biz_date", now.substring(0, 10)); |
|
|
|
|
|
io_mst.put("stor_id", whereJson.get("store_id")); |
|
|
|
|
|
io_mst.put("stor_code", whereJson.get("store_code")); |
|
|
|
|
|
io_mst.put("stor_name", whereJson.get("store_name")); |
|
|
|
|
|
io_mst.put("detail_count", 1); |
|
|
|
|
|
io_mst.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); |
|
|
|
|
|
io_mst.put("create_mode", IOSEnum.CREATE_MODE.code("PC产生")); |
|
|
|
|
|
io_mst.put("input_optid", currentUserId + ""); |
|
|
|
|
|
io_mst.put("input_optname", nickName); |
|
|
|
|
|
io_mst.put("input_time", now); |
|
|
|
|
|
io_mst.put("update_optid", currentUserId + ""); |
|
|
|
|
|
io_mst.put("update_optname", nickName); |
|
|
|
|
|
io_mst.put("update_time", now); |
|
|
|
|
|
io_mst.put("is_delete", BaseDataEnum.IS_YES_NOT.code("否")); |
|
|
|
|
|
io_mst.put("is_upload", BaseDataEnum.IS_YES_NOT.code("否")); |
|
|
|
|
|
Long deptId = SecurityUtils.getDeptId(); |
|
|
|
|
|
io_mst.put("sysdeptid", deptId + ""); |
|
|
|
|
|
io_mst.put("syscompanyid", deptId + ""); |
|
|
|
|
|
io_mst.put("qty", whereJson.get("store_code")); |
|
|
|
|
|
ioStorInvMapper.insert(io_mst.toJavaObject(IOStorInv.class)); |
|
|
|
|
|
//明细
|
|
|
|
|
|
JSONObject ioStorInvDtl = new JSONObject(); |
|
|
|
|
|
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId()); |
|
|
|
|
|
ioStorInvDtl.put("iostorinv_id", iostorinv_id); |
|
|
|
|
|
ioStorInvDtl.put("seq_no", "1"); |
|
|
|
|
|
ioStorInvDtl.put("material_id", whereJson.get("material_id")); |
|
|
|
|
|
ioStorInvDtl.put("material_code", whereJson.get("material_code")); |
|
|
|
|
|
ioStorInvDtl.put("Pcsn", whereJson.get("pcsn")); |
|
|
|
|
|
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); |
|
|
|
|
|
ioStorInvDtl.put("qty_unit_id", whereJson.get("unit_id")); |
|
|
|
|
|
ioStorInvDtl.put("qty_unit_name", whereJson.get("unit_name")); |
|
|
|
|
|
ioStorInvDtl.put("assign_qty", whereJson.get("qty")); |
|
|
|
|
|
ioStorInvDtl.put("unassign_qty", "0"); |
|
|
|
|
|
ioStorInvDtl.put("plan_qty", whereJson.get("qty")); |
|
|
|
|
|
ioStorInvDtlMapper.insert(ioStorInvDtl.toJavaObject(IOStorInvDtl.class)); |
|
|
|
|
|
//分配
|
|
|
|
|
|
JSONObject dis = new JSONObject(); |
|
|
|
|
|
String disId = IdUtil.getStringId(); |
|
|
|
|
|
dis.put("iostorinvdis_id", disId); |
|
|
|
|
|
dis.put("iostorinv_id", iostorinv_id); |
|
|
|
|
|
dis.put("iostorinvdtl_id", ioStorInvDtl.getString("iostorinvdtl_id")); |
|
|
|
|
|
dis.put("seq_no", 1); |
|
|
|
|
|
dis.put("material_id", whereJson.get("material_id")); |
|
|
|
|
|
dis.put("material_code", whereJson.get("material_code")); |
|
|
|
|
|
dis.put("pcsn", whereJson.get("pcsn")); |
|
|
|
|
|
dis.put("storagevehicle_code", whereJson.get("storagevehicle_code")); |
|
|
|
|
|
dis.put("work_status", IOSEnum.INBILL_DIS_STATUS.code("执行中")); |
|
|
|
|
|
dis.put("is_issued", BaseDataEnum.IS_YES_NOT.code("否")); |
|
|
|
|
|
dis.put("qty_unit_id", whereJson.get("unit_id")); |
|
|
|
|
|
dis.put("qty_unit_name", whereJson.get("unit_name")); |
|
|
|
|
|
dis.put("plan_qty", whereJson.get("qty")); |
|
|
|
|
|
ioStorInvDisMapper.insert(dis.toJavaObject(IOStorInvDis.class)); |
|
|
|
|
|
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(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
@ -163,10 +354,12 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
GroupPlate groupPlate = mdPbGroupplateMapper.selectById(whereJson.getString("group_id")); |
|
|
GroupPlate groupPlate = mdPbGroupplateMapper.selectById(whereJson.getString("group_id")); |
|
|
//更新组盘信息
|
|
|
//更新组盘信息
|
|
|
LambdaUpdateWrapper<GroupPlate> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
LambdaUpdateWrapper<GroupPlate> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
|
|
//出库确认
|
|
|
if ("1" .equals(whereJson.getString("type"))) { |
|
|
if ("1" .equals(whereJson.getString("type"))) { |
|
|
BigDecimal qty = groupPlate.getQty().subtract(groupPlate.getFrozen_qty()).abs(); |
|
|
BigDecimal qty = groupPlate.getQty().subtract(groupPlate.getFrozen_qty()).abs(); |
|
|
updateWrapper.set(GroupPlate::getQty, qty).set(GroupPlate::getFrozen_qty, 0); |
|
|
updateWrapper.set(GroupPlate::getQty, qty).set(GroupPlate::getFrozen_qty, 0); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
//强制确认
|
|
|
updateWrapper.set(GroupPlate::getQty, 0).set(GroupPlate::getFrozen_qty, 0); |
|
|
updateWrapper.set(GroupPlate::getQty, 0).set(GroupPlate::getFrozen_qty, 0); |
|
|
} |
|
|
} |
|
|
updateWrapper.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")).eq(GroupPlate::getGroup_id, whereJson.getString("group_id")); |
|
|
updateWrapper.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库")).eq(GroupPlate::getGroup_id, whereJson.getString("group_id")); |
|
@ -174,4 +367,45 @@ public class PdaIosOutServiceImpl implements PdaIosOutService { |
|
|
// iSchBasePointService.unLockPoint(pointDao.getPoint_code());
|
|
|
// iSchBasePointService.unLockPoint(pointDao.getPoint_code());
|
|
|
return PdaResponse.requestOk(); |
|
|
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(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|