feat():生成采购单;

master
jiyufei 2 months ago
parent 65a8aae997
commit 8373c1c223

@ -2,7 +2,10 @@ package jnpf.service;
import jnpf.model.yysmaterialprocurementplan.*; import jnpf.model.yysmaterialprocurementplan.*;
import jnpf.entity.*; import jnpf.entity.*;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -14,13 +17,23 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
* 2024-08-08 * 2024-08-08
*/ */
public interface YysMaterialProcurementItemService extends IService<YysMaterialProcurementItemEntity> { public interface YysMaterialProcurementItemService extends IService<YysMaterialProcurementItemEntity> {
QueryWrapper<YysMaterialProcurementItemEntity> getChild(YysMaterialProcurementPlanPagination pagination,QueryWrapper<YysMaterialProcurementItemEntity> yysMaterialProcurementItemQueryWrapper); QueryWrapper<YysMaterialProcurementItemEntity> getChild(YysMaterialProcurementPlanPagination pagination, QueryWrapper<YysMaterialProcurementItemEntity> yysMaterialProcurementItemQueryWrapper);
/** /**
* *
*
* @param id * @param id
* @param list * @param list
* @return * @return
*/ */
String initPlan(String id, List<YysMaterialRequirementItemEntity> list); String initPlan(String id, List<YysMaterialRequirementItemEntity> list);
/**
*
*
* @param materialId
* @param join
* @param nums
*/
void syncNums(String materialId, String join, BigDecimal nums);
} }

@ -32,4 +32,10 @@ public interface YysMaterialProcurementOrderService extends IService<YysMaterial
void saveOrUpdate(YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm,String id, boolean isSave) throws Exception; void saveOrUpdate(YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm,String id, boolean isSave) throws Exception;
/**
*
* @param form
* @return
*/
String initOrder(YysMaterialProcurementOrderForm form);
} }

@ -43,4 +43,6 @@ public interface YysMaterialProcurementPlanService extends IService<YysMaterialP
* @return * @return
*/ */
String initPlan(YysMaterialRequirementPlanEntity plan, List<YysMaterialRequirementItemEntity> list); String initPlan(YysMaterialRequirementPlanEntity plan, List<YysMaterialRequirementItemEntity> list);
void commit(YysMaterialProcurementPlanForm yysMaterialProcurementPlanForm,String id, boolean isSave) throws Exception;
} }

@ -84,9 +84,20 @@ public class YysMaterialProcurementItemServiceImpl extends ServiceImpl<YysMateri
lists.add(procurementItem); lists.add(procurementItem);
} }
boolean result = this.saveBatch(lists); boolean result = this.saveBatch(lists);
if (result){ if (result) {
return "生成成功"; return "生成成功";
} }
return "生成失败"; return "生成失败";
} }
@Override
public void syncNums(String materialId, String join, BigDecimal nums) {
YysMaterialProcurementItemEntity entity = this.getById(materialId);
if (ObjectUtil.isNull(entity)) {
return;
}
entity.setOrderQuantity(nums);
entity.setOrderNos(join);
this.updateById(entity);
}
} }

@ -1,23 +1,38 @@
package jnpf.service.impl; package jnpf.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.google.common.collect.Lists;
import jnpf.entity.*; import jnpf.entity.*;
import jnpf.mapper.YysMaterialProcurementOrderMapper; import jnpf.mapper.YysMaterialProcurementOrderMapper;
import jnpf.service.*; import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysmaterialprocurementorder.*; import jnpf.model.yysmaterialprocurementorder.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel; import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil; import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel; import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel; import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel; import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import jnpf.model.QueryModel; import jnpf.model.QueryModel;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel; import jnpf.base.model.ColumnDataModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel; import jnpf.database.model.superQuery.SuperJsonModel;
@ -25,13 +40,20 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import jnpf.util.*; import jnpf.util.*;
import java.util.*; import java.util.*;
import jnpf.base.UserInfo; import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity; import jnpf.permission.entity.UserEntity;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
/** /**
*
* YysMaterialProcurementOrder * YysMaterialProcurementOrder
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
@ -39,293 +61,342 @@ import jnpf.permission.entity.UserEntity;
* 2024-08-08 * 2024-08-08
*/ */
@Service @Service
public class YysMaterialProcurementOrderServiceImpl extends ServiceImpl<YysMaterialProcurementOrderMapper, YysMaterialProcurementOrderEntity> implements YysMaterialProcurementOrderService{ @Slf4j
public class YysMaterialProcurementOrderServiceImpl extends ServiceImpl<YysMaterialProcurementOrderMapper, YysMaterialProcurementOrderEntity> implements YysMaterialProcurementOrderService {
@Autowired @Autowired
private GeneraterSwapUtil generaterSwapUtil; private GeneraterSwapUtil generaterSwapUtil;
@Autowired @Autowired
private UserProvider userProvider; private UserProvider userProvider;
@Resource
private YysMaterialProcurementItemService yysMaterialProcurementItemService;
@Override @Override
public List<YysMaterialProcurementOrderEntity> getList(YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination){ public List<YysMaterialProcurementOrderEntity> getList(YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination) {
return getTypeList(yysMaterialProcurementOrderPagination,yysMaterialProcurementOrderPagination.getDataType()); return getTypeList(yysMaterialProcurementOrderPagination, yysMaterialProcurementOrderPagination.getDataType());
} }
/** 列表查询 */
/**
*
*/
@Override @Override
public List<YysMaterialProcurementOrderEntity> getTypeList(YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination,String dataType){ public List<YysMaterialProcurementOrderEntity> getTypeList(YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination, String dataType) {
String userId=userProvider.get().getUserId(); String userId = userProvider.get().getUserId();
List<String> AllIdList =new ArrayList(); List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList =new ArrayList<>(); List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc"); boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? YysMaterialProcurementOrderConstant.getAppColumnData() : YysMaterialProcurementOrderConstant.getColumnData(); String columnData = !isPc ? YysMaterialProcurementOrderConstant.getAppColumnData() : YysMaterialProcurementOrderConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class); ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList()); String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0; int total = 0;
int yysMaterialProcurementOrderNum =0; int yysMaterialProcurementOrderNum = 0;
QueryWrapper<YysMaterialProcurementOrderEntity> yysMaterialProcurementOrderQueryWrapper=new QueryWrapper<>(); QueryWrapper<YysMaterialProcurementOrderEntity> yysMaterialProcurementOrderQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>(); List<String> allSuperIDlist = new ArrayList<>();
String superOp =""; String superOp = "";
if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getSuperQueryJson())){ if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>(); List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>(); List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = yysMaterialProcurementOrderPagination.getSuperQueryJson(); String queryJson = yysMaterialProcurementOrderPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class); SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0; int superNum = 0;
QueryWrapper<YysMaterialProcurementOrderEntity> yysMaterialProcurementOrderSuperWrapper = new QueryWrapper<>(); QueryWrapper<YysMaterialProcurementOrderEntity> yysMaterialProcurementOrderSuperWrapper = new QueryWrapper<>();
yysMaterialProcurementOrderSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysMaterialProcurementOrderSuperWrapper,YysMaterialProcurementOrderEntity.class,queryJson,"0")); yysMaterialProcurementOrderSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysMaterialProcurementOrderSuperWrapper, YysMaterialProcurementOrderEntity.class, queryJson, "0"));
int yysMaterialProcurementOrderNum1 = yysMaterialProcurementOrderSuperWrapper.getExpression().getNormal().size(); int yysMaterialProcurementOrderNum1 = yysMaterialProcurementOrderSuperWrapper.getExpression().getNormal().size();
if (yysMaterialProcurementOrderNum1>0){ if (yysMaterialProcurementOrderNum1 > 0) {
List<String> yysMaterialProcurementOrderList =this.list(yysMaterialProcurementOrderSuperWrapper).stream().map(YysMaterialProcurementOrderEntity::getId).collect(Collectors.toList()); List<String> yysMaterialProcurementOrderList = this.list(yysMaterialProcurementOrderSuperWrapper).stream().map(YysMaterialProcurementOrderEntity::getId).collect(Collectors.toList());
allSuperList.addAll(yysMaterialProcurementOrderList); allSuperList.addAll(yysMaterialProcurementOrderList);
intersectionSuperList.add(yysMaterialProcurementOrderList); intersectionSuperList.add(yysMaterialProcurementOrderList);
superNum++; superNum++;
} }
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : ""; superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or //and or
if(superOp.equalsIgnoreCase("and")){ if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList); allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{ } else {
allSuperIDlist = allSuperList; allSuperIDlist = allSuperList;
} }
} }
List<String> allRuleIDlist = new ArrayList<>(); List<String> allRuleIDlist = new ArrayList<>();
String ruleOp =""; String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)){ if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>(); List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>(); List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class); SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0; int ruleNum = 0;
QueryWrapper<YysMaterialProcurementOrderEntity> yysMaterialProcurementOrderSuperWrapper = new QueryWrapper<>(); QueryWrapper<YysMaterialProcurementOrderEntity> yysMaterialProcurementOrderSuperWrapper = new QueryWrapper<>();
yysMaterialProcurementOrderSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysMaterialProcurementOrderSuperWrapper,YysMaterialProcurementOrderEntity.class,ruleJson,"0")); yysMaterialProcurementOrderSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(yysMaterialProcurementOrderSuperWrapper, YysMaterialProcurementOrderEntity.class, ruleJson, "0"));
int yysMaterialProcurementOrderNum1 = yysMaterialProcurementOrderSuperWrapper.getExpression().getNormal().size(); int yysMaterialProcurementOrderNum1 = yysMaterialProcurementOrderSuperWrapper.getExpression().getNormal().size();
if (yysMaterialProcurementOrderNum1>0){ if (yysMaterialProcurementOrderNum1 > 0) {
List<String> yysMaterialProcurementOrderList =this.list(yysMaterialProcurementOrderSuperWrapper).stream().map(YysMaterialProcurementOrderEntity::getId).collect(Collectors.toList()); List<String> yysMaterialProcurementOrderList = this.list(yysMaterialProcurementOrderSuperWrapper).stream().map(YysMaterialProcurementOrderEntity::getId).collect(Collectors.toList());
allRuleList.addAll(yysMaterialProcurementOrderList); allRuleList.addAll(yysMaterialProcurementOrderList);
intersectionRuleList.add(yysMaterialProcurementOrderList); intersectionRuleList.add(yysMaterialProcurementOrderList);
ruleNum++; ruleNum++;
} }
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : ""; ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or //and or
if(ruleOp.equalsIgnoreCase("and")){ if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList); allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{ } else {
allRuleIDlist = allRuleList; allRuleIDlist = allRuleList;
} }
} }
boolean pcPermission = true; boolean pcPermission = true;
boolean appPermission = false; boolean appPermission = false;
if(isPc && pcPermission){ if (isPc && pcPermission) {
if (!userProvider.get().getIsAdministrator()){ if (!userProvider.get().getIsAdministrator()) {
Object yysMaterialProcurementOrderObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysMaterialProcurementOrderQueryWrapper,YysMaterialProcurementOrderEntity.class,yysMaterialProcurementOrderPagination.getMenuId(),"0")); Object yysMaterialProcurementOrderObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysMaterialProcurementOrderQueryWrapper, YysMaterialProcurementOrderEntity.class, yysMaterialProcurementOrderPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(yysMaterialProcurementOrderObj)){ if (ObjectUtil.isEmpty(yysMaterialProcurementOrderObj)) {
return new ArrayList<>(); return new ArrayList<>();
} else { } else {
yysMaterialProcurementOrderQueryWrapper = (QueryWrapper<YysMaterialProcurementOrderEntity>)yysMaterialProcurementOrderObj; yysMaterialProcurementOrderQueryWrapper = (QueryWrapper<YysMaterialProcurementOrderEntity>) yysMaterialProcurementOrderObj;
if( yysMaterialProcurementOrderQueryWrapper.getExpression().getNormal().size()>0){ if (yysMaterialProcurementOrderQueryWrapper.getExpression().getNormal().size() > 0) {
yysMaterialProcurementOrderNum++; yysMaterialProcurementOrderNum++;
} }
} }
} }
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object yysMaterialProcurementOrderObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysMaterialProcurementOrderQueryWrapper,YysMaterialProcurementOrderEntity.class,yysMaterialProcurementOrderPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(yysMaterialProcurementOrderObj)){
return new ArrayList<>();
} else {
yysMaterialProcurementOrderQueryWrapper = (QueryWrapper<YysMaterialProcurementOrderEntity>)yysMaterialProcurementOrderObj;
if( yysMaterialProcurementOrderQueryWrapper.getExpression().getNormal().size()>0){
yysMaterialProcurementOrderNum++;
}
} }
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object yysMaterialProcurementOrderObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(yysMaterialProcurementOrderQueryWrapper, YysMaterialProcurementOrderEntity.class, yysMaterialProcurementOrderPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(yysMaterialProcurementOrderObj)) {
return new ArrayList<>();
} else {
yysMaterialProcurementOrderQueryWrapper = (QueryWrapper<YysMaterialProcurementOrderEntity>) yysMaterialProcurementOrderObj;
if (yysMaterialProcurementOrderQueryWrapper.getExpression().getNormal().size() > 0) {
yysMaterialProcurementOrderNum++;
}
}
} }
} }
if(isPc){ if (isPc) {
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getOrderNumber())){ if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getOrderNumber())) {
yysMaterialProcurementOrderNum++; yysMaterialProcurementOrderNum++;
String value = yysMaterialProcurementOrderPagination.getOrderNumber() instanceof List ? String value = yysMaterialProcurementOrderPagination.getOrderNumber() instanceof List ?
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getOrderNumber()) : JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getOrderNumber()) :
String.valueOf(yysMaterialProcurementOrderPagination.getOrderNumber()); String.valueOf(yysMaterialProcurementOrderPagination.getOrderNumber());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getOrderNumber,value); yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getOrderNumber, value);
} }
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getProcurementNumber())){ if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getProcurementNumber())) {
yysMaterialProcurementOrderNum++; yysMaterialProcurementOrderNum++;
String value = yysMaterialProcurementOrderPagination.getProcurementNumber() instanceof List ? String value = yysMaterialProcurementOrderPagination.getProcurementNumber() instanceof List ?
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getProcurementNumber()) : JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getProcurementNumber()) :
String.valueOf(yysMaterialProcurementOrderPagination.getProcurementNumber()); String.valueOf(yysMaterialProcurementOrderPagination.getProcurementNumber());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getProcurementNumber,value); yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getProcurementNumber, value);
} }
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getMaterialName())){ if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getMaterialName())) {
yysMaterialProcurementOrderNum++; yysMaterialProcurementOrderNum++;
String value = yysMaterialProcurementOrderPagination.getMaterialName() instanceof List ? String value = yysMaterialProcurementOrderPagination.getMaterialName() instanceof List ?
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getMaterialName()) : JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getMaterialName()) :
String.valueOf(yysMaterialProcurementOrderPagination.getMaterialName()); String.valueOf(yysMaterialProcurementOrderPagination.getMaterialName());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getMaterialName,value); yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getMaterialName, value);
} }
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getSupplier())){ if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getSupplier())) {
yysMaterialProcurementOrderNum++; yysMaterialProcurementOrderNum++;
String value = yysMaterialProcurementOrderPagination.getSupplier() instanceof List ? String value = yysMaterialProcurementOrderPagination.getSupplier() instanceof List ?
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getSupplier()) : JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getSupplier()) :
String.valueOf(yysMaterialProcurementOrderPagination.getSupplier()); String.valueOf(yysMaterialProcurementOrderPagination.getSupplier());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getSupplier,value); yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getSupplier, value);
} }
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getOrderStatus())){ if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getOrderStatus())) {
yysMaterialProcurementOrderNum++; yysMaterialProcurementOrderNum++;
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
try { try {
String[][] orderStatus = JsonUtil.getJsonToBean(yysMaterialProcurementOrderPagination.getOrderStatus(),String[][].class); String[][] orderStatus = JsonUtil.getJsonToBean(yysMaterialProcurementOrderPagination.getOrderStatus(), String[][].class);
for(int i=0;i<orderStatus.length;i++){ for (int i = 0; i < orderStatus.length; i++) {
if(orderStatus[i].length>0){ if (orderStatus[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(orderStatus[i]))); idList.add(JsonUtil.getObjectToString(Arrays.asList(orderStatus[i])));
} }
} }
}catch (Exception e1){ } catch (Exception e1) {
try { try {
List<String> orderStatus = JsonUtil.getJsonToList(yysMaterialProcurementOrderPagination.getOrderStatus(),String.class); List<String> orderStatus = JsonUtil.getJsonToList(yysMaterialProcurementOrderPagination.getOrderStatus(), String.class);
if(orderStatus.size()>0){ if (orderStatus.size() > 0) {
idList.addAll(orderStatus); idList.addAll(orderStatus);
} }
}catch (Exception e2){ } catch (Exception e2) {
idList.add(String.valueOf(yysMaterialProcurementOrderPagination.getOrderStatus())); idList.add(String.valueOf(yysMaterialProcurementOrderPagination.getOrderStatus()));
} }
} }
yysMaterialProcurementOrderQueryWrapper.lambda().and(t->{ yysMaterialProcurementOrderQueryWrapper.lambda().and(t -> {
idList.forEach(tt->{ idList.forEach(tt -> {
t.like(YysMaterialProcurementOrderEntity::getOrderStatus, tt).or(); t.like(YysMaterialProcurementOrderEntity::getOrderStatus, tt).or();
}); });
}); });
} }
} }
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList); List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){ if (total > 0) {
if (intersection.size()==0){ if (intersection.size() == 0) {
intersection.add("jnpfNullList"); intersection.add("jnpfNullList");
} }
yysMaterialProcurementOrderQueryWrapper.lambda().in(YysMaterialProcurementOrderEntity::getId, intersection); yysMaterialProcurementOrderQueryWrapper.lambda().in(YysMaterialProcurementOrderEntity::getId, intersection);
} }
//是否有高级查询 //是否有高级查询
if (StringUtil.isNotEmpty(superOp)){ if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size()==0){ if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList"); allSuperIDlist.add("jnpfNullList");
} }
List<String> finalAllSuperIDlist = allSuperIDlist; List<String> finalAllSuperIDlist = allSuperIDlist;
yysMaterialProcurementOrderQueryWrapper.lambda().and(t->t.in(YysMaterialProcurementOrderEntity::getId, finalAllSuperIDlist)); yysMaterialProcurementOrderQueryWrapper.lambda().and(t -> t.in(YysMaterialProcurementOrderEntity::getId, finalAllSuperIDlist));
} }
//是否有数据过滤查询 //是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){ if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size()==0){ if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList"); allRuleIDlist.add("jnpfNullList");
} }
List<String> finalAllRuleIDlist = allRuleIDlist; List<String> finalAllRuleIDlist = allRuleIDlist;
yysMaterialProcurementOrderQueryWrapper.lambda().and(t->t.in(YysMaterialProcurementOrderEntity::getId, finalAllRuleIDlist)); yysMaterialProcurementOrderQueryWrapper.lambda().and(t -> t.in(YysMaterialProcurementOrderEntity::getId, finalAllRuleIDlist));
} }
//假删除标志 //假删除标志
yysMaterialProcurementOrderQueryWrapper.lambda().isNull(YysMaterialProcurementOrderEntity::getDeleteMark); yysMaterialProcurementOrderQueryWrapper.lambda().isNull(YysMaterialProcurementOrderEntity::getDeleteMark);
//排序 //排序
if(StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSidx())){ if (StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSidx())) {
yysMaterialProcurementOrderQueryWrapper.lambda().orderByDesc(YysMaterialProcurementOrderEntity::getId); yysMaterialProcurementOrderQueryWrapper.lambda().orderByDesc(YysMaterialProcurementOrderEntity::getId);
}else{ } else {
try { try {
String sidx = yysMaterialProcurementOrderPagination.getSidx(); String sidx = yysMaterialProcurementOrderPagination.getSidx();
String[] strs= sidx.split("_name"); String[] strs = sidx.split("_name");
YysMaterialProcurementOrderEntity yysMaterialProcurementOrderEntity = new YysMaterialProcurementOrderEntity(); YysMaterialProcurementOrderEntity yysMaterialProcurementOrderEntity = new YysMaterialProcurementOrderEntity();
Field declaredField = yysMaterialProcurementOrderEntity.getClass().getDeclaredField(strs[0]); Field declaredField = yysMaterialProcurementOrderEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true); declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value(); String value = declaredField.getAnnotation(TableField.class).value();
yysMaterialProcurementOrderQueryWrapper="asc".equals(yysMaterialProcurementOrderPagination.getSort().toLowerCase())?yysMaterialProcurementOrderQueryWrapper.orderByAsc(value):yysMaterialProcurementOrderQueryWrapper.orderByDesc(value); yysMaterialProcurementOrderQueryWrapper = "asc".equals(yysMaterialProcurementOrderPagination.getSort().toLowerCase()) ? yysMaterialProcurementOrderQueryWrapper.orderByAsc(value) : yysMaterialProcurementOrderQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
if("0".equals(dataType)){ if ("0".equals(dataType)) {
if((total>0 && AllIdList.size()>0) || total==0){ if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<YysMaterialProcurementOrderEntity> page=new Page<>(yysMaterialProcurementOrderPagination.getCurrentPage(), yysMaterialProcurementOrderPagination.getPageSize()); Page<YysMaterialProcurementOrderEntity> page = new Page<>(yysMaterialProcurementOrderPagination.getCurrentPage(), yysMaterialProcurementOrderPagination.getPageSize());
IPage<YysMaterialProcurementOrderEntity> userIPage=this.page(page, yysMaterialProcurementOrderQueryWrapper); IPage<YysMaterialProcurementOrderEntity> userIPage = this.page(page, yysMaterialProcurementOrderQueryWrapper);
return yysMaterialProcurementOrderPagination.setData(userIPage.getRecords(),userIPage.getTotal()); return yysMaterialProcurementOrderPagination.setData(userIPage.getRecords(), userIPage.getTotal());
}else{ } else {
List<YysMaterialProcurementOrderEntity> list = new ArrayList(); List<YysMaterialProcurementOrderEntity> list = new ArrayList();
return yysMaterialProcurementOrderPagination.setData(list, list.size()); return yysMaterialProcurementOrderPagination.setData(list, list.size());
} }
}else{ } else {
return this.list(yysMaterialProcurementOrderQueryWrapper); return this.list(yysMaterialProcurementOrderQueryWrapper);
} }
} }
@Override @Override
public YysMaterialProcurementOrderEntity getInfo(String id){ public YysMaterialProcurementOrderEntity getInfo(String id) {
QueryWrapper<YysMaterialProcurementOrderEntity> queryWrapper=new QueryWrapper<>(); QueryWrapper<YysMaterialProcurementOrderEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(YysMaterialProcurementOrderEntity::getId,id); queryWrapper.lambda().eq(YysMaterialProcurementOrderEntity::getId, id);
return this.getOne(queryWrapper); return this.getOne(queryWrapper);
} }
@Override @Override
public void create(YysMaterialProcurementOrderEntity entity){ public void create(YysMaterialProcurementOrderEntity entity) {
this.save(entity); this.save(entity);
} }
@Override @Override
public boolean update(String id, YysMaterialProcurementOrderEntity entity){ public boolean update(String id, YysMaterialProcurementOrderEntity entity) {
return this.updateById(entity); return this.updateById(entity);
} }
@Override @Override
public void delete(YysMaterialProcurementOrderEntity entity){ public void delete(YysMaterialProcurementOrderEntity entity) {
if(entity!=null){ if (entity != null) {
this.removeById(entity.getId()); this.removeById(entity.getId());
} }
} }
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override @Override
public String checkForm(YysMaterialProcurementOrderForm form,int i) { public String checkForm(YysMaterialProcurementOrderForm form, int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0"); boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id=""; String id = "";
String countRecover = ""; String countRecover = "";
if (isUp){ if (isUp) {
id = form.getId(); id = form.getId();
} }
//主表字段验证 //主表字段验证
if(StringUtil.isEmpty(form.getSupplier())){ if (StringUtil.isEmpty(form.getSupplier())) {
return "供应商不能为空"; return "供应商不能为空";
} }
return countRecover; return countRecover;
} }
/** /**
* () * ()
* @param id *
* @param yysMaterialProcurementOrderForm * @param id
* @return * @param yysMaterialProcurementOrderForm
*/ * @return
*/
@Override @Override
@Transactional @Transactional
public void saveOrUpdate(YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm,String id, boolean isSave) throws Exception{ public void saveOrUpdate(YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm, String id, boolean isSave) throws Exception {
UserInfo userInfo=userProvider.get(); UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId()); UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysMaterialProcurementOrderForm = JsonUtil.getJsonToBean( yysMaterialProcurementOrderForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysMaterialProcurementOrderConstant.getFormData(),yysMaterialProcurementOrderForm),YysMaterialProcurementOrderForm.class); generaterSwapUtil.swapDatetime(YysMaterialProcurementOrderConstant.getFormData(), yysMaterialProcurementOrderForm), YysMaterialProcurementOrderForm.class);
YysMaterialProcurementOrderEntity entity = JsonUtil.getJsonToBean(yysMaterialProcurementOrderForm, YysMaterialProcurementOrderEntity.class); YysMaterialProcurementOrderEntity entity = JsonUtil.getJsonToBean(yysMaterialProcurementOrderForm, YysMaterialProcurementOrderEntity.class);
if(isSave){ if (isSave) {
String mainId = RandomUtil.uuId() ; String mainId = RandomUtil.uuId();
entity.setId(mainId); entity.setId(mainId);
}else{ } else {
} }
this.saveOrUpdate(entity); this.saveOrUpdate(entity);
} }
@Override
public String initOrder(YysMaterialProcurementOrderForm form) {
log.info("生成采购订单form{}", form);
if (CollectionUtils.isEmpty(form.getOrderData())) {
return "采购单信息为空";
}
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
List<YysMaterialProcurementOrderEntity> collect = form.getOrderData().stream().map(obj -> {
YysMaterialProcurementOrderEntity entity = BeanUtil.copyProperties(obj, YysMaterialProcurementOrderEntity.class);
String mainId = RandomUtil.uuId();
int index = 1;
String number = String.format("%03d" + "d", index);
entity.setId(mainId);
entity.setOrderNumber("PO" + currentDate + number);
entity.setCreatorTime(DateUtil.getNowDate());
entity.setCreatorUserId(userProvider.get().getUserId());
index++;
return entity;
}).collect(Collectors.toList());
boolean result = this.saveBatch(collect);
if (result) {
//需要更新采购物料表中的总下单数量以及单号
List<String> orders = collect.stream().map(YysMaterialProcurementOrderEntity::getOrderNumber).collect(Collectors.toList());
BigDecimal nums = collect.stream()
.map(YysMaterialProcurementOrderEntity::getOrderQuantity)
.reduce(BigDecimal.ZERO, BigDecimal::add);
String materialId = collect.get(0).getMaterialId();
CompletableFuture.runAsync(() -> yysMaterialProcurementItemService.syncNums(materialId, String.join(",", orders), nums));
return "生成成功";
}
return "生成失败";
}
} }

@ -443,4 +443,53 @@ public class YysMaterialProcurementPlanServiceImpl extends ServiceImpl<YysMateri
} }
return "生成成功"; return "生成成功";
} }
/**
* ()
*
* @param id
* @param yysMaterialProcurementPlanForm
* @return
*/
@Override
@Transactional
public void commit(YysMaterialProcurementPlanForm yysMaterialProcurementPlanForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysMaterialProcurementPlanForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysMaterialProcurementPlanConstant.getFormData(), yysMaterialProcurementPlanForm), YysMaterialProcurementPlanForm.class);
YysMaterialProcurementPlanEntity entity = JsonUtil.getJsonToBean(yysMaterialProcurementPlanForm, YysMaterialProcurementPlanEntity.class);
if (isSave) {
String mainId = RandomUtil.uuId();
entity.setProcurementNumber(generaterSwapUtil.getBillNumber("procurementnumber", false));
entity.setId(mainId);
} else {
entity.setProcurementStatus("2");
//entity.setProcurementNumber(generaterSwapUtil.getBillNumber("procurementnumber", false));
}
this.saveOrUpdate(entity);
//YysMaterialProcurementItem子表数据新增修改
if (!isSave) {
QueryWrapper<YysMaterialProcurementItemEntity> YysMaterialProcurementItemqueryWrapper = new QueryWrapper<>();
YysMaterialProcurementItemqueryWrapper.lambda().eq(YysMaterialProcurementItemEntity::getMaterialProcurementPlanId, entity.getId());
yysMaterialProcurementItemService.remove(YysMaterialProcurementItemqueryWrapper);
}
if (yysMaterialProcurementPlanForm.getYysMaterialProcurementItemList() != null) {
List<YysMaterialProcurementItemEntity> tableField107 = JsonUtil.getJsonToList(yysMaterialProcurementPlanForm.getYysMaterialProcurementItemList(), YysMaterialProcurementItemEntity.class);
for (YysMaterialProcurementItemEntity entitys : tableField107) {
entitys.setId(RandomUtil.uuId());
entitys.setMaterialProcurementPlanId(entity.getId());
if (isSave) {
} else {
}
yysMaterialProcurementItemService.saveOrUpdate(entitys);
}
//每次修改的时候去修改下 采购表的修改时间和创建用户 其次统计数量
entity.setLastModifyTime(DateUtil.getNowDate());
entity.setLastModifyUserId(userInfo.getUserId());
this.saveOrUpdate(entity);
}
}
} }

@ -13,18 +13,23 @@ import jnpf.entity.*;
import jnpf.util.*; import jnpf.util.*;
import jnpf.model.yysmaterialprocurementorder.*; import jnpf.model.yysmaterialprocurementorder.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.*; import java.util.*;
import jnpf.annotation.JnpfField; import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO; import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO; import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO; import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil; import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity; import jnpf.base.entity.ProvinceEntity;
import java.io.IOException; import java.io.IOException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity; import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException; import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -36,7 +41,9 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import java.io.File; import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel; import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel; import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel; import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
@ -51,6 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
/** /**
* YysMaterialProcurementOrder * YysMaterialProcurementOrder
*
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
@ -58,7 +66,7 @@ import org.springframework.transaction.annotation.Transactional;
*/ */
@Slf4j @Slf4j
@RestController @RestController
@Tag(name = "YysMaterialProcurementOrder" , description = "example") @Tag(name = "YysMaterialProcurementOrder", description = "example")
@RequestMapping("/api/example/YysMaterialProcurementOrder") @RequestMapping("/api/example/YysMaterialProcurementOrder")
public class YysMaterialProcurementOrderController { public class YysMaterialProcurementOrderController {
@ -72,30 +80,29 @@ public class YysMaterialProcurementOrderController {
private YysMaterialProcurementOrderService yysMaterialProcurementOrderService; private YysMaterialProcurementOrderService yysMaterialProcurementOrderService;
@Autowired @Autowired
private ConfigValueUtil configValueUtil; private ConfigValueUtil configValueUtil;
/** /**
* *
* *
* @param yysMaterialProcurementOrderPagination * @param yysMaterialProcurementOrderPagination
* @return * @return
*/ */
@Operation(summary = "获取列表") @Operation(summary = "获取列表")
@PostMapping("/getList") @PostMapping("/getList")
public ActionResult list(@RequestBody YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination)throws IOException{ public ActionResult list(@RequestBody YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination) throws IOException {
List<YysMaterialProcurementOrderEntity> list= yysMaterialProcurementOrderService.getList(yysMaterialProcurementOrderPagination); List<YysMaterialProcurementOrderEntity> list = yysMaterialProcurementOrderService.getList(yysMaterialProcurementOrderPagination);
List<Map<String, Object>> realList=new ArrayList<>(); List<Map<String, Object>> realList = new ArrayList<>();
for (YysMaterialProcurementOrderEntity entity : list) { for (YysMaterialProcurementOrderEntity entity : list) {
Map<String, Object> yysMaterialProcurementOrderMap=JsonUtil.entityToMap(entity); Map<String, Object> yysMaterialProcurementOrderMap = JsonUtil.entityToMap(entity);
yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id")); yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
realList.add(yysMaterialProcurementOrderMap); realList.add(yysMaterialProcurementOrderMap);
} }
//数据转换 //数据转换
realList = generaterSwapUtil.swapDataList(realList, YysMaterialProcurementOrderConstant.getFormData(), YysMaterialProcurementOrderConstant.getColumnData(), yysMaterialProcurementOrderPagination.getModuleId(),false); realList = generaterSwapUtil.swapDataList(realList, YysMaterialProcurementOrderConstant.getFormData(), YysMaterialProcurementOrderConstant.getColumnData(), yysMaterialProcurementOrderPagination.getModuleId(), false);
//返回对象 //返回对象
PageListVO vo = new PageListVO(); PageListVO vo = new PageListVO();
@ -104,132 +111,134 @@ public class YysMaterialProcurementOrderController {
vo.setPagination(page); vo.setPagination(page);
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
* *
* @param yysMaterialProcurementOrderForm * @param yysMaterialProcurementOrderForm
* @return * @return
*/ */
@PostMapping() @PostMapping()
@Operation(summary = "创建") @Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm) { public ActionResult create(@RequestBody @Valid YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm) {
String b = yysMaterialProcurementOrderService.checkForm(yysMaterialProcurementOrderForm,0); String b = yysMaterialProcurementOrderService.checkForm(yysMaterialProcurementOrderForm, 0);
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b ); return ActionResult.fail(b);
} }
try{ try {
yysMaterialProcurementOrderService.saveOrUpdate(yysMaterialProcurementOrderForm, null ,true); yysMaterialProcurementOrderService.saveOrUpdate(yysMaterialProcurementOrderForm, null, true);
}catch(Exception e){ } catch (Exception e) {
return ActionResult.fail("新增数据失败"); return ActionResult.fail("新增数据失败");
} }
return ActionResult.success("创建成功"); return ActionResult.success("创建成功");
} }
/** /**
* Excel * Excel
* *
* @return * @return
*/ */
@Operation(summary = "导出Excel") @Operation(summary = "导出Excel")
@PostMapping("/Actions/Export") @PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination) throws IOException { public ActionResult Export(@RequestBody YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination) throws IOException {
if (StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSelectKey())){ if (StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSelectKey())) {
return ActionResult.fail("请选择导出字段"); return ActionResult.fail("请选择导出字段");
} }
List<YysMaterialProcurementOrderEntity> list= yysMaterialProcurementOrderService.getList(yysMaterialProcurementOrderPagination); List<YysMaterialProcurementOrderEntity> list = yysMaterialProcurementOrderService.getList(yysMaterialProcurementOrderPagination);
List<Map<String, Object>> realList=new ArrayList<>(); List<Map<String, Object>> realList = new ArrayList<>();
for (YysMaterialProcurementOrderEntity entity : list) { for (YysMaterialProcurementOrderEntity entity : list) {
Map<String, Object> yysMaterialProcurementOrderMap=JsonUtil.entityToMap(entity); Map<String, Object> yysMaterialProcurementOrderMap = JsonUtil.entityToMap(entity);
yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id")); yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
realList.add(yysMaterialProcurementOrderMap); realList.add(yysMaterialProcurementOrderMap);
} }
//数据转换 //数据转换
realList = generaterSwapUtil.swapDataList(realList, YysMaterialProcurementOrderConstant.getFormData(), YysMaterialProcurementOrderConstant.getColumnData(), yysMaterialProcurementOrderPagination.getModuleId(),false); realList = generaterSwapUtil.swapDataList(realList, YysMaterialProcurementOrderConstant.getFormData(), YysMaterialProcurementOrderConstant.getColumnData(), yysMaterialProcurementOrderPagination.getModuleId(), false);
String[]keys=!StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSelectKey())?yysMaterialProcurementOrderPagination.getSelectKey():new String[0]; String[] keys = !StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSelectKey()) ? yysMaterialProcurementOrderPagination.getSelectKey() : new String[0];
UserInfo userInfo=userProvider.get(); UserInfo userInfo = userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo); DownloadVO vo = this.creatModelExcel(configValueUtil.getTemporaryFilePath(), realList, keys, userInfo);
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
*/ */
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){ public DownloadVO creatModelExcel(String path, List<Map<String, Object>> list, String[] keys, UserInfo userInfo) {
DownloadVO vo=DownloadVO.builder().build(); DownloadVO vo = DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>(); List<ExcelExportEntity> entitys = new ArrayList<>();
if(keys.length>0){ if (keys.length > 0) {
for(String key:keys){ for (String key : keys) {
switch(key){ switch (key) {
case "orderNumber" : case "orderNumber":
entitys.add(new ExcelExportEntity("采购单号" ,"orderNumber")); entitys.add(new ExcelExportEntity("采购单号", "orderNumber"));
break; break;
case "orderDate" : case "orderDate":
entitys.add(new ExcelExportEntity("单据日期" ,"orderDate")); entitys.add(new ExcelExportEntity("单据日期", "orderDate"));
break; break;
case "procurementNumber" : case "procurementNumber":
entitys.add(new ExcelExportEntity("采购计划单号" ,"procurementNumber")); entitys.add(new ExcelExportEntity("采购计划单号", "procurementNumber"));
break; break;
case "supplier" : case "supplier":
entitys.add(new ExcelExportEntity("供应商" ,"supplier")); entitys.add(new ExcelExportEntity("供应商", "supplier"));
break; break;
case "materialCode" : case "materialCode":
entitys.add(new ExcelExportEntity("物料编码" ,"materialCode")); entitys.add(new ExcelExportEntity("物料编码", "materialCode"));
break; break;
case "materialName" : case "materialName":
entitys.add(new ExcelExportEntity("物料名称" ,"materialName")); entitys.add(new ExcelExportEntity("物料名称", "materialName"));
break; break;
case "specification" : case "specification":
entitys.add(new ExcelExportEntity("规格型号" ,"specification")); entitys.add(new ExcelExportEntity("规格型号", "specification"));
break; break;
case "orderQuantity" : case "orderQuantity":
entitys.add(new ExcelExportEntity("下单数量" ,"orderQuantity")); entitys.add(new ExcelExportEntity("下单数量", "orderQuantity"));
break; break;
case "unit" : case "unit":
entitys.add(new ExcelExportEntity("计量单位" ,"unit")); entitys.add(new ExcelExportEntity("计量单位", "unit"));
break; break;
case "totalProductionQuantity" : case "totalProductionQuantity":
entitys.add(new ExcelExportEntity("总投产数量" ,"totalProductionQuantity")); entitys.add(new ExcelExportEntity("总投产数量", "totalProductionQuantity"));
break; break;
case "totalSendQuantity" : case "totalSendQuantity":
entitys.add(new ExcelExportEntity("总发货数量" ,"totalSendQuantity")); entitys.add(new ExcelExportEntity("总发货数量", "totalSendQuantity"));
break; break;
case "requestDeliveryDate" : case "requestDeliveryDate":
entitys.add(new ExcelExportEntity("要求到货日期" ,"requestDeliveryDate")); entitys.add(new ExcelExportEntity("要求到货日期", "requestDeliveryDate"));
break; break;
case "delayReason" : case "delayReason":
entitys.add(new ExcelExportEntity("延期原因" ,"delayReason")); entitys.add(new ExcelExportEntity("延期原因", "delayReason"));
break; break;
case "delayedDeliveryDate" : case "delayedDeliveryDate":
entitys.add(new ExcelExportEntity("延期交货日期" ,"delayedDeliveryDate")); entitys.add(new ExcelExportEntity("延期交货日期", "delayedDeliveryDate"));
break; break;
case "batchDeliveryDate" : case "batchDeliveryDate":
entitys.add(new ExcelExportEntity("分批发货日期" ,"batchDeliveryDate")); entitys.add(new ExcelExportEntity("分批发货日期", "batchDeliveryDate"));
break; break;
case "batchShipmentQuantity" : case "batchShipmentQuantity":
entitys.add(new ExcelExportEntity("分批发货数量" ,"batchShipmentQuantity")); entitys.add(new ExcelExportEntity("分批发货数量", "batchShipmentQuantity"));
break; break;
case "confirmQuantityReceived" : case "confirmQuantityReceived":
entitys.add(new ExcelExportEntity("确认到货数量" ,"confirmQuantityReceived")); entitys.add(new ExcelExportEntity("确认到货数量", "confirmQuantityReceived"));
break; break;
case "orderStatus" : case "orderStatus":
entitys.add(new ExcelExportEntity("单据状态" ,"orderStatus")); entitys.add(new ExcelExportEntity("单据状态", "orderStatus"));
break; break;
case "orderFiles" : case "orderFiles":
entitys.add(new ExcelExportEntity("订单附件" ,"orderFiles")); entitys.add(new ExcelExportEntity("订单附件", "orderFiles"));
break; break;
default: default:
break; break;
} }
} }
} }
ExportParams exportParams = new ExportParams(null, "表单信息"); ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF); exportParams.setType(ExcelType.XSSF);
try{ try {
@Cleanup Workbook workbook = new HSSFWorkbook(); @Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){ if (entitys.size() > 0) {
if (list.size()==0){ if (list.size() == 0) {
list.add(new HashMap<>()); list.add(new HashMap<>());
} }
//去除空数据 //去除空数据
@ -239,8 +248,8 @@ public class YysMaterialProcurementOrderController {
for (String key : keys) { for (String key : keys) {
//子表 //子表
if (key.toLowerCase().startsWith("tablefield")) { if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" )); String tableField = key.substring(0, key.indexOf("-"));
String field = key.substring(key.indexOf("-" ) + 1); String field = key.substring(key.indexOf("-") + 1);
Object o = map.get(tableField); Object o = map.get(tableField);
if (o != null) { if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o; List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
@ -266,7 +275,7 @@ public class YysMaterialProcurementOrderController {
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList(); List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) { if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList); entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList); dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
} }
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList); workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
@ -283,91 +292,109 @@ public class YysMaterialProcurementOrderController {
} }
return vo; return vo;
} }
/** /**
* *
* @param id *
* @param yysMaterialProcurementOrderForm * @param id
* @return * @param yysMaterialProcurementOrderForm
*/ * @return
*/
@PutMapping("/{id}") @PutMapping("/{id}")
@Operation(summary = "更新") @Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm, public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm,
@RequestParam(value = "isImport", required = false) boolean isImport){ @RequestParam(value = "isImport", required = false) boolean isImport) {
yysMaterialProcurementOrderForm.setId(id); yysMaterialProcurementOrderForm.setId(id);
if (!isImport) { if (!isImport) {
String b = yysMaterialProcurementOrderService.checkForm(yysMaterialProcurementOrderForm,1); String b = yysMaterialProcurementOrderService.checkForm(yysMaterialProcurementOrderForm, 1);
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b ); return ActionResult.fail(b);
} }
} }
YysMaterialProcurementOrderEntity entity= yysMaterialProcurementOrderService.getInfo(id); YysMaterialProcurementOrderEntity entity = yysMaterialProcurementOrderService.getInfo(id);
if(entity!=null){ if (entity != null) {
try{ try {
yysMaterialProcurementOrderService.saveOrUpdate(yysMaterialProcurementOrderForm,id,false); yysMaterialProcurementOrderService.saveOrUpdate(yysMaterialProcurementOrderForm, id, false);
}catch(Exception e){ } catch (Exception e) {
return ActionResult.fail("修改数据失败"); return ActionResult.fail("修改数据失败");
} }
return ActionResult.success("更新成功"); return ActionResult.success("更新成功");
}else{ } else {
return ActionResult.fail("更新失败,数据不存在"); return ActionResult.fail("更新失败,数据不存在");
} }
} }
/** /**
* *
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "删除") @Operation(summary = "删除")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@Transactional @Transactional
public ActionResult delete(@PathVariable("id") String id){ public ActionResult delete(@PathVariable("id") String id) {
YysMaterialProcurementOrderEntity entity= yysMaterialProcurementOrderService.getInfo(id); YysMaterialProcurementOrderEntity entity = yysMaterialProcurementOrderService.getInfo(id);
if(entity!=null){ if (entity != null) {
//假删除 //假删除
entity.setDeleteMark(1); entity.setDeleteMark(1);
yysMaterialProcurementOrderService.update(id,entity); yysMaterialProcurementOrderService.update(id, entity);
} }
return ActionResult.success("删除成功"); return ActionResult.success("删除成功");
} }
/** /**
* () * ()
* 使- * 使-
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "表单信息(详情页)") @Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){ public ActionResult detailInfo(@PathVariable("id") String id) {
YysMaterialProcurementOrderEntity entity= yysMaterialProcurementOrderService.getInfo(id); YysMaterialProcurementOrderEntity entity = yysMaterialProcurementOrderService.getInfo(id);
if(entity==null){ if (entity == null) {
return ActionResult.fail("表单数据不存在!"); return ActionResult.fail("表单数据不存在!");
} }
Map<String, Object> yysMaterialProcurementOrderMap=JsonUtil.entityToMap(entity); Map<String, Object> yysMaterialProcurementOrderMap = JsonUtil.entityToMap(entity);
yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id")); yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
yysMaterialProcurementOrderMap = generaterSwapUtil.swapDataDetail(yysMaterialProcurementOrderMap,YysMaterialProcurementOrderConstant.getFormData(),"591255416864768197",false); yysMaterialProcurementOrderMap = generaterSwapUtil.swapDataDetail(yysMaterialProcurementOrderMap, YysMaterialProcurementOrderConstant.getFormData(), "591255416864768197", false);
return ActionResult.success(yysMaterialProcurementOrderMap); return ActionResult.success(yysMaterialProcurementOrderMap);
} }
/** /**
* () * ()
* 使- * 使-
* @param id *
* @return * @param id
*/ * @return
*/
@Operation(summary = "信息") @Operation(summary = "信息")
@GetMapping("/{id}") @GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){ public ActionResult info(@PathVariable("id") String id) {
YysMaterialProcurementOrderEntity entity= yysMaterialProcurementOrderService.getInfo(id); YysMaterialProcurementOrderEntity entity = yysMaterialProcurementOrderService.getInfo(id);
if(entity==null){ if (entity == null) {
return ActionResult.fail("表单数据不存在!"); return ActionResult.fail("表单数据不存在!");
} }
Map<String, Object> yysMaterialProcurementOrderMap=JsonUtil.entityToMap(entity); Map<String, Object> yysMaterialProcurementOrderMap = JsonUtil.entityToMap(entity);
yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id")); yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
yysMaterialProcurementOrderMap = generaterSwapUtil.swapDataForm(yysMaterialProcurementOrderMap,YysMaterialProcurementOrderConstant.getFormData(),YysMaterialProcurementOrderConstant.TABLEFIELDKEY,YysMaterialProcurementOrderConstant.TABLERENAMES); yysMaterialProcurementOrderMap = generaterSwapUtil.swapDataForm(yysMaterialProcurementOrderMap, YysMaterialProcurementOrderConstant.getFormData(), YysMaterialProcurementOrderConstant.TABLEFIELDKEY, YysMaterialProcurementOrderConstant.TABLERENAMES);
return ActionResult.success(yysMaterialProcurementOrderMap); return ActionResult.success(yysMaterialProcurementOrderMap);
} }
@Operation(summary = "生成采购订单")
@PostMapping("/initOrder")
public ActionResult initOrder(@RequestBody YysMaterialProcurementOrderForm form) {
String result = yysMaterialProcurementOrderService.initOrder(form);
if (result.contains("成功")) {
return ActionResult.success(result);
}
return ActionResult.fail(result);
}
} }

@ -399,4 +399,35 @@ public class YysMaterialProcurementPlanController {
return ActionResult.success(yysMaterialProcurementPlanMap); return ActionResult.success(yysMaterialProcurementPlanMap);
} }
/**
*
*
* @param id
* @param yysMaterialProcurementPlanForm
* @return
*/
@PutMapping("/commit/{id}")
@Operation(summary = "提交")
public ActionResult commit(@PathVariable("id") String id, @RequestBody @Valid YysMaterialProcurementPlanForm yysMaterialProcurementPlanForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
yysMaterialProcurementPlanForm.setId(id);
if (!isImport) {
String b = yysMaterialProcurementPlanService.checkForm(yysMaterialProcurementPlanForm, 1);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
YysMaterialProcurementPlanEntity entity = yysMaterialProcurementPlanService.getInfo(id);
if (entity != null) {
try {
yysMaterialProcurementPlanService.commit(yysMaterialProcurementPlanForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
} }

@ -2,9 +2,11 @@ package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* *
* *
@ -15,46 +17,50 @@ import java.math.BigDecimal;
*/ */
@Data @Data
@TableName("yys_material_procurement_item") @TableName("yys_material_procurement_item")
public class YysMaterialProcurementItemEntity { public class YysMaterialProcurementItemEntity {
@TableId(value ="ID" ) @TableId(value = "ID")
private String id; private String id;
@TableField("MATERIAL_PROCUREMENT_PLAN_ID") @TableField("MATERIAL_PROCUREMENT_PLAN_ID")
private String materialProcurementPlanId; private String materialProcurementPlanId;
@TableField(value = "MATERIAL_CODE" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "MATERIAL_CODE", updateStrategy = FieldStrategy.IGNORED)
private String materialCode; private String materialCode;
@TableField(value = "MATERIAL_NAME" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "MATERIAL_NAME", updateStrategy = FieldStrategy.IGNORED)
private String materialName; private String materialName;
@TableField(value = "MATERIAL_TYPE" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "MATERIAL_TYPE", updateStrategy = FieldStrategy.IGNORED)
private String materialType; private String materialType;
@TableField(value = "SPECIFICATION" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "SPECIFICATION", updateStrategy = FieldStrategy.IGNORED)
private String specification; private String specification;
@TableField(value = "LACK_NUMBER" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "LACK_NUMBER", updateStrategy = FieldStrategy.IGNORED)
private BigDecimal lackNumber; private BigDecimal lackNumber;
@TableField(value = "UNIT" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "UNIT", updateStrategy = FieldStrategy.IGNORED)
private String unit; private String unit;
@TableField(value = "PROCUREMENT_PLAN_NUMBER" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "PROCUREMENT_PLAN_NUMBER", updateStrategy = FieldStrategy.IGNORED)
private BigDecimal procurementPlanNumber; private BigDecimal procurementPlanNumber;
@TableField(value = "F_CREATOR_TIME" , fill = FieldFill.INSERT) @TableField(value = "order_quantity", updateStrategy = FieldStrategy.IGNORED)
private BigDecimal orderQuantity;
@TableField(value = "order_nos", updateStrategy = FieldStrategy.IGNORED)
private String orderNos;
@TableField(value = "F_CREATOR_TIME", fill = FieldFill.INSERT)
private Date creatorTime; private Date creatorTime;
@TableField(value = "F_CREATOR_USER_ID" , fill = FieldFill.INSERT) @TableField(value = "F_CREATOR_USER_ID", fill = FieldFill.INSERT)
private String creatorUserId; private String creatorUserId;
@TableField(value = "F_LAST_MODIFY_TIME" , fill = FieldFill.INSERT_UPDATE) @TableField(value = "F_LAST_MODIFY_TIME", fill = FieldFill.INSERT_UPDATE)
private Date lastModifyTime; private Date lastModifyTime;
@TableField(value = "F_LAST_MODIFY_USER_ID" , fill = FieldFill.INSERT_UPDATE) @TableField(value = "F_LAST_MODIFY_USER_ID", fill = FieldFill.INSERT_UPDATE)
private String lastModifyUserId; private String lastModifyUserId;
@TableField(value = "F_DELETE_TIME" , fill = FieldFill.UPDATE) @TableField(value = "F_DELETE_TIME", fill = FieldFill.UPDATE)
private Date deleteTime; private Date deleteTime;
@TableField(value = "F_DELETE_USER_ID" , fill = FieldFill.UPDATE) @TableField(value = "F_DELETE_USER_ID", fill = FieldFill.UPDATE)
private String deleteUserId; private String deleteUserId;
@TableField(value = "F_DELETE_MARK" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "F_DELETE_MARK", updateStrategy = FieldStrategy.IGNORED)
private Integer deleteMark; private Integer deleteMark;
@TableField("F_TENANT_ID") @TableField("F_TENANT_ID")
private String tenantId; private String tenantId;
@TableField(value = "COMPANY_ID" , fill = FieldFill.INSERT) @TableField(value = "COMPANY_ID", fill = FieldFill.INSERT)
private String companyId; private String companyId;
@TableField(value = "DEPARTMENT_ID" , fill = FieldFill.INSERT) @TableField(value = "DEPARTMENT_ID", fill = FieldFill.INSERT)
private String departmentId; private String departmentId;
@TableField(value = "ORGANIZE_JSON_ID" , fill = FieldFill.INSERT) @TableField(value = "ORGANIZE_JSON_ID", fill = FieldFill.INSERT)
private String organizeJsonId; private String organizeJsonId;
@TableField("F_FLOW_ID") @TableField("F_FLOW_ID")
private String flowId; private String flowId;

@ -29,6 +29,8 @@ public class YysMaterialProcurementOrderEntity {
private String procurementNumber; private String procurementNumber;
@TableField(value = "SUPPLIER" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "SUPPLIER" , updateStrategy = FieldStrategy.IGNORED)
private String supplier; private String supplier;
@TableField(value = "MATERIAL_ID" , updateStrategy = FieldStrategy.IGNORED)
private String materialId;
@TableField(value = "MATERIAL_CODE" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "MATERIAL_CODE" , updateStrategy = FieldStrategy.IGNORED)
private String materialCode; private String materialCode;
@TableField(value = "MATERIAL_NAME" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "MATERIAL_NAME" , updateStrategy = FieldStrategy.IGNORED)

@ -1,77 +1,131 @@
package jnpf.model.yysmaterialprocurementorder; package jnpf.model.yysmaterialprocurementorder;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
/** /**
* YysMaterialProcurementOrder * YysMaterialProcurementOrder
*
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-08-08 * @ 2024-08-08
*/ */
@Data @Data
public class YysMaterialProcurementOrderForm { public class YysMaterialProcurementOrderForm {
/** 主键 */ /**
*
*/
private String id; private String id;
/** 采购单号 **/ /**
*
**/
@JsonProperty("orderNumber") @JsonProperty("orderNumber")
private String orderNumber; private String orderNumber;
/** 单据日期 **/ /**
*
**/
@JsonProperty("orderDate") @JsonProperty("orderDate")
private String orderDate; private String orderDate;
/** 采购计划单号 **/ /**
*
**/
@JsonProperty("procurementNumber") @JsonProperty("procurementNumber")
private String procurementNumber; private String procurementNumber;
/** 供应商 **/ /**
*
**/
@JsonProperty("supplier") @JsonProperty("supplier")
private String supplier; private String supplier;
/** 物料编码 **/ /**
*
**/
@JsonProperty("materialID")
private String materialId;
/**
/**
*
**/
@JsonProperty("materialCode") @JsonProperty("materialCode")
private String materialCode; private String materialCode;
/** 物料名称 **/ /**
*
**/
@JsonProperty("materialName") @JsonProperty("materialName")
private String materialName; private String materialName;
/** 规格型号 **/ /**
*
**/
@JsonProperty("specification") @JsonProperty("specification")
private String specification; private String specification;
/** 下单数量 **/ /**
*
**/
@JsonProperty("orderQuantity") @JsonProperty("orderQuantity")
private BigDecimal orderQuantity; private BigDecimal orderQuantity;
/** 计量单位 **/ /**
*
**/
@JsonProperty("unit") @JsonProperty("unit")
private String unit; private String unit;
/** 总投产数量 **/ /**
*
**/
@JsonProperty("totalProductionQuantity") @JsonProperty("totalProductionQuantity")
private BigDecimal totalProductionQuantity; private BigDecimal totalProductionQuantity;
/** 总发货数量 **/ /**
*
**/
@JsonProperty("totalSendQuantity") @JsonProperty("totalSendQuantity")
private BigDecimal totalSendQuantity; private BigDecimal totalSendQuantity;
/** 要求到货日期 **/ /**
*
**/
@JsonProperty("requestDeliveryDate") @JsonProperty("requestDeliveryDate")
private String requestDeliveryDate; private String requestDeliveryDate;
/** 延期原因 **/ /**
*
**/
@JsonProperty("delayReason") @JsonProperty("delayReason")
private String delayReason; private String delayReason;
/** 延期交货日期 **/ /**
*
**/
@JsonProperty("delayedDeliveryDate") @JsonProperty("delayedDeliveryDate")
private String delayedDeliveryDate; private String delayedDeliveryDate;
/** 分批发货日期 **/ /**
*
**/
@JsonProperty("batchDeliveryDate") @JsonProperty("batchDeliveryDate")
private String batchDeliveryDate; private String batchDeliveryDate;
/** 分批发货数量 **/ /**
*
**/
@JsonProperty("batchShipmentQuantity") @JsonProperty("batchShipmentQuantity")
private BigDecimal batchShipmentQuantity; private BigDecimal batchShipmentQuantity;
/** 确认到货数量 **/ /**
*
**/
@JsonProperty("confirmQuantityReceived") @JsonProperty("confirmQuantityReceived")
private BigDecimal confirmQuantityReceived; private BigDecimal confirmQuantityReceived;
/** 单据状态 **/ /**
*
**/
@JsonProperty("orderStatus") @JsonProperty("orderStatus")
private Object orderStatus; private Object orderStatus;
/** 订单附件 **/ /**
*
**/
@JsonProperty("orderFiles") @JsonProperty("orderFiles")
private Object orderFiles; private Object orderFiles;
/**
*
*/
private List<YysMaterialProcurementOrderForm> orderData;
} }

@ -47,7 +47,8 @@
<el-col :span="24"> <el-col :span="24">
<div style="padding:15px 0px"> <div style="padding:15px 0px">
<span style="color: #409EFF;"></span> <span style="color: #409EFF;"></span>
<span style="font-size: 14px;font-weight: 500;color:rgb(102, 102, 102);">物料明细</span> <span
style="font-size: 14px;font-weight: 500;color:rgb(102, 102, 102);">物料明细</span>
</div> </div>
</el-col> </el-col>
<el-table :data="dataForm.tableField107" size='mini' border> <el-table :data="dataForm.tableField107" size='mini' border>
@ -91,6 +92,16 @@
<p>{{ scope.row.unit }}</p> <p>{{ scope.row.unit }}</p>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="orderQuantity" label="已下单数量">
<template slot-scope="scope">
<p>{{ scope.row.orderQuantity }}</p>
</template>
</el-table-column>
<el-table-column prop="orderNos" label="采购单号">
<template slot-scope="scope">
<p>{{ scope.row.orderNos }}</p>
</template>
</el-table-column>
</el-table> </el-table>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>

@ -2,10 +2,7 @@
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<div class="JNPF-preview-main"> <div class="JNPF-preview-main">
<div class="JNPF-common-page-header"> <div class="JNPF-common-page-header">
<el-page-header <el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
@back="goBack"
:content="!dataForm.id ? '新建' : '编辑'"
/>
<div class="options"> <div class="options">
<!-- <el-dropdown class="dropdown" placement="bottom"> <!-- <el-dropdown class="dropdown" placement="bottom">
<el-button style="width:70px"> <el-button style="width:70px">
@ -20,135 +17,67 @@
{{ '下一条' }} {{ '下一条' }}
</el-dropdown-item> </el-dropdown-item>
</template> </template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" <el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" :loading="continueBtnLoading" :disabled='btnLoading'>
:loading="continueBtnLoading" :disabled='btnLoading'> {{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-dropdown-item>
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-dropdown-item> </el-dropdown-menu>
</el-dropdown-menu> </el-dropdown> -->
</el-dropdown> --> <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" :disabled="continueBtnLoading">
<el-button </el-button>
type="primary" <el-button type="success" @click="submit()" :loading="btnLoading" :disabled="continueBtnLoading">
@click="dataFormSubmit()" 提交</el-button>
:loading="btnLoading"
:disabled="continueBtnLoading"
>
</el-button
>
<el-button
type="success"
@click="dataFormSubmit()"
:loading="btnLoading"
:disabled="continueBtnLoading"
>
提交</el-button
>
<el-button @click="goBack"> </el-button> <el-button @click="goBack"> </el-button>
</div> </div>
</div> </div>
<el-row <el-row :gutter="15" class=" main" :style="{ margin: '0 auto', width: '100%' }">
:gutter="15" <el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="150px"
class=" main" label-position="right">
:style="{ margin: '0 auto', width: '100%' }"
>
<el-form
ref="formRef"
:model="dataForm"
:rules="dataRule"
size="small"
label-width="150px"
label-position="right"
>
<template v-if="!loading"> <template v-if="!loading">
<!-- 具体表单 --> <!-- 具体表单 -->
<el-col :span="24"> <el-col :span="24">
<div style="padding:15px 0px"> <div style="padding:15px 0px">
<span style="color: #409EFF;"></span> <span style="color: #409EFF;"></span>
<span <span style="font-size: 14px;font-weight: 500;color:rgb(102, 102, 102);">基础信息</span>
style="font-size: 14px;font-weight: 500;color:rgb(102, 102, 102);"
>基础信息</span
>
</div> </div>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="采购计划单号" prop="procurementNumber"> <jnpf-form-tip-item label="采购计划单号" prop="procurementNumber">
<JnpfInput <JnpfInput v-model="dataForm.procurementNumber" @change="changeData('procurementNumber', -1)"
v-model="dataForm.procurementNumber" placeholder="系统自动生成" readonly :style="{ width: '100%' }">
@change="changeData('procurementNumber', -1)"
placeholder="系统自动生成"
readonly
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="单据日期" prop="procurementDate"> <jnpf-form-tip-item label="单据日期" prop="procurementDate">
<JnpfDatePicker <JnpfDatePicker v-model="dataForm.procurementDate" @change="changeData('procurementDate', -1)"
v-model="dataForm.procurementDate" :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择"
@change="changeData('procurementDate', -1)" clearable disabled :style="{ width: '100%' }" type="date" format="yyyy-MM-dd">
:startTime="dateTime(false, 1, 1, '', '')"
:endTime="dateTime(false, 1, 1, '', '')"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
type="date"
format="yyyy-MM-dd"
>
</JnpfDatePicker> </JnpfDatePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="年月" prop="procurementYearMonth"> <jnpf-form-tip-item label="年月" prop="procurementYearMonth">
<JnpfDatePicker <JnpfDatePicker v-model="dataForm.procurementYearMonth" @change="changeData('procurementYearMonth', -1)"
v-model="dataForm.procurementYearMonth" :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择"
@change="changeData('procurementYearMonth', -1)" clearable disabled :style="{ width: '100%' }" type="month" format="yyyy-MM">
:startTime="dateTime(false, 1, 1, '', '')"
:endTime="dateTime(false, 1, 1, '', '')"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
type="month"
format="yyyy-MM"
>
</JnpfDatePicker> </JnpfDatePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="物料需求计划单号" prop="planNumber"> <jnpf-form-tip-item label="物料需求计划单号" prop="planNumber">
<JnpfPopupSelect <JnpfPopupSelect v-model="dataForm.planNumber" @change="changeData('planNumber', -1)" :rowIndex="null"
v-model="dataForm.planNumber" :formData="dataForm" :templateJson="interfaceRes.planNumber" placeholder="请选择"
@change="changeData('planNumber', -1)" propsValue="plan_number" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
:rowIndex="null" relationField="plan_number" field="planNumber" interfaceId="591169965881556997" :pageSize="20"
:formData="dataForm" :columnOptions="planNumbercolumnOptions" clearable disabled :style="{ width: '100%' }">
:templateJson="interfaceRes.planNumber"
placeholder="请选择"
propsValue="plan_number"
popupWidth="800px"
popupTitle="选择数据"
popupType="dialog"
relationField="plan_number"
field="planNumber"
interfaceId="591169965881556997"
:pageSize="20"
:columnOptions="planNumbercolumnOptions"
clearable
:style="{ width: '100%' }"
>
</JnpfPopupSelect> </JnpfPopupSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="备注" prop="reamrk"> <jnpf-form-tip-item label="备注" prop="reamrk">
<JnpfTextarea <JnpfTextarea v-model="dataForm.reamrk" @change="changeData('reamrk', -1)" placeholder="请输入"
v-model="dataForm.reamrk" :style="{ width: '100%' }" true type="textarea" :autosize="{ minRows: 4, maxRows: 4 }">
@change="changeData('reamrk', -1)"
placeholder="请输入"
:style="{ width: '100%' }"
true
type="textarea"
:autosize="{ minRows: 4, maxRows: 4 }"
>
</JnpfTextarea> </JnpfTextarea>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
@ -157,40 +86,22 @@
<el-col :span="24"> <el-col :span="24">
<div style="padding:15px 0px"> <div style="padding:15px 0px">
<span style="color: #409EFF;"></span> <span style="color: #409EFF;"></span>
<span <span style="font-size: 14px;font-weight: 500;color:rgb(102, 102, 102);">物料明细</span>
style="font-size: 14px;font-weight: 500;color:rgb(102, 102, 102);"
>物料明细</span
>
</div> </div>
</el-col> </el-col>
<el-table <el-table :data="dataForm.yysMaterialProcurementItemList" size="mini" border>
:data="dataForm.yysMaterialProcurementItemList" <el-table-column type="index" width="50" label="序号" align="center" />
size="mini"
border
>
<el-table-column
type="index"
width="50"
label="序号"
align="center"
/>
<el-table-column label="物料编码" prop="materialCode"> <el-table-column label="物料编码" prop="materialCode">
<template slot="header" v-if="false"> <template slot="header" v-if="false">
<span class="required-sign">*</span>物料编码 <span class="required-sign">*</span>物料编码
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfInput <JnpfInput v-model="scope.row.materialCode" @change="
v-model="scope.row.materialCode" changeData(
@change=" 'yysmaterialprocurementitem-materialCode',
changeData( scope.$index
'yysmaterialprocurementitem-materialCode', )
scope.$index " placeholder="请输入" clearable :style="{ width: '100%' }">
)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</template> </template>
</el-table-column> </el-table-column>
@ -199,18 +110,12 @@
<span class="required-sign">*</span>物料名称 <span class="required-sign">*</span>物料名称
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfInput <JnpfInput v-model="scope.row.materialName" @change="
v-model="scope.row.materialName" changeData(
@change=" 'yysmaterialprocurementitem-materialName',
changeData( scope.$index
'yysmaterialprocurementitem-materialName', )
scope.$index " placeholder="请输入" clearable :style="{ width: '100%' }">
)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</template> </template>
</el-table-column> </el-table-column>
@ -219,18 +124,12 @@
<span class="required-sign">*</span>物料类型 <span class="required-sign">*</span>物料类型
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfInput <JnpfInput v-model="scope.row.materialType" @change="
v-model="scope.row.materialType" changeData(
@change=" 'yysmaterialprocurementitem-materialType',
changeData( scope.$index
'yysmaterialprocurementitem-materialType', )
scope.$index " placeholder="请输入" clearable :style="{ width: '100%' }">
)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</template> </template>
</el-table-column> </el-table-column>
@ -239,18 +138,12 @@
<span class="required-sign">*</span>规格型号 <span class="required-sign">*</span>规格型号
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfInput <JnpfInput v-model="scope.row.specification" @change="
v-model="scope.row.specification" changeData(
@change=" 'yysmaterialprocurementitem-specification',
changeData( scope.$index
'yysmaterialprocurementitem-specification', )
scope.$index " placeholder="请输入" clearable :style="{ width: '100%' }">
)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</template> </template>
</el-table-column> </el-table-column>
@ -259,41 +152,26 @@
<span class="required-sign">*</span>欠缺量 <span class="required-sign">*</span>欠缺量
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfInputNumber <JnpfInputNumber v-model="scope.row.lackNumber" @change="
v-model="scope.row.lackNumber" changeData(
@change=" 'yysmaterialprocurementitem-lackNumber',
changeData( scope.$index
'yysmaterialprocurementitem-lackNumber', )
scope.$index " placeholder="数字文本" :precision="2" :step="1" :style="{ width: '100%' }">
)
"
placeholder="数字文本"
:precision="2"
:step="1"
>
</JnpfInputNumber> </JnpfInputNumber>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="拟采购量" prop="procurementPlanNumber">
label="拟采购量"
prop="procurementPlanNumber"
>
<template slot="header" v-if="false"> <template slot="header" v-if="false">
<span class="required-sign">*</span>拟采购量 <span class="required-sign">*</span>拟采购量
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfInputNumber <JnpfInputNumber v-model="scope.row.procurementPlanNumber" @change="
v-model="scope.row.procurementPlanNumber" changeData(
@change=" 'yysmaterialprocurementitem-procurementPlanNumber',
changeData( scope.$index
'yysmaterialprocurementitem-procurementPlanNumber', )
scope.$index " placeholder="数字文本" :precision="2" :step="1" :style="{ width: '100%' }">
)
"
placeholder="数字文本"
:precision="2"
:step="1"
>
</JnpfInputNumber> </JnpfInputNumber>
</template> </template>
</el-table-column> </el-table-column>
@ -302,106 +180,65 @@
<span class="required-sign">*</span>计量单位 <span class="required-sign">*</span>计量单位
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfInput <JnpfInput v-model="scope.row.unit" @change="
v-model="scope.row.unit" changeData(
@change=" 'yysmaterialprocurementitem-unit',
changeData( scope.$index
'yysmaterialprocurementitem-unit', )
scope.$index " placeholder="请输入" clearable :style="{ width: '100%' }">
)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="已下单数量" prop="orderQuantity">
</el-table-column>
<el-table-column label="采购单号" prop="orderNos">
</el-table-column>
<el-table-column label="操作" width="200"> <el-table-column label="操作" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button size="mini" type="text" class="JNPF-table-delBtn"
size="mini" @click="delyysMaterialProcurementItemList(scope.$index)">删除</el-button>
type="text" <el-button size="mini" type="text" @click="fnProcurementOrderCreate(scope.row)"></el-button>
class="JNPF-table-delBtn"
@click="delyysMaterialProcurementItemList(scope.$index)"
>删除</el-button
>
<el-button
size="mini"
type="text"
@click="fnProcurementOrderCreate(scope.row)"
>生成采购单</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div <div class="table-actions" @click="addyysMaterialProcurementItemList()">
class="table-actions"
@click="addyysMaterialProcurementItemList()"
>
<el-button type="text" icon="el-icon-plus">添加</el-button> <el-button type="text" icon="el-icon-plus">添加</el-button>
</div> </div>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="创建人" prop="creatorUserId"> <jnpf-form-tip-item label="创建人" prop="creatorUserId">
<JnpfInput <JnpfInput v-model="dataForm.creatorUserId" @change="changeData('creatorUserId', -1)" placeholder="自动生成"
v-model="dataForm.creatorUserId" disabled clearable :style="{ width: '100%' }">
@change="changeData('creatorUserId', -1)"
placeholder="自动生成"
disabled
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="创建时间" prop="creatorTime"> <jnpf-form-tip-item label="创建时间" prop="creatorTime">
<JnpfDatePicker <JnpfDatePicker v-model="dataForm.creatorTime" @change="changeData('creatorTime', -1)"
v-model="dataForm.creatorTime" :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')" placeholder="自动生成"
@change="changeData('creatorTime', -1)" disabled clearable :style="{ width: '100%' }" type="date" format="yyyy-MM-dd">
:startTime="dateTime(false, 1, 1, '', '')"
:endTime="dateTime(false, 1, 1, '', '')"
placeholder="自动生成"
disabled
clearable
:style="{ width: '100%' }"
type="date"
format="yyyy-MM-dd"
>
</JnpfDatePicker> </JnpfDatePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="修改人" prop="lastModifyUserId"> <jnpf-form-tip-item label="修改人" prop="lastModifyUserId">
<JnpfInput <JnpfInput v-model="dataForm.lastModifyUserId" @change="changeData('lastModifyUserId', -1)"
v-model="dataForm.lastModifyUserId" placeholder="修改时记录" disabled clearable :style="{ width: '100%' }">
@change="changeData('lastModifyUserId', -1)"
placeholder="修改时记录"
disabled
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="修改时间" prop="lastModifyTime"> <jnpf-form-tip-item label="修改时间" prop="lastModifyTime">
<JnpfDatePicker <JnpfDatePicker v-model="dataForm.lastModifyTime" @change="changeData('lastModifyTime', -1)"
v-model="dataForm.lastModifyTime" :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')"
@change="changeData('lastModifyTime', -1)" placeholder="修改时记录" disabled clearable :style="{ width: '100%' }" type="date" format="yyyy-MM-dd">
:startTime="dateTime(false, 1, 1, '', '')"
:endTime="dateTime(false, 1, 1, '', '')"
placeholder="修改时记录"
disabled
clearable
:style="{ width: '100%' }"
type="date"
format="yyyy-MM-dd"
>
</JnpfDatePicker> </JnpfDatePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
@ -409,66 +246,36 @@
</template> </template>
</el-form> </el-form>
<el-col :span="24"> <el-col :span="24">
<el-row <el-row v-if="isOrdering == true" :style="{ margin: '0 auto', width: '100%' }">
v-if="isOrdering == true" <el-col :span="3">
:style="{ margin: '0 auto', width: '100%' }" <div style="height:10px;"></div>
> </el-col>
<el-col :span="3"><div style="height:10px;"></div></el-col>
<el-col :span="16"> <el-col :span="16">
<el-row :style="{ margin: '0 auto', width: '100%' }"> <el-row :style="{ margin: '0 auto', width: '100%' }">
<el-col :span="24" style="padding: 20px 0px;" <el-col :span="24" style="padding: 20px 0px;">生成采购单
>生成采购单
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-row style="padding: 20px 0px;"> <el-row style="padding: 20px 0px;">
<el-col :span="5" <el-col :span="5">物料编码{{ procurementOrderItem.materialCode }}</el-col>
>物料编码{{ procurementOrderItem.materialCode }}</el-col <el-col :span="5">物料名称{{ procurementOrderItem.materialName }}</el-col>
> <el-col :span="5">物料类型{{ procurementOrderItem.materialType }}</el-col>
<el-col :span="5" <el-col :span="5">欠缺量{{ procurementOrderItem.lackNumber }}</el-col>
>物料名称{{ procurementOrderItem.materialName }}</el-col <el-col :span="4">计量单位{{ procurementOrderItem.unit }}</el-col>
>
<el-col :span="5"
>物料类型{{ procurementOrderItem.materialType }}</el-col
>
<el-col :span="5"
>欠缺量{{ procurementOrderItem.lackNumber }}</el-col
>
<el-col :span="4"
>计量单位{{ procurementOrderItem.unit }}</el-col
>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-table :data="procurementOrderList" size="mini" border> <el-table :data="procurementOrderList" size="mini" border>
<el-table-column <el-table-column type="index" width="50" label="序号" align="center" />
type="index"
width="50"
label="序号"
align="center"
/>
<el-table-column label="供应商" prop="supplier"> <el-table-column label="供应商" prop="supplier">
<template slot="header"> <template slot="header">
<span class="required-sign">*</span> 供应商 <span class="required-sign">*</span> 供应商
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfPopupSelect <JnpfPopupSelect v-model="scope.row.supplier" :rowIndex="null" :formData="scope.row"
v-model="scope.row.supplier" :templateJson="[]" placeholder="请选择" propsValue="supplier_id" popupWidth="800px"
:rowIndex="null" popupTitle="选择数据" popupType="dialog" relationField="supplier_cname" field="supplier"
:formData="scope.row" interfaceId="591554794397630469" :pageSize="20" :columnOptions="suppliercolumnOptions"
:templateJson="[]" clearable :style="{ width: '100%' }">
placeholder="请选择"
propsValue="supplier_id"
popupWidth="800px"
popupTitle="选择数据"
popupType="dialog"
relationField="supplier_cname"
field="supplier"
interfaceId="591554794397630469"
:pageSize="20"
:columnOptions="suppliercolumnOptions"
clearable
:style="{ width: '100%' }"
>
</JnpfPopupSelect> </JnpfPopupSelect>
</template> </template>
</el-table-column> </el-table-column>
@ -477,82 +284,41 @@
<span class="required-sign">*</span> 下单数量 <span class="required-sign">*</span> 下单数量
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfInputNumber <JnpfInputNumber v-model="scope.row.orderQuantity" placeholder="数字文本" :precision="2" :step="1">
v-model="scope.row.orderQuantity"
placeholder="数字文本"
:precision="2"
:step="1"
>
</JnpfInputNumber> </JnpfInputNumber>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="要求到货日期" prop="requestDeliveryDate">
label="要求到货日期"
prop="requestDeliveryDate"
>
<template slot-scope="scope"> <template slot-scope="scope">
<JnpfDatePicker <JnpfDatePicker v-model="scope.row.requestDeliveryDate"
v-model="scope.row.requestDeliveryDate" :startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')"
:startTime="dateTime(false, 1, 1, '', '')" placeholder="请选择" clearable :style="{ width: '100%' }" type="month" format="yyyy-MM-dd">
:endTime="dateTime(false, 1, 1, '', '')"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
type="month"
format="yyyy-MM-dd"
>
</JnpfDatePicker> </JnpfDatePicker>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="200"> <el-table-column label="操作" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button size="mini" type="text" class="JNPF-table-delBtn" @click="
size="mini" fnProcurementOrderItemDel(scope.$index)
type="text" ">删除</el-button>
class="JNPF-table-delBtn"
@click="
fnProcurementOrderItemDel(scope.$index)
"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div <div class="table-actions" @click="fnProcurementOrderItemAdd()">
class="table-actions"
@click="fnProcurementOrderItemAdd()"
>
<el-button type="text" icon="el-icon-plus">添加</el-button> <el-button type="text" icon="el-icon-plus">添加</el-button>
</div> </div>
</el-col> </el-col>
<el-col <el-col :span="24" :style="{ textAlign: 'center', margin: '30px 0px' }">
:span="24" <el-button :style="{ margin: '0px 30px' }" @click="fnProcurementOrderCancel"></el-button>
:style="{ textAlign: 'center', margin: '30px 0px' }" <el-button type="primary" :style="{ margin: '0px 30px' }"
> @click="fnProcurementOrderSub">提交</el-button>
<el-button
:style="{ margin: '0px 30px' }"
@click="fnProcurementOrderCancel"
>取消</el-button
>
<el-button
type="primary"
:style="{ margin: '0px 30px' }"
@click="fnProcurementOrderSub"
>提交</el-button
>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<SelectDialog <SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
v-if="selectDialogVisible" @select="addForSelect" @close="selectDialogVisible = false" />
:config="currTableConf"
:formData="dataForm"
ref="selectDialog"
@select="addForSelect"
@close="selectDialogVisible = false"
/>
</el-row> </el-row>
</div> </div>
</transition> </transition>
@ -727,7 +493,7 @@ export default {
this.initDefaultData(); this.initDefaultData();
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm)); this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
}, },
mounted() {}, mounted() { },
methods: { methods: {
fnProcurementOrderCreate(row) { fnProcurementOrderCreate(row) {
this.procurementOrderItem = { ...this.procurementOrderItemO }; this.procurementOrderItem = { ...this.procurementOrderItemO };
@ -752,7 +518,7 @@ export default {
.then(() => { .then(() => {
this.procurementOrderList.splice(index, 1); this.procurementOrderList.splice(index, 1);
}) })
.catch(() => {}); .catch(() => { });
}, },
fnProcurementOrderCancel() { fnProcurementOrderCancel() {
this.procurementOrderList = []; this.procurementOrderList = [];
@ -760,6 +526,7 @@ export default {
}, },
fnProcurementOrderSub() { fnProcurementOrderSub() {
console.log(this.procurementOrderList); console.log(this.procurementOrderList);
///api/example/YysMaterialProcurementOrder/initOrder
}, },
prev() { prev() {
this.index--; this.index--;
@ -837,7 +604,7 @@ export default {
} }
} }
}, },
dataAll() {}, dataAll() { },
yysmaterialprocurementitemExist() { yysmaterialprocurementitemExist() {
let isOk = true; let isOk = true;
for ( for (
@ -891,7 +658,7 @@ export default {
this.$store.commit("generator/UPDATE_RELATION_DATA", {}); this.$store.commit("generator/UPDATE_RELATION_DATA", {});
}, },
// //
initDefaultData() {}, initDefaultData() { },
// //
dataFormSubmit(type) { dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0; this.dataFormSubmitType = type ? type : 0;
@ -902,6 +669,38 @@ export default {
} }
}); });
}, },
submit(type) {
this.dataFormSubmitType = type ? type : 0;
this.$refs["formRef"].validate(valid => {
if (valid) {
if (!this.yysmaterialprocurementitemExist()) return;
let _data = this.dataList();
request({
url: "/api/example/YysMaterialProcurementPlan/commit/" + this.dataForm.id,
method: "PUT",
data: _data
})
.then(res => {
this.$message({
message: res.msg,
type: "success",
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2)
return (this.continueBtnLoading = false);
this.visible = false;
this.btnLoading = false;
this.$emit("refresh", true);
}
});
})
.catch(() => {
this.btnLoading = false;
this.continueBtnLoading = false;
});
}
});
},
request() { request() {
let _data = this.dataList(); let _data = this.dataList();
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
@ -984,7 +783,7 @@ export default {
.then(() => { .then(() => {
this.dataForm.yysMaterialProcurementItemList.splice(index, 1); this.dataForm.yysMaterialProcurementItemList.splice(index, 1);
}) })
.catch(() => {}); .catch(() => { });
}, },
getyysMaterialProcurementItemList(value) { getyysMaterialProcurementItemList(value) {
let item = { ...this.tableRows.yysMaterialProcurementItemList, ...value }; let item = { ...this.tableRows.yysMaterialProcurementItemList, ...value };

Loading…
Cancel
Save