|
@ -2,7 +2,9 @@ package org.nl.wms.basedata_manage.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
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 lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@ -17,6 +19,7 @@ import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo; |
|
|
import org.nl.wms.warehouse_manage.enums.IOSEnum; |
|
|
import org.nl.wms.warehouse_manage.enums.IOSEnum; |
|
|
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService; |
|
|
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService; |
|
|
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.mapper.MdPbGroupplateMapper; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.http.HttpStatus; |
|
|
import org.springframework.http.HttpStatus; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.http.ResponseEntity; |
|
@ -24,8 +27,11 @@ import org.springframework.util.Assert; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
import java.util.Set; |
|
|
import java.util.Set; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -46,6 +52,8 @@ public class GroupController { |
|
|
private final IMdPbGroupplateService iMdPbGroupplateService; |
|
|
private final IMdPbGroupplateService iMdPbGroupplateService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private final IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService; |
|
|
private final IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private final MdPbGroupplateMapper mdPbGroupplateMapper; |
|
|
|
|
|
|
|
|
@GetMapping |
|
|
@GetMapping |
|
|
@Log("分页查询") |
|
|
@Log("分页查询") |
|
@ -57,24 +65,30 @@ public class GroupController { |
|
|
@PostMapping |
|
|
@PostMapping |
|
|
@Log("新增组盘组盘") |
|
|
@Log("新增组盘组盘") |
|
|
public ResponseEntity<Object> createSingle(@RequestBody JSONObject group) { |
|
|
public ResponseEntity<Object> createSingle(@RequestBody JSONObject group) { |
|
|
Assert.noNullElements(new Object[]{group,group.get("material_id"),group.get("storagevehicle_code"),group.get("qty")},"请求参数不能为空"); |
|
|
Assert.noNullElements(new Object[]{group, group.get("tableData"), group.get("storagevehicle_code")}, "请求参数不能为空"); |
|
|
GroupPlate groupPlate = group.toJavaObject(GroupPlate.class); |
|
|
String storagevehicleCode = group.getString("storagevehicle_code"); |
|
|
String storagevehicleCode = groupPlate.getStoragevehicle_code(); |
|
|
|
|
|
{ |
|
|
{ |
|
|
iMdPbStoragevehicleinfoService.getByCode(storagevehicleCode); |
|
|
iMdPbStoragevehicleinfoService.getByCode(storagevehicleCode); |
|
|
int has = iMdPbGroupplateService.count(new LambdaUpdateWrapper<GroupPlate>() |
|
|
int has = iMdPbGroupplateService.count(new LambdaUpdateWrapper<GroupPlate>() |
|
|
.eq(GroupPlate::getStoragevehicle_code, groupPlate.getStoragevehicle_code()) |
|
|
.eq(GroupPlate::getStoragevehicle_code, storagevehicleCode) |
|
|
.lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))); |
|
|
.lt(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("出库"))); |
|
|
if (has>0){ |
|
|
if (has > 0) { |
|
|
throw new BadRequestException("当前载具组盘信息已存在"); |
|
|
throw new BadRequestException("当前载具组盘信息已存在"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
groupPlate.setGroup_id(IdUtil.getStringId()); |
|
|
JSONArray rows = group.getJSONArray("tableData"); |
|
|
groupPlate.setCreate_id(SecurityUtils.getCurrentUserId()); |
|
|
for (int i = 0; i < rows.size(); i++) { |
|
|
groupPlate.setCreate_name(SecurityUtils.getCurrentUsername()); |
|
|
JSONObject row = rows.getJSONObject(i); |
|
|
groupPlate.setCreate_time(DateUtil.now()); |
|
|
GroupPlate groupPlate = row.toJavaObject(GroupPlate.class); |
|
|
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("组盘")); |
|
|
groupPlate.setStoragevehicle_code(storagevehicleCode); |
|
|
iMdPbGroupplateService.save(groupPlate); |
|
|
groupPlate.setGroup_id(IdUtil.getStringId()); |
|
|
|
|
|
groupPlate.setCreate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
|
|
groupPlate.setCreate_name(SecurityUtils.getCurrentUsername()); |
|
|
|
|
|
groupPlate.setCreate_time(DateUtil.now()); |
|
|
|
|
|
groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("组盘")); |
|
|
|
|
|
iMdPbGroupplateService.save(groupPlate); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return new ResponseEntity<>(HttpStatus.OK); |
|
|
return new ResponseEntity<>(HttpStatus.OK); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -84,4 +98,18 @@ public class GroupController { |
|
|
iMdPbGroupplateService.delete(ids); |
|
|
iMdPbGroupplateService.delete(ids); |
|
|
return new ResponseEntity<>(HttpStatus.OK); |
|
|
return new ResponseEntity<>(HttpStatus.OK); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/getAllGroupInfo") |
|
|
|
|
|
@Log("通过载具号获取全部组盘信息") |
|
|
|
|
|
public ResponseEntity<Object> getAllGroupInfo(@RequestBody JSONArray rows) { |
|
|
|
|
|
List<String> vehicle_list = rows.stream() |
|
|
|
|
|
.map(obj -> (HashMap<String, String>) obj) |
|
|
|
|
|
.map(json -> json.get("storagevehicle_code")) |
|
|
|
|
|
.distinct() |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
List<JSONObject> list = mdPbGroupplateMapper.getVehicleMaterial(new JSONObject() {{ |
|
|
|
|
|
put("vehicle_codes", vehicle_list); |
|
|
|
|
|
}}); |
|
|
|
|
|
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|