opt:优化单据管理
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package org.nl.common.domain.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 时区转换
|
||||
*
|
||||
* @author gbx
|
||||
* @since 2025-06-27
|
||||
*/
|
||||
public class IsoToLocalDateTimeStringDeserializer extends JsonDeserializer<String> {
|
||||
private static final DateTimeFormatter FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.of("Asia/Shanghai"));
|
||||
|
||||
@Override
|
||||
public String deserialize(JsonParser p, DeserializationContext ctxt)
|
||||
throws IOException {
|
||||
String isoString = p.getText();
|
||||
try {
|
||||
Instant instant = Instant.parse(isoString);
|
||||
return FORMATTER.format(instant);
|
||||
} catch (Exception e) {
|
||||
return isoString;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,25 +63,45 @@ public class PageQuery implements Serializable {
|
||||
Page<T> page = new Page<>(pageNum, pageSize);
|
||||
if (StringUtils.isNotEmpty(sort)){
|
||||
String[] split = sort.split(",");
|
||||
for (int i = 0; i < (split.length & ~1); i=i+2) {
|
||||
for (int i = 0; i < (split.length & ~1); i = i + 2) {
|
||||
String col = split[i];
|
||||
OrderItem item = new OrderItem();
|
||||
item.setColumn(col);
|
||||
item.setAsc(split[i+1].toLowerCase(Locale.ROOT).equals("asc"));
|
||||
item.setAsc(split[i + 1].toLowerCase(Locale.ROOT).equals("asc"));
|
||||
page.addOrder(item);
|
||||
}
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
public <R,T> Page<T> build(Class<R> r) {
|
||||
public static void trimStringFields(Object obj) {
|
||||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
Field[] fields = obj.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (field.getType() == String.class) {
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
String value = (String) field.get(obj);
|
||||
if (value != null) {
|
||||
field.set(obj, value.trim().toUpperCase());
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public <R, T> Page<T> build(Class<R> r) {
|
||||
Integer pageNum = ObjectUtil.defaultIfNull(getPage(), DEFAULT_PAGE_NUM);
|
||||
Integer pageSize = ObjectUtil.defaultIfNull(getSize(), DEFAULT_PAGE_SIZE);
|
||||
if (pageNum <= 0) {
|
||||
pageNum = DEFAULT_PAGE_NUM;
|
||||
}
|
||||
Page<T> page = new Page<>(pageNum, pageSize);
|
||||
if (StringUtils.isNotEmpty(sort)){
|
||||
if (StringUtils.isNotEmpty(sort)) {
|
||||
String[] split = sort.split(",");
|
||||
for (int i = 0; i < (split.length & ~1); i=i+2) {
|
||||
String col = split[i];
|
||||
|
||||
@@ -157,4 +157,17 @@ public class DateUtil {
|
||||
public static LocalDateTime parseLocalDateTimeFormatyMdHms(String localDateTime) {
|
||||
return LocalDateTime.from(DFY_MD_HMS.parse(localDateTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转 yyyy-MM-dd
|
||||
*
|
||||
* @param localDateTime /
|
||||
* @return /
|
||||
*/
|
||||
public static String parseLocalDateTimeFormatYmd(String localDateTime) {
|
||||
if (localDateTime == null || localDateTime.length() < 10) {
|
||||
return localDateTime;
|
||||
}
|
||||
return localDateTime.substring(0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,21 @@ package org.nl.wms.pm_manage.form_data.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit;
|
||||
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.dao.PmFormData;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.dto.PmFormDataParam;
|
||||
@@ -67,17 +72,8 @@ public class PmFormDataController {
|
||||
@PutMapping()
|
||||
@Log("修改单据结构")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject param) {
|
||||
//逻辑判断:如果有数据了则不允许修改
|
||||
String s = param.toString(SerializerFeature.SortField);
|
||||
PmFormData pmFormData = JSONObject.parseObject(s, PmFormData.class, Feature.OrderedField);
|
||||
//生产入库单存在报工数超过合格数,需要人工修改正确报工数=合格数,进行手动回传
|
||||
String id = pmFormData.getId();
|
||||
PmFormData entity = iPmFormDataService.getById(id);
|
||||
entity.setRemark(pmFormData.getRemark());
|
||||
entity.setUpdate_name(SecurityUtils.getCurrentUserId());
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
iPmFormDataService.updateById(entity);
|
||||
public ResponseEntity<Object> update(@RequestBody PmFormDataParam params) {
|
||||
iPmFormDataService.update(params);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,14 @@ public interface IPmFormDataService extends IService<PmFormData> {
|
||||
*/
|
||||
void create(PmFormDataParam params);
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param params 对象实体
|
||||
*/
|
||||
void update(PmFormDataParam params);
|
||||
|
||||
|
||||
List<PmFormData> getByType(String from_type);
|
||||
|
||||
Object queryAll(FormDataQuery query, PageQuery page);
|
||||
|
||||
@@ -2,8 +2,10 @@ package org.nl.wms.pm_manage.form_data.service.dao.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nl.common.domain.handler.IsoToLocalDateTimeStringDeserializer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@@ -29,7 +31,14 @@ public class PmFormData extends Model<PmFormData> {
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.NONE)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 仓库编号
|
||||
*/
|
||||
private String stor_id;
|
||||
/**
|
||||
* 仓库信息
|
||||
*/
|
||||
private String stor_name;
|
||||
|
||||
/**
|
||||
* 编号
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.wms.pm_manage.form_data.service.dao.dto;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import lombok.*;
|
||||
import org.nl.common.domain.handler.IsoToLocalDateTimeStringDeserializer;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.dao.PmFormData;
|
||||
|
||||
@@ -32,6 +34,14 @@ public class PmFormDataParam extends BaseQuery<PmFormData> {
|
||||
* 单据状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 仓库编号
|
||||
*/
|
||||
private String stor_id;
|
||||
/**
|
||||
* 仓库信息
|
||||
*/
|
||||
private String stor_name;
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
@@ -39,6 +49,7 @@ public class PmFormDataParam extends BaseQuery<PmFormData> {
|
||||
/**
|
||||
* 源单单据日期
|
||||
*/
|
||||
@JsonDeserialize(using = IsoToLocalDateTimeStringDeserializer.class)
|
||||
private String source_form_date;
|
||||
/**
|
||||
* 物料code
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
<result property="assign_qty" column="assign_qty"/>
|
||||
<result property="actual_qty" column="actual_qty"/>
|
||||
<result property="total_qty" column="total_qty"/>
|
||||
<result property="stor_id" column="stor_id"/>
|
||||
<result property="stor_name" column="stor_name"/>
|
||||
<result property="unit_id" column="unit_id"/>
|
||||
<result property="unit_name" column="unit_name"/>
|
||||
<result property="vehicle_code" column="vehicle_code"/>
|
||||
@@ -128,17 +130,15 @@
|
||||
<if test="query.code != null and query.code != ''">
|
||||
and code LIKE '%${query.code}'
|
||||
</if>
|
||||
<if test="query.bill_code != null and query.bill_code != ''">
|
||||
and source_form_date = #{query.bill_code}
|
||||
</if>
|
||||
<if test="query.mater != null and query.mater != ''">
|
||||
and md_me_materialbase.material_code like '%${query.mater}%'
|
||||
<if test="query.material_code != null and query.material_code != ''">
|
||||
and (md_me_materialbase.material_code LIKE '%${query.material_code}%'
|
||||
or md_me_materialbase.material_name LIKE '%${query.material_code}%')
|
||||
</if>
|
||||
<if test="query.start_time != null and query.start_time != ''">
|
||||
and pm_form_data.create_time >= #{query.start_time}
|
||||
and pm_form_data.source_form_date >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time != null and query.end_time != ''">
|
||||
and #{query.end_time} >= pm_form_data.create_time
|
||||
and #{query.end_time} >= pm_form_data.source_form_date
|
||||
</if>
|
||||
<if test="query.status != null and query.status != ''">
|
||||
and pm_form_data.status IN
|
||||
|
||||
@@ -21,11 +21,10 @@ public class FormDataQuery extends BaseQuery<PmFormData> {
|
||||
private String search;
|
||||
private String pcsn;
|
||||
private String parent_id;
|
||||
private String mater;
|
||||
private String material_code;
|
||||
private String[] status;
|
||||
private String start_time;
|
||||
private String end_time;
|
||||
|
||||
private Map<String,String> form_query;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,170 +18,121 @@ import java.util.List;
|
||||
@Data
|
||||
public class PmFormDataDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final long serialVersionUID = -7739291296662381396L;
|
||||
|
||||
|
||||
/**
|
||||
* 业务单据单据id
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 单据编码
|
||||
* 编号
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 对应流程实例id
|
||||
* 单据状态
|
||||
*/
|
||||
private String proc_inst_id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 业务单据编号
|
||||
*/
|
||||
private String source_form_id;
|
||||
/**
|
||||
* 业务单据编号
|
||||
*/
|
||||
private String source_form_type;
|
||||
|
||||
/**
|
||||
* 业务单据日期
|
||||
*/
|
||||
private String source_form_date;
|
||||
|
||||
private String status;
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private String form_type;
|
||||
|
||||
/**
|
||||
* 业务单据状态
|
||||
* 源单单据日期
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 业务单据状态
|
||||
*/
|
||||
private String bill_status;
|
||||
|
||||
/**
|
||||
* 物料状态
|
||||
*/
|
||||
private String material_status;
|
||||
/**
|
||||
* 业务单据状态
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 物料id
|
||||
*/
|
||||
private String material_id;
|
||||
/**
|
||||
* 物料name
|
||||
*/
|
||||
private String material_name;
|
||||
private String source_form_date;
|
||||
/**
|
||||
* 物料code
|
||||
*/
|
||||
private String material_code;
|
||||
|
||||
/**
|
||||
* 物料spec
|
||||
* 物料规格
|
||||
*/
|
||||
private String material_spec;
|
||||
/**
|
||||
* 物料单重
|
||||
* 物料
|
||||
*/
|
||||
private String material_name;
|
||||
/**
|
||||
* 净重
|
||||
*/
|
||||
private String net_weight;
|
||||
/**
|
||||
* 单据编号
|
||||
*/
|
||||
private String billNo;
|
||||
/**
|
||||
* 源单编号
|
||||
*/
|
||||
private String srcBillNo;
|
||||
|
||||
/**
|
||||
* 条码
|
||||
*/
|
||||
private String bar_code;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
/**
|
||||
* 冻结数量
|
||||
*/
|
||||
private BigDecimal frozen_qty;
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private BigDecimal sto_qty;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal plan_qty;
|
||||
/**
|
||||
* 已分配数量
|
||||
*/
|
||||
private BigDecimal assign_qty;
|
||||
/**
|
||||
* 实际数量
|
||||
*/
|
||||
private BigDecimal actual_qty;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit_id;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String unit_name;
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
private String pcsn;
|
||||
/**
|
||||
* 批次号
|
||||
* 计划数量
|
||||
*/
|
||||
private String product_area;
|
||||
|
||||
private BigDecimal plan_qty;
|
||||
/**
|
||||
* 是否删除
|
||||
* 数量
|
||||
*/
|
||||
private String is_delete;
|
||||
private BigDecimal qty;
|
||||
/**
|
||||
* 载具
|
||||
* 分配数量
|
||||
*/
|
||||
private BigDecimal assign_qty;
|
||||
/**
|
||||
* 实际数量
|
||||
*/
|
||||
private BigDecimal actual_qty;
|
||||
/**
|
||||
* 单据累计数量
|
||||
*/
|
||||
private BigDecimal total_qty;
|
||||
/**
|
||||
* 数量单位
|
||||
*/
|
||||
private String unit_id;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String unit_name;
|
||||
/**
|
||||
* 载具信息
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
private String stor_name;
|
||||
/**
|
||||
* 载具组盘id
|
||||
*/
|
||||
private String vehicle_id;
|
||||
/**
|
||||
* 出库单据号
|
||||
*/
|
||||
private String prd_ppbom_no;
|
||||
|
||||
/**
|
||||
* 自定义表单字段
|
||||
*/
|
||||
private JSONObject form_data;
|
||||
|
||||
private String form_data;
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private String create_time;
|
||||
/**
|
||||
* 创建id
|
||||
*/
|
||||
private String create_name;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_name;
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 是否完结
|
||||
*/
|
||||
private Integer is_finish;
|
||||
|
||||
/**
|
||||
* 关联上级表单id
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.pm_manage.form_data.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
@@ -11,11 +12,14 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.CopyUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IMdPbMeasureunitService;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit;
|
||||
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.dao.PmFormData;
|
||||
import org.nl.wms.pm_manage.form_data.service.dao.dto.PmFormDataParam;
|
||||
@@ -23,7 +27,6 @@ import org.nl.wms.pm_manage.form_data.service.dao.mapper.PmFormDataMapper;
|
||||
import org.nl.wms.pm_manage.form_data.service.dto.FormDataQuery;
|
||||
import org.nl.wms.pm_manage.form_data.service.dto.PmFormDataDto;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -36,6 +39,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.common.domain.query.PageQuery.trimStringFields;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 表单信息表 服务实现类
|
||||
@@ -57,15 +62,13 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormData> implements IPmFormDataService {
|
||||
|
||||
@Autowired
|
||||
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
||||
|
||||
@Resource
|
||||
private PmFormDataMapper pmFormDataMapper;
|
||||
|
||||
@Autowired
|
||||
private IStructattrService iStIvtStructattrService;
|
||||
|
||||
@Resource
|
||||
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
||||
@Resource
|
||||
private IBsrealStorattrService iBsrealStorattrService;
|
||||
|
||||
@Override
|
||||
public Integer syncFormData(String form_type, String dataString) {
|
||||
@@ -82,13 +85,44 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
||||
*/
|
||||
@Override
|
||||
public void create(PmFormDataParam params) {
|
||||
|
||||
|
||||
|
||||
|
||||
params.setCode(CodeUtil.getNewCode("EXT_BILL"));
|
||||
params.setSource_form_date(org.nl.common.utils.DateUtil.parseLocalDateTimeFormatYmd(params.getSource_form_date()));
|
||||
MdPbMeasureunit mdPbMeasureunit = iMdPbMeasureunitService.getOne(new LambdaQueryWrapper<MdPbMeasureunit>().eq(MdPbMeasureunit::getMeasure_unit_id, params.getUnit_id()));
|
||||
if (ObjectUtil.isEmpty(mdPbMeasureunit)) {
|
||||
throw new BadRequestException("没有该计量单位信息");
|
||||
}
|
||||
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(params.getStor_id());
|
||||
if (ObjectUtil.isEmpty(bsrealStorattr)) {
|
||||
throw new BadRequestException("没有该仓库信息");
|
||||
}
|
||||
params.setStor_name(bsrealStorattr.getStor_name());
|
||||
params.setUnit_name(mdPbMeasureunit.getUnit_name());
|
||||
pmFormDataMapper.insert(getBasicInfo(params, true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param params 对象实体
|
||||
*/
|
||||
@Override
|
||||
public void update(PmFormDataParam params) {
|
||||
params.setSource_form_date(org.nl.common.utils.DateUtil.parseLocalDateTimeFormatYmd(params.getSource_form_date()));
|
||||
MdPbMeasureunit mdPbMeasureunit = iMdPbMeasureunitService.getOne(new LambdaQueryWrapper<MdPbMeasureunit>().eq(MdPbMeasureunit::getMeasure_unit_id, params.getUnit_id()));
|
||||
if (ObjectUtil.isEmpty(mdPbMeasureunit)) {
|
||||
throw new BadRequestException("没有该计量单位信息");
|
||||
}
|
||||
BsrealStorattr bsrealStorattr = iBsrealStorattrService.findById(params.getStor_id());
|
||||
if (ObjectUtil.isEmpty(bsrealStorattr)) {
|
||||
throw new BadRequestException("没有该仓库信息");
|
||||
}
|
||||
params.setStor_name(bsrealStorattr.getStor_name());
|
||||
params.setUnit_name(mdPbMeasureunit.getUnit_name());
|
||||
pmFormDataMapper.updateById(getBasicInfo(params, false));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object queryAll(FormDataQuery query, PageQuery pageQuery) {
|
||||
Page page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
@@ -121,21 +155,8 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
||||
public com.baomidou.mybatisplus.extension.plugins.pagination.Page<PmFormDataDto> queryTree(FormDataQuery query, PageQuery pageQuery) {
|
||||
Page page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
page.setOrderBy("id DESC");
|
||||
if (ObjectUtil.isNotEmpty(query.getMater()) || ObjectUtil.isNotEmpty(query.getPcsn()) || ObjectUtil.isNotEmpty(query.getBill_code())) {
|
||||
if (ObjectUtil.isNotEmpty(query.getPcsn())) {
|
||||
query.setPcsn(query.getPcsn().trim());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(query.getMater())) {
|
||||
query.setMater(query.getMater().trim());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(query.getBill_code())) {
|
||||
query.setBill_code(query.getBill_code().trim());
|
||||
}
|
||||
}
|
||||
trimStringFields(query);
|
||||
List<PmFormDataDto> pmFormDataList = this.baseMapper.queryTree2(query);
|
||||
if (ObjectUtil.isNotEmpty(pmFormDataList)) {
|
||||
handleFormDataList(pmFormDataList, query);
|
||||
}
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page<PmFormDataDto> dtoPage = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page.getPages(), page.getPageSize(), page.getTotal());
|
||||
dtoPage.setRecords(pmFormDataList);
|
||||
return dtoPage;
|
||||
@@ -150,13 +171,9 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
||||
if (!CollectionUtils.isEmpty(childs)) {
|
||||
Map<String, List<PmFormDataDto>> childMap = childs.stream().collect(Collectors.groupingBy(PmFormDataDto::getParent_id));
|
||||
for (PmFormDataDto dataDto : pmFormDataDtos) {
|
||||
String productArea = dataDto.getForm_data().getString("product_area");
|
||||
dataDto.setProduct_area(productArea);
|
||||
List<PmFormDataDto> children = childMap.get(dataDto.getId());
|
||||
if (children != null) {
|
||||
for (PmFormDataDto child : children) {
|
||||
String childProductArea = child.getForm_data().getString("product_area");
|
||||
child.setProduct_area(childProductArea);
|
||||
if (child.getPlan_qty() != null && child.getAssign_qty().compareTo(BigDecimal.ZERO) == 0) {
|
||||
BigDecimal total = child.getPlan_qty().subtract(child.getAssign_qty().add(child.getActual_qty() == null ? BigDecimal.ZERO : child.getActual_qty()));
|
||||
child.setQty(total.compareTo(BigDecimal.ZERO) > 0 ? total : BigDecimal.ZERO);
|
||||
@@ -165,13 +182,6 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
|
||||
}
|
||||
dataDto.setChildren(children);
|
||||
}
|
||||
} else {
|
||||
if (ObjectUtil.isNotEmpty(query.getMater()) || ObjectUtil.isNotEmpty(query.getPcsn()) || ObjectUtil.isNotEmpty(query.getBill_code()) || ObjectUtil.isNotEmpty(query.getStatus())) {
|
||||
BigDecimal counts = this.baseMapper.queryTreeCounts(query);
|
||||
for (PmFormDataDto r : pmFormDataDtos) {
|
||||
r.setSto_qty(counts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user