商品列表初步

jg-waiwang-pro
mhsnet 9 months ago
parent c4c08f0992
commit cdfb15d5fa

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.mapper.ProductBusinessMapper">
</mapper>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.mapper.ProductUnitMapper">
</mapper>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.mapper.ProductWarehouseMapper">
</mapper>

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.ProductBusinessEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
public interface ProductBusinessMapper extends BaseMapper<ProductBusinessEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.ProductUnitEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
public interface ProductUnitMapper extends BaseMapper<ProductUnitEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.ProductWarehouseEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
public interface ProductWarehouseMapper extends BaseMapper<ProductWarehouseEntity> {
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.productwarehouse.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
public interface ProductBusinessService extends IService<ProductBusinessEntity> {
QueryWrapper<ProductBusinessEntity> getChild(ProductWarehousePagination pagination,QueryWrapper<ProductBusinessEntity> productBusinessQueryWrapper);
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.productwarehouse.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
public interface ProductUnitService extends IService<ProductUnitEntity> {
QueryWrapper<ProductUnitEntity> getChild(ProductWarehousePagination pagination,QueryWrapper<ProductUnitEntity> productUnitQueryWrapper);
}

@ -0,0 +1,41 @@
package jnpf.service;
import jnpf.model.productwarehouse.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
public interface ProductWarehouseService extends IService<ProductWarehouseEntity> {
List<ProductWarehouseEntity> getList(ProductWarehousePagination productWarehousePagination);
List<ProductWarehouseEntity> getTypeList(ProductWarehousePagination productWarehousePagination,String dataType);
ProductWarehouseEntity getInfo(String id);
void delete(ProductWarehouseEntity entity);
void create(ProductWarehouseEntity entity);
boolean update(String id, ProductWarehouseEntity entity);
//子表方法
List<ProductUnitEntity> getProductUnitList(String id,ProductWarehousePagination productWarehousePagination);
List<ProductUnitEntity> getProductUnitList(String id);
//副表数据方法
ProductBusinessEntity getProductBusiness(String id);
String checkForm(ProductWarehouseForm form,int i);
void saveOrUpdate(ProductWarehouseForm productWarehouseForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,59 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.ProductBusinessMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.productwarehouse.*;
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 jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
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 jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
@Service
public class ProductBusinessServiceImpl extends ServiceImpl<ProductBusinessMapper, ProductBusinessEntity> implements ProductBusinessService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<ProductBusinessEntity> getChild(ProductWarehousePagination pagination, QueryWrapper<ProductBusinessEntity> productBusinessQueryWrapper){
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?ProductWarehouseConstant.getColumnData():ProductWarehouseConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
return productBusinessQueryWrapper;
}
}

@ -0,0 +1,59 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.ProductUnitMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.productwarehouse.*;
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 jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
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 jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
@Service
public class ProductUnitServiceImpl extends ServiceImpl<ProductUnitMapper, ProductUnitEntity> implements ProductUnitService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<ProductUnitEntity> getChild(ProductWarehousePagination pagination, QueryWrapper<ProductUnitEntity> productUnitQueryWrapper){
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?ProductWarehouseConstant.getColumnData():ProductWarehouseConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
return productUnitQueryWrapper;
}
}

@ -0,0 +1,496 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.ProductWarehouseMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.productwarehouse.*;
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.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 jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* productWarehouse
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
@Service
public class ProductWarehouseServiceImpl extends ServiceImpl<ProductWarehouseMapper, ProductWarehouseEntity> implements ProductWarehouseService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private ProductBusinessService productBusinessService;
@Autowired
private ProductUnitService productUnitService;
@Override
public List<ProductWarehouseEntity> getList(ProductWarehousePagination productWarehousePagination){
return getTypeList(productWarehousePagination,productWarehousePagination.getDataType());
}
/** 列表查询 */
@Override
public List<ProductWarehouseEntity> getTypeList(ProductWarehousePagination productWarehousePagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? ProductWarehouseConstant.getAppColumnData() : ProductWarehouseConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int productWarehouseNum =0;
QueryWrapper<ProductWarehouseEntity> productWarehouseQueryWrapper=new QueryWrapper<>();
int productBusinessNum =0;
QueryWrapper<ProductBusinessEntity> productBusinessQueryWrapper=new QueryWrapper<>();
int productUnitNum =0;
QueryWrapper<ProductUnitEntity> productUnitQueryWrapper=new QueryWrapper<>();
long productBusinesscount = productBusinessService.count();
long productUnitcount = productUnitService.count();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(productWarehousePagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = productWarehousePagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<ProductWarehouseEntity> productWarehouseSuperWrapper = new QueryWrapper<>();
productWarehouseSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(productWarehouseSuperWrapper,ProductWarehouseEntity.class,queryJson,"0"));
int productWarehouseNum1 = productWarehouseSuperWrapper.getExpression().getNormal().size();
if (productWarehouseNum1>0){
List<String> productWarehouseList =this.list(productWarehouseSuperWrapper).stream().map(ProductWarehouseEntity::getId).collect(Collectors.toList());
allSuperList.addAll(productWarehouseList);
intersectionSuperList.add(productWarehouseList);
superNum++;
}
String productBusinessTable = "jg_product_business";
boolean productBusinessHasSql = queryJson.contains(productBusinessTable);
List<String> productBusinessList = generaterSwapUtil.selectIdsByChildCondition(ProductWarehouseConstant.getTableList(), productBusinessTable , queryJson, null);
if (productBusinessHasSql){
allSuperList.addAll(productBusinessList);
intersectionSuperList.add(productBusinessList);
superNum++;
}
String productUnitTable = "jg_product_unit";
boolean productUnitHasSql = queryJson.contains(productUnitTable);
List<String> productUnitList = generaterSwapUtil.selectIdsByChildCondition(ProductWarehouseConstant.getTableList(), productUnitTable , queryJson, null);
if (productUnitHasSql){
allSuperList.addAll(productUnitList);
intersectionSuperList.add(productUnitList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<ProductWarehouseEntity> productWarehouseSuperWrapper = new QueryWrapper<>();
productWarehouseSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(productWarehouseSuperWrapper,ProductWarehouseEntity.class,ruleJson,"0"));
int productWarehouseNum1 = productWarehouseSuperWrapper.getExpression().getNormal().size();
if (productWarehouseNum1>0){
List<String> productWarehouseList =this.list(productWarehouseSuperWrapper).stream().map(ProductWarehouseEntity::getId).collect(Collectors.toList());
allRuleList.addAll(productWarehouseList);
intersectionRuleList.add(productWarehouseList);
ruleNum++;
}
String productBusinessTable = "jg_product_business";
boolean productBusinessHasSql = ruleJson.contains(productBusinessTable);
List<String> productBusinessList = generaterSwapUtil.selectIdsByChildCondition(ProductWarehouseConstant.getTableList(), productBusinessTable , ruleJson, null);
if (productBusinessHasSql){
allRuleList.addAll(productBusinessList);
intersectionRuleList.add(productBusinessList);
ruleNum++;
}
String productUnitTable = "jg_product_unit";
boolean productUnitHasSql = ruleJson.contains(productUnitTable);
List<String> productUnitList = generaterSwapUtil.selectIdsByChildCondition(ProductWarehouseConstant.getTableList(), productUnitTable , ruleJson, null);
if (productUnitHasSql){
allRuleList.addAll(productUnitList);
intersectionRuleList.add(productUnitList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object productWarehouseObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productWarehouseQueryWrapper,ProductWarehouseEntity.class,productWarehousePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productWarehouseObj)){
return new ArrayList<>();
} else {
productWarehouseQueryWrapper = (QueryWrapper<ProductWarehouseEntity>)productWarehouseObj;
if( productWarehouseQueryWrapper.getExpression().getNormal().size()>0){
productWarehouseNum++;
}
}
Object productBusinessObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productBusinessQueryWrapper,ProductBusinessEntity.class,productWarehousePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productBusinessObj)){
return new ArrayList<>();
} else {
productBusinessQueryWrapper = (QueryWrapper<ProductBusinessEntity>)productBusinessObj;
if( productBusinessQueryWrapper.getExpression().getNormal().size()>0){
productBusinessNum++;
}
}
Object productUnitObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productUnitQueryWrapper,ProductUnitEntity.class,productWarehousePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productUnitObj)){
return new ArrayList<>();
} else {
productUnitQueryWrapper = (QueryWrapper<ProductUnitEntity>)productUnitObj;
if( productUnitQueryWrapper.getExpression().getNormal().size()>0){
productUnitNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object productWarehouseObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productWarehouseQueryWrapper,ProductWarehouseEntity.class,productWarehousePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productWarehouseObj)){
return new ArrayList<>();
} else {
productWarehouseQueryWrapper = (QueryWrapper<ProductWarehouseEntity>)productWarehouseObj;
if( productWarehouseQueryWrapper.getExpression().getNormal().size()>0){
productWarehouseNum++;
}
}
Object productBusinessObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productBusinessQueryWrapper,ProductBusinessEntity.class,productWarehousePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productBusinessObj)){
return new ArrayList<>();
} else {
productBusinessQueryWrapper = (QueryWrapper<ProductBusinessEntity>)productBusinessObj;
if( productBusinessQueryWrapper.getExpression().getNormal().size()>0){
productBusinessNum++;
}
}
Object productUnitObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productUnitQueryWrapper,ProductUnitEntity.class,productWarehousePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productUnitObj)){
return new ArrayList<>();
} else {
productUnitQueryWrapper = (QueryWrapper<ProductUnitEntity>)productUnitObj;
if( productUnitQueryWrapper.getExpression().getNormal().size()>0){
productUnitNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(productWarehousePagination.getCode())){
productWarehouseNum++;
String value = productWarehousePagination.getCode() instanceof List ?
JsonUtil.getObjectToString(productWarehousePagination.getCode()) :
String.valueOf(productWarehousePagination.getCode());
productWarehouseQueryWrapper.lambda().like(ProductWarehouseEntity::getCode,value);
}
if(ObjectUtil.isNotEmpty(productWarehousePagination.getName())){
productWarehouseNum++;
String value = productWarehousePagination.getName() instanceof List ?
JsonUtil.getObjectToString(productWarehousePagination.getName()) :
String.valueOf(productWarehousePagination.getName());
productWarehouseQueryWrapper.lambda().like(ProductWarehouseEntity::getName,value);
}
if(ObjectUtil.isNotEmpty(productWarehousePagination.getProductTypeId())){
productWarehouseNum++;
productWarehouseQueryWrapper.lambda().eq(ProductWarehouseEntity::getProductTypeId,productWarehousePagination.getProductTypeId());
}
if(ObjectUtil.isNotEmpty(productWarehousePagination.getInventoryType())){
productWarehouseNum++;
List<String> idList = new ArrayList<>();
try {
String[][] inventoryType = JsonUtil.getJsonToBean(productWarehousePagination.getInventoryType(),String[][].class);
for(int i=0;i<inventoryType.length;i++){
if(inventoryType[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(inventoryType[i])));
}
}
}catch (Exception e1){
try {
List<String> inventoryType = JsonUtil.getJsonToList(productWarehousePagination.getInventoryType(),String.class);
if(inventoryType.size()>0){
idList.addAll(inventoryType);
}
}catch (Exception e2){
idList.add(String.valueOf(productWarehousePagination.getInventoryType()));
}
}
productWarehouseQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(ProductWarehouseEntity::getInventoryType, tt).or();
});
});
}
}
if(productBusinessNum>0){
List<String> productBusinessIdList = productBusinessService.list(productBusinessQueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getProductId())).map(t->t.getProductId()).collect(Collectors.toList());
long count = productBusinessService.count();
if (count>0){
intersectionList.add(productBusinessIdList);
}
AllIdList.addAll(productBusinessIdList);
}
total+=productBusinessNum;
if(productUnitNum>0){
List<String> productUnitIdList = productUnitService.list(productUnitQueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getProuctId())).map(t->t.getProuctId()).collect(Collectors.toList());
long count = productUnitService.count();
if (count>0){
intersectionList.add(productUnitIdList);
}
AllIdList.addAll(productUnitIdList);
}
total+=productUnitNum;
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
productWarehouseQueryWrapper.lambda().in(ProductWarehouseEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
productWarehouseQueryWrapper.lambda().and(t->t.in(ProductWarehouseEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
productWarehouseQueryWrapper.lambda().and(t->t.in(ProductWarehouseEntity::getId, finalAllRuleIDlist));
}
//假删除标志
productWarehouseQueryWrapper.lambda().isNull(ProductWarehouseEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(productWarehousePagination.getSidx())){
productWarehouseQueryWrapper.lambda().orderByDesc(ProductWarehouseEntity::getId);
}else{
try {
String sidx = productWarehousePagination.getSidx();
String[] strs= sidx.split("_name");
ProductWarehouseEntity productWarehouseEntity = new ProductWarehouseEntity();
Field declaredField = productWarehouseEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
productWarehouseQueryWrapper="asc".equals(productWarehousePagination.getSort().toLowerCase())?productWarehouseQueryWrapper.orderByAsc(value):productWarehouseQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<ProductWarehouseEntity> page=new Page<>(productWarehousePagination.getCurrentPage(), productWarehousePagination.getPageSize());
IPage<ProductWarehouseEntity> userIPage=this.page(page, productWarehouseQueryWrapper);
return productWarehousePagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<ProductWarehouseEntity> list = new ArrayList();
return productWarehousePagination.setData(list, list.size());
}
}else{
return this.list(productWarehouseQueryWrapper);
}
}
@Override
public ProductWarehouseEntity getInfo(String id){
QueryWrapper<ProductWarehouseEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(ProductWarehouseEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(ProductWarehouseEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, ProductWarehouseEntity entity){
return this.updateById(entity);
}
@Override
public void delete(ProductWarehouseEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** ProductUnit子表方法 */
@Override
public List<ProductUnitEntity> getProductUnitList(String id,ProductWarehousePagination productWarehousePagination){
Map<String, Object> newtabMap=ProductWarehouseConstant.TABLEFIELDKEY.entrySet()
.stream().collect( Collectors.toMap(e->e.getValue(),e->e.getKey()));
String tableName="productUnit";
tableName=newtabMap.get(tableName)==null?tableName:newtabMap.get(tableName).toString();
QueryWrapper<ProductUnitEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = productUnitService.getChild(productWarehousePagination,queryWrapper);
queryWrapper.lambda().eq(ProductUnitEntity::getProuctId, id);
generaterSwapUtil.wrapperHandle(ProductWarehouseConstant.getColumnData(), ProductWarehouseConstant.getAppColumnData(), queryWrapper,ProductUnitEntity.class,"sub",tableName);
return productUnitService.list(queryWrapper);
}
/** ProductUnit子表方法 */
@Override
public List<ProductUnitEntity> getProductUnitList(String id){
QueryWrapper<ProductUnitEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProductUnitEntity::getProuctId, id);
return productUnitService.list(queryWrapper);
}
/** ProductBusiness副表方法 */
@Override
public ProductBusinessEntity getProductBusiness(String id){
QueryWrapper<ProductBusinessEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProductBusinessEntity::getProductId, id);
return productBusinessService.getOne(queryWrapper);
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(ProductWarehouseForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getName())){
return "商品名称不能为空";
}
if(StringUtil.isEmpty(form.getSpec())){
return "商品规格不能为空";
}
if(StringUtil.isEmpty(form.getAvailableInventory())){
return "可售库存不能为空";
}
//副表字段验证
//子表字段验证
if (form.getProductUnitList()!=null){
}
return countRecover;
}
/**
* ()
* @param id
* @param productWarehouseForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(ProductWarehouseForm productWarehouseForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
productWarehouseForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(ProductWarehouseConstant.getFormData(),productWarehouseForm),ProductWarehouseForm.class);
ProductWarehouseEntity entity = JsonUtil.getJsonToBean(productWarehouseForm, ProductWarehouseEntity.class);
if(isSave){
String mainId = id ;
entity.setCode(generaterSwapUtil.getBillNumber("productcode", false));
entity.setBarCode(generaterSwapUtil.getBillNumber("productBarCode", false));
entity.setId(mainId);
entity.setFlowId(productWarehouseForm.getFlowId());
entity.setVersion(0);
}else{
entity.setCode(generaterSwapUtil.getBillNumber("productcode", false));
entity.setBarCode(generaterSwapUtil.getBillNumber("productBarCode", false));
entity.setFlowId(productWarehouseForm.getFlowId());
}
this.saveOrUpdate(entity);
//ProductUnit子表数据新增修改
if(!isSave){
QueryWrapper<ProductUnitEntity> ProductUnitqueryWrapper = new QueryWrapper<>();
ProductUnitqueryWrapper.lambda().eq(ProductUnitEntity::getProuctId, entity.getId());
productUnitService.remove(ProductUnitqueryWrapper);
}
if (productWarehouseForm.getProductUnitList()!=null){
List<ProductUnitEntity> tableField141 = JsonUtil.getJsonToList(productWarehouseForm.getProductUnitList(),ProductUnitEntity.class);
for(ProductUnitEntity entitys : tableField141){
entitys.setId(RandomUtil.uuId());
entitys.setProuctId(entity.getId());
if(isSave){
}else{
}
productUnitService.saveOrUpdate(entitys);
}
}
//jg_product_business副表数据新增修改
Map<String, Object> ProductBusinessMap = generaterSwapUtil.getMastTabelData(productWarehouseForm,"jg_product_business");
ProductBusinessEntity jg_product_businessentity = JsonUtil.getJsonToBean(ProductBusinessMap,ProductBusinessEntity.class);
//自动生成的字段
if(isSave){
jg_product_businessentity.setProductId(entity.getId());
jg_product_businessentity.setId(RandomUtil.uuId());
}else{
QueryWrapper<ProductBusinessEntity> queryWrapperProductBusiness =new QueryWrapper<>();
queryWrapperProductBusiness.lambda().eq(ProductBusinessEntity::getProductId,entity.getId());
ProductBusinessEntity jg_product_businessOneEntity= productBusinessService.getOne(queryWrapperProductBusiness);
jg_product_businessentity.setId(jg_product_businessOneEntity.getId());
jg_product_businessentity.setProductId(entity.getId());
}
productBusinessService.saveOrUpdate(jg_product_businessentity);
}
}

@ -0,0 +1,250 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.productwarehouse.*;
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;
/**
* productWarehouse
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-31
*/
@Slf4j
@RestController
@Tag(name = "productWarehouse" , description = "scm")
@RequestMapping("/api/scm/ProductWarehouse")
public class ProductWarehouseController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private ProductWarehouseService productWarehouseService;
@Autowired
private ProductUnitService productUnitService;
@Autowired
private ProductBusinessService productBusinessService;
/**
*
*
* @param productWarehousePagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody ProductWarehousePagination productWarehousePagination)throws IOException{
List<ProductWarehouseEntity> list= productWarehouseService.getList(productWarehousePagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (ProductWarehouseEntity entity : list) {
Map<String, Object> productWarehouseMap=JsonUtil.entityToMap(entity);
productWarehouseMap.put("id", productWarehouseMap.get("id"));
//副表数据
ProductBusinessEntity productBusinessEntity = productWarehouseService.getProductBusiness(entity.getId());
if(ObjectUtil.isNotEmpty(productBusinessEntity)){
Map<String, Object> productBusinessMap=JsonUtil.entityToMap(productBusinessEntity);
for(String key:productBusinessMap.keySet()){
productWarehouseMap.put("jnpf_jg_product_business_jnpf_"+key,productBusinessMap.get(key));
}
}
//子表数据
List<ProductUnitEntity> productUnitList = productWarehouseService.getProductUnitList(entity.getId(),productWarehousePagination);
productWarehouseMap.put("tableField141",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(productUnitList)));
realList.add(productWarehouseMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, ProductWarehouseConstant.getFormData(), ProductWarehouseConstant.getColumnData(), productWarehousePagination.getModuleId(),false);
//流程状态添加
for(Map<String, Object> vo:realList){
FlowTaskEntity flowTaskEntity = generaterSwapUtil.getInfoSubmit(String.valueOf(vo.get("id")), FlowTaskEntity::getStatus);
if (flowTaskEntity!=null){
vo.put("flowState",flowTaskEntity.getStatus());
}else{
vo.put("flowState",null);
}
//添加流程id
String flowId="";
if(vo.get("flowid")!=null){
flowId = String.valueOf(vo.get("flowid"));
}
if(vo.get("flowid".toUpperCase())!=null){
flowId = String.valueOf(vo.get("flowid".toUpperCase()));
}
if(StringUtil.isNotEmpty(flowId)){
vo.put("flowId" ,flowId);
}
}
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(productWarehousePagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param productWarehouseForm
* @return
*/
@PostMapping("/{id}")
@Operation(summary = "创建")
public ActionResult create(@PathVariable("id") String id, @RequestBody @Valid ProductWarehouseForm productWarehouseForm) {
String b = productWarehouseService.checkForm(productWarehouseForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
productWarehouseService.saveOrUpdate(productWarehouseForm, id ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
*
* @param id
* @param productWarehouseForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid ProductWarehouseForm productWarehouseForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
productWarehouseForm.setId(id);
if (!isImport) {
String b = productWarehouseService.checkForm(productWarehouseForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
ProductWarehouseEntity entity= productWarehouseService.getInfo(id);
if(entity!=null){
try{
productWarehouseService.saveOrUpdate(productWarehouseForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
ProductWarehouseEntity entity= productWarehouseService.getInfo(id);
if(entity!=null){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(id, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity != null) {
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
} catch (WorkFlowException e) {
e.printStackTrace();
}
}
//假删除
entity.setDeleteMark(1);
productWarehouseService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
ProductWarehouseEntity entity= productWarehouseService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> productWarehouseMap=JsonUtil.entityToMap(entity);
productWarehouseMap.put("id", productWarehouseMap.get("id"));
//副表数据
ProductBusinessEntity productBusinessEntity = productWarehouseService.getProductBusiness(entity.getId());
if(ObjectUtil.isNotEmpty(productBusinessEntity)){
Map<String, Object> productBusinessMap=JsonUtil.entityToMap(productBusinessEntity);
for(String key:productBusinessMap.keySet()){
productWarehouseMap.put("jnpf_jg_product_business_jnpf_"+key,productBusinessMap.get(key));
}
}
//子表数据
List<ProductUnitEntity> productUnitList = productWarehouseService.getProductUnitList(entity.getId());
productWarehouseMap.put("tableField141",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(productUnitList)));
productWarehouseMap = generaterSwapUtil.swapDataDetail(productWarehouseMap,ProductWarehouseConstant.getFormData(),"518014334211720453",false);
return ActionResult.success(productWarehouseMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
ProductWarehouseEntity entity= productWarehouseService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> productWarehouseMap=JsonUtil.entityToMap(entity);
productWarehouseMap.put("id", productWarehouseMap.get("id"));
//副表数据
ProductBusinessEntity productBusinessEntity = productWarehouseService.getProductBusiness(entity.getId());
if(ObjectUtil.isNotEmpty(productBusinessEntity)){
Map<String, Object> productBusinessMap=JsonUtil.entityToMap(productBusinessEntity);
for(String key:productBusinessMap.keySet()){
productWarehouseMap.put("jnpf_jg_product_business_jnpf_"+key,productBusinessMap.get(key));
}
}
//子表数据
List<ProductUnitEntity> productUnitList = productWarehouseService.getProductUnitList(entity.getId());
productWarehouseMap.put("productUnitList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(productUnitList)));
productWarehouseMap = generaterSwapUtil.swapDataForm(productWarehouseMap,ProductWarehouseConstant.getFormData(),ProductWarehouseConstant.TABLEFIELDKEY,ProductWarehouseConstant.TABLERENAMES);
return ActionResult.success(productWarehouseMap);
}
}

@ -0,0 +1,39 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* 线
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-31
*/
@Data
@TableName("jg_product_business")
public class ProductBusinessEntity {
@TableId(value ="ID" )
private String id;
@TableField("PRODUCT_ID")
private String productId;
@TableField(value = "BUSINESS_LINE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String businessLineId;
@TableField("F_CREATOR_TIME")
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;
}

@ -0,0 +1,89 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-31
*/
@Data
@TableName("jg_product_unit")
public class ProductUnitEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "PRODUCT_UNIT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String productUnitName;
@TableField("PROUCT_ID")
private String prouctId;
@TableField(value = "CONVERSION_RULES1" , updateStrategy = FieldStrategy.IGNORED)
private String conversionRules1;
@TableField("CONVERSION_RULES2")
private String conversionRules2;
@TableField("PACKAGING_BARCODE")
private String packagingBarcode;
@TableField("DIMENSIONAL_UNIT")
private String dimensionalUnit;
@TableField("SIZE_INFORMATION1")
private BigDecimal sizeInformation1;
@TableField("SIZE_INFORMATION2")
private BigDecimal sizeInformation2;
@TableField("SIZE_INFORMATION3")
private BigDecimal sizeInformation3;
@TableField("VOLUME_INFORMATION")
private BigDecimal volumeInformation;
@TableField("VOLUME_INFORMATION_UNIT")
private String volumeInformationUnit;
@TableField("WEIGHT")
private String weight;
@TableField("GROSS_WEIGHT")
private BigDecimal grossWeight;
@TableField("NET_WEIGHT")
private BigDecimal netWeight;
@TableField("PURCHASE_PRICE")
private BigDecimal purchasePrice;
@TableField("CURRENCY_ID1")
private String currencyId1;
@TableField("RETAIL_PRICE")
private BigDecimal retailPrice;
@TableField("CURRENCY_ID2")
private String currencyId2;
@TableField("STANDARD_PRICE")
private BigDecimal standardPrice;
@TableField("CURRENCY_ID3")
private String currencyId3;
@TableField("COST_PRICE")
private BigDecimal costPrice;
@TableField("CURRENCY_ID4")
private String currencyId4;
@TableField("F_CREATOR_TIME")
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;
}

@ -0,0 +1,219 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-31
*/
@Data
@TableName("jg_product")
public class ProductWarehouseEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "PRODUCT_TYPE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String productTypeId;
@TableField(value = "PHOTO" , updateStrategy = FieldStrategy.IGNORED)
private String photo;
@TableField(value = "CODE" , updateStrategy = FieldStrategy.IGNORED)
private String code;
@TableField(value = "NAME" , updateStrategy = FieldStrategy.IGNORED)
private String name;
@TableField("PRODUCT_STATUS")
private String productStatus;
@TableField(value = "SHORT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String shortName;
@TableField(value = "BAR_CODE" , updateStrategy = FieldStrategy.IGNORED)
private String barCode;
@TableField("BOX_SURFACE_NUM")
private String boxSurfaceNum;
@TableField(value = "SPEC" , updateStrategy = FieldStrategy.IGNORED)
private String spec;
@TableField(value = "INVENTORY_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String inventoryType;
@TableField(value = "BRAND_ID" , updateStrategy = FieldStrategy.IGNORED)
private String brandId;
@TableField(value = "AREA" , updateStrategy = FieldStrategy.IGNORED)
private String area;
@TableField("PRODUCT_CATEGORY_ID")
private String productCategoryId;
@TableField("LIFE_CYCLE")
private String lifeCycle;
@TableField("AREA_CATEGORY")
private String areaCategory;
@TableField(value = "DANGEROUS_FLAG" , updateStrategy = FieldStrategy.IGNORED)
private String dangerousFlag;
@TableField(value = "IMPORTED_FLAG" , updateStrategy = FieldStrategy.IGNORED)
private String importedFlag;
@TableField(value = "FIRST_SUPPLIER_ID" , updateStrategy = FieldStrategy.IGNORED)
private String firstSupplierId;
@TableField("SETTLEMENT_ENTITY")
private String settlementEntity;
@TableField(value = "OUTPUT_TAX_RATE" , updateStrategy = FieldStrategy.IGNORED)
private String outputTaxRate;
@TableField(value = "INPUT_TAX_RATE" , updateStrategy = FieldStrategy.IGNORED)
private String inputTaxRate;
@TableField(value = "DELIVERY_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String deliveryType;
@TableField("MANY_UNIT_FLAG")
private String manyUnitFlag;
@TableField("INVENTORY_UNIT_ID")
private String inventoryUnitId;
@TableField("ORDER_MAIN_UNIT_ID")
private String orderMainUnitId;
@TableField("ORDER_OTHER_UNIT_ID")
private String orderOtherUnitId;
@TableField("SALES_MAIN_UNIT_ID")
private String salesMainUnitId;
@TableField("SALES_OTHER_UNIT_ID")
private String salesOtherUnitId;
@TableField("OPERATE_UNIT_ID")
private String operateUnitId;
@TableField("PRICING_UNIT_ID")
private String pricingUnitId;
@TableField("PURCHASE_ORDER_QUANTITY_DOWN")
private String purchaseOrderQuantityDown;
@TableField("PURCHASE_ORDER_QUANTITY_UPPER")
private String purchaseOrderQuantityUpper;
@TableField("PURCHASE_ORDER_MULTIPLE")
private String purchaseOrderMultiple;
@TableField("PURCHASE_INITIAL_AMOUNT")
private String purchaseInitialAmount;
@TableField("PURCHASE_ALLOW_OVERCHARGING_RATIO")
private String purchaseAllowOverchargingRatio;
@TableField("PURCHASE_ORDER_START")
private Date purchaseOrderStart;
@TableField("PURCHASE_ORDER_END")
private Date purchaseOrderEnd;
@TableField("PURCHASE_MODE")
private String purchaseMode;
@TableField("SALES_ORDER_QUANTITY_DOWN")
private String salesOrderQuantityDown;
@TableField("SALES_ORDER_QUANTITY_UPPER")
private String salesOrderQuantityUpper;
@TableField("SALES_ORDER_MULTIPLE")
private String salesOrderMultiple;
@TableField("SALES_INITIAL_AMOUNT")
private String salesInitialAmount;
@TableField("SALES_ALLOW_OVERCHARGING_RATIO")
private String salesAllowOverchargingRatio;
@TableField(value = "SALES_START" , updateStrategy = FieldStrategy.IGNORED)
private Date salesStart;
@TableField(value = "SALES_END" , updateStrategy = FieldStrategy.IGNORED)
private Date salesEnd;
@TableField("SALES_MODE_START")
private String salesModeStart;
@TableField("SALES_MODE")
private String salesMode;
@TableField("DELIVER_MODE")
private String deliverMode;
@TableField("DELIVER_GOODS_DATE")
private Date deliverGoodsDate;
@TableField("DELAY_NUM")
private String delayNum;
@TableField(value = "SAFETY_STOCK" , updateStrategy = FieldStrategy.IGNORED)
private String safetyStock;
@TableField(value = "INVENTORY_DAY_DOWN" , updateStrategy = FieldStrategy.IGNORED)
private String inventoryDayDown;
@TableField(value = "INVENTORY_DAY_UPPER" , updateStrategy = FieldStrategy.IGNORED)
private String inventoryDayUpper;
@TableField(value = "INVENTORY_DOWN" , updateStrategy = FieldStrategy.IGNORED)
private String inventoryDown;
@TableField(value = "INVENTORY_UPPER" , updateStrategy = FieldStrategy.IGNORED)
private String inventoryUpper;
@TableField("FIXED_REPLENISHMENT_QUANTITY")
private String fixedReplenishmentQuantity;
@TableField(value = "AVAILABLE_INVENTORY" , updateStrategy = FieldStrategy.IGNORED)
private String availableInventory;
@TableField("TRANSIT_INVENTORY")
private String transitInventory;
@TableField("MANAGE_INVENTORY")
private String manageInventory;
@TableField("FROM_INVENTORY")
private String fromInventory;
@TableField("MANAGE_BATCHES")
private String manageBatches;
@TableField("TRANSPORT_STOREY_BOARD_NUM")
private String transportStoreyBoardNum;
@TableField("TRANSPORT_BOX_STOREY_NUM")
private String transportBoxStoreyNum;
@TableField("TRANSPORT_BOX_BOARD_NUM")
private String transportBoxBoardNum;
@TableField("TRANSPORT_TEMPERATURE")
private String transportTemperature;
@TableField("TRANSPORT_TEMPERATURE_DOWN")
private String transportTemperatureDown;
@TableField("TRANSPORT_TEMPERATURE_UPPER")
private String transportTemperatureUpper;
@TableField("STORAGE_STOREY_BOARD_NUM")
private String storageStoreyBoardNum;
@TableField("STORAGE_BOX_STOREY_NUM")
private String storageBoxStoreyNum;
@TableField("STORAGE_BOX_BOARD_NUM")
private String storageBoxBoardNum;
@TableField("STORAGE_TEMPERATURE_DOWN")
private String storageTemperatureDown;
@TableField("STORAGE_TEMPERATURE")
private String storageTemperature;
@TableField("SALES_STATUS")
private String salesStatus;
@TableField("STORAGE_TEMPERATURE_UPPER")
private String storageTemperatureUpper;
@TableField("QUALITY_INSPECTION_RATIO")
private String qualityInspectionRatio;
@TableField("QUALITY_INSPECTION_FREQUENCY")
private String qualityInspectionFrequency;
@TableField("QUALITY_INSPECTION_REPORT")
private String qualityInspectionReport;
@TableField("QUALITY_INSPECTION_REPORT_START")
private Date qualityInspectionReportStart;
@TableField("QUALITY_INSPECTION_REPORT_END")
private Date qualityInspectionReportEnd;
@TableField("QUALITY_CONTROL")
private String qualityControl;
@TableField("QUALITY_INSPECTION_STANDARDS")
private String qualityInspectionStandards;
@TableField(value = "PROCESSED_FLAG" , updateStrategy = FieldStrategy.IGNORED)
private String processedFlag;
@TableField(value = "OUTSOURCED_FLAG" , updateStrategy = FieldStrategy.IGNORED)
private String outsourcedFlag;
@TableField("REMARK")
private String remark;
@TableField("RESERVED_FIELDS1")
private String reservedFields1;
@TableField("RESERVED_FIELDS2")
private String reservedFields2;
@TableField("RESERVED_FIELDS3")
private String reservedFields3;
@TableField("RESERVED_FIELDS4")
private String reservedFields4;
@TableField("RESERVED_FIELDS5")
private String reservedFields5;
@TableField("RESERVED_FIELDS6")
private String reservedFields6;
@TableField("F_CREATOR_TIME")
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("F_FLOW_ID")
private String flowId;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,25 @@
package jnpf.model.productwarehouse;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* productWarehouse
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
@Data
public class ProductBusinessModel {
/** 适配业务范围 **/
@JSONField(name = "businessLineId")
private Object businessLineId;
}

@ -0,0 +1,29 @@
package jnpf.model.productwarehouse;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* productWarehouse
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-01-31
*/
@Data
public class ProductUnitModel {
/** 单位名称 **/
@JSONField(name = "productUnitName")
private Object productUnitName;
/** 换算规则 **/
@JSONField(name = "conversionRules1")
private BigDecimal conversionRules1;
}

@ -0,0 +1,110 @@
package jnpf.model.productwarehouse;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* productWarehouse
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-31
*/
@Data
public class ProductWarehouseForm {
/** 主键 */
private String id;
/** 子表数据 **/
@JsonProperty("productUnitList")
private List<ProductUnitModel> productUnitList;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 流程id **/
@JsonProperty("flowId")
private String flowId;
/** 商品类型 **/
@JsonProperty("productTypeId")
private String productTypeId;
/** 商品图片 **/
@JsonProperty("photo")
private Object photo;
/** 商品编号 **/
@JsonProperty("code")
private String code;
/** 商品名称 **/
@JsonProperty("name")
private String name;
/** 商品简称 **/
@JsonProperty("shortName")
private String shortName;
/** 商品条码 **/
@JsonProperty("barCode")
private String barCode;
/** 商品规格 **/
@JsonProperty("spec")
private String spec;
/** 存货类型 **/
@JsonProperty("inventoryType")
private Object inventoryType;
/** 品牌 **/
@JsonProperty("brandId")
private String brandId;
/** 产地 **/
@JsonProperty("area")
private Object area;
/** 危险品 **/
@JsonProperty("dangerousFlag")
private Integer dangerousFlag;
/** 进口商品 **/
@JsonProperty("importedFlag")
private Integer importedFlag;
/** 加工商品 **/
@JsonProperty("processedFlag")
private Integer processedFlag;
/** 委外商品 **/
@JsonProperty("outsourcedFlag")
private Integer outsourcedFlag;
/** 首选供应商 **/
@JsonProperty("firstSupplierId")
private String firstSupplierId;
/** 销项税率 **/
@JsonProperty("outputTaxRate")
private Object outputTaxRate;
/** 进项税率 **/
@JsonProperty("inputTaxRate")
private Object inputTaxRate;
/** 配送方式 **/
@JsonProperty("deliveryType")
private String deliveryType;
/** 开售时间 **/
@JsonProperty("salesStart")
private String salesStart;
/** 停售时间 **/
@JsonProperty("salesEnd")
private String salesEnd;
/** 安全库存 **/
@JsonProperty("safetyStock")
private String safetyStock;
/** 可售库存 **/
@JsonProperty("availableInventory")
private String availableInventory;
/** 库存天数下限 **/
@JsonProperty("inventoryDayDown")
private String inventoryDayDown;
/** 库存天数上限 **/
@JsonProperty("inventoryDayUpper")
private String inventoryDayUpper;
/** 库存下限 **/
@JsonProperty("inventoryDown")
private String inventoryDown;
/** 库存上限 **/
@JsonProperty("inventoryUpper")
private String inventoryUpper;
/** 适配业务范围 **/
@JsonProperty("jnpf_jg_product_business_jnpf_businessLineId")
private Object jnpf_jg_product_business_jnpf_businessLineId;
}

@ -0,0 +1,42 @@
package jnpf.model.productwarehouse;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* productWarehouse
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-31
*/
@Data
public class ProductWarehousePagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 商品编号 */
@JsonProperty("code")
private Object code;
/** 商品名称 */
@JsonProperty("name")
private Object name;
/** 商品类型 */
@JsonProperty("productTypeId")
private Object productTypeId;
/** 存货类型 */
@JsonProperty("inventoryType")
private Object inventoryType;
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,611 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="商品编号">
<el-input v-model="query.code" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="商品名称">
<el-input v-model="query.name" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="商品类型">
<JnpfSelect v-model="query.productTypeId" placeholder="请选择" clearable
:options="productTypeIdOptions"
:props="productTypeIdProps" >
</JnpfSelect>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="存货类型">
<JnpfSelect v-model="query.inventoryType" placeholder="请选择" clearable
:options="inventoryTypeOptions"
:props="inventoryTypeProps" multiple >
</JnpfSelect>
</el-form-item>
</el-col>
</template>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
<el-button type="text" icon="el-icon-arrow-down" @click="showAll=true" v-if="!showAll">
展开
</el-button>
<el-button type="text" icon="el-icon-arrow-up" @click="showAll=false" v-else>
收起
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">
</el-button>
</div>
<div class="JNPF-common-head-right">
<el-tooltip content="高级查询" placement="top" v-if="true">
<el-link icon="icon-ym icon-ym-filter JNPF-common-head-icon" :underline="false"
@click="openSuperQuery()" />
</el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange'
:span-method="arraySpanMethod"
>
<el-table-column
prop="code"
label="商品编号" align="left"
>
</el-table-column>
<el-table-column
prop="name"
label="商品名称" align="left"
>
</el-table-column>
<el-table-column
prop="productTypeId"
label="商品类型" align="left"
>
</el-table-column>
<el-table-column
prop="shortName"
label="商品简称" align="left"
>
</el-table-column>
<el-table-column
prop="spec"
label="商品规格" align="left"
>
</el-table-column>
<el-table-column
prop="barCode"
label="商品条码" align="left"
>
</el-table-column>
<el-table-column
prop="inventoryType"
label="存货类型" align="left"
>
</el-table-column>
<el-table-column
prop="brandId"
label="品牌" align="left"
>
</el-table-column>
<el-table-column prop="flowState" label="状态" width="100" >
<template slot-scope="scope" v-if="!scope.row.top">
<el-tag v-if="scope.row.flowState==1"></el-tag>
<el-tag type="success" v-else-if="scope.row.flowState==2">审核通过</el-tag>
<el-tag type="danger" v-else-if="scope.row.flowState==3">审核驳回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState==4">流程撤回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState==5">审核终止</el-tag>
<el-tag type="warning" v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="操作"
fixed="right" width="150" >
<template slot-scope="scope" >
<el-button type="text" :disabled="[1,2,4,5].indexOf(scope.row.flowState)>-1"
@click="updateHandle(scope.row)" >编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" :disabled="[1,2,3,5].indexOf(scope.row.flowState)>-1" @click="handleDel(scope.row.id)">
</el-button>
<el-button size="mini" type="text" :disabled="!scope.row.flowState"
@click="updateHandle(scope.row,scope.row.flowState)"
>详情</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
</div>
</div>
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
<FlowBox v-if="flowVisible" ref="FlowBox" @close="colseFlow" />
<el-dialog title="请选择流程" :close-on-click-modal="false" append-to-body
:visible.sync="flowListVisible" class="JNPF-dialog template-dialog JNPF-dialog_center"
lock-scroll width="400px">
<el-scrollbar class="template-list">
<div class="template-item" v-for="item in flowList" :key="item.id"
@click="selectFlow(item)">{{item.fullName}}
</div>
</el-scrollbar>
</el-dialog>
<ImportBox v-if="uploadBoxVisible" ref="UploadBox" @refresh="initData" />
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false"/>
<ToFormDetail v-if="toFormDetailVisible" ref="toFormDetail" @close="toFormDetailVisible = false" />
<SuperQuery v-if="superQueryVisible" ref="SuperQuery" :columnOptions="superQueryJson"
@superQuery="superQuery" />
</div>
</template>
<script>
import request from '@/utils/request'
import {mapGetters} from "vuex";
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'
import { getFormById } from '@/api/workFlow/FormDesign'
import { getFlowList } from '@/api/workFlow/FlowEngine'
import FlowBox from '@/views/workFlow/components/FlowBox'
import ExportBox from '@/components/ExportBox'
import ToFormDetail from '@/views/basic/dynamicModel/list/detail'
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
import { getConfigData } from '@/api/onlineDev/visualDev'
import { getDefaultCurrentValueUserIdAsync } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentIdAsync } from '@/api/permission/organize'
import columnList from './columnList'
import { thousandsFormat } from "@/components/Generator/utils/index"
import SuperQuery from '@/components/SuperQuery'
import superQueryJson from './superQueryJson'
export default {
components: {
FlowBox,
ExportBox,ToFormDetail , SuperQuery
},
data() {
return {
keyword:'',
expandsTree: true,
refreshTree: true,
toFormDetailVisible:false,
expandObj:{},
columnOptions: [],
mergeList: [],
exportList:[],
columnList,
showAll: false,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
code:undefined,
name:undefined,
productTypeId:undefined,
inventoryType:undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
productTypeIdOptions:[],
productTypeIdProps:{"label":"fullName","value":"enCode" },
inventoryTypeOptions:[],
inventoryTypeProps:{"label":"fullName","value":"enCode" },
outputTaxRateOptions:[],
outputTaxRateProps:{"label":"fullName","value":"enCode" },
inputTaxRateOptions:[],
inputTaxRateProps:{"label":"fullName","value":"enCode" },
deliveryTypeOptions:[],
deliveryTypeProps:{"label":"fullName","value":"enCode" },
jnpf_jg_product_business_jnpf_businessLineIdOptions:[],
jnpf_jg_product_business_jnpf_businessLineIdProps:{"label":"name","value":"id" },
tableField141_productUnitNameOptions:[],
tableField141_productUnitNameProps:{"label":"fullName","value":"id" },
interfaceRes: {
brandId:[] ,
firstSupplierId:[] ,
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
getFormById("518014334211720453").then(res1 => {
let flowId = res1.data&&res1.data.id
getFlowList(flowId,'1').then(res2 => {
this.flowList = res2.data
this.getColumnList(),
this.initSearchDataAndListData()
this.getproductTypeIdOptions();
this.getinventoryTypeOptions();
this.queryData = JSON.parse(JSON.stringify(this.query))
}).catch((e) => {
this.$message({ type: 'error', message: e.message });
this.$router.push('/404');
})
})
},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.toFormDetailVisible = true
this.$nextTick(() => {
this.$refs.toFormDetail.init(formData, modelId, defaultValue)
})
})
},
toggleTreeExpand(expands) {
this.refreshTree = false
this.expandsTree = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(null)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data[this.treeProps.label].indexOf(value) !== -1;
},
loadNode(node, resolve) {
const nodeData = node.data
const config ={
treeInterfaceId:"",
treeTemplateJson:[]
}
if (config.treeInterfaceId) {
//
if (config.treeTemplateJson && config.treeTemplateJson.length) {
for (let i = 0; i < config.treeTemplateJson.length; i++) {
const element = config.treeTemplateJson[i];
element.defaultValue = nodeData[element.relationField] || ''
}
}
//
let query = {
paramList: config.treeTemplateJson || [],
}
//
getDataInterfaceRes(config.treeInterfaceId, query).then(res => {
let data = res.data
if (Array.isArray(data)) {
resolve(data);
} else {
resolve([]);
}
})
}
},
getColumnList() {
//
this.columnOptions = this.transformColumnList(this.columnList)
},
transformColumnList(columnList) {
let list = []
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e)
} else {
let prop = e.prop.split('-')[0]
let label = e.label.split('-')[0]
let vModel = e.prop.split('-')[1]
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
e.vModel = vModel
if (!this.expandObj.hasOwnProperty(`${prop}Expand`)) this.$set(this.expandObj, `${prop}Expand`, false)
if (!list.some(o => o.prop === prop)) list.push(newItem)
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e)
break
}
}
}
}
this.getMergeList(list)
this.getExportList(list)
return list
},
arraySpanMethod({ column }) {
for (let i = 0; i < this.mergeList.length; i++) {
if (column.property == this.mergeList[i].prop) {
return [this.mergeList[i].rowspan, this.mergeList[i].colspan]
}
}
},
getMergeList(list) {
let newList = JSON.parse(JSON.stringify(list))
newList.forEach(item => {
if (item.children && item.children.length) {
let child = {
prop: item.prop + '-child-first'
}
item.children.unshift(child)
}
})
newList.forEach(item => {
if (item.children && item.children.length ) {
item.children.forEach((child, index) => {
if (index == 0) {
this.mergeList.push({
prop: child.prop,
rowspan: 1,
colspan: item.children.length
})
} else {
this.mergeList.push({
prop: child.prop,
rowspan: 0,
colspan: 0
})
}
})
} else {
this.mergeList.push({
prop: item.prop,
rowspan: 1,
colspan: 1
})
}
})
},
getExportList(list) {
let exportList = []
for (let i = 0; i < list.length; i++) {
if (list[i].jnpfKey === 'table') {
for (let j = 0; j < list[i].children.length; j++) {
exportList.push(list[i].children[j])
}
} else {
exportList.push(list[i])
}
}
this.exportList = exportList
},
getproductTypeIdOptions() {
getDictionaryDataSelector('521699870097015173').then(res => {
this.productTypeIdOptions = res.data.list
})
},
getinventoryTypeOptions() {
getDictionaryDataSelector('521705509590401413').then(res => {
this.inventoryTypeOptions = res.data.list
})
},
goDetail(id){
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(id)
})
},
sortChange({column, prop, order}) {
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
this.listQuery.sidx = !order ? '' : prop
this.initData()
},
async initSearchDataAndListData() {
await this.initSearchData()
this.initData()
},
//
async initSearchData() {
},
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId:this.menuId,
moduleId:'518014334211720453',
type:1,
};
request({
url: `/api/scm/ProductWarehouse/getList`,
method: 'post',
data: _query
}).then(res => {
var _list =res.data.list;
this.list = _list.map(o => ({
...o,
...this.expandObj,
}))
this.total = res.data.pagination.total
this.listLoading = false
})
},
handleDel(id) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/ProductWarehouse/${id}`,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
});
})
}).catch(() => {
});
},
handelUpload(){
this.uploadBoxVisible = true
this.$nextTick(() => {
this.$refs.UploadBox.init("","scm/ProductWarehouse")
})
},
openSuperQuery() {
this.superQueryVisible = true
this.$nextTick(() => {
this.$refs.SuperQuery.init()
})
},
superQuery(queryJson) {
this.listQuery.superQueryJson = queryJson
this.listQuery.currentPage = 1
this.initData()
},
addOrUpdateHandle(row,flowState) {
if(!row){
this.addHandle();
}else {
this.updateHandle(row,flowState)
}
},
exportData() {
this.exportBoxVisible = true
this.$nextTick(() => {
this.$refs.ExportBox.init(this.exportList)
})
},
download(data) {
let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId}
request({
url: `/api/scm/ProductWarehouse/Actions/Export`,
method: 'post',
data: query
}).then(res => {
if (!res.data.url) return
this.jnpf.downloadFile(res.data.url)
this.$refs.ExportBox.visible = false
this.exportBoxVisible = false
})
},
search() {
this.listQuery.currentPage=1
this.listQuery.pageSize=20
this.listQuery.sort="desc"
this.listQuery.sidx=""
this.initData()
},
//
updateHandle(row,flowState) {
let data = {
id: row.id,
flowId: row.flowId || this.flowList[0].id,
opType: flowState ? 0 : '-1',
status: flowState
}
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
toApprovalDetail(row) {
let data = {
id: row.id,
flowId: row.flowId,
opType: 0,
status: row.currentState
}
this.formVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
addHandle() {
if (!this.flowList.length) {
this.$message({ type: 'error', message: '流程不存在' });
} else if (this.flowList.length === 1) {
this.selectFlow(this.flowList[0])
} else {
this.flowListVisible = true
}
},
//
selectFlow(item) {
let data = {
id: '',
formType: 1,
flowId: item.id,
opType: '-1'
}
this.flowListVisible = false
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
refresh(isrRefresh) {
this.formVisible = false
if (isrRefresh) this.reset()
},
reset() {
this.query = JSON.parse(JSON.stringify(this.queryData))
this.search()
},
colseFlow(isrRefresh) {
this.flowVisible = false
if (isrRefresh) this.reset()
},
}
}
</script>

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