feat():U8同步设为定时任务,日生产工单定时任务同步状态

master
jiyufei 2 months ago
parent e6c928a673
commit 0eae65d071

@ -62,7 +62,7 @@ spring:
validation-query: SELECT 1
datasource:
master:
url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.dbname}?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=UTC
url: jdbc:mysql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.dbname}?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true&serverTimezone=GMT%2B8
username: ${spring.datasource.username}
password: ${spring.datasource.password}
driver-class-name: com.mysql.cj.jdbc.Driver

@ -0,0 +1,7 @@
package jnpf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.entity.YysSubsetMaterialEntity;
public interface YysSubsetMaterialMapper extends BaseMapper<YysSubsetMaterialEntity> {
}

@ -33,4 +33,5 @@ public interface YysBillMaterialService extends IService<YysBillMaterialEntity>
YysBillMaterialEntity getByProductId(String id);
List<YysBillMaterialEntity> getListByProductIds(List<String> id);
String syncMaterial();
}

@ -53,4 +53,6 @@ public interface YysDayWorkService extends IService<YysDayWorkEntity> {
String isFrozen(String id);
String cancelFrozen(String id);
void syncDayWork();
}

@ -32,4 +32,5 @@ public interface YysInventoryQueryService extends IService<YysInventoryQueryEnti
void saveOrUpdate(YysInventoryQueryForm yysInventoryQueryForm,String id, boolean isSave) throws Exception;
String syncInventory();
}

@ -0,0 +1,7 @@
package jnpf.service;
import com.baomidou.mybatisplus.extension.service.IService;
import jnpf.entity.YysSubsetMaterialEntity;
public interface YysSubsetMaterialService extends IService<YysSubsetMaterialEntity> {
}

@ -1,37 +1,45 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.YysBillMaterialMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysbillmaterial.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
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 com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.YysBillMaterialEntity;
import jnpf.entity.YysSubsetMaterialEntity;
import jnpf.mapper.YysBillMaterialMapper;
import jnpf.model.QueryModel;
import jnpf.model.yysbillmaterial.*;
import jnpf.model.yysmaterialinformation.MaterialInformationSync;
import jnpf.permission.entity.UserEntity;
import jnpf.service.YysBillMaterialService;
import jnpf.service.YysSubsetMaterialService;
import jnpf.util.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
*
* yysBillMaterial
* V3.5
* https://www.jnpfsoft.com
@ -46,11 +54,20 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
@Autowired
private UserProvider userProvider;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private YysSubsetMaterialService yysSubsetMaterialService;
@Override
public List<YysBillMaterialEntity> getList(YysBillMaterialPagination yysBillMaterialPagination) {
return getTypeList(yysBillMaterialPagination, yysBillMaterialPagination.getDataType());
}
/** 列表查询 */
/**
*
*/
@Override
public List<YysBillMaterialEntity> getTypeList(YysBillMaterialPagination yysBillMaterialPagination, String dataType) {
String userId = userProvider.get().getUserId();
@ -229,27 +246,34 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
return this.list(yysBillMaterialQueryWrapper);
}
}
@Override
public YysBillMaterialEntity getInfo(String id) {
QueryWrapper<YysBillMaterialEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(YysBillMaterialEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(YysBillMaterialEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, YysBillMaterialEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(YysBillMaterialEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override
public String checkForm(YysBillMaterialForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
@ -261,8 +285,10 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
//主表字段验证
return countRecover;
}
/**
* ()
*
* @param id
* @param yysBillMaterialForm
* @return
@ -298,4 +324,84 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
wrapper.lambda().in(YysBillMaterialEntity::getPieceId, id);
return this.list(wrapper);
}
@Override
@DS("slave_2")
public String syncMaterial() {
List<String> syncList = this.list(new LambdaQueryWrapper<>(YysBillMaterialEntity.class).isNull(YysBillMaterialEntity::getDeleteMark))
.stream().map(YysBillMaterialEntity::getId).collect(Collectors.toList());
//母件物料
RowMapper<SyncMaterial> rowMapper = new BeanPropertyRowMapper<>(SyncMaterial.class);
String sql = "select * from v_bom_parent_rpt";
List<SyncMaterial> query = this.jdbcTemplate.query(sql, rowMapper);
if (CollectionUtils.isEmpty(query)) {
return "远程母件物料信息为空";
}
//过滤出同步过的
query = query.stream().filter(obj -> !syncList.contains(obj.getAutoId())).collect(Collectors.toList());
//子件物料
RowMapper<SyncSubsetMaterial> subMapper = new BeanPropertyRowMapper<>(SyncSubsetMaterial.class);
String subsetSql = "select * from v_bom_opcomponent_rpt";
List<SyncSubsetMaterial> subsetMaterials = this.jdbcTemplate.query(subsetSql, subMapper);
Map<String, List<SyncSubsetMaterial>> subsetCollect = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(subsetMaterials)) {
subsetCollect = subsetMaterials.stream().collect(Collectors.groupingBy(SyncSubsetMaterial::getBomId));
}
//物料表数据 不从自己库取数据,防止自己库未同步,从而取不到数据
RowMapper<MaterialInformationSync> materialMapper = new BeanPropertyRowMapper<>(MaterialInformationSync.class);
String materialSql = "select * from dbo.Inventory";
List<MaterialInformationSync> informationSyncs = this.jdbcTemplate.query(materialSql, materialMapper);
Map<String, MaterialInformationSync> materialCollect = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(informationSyncs)) {
materialCollect = informationSyncs.stream().collect(Collectors.toMap(MaterialInformationSync::getCInvCode, Function.identity()));
}
List<YysBillMaterialEntity> materialResult = Lists.newArrayList();
List<YysSubsetMaterialEntity> subsetResult = Lists.newArrayList();
for (SyncMaterial material : query) {
YysBillMaterialEntity yysBillMaterialEntity = new YysBillMaterialEntity();
yysBillMaterialEntity.setId(material.getAutoId());
yysBillMaterialEntity.setPieceId(material.getBomId());
if (MapUtils.isNotEmpty(materialCollect) && materialCollect.containsKey(material.getInvCode())) {
MaterialInformationSync sync = materialCollect.get(material.getInvCode());
yysBillMaterialEntity.setPieceName(sync.getCInvName());
yysBillMaterialEntity.setModels(sync.getEInvStd());
yysBillMaterialEntity.setUnit(sync.getCComUnitCode());
}
//处理子集
if (MapUtils.isNotEmpty(subsetCollect) && subsetCollect.containsKey(yysBillMaterialEntity.getPieceId())) {
List<SyncSubsetMaterial> list = subsetCollect.get(yysBillMaterialEntity.getPieceId());
for (SyncSubsetMaterial subsetMaterial : list) {
YysSubsetMaterialEntity yysSubsetMaterialEntity = new YysSubsetMaterialEntity();
yysSubsetMaterialEntity.setId(subsetMaterial.getOpComponentId());
yysSubsetMaterialEntity.setPieceId(yysBillMaterialEntity.getId());
yysSubsetMaterialEntity.setSubsetId(subsetMaterial.getBomId());
yysSubsetMaterialEntity.setBaseUse(subsetMaterial.getBaseQtyN());
yysSubsetMaterialEntity.setBaseNum(subsetMaterial.getBaseQtyD());
if (MapUtils.isNotEmpty(materialCollect) && materialCollect.containsKey(subsetMaterial.getInvCode())) {
MaterialInformationSync sync = materialCollect.get(subsetMaterial.getInvCode());
yysSubsetMaterialEntity.setSubsetName(sync.getCInvName());
yysSubsetMaterialEntity.setSubsetModel(sync.getEInvStd());
yysSubsetMaterialEntity.setUnit(sync.getCComUnitCode());
}
yysSubsetMaterialEntity.setCreatorTime(DateUtil.getNowDate());
//默认给个状态
yysSubsetMaterialEntity.setStatus("2");
subsetResult.add(yysSubsetMaterialEntity);
}
}
//暂时默认单据状态为已审核
yysBillMaterialEntity.setDocumentStatus("2");
yysBillMaterialEntity.setCreatorTime(DateUtil.getNowDate());
materialResult.add(yysBillMaterialEntity);
}
if (CollectionUtils.isEmpty(materialResult)) {
return "没有需要同步的数据";
}
boolean material = this.saveBatch(materialResult);
boolean savedBatch = yysSubsetMaterialService.saveBatch(subsetResult);
if (material && savedBatch) {
return "同步成功";
}
return "同步失败";
}
}

@ -23,8 +23,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.logging.SimpleFormatter;
import java.util.stream.Collectors;
/**
@ -534,4 +541,62 @@ public class YysDayWorkServiceImpl extends ServiceImpl<YysDayWorkMapper, YysDayW
this.updateById(entity);
return "取消冻结成功";
}
@Override
@Transactional(rollbackFor = Exception.class)
public void syncDayWork() {
//查询数据
LambdaQueryWrapper<YysDayWorkEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.ne(YysDayWorkEntity::getProductionStatus, "2");
wrapper.isNull(YysDayWorkEntity::getDeleteMark);
List<YysDayWorkEntity> list = this.list(wrapper);
LocalDate currentDate = LocalDate.now();
for (YysDayWorkEntity entity : list) {
if ("是".equals(entity.getIsFrozen())) {
entity.setProductionStatus("1");
continue;
}
Date manufactureDate = entity.getManufactureTime();
LocalDate productionDate = manufactureDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
if (productionDate.isBefore(currentDate)) {
entity.setProductionStatus("2");
} else if (productionDate.isAfter(currentDate)) {
entity.setProductionStatus("1");
} else {
if (isCurrentTimeBetween(entity.getStartTime(), entity.getEndTime())) {
entity.setProductionStatus("3");
} else if (isBefore(entity.getStartTime())) {
entity.setProductionStatus("1");
} else if (isAfter(entity.getEndTime())) {
entity.setProductionStatus("2");
}
}
}
this.updateBatchById(list);
}
private static boolean isCurrentTimeBetween(String startTimeStr, String ednTimeStr) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
// 将字符串时间转换为LocalTime对象
LocalTime startTime = LocalTime.parse(startTimeStr, formatter);
LocalTime endTime = LocalTime.parse(ednTimeStr, formatter);
LocalTime now = LocalTime.now();
return !now.isBefore(startTime) && (!now.isAfter(endTime) || now.equals(endTime));
}
//判断当前是否小于开始时间
private static boolean isBefore(String startTimeStr) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
LocalTime now = LocalTime.now();
LocalTime startTime = LocalTime.parse(startTimeStr, formatter);
return now.isBefore(startTime);
}
//判断是否大于结束时间
private static boolean isAfter(String endTimeStr) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm");
LocalTime now = LocalTime.now();
LocalTime endTime = LocalTime.parse(endTimeStr, formatter);
return now.isAfter(endTime);
}
}

@ -1,37 +1,45 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.YysInventoryQueryMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysinventoryquery.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
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 com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.YysInventoryQueryEntity;
import jnpf.mapper.YysInventoryQueryMapper;
import jnpf.model.QueryModel;
import jnpf.model.yysinventoryquery.SyncInventoryQuery;
import jnpf.model.yysinventoryquery.YysInventoryQueryConstant;
import jnpf.model.yysinventoryquery.YysInventoryQueryForm;
import jnpf.model.yysinventoryquery.YysInventoryQueryPagination;
import jnpf.model.yysmaterialinformation.MaterialInformationSync;
import jnpf.permission.entity.UserEntity;
import jnpf.service.YysInventoryQueryService;
import jnpf.util.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
*
* yysInventoryQuery
* V3.5
* https://www.jnpfsoft.com
@ -46,11 +54,17 @@ public class YysInventoryQueryServiceImpl extends ServiceImpl<YysInventoryQueryM
@Autowired
private UserProvider userProvider;
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List<YysInventoryQueryEntity> getList(YysInventoryQueryPagination yysInventoryQueryPagination) {
return getTypeList(yysInventoryQueryPagination, yysInventoryQueryPagination.getDataType());
}
/** 列表查询 */
/**
*
*/
@Override
public List<YysInventoryQueryEntity> getTypeList(YysInventoryQueryPagination yysInventoryQueryPagination, String dataType) {
String userId = userProvider.get().getUserId();
@ -229,27 +243,34 @@ public class YysInventoryQueryServiceImpl extends ServiceImpl<YysInventoryQueryM
return this.list(yysInventoryQueryQueryWrapper);
}
}
@Override
public YysInventoryQueryEntity getInfo(String id) {
QueryWrapper<YysInventoryQueryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(YysInventoryQueryEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(YysInventoryQueryEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, YysInventoryQueryEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(YysInventoryQueryEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override
public String checkForm(YysInventoryQueryForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
@ -261,8 +282,10 @@ public class YysInventoryQueryServiceImpl extends ServiceImpl<YysInventoryQueryM
//主表字段验证
return countRecover;
}
/**
* ()
*
* @param id
* @param yysInventoryQueryForm
* @return
@ -284,4 +307,48 @@ public class YysInventoryQueryServiceImpl extends ServiceImpl<YysInventoryQueryM
this.saveOrUpdate(entity);
}
@Override
public String syncInventory() {
List<String> syncList = this.list(new LambdaQueryWrapper<>(YysInventoryQueryEntity.class).isNull(YysInventoryQueryEntity::getDeleteMark))
.stream().map(YysInventoryQueryEntity::getId).collect(Collectors.toList());
RowMapper<SyncInventoryQuery> rowMapper = new BeanPropertyRowMapper<>(SyncInventoryQuery.class);
String sql = "select * from CurrentStock";
List<SyncInventoryQuery> query = this.jdbcTemplate.query(sql, rowMapper);
if (CollectionUtils.isEmpty(query)) {
return "远程库存信息为空";
}
//物料表数据 不从自己库取数据,防止自己库未同步,从而取不到数据
RowMapper<MaterialInformationSync> materialMapper = new BeanPropertyRowMapper<>(MaterialInformationSync.class);
String materialSql = "select * from dbo.Inventory";
List<MaterialInformationSync> informationSyncs = this.jdbcTemplate.query(materialSql, materialMapper);
Map<String, MaterialInformationSync> materialCollect = Maps.newHashMap();
if (CollectionUtils.isNotEmpty(informationSyncs)) {
materialCollect = informationSyncs.stream().collect(Collectors.toMap(MaterialInformationSync::getCInvCode, Function.identity()));
}
List<YysInventoryQueryEntity> result = Lists.newArrayList();
for (SyncInventoryQuery inventoryQuery : query) {
YysInventoryQueryEntity entity = new YysInventoryQueryEntity();
entity.setId(inventoryQuery.getAutoId());
entity.setInventoryNumber(inventoryQuery.getIQuantity());
if (MapUtils.isNotEmpty(materialCollect) && materialCollect.containsKey(inventoryQuery.getCInvCode())) {
MaterialInformationSync sync = materialCollect.get(inventoryQuery.getCInvCode());
entity.setMaterialName(sync.getCInvName());
entity.setModels(sync.getEInvStd());
entity.setUnit(sync.getCComUnitCode());
entity.setMaterialClassification(sync.getCInvCCode());
}
entity.setCreatorTime(DateUtil.getNowDate());
result.add(entity);
}
if (CollectionUtils.isEmpty(result)) {
return "没有需要同步的数据";
}
boolean b = this.saveBatch(result);
if (b) {
return "同步成功";
}
return "同步失败";
}
}

@ -0,0 +1,11 @@
package jnpf.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.entity.YysSubsetMaterialEntity;
import jnpf.mapper.YysSubsetMaterialMapper;
import jnpf.service.YysSubsetMaterialService;
import org.springframework.stereotype.Service;
@Service
public class YysSubsetMaterialServiceImpl extends ServiceImpl<YysSubsetMaterialMapper, YysSubsetMaterialEntity> implements YysSubsetMaterialService {
}

@ -15,22 +15,27 @@ import jnpf.model.yysbillmaterial.*;
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.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.transaction.annotation.Transactional;
/**
* yysBillMaterial
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
@ -52,7 +57,6 @@ public class YysBillMaterialController {
private YysBillMaterialService yysBillMaterialService;
/**
*
*
@ -81,6 +85,7 @@ public class YysBillMaterialController {
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
@ -101,8 +106,10 @@ public class YysBillMaterialController {
}
return ActionResult.success("创建成功");
}
/**
*
*
* @param id
* @param yysBillMaterialForm
* @return
@ -130,8 +137,10 @@ public class YysBillMaterialController {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
*
* @param id
* @return
*/
@ -146,9 +155,11 @@ public class YysBillMaterialController {
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@ -166,9 +177,11 @@ public class YysBillMaterialController {
yysBillMaterialMap = generaterSwapUtil.swapDataDetail(yysBillMaterialMap, YysBillMaterialConstant.getFormData(), "591255830234402757", false);
return ActionResult.success(yysBillMaterialMap);
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@ -187,4 +200,14 @@ public class YysBillMaterialController {
return ActionResult.success(yysBillMaterialMap);
}
@Operation(summary = "U8-获取物料清单")
@GetMapping("/syncMaterial")
public ActionResult syncMaterial() {
String result = yysBillMaterialService.syncMaterial();
if (result.contains("成功")) {
return ActionResult.success(result);
}
return ActionResult.fail(result);
}
}

@ -15,22 +15,27 @@ import jnpf.model.yysinventoryquery.*;
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.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.transaction.annotation.Transactional;
/**
* yysInventoryQuery
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
@ -52,7 +57,6 @@ public class YysInventoryQueryController {
private YysInventoryQueryService yysInventoryQueryService;
/**
*
*
@ -81,6 +85,7 @@ public class YysInventoryQueryController {
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
@ -101,8 +106,10 @@ public class YysInventoryQueryController {
}
return ActionResult.success("创建成功");
}
/**
*
*
* @param id
* @param yysInventoryQueryForm
* @return
@ -130,8 +137,10 @@ public class YysInventoryQueryController {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
*
* @param id
* @return
*/
@ -146,9 +155,11 @@ public class YysInventoryQueryController {
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@ -166,9 +177,11 @@ public class YysInventoryQueryController {
yysInventoryQueryMap = generaterSwapUtil.swapDataDetail(yysInventoryQueryMap, YysInventoryQueryConstant.getFormData(), "591261094123671493", false);
return ActionResult.success(yysInventoryQueryMap);
}
/**
* ()
* 使-
*
* @param id
* @return
*/
@ -187,4 +200,14 @@ public class YysInventoryQueryController {
return ActionResult.success(yysInventoryQueryMap);
}
@Operation(summary = "U8-获取库存查询数据")
@GetMapping("/syncInventory")
public ActionResult syncInventory() {
String result = yysInventoryQueryService.syncInventory();
if (result.contains("成功")) {
return ActionResult.success(result);
}
return ActionResult.fail(result);
}
}

@ -30,7 +30,7 @@ public class YysInventoryQueryEntity {
@TableField(value = "MODELS" , updateStrategy = FieldStrategy.IGNORED)
private String models;
@TableField(value = "INVENTORY_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal inventoryNumber;
private String inventoryNumber;
@TableField("REAMRK")
private String reamrk;
@TableField("F_CREATOR_TIME")

@ -0,0 +1,56 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName("yys_subset_material")
public class YysSubsetMaterialEntity {
@TableId(value = "ID")
private String id;
@TableField(value = "PIECE_ID", updateStrategy = FieldStrategy.IGNORED)
private String pieceId;
@TableField(value = "SUBSET_ID", updateStrategy = FieldStrategy.IGNORED)
private String subsetId;
@TableField(value = "SUBSET_NAME", updateStrategy = FieldStrategy.IGNORED)
private String subsetName;
@TableField(value = "SUBSET_MODEL", updateStrategy = FieldStrategy.IGNORED)
private String subsetModel;
@TableField(value = "UNIT", updateStrategy = FieldStrategy.IGNORED)
private String unit;
@TableField(value = "STATUS", updateStrategy = FieldStrategy.IGNORED)
private String status;
@TableField(value = "BASE_USE", updateStrategy = FieldStrategy.IGNORED)
private String baseUse;
@TableField(value = "BASE_NUM", updateStrategy = FieldStrategy.IGNORED)
private String baseNum;
@TableField(value = "F_CREATOR_TIME", updateStrategy = FieldStrategy.IGNORED)
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -0,0 +1,23 @@
package jnpf.model.yysbillmaterial;
import lombok.Data;
@Data
public class SyncMaterial {
/**
* id
*/
private String AutoId;
/**
* bomId
*/
private String BomId;
/**
*
*/
private String InvCode;
}

@ -0,0 +1,32 @@
package jnpf.model.yysbillmaterial;
import lombok.Data;
@Data
public class SyncSubsetMaterial {
/**
* id
*/
private String OpComponentId;
/**
* bomId
*/
private String BomId;
/**
*
*/
private String BaseQtyN;
/**
*
*/
private String BaseQtyD;
/**
*
*/
private String InvCode;
}

@ -0,0 +1,21 @@
package jnpf.model.yysinventoryquery;
import lombok.Data;
@Data
public class SyncInventoryQuery {
/**
* id
*/
private String AutoId;
/**
*
*/
private String cInvCode;
/**
*
*/
private String iQuantity;
}

@ -6,9 +6,7 @@ import jnpf.entity.EqmtCollectExceptMasterEntity;
import jnpf.entity.EqmtCollectPubDataEntity;
import jnpf.entity.YysDeviceDataEntity;
import jnpf.entity.YysDeviceWarnStatisticsEntity;
import jnpf.service.YysDeviceDataService;
import jnpf.service.YysDeviceWarnService;
import jnpf.service.YysDeviceWarnStatisticsService;
import jnpf.service.*;
import jnpf.util.DateUtil;
import jnpf.util.RandomUtil;
import jnpf.util.UserProvider;
@ -33,6 +31,30 @@ public class YysTaskHandler {
@Resource
private YysDeviceWarnService yysDeviceWarnService;
@Resource
private YysSupplierInformationService yysSupplierInformationService;
@Resource
private YysSupplierClassService yysSupplierClassService;
@Resource
private YysMaterialInformationService yysMaterialInformationService;
@Resource
private YysMaterialClassService yysMaterialClassService;
@Resource
private YysUnitInformationService yysUnitInformationService;
@Resource
private YysBillMaterialService yysBillMaterialService;
@Resource
private YysInventoryQueryService yysInventoryQueryService;
@Resource
private YysDayWorkService yysDayWorkService;
@Autowired
private UserProvider userProvider;
@ -114,4 +136,78 @@ public class YysTaskHandler {
CompletableFuture.runAsync(() -> yysDeviceWarnService.syncCount(collect));
}
}
/**
* U8
*/
//每一小时执行一次
@XxlJob("syncSupplier")
public void syncSupplier() {
yysSupplierInformationService.syncSupplier();
}
/**
* U8
*/
//每一小时执行一次
@XxlJob("syncSupplierClass")
public void syncSupplierClass() {
yysSupplierClassService.syncSupplierClass();
}
/**
* U8
*/
//每一小时执行一次
@XxlJob("syncMaterialInfo")
public void syncMaterialInfo() {
yysMaterialInformationService.syncMaterialInfo();
}
/**
* U8
*/
//每一小时执行一次
@XxlJob("syncMaterialClass")
public void syncMaterialClass() {
yysMaterialClassService.syncMaterialClass();
}
/**
* U8
*/
//每一小时执行一次
@XxlJob("syncUnit")
public void syncUnit() {
yysUnitInformationService.syncUnit();
}
/**
* U8
*/
//每一小时执行一次
@XxlJob("syncMaterial")
public void syncMaterial() {
yysBillMaterialService.syncMaterial();
}
/**
* U8
*/
//每一小时执行一次
@XxlJob("syncInventory")
public void syncInventory() {
yysInventoryQueryService.syncInventory();
}
/**
*
*/
//每分钟执行一次
@XxlJob("syncDayWork")
public void syncDayWork() {
yysDayWorkService.syncDayWork();
}
}

@ -31,6 +31,8 @@
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">
</el-button>
<el-button type="success" icon="icon-ym el-icon-refresh" @click="syncData()">
</el-button>
</div>
<div class="JNPF-common-head-right">
<el-tooltip content="高级查询" placement="top" v-if="true">
@ -182,6 +184,25 @@ export default {
this.queryData = JSON.parse(JSON.stringify(this.query))
},
methods: {
syncData(){
this.$confirm('此操作将从远程库中拉取同步数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/example/YysBillMaterial/syncMaterial`,
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 => {

@ -282,7 +282,7 @@ export default {
deviceCodecolumnOptions: [{ "label": "设备编码", "value": "device_code" }, { "label": "设备名称", "value": "device_name" }, { "label": "设备类型", "value": "device_desc" },],
postcolumnOptions: [{ "label": "班次", "value": "classes_name" }, { "label": "开始时间", "value": "start_time" }, { "label": "结束时间", "value": "end_time" }, { "label": "时长", "value": "classes_duration" },],
productCodecolumnOptions: [{ "label": "产品编码", "value": "material_id" }, { "label": "产品名称", "value": "material_name" }, { "label": "规格型号", "value": "model" }, { "label": "计量单位", "value": "unit_measurement" }, { "label": "安全库存", "value": "safety_stock" },],
productionStatusOptions: [{ "fullName": "未开工", "id": "1" }, { "fullName": "已完工", "id": "2" }],
productionStatusOptions: [{ "fullName": "未开工", "id": "1" }, { "fullName": "已完工", "id": "2" }, { "fullName": "已开工", "id": "3" }],
productionStatusProps: { "label": "fullName", "value": "id" },
childIndex: -1,
isEdit: false,

@ -83,7 +83,7 @@
@click="delyysdeviceunkeeplogsList(scope.$index)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="维保类型" prop="unkeepType" fixed="left" width="200" align="center">
<el-table-column label="维保类型" prop="unkeepType" width="200" align="center">
<template slot="header" v-if="true">
<span class="required-sign">*</span>维保类型
</template>
@ -97,7 +97,7 @@
</template>
</el-table-column>
<el-table-column label="维保开始时间" prop="startTime" fixed="left" width="200" align="center">
<el-table-column label="维保开始时间" prop="startTime" width="200" align="center">
<template slot="header" v-if="true">
<span class="required-sign">*</span>维保开始时间
</template>
@ -111,7 +111,7 @@
</template>
</el-table-column>
<el-table-column label="维保结束时间" prop="endTime" fixed="left" width="200" align="center">
<el-table-column label="维保结束时间" prop="endTime" width="200" align="center">
<template slot="header" v-if="true">
<span class="required-sign">*</span>维保结束时间
</template>

@ -31,7 +31,7 @@
<div>
<!-- <el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">
</el-button> -->
<el-button type="success" disabled icon="icon-ym el-icon-refresh" @click="syncData()">
<el-button type="success" icon="icon-ym el-icon-refresh" @click="syncData()">
</el-button>
</div>
<div class="JNPF-common-head-right">
@ -174,6 +174,25 @@ export default {
this.queryData = JSON.parse(JSON.stringify(this.query))
},
methods: {
syncData(){
this.$confirm('此操作将从远程库中拉取同步数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/example/YysInventoryQuery/syncInventory`,
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 => {

Loading…
Cancel
Save