|
|
@ -1,17 +1,22 @@ |
|
|
|
package org.nl.wms.pda_manage.sch_manage.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.http.HttpStatus; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleinfoService; |
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.wms.basedata_manage.service.IStructattrService; |
|
|
|
import org.nl.wms.basedata_manage.service.dao.Structattr; |
|
|
|
import org.nl.wms.basedata_manage.service.dao.mapper.StructattrMapper; |
|
|
|
import org.nl.wms.pda_manage.sch_manage.service.PdaSchPointService; |
|
|
|
import org.nl.wms.pda_manage.util.PdaResponse; |
|
|
|
import org.nl.wms.sch_manage.service.dao.SchBasePoint; |
|
|
|
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.nl.wms.warehouse_manage.service.dao.mapper.StIvtMoveinvdtlMapper; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* <p> |
|
|
|
* 手持点位操作 实现类 |
|
|
@ -21,43 +26,103 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
* @since 2025-06-06 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class PdaSchPointServiceImpl extends ServiceImpl<SchBasePointMapper, SchBasePoint> implements PdaSchPointService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 载具信息服务 |
|
|
|
*/ |
|
|
|
@Autowired |
|
|
|
private IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService; |
|
|
|
public class PdaSchPointServiceImpl implements PdaSchPointService { |
|
|
|
@Resource |
|
|
|
private StIvtMoveinvdtlMapper stIvtMoveinvdtlMapper; |
|
|
|
@Resource |
|
|
|
private IStructattrService iStructattrService; |
|
|
|
@Resource |
|
|
|
private StructattrMapper structattrMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PdaResponse getPoint(JSONObject whereJson) { |
|
|
|
SchBasePoint pointDao = this.getById(whereJson.getString("point_code")); |
|
|
|
pointDao.setStoragevehicle_code(pointDao.getVehicle_code()); |
|
|
|
return PdaResponse.requestParamOk(pointDao); |
|
|
|
} |
|
|
|
public JSONObject getPoint(JSONObject whereJson) { |
|
|
|
// 载具号
|
|
|
|
String vehicle_code = whereJson.getString("vehicle_code"); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(vehicle_code)) { |
|
|
|
throw new BadRequestException("载具编码不能为空!"); |
|
|
|
} |
|
|
|
whereJson.remove("struct_code"); |
|
|
|
List<JSONObject> list = stIvtMoveinvdtlMapper.querydtl(whereJson); |
|
|
|
|
|
|
|
JSONObject ret = new JSONObject(); |
|
|
|
ret.put("status", String.valueOf(HttpStatus.HTTP_OK)); |
|
|
|
ret.put("message","查询成功"); |
|
|
|
ret.put("data",list); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public PdaResponse binding(JSONObject whereJson) { |
|
|
|
this.update( |
|
|
|
new UpdateWrapper<SchBasePoint>().lambda() |
|
|
|
.eq(SchBasePoint::getPoint_code, whereJson.getString("point_code")) |
|
|
|
.set(SchBasePoint::getVehicle_code, null) |
|
|
|
.set(SchBasePoint::getIos_id, null) |
|
|
|
public JSONObject binding(JSONObject whereJson) { |
|
|
|
// 载具号
|
|
|
|
String vehicle_code = whereJson.getString("vehicle_code"); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(vehicle_code)) { |
|
|
|
throw new BadRequestException("载具编码不能为空!"); |
|
|
|
} |
|
|
|
// 载具号
|
|
|
|
String struct_code = whereJson.getString("struct_code"); |
|
|
|
if (ObjectUtil.isEmpty(struct_code)) { |
|
|
|
throw new BadRequestException("点位编码不能为空!"); |
|
|
|
} |
|
|
|
Structattr struct = structattrMapper.selectOne(new LambdaQueryWrapper<Structattr>() |
|
|
|
.eq(Structattr::getStruct_code, struct_code) |
|
|
|
); |
|
|
|
return PdaResponse.requestOk(); |
|
|
|
if(ObjectUtil.isEmpty(struct)){ |
|
|
|
throw new BadRequestException("找不到点位:"+struct_code); |
|
|
|
} |
|
|
|
if(ObjectUtil.isNotEmpty(struct.getStoragevehicle_code())){ |
|
|
|
throw new BadRequestException("点位:"+struct_code+"上已有载具号:"+struct.getStoragevehicle_code()+",不允许再次绑定!"); |
|
|
|
} |
|
|
|
List<Structattr> list = structattrMapper.selectList(new LambdaQueryWrapper<Structattr>() |
|
|
|
.eq(Structattr::getStoragevehicle_code, vehicle_code) |
|
|
|
); |
|
|
|
if(list.size()>0){ |
|
|
|
throw new BadRequestException("载具:"+vehicle_code+"上已绑定在货位:"+list.get(0).getStruct_code()+",不允许再次绑定!"); |
|
|
|
} |
|
|
|
iStructattrService.update( |
|
|
|
new UpdateWrapper<Structattr>().lambda() |
|
|
|
.eq(Structattr::getStruct_code, struct_code) |
|
|
|
.set(Structattr::getStoragevehicle_code, vehicle_code) |
|
|
|
); |
|
|
|
JSONObject ret = new JSONObject(); |
|
|
|
ret.put("status", String.valueOf(HttpStatus.HTTP_OK)); |
|
|
|
ret.put("message","操作成功"); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public PdaResponse dissect(JSONObject whereJson) { |
|
|
|
// 判断载具是否存在
|
|
|
|
iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("vehicle_code")); |
|
|
|
this.update( |
|
|
|
new UpdateWrapper<SchBasePoint>().lambda() |
|
|
|
.eq(SchBasePoint::getPoint_code, whereJson.getString("point_code")) |
|
|
|
.set(SchBasePoint::getVehicle_code, whereJson.getString("vehicle_code")) |
|
|
|
public JSONObject dissect(JSONObject whereJson) { |
|
|
|
// 载具号
|
|
|
|
String vehicle_code = whereJson.getString("vehicle_code"); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(vehicle_code)) { |
|
|
|
throw new BadRequestException("载具编码不能为空!"); |
|
|
|
} |
|
|
|
// 载具号
|
|
|
|
String struct_code = whereJson.getString("struct_code"); |
|
|
|
if (ObjectUtil.isEmpty(struct_code)) { |
|
|
|
throw new BadRequestException("点位编码不能为空!"); |
|
|
|
} |
|
|
|
Structattr struct = structattrMapper.selectOne(new LambdaQueryWrapper<Structattr>() |
|
|
|
.eq(Structattr::getStruct_code, struct_code) |
|
|
|
); |
|
|
|
if(ObjectUtil.isEmpty(struct)){ |
|
|
|
throw new BadRequestException("找不到点位:"+struct_code); |
|
|
|
} |
|
|
|
if(ObjectUtil.isEmpty(struct.getStoragevehicle_code())){ |
|
|
|
throw new BadRequestException("点位:"+struct_code+"上无载具号:"+vehicle_code+",不需要解绑!"); |
|
|
|
} |
|
|
|
|
|
|
|
iStructattrService.update( |
|
|
|
new UpdateWrapper<Structattr>().lambda() |
|
|
|
.eq(Structattr::getStruct_code, whereJson.getString("struct_code")) |
|
|
|
.set(Structattr::getStoragevehicle_code, null) |
|
|
|
); |
|
|
|
return PdaResponse.requestOk(); |
|
|
|
JSONObject ret = new JSONObject(); |
|
|
|
ret.put("status", String.valueOf(HttpStatus.HTTP_OK)); |
|
|
|
ret.put("message","操作成功"); |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|