opt:手持组盘新增料框
This commit is contained in:
@@ -3,6 +3,7 @@ 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 cn.hutool.http.HttpStatus;
|
||||||
|
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.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -36,13 +37,16 @@ import org.nl.wms.system_manage.service.dict.dao.Dict;
|
|||||||
import org.nl.wms.system_manage.service.dict.dao.mapper.SysDictMapper;
|
import org.nl.wms.system_manage.service.dict.dao.mapper.SysDictMapper;
|
||||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
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.IMdPbGroupplateDtlService;
|
||||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||||
import org.nl.wms.warehouse_manage.service.IRawAssistIStorService;
|
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.GroupPlateDtl;
|
||||||
import org.nl.wms.warehouse_manage.service.dao.IOStorInvDtl;
|
import org.nl.wms.warehouse_manage.service.dao.IOStorInvDtl;
|
||||||
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.MdPbGroupplateMapper;
|
import org.nl.wms.warehouse_manage.service.dao.mapper.MdPbGroupplateMapper;
|
||||||
import org.nl.wms.warehouse_manage.service.dto.IOStorInvDisDto;
|
import org.nl.wms.warehouse_manage.service.dto.IOStorInvDisDto;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
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;
|
||||||
@@ -90,6 +94,9 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMdPbGroupplateDtlService iMdPbGroupplateDtlService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库区服务
|
* 库区服务
|
||||||
*/
|
*/
|
||||||
@@ -127,15 +134,14 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISchBaseRegionService iSchBaseRegionService;
|
private ISchBaseRegionService iSchBaseRegionService;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public JSONObject groupPlate(JSONObject whereJson) {
|
public JSONObject groupPlate(JSONObject whereJson) {
|
||||||
// 物料编码
|
// 物料编码
|
||||||
String materialId = whereJson.getString("material_id");
|
String materialId = whereJson.getString("material_id");
|
||||||
//载具号
|
//载具号
|
||||||
String vehicle_code = whereJson.getString("vehicle_code");
|
String vehicle_code = whereJson.getString("vehicle_code");
|
||||||
// 数量
|
|
||||||
BigDecimal qty = whereJson.getBigDecimal("qty");
|
|
||||||
if (ObjectUtil.isEmpty(materialId)) {
|
if (ObjectUtil.isEmpty(materialId)) {
|
||||||
throw new BadRequestException("物料信息不能为空!");
|
throw new BadRequestException("物料信息不能为空!");
|
||||||
}
|
}
|
||||||
@@ -161,20 +167,38 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
|||||||
if (count.size() > 0) {
|
if (count.size() > 0) {
|
||||||
throw new BadRequestException("载具编码:" + vehicle_code + "已存在库内:"+count.get(0).getStruct_code()+",请对数据进行核实!");
|
throw new BadRequestException("载具编码:" + vehicle_code + "已存在库内:"+count.get(0).getStruct_code()+",请对数据进行核实!");
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupPlate groupDao = GroupPlate.builder()
|
GroupPlate groupDao = GroupPlate.builder()
|
||||||
.group_id(IdUtil.getStringId())
|
.group_id(IdUtil.getStringId())
|
||||||
.material_id(materDao.getMaterial_id())
|
.material_id(materDao.getMaterial_id())
|
||||||
.storagevehicle_code(vehicle_code)
|
.storagevehicle_code(vehicle_code)
|
||||||
.qty_unit_id(unitDao.getMeasure_unit_id())
|
.qty_unit_id(unitDao.getMeasure_unit_id())
|
||||||
.qty_unit_name(unitDao.getUnit_name())
|
.qty_unit_name(unitDao.getUnit_name())
|
||||||
.qty(qty)
|
|
||||||
.frozen_qty(BigDecimal.ZERO)
|
.frozen_qty(BigDecimal.ZERO)
|
||||||
.status(GROUP_PLATE_STATUS.code("组盘"))
|
.status(GROUP_PLATE_STATUS.code("组盘"))
|
||||||
.create_id(SecurityUtils.getCurrentUserId())
|
.create_id(SecurityUtils.getCurrentUserId())
|
||||||
.create_name(SecurityUtils.getCurrentNickName())
|
.create_name(SecurityUtils.getCurrentNickName())
|
||||||
.create_time(DateUtil.now())
|
.create_time(DateUtil.now())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
List<GroupPlateDtl> groupPlateDtlList = new ArrayList<>();
|
||||||
|
JSONArray dtlList = whereJson.getJSONArray("dtlList");
|
||||||
|
BigDecimal qty = new BigDecimal("0");
|
||||||
|
for (int i = 0; i < dtlList.size(); i++) {
|
||||||
|
JSONObject row = dtlList.getJSONObject(i);
|
||||||
|
GroupPlateDtl groupPlateDtl = new GroupPlateDtl();
|
||||||
|
BeanUtils.copyProperties(groupDao,groupPlateDtl);
|
||||||
|
groupPlateDtl.setGroupdtl_id(IdUtil.getStringId());
|
||||||
|
groupPlateDtl.setMater_frame(row.getString("mater_frame"));
|
||||||
|
groupPlateDtl.setQty(row.getBigDecimal("qty"));
|
||||||
|
groupPlateDtlList.add(groupPlateDtl);
|
||||||
|
|
||||||
|
qty = qty.add(row.getBigDecimal("qty"));
|
||||||
|
}
|
||||||
|
|
||||||
|
groupDao.setQty(qty);
|
||||||
iMdPbGroupplateService.save(groupDao);
|
iMdPbGroupplateService.save(groupDao);
|
||||||
|
iMdPbGroupplateDtlService.saveBatch(groupPlateDtlList);
|
||||||
JSONObject ret = new JSONObject();
|
JSONObject ret = new JSONObject();
|
||||||
ret.put("status", String.valueOf(HttpStatus.HTTP_OK));
|
ret.put("status", String.valueOf(HttpStatus.HTTP_OK));
|
||||||
ret.put("message","操作成功");
|
ret.put("message","操作成功");
|
||||||
@@ -269,6 +293,11 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
|||||||
whereJson.put("status", GROUP_PLATE_STATUS.code("组盘"));
|
whereJson.put("status", GROUP_PLATE_STATUS.code("组盘"));
|
||||||
whereJson.put("vehicleCode", whereJson.getString("search"));
|
whereJson.put("vehicleCode", whereJson.getString("search"));
|
||||||
List<JSONObject> ret = mdPbGroupplateMapper.getVehicleMaterial(whereJson);
|
List<JSONObject> ret = mdPbGroupplateMapper.getVehicleMaterial(whereJson);
|
||||||
|
|
||||||
|
//列表清单展示
|
||||||
|
ret.get(0).put("dtlList",iMdPbGroupplateDtlService.list(new LambdaQueryWrapper<>(GroupPlateDtl.class)
|
||||||
|
.eq(GroupPlateDtl::getGroup_id, ret.get(0).getString("group_id"))));
|
||||||
|
|
||||||
return ret.get(0);
|
return ret.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user