|
|
|
@ -1,64 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package jnpf.material.controller;
|
|
|
|
|
package jnpf.materialvo.controller;
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import jnpf.base.ActionResult;
|
|
|
|
|
import jnpf.base.vo.PageListVO;
|
|
|
|
|
import jnpf.base.vo.PaginationVO;
|
|
|
|
|
import jnpf.base.UserInfo;
|
|
|
|
|
import jnpf.base.vo.DownloadVO;
|
|
|
|
|
import jnpf.base.vo.PageListVO;
|
|
|
|
|
import jnpf.base.vo.PaginationVO;
|
|
|
|
|
import jnpf.config.ConfigValueUtil;
|
|
|
|
|
import jnpf.exception.DataException;
|
|
|
|
|
import jnpf.material.entity.MaterialMobileEntity;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import jnpf.base.entity.ProvinceEntity;
|
|
|
|
|
import jnpf.material.model.material.*;
|
|
|
|
|
import jnpf.material.model.material.MaterialPagination;
|
|
|
|
|
import jnpf.entity.*;
|
|
|
|
|
import jnpf.materialvo.entity.MaterialEntity;
|
|
|
|
|
import jnpf.materialvo.entity.MaterialVoMobileEntity;
|
|
|
|
|
import jnpf.materialvo.model.material.*;
|
|
|
|
|
import jnpf.materialvo.service.MaterialService;
|
|
|
|
|
import jnpf.util.*;
|
|
|
|
|
import jnpf.base.util.*;
|
|
|
|
|
import jnpf.base.vo.ListVO;
|
|
|
|
|
import jnpf.util.context.SpringContext;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import jnpf.util.enums.FileTypeEnum;
|
|
|
|
|
import jnpf.util.file.UploadUtil;
|
|
|
|
|
import lombok.Cleanup;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import jnpf.material.entity.MaterialEntity;
|
|
|
|
|
import jnpf.material.service.MaterialService;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import jnpf.util.GeneraterSwapUtil;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import jnpf.util.file.UploadUtil;
|
|
|
|
|
import jnpf.util.enums.FileTypeEnum;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* material
|
|
|
|
|
* 物料档案
|
|
|
|
|
* @版本: V3.2.0
|
|
|
|
|
* @版权: LINKAGE-BOOT
|
|
|
|
|
* @作者: LINKAGE-BOOT研发团队
|
|
|
|
|
* @日期: 2023-01-05
|
|
|
|
|
* @日期: 2023-02-15
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
|
|
|
|
@Api(tags = "material" , value = "Material")
|
|
|
|
|
@RequestMapping("/api/Material/Material")
|
|
|
|
|
@Api(tags = "物料档案" , value = "example")
|
|
|
|
|
@RequestMapping("/api/example/Material")
|
|
|
|
|
public class MaterialController {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@ -82,12 +73,11 @@ public class MaterialController {
|
|
|
|
|
* @param materialPagination
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("列表")
|
|
|
|
|
@PostMapping("/getList")
|
|
|
|
|
public ActionResult list(@RequestBody MaterialPagination materialPagination)throws IOException{
|
|
|
|
|
List<MaterialMobileEntity> list= materialService.getList(materialPagination);
|
|
|
|
|
List<MaterialVoMobileEntity> list= materialService.getList(materialPagination);
|
|
|
|
|
//处理id字段转名称,若无需转或者为空可删除
|
|
|
|
|
for(MaterialMobileEntity entity:list){
|
|
|
|
|
for(MaterialVoMobileEntity entity:list){
|
|
|
|
|
Map<String,Object> outAreaMap = new HashMap<>();
|
|
|
|
|
entity.setOutArea(generaterSwapUtil.getPopupSelectValue("381404161809350213","id","areaname",entity.getOutArea(),outAreaMap));
|
|
|
|
|
Map<String,Object> inAreaMap = new HashMap<>();
|
|
|
|
@ -117,6 +107,7 @@ public class MaterialController {
|
|
|
|
|
public ActionResult create(@RequestBody @Valid MaterialCrForm materialCrForm) throws DataException {
|
|
|
|
|
String mainId =RandomUtil.uuId();
|
|
|
|
|
UserInfo userInfo=userProvider.get();
|
|
|
|
|
materialCrForm.setCreatorTime(DateUtil.getNow());
|
|
|
|
|
MaterialEntity entity = JsonUtil.getJsonToBean(materialCrForm, MaterialEntity.class);
|
|
|
|
|
entity.setId(mainId);
|
|
|
|
|
materialService.save(entity);
|
|
|
|
@ -157,13 +148,13 @@ public class MaterialController {
|
|
|
|
|
return ActionResult.fail("请选择导出字段");
|
|
|
|
|
}
|
|
|
|
|
MaterialPagination materialPagination=JsonUtil.getJsonToBean(materialPaginationExportModel, MaterialPagination.class);
|
|
|
|
|
List<MaterialMobileEntity> list= materialService.getTypeList(materialPagination,materialPaginationExportModel.getDataType());
|
|
|
|
|
List<MaterialEntity> list= materialService.getTypeList(materialPagination,materialPaginationExportModel.getDataType());
|
|
|
|
|
//处理id字段转名称,若无需转或者为空可删除
|
|
|
|
|
for(MaterialEntity entity:list){
|
|
|
|
|
Map<String,Object> outAreaMap = new HashMap<>();
|
|
|
|
|
entity.setOutArea(generaterSwapUtil.swapRelationFormValue("comInputField102",entity.getOutArea(),"294012196529150981",outAreaMap));
|
|
|
|
|
entity.setOutArea(generaterSwapUtil.getPopupSelectValue("381404161809350213","id","areaname",entity.getOutArea(),outAreaMap));
|
|
|
|
|
Map<String,Object> inAreaMap = new HashMap<>();
|
|
|
|
|
entity.setInArea(generaterSwapUtil.swapRelationFormValue("comInputField102",entity.getInArea(),"294012196529150981",inAreaMap));
|
|
|
|
|
entity.setInArea(generaterSwapUtil.getPopupSelectValue("381404161809350213","id","areaname",entity.getInArea(),inAreaMap));
|
|
|
|
|
}
|
|
|
|
|
List<MaterialListVO> listVO=JsonUtil.getJsonToList(list,MaterialListVO.class);
|
|
|
|
|
for(MaterialListVO materialVO:listVO){
|
|
|
|
@ -186,14 +177,11 @@ public class MaterialController {
|
|
|
|
|
case "itemCode" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("物料编码" ,"itemCode"));
|
|
|
|
|
break;
|
|
|
|
|
case "description" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("物料名称" ,"description"));
|
|
|
|
|
break;
|
|
|
|
|
case "organizationCode" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("库存组织代码" ,"organizationCode"));
|
|
|
|
|
case "itemName" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("物料名称" ,"itemName"));
|
|
|
|
|
break;
|
|
|
|
|
case "primaryUomCode" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("主单位代码" ,"primaryUomCode"));
|
|
|
|
|
case "description" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("物料说明" ,"description"));
|
|
|
|
|
break;
|
|
|
|
|
case "primaryUnitOmeasure" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("主单位名称" ,"primaryUnitOmeasure"));
|
|
|
|
@ -210,33 +198,30 @@ public class MaterialController {
|
|
|
|
|
case "inArea" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("默认入库区" ,"inArea"));
|
|
|
|
|
break;
|
|
|
|
|
case "creatorusername" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("创建人名称" ,"creatorusername"));
|
|
|
|
|
case "standardCost" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("标准成本" ,"standardCost"));
|
|
|
|
|
break;
|
|
|
|
|
case "creatortime" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("创建时间" ,"creatortime"));
|
|
|
|
|
case "financial" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("财务类别" ,"financial"));
|
|
|
|
|
break;
|
|
|
|
|
case "lastmodifyusername" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("修改人名称" ,"lastmodifyusername"));
|
|
|
|
|
break;
|
|
|
|
|
case "lastmodifytime" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("修改时间" ,"lastmodifytime"));
|
|
|
|
|
case "financialName" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("类别名称" ,"financialName"));
|
|
|
|
|
break;
|
|
|
|
|
case "effectiveStatus" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("生效状态" ,"effectiveStatus"));
|
|
|
|
|
break;
|
|
|
|
|
case "processingType" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("处理类型" ,"processingType"));
|
|
|
|
|
break;
|
|
|
|
|
case "readTag" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("读取标记" ,"readTag"));
|
|
|
|
|
break;
|
|
|
|
|
case "readDate" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("读取时间" ,"readDate"));
|
|
|
|
|
case "itemId" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("ERP物料ID" ,"itemId"));
|
|
|
|
|
break;
|
|
|
|
|
case "errorMessage" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("错误信息" ,"errorMessage"));
|
|
|
|
|
break;
|
|
|
|
|
case "creatorTime" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("创建时间" ,"creatorTime"));
|
|
|
|
|
break;
|
|
|
|
|
case "lastModifyTime" :
|
|
|
|
|
entitys.add(new ExcelExportEntity("修改时间" ,"lastModifyTime"));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -300,6 +285,12 @@ public class MaterialController {
|
|
|
|
|
public ActionResult<MaterialInfoVO> info(@PathVariable("id") String id){
|
|
|
|
|
MaterialEntity entity= materialService.getInfo(id);
|
|
|
|
|
MaterialInfoVO vo=JsonUtil.getJsonToBean(entity, MaterialInfoVO.class);
|
|
|
|
|
if(vo.getCreatorTime()!=null){
|
|
|
|
|
vo.setCreatorTime(vo.getCreatorTime());
|
|
|
|
|
}
|
|
|
|
|
if(vo.getLastModifyTime()!=null){
|
|
|
|
|
vo.setLastModifyTime(vo.getLastModifyTime());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//子表
|
|
|
|
|
//副表
|
|
|
|
@ -323,9 +314,9 @@ public class MaterialController {
|
|
|
|
|
|
|
|
|
|
//添加到详情表单对象中
|
|
|
|
|
Map<String,Object> outAreaMap = new HashMap<>();
|
|
|
|
|
vo.setOutArea(generaterSwapUtil.swapRelationFormValue("comInputField102",vo.getOutArea(),"294012196529150981",outAreaMap));
|
|
|
|
|
vo.setOutArea(generaterSwapUtil.getPopupSelectValue("381404161809350213","id","areaname",vo.getOutArea(),outAreaMap));
|
|
|
|
|
Map<String,Object> inAreaMap = new HashMap<>();
|
|
|
|
|
vo.setInArea(generaterSwapUtil.swapRelationFormValue("comInputField102",vo.getInArea(),"294012196529150981",inAreaMap));
|
|
|
|
|
vo.setInArea(generaterSwapUtil.getPopupSelectValue("381404161809350213","id","areaname",vo.getInArea(),inAreaMap));
|
|
|
|
|
|
|
|
|
|
return ActionResult.success(vo);
|
|
|
|
|
}
|
|
|
|
@ -345,7 +336,9 @@ public class MaterialController {
|
|
|
|
|
UserInfo userInfo=userProvider.get();
|
|
|
|
|
MaterialEntity entity= materialService.getInfo(id);
|
|
|
|
|
if(entity!=null){
|
|
|
|
|
materialUpForm.setLastModifyTime(DateUtil.getNow());
|
|
|
|
|
MaterialEntity subentity=JsonUtil.getJsonToBean(materialUpForm, MaterialEntity.class);
|
|
|
|
|
subentity.setCreatorTime(entity.getCreatorTime());
|
|
|
|
|
materialService.update(id, subentity);
|
|
|
|
|
return ActionResult.success("更新成功");
|
|
|
|
|
}else{
|