feat():前端组件样式修改,后端逻辑优化;

master
jiyufei 3 months ago
parent 1600316297
commit 50f2217a22

@ -4,6 +4,7 @@ import jnpf.model.yysmonthlyproduction.*;
import jnpf.entity.*; import jnpf.entity.*;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/** /**
* yysMonthlyProduction * yysMonthlyProduction
@ -29,6 +30,6 @@ public interface YysMonthlyProductionService extends IService<YysMonthlyProducti
//副表数据方法 //副表数据方法
String checkForm(YysMonthlyProductionForm form,int i); String checkForm(YysMonthlyProductionForm form,int i);
String saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm, String id, boolean isSave) ; String saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm,String id, boolean isSave);
} }

@ -1,17 +1,28 @@
package jnpf.service.impl; package jnpf.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jnpf.entity.*; import jnpf.entity.*;
import jnpf.mapper.YysMonthlyProductionMapper; import jnpf.mapper.YysMonthlyProductionMapper;
import jnpf.service.*; import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysmonthlyproduction.*; import jnpf.model.yysmonthlyproduction.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil; import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel; import jnpf.model.QueryModel;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -25,6 +36,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*; import jnpf.util.*;
import java.util.*; import java.util.*;
@ -49,17 +63,7 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
@Override @Override
public List<YysMonthlyProductionEntity> getList(YysMonthlyProductionPagination yysMonthlyProductionPagination) { public List<YysMonthlyProductionEntity> getList(YysMonthlyProductionPagination yysMonthlyProductionPagination) {
// QueryWrapper<YysMonthlyProductionEntity> wrapper = new QueryWrapper<>();
// if (ObjectUtil.isNotEmpty(yysMonthlyProductionPagination.getYears())) {
// wrapper.lambda().eq(YysMonthlyProductionEntity::getYears, yysMonthlyProductionPagination.getYears().toString());
// }
// wrapper.lambda().isNull(YysMonthlyProductionEntity::getDeleteMark);
// wrapper.last("ORDER BY CAST(day AS UNSIGNED)");
// Page<YysMonthlyProductionEntity> page = new Page<>(yysMonthlyProductionPagination.getCurrentPage(), yysMonthlyProductionPagination.getPageSize());
// IPage<YysMonthlyProductionEntity> userIPage = this.page(page, wrapper);
// return yysMonthlyProductionPagination.setData(userIPage.getRecords(), userIPage.getTotal());
return getTypeList(yysMonthlyProductionPagination, yysMonthlyProductionPagination.getDataType()); return getTypeList(yysMonthlyProductionPagination, yysMonthlyProductionPagination.getDataType());
} }
/** /**
@ -161,10 +165,13 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
if (ObjectUtil.isNotEmpty(yysMonthlyProductionPagination.getYears())) { if (ObjectUtil.isNotEmpty(yysMonthlyProductionPagination.getYears())) {
yysMonthlyProductionNum++; yysMonthlyProductionNum++;
String value = yysMonthlyProductionPagination.getYears() instanceof List ? List YearsList = JsonUtil.getJsonToList(yysMonthlyProductionPagination.getYears(), String.class);
JsonUtil.getObjectToString(yysMonthlyProductionPagination.getYears()) : Long fir = Long.valueOf(String.valueOf(YearsList.get(0)));
String.valueOf(yysMonthlyProductionPagination.getYears()); Long sec = Long.valueOf(String.valueOf(YearsList.get(1)));
yysMonthlyProductionQueryWrapper.lambda().eq(YysMonthlyProductionEntity::getYears, value);
yysMonthlyProductionQueryWrapper.lambda().ge(YysMonthlyProductionEntity::getYears, new Date(fir))
.le(YysMonthlyProductionEntity::getYears, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
} }
@ -202,6 +209,8 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
List<String> finalAllRuleIDlist = allRuleIDlist; List<String> finalAllRuleIDlist = allRuleIDlist;
yysMonthlyProductionQueryWrapper.lambda().and(t -> t.in(YysMonthlyProductionEntity::getId, finalAllRuleIDlist)); yysMonthlyProductionQueryWrapper.lambda().and(t -> t.in(YysMonthlyProductionEntity::getId, finalAllRuleIDlist));
} }
//假删除标志
yysMonthlyProductionQueryWrapper.lambda().isNull(YysMonthlyProductionEntity::getDeleteMark);
//排序 //排序
if (StringUtil.isEmpty(yysMonthlyProductionPagination.getSidx())) { if (StringUtil.isEmpty(yysMonthlyProductionPagination.getSidx())) {
@ -270,21 +279,31 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
id = form.getId(); id = form.getId();
} }
//主表字段验证 //主表字段验证
if (StringUtil.isEmpty(form.getYears())) {
return "年月不能为空";
}
if (StringUtil.isEmpty(form.getProductId())) { if (StringUtil.isEmpty(form.getProductId())) {
return "产品编码不能为空"; return "产品编码不能为空";
} }
if (StringUtil.isEmpty(form.getProductName())) {
return "产品名称不能为空";
}
if (StringUtil.isEmpty(form.getModel())) { if (StringUtil.isEmpty(form.getModel())) {
return "规格型号不能为空"; return "规格型号不能为空";
} }
if (StringUtil.isEmpty(form.getMeasurementUnit())) { if (StringUtil.isEmpty(form.getMeasurementUnit())) {
return "计量单位不能为空"; return "计量单位不能为空";
} }
if (StringUtil.isNotEmpty(form.getMeasurementNumber())) {
if (!Pattern.compile("^\\d+$").matcher(String.valueOf(form.getMeasurementNumber())).matches()) {
return "请输入正确的数字";
}
}
if (StringUtil.isEmpty(form.getCurrentInventory())) { if (StringUtil.isEmpty(form.getCurrentInventory())) {
return "当前库存不能为空"; return "当前库存不能为空";
} }
if (StringUtil.isNotEmpty(form.getCurrentInventory())) {
if (!Pattern.compile("^\\d+$").matcher(String.valueOf(form.getCurrentInventory())).matches()) {
return "请输入正确的数字";
}
}
return countRecover; return countRecover;
} }
@ -299,31 +318,33 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
@Transactional @Transactional
public String saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm, String id, boolean isSave) { public String saveOrUpdate(YysMonthlyProductionForm yysMonthlyProductionForm, String id, boolean isSave) {
UserInfo userInfo = userProvider.get(); UserInfo userInfo = userProvider.get();
LambdaQueryWrapper<YysMonthlyProductionEntity> wrapper = new LambdaQueryWrapper<>(YysMonthlyProductionEntity.class);
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId()); UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysMonthlyProductionForm = JsonUtil.getJsonToBean( yysMonthlyProductionForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysMonthlyProductionConstant.getFormData(), yysMonthlyProductionForm), YysMonthlyProductionForm.class); generaterSwapUtil.swapDatetime(YysMonthlyProductionConstant.getFormData(), yysMonthlyProductionForm), YysMonthlyProductionForm.class);
YysMonthlyProductionEntity entity = JsonUtil.getJsonToBean(yysMonthlyProductionForm, YysMonthlyProductionEntity.class); YysMonthlyProductionEntity entity = JsonUtil.getJsonToBean(yysMonthlyProductionForm, YysMonthlyProductionEntity.class);
java.sql.Date sqlDate = new java.sql.Date(Long.parseLong(yysMonthlyProductionForm.getYears()));
LambdaQueryWrapper<YysMonthlyProductionEntity> wrapper = new LambdaQueryWrapper<>(YysMonthlyProductionEntity.class);
wrapper.eq(YysMonthlyProductionEntity::getProductName, yysMonthlyProductionForm.getProductName());
wrapper.eq(YysMonthlyProductionEntity::getProductId, yysMonthlyProductionForm.getProductId());
wrapper.eq(YysMonthlyProductionEntity::getYears, sqlDate);
if (isSave) { if (isSave) {
wrapper.eq(YysMonthlyProductionEntity::getYears, yysMonthlyProductionForm.getYears());
wrapper.eq(YysMonthlyProductionEntity::getProductName, yysMonthlyProductionForm.getProductName());
if (CollectionUtils.isNotEmpty(this.list(wrapper))) { if (CollectionUtils.isNotEmpty(this.list(wrapper))) {
return "所选年月与产品已被创建"; return "所选年月及产品名称已经创建";
} }
String mainId = RandomUtil.uuId(); String mainId = RandomUtil.uuId();
entity.setCreatorTime(DateUtil.getNowDate()); entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userInfo.getUserId()); entity.setCreatorUserId(userInfo.getUserId());
entity.setId(mainId); entity.setId(mainId);
entity.setVersion(0);
} else { } else {
YysMonthlyProductionEntity byId = this.getById(yysMonthlyProductionForm.getId());
wrapper.ne(YysMonthlyProductionEntity::getYears, yysMonthlyProductionForm.getYears()); boolean isProductNameChanged = !byId.getProductName().equals(yysMonthlyProductionForm.getProductName());
wrapper.ne(YysMonthlyProductionEntity::getProductName, yysMonthlyProductionForm.getProductName()); boolean isProductCodeChanged = !byId.getProductId().equals(yysMonthlyProductionForm.getProductId());
boolean isYearsChanged = !byId.getYears().equals(sqlDate);
if (CollectionUtils.isNotEmpty(this.list(wrapper))) { if (isProductNameChanged || isProductCodeChanged || isYearsChanged) {
return "所选年月与产品已被创建"; if (CollectionUtils.isNotEmpty(this.list(wrapper))) {
return "所选年月及产品名称已经存在,无法修改";
}
} }
entity.setLastModifyTime(DateUtil.getNowDate()); entity.setLastModifyTime(DateUtil.getNowDate());
entity.setLastModifyUserId(userInfo.getUserId()); entity.setLastModifyUserId(userInfo.getUserId());
@ -333,6 +354,5 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl<YysMonthlyProdu
return "操作成功"; return "操作成功";
} }
return "操作失败"; return "操作失败";
} }
} }

@ -15,16 +15,20 @@ import jnpf.model.yysmonthlyproduction.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.*; import java.util.*;
import jnpf.annotation.JnpfField; import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO; import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO; import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO; import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil; import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity; import jnpf.base.entity.ProvinceEntity;
import java.io.IOException; import java.io.IOException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity; import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException; import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -36,7 +40,9 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import java.io.File; import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel; import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel; import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel; import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
@ -51,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
/** /**
* yysMonthlyProduction * yysMonthlyProduction
*
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
@ -58,7 +65,7 @@ import org.springframework.transaction.annotation.Transactional;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@Tag(name = "yysMonthlyProduction" , description = "example") @Tag(name = "yysMonthlyProduction", description = "example")
@RequestMapping("/api/example/YysMonthlyProduction") @RequestMapping("/api/example/YysMonthlyProduction")
public class YysMonthlyProductionController { public class YysMonthlyProductionController {
@ -72,30 +79,29 @@ public class YysMonthlyProductionController {
private YysMonthlyProductionService yysMonthlyProductionService; private YysMonthlyProductionService yysMonthlyProductionService;
@Autowired @Autowired
private ConfigValueUtil configValueUtil; private ConfigValueUtil configValueUtil;
/** /**
* *
* *
* @param yysMonthlyProductionPagination * @param yysMonthlyProductionPagination
* @return * @return
*/ */
@Operation(summary = "获取列表") @Operation(summary = "获取列表")
@PostMapping("/getList") @PostMapping("/getList")
public ActionResult list(@RequestBody YysMonthlyProductionPagination yysMonthlyProductionPagination)throws IOException{ public ActionResult list(@RequestBody YysMonthlyProductionPagination yysMonthlyProductionPagination) throws IOException {
List<YysMonthlyProductionEntity> list= yysMonthlyProductionService.getList(yysMonthlyProductionPagination); List<YysMonthlyProductionEntity> list = yysMonthlyProductionService.getList(yysMonthlyProductionPagination);
List<Map<String, Object>> realList=new ArrayList<>(); List<Map<String, Object>> realList = new ArrayList<>();
for (YysMonthlyProductionEntity entity : list) { for (YysMonthlyProductionEntity entity : list) {
Map<String, Object> yysMonthlyProductionMap=JsonUtil.entityToMap(entity); Map<String, Object> yysMonthlyProductionMap = JsonUtil.entityToMap(entity);
yysMonthlyProductionMap.put("id", yysMonthlyProductionMap.get("id")); yysMonthlyProductionMap.put("id", yysMonthlyProductionMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
realList.add(yysMonthlyProductionMap); realList.add(yysMonthlyProductionMap);
} }
//数据转换 //数据转换
realList = generaterSwapUtil.swapDataList(realList, YysMonthlyProductionConstant.getFormData(), YysMonthlyProductionConstant.getColumnData(), yysMonthlyProductionPagination.getModuleId(),false); realList = generaterSwapUtil.swapDataList(realList, YysMonthlyProductionConstant.getFormData(), YysMonthlyProductionConstant.getColumnData(), yysMonthlyProductionPagination.getModuleId(), false);
//返回对象 //返回对象
PageListVO vo = new PageListVO(); PageListVO vo = new PageListVO();
@ -104,94 +110,100 @@ public class YysMonthlyProductionController {
vo.setPagination(page); vo.setPagination(page);
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
* *
* @param yysMonthlyProductionForm * @param yysMonthlyProductionForm
* @return * @return
*/ */
@PostMapping() @PostMapping()
@Operation(summary = "创建") @Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid YysMonthlyProductionForm yysMonthlyProductionForm) { public ActionResult create(@RequestBody @Valid YysMonthlyProductionForm yysMonthlyProductionForm) {
String b = yysMonthlyProductionService.checkForm(yysMonthlyProductionForm,0); String b = yysMonthlyProductionService.checkForm(yysMonthlyProductionForm, 0);
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b ); return ActionResult.fail(b);
}
String result = yysMonthlyProductionService.saveOrUpdate(yysMonthlyProductionForm, null, true);
if (result.contains("成功")) {
return ActionResult.success(result);
} }
return ActionResult.success(yysMonthlyProductionService.saveOrUpdate(yysMonthlyProductionForm, null, true)); return ActionResult.fail(result);
} }
/** /**
* Excel * Excel
* *
* @return * @return
*/ */
@Operation(summary = "导出Excel") @Operation(summary = "导出Excel")
@PostMapping("/Actions/Export") @PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody YysMonthlyProductionPagination yysMonthlyProductionPagination) throws IOException { public ActionResult Export(@RequestBody YysMonthlyProductionPagination yysMonthlyProductionPagination) throws IOException {
if (StringUtil.isEmpty(yysMonthlyProductionPagination.getSelectKey())){ if (StringUtil.isEmpty(yysMonthlyProductionPagination.getSelectKey())) {
return ActionResult.fail("请选择导出字段"); return ActionResult.fail("请选择导出字段");
} }
List<YysMonthlyProductionEntity> list= yysMonthlyProductionService.getList(yysMonthlyProductionPagination); List<YysMonthlyProductionEntity> list = yysMonthlyProductionService.getList(yysMonthlyProductionPagination);
List<Map<String, Object>> realList=new ArrayList<>(); List<Map<String, Object>> realList = new ArrayList<>();
for (YysMonthlyProductionEntity entity : list) { for (YysMonthlyProductionEntity entity : list) {
Map<String, Object> yysMonthlyProductionMap=JsonUtil.entityToMap(entity); Map<String, Object> yysMonthlyProductionMap = JsonUtil.entityToMap(entity);
yysMonthlyProductionMap.put("id", yysMonthlyProductionMap.get("id")); yysMonthlyProductionMap.put("id", yysMonthlyProductionMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
realList.add(yysMonthlyProductionMap); realList.add(yysMonthlyProductionMap);
} }
//数据转换 //数据转换
realList = generaterSwapUtil.swapDataList(realList, YysMonthlyProductionConstant.getFormData(), YysMonthlyProductionConstant.getColumnData(), yysMonthlyProductionPagination.getModuleId(),false); realList = generaterSwapUtil.swapDataList(realList, YysMonthlyProductionConstant.getFormData(), YysMonthlyProductionConstant.getColumnData(), yysMonthlyProductionPagination.getModuleId(), false);
String[]keys=!StringUtil.isEmpty(yysMonthlyProductionPagination.getSelectKey())?yysMonthlyProductionPagination.getSelectKey():new String[0]; String[] keys = !StringUtil.isEmpty(yysMonthlyProductionPagination.getSelectKey()) ? yysMonthlyProductionPagination.getSelectKey() : new String[0];
UserInfo userInfo=userProvider.get(); UserInfo userInfo = userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo); DownloadVO vo = this.creatModelExcel(configValueUtil.getTemporaryFilePath(), realList, keys, userInfo);
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
*/ */
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){ public DownloadVO creatModelExcel(String path, List<Map<String, Object>> list, String[] keys, UserInfo userInfo) {
DownloadVO vo=DownloadVO.builder().build(); DownloadVO vo = DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>(); List<ExcelExportEntity> entitys = new ArrayList<>();
if(keys.length>0){ if (keys.length > 0) {
for(String key:keys){ for (String key : keys) {
switch(key){ switch (key) {
case "years" : case "years":
entitys.add(new ExcelExportEntity("年月" ,"years")); entitys.add(new ExcelExportEntity("年月", "years"));
break; break;
case "productId" : case "productId":
entitys.add(new ExcelExportEntity("产品编码" ,"productId")); entitys.add(new ExcelExportEntity("产品编码", "productId"));
break; break;
case "productName" : case "productName":
entitys.add(new ExcelExportEntity("产品名称" ,"productName")); entitys.add(new ExcelExportEntity("产品名称", "productName"));
break; break;
case "model" : case "model":
entitys.add(new ExcelExportEntity("规格型号" ,"model")); entitys.add(new ExcelExportEntity("规格型号", "model"));
break; break;
case "measurementUnit" : case "measurementUnit":
entitys.add(new ExcelExportEntity("计量单位" ,"measurementUnit")); entitys.add(new ExcelExportEntity("计量单位", "measurementUnit"));
break; break;
case "measurementNumber" : case "measurementNumber":
entitys.add(new ExcelExportEntity("计量数量" ,"measurementNumber")); entitys.add(new ExcelExportEntity("计量数量", "measurementNumber"));
break; break;
case "currentInventory" : case "currentInventory":
entitys.add(new ExcelExportEntity("当前库存" ,"currentInventory")); entitys.add(new ExcelExportEntity("当前库存", "currentInventory"));
break; break;
case "deliveryTime" : case "deliveryTime":
entitys.add(new ExcelExportEntity("交期" ,"deliveryTime")); entitys.add(new ExcelExportEntity("交期", "deliveryTime"));
break; break;
default: default:
break; break;
} }
} }
} }
ExportParams exportParams = new ExportParams(null, "表单信息"); ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF); exportParams.setType(ExcelType.XSSF);
try{ try {
@Cleanup Workbook workbook = new HSSFWorkbook(); @Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){ if (entitys.size() > 0) {
if (list.size()==0){ if (list.size() == 0) {
list.add(new HashMap<>()); list.add(new HashMap<>());
} }
//去除空数据 //去除空数据
@ -201,8 +213,8 @@ public class YysMonthlyProductionController {
for (String key : keys) { for (String key : keys) {
//子表 //子表
if (key.toLowerCase().startsWith("tablefield")) { if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" )); String tableField = key.substring(0, key.indexOf("-"));
String field = key.substring(key.indexOf("-" ) + 1); String field = key.substring(key.indexOf("-") + 1);
Object o = map.get(tableField); Object o = map.get(tableField);
if (o != null) { if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o; List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
@ -228,7 +240,7 @@ public class YysMonthlyProductionController {
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList(); List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) { if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList); entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList); dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
} }
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList); workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
@ -245,6 +257,7 @@ public class YysMonthlyProductionController {
} }
return vo; return vo;
} }
@Operation(summary = "上传文件") @Operation(summary = "上传文件")
@PostMapping("/Uploader") @PostMapping("/Uploader")
public ActionResult<Object> Uploader() { public ActionResult<Object> Uploader() {
@ -264,75 +277,75 @@ public class YysMonthlyProductionController {
} }
/** /**
* *
* *
* @return * @return
*/ */
@Operation(summary = "模板下载") @Operation(summary = "模板下载")
@GetMapping("/TemplateDownload") @GetMapping("/TemplateDownload")
public ActionResult<DownloadVO> TemplateDownload(){ public ActionResult<DownloadVO> TemplateDownload() {
DownloadVO vo = DownloadVO.builder().build(); DownloadVO vo = DownloadVO.builder().build();
UserInfo userInfo = userProvider.get(); UserInfo userInfo = userProvider.get();
Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
//主表对象 //主表对象
List<ExcelExportEntity> entitys = new ArrayList<>(); List<ExcelExportEntity> entitys = new ArrayList<>();
//以下添加字段 //以下添加字段
entitys.add(new ExcelExportEntity("年月" ,"years")); entitys.add(new ExcelExportEntity("年月", "years"));
entitys.add(new ExcelExportEntity("产品编码" ,"productId")); dataMap.put("years", "例: yyyy-MM");
entitys.add(new ExcelExportEntity("产品名称" ,"productName")); entitys.add(new ExcelExportEntity("产品编码", "productId"));
dataMap.put("productName", "例:技术部/部门编码"); entitys.add(new ExcelExportEntity("产品名称", "productName"));
entitys.add(new ExcelExportEntity("规格型号" ,"model")); entitys.add(new ExcelExportEntity("规格型号", "model"));
entitys.add(new ExcelExportEntity("计量单位" ,"measurementUnit")); entitys.add(new ExcelExportEntity("计量单位", "measurementUnit"));
entitys.add(new ExcelExportEntity("当前库存" ,"currentInventory")); entitys.add(new ExcelExportEntity("当前库存", "currentInventory"));
entitys.add(new ExcelExportEntity("交期" ,"deliveryTime")); entitys.add(new ExcelExportEntity("交期", "deliveryTime"));
dataMap.put("deliveryTime", "例: yyyy-MM-dd"); dataMap.put("deliveryTime", "例: yyyy-MM-dd");
entitys.add(new ExcelExportEntity("计量数量" ,"measurementNumber")); entitys.add(new ExcelExportEntity("计量数量", "measurementNumber"));
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
list.add(dataMap); list.add(dataMap);
ExportParams exportParams = new ExportParams(null, "月生产计划模板"); ExportParams exportParams = new ExportParams(null, "月生产计划模板");
exportParams.setType(ExcelType.XSSF); exportParams.setType(ExcelType.XSSF);
try{ try {
@Cleanup Workbook workbook = new HSSFWorkbook(); @Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){ if (entitys.size() > 0) {
if (list.size()==0){ if (list.size() == 0) {
list.add(new HashMap<>()); list.add(new HashMap<>());
} }
//复杂表头-表头和数据处理 //复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(YysMonthlyProductionConstant.getColumnData(), ColumnDataModel.class); ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(YysMonthlyProductionConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList(); List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) { if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList); entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList); list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList);
} }
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list); workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
} }
String fileName = "月生产计划模板" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xlsx"; String fileName = "月生产计划模板" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName); MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath(); String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName); FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename()); vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName); vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) { } catch (Exception e) {
log.error("模板信息导出Excel错误:{}", e.getMessage()); log.error("模板信息导出Excel错误:{}", e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
* *
* @return * @return
*/ */
@Operation(summary = "导入预览" ) @Operation(summary = "导入预览")
@GetMapping("/ImportPreview") @GetMapping("/ImportPreview")
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception { public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
Map<String, Object> headAndDataMap = new HashMap<>(2); Map<String, Object> headAndDataMap = new HashMap<>(2);
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath(); String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName); FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
File temporary = new File(XSSEscape.escapePath(filePath + fileName)); File temporary = new File(XSSEscape.escapePath(filePath + fileName));
int headerRowIndex = 1; int headerRowIndex = 1;
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setTitleRows(0); params.setTitleRows(0);
params.setHeadRows(headerRowIndex); params.setHeadRows(headerRowIndex);
@ -341,17 +354,17 @@ public class YysMonthlyProductionController {
List<YysMonthlyProductionExcelVO> excelDataList = ExcelImportUtil.importExcel(temporary, YysMonthlyProductionExcelVO.class, params); List<YysMonthlyProductionExcelVO> excelDataList = ExcelImportUtil.importExcel(temporary, YysMonthlyProductionExcelVO.class, params);
// 导入字段 // 导入字段
List<ExcelImFieldModel> columns = new ArrayList<>(); List<ExcelImFieldModel> columns = new ArrayList<>();
columns.add(new ExcelImFieldModel("years","年月")); columns.add(new ExcelImFieldModel("years", "年月"));
columns.add(new ExcelImFieldModel("productId","产品编码")); columns.add(new ExcelImFieldModel("productId", "产品编码"));
columns.add(new ExcelImFieldModel("productName","产品名称")); columns.add(new ExcelImFieldModel("productName", "产品名称"));
columns.add(new ExcelImFieldModel("model","规格型号")); columns.add(new ExcelImFieldModel("model", "规格型号"));
columns.add(new ExcelImFieldModel("measurementUnit","计量单位")); columns.add(new ExcelImFieldModel("measurementUnit", "计量单位"));
columns.add(new ExcelImFieldModel("currentInventory","当前库存")); columns.add(new ExcelImFieldModel("currentInventory", "当前库存"));
columns.add(new ExcelImFieldModel("deliveryTime","交期")); columns.add(new ExcelImFieldModel("deliveryTime", "交期"));
columns.add(new ExcelImFieldModel("measurementNumber","计量数量")); columns.add(new ExcelImFieldModel("measurementNumber", "计量数量"));
headAndDataMap.put("dataRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(excelDataList))); headAndDataMap.put("dataRow", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(excelDataList)));
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns))); headAndDataMap.put("headerRow", JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
} catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ActionResult.fail("表头名称不可更改,表头行不能删除"); return ActionResult.fail("表头名称不可更改,表头行不能删除");
} }
@ -359,148 +372,156 @@ public class YysMonthlyProductionController {
} }
/** /**
* *
* *
* @return * @return
*/ */
@Operation(summary = "导入数据" ) @Operation(summary = "导入数据")
@PostMapping("/ImportData") @PostMapping("/ImportData")
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception { public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
List<Map<String, Object>> listData=new ArrayList<>(); List<Map<String, Object>> listData = new ArrayList<>();
for(Map<String, Object> map : visualImportModel.getList()){ for (Map<String, Object> map : visualImportModel.getList()) {
listData.add(map); listData.add(map);
} }
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel(); ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
uniqueModel.setDbLinkId(YysMonthlyProductionConstant.DBLINKID); uniqueModel.setDbLinkId(YysMonthlyProductionConstant.DBLINKID);
uniqueModel.setUpdate(Objects.equals("2", "2")); uniqueModel.setUpdate(Objects.equals("2", "2"));
ExcelImportModel excelImportModel = generaterSwapUtil.importData(YysMonthlyProductionConstant.getFormData(),listData,uniqueModel, ExcelImportModel excelImportModel = generaterSwapUtil.importData(YysMonthlyProductionConstant.getFormData(), listData, uniqueModel,
YysMonthlyProductionConstant.TABLEFIELDKEY,YysMonthlyProductionConstant.getTableList()); YysMonthlyProductionConstant.TABLEFIELDKEY, YysMonthlyProductionConstant.getTableList());
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel(); List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
for (ImportDataModel model : importDataModel) { for (ImportDataModel model : importDataModel) {
String id = model.getId(); String id = model.getId();
Map<String, Object> result = model.getResultData(); Map<String, Object> result = model.getResultData();
if(StringUtil.isNotEmpty(id)){ if (StringUtil.isNotEmpty(id)) {
update(id, JsonUtil.getJsonToBean(result,YysMonthlyProductionForm.class), true); update(id, JsonUtil.getJsonToBean(result, YysMonthlyProductionForm.class), true);
}else { } else {
create( JsonUtil.getJsonToBean(result,YysMonthlyProductionForm.class)); create(JsonUtil.getJsonToBean(result, YysMonthlyProductionForm.class));
} }
} }
return ActionResult.success(excelImportModel); return ActionResult.success(excelImportModel);
} }
/** /**
* *
* *
* @return * @return
*/ */
@Operation(summary = "导出异常报告") @Operation(summary = "导出异常报告")
@PostMapping("/ImportExceptionData") @PostMapping("/ImportExceptionData")
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) { public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
DownloadVO vo=DownloadVO.builder().build(); DownloadVO vo = DownloadVO.builder().build();
List<YysMonthlyProductionExcelErrorVO> yysMonthlyProductionVOList = JsonUtil.getJsonToList(visualImportModel.getList(), YysMonthlyProductionExcelErrorVO.class); List<YysMonthlyProductionExcelErrorVO> yysMonthlyProductionVOList = JsonUtil.getJsonToList(visualImportModel.getList(), YysMonthlyProductionExcelErrorVO.class);
UserInfo userInfo = userProvider.get(); UserInfo userInfo = userProvider.get();
try{ try {
@Cleanup Workbook workbook = new HSSFWorkbook(); @Cleanup Workbook workbook = new HSSFWorkbook();
ExportParams exportParams = new ExportParams(null, "错误报告"); ExportParams exportParams = new ExportParams(null, "错误报告");
exportParams.setType(ExcelType.XSSF); exportParams.setType(ExcelType.XSSF);
workbook = ExcelExportUtil.exportExcel(exportParams, workbook = ExcelExportUtil.exportExcel(exportParams,
YysMonthlyProductionExcelErrorVO.class, yysMonthlyProductionVOList); YysMonthlyProductionExcelErrorVO.class, yysMonthlyProductionVOList);
String fileName = "错误报告" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx"; String fileName = "错误报告" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName); MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath(); String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName); FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename()); vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName); vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
* @param id *
* @param yysMonthlyProductionForm * @param id
* @return * @param yysMonthlyProductionForm
*/ * @return
*/
@PutMapping("/{id}") @PutMapping("/{id}")
@Operation(summary = "更新") @Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid YysMonthlyProductionForm yysMonthlyProductionForm, public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid YysMonthlyProductionForm yysMonthlyProductionForm,
@RequestParam(value = "isImport", required = false) boolean isImport){ @RequestParam(value = "isImport", required = false) boolean isImport) {
yysMonthlyProductionForm.setId(id); yysMonthlyProductionForm.setId(id);
if (!isImport) { if (!isImport) {
String b = yysMonthlyProductionService.checkForm(yysMonthlyProductionForm,1); String b = yysMonthlyProductionService.checkForm(yysMonthlyProductionForm, 1);
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b ); return ActionResult.fail(b);
} }
} }
YysMonthlyProductionEntity entity= yysMonthlyProductionService.getInfo(id); YysMonthlyProductionEntity entity = yysMonthlyProductionService.getInfo(id);
if(entity!=null){ if (entity != null) {
try{ String result = yysMonthlyProductionService.saveOrUpdate(yysMonthlyProductionForm, null, false);
yysMonthlyProductionService.saveOrUpdate(yysMonthlyProductionForm,id,false); if (result.contains("成功")) {
}catch(Exception e){ return ActionResult.success(result);
return ActionResult.fail("修改数据失败");
} }
return ActionResult.success("更新成功"); return ActionResult.fail(result);
}else{
return ActionResult.fail("更新失败,数据不存在");
} }
return ActionResult.fail("操作失败");
} }
/** /**
* *
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "删除") @Operation(summary = "删除")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@Transactional @Transactional
public ActionResult delete(@PathVariable("id") String id){ public ActionResult delete(@PathVariable("id") String id) {
YysMonthlyProductionEntity entity= yysMonthlyProductionService.getInfo(id); YysMonthlyProductionEntity entity = yysMonthlyProductionService.getInfo(id);
if(entity!=null){ if (entity != null) {
//主表数据删除 //假删除
yysMonthlyProductionService.delete(entity); entity.setDeleteMark(1);
entity.setDeleteTime(DateUtil.getNowDate());
yysMonthlyProductionService.update(id, entity);
} }
return ActionResult.success("删除成功"); return ActionResult.success("删除成功");
} }
/** /**
* () * ()
* 使- * 使-
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "表单信息(详情页)") @Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){ public ActionResult detailInfo(@PathVariable("id") String id) {
YysMonthlyProductionEntity entity= yysMonthlyProductionService.getInfo(id); YysMonthlyProductionEntity entity = yysMonthlyProductionService.getInfo(id);
if(entity==null){ if (entity == null) {
return ActionResult.fail("表单数据不存在!"); return ActionResult.fail("表单数据不存在!");
} }
Map<String, Object> yysMonthlyProductionMap=JsonUtil.entityToMap(entity); Map<String, Object> yysMonthlyProductionMap = JsonUtil.entityToMap(entity);
yysMonthlyProductionMap.put("id", yysMonthlyProductionMap.get("id")); yysMonthlyProductionMap.put("id", yysMonthlyProductionMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
yysMonthlyProductionMap = generaterSwapUtil.swapDataDetail(yysMonthlyProductionMap,YysMonthlyProductionConstant.getFormData(),"590488386381285765",false); yysMonthlyProductionMap = generaterSwapUtil.swapDataDetail(yysMonthlyProductionMap, YysMonthlyProductionConstant.getFormData(), "590488386381285765", false);
return ActionResult.success(yysMonthlyProductionMap); return ActionResult.success(yysMonthlyProductionMap);
} }
/** /**
* () * ()
* 使- * 使-
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "信息") @Operation(summary = "信息")
@GetMapping("/{id}") @GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){ public ActionResult info(@PathVariable("id") String id) {
YysMonthlyProductionEntity entity= yysMonthlyProductionService.getInfo(id); YysMonthlyProductionEntity entity = yysMonthlyProductionService.getInfo(id);
if(entity==null){ if (entity == null) {
return ActionResult.fail("表单数据不存在!"); return ActionResult.fail("表单数据不存在!");
} }
Map<String, Object> yysMonthlyProductionMap=JsonUtil.entityToMap(entity); Map<String, Object> yysMonthlyProductionMap = JsonUtil.entityToMap(entity);
yysMonthlyProductionMap.put("id", yysMonthlyProductionMap.get("id")); yysMonthlyProductionMap.put("id", yysMonthlyProductionMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
yysMonthlyProductionMap = generaterSwapUtil.swapDataForm(yysMonthlyProductionMap,YysMonthlyProductionConstant.getFormData(),YysMonthlyProductionConstant.TABLEFIELDKEY,YysMonthlyProductionConstant.TABLERENAMES); yysMonthlyProductionMap = generaterSwapUtil.swapDataForm(yysMonthlyProductionMap, YysMonthlyProductionConstant.getFormData(), YysMonthlyProductionConstant.TABLEFIELDKEY, YysMonthlyProductionConstant.TABLERENAMES);
return ActionResult.success(yysMonthlyProductionMap); return ActionResult.success(yysMonthlyProductionMap);
} }

@ -2,10 +2,10 @@ package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
/** /**
*
*
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
@ -13,24 +13,24 @@ import java.util.Date;
*/ */
@Data @Data
@TableName("yys_monthly_production") @TableName("yys_monthly_production")
public class YysMonthlyProductionEntity { public class YysMonthlyProductionEntity {
@TableId(value ="ID" ) @TableId(value = "ID")
private String id; private String id;
@TableField(value = "YEARS" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "YEARS", updateStrategy = FieldStrategy.IGNORED)
private String years; private Date years;
@TableField(value = "PRODUCT_ID" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "PRODUCT_ID", updateStrategy = FieldStrategy.IGNORED)
private String productId; private String productId;
@TableField(value = "PRODUCT_NAME" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "PRODUCT_NAME", updateStrategy = FieldStrategy.IGNORED)
private String productName; private String productName;
@TableField(value = "MODEL" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "MODEL", updateStrategy = FieldStrategy.IGNORED)
private String model; private String model;
@TableField(value = "MEASUREMENT_UNIT" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "MEASUREMENT_UNIT", updateStrategy = FieldStrategy.IGNORED)
private String measurementUnit; private String measurementUnit;
@TableField(value = "MEASUREMENT_NUMBER" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "MEASUREMENT_NUMBER", updateStrategy = FieldStrategy.IGNORED)
private String measurementNumber; private String measurementNumber;
@TableField(value = "CURRENT_INVENTORY" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "CURRENT_INVENTORY", updateStrategy = FieldStrategy.IGNORED)
private String currentInventory; private String currentInventory;
@TableField(value = "DELIVERY_TIME" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "DELIVERY_TIME", updateStrategy = FieldStrategy.IGNORED)
private Date deliveryTime; private Date deliveryTime;
@TableField("F_CREATOR_TIME") @TableField("F_CREATOR_TIME")
private Date creatorTime; private Date creatorTime;
@ -56,4 +56,6 @@ public class YysMonthlyProductionEntity {
private String organizeJsonId; private String organizeJsonId;
@TableField("F_FLOW_ID") @TableField("F_FLOW_ID")
private String flowId; private String flowId;
@TableField("F_VERSION")
private Integer version;
} }

@ -25,6 +25,7 @@ public class YysMonthlyProductionExcelVO{
/** 年月 **/ /** 年月 **/
@JSONField(name = "years") @JSONField(name = "years")
@Excel(name = "年月",orderNum = "1", isImportField = "true" ) @Excel(name = "年月",orderNum = "1", isImportField = "true" )
@JsonFormat(pattern = "yyyy-MM",timezone = "GMT+8")
private String years; private String years;
/** 产品编码 **/ /** 产品编码 **/

@ -16,7 +16,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class YysMonthlyProductionForm { public class YysMonthlyProductionForm {
/** 主键 */ /** 主键 */
private String id; private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 年月 **/ /** 年月 **/
@JsonProperty("years") @JsonProperty("years")
private String years; private String years;
@ -25,7 +27,7 @@ public class YysMonthlyProductionForm {
private String productId; private String productId;
/** 产品名称 **/ /** 产品名称 **/
@JsonProperty("productName") @JsonProperty("productName")
private Object productName; private String productName;
/** 规格型号 **/ /** 规格型号 **/
@JsonProperty("model") @JsonProperty("model")
private String model; private String model;

@ -53,26 +53,26 @@
<div class="JNPF-common-layout-main JNPF-flex-main"> <div class="JNPF-common-layout-main JNPF-flex-main">
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' <JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange'
:span-method="arraySpanMethod"> :span-method="arraySpanMethod">
<el-table-column prop="manufactureTime" label="生产日期" align="left"> <el-table-column prop="manufactureTime" label="生产日期" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="productCode" label="产品编码" align="left"> <el-table-column prop="productCode" label="产品编码" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="productName" label="产品名称" align="left"> <el-table-column prop="productName" label="产品名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="models" label="规格型号" align="left"> <el-table-column prop="models" label="规格型号" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="measurementUnit" label="计量单位" align="left"> <el-table-column prop="measurementUnit" label="计量单位" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="deviceCode" label="设备编码" align="left"> <el-table-column prop="deviceCode" label="设备编码" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="deviceName" label="设备名称" align="left"> <el-table-column prop="deviceName" label="设备名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="planNumber" label="计量数量" align="left"> <el-table-column prop="planNumber" label="计量数量" align="center">
<template slot-scope="scope" v-if="scope.row.planNumber"> <template slot-scope="scope" v-if="scope.row.planNumber">
<JnpfNumber v-model="scope.row.planNumber" :thousands="false" /> <JnpfNumber v-model="scope.row.planNumber" :thousands="false" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="deliveryTime" label="交期" align="left" :formatter="formatDeliveryTime"> <el-table-column prop="deliveryTime" label="交期" align="center" :formatter="formatDeliveryTime">
</el-table-column> </el-table-column>
</JNPF-table> </JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"

@ -71,40 +71,40 @@
</div> </div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' <JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange'
:span-method="arraySpanMethod"> :span-method="arraySpanMethod">
<el-table-column prop="manufactureTime" label="生产日期" align="left"> <el-table-column prop="manufactureTime" label="生产日期" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="deviceCode" label="设备编码" align="left"> <el-table-column prop="deviceCode" label="设备编码" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="deviceName" label="设备名称" align="left"> <el-table-column prop="deviceName" label="设备名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="sort" label="顺序号" align="left"> <el-table-column prop="sort" label="顺序号" align="center">
<template slot-scope="scope" v-if="scope.row.sort"> <template slot-scope="scope" v-if="scope.row.sort">
<JnpfNumber v-model="scope.row.sort" :thousands="false" /> <JnpfNumber v-model="scope.row.sort" :thousands="false" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="班次" prop="post" algin="left"> <el-table-column label="班次" prop="post" algin="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.post }} {{ scope.row.post }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="startTime" label="开始时间" align="left"> <el-table-column prop="startTime" label="开始时间" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="endTime" label="结束时间" align="left"> <el-table-column prop="endTime" label="结束时间" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="productCode" label="产品编码" align="left"> <el-table-column prop="productCode" label="产品编码" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="productName" label="产品名称" align="left"> <el-table-column prop="productName" label="产品名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="models" label="规格型号" align="left"> <el-table-column prop="models" label="规格型号" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="measurementUnit" label="计量单位" align="left"> <el-table-column prop="measurementUnit" label="计量单位" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="planNumber" label="计量数量" align="left"> <el-table-column prop="planNumber" label="计量数量" align="center">
<template slot-scope="scope" v-if="scope.row.planNumber"> <template slot-scope="scope" v-if="scope.row.planNumber">
<JnpfNumber v-model="scope.row.planNumber" :thousands="false" /> <JnpfNumber v-model="scope.row.planNumber" :thousands="false" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="生产状态" prop="productionStatus" algin="left"> <el-table-column label="生产状态" prop="productionStatus" algin="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.productionStatus }} {{ scope.row.productionStatus }}
</template> </template>

File diff suppressed because one or more lines are too long

@ -6,11 +6,13 @@
label-position="right"> label-position="right">
<template v-if="!loading"> <template v-if="!loading">
<!-- 具体表单 --> <!-- 具体表单 -->
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="年月" prop="years"> <jnpf-form-tip-item label="年月" prop="years">
<JnpfInput v-model="dataForm.years" @change="changeData('years', -1)" placeholder="请输入年月" <JnpfDatePicker v-model="dataForm.years" @change="changeData('years', -1)"
clearable :style='{ "width": "100%" }'> :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')"
</JnpfInput> placeholder="请选择年月" clearable :style='{ "width": "100%" }' type="month" format="yyyy-MM">
</JnpfDatePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -71,16 +73,6 @@
@select="addForSelect" @close="selectDialogVisible = false" /> @select="addForSelect" @close="selectDialogVisible = false" />
</el-row> </el-row>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<!-- <div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'>
{{ '上一条' }}
</el-button>
<el-button @click="next" :disabled='nextDis'>
{{ '下一条' }}
</el-button>
</div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-button> -->
<el-button @click="visible = false"> </el-button> <el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button> <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
</span> </span>
@ -136,6 +128,7 @@ export default {
measurementNumber: undefined, measurementNumber: undefined,
currentInventory: undefined, currentInventory: undefined,
deliveryTime: undefined, deliveryTime: undefined,
version: 0,
}, },
tableRequiredData: {}, tableRequiredData: {},
dataRule: dataRule:
@ -143,8 +136,8 @@ export default {
years: [ years: [
{ {
required: true, required: true,
message: '请输入年月', message: '请选择年月',
trigger: 'blur' trigger: 'change'
}, },
], ],
productId: [ productId: [
@ -346,7 +339,6 @@ export default {
// //
initDefaultData() { initDefaultData() {
this.dataForm.deliveryTime = new Date().getTime() this.dataForm.deliveryTime = new Date().getTime()
this.dataForm.years = new Date().getTime()
}, },
// //

@ -5,9 +5,9 @@
<el-form @submit.native.prevent> <el-form @submit.native.prevent>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="年月"> <el-form-item label="年月">
<JnpfDatePicker v-model="query.years" format="yyyy-MM" startPlaceholder="开始日期" <JnpfDateRangePicker v-model="query.years" format="yyyy-MM" startPlaceholder="开始日期"
endPlaceholder="结束日期"> endPlaceholder="结束日期">
</JnpfDatePicker> </JnpfDateRangePicker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
@ -32,9 +32,9 @@
</el-button> </el-button>
<el-button type="success" icon="icon-ym icon-ym-btn-upload" @click="handelUpload()"> <el-button type="success" icon="icon-ym icon-ym-btn-upload" @click="handelUpload()">
</el-button> </el-button>
<el-button class="custom-success-button" type="success" icon="icon-ym icon-ym-btn-upload" @click="handelUpload()"> <el-button type="success" icon="icon-ym icon-ym-btn-add" @click="handelUpload()">
</el-button> </el-button>
<el-button class="custom-mpr-button" type="success" icon="icon-ym icon-ym-btn-upload" @click="handelUpload()">MPR <el-button type="success" icon="icon-ym icon-ym-btn-add" @click="handelUpload()">MRP
</el-button> </el-button>
</div> </div>
<div class="JNPF-common-head-right"> <div class="JNPF-common-head-right">
@ -52,19 +52,19 @@
:span-method="arraySpanMethod"> :span-method="arraySpanMethod">
<el-table-column prop="years" label="年月" align="center"> <el-table-column prop="years" label="年月" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="productId" label="产品编码" align="left"> <el-table-column prop="productId" label="产品编码" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="productName" label="产品名称" align="left"> <el-table-column prop="productName" label="产品名称" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="model" label="规格型号" align="left"> <el-table-column prop="model" label="规格型号" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="measurementUnit" label="计量单位" align="left"> <el-table-column prop="measurementUnit" label="计量单位" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="measurementNumber" label="计量数量" align="left"> <el-table-column prop="measurementNumber" label="计量数量" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="currentInventory" label="当前库存" align="left"> <el-table-column prop="currentInventory" label="当前库存" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="deliveryTime" label="交期" align="left"> <el-table-column prop="deliveryTime" label="交期" align="center">
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" width="150"> <el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
@ -354,13 +354,6 @@ export default {
moduleId: '590488386381285765', moduleId: '590488386381285765',
type: 1, type: 1,
}; };
if (_query.years != undefined) {
let aaa = _query.years;
const date = new Date(aaa);
const year = date.getFullYear().toString();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
_query.years = `${year}${month}`;
}
request({ request({
url: `/api/example/YysMonthlyProduction/getList`, url: `/api/example/YysMonthlyProduction/getList`,
method: 'post', method: 'post',

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save