Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package org.nl.modules.tools.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -97,4 +98,12 @@ public class LocalStorageController {
|
||||
localStorageService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导入数据")
|
||||
@PostMapping("/importExcel")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> importExcel(@RequestBody String path) {
|
||||
localStorageService.importExcel(path);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,4 +81,10 @@ public interface LocalStorageService {
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<LocalStorageDto> localStorageDtos, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param path
|
||||
*/
|
||||
void importExcel(String path);
|
||||
}
|
||||
@@ -15,21 +15,23 @@
|
||||
*/
|
||||
package org.nl.modules.tools.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.config.FileProperties;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.PageUtil;
|
||||
import org.nl.modules.common.utils.QueryHelp;
|
||||
import org.nl.modules.common.utils.ValidationUtil;
|
||||
import org.nl.modules.common.utils.*;
|
||||
import org.nl.modules.tools.domain.LocalStorage;
|
||||
import org.nl.modules.tools.repository.LocalStorageRepository;
|
||||
import org.nl.modules.tools.service.LocalStorageService;
|
||||
import org.nl.modules.tools.service.dto.LocalStorageDto;
|
||||
import org.nl.modules.tools.service.dto.LocalStorageQueryCriteria;
|
||||
import org.nl.modules.tools.service.mapstruct.LocalStorageMapper;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -135,4 +137,43 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(String path) {
|
||||
WQLObject measureunitTab = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
WQLObject materialbaseTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
List<Map<String, Object>> listMap = EasyExcel.read(path).sheet().doReadSync();
|
||||
// listMap.remove(0);
|
||||
for (int i = 0; i < listMap.size(); i++) {
|
||||
Map<String, Object> map = listMap.get(i);
|
||||
String material_code = String.valueOf(map.get(5));
|
||||
String material_name = String.valueOf(map.get(6));
|
||||
String unit_code = String.valueOf(map.get(7));
|
||||
JSONObject object = measureunitTab.query("unit_code = '" + unit_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(object)) throw new BadRequestException("空" + unit_code);
|
||||
JSONObject material = new JSONObject();
|
||||
material.put("material_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
material.put("material_code", material_code);
|
||||
material.put("material_name", material_name);
|
||||
material.put("base_unit_id", object.getString("measure_unit_id"));
|
||||
material.put("is_used", 1);
|
||||
material.put("is_delete", 0);
|
||||
material.put("create_id", currentUserId);
|
||||
material.put("create_name", nickName);
|
||||
material.put("create_time", now);
|
||||
material.put("update_optid", currentUserId);
|
||||
material.put("update_optname", nickName);
|
||||
material.put("update_time", now);
|
||||
materialbaseTab.insert(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
package org.nl.wms.pdm.bi.rest;
|
||||
|
||||
|
||||
import org.nl.wms.pdm.bi.service.SubpackagerelationService;
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "子卷包装关系管理")
|
||||
@RequestMapping("/api/subpackagerelation")
|
||||
@Slf4j
|
||||
public class SubpackagerelationController {
|
||||
|
||||
private final SubpackagerelationService subpackagerelationService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询子卷包装关系")
|
||||
@ApiOperation("查询子卷包装关系")
|
||||
//@SaCheckPermission("@el.check('subpackagerelation:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(subpackagerelationService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增子卷包装关系")
|
||||
@ApiOperation("新增子卷包装关系")
|
||||
//@SaCheckPermission("@el.check('subpackagerelation:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SubpackagerelationDto dto){
|
||||
subpackagerelationService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改子卷包装关系")
|
||||
@ApiOperation("修改子卷包装关系")
|
||||
//@SaCheckPermission("@el.check('subpackagerelation:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SubpackagerelationDto dto){
|
||||
subpackagerelationService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除子卷包装关系")
|
||||
@ApiOperation("删除子卷包装关系")
|
||||
//@SaCheckPermission("@el.check('subpackagerelation:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
subpackagerelationService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
package org.nl.wms.pdm.bi.service;
|
||||
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
**/
|
||||
public interface SubpackagerelationService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<SubpackagerelationDto>
|
||||
*/
|
||||
List<SubpackagerelationDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param workorder_id ID
|
||||
* @return Subpackagerelation
|
||||
*/
|
||||
SubpackagerelationDto findById(Long workorder_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Subpackagerelation
|
||||
*/
|
||||
SubpackagerelationDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(SubpackagerelationDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(SubpackagerelationDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.nl.wms.pdm.bi.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
**/
|
||||
@Data
|
||||
public class SubpackagerelationDto implements Serializable {
|
||||
|
||||
/** 子卷包装标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long workorder_id;
|
||||
|
||||
/** 木箱唯一码 */
|
||||
private String package_box_SN;
|
||||
|
||||
/** 箱内子卷数量 */
|
||||
private BigDecimal quanlity_in_box;
|
||||
|
||||
/** 木箱自身重量 */
|
||||
private BigDecimal box_weight;
|
||||
|
||||
/** 保质期 */
|
||||
private BigDecimal quality_guaran_period;
|
||||
|
||||
/** 销售订单及行号 */
|
||||
private String sale_order_name;
|
||||
|
||||
/** 客户编号 */
|
||||
private String customer_name;
|
||||
|
||||
/** 客户名称 */
|
||||
private String customer_description;
|
||||
|
||||
/** 产品编码 */
|
||||
private String product_name;
|
||||
|
||||
/** 产品描述 */
|
||||
private String product_description;
|
||||
|
||||
/** 入库日期 */
|
||||
private String date_of_FG_inbound;
|
||||
|
||||
/** 子卷号 */
|
||||
private String container_name;
|
||||
|
||||
/** 产品规格(幅宽) */
|
||||
private String width;
|
||||
|
||||
/** 产品厚度 */
|
||||
private String thickness;
|
||||
|
||||
/** 单位面积质量 */
|
||||
private BigDecimal mass_per_unit_area;
|
||||
|
||||
/** 净重 */
|
||||
private BigDecimal net_weight;
|
||||
|
||||
/** 长度 */
|
||||
private BigDecimal length;
|
||||
|
||||
/** 制造完成日期 */
|
||||
private String date_of_production;
|
||||
|
||||
/** 计划外分切的子卷 */
|
||||
private String is_un_plan_production;
|
||||
|
||||
/** 子卷的物性值1 */
|
||||
private String un_plan_product_property1;
|
||||
|
||||
/** 子卷的物性值2 */
|
||||
private String un_plan_product_property2;
|
||||
|
||||
/** 子卷的物性值3 */
|
||||
private String un_plan_product_property3;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 创建人 */
|
||||
private Long create_id;
|
||||
|
||||
/** 创建人姓名 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
|
||||
/** 是否需要重打外包装标签 */
|
||||
private String isRePrintPackageBoxLabel;
|
||||
|
||||
/** 是否需要拆包重打子卷标签 */
|
||||
private String isUnPackBox;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
package org.nl.wms.pdm.bi.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.pdm.bi.service.SubpackagerelationService;
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SubpackagerelationServiceImpl implements SubpackagerelationService {
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "package_box_SN desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SubpackagerelationDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(SubpackagerelationDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubpackagerelationDto findById(Long workorder_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( SubpackagerelationDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubpackagerelationDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( SubpackagerelationDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(SubpackagerelationDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(SubpackagerelationDto dto) {
|
||||
SubpackagerelationDto entity = this.findById(dto.getWorkorder_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
for (Long workorder_id: ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("workorder_id", String.valueOf(workorder_id));
|
||||
param.put("is_delete", "1");
|
||||
// param.put("update_optid", currentUserId);
|
||||
// param.put("update_optname", nickName);
|
||||
// param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user