fix:组盘、入库相关业务修改为混料

This commit is contained in:
zhouz
2025-07-23 13:07:32 +08:00
parent efea91d120
commit 514f45ab5a
9 changed files with 100 additions and 33 deletions

View File

@@ -2,7 +2,9 @@ package org.nl.wms.basedata_manage.controller;
import cn.hutool.core.date.DateUtil;
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.RequiredArgsConstructor;
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.service.IMdPbGroupplateService;
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.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -24,8 +27,11 @@ import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -46,6 +52,8 @@ public class GroupController {
private final IMdPbGroupplateService iMdPbGroupplateService;
@Autowired
private final IMdPbStoragevehicleinfoService iMdPbStoragevehicleinfoService;
@Autowired
private final MdPbGroupplateMapper mdPbGroupplateMapper;
@GetMapping
@Log("分页查询")
@@ -57,24 +65,30 @@ public class GroupController {
@PostMapping
@Log("新增组盘组盘")
public ResponseEntity<Object> createSingle(@RequestBody JSONObject group) {
Assert.noNullElements(new Object[]{group,group.get("material_id"),group.get("storagevehicle_code"),group.get("qty")},"请求参数不能为空");
GroupPlate groupPlate = group.toJavaObject(GroupPlate.class);
String storagevehicleCode = groupPlate.getStoragevehicle_code();
Assert.noNullElements(new Object[]{group, group.get("tableData"), group.get("storagevehicle_code")}, "请求参数不能为空");
String storagevehicleCode = group.getString("storagevehicle_code");
{
iMdPbStoragevehicleinfoService.getByCode(storagevehicleCode);
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("出库")));
if (has>0){
if (has > 0) {
throw new BadRequestException("当前载具组盘信息已存在");
}
}
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);
JSONArray rows = group.getJSONArray("tableData");
for (int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
GroupPlate groupPlate = row.toJavaObject(GroupPlate.class);
groupPlate.setStoragevehicle_code(storagevehicleCode);
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);
}
@@ -84,4 +98,18 @@ public class GroupController {
iMdPbGroupplateService.delete(ids);
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);
}
}

View File

@@ -60,7 +60,12 @@ public class MdMeMaterialbase implements Serializable {
/**
* 基本计量单位
*/
private String base_unit_id;
private String qty_unit_id;
/**
* 基本计量单位名称
*/
private String qty_unit_name;
/**
* 辅助计量单位

View File

@@ -148,7 +148,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
String qty = whereJson.getString("qty");
MdPbStoragevehicleinfo vehicleDao = iMdPbStoragevehicleinfoService.getByCode(whereJson.getString("vehicle_code"));
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(materialId);
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getBase_unit_id());
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getQty_unit_id());
// 校验
if (ObjectUtil.isEmpty(vehicleDao) || ObjectUtil.isEmpty(materDao) || ObjectUtil.isEmpty(materDao)) {
throw new BadRequestException("载具,物料或单位信息有误!");

View File

@@ -49,12 +49,16 @@
<select id="getGroupPlate" resultType="org.nl.wms.warehouse_manage.service.dto.GroupPlateDto">
SELECT group_id,
storagevehicle_code,
gp.material_id,pcsn,
qty_unit_id,
qty_unit_name,qty,frozen_qty,remark,
status,ext_code,ext_type,
mater.material_name,mater.material_spec,mater.material_code
storagevehicle_code,
gp.material_id,
pcsn,
gp.qty_unit_id,
gp.qty_unit_name,
qty,
frozen_qty,
remark,
status,ext_code,ext_type,
mater.material_name,mater.material_spec,mater.material_code
FROM md_pb_groupplate gp
LEFT JOIN md_me_materialbase mater ON mater.material_id = gp.material_id
<where>
@@ -65,11 +69,11 @@
</if>
<if test="params.pcsn != null">
AND
gp.pcsn LIKE CONCAT('%', #{params.pcsn}, '%')
gp.pcsn LIKE CONCAT('%', #{params.pcsn}, '%')
</if>
<if test="params.storagevehicle_code != null">
AND
gp.storagevehicle_code LIKE CONCAT('%', #{params.storagevehicle_code}, '%')
gp.storagevehicle_code LIKE CONCAT('%', #{params.storagevehicle_code}, '%')
</if>
<if test="params.begin_time != null">
AND

View File

@@ -76,6 +76,12 @@
AND
gro.qty>0
</if>
<if test="params.vehicle_codes != null and params.vehicle_codes.size > 0">
AND gro.storagevehicle_code IN
<foreach collection="params.vehicle_codes" item="storagevehicle_code" open="(" separator="," close=")">
#{storagevehicle_code}
</foreach>
</if>
</where>
ORDER BY gro.create_time Desc
</select>