diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysDayWorkService.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysDayWorkService.java index 9e9043d..b94b2b4 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysDayWorkService.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysDayWorkService.java @@ -47,4 +47,10 @@ public interface YysDayWorkService extends IService { * @return */ String sure(ConfirmResponse request); + + void syncIsForzen(String id); + + String isFrozen(String id); + + String cancelFrozen(String id); } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysMonthlyProductionService.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysMonthlyProductionService.java index 635f07c..1a8e87c 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysMonthlyProductionService.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/YysMonthlyProductionService.java @@ -35,4 +35,7 @@ public interface YysMonthlyProductionService extends IService getUnMPRList(String month); + String isFrozen(String id); + + String cancelFrozen(String id); } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDayWorkServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDayWorkServiceImpl.java index b395bca..bec4dd6 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDayWorkServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysDayWorkServiceImpl.java @@ -28,7 +28,6 @@ import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; /** - * * yysDayWork * 版本: V3.5 * 版权: 引迈信息技术有限公司(https://www.jnpfsoft.com) @@ -36,7 +35,7 @@ import java.util.stream.Collectors; * 日期: 2024-08-19 */ @Service -public class YysDayWorkServiceImpl extends ServiceImpl implements YysDayWorkService{ +public class YysDayWorkServiceImpl extends ServiceImpl implements YysDayWorkService { @Autowired private GeneraterSwapUtil generaterSwapUtil; @@ -62,112 +61,115 @@ public class YysDayWorkServiceImpl extends ServiceImpl getList(YysDayWorkPagination yysDayWorkPagination){ - return getTypeList(yysDayWorkPagination,yysDayWorkPagination.getDataType()); + public List getList(YysDayWorkPagination yysDayWorkPagination) { + return getTypeList(yysDayWorkPagination, yysDayWorkPagination.getDataType()); } - /** 列表查询 */ + + /** + * 列表查询 + */ @Override - public List getTypeList(YysDayWorkPagination yysDayWorkPagination,String dataType){ - String userId=userProvider.get().getUserId(); - List AllIdList =new ArrayList(); - List> intersectionList =new ArrayList<>(); + public List getTypeList(YysDayWorkPagination yysDayWorkPagination, String dataType) { + String userId = userProvider.get().getUserId(); + List AllIdList = new ArrayList(); + List> intersectionList = new ArrayList<>(); boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); String columnData = !isPc ? YysDayWorkConstant.getAppColumnData() : YysDayWorkConstant.getColumnData(); ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class); String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList()); - int total=0; - int yysDayWorkNum =0; - QueryWrapper yysDayWorkQueryWrapper=new QueryWrapper<>(); + int total = 0; + int yysDayWorkNum = 0; + QueryWrapper yysDayWorkQueryWrapper = new QueryWrapper<>(); List allSuperIDlist = new ArrayList<>(); - String superOp =""; - if (ObjectUtil.isNotEmpty(yysDayWorkPagination.getSuperQueryJson())){ + String superOp = ""; + if (ObjectUtil.isNotEmpty(yysDayWorkPagination.getSuperQueryJson())) { List allSuperList = new ArrayList<>(); - List> intersectionSuperList = new ArrayList<>(); + List> intersectionSuperList = new ArrayList<>(); String queryJson = yysDayWorkPagination.getSuperQueryJson(); SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class); int superNum = 0; QueryWrapper yysDayWorkSuperWrapper = new QueryWrapper<>(); - yysDayWorkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysDayWorkSuperWrapper,YysDayWorkEntity.class,queryJson,"0")); + yysDayWorkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysDayWorkSuperWrapper, YysDayWorkEntity.class, queryJson, "0")); int yysDayWorkNum1 = yysDayWorkSuperWrapper.getExpression().getNormal().size(); - if (yysDayWorkNum1>0){ - List yysDayWorkList =this.list(yysDayWorkSuperWrapper).stream().map(YysDayWorkEntity::getId).collect(Collectors.toList()); + if (yysDayWorkNum1 > 0) { + List yysDayWorkList = this.list(yysDayWorkSuperWrapper).stream().map(YysDayWorkEntity::getId).collect(Collectors.toList()); allSuperList.addAll(yysDayWorkList); intersectionSuperList.add(yysDayWorkList); superNum++; } superOp = superNum > 0 ? superJsonModel.getMatchLogic() : ""; //and or - if(superOp.equalsIgnoreCase("and")){ + if (superOp.equalsIgnoreCase("and")) { allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList); - }else{ + } else { allSuperIDlist = allSuperList; } } List allRuleIDlist = new ArrayList<>(); - String ruleOp =""; - if (ObjectUtil.isNotEmpty(ruleJson)){ + String ruleOp = ""; + if (ObjectUtil.isNotEmpty(ruleJson)) { List allRuleList = new ArrayList<>(); - List> intersectionRuleList = new ArrayList<>(); + List> intersectionRuleList = new ArrayList<>(); SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class); int ruleNum = 0; QueryWrapper yysDayWorkSuperWrapper = new QueryWrapper<>(); - yysDayWorkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysDayWorkSuperWrapper,YysDayWorkEntity.class,ruleJson,"0")); + yysDayWorkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysDayWorkSuperWrapper, YysDayWorkEntity.class, ruleJson, "0")); int yysDayWorkNum1 = yysDayWorkSuperWrapper.getExpression().getNormal().size(); - if (yysDayWorkNum1>0){ - List yysDayWorkList =this.list(yysDayWorkSuperWrapper).stream().map(YysDayWorkEntity::getId).collect(Collectors.toList()); + if (yysDayWorkNum1 > 0) { + List yysDayWorkList = this.list(yysDayWorkSuperWrapper).stream().map(YysDayWorkEntity::getId).collect(Collectors.toList()); allRuleList.addAll(yysDayWorkList); intersectionRuleList.add(yysDayWorkList); ruleNum++; } ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : ""; //and or - if(ruleOp.equalsIgnoreCase("and")){ + if (ruleOp.equalsIgnoreCase("and")) { allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList); - }else{ + } else { allRuleIDlist = allRuleList; } } - boolean pcPermission = false; - boolean appPermission = false; - if(isPc && pcPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object yysDayWorkObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysDayWorkQueryWrapper,YysDayWorkEntity.class,yysDayWorkPagination.getMenuId(),"0")); - if (ObjectUtil.isEmpty(yysDayWorkObj)){ - return new ArrayList<>(); - } else { - yysDayWorkQueryWrapper = (QueryWrapper)yysDayWorkObj; - if( yysDayWorkQueryWrapper.getExpression().getNormal().size()>0){ - yysDayWorkNum++; - } - } - } - } - if(!isPc && appPermission){ - if (!userProvider.get().getIsAdministrator()){ - Object yysDayWorkObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysDayWorkQueryWrapper,YysDayWorkEntity.class,yysDayWorkPagination.getMenuId(),"0")); - if (ObjectUtil.isEmpty(yysDayWorkObj)){ - return new ArrayList<>(); - } else { - yysDayWorkQueryWrapper = (QueryWrapper)yysDayWorkObj; - if( yysDayWorkQueryWrapper.getExpression().getNormal().size()>0){ - yysDayWorkNum++; - } + boolean pcPermission = false; + boolean appPermission = false; + if (isPc && pcPermission) { + if (!userProvider.get().getIsAdministrator()) { + Object yysDayWorkObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysDayWorkQueryWrapper, YysDayWorkEntity.class, yysDayWorkPagination.getMenuId(), "0")); + if (ObjectUtil.isEmpty(yysDayWorkObj)) { + return new ArrayList<>(); + } else { + yysDayWorkQueryWrapper = (QueryWrapper) yysDayWorkObj; + if (yysDayWorkQueryWrapper.getExpression().getNormal().size() > 0) { + yysDayWorkNum++; + } + } + } } + if (!isPc && appPermission) { + if (!userProvider.get().getIsAdministrator()) { + Object yysDayWorkObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysDayWorkQueryWrapper, YysDayWorkEntity.class, yysDayWorkPagination.getMenuId(), "0")); + if (ObjectUtil.isEmpty(yysDayWorkObj)) { + return new ArrayList<>(); + } else { + yysDayWorkQueryWrapper = (QueryWrapper) yysDayWorkObj; + if (yysDayWorkQueryWrapper.getExpression().getNormal().size() > 0) { + yysDayWorkNum++; + } + } - } - } - if(isPc){ - if(ObjectUtil.isNotEmpty(yysDayWorkPagination.getManufactureTime())){ - yysDayWorkNum++; + } + } + if (isPc) { + if (ObjectUtil.isNotEmpty(yysDayWorkPagination.getManufactureTime())) { + yysDayWorkNum++; - List ManufactureTimeList = JsonUtil.getJsonToList(yysDayWorkPagination.getManufactureTime(),String.class); - Long fir = Long.valueOf(String.valueOf(ManufactureTimeList.get(0))); - Long sec = Long.valueOf(String.valueOf(ManufactureTimeList.get(1))); + List ManufactureTimeList = JsonUtil.getJsonToList(yysDayWorkPagination.getManufactureTime(), String.class); + Long fir = Long.valueOf(String.valueOf(ManufactureTimeList.get(0))); + Long sec = Long.valueOf(String.valueOf(ManufactureTimeList.get(1))); - yysDayWorkQueryWrapper.lambda().ge(YysDayWorkEntity::getManufactureTime, new Date(fir)) - .le(YysDayWorkEntity::getManufactureTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59")); + yysDayWorkQueryWrapper.lambda().ge(YysDayWorkEntity::getManufactureTime, new Date(fir)) + .le(YysDayWorkEntity::getManufactureTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59")); } @@ -186,74 +188,74 @@ public class YysDayWorkServiceImpl extends ServiceImpl idList = new ArrayList<>(); - try { - String[][] productionStatus = JsonUtil.getJsonToBean(yysDayWorkPagination.getProductionStatus(),String[][].class); - for(int i=0;i0){ - idList.add(JsonUtil.getObjectToString(Arrays.asList(productionStatus[i]))); - } - } - }catch (Exception e1){ - try { - List productionStatus = JsonUtil.getJsonToList(yysDayWorkPagination.getProductionStatus(),String.class); - if(productionStatus.size()>0){ - idList.addAll(productionStatus); - } - }catch (Exception e2){ - idList.add(String.valueOf(yysDayWorkPagination.getProductionStatus())); - } - } - yysDayWorkQueryWrapper.lambda().and(t->{ - idList.forEach(tt->{ - t.like(YysDayWorkEntity::getProductionStatus, tt).or(); - }); - }); + List idList = new ArrayList<>(); + try { + String[][] productionStatus = JsonUtil.getJsonToBean(yysDayWorkPagination.getProductionStatus(), String[][].class); + for (int i = 0; i < productionStatus.length; i++) { + if (productionStatus[i].length > 0) { + idList.add(JsonUtil.getObjectToString(Arrays.asList(productionStatus[i]))); + } + } + } catch (Exception e1) { + try { + List productionStatus = JsonUtil.getJsonToList(yysDayWorkPagination.getProductionStatus(), String.class); + if (productionStatus.size() > 0) { + idList.addAll(productionStatus); + } + } catch (Exception e2) { + idList.add(String.valueOf(yysDayWorkPagination.getProductionStatus())); + } + } + yysDayWorkQueryWrapper.lambda().and(t -> { + idList.forEach(tt -> { + t.like(YysDayWorkEntity::getProductionStatus, tt).or(); + }); + }); } } List intersection = generaterSwapUtil.getIntersection(intersectionList); - if (total>0){ - if (intersection.size()==0){ + if (total > 0) { + if (intersection.size() == 0) { intersection.add("jnpfNullList"); } yysDayWorkQueryWrapper.lambda().in(YysDayWorkEntity::getId, intersection); } - //是否有高级查询 - if (StringUtil.isNotEmpty(superOp)){ - if (allSuperIDlist.size()==0){ + //是否有高级查询 + if (StringUtil.isNotEmpty(superOp)) { + if (allSuperIDlist.size() == 0) { allSuperIDlist.add("jnpfNullList"); } List finalAllSuperIDlist = allSuperIDlist; - yysDayWorkQueryWrapper.lambda().and(t->t.in(YysDayWorkEntity::getId, finalAllSuperIDlist)); + yysDayWorkQueryWrapper.lambda().and(t -> t.in(YysDayWorkEntity::getId, finalAllSuperIDlist)); } - //是否有数据过滤查询 - if (StringUtil.isNotEmpty(ruleOp)){ - if (allRuleIDlist.size()==0){ + //是否有数据过滤查询 + if (StringUtil.isNotEmpty(ruleOp)) { + if (allRuleIDlist.size() == 0) { allRuleIDlist.add("jnpfNullList"); } List finalAllRuleIDlist = allRuleIDlist; - yysDayWorkQueryWrapper.lambda().and(t->t.in(YysDayWorkEntity::getId, finalAllRuleIDlist)); + yysDayWorkQueryWrapper.lambda().and(t -> t.in(YysDayWorkEntity::getId, finalAllRuleIDlist)); } //假删除标志 yysDayWorkQueryWrapper.lambda().isNull(YysDayWorkEntity::getDeleteMark); @@ -276,79 +278,88 @@ public class YysDayWorkServiceImpl extends ServiceImpl0 && AllIdList.size()>0) || total==0){ - Page page=new Page<>(yysDayWorkPagination.getCurrentPage(), yysDayWorkPagination.getPageSize()); - IPage userIPage=this.page(page, yysDayWorkQueryWrapper); - return yysDayWorkPagination.setData(userIPage.getRecords(),userIPage.getTotal()); - }else{ + if ("0".equals(dataType)) { + if ((total > 0 && AllIdList.size() > 0) || total == 0) { + Page page = new Page<>(yysDayWorkPagination.getCurrentPage(), yysDayWorkPagination.getPageSize()); + IPage userIPage = this.page(page, yysDayWorkQueryWrapper); + return yysDayWorkPagination.setData(userIPage.getRecords(), userIPage.getTotal()); + } else { List list = new ArrayList(); return yysDayWorkPagination.setData(list, list.size()); } - }else{ + } else { return this.list(yysDayWorkQueryWrapper); } } + @Override - public YysDayWorkEntity getInfo(String id){ - QueryWrapper queryWrapper=new QueryWrapper<>(); - queryWrapper.lambda().eq(YysDayWorkEntity::getId,id); + public YysDayWorkEntity getInfo(String id) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(YysDayWorkEntity::getId, id); return this.getOne(queryWrapper); } + @Override - public void create(YysDayWorkEntity entity){ + public void create(YysDayWorkEntity entity) { this.save(entity); } + @Override - public boolean update(String id, YysDayWorkEntity entity){ + public boolean update(String id, YysDayWorkEntity entity) { return this.updateById(entity); } + @Override - public void delete(YysDayWorkEntity entity){ - if(entity!=null){ + public void delete(YysDayWorkEntity entity) { + if (entity != null) { this.removeById(entity.getId()); } } - /** 验证表单唯一字段,正则,非空 i-0新增-1修改*/ + + /** + * 验证表单唯一字段,正则,非空 i-0新增-1修改 + */ @Override - public String checkForm(YysDayWorkForm form,int i) { - boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0"); - String id=""; + public String checkForm(YysDayWorkForm form, int i) { + boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0"); + String id = ""; String countRecover = ""; - if (isUp){ + if (isUp) { id = form.getId(); } //主表字段验证 - if(StringUtil.isEmpty(form.getProductName())){ - return "产品名称不能为空"; - } - if(StringUtil.isNotEmpty(form.getProductName())){ - form.setProductName(form.getProductName().trim()); - QueryWrapper productNameWrapper=new QueryWrapper<>(); - productNameWrapper.lambda().eq(YysDayWorkEntity::getProductName,form.getProductName()); - //假删除标志 - productNameWrapper.lambda().isNull(YysDayWorkEntity::getDeleteMark); - if (isUp){ - productNameWrapper.lambda().ne(YysDayWorkEntity::getId, id); - } - if((int) this.count(productNameWrapper)>0){ - countRecover = "产品名称不能重复"; - } - } - if(StringUtil.isEmpty(form.getModels())){ - return "规格型号不能为空"; - } - if(StringUtil.isEmpty(form.getMeasurementUnit())){ - return "计量单位不能为空"; - } + if (StringUtil.isEmpty(form.getProductName())) { + return "产品名称不能为空"; + } + if (StringUtil.isNotEmpty(form.getProductName())) { + form.setProductName(form.getProductName().trim()); + QueryWrapper productNameWrapper = new QueryWrapper<>(); + productNameWrapper.lambda().eq(YysDayWorkEntity::getProductName, form.getProductName()); + //假删除标志 + productNameWrapper.lambda().isNull(YysDayWorkEntity::getDeleteMark); + if (isUp) { + productNameWrapper.lambda().ne(YysDayWorkEntity::getId, id); + } + if ((int) this.count(productNameWrapper) > 0) { + countRecover = "产品名称不能重复"; + } + } + if (StringUtil.isEmpty(form.getModels())) { + return "规格型号不能为空"; + } + if (StringUtil.isEmpty(form.getMeasurementUnit())) { + return "计量单位不能为空"; + } return countRecover; } + /** - * 新增修改数据(事务回滚) - * @param id - * @param yysDayWorkForm - * @return - */ + * 新增修改数据(事务回滚) + * + * @param id + * @param yysDayWorkForm + * @return + */ @Override @Transactional public void saveOrUpdate(YysDayWorkForm yysDayWorkForm, String id, boolean isSave) throws Exception { @@ -365,6 +376,7 @@ public class YysDayWorkServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(YysDayWorkEntity::getIsConfirm, request.getFlag()); + wrapper.eq(YysDayWorkEntity::getIsFrozen, "否"); + wrapper.isNull(YysDayWorkEntity::getDeleteMark); List root = this.list(wrapper); if (CollectionUtils.isEmpty(root)) { return Collections.emptyList(); @@ -479,7 +493,7 @@ public class YysDayWorkServiceImpl extends ServiceImpl{ + CompletableFuture.runAsync(() -> { YysDayWorkEntity entity = this.getById(request.getId()); entity.setIsConfirm("2"); entity.setProductionStatus("2"); @@ -489,4 +503,29 @@ public class YysDayWorkServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(YysDayWorkEntity::getMonthId, id); + List list = this.list(wrapper); + list.forEach(obj -> obj.setIsFrozen("是")); + this.updateBatchById(list); + } + + @Override + public String isFrozen(String id) { + YysDayWorkEntity entity = this.getById(id); + entity.setIsFrozen("是"); + this.updateById(entity); + return "冻结成功"; + } + + @Override + public String cancelFrozen(String id) { + YysDayWorkEntity entity = this.getById(id); + entity.setIsFrozen("否"); + this.updateById(entity); + return "取消冻结成功"; + } } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMonthlyProductionServiceImpl.java b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMonthlyProductionServiceImpl.java index a851c70..79b2015 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMonthlyProductionServiceImpl.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-biz/src/main/java/jnpf/service/impl/YysMonthlyProductionServiceImpl.java @@ -17,6 +17,7 @@ import jnpf.model.yysmonthlyproduction.YysMonthlyProductionConstant; import jnpf.model.yysmonthlyproduction.YysMonthlyProductionForm; import jnpf.model.yysmonthlyproduction.YysMonthlyProductionPagination; import jnpf.permission.entity.UserEntity; +import jnpf.service.YysDayWorkService; import jnpf.service.YysMonthlyProductionService; import jnpf.util.*; import org.apache.commons.collections4.CollectionUtils; @@ -28,6 +29,7 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.concurrent.CompletableFuture; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -46,6 +48,9 @@ public class YysMonthlyProductionServiceImpl extends ServiceImpl getList(YysMonthlyProductionPagination yysMonthlyProductionPagination) { return getTypeList(yysMonthlyProductionPagination, yysMonthlyProductionPagination.getDataType()); @@ -321,6 +326,7 @@ public class YysMonthlyProductionServiceImpl extends ServiceImplyysDayWorkService.syncIsForzen(id)); + } + return "冻结成功"; + } + + @Override + public String cancelFrozen(String id) { + YysMonthlyProductionEntity entity = this.getById(id); + entity.setIsFrozen("否"); + this.updateById(entity); + return "取消冻结成功"; + } } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysDayWorkController.java b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysDayWorkController.java index 445778f..1605fd9 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysDayWorkController.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysDayWorkController.java @@ -1,60 +1,49 @@ package jnpf.controller; -import cn.hutool.core.util.ObjectUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; +import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; +import cn.xuyanwu.spring.file.storage.FileInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jnpf.base.ActionResult; import jnpf.base.UserInfo; -import jnpf.exception.DataException; -import jnpf.permission.entity.UserEntity; -import jnpf.service.*; -import jnpf.entity.*; -import jnpf.util.*; -import jnpf.model.yysdaywork.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.*; - -import jnpf.annotation.JnpfField; +import jnpf.base.model.ColumnDataModel; +import jnpf.base.util.VisualUtils; +import jnpf.base.vo.DownloadVO; import jnpf.base.vo.PageListVO; import jnpf.base.vo.PaginationVO; -import jnpf.base.vo.DownloadVO; import jnpf.config.ConfigValueUtil; -import jnpf.base.entity.ProvinceEntity; - -import java.io.IOException; -import java.util.stream.Collectors; - -import jnpf.engine.entity.FlowTaskEntity; -import jnpf.exception.WorkFlowException; -import org.springframework.web.multipart.MultipartFile; -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.ExcelImportUtil; -import cn.afterturn.easypoi.excel.entity.ExportParams; -import cn.afterturn.easypoi.excel.entity.ImportParams; -import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity; -import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Workbook; - -import java.io.File; - +import jnpf.entity.YysDayWorkEntity; +import jnpf.entity.YysMonthlyProductionEntity; +import jnpf.model.visualJson.config.HeaderModel; +import jnpf.model.yysdaywork.*; import jnpf.onlinedev.model.ExcelImFieldModel; +import jnpf.onlinedev.model.OnlineImport.ExcelImportModel; import jnpf.onlinedev.model.OnlineImport.ImportDataModel; import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel; -import jnpf.onlinedev.model.OnlineImport.ExcelImportModel; import jnpf.onlinedev.model.OnlineImport.VisualImportModel; -import cn.xuyanwu.spring.file.storage.FileInfo; +import jnpf.service.YysDayWorkService; +import jnpf.service.YysMonthlyProductionService; +import jnpf.util.*; import lombok.Cleanup; -import jnpf.model.visualJson.config.HeaderModel; -import jnpf.base.model.ColumnDataModel; -import jnpf.base.util.VisualUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import java.io.File; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; /** * yysDayWork @@ -80,8 +69,7 @@ public class YysDayWorkController { private YysDayWorkService yysDayWorkService; @Autowired - private YysClassesService yysClassesService; - + private YysMonthlyProductionService yysMonthlyProductionService; @Autowired private ConfigValueUtil configValueUtil; @@ -97,9 +85,14 @@ public class YysDayWorkController { public ActionResult list(@RequestBody YysDayWorkPagination yysDayWorkPagination) throws IOException { List list = yysDayWorkService.getList(yysDayWorkPagination); List> realList = new ArrayList<>(); + List list1 = yysMonthlyProductionService.list(); + Map collect = list1.stream().collect(Collectors.toMap(YysMonthlyProductionEntity::getId, YysMonthlyProductionEntity::getIsFrozen)); for (YysDayWorkEntity entity : list) { Map yysDayWorkMap = JsonUtil.entityToMap(entity); yysDayWorkMap.put("id", yysDayWorkMap.get("id")); + if (MapUtils.isNotEmpty(collect) && collect.containsKey(entity.getMonthId())) { + yysDayWorkMap.put("f_isFrozen", collect.getOrDefault(entity.getMonthId(), "")); + } //副表数据 //子表数据 realList.add(yysDayWorkMap); @@ -570,4 +563,16 @@ public class YysDayWorkController { return ActionResult.fail(result); } + @Operation(summary = "冻结") + @GetMapping("/isFrozen/{id}") + public ActionResult isFrozen(@PathVariable("id") String id) { + return ActionResult.success(yysDayWorkService.isFrozen(id)); + } + + @Operation(summary = "解冻") + @GetMapping("/cancelFrozen/{id}") + public ActionResult cancelFrozen(@PathVariable("id") String id) { + return ActionResult.success(yysDayWorkService.cancelFrozen(id)); + } + } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysMonthlyProductionController.java b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysMonthlyProductionController.java index 1c8eaf1..e10cc28 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysMonthlyProductionController.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-controller/src/main/java/jnpf/controller/YysMonthlyProductionController.java @@ -531,6 +531,18 @@ public class YysMonthlyProductionController { return ActionResult.success(yysMonthlyProductionMap); } + @Operation(summary = "冻结") + @GetMapping("/isFrozen/{id}") + public ActionResult isFrozen(@PathVariable("id") String id) { + return ActionResult.success(yysMonthlyProductionService.isFrozen(id)); + } + + @Operation(summary = "解冻") + @GetMapping("/cancelFrozen/{id}") + public ActionResult cancelFrozen(@PathVariable("id") String id) { + return ActionResult.success(yysMonthlyProductionService.cancelFrozen(id)); + } + @PostMapping("/mrp/{month}") @Operation(summary = "MRP运算") public ActionResult MRP(@PathVariable String month) { @@ -545,7 +557,7 @@ public class YysMonthlyProductionController { return ActionResult.fail("月份不能为空"); } List unMPRList = yysMonthlyProductionService.getUnMPRList(month); - if(unMPRList.size() == 0) return ActionResult.fail("没有需要生成MRP的月度生产计划"); + if (unMPRList.size() == 0) return ActionResult.fail("没有需要生成MRP的月度生产计划"); // 获取没有生成MRP的月度生产计划 Set productIds = unMPRList.stream().map(YysMonthlyProductionEntity::getProductId).collect(Collectors.toSet()); diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/entity/YysDayWorkEntity.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/entity/YysDayWorkEntity.java index 823f48d..2547f25 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/entity/YysDayWorkEntity.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/entity/YysDayWorkEntity.java @@ -48,6 +48,8 @@ public class YysDayWorkEntity { private String isConfirm; @TableField("DELIVERY_TIME") private Date deliveryTime; + @TableField(value = "IS_FROZEN" , updateStrategy = FieldStrategy.IGNORED) + private String isFrozen; @TableField("F_CREATOR_TIME") private Date creatorTime; @TableField("F_CREATOR_USER_ID") diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/entity/YysMonthlyProductionEntity.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/entity/YysMonthlyProductionEntity.java index bc6c7b0..7bb0aac 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/entity/YysMonthlyProductionEntity.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/entity/YysMonthlyProductionEntity.java @@ -32,6 +32,10 @@ public class YysMonthlyProductionEntity { private String currentInventory; @TableField(value = "PLAN_NUMBER" , updateStrategy = FieldStrategy.IGNORED) private String planNumber; + @TableField(value = "IS_MRP" , updateStrategy = FieldStrategy.IGNORED) + private String isMrp; + @TableField(value = "IS_FROZEN" , updateStrategy = FieldStrategy.IGNORED) + private String isFrozen; @TableField(value = "DELIVERY_TIME" , updateStrategy = FieldStrategy.IGNORED) private Date deliveryTime; @TableField("F_CREATOR_TIME") diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/yysdaywork/YysDayWorkForm.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/yysdaywork/YysDayWorkForm.java index 8eacca5..0783ceb 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/yysdaywork/YysDayWorkForm.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/yysdaywork/YysDayWorkForm.java @@ -59,4 +59,7 @@ public class YysDayWorkForm { /** 生产状态 **/ @JsonProperty("productionStatus") private Object productionStatus; + /** 是否冻结 **/ + @JsonProperty("isFrozen") + private String isFrozen; } diff --git a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/yysmonthlyproduction/YysMonthlyProductionForm.java b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/yysmonthlyproduction/YysMonthlyProductionForm.java index a0f7c0d..205aff7 100644 --- a/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/yysmonthlyproduction/YysMonthlyProductionForm.java +++ b/jnpf-java-boot/jnpf-example/jnpf-example-entity/src/main/java/jnpf/model/yysmonthlyproduction/YysMonthlyProductionForm.java @@ -44,4 +44,7 @@ public class YysMonthlyProductionForm { /** 交期 **/ @JsonProperty("deliveryTime") private String deliveryTime; + /** 是否冻结 **/ + @JsonProperty("isFrozen") + private String isFrozen; } diff --git a/jnpf-java-boot/jnpf-web/src/views/yys/yysdaywork/form.vue b/jnpf-java-boot/jnpf-web/src/views/yys/yysdaywork/form.vue index 9cdbbf1..daa2e11 100644 --- a/jnpf-java-boot/jnpf-web/src/views/yys/yysdaywork/form.vue +++ b/jnpf-java-boot/jnpf-web/src/views/yys/yysdaywork/form.vue @@ -196,6 +196,7 @@ export default { sort: 1, productionStatus: '1', version: 0, + isFrozen:undefined, }, tableRequiredData: {}, dataRule: diff --git a/jnpf-java-boot/jnpf-web/src/views/yys/yysdaywork/index.vue b/jnpf-java-boot/jnpf-web/src/views/yys/yysdaywork/index.vue index a70b5fd..94d6e93 100644 --- a/jnpf-java-boot/jnpf-web/src/views/yys/yysdaywork/index.vue +++ b/jnpf-java-boot/jnpf-web/src/views/yys/yysdaywork/index.vue @@ -66,37 +66,37 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -105,7 +105,13 @@ 已完工 - + + + + @@ -225,6 +237,53 @@ export default { this.queryData = JSON.parse(JSON.stringify(this.query)) }, methods: { + isFrozen(id, time) { + if (time != null) { + const targetDate = new Date(time); + // 获取当前日期 + const today = new Date(); + if (targetDate.getTime() < today.getTime()) { + this.$message.error('生产日期小于当前日期,不允许冻结'); + return + } + } + this.$confirm('此操作将冻结该数据, 是否继续?', '提示', { + type: 'warning' + }).then(() => { + request({ + url: `/api/example/YysDayWork/isFrozen/${id}`, + method: 'GET' + }).then(res => { + this.$message({ + type: 'success', + message: res.msg, + onClose: () => { + this.initData() + } + }); + }) + }).catch(() => { + }); + }, + cancelForzen(id) { + this.$confirm('此操作将取消冻结该数据, 是否继续?', '提示', { + type: 'warning' + }).then(() => { + request({ + url: `/api/example/YysDayWork/cancelFrozen/${id}`, + method: 'GET' + }).then(res => { + this.$message({ + type: 'success', + message: res.msg, + onClose: () => { + this.initData() + } + }); + }) + }).catch(() => { + }); + }, toDetail(defaultValue, modelId) { if (!defaultValue) return getConfigData(modelId).then(res => { diff --git a/jnpf-java-boot/jnpf-web/src/views/yys/yysmaterialclass/index.vue b/jnpf-java-boot/jnpf-web/src/views/yys/yysmaterialclass/index.vue index 4f2a4a1..95f095e 100644 --- a/jnpf-java-boot/jnpf-web/src/views/yys/yysmaterialclass/index.vue +++ b/jnpf-java-boot/jnpf-web/src/views/yys/yysmaterialclass/index.vue @@ -51,7 +51,7 @@ - +