feat():生成采购单;

master
jiyufei 2 months ago
parent 65a8aae997
commit 8373c1c223

@ -2,7 +2,10 @@ package jnpf.service;
import jnpf.model.yysmaterialprocurementplan.*;
import jnpf.entity.*;
import java.math.BigDecimal;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -14,13 +17,23 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
* 2024-08-08
*/
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 list
* @return
*/
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;
/**
*
* @param form
* @return
*/
String initOrder(YysMaterialProcurementOrderForm form);
}

@ -43,4 +43,6 @@ public interface YysMaterialProcurementPlanService extends IService<YysMaterialP
* @return
*/
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);
}
boolean result = this.saveBatch(lists);
if (result){
if (result) {
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;
import cn.hutool.core.bean.BeanUtil;
import com.google.common.collect.Lists;
import jnpf.entity.*;
import jnpf.mapper.YysMaterialProcurementOrderMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.yysmaterialprocurementorder.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
@ -25,13 +40,20 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
/**
*
* YysMaterialProcurementOrder
* V3.5
* https://www.jnpfsoft.com
@ -39,293 +61,342 @@ import jnpf.permission.entity.UserEntity;
* 2024-08-08
*/
@Service
public class YysMaterialProcurementOrderServiceImpl extends ServiceImpl<YysMaterialProcurementOrderMapper, YysMaterialProcurementOrderEntity> implements YysMaterialProcurementOrderService{
@Slf4j
public class YysMaterialProcurementOrderServiceImpl extends ServiceImpl<YysMaterialProcurementOrderMapper, YysMaterialProcurementOrderEntity> implements YysMaterialProcurementOrderService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Resource
private YysMaterialProcurementItemService yysMaterialProcurementItemService;
@Override
public List<YysMaterialProcurementOrderEntity> getList(YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination){
return getTypeList(yysMaterialProcurementOrderPagination,yysMaterialProcurementOrderPagination.getDataType());
public List<YysMaterialProcurementOrderEntity> getList(YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination) {
return getTypeList(yysMaterialProcurementOrderPagination, yysMaterialProcurementOrderPagination.getDataType());
}
/** 列表查询 */
/**
*
*/
@Override
public List<YysMaterialProcurementOrderEntity> getTypeList(YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
public List<YysMaterialProcurementOrderEntity> getTypeList(YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination, String dataType) {
String userId = userProvider.get().getUserId();
List<String> AllIdList = new ArrayList();
List<List<String>> intersectionList = new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? YysMaterialProcurementOrderConstant.getAppColumnData() : YysMaterialProcurementOrderConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int yysMaterialProcurementOrderNum =0;
QueryWrapper<YysMaterialProcurementOrderEntity> yysMaterialProcurementOrderQueryWrapper=new QueryWrapper<>();
int total = 0;
int yysMaterialProcurementOrderNum = 0;
QueryWrapper<YysMaterialProcurementOrderEntity> yysMaterialProcurementOrderQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getSuperQueryJson())){
String superOp = "";
if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = yysMaterialProcurementOrderPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
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();
if (yysMaterialProcurementOrderNum1>0){
List<String> yysMaterialProcurementOrderList =this.list(yysMaterialProcurementOrderSuperWrapper).stream().map(YysMaterialProcurementOrderEntity::getId).collect(Collectors.toList());
if (yysMaterialProcurementOrderNum1 > 0) {
List<String> yysMaterialProcurementOrderList = this.list(yysMaterialProcurementOrderSuperWrapper).stream().map(YysMaterialProcurementOrderEntity::getId).collect(Collectors.toList());
allSuperList.addAll(yysMaterialProcurementOrderList);
intersectionSuperList.add(yysMaterialProcurementOrderList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
if (superOp.equalsIgnoreCase("and")) {
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
} else {
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
String ruleOp = "";
if (ObjectUtil.isNotEmpty(ruleJson)) {
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
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();
if (yysMaterialProcurementOrderNum1>0){
List<String> yysMaterialProcurementOrderList =this.list(yysMaterialProcurementOrderSuperWrapper).stream().map(YysMaterialProcurementOrderEntity::getId).collect(Collectors.toList());
if (yysMaterialProcurementOrderNum1 > 0) {
List<String> yysMaterialProcurementOrderList = this.list(yysMaterialProcurementOrderSuperWrapper).stream().map(YysMaterialProcurementOrderEntity::getId).collect(Collectors.toList());
allRuleList.addAll(yysMaterialProcurementOrderList);
intersectionRuleList.add(yysMaterialProcurementOrderList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
if (ruleOp.equalsIgnoreCase("and")) {
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
} else {
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = true;
boolean appPermission = false;
if(isPc && pcPermission){
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++;
}
boolean pcPermission = true;
boolean appPermission = false;
if (isPc && pcPermission) {
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(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getOrderNumber())){
yysMaterialProcurementOrderNum++;
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getOrderNumber())) {
yysMaterialProcurementOrderNum++;
String value = yysMaterialProcurementOrderPagination.getOrderNumber() instanceof List ?
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getOrderNumber()) :
String.valueOf(yysMaterialProcurementOrderPagination.getOrderNumber());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getOrderNumber,value);
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getOrderNumber()) :
String.valueOf(yysMaterialProcurementOrderPagination.getOrderNumber());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getOrderNumber, value);
}
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getProcurementNumber())){
yysMaterialProcurementOrderNum++;
if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getProcurementNumber())) {
yysMaterialProcurementOrderNum++;
String value = yysMaterialProcurementOrderPagination.getProcurementNumber() instanceof List ?
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getProcurementNumber()) :
String.valueOf(yysMaterialProcurementOrderPagination.getProcurementNumber());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getProcurementNumber,value);
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getProcurementNumber()) :
String.valueOf(yysMaterialProcurementOrderPagination.getProcurementNumber());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getProcurementNumber, value);
}
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getMaterialName())){
yysMaterialProcurementOrderNum++;
if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getMaterialName())) {
yysMaterialProcurementOrderNum++;
String value = yysMaterialProcurementOrderPagination.getMaterialName() instanceof List ?
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getMaterialName()) :
String.valueOf(yysMaterialProcurementOrderPagination.getMaterialName());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getMaterialName,value);
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getMaterialName()) :
String.valueOf(yysMaterialProcurementOrderPagination.getMaterialName());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getMaterialName, value);
}
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getSupplier())){
yysMaterialProcurementOrderNum++;
if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getSupplier())) {
yysMaterialProcurementOrderNum++;
String value = yysMaterialProcurementOrderPagination.getSupplier() instanceof List ?
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getSupplier()) :
String.valueOf(yysMaterialProcurementOrderPagination.getSupplier());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getSupplier,value);
JsonUtil.getObjectToString(yysMaterialProcurementOrderPagination.getSupplier()) :
String.valueOf(yysMaterialProcurementOrderPagination.getSupplier());
yysMaterialProcurementOrderQueryWrapper.lambda().like(YysMaterialProcurementOrderEntity::getSupplier, value);
}
if(ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getOrderStatus())){
yysMaterialProcurementOrderNum++;
if (ObjectUtil.isNotEmpty(yysMaterialProcurementOrderPagination.getOrderStatus())) {
yysMaterialProcurementOrderNum++;
List<String> idList = new ArrayList<>();
try {
String[][] orderStatus = JsonUtil.getJsonToBean(yysMaterialProcurementOrderPagination.getOrderStatus(),String[][].class);
for(int i=0;i<orderStatus.length;i++){
if(orderStatus[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(orderStatus[i])));
}
}
}catch (Exception e1){
try {
List<String> orderStatus = JsonUtil.getJsonToList(yysMaterialProcurementOrderPagination.getOrderStatus(),String.class);
if(orderStatus.size()>0){
idList.addAll(orderStatus);
}
}catch (Exception e2){
idList.add(String.valueOf(yysMaterialProcurementOrderPagination.getOrderStatus()));
}
}
yysMaterialProcurementOrderQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(YysMaterialProcurementOrderEntity::getOrderStatus, tt).or();
});
});
List<String> idList = new ArrayList<>();
try {
String[][] orderStatus = JsonUtil.getJsonToBean(yysMaterialProcurementOrderPagination.getOrderStatus(), String[][].class);
for (int i = 0; i < orderStatus.length; i++) {
if (orderStatus[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(orderStatus[i])));
}
}
} catch (Exception e1) {
try {
List<String> orderStatus = JsonUtil.getJsonToList(yysMaterialProcurementOrderPagination.getOrderStatus(), String.class);
if (orderStatus.size() > 0) {
idList.addAll(orderStatus);
}
} catch (Exception e2) {
idList.add(String.valueOf(yysMaterialProcurementOrderPagination.getOrderStatus()));
}
}
yysMaterialProcurementOrderQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(YysMaterialProcurementOrderEntity::getOrderStatus, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
yysMaterialProcurementOrderQueryWrapper.lambda().in(YysMaterialProcurementOrderEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
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 (allRuleIDlist.size()==0){
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
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);
//排序
if(StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSidx())){
if (StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSidx())) {
yysMaterialProcurementOrderQueryWrapper.lambda().orderByDesc(YysMaterialProcurementOrderEntity::getId);
}else{
} else {
try {
String sidx = yysMaterialProcurementOrderPagination.getSidx();
String[] strs= sidx.split("_name");
String[] strs = sidx.split("_name");
YysMaterialProcurementOrderEntity yysMaterialProcurementOrderEntity = new YysMaterialProcurementOrderEntity();
Field declaredField = yysMaterialProcurementOrderEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
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) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<YysMaterialProcurementOrderEntity> page=new Page<>(yysMaterialProcurementOrderPagination.getCurrentPage(), yysMaterialProcurementOrderPagination.getPageSize());
IPage<YysMaterialProcurementOrderEntity> userIPage=this.page(page, yysMaterialProcurementOrderQueryWrapper);
return yysMaterialProcurementOrderPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<YysMaterialProcurementOrderEntity> page = new Page<>(yysMaterialProcurementOrderPagination.getCurrentPage(), yysMaterialProcurementOrderPagination.getPageSize());
IPage<YysMaterialProcurementOrderEntity> userIPage = this.page(page, yysMaterialProcurementOrderQueryWrapper);
return yysMaterialProcurementOrderPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<YysMaterialProcurementOrderEntity> list = new ArrayList();
return yysMaterialProcurementOrderPagination.setData(list, list.size());
}
}else{
} else {
return this.list(yysMaterialProcurementOrderQueryWrapper);
}
}
@Override
public YysMaterialProcurementOrderEntity getInfo(String id){
QueryWrapper<YysMaterialProcurementOrderEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(YysMaterialProcurementOrderEntity::getId,id);
public YysMaterialProcurementOrderEntity getInfo(String id) {
QueryWrapper<YysMaterialProcurementOrderEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(YysMaterialProcurementOrderEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(YysMaterialProcurementOrderEntity entity){
public void create(YysMaterialProcurementOrderEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, YysMaterialProcurementOrderEntity entity){
public boolean update(String id, YysMaterialProcurementOrderEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(YysMaterialProcurementOrderEntity entity){
if(entity!=null){
public void delete(YysMaterialProcurementOrderEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
/**
* i-0-1
*/
@Override
public String checkForm(YysMaterialProcurementOrderForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
public String checkForm(YysMaterialProcurementOrderForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp){
if (isUp) {
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getSupplier())){
return "供应商不能为空";
}
if (StringUtil.isEmpty(form.getSupplier())) {
return "供应商不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param yysMaterialProcurementOrderForm
* @return
*/
* ()
*
* @param id
* @param yysMaterialProcurementOrderForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
public void saveOrUpdate(YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
yysMaterialProcurementOrderForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(YysMaterialProcurementOrderConstant.getFormData(),yysMaterialProcurementOrderForm),YysMaterialProcurementOrderForm.class);
generaterSwapUtil.swapDatetime(YysMaterialProcurementOrderConstant.getFormData(), yysMaterialProcurementOrderForm), YysMaterialProcurementOrderForm.class);
YysMaterialProcurementOrderEntity entity = JsonUtil.getJsonToBean(yysMaterialProcurementOrderForm, YysMaterialProcurementOrderEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
if (isSave) {
String mainId = RandomUtil.uuId();
entity.setId(mainId);
}else{
} else {
}
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 "生成成功";
}
/**
* ()
*
* @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.model.yysmaterialprocurementorder.*;
import lombok.extern.slf4j.Slf4j;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile;
@ -36,7 +41,9 @@ import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
@ -51,6 +58,7 @@ import org.springframework.transaction.annotation.Transactional;
/**
* YysMaterialProcurementOrder
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
@ -58,7 +66,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Slf4j
@RestController
@Tag(name = "YysMaterialProcurementOrder" , description = "example")
@Tag(name = "YysMaterialProcurementOrder", description = "example")
@RequestMapping("/api/example/YysMaterialProcurementOrder")
public class YysMaterialProcurementOrderController {
@ -72,30 +80,29 @@ public class YysMaterialProcurementOrderController {
private YysMaterialProcurementOrderService yysMaterialProcurementOrderService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param yysMaterialProcurementOrderPagination
* @return
*/
*
*
* @param yysMaterialProcurementOrderPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination)throws IOException{
List<YysMaterialProcurementOrderEntity> list= yysMaterialProcurementOrderService.getList(yysMaterialProcurementOrderPagination);
List<Map<String, Object>> realList=new ArrayList<>();
public ActionResult list(@RequestBody YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination) throws IOException {
List<YysMaterialProcurementOrderEntity> list = yysMaterialProcurementOrderService.getList(yysMaterialProcurementOrderPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (YysMaterialProcurementOrderEntity entity : list) {
Map<String, Object> yysMaterialProcurementOrderMap=JsonUtil.entityToMap(entity);
yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id"));
//副表数据
//子表数据
Map<String, Object> yysMaterialProcurementOrderMap = JsonUtil.entityToMap(entity);
yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id"));
//副表数据
//子表数据
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();
@ -104,132 +111,134 @@ public class YysMaterialProcurementOrderController {
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param yysMaterialProcurementOrderForm
* @return
*/
*
*
* @param yysMaterialProcurementOrderForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm) {
String b = yysMaterialProcurementOrderService.checkForm(yysMaterialProcurementOrderForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
String b = yysMaterialProcurementOrderService.checkForm(yysMaterialProcurementOrderForm, 0);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
try{
yysMaterialProcurementOrderService.saveOrUpdate(yysMaterialProcurementOrderForm, null ,true);
}catch(Exception e){
try {
yysMaterialProcurementOrderService.saveOrUpdate(yysMaterialProcurementOrderForm, null, true);
} catch (Exception e) {
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody YysMaterialProcurementOrderPagination yysMaterialProcurementOrderPagination) throws IOException {
if (StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSelectKey())){
if (StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSelectKey())) {
return ActionResult.fail("请选择导出字段");
}
List<YysMaterialProcurementOrderEntity> list= yysMaterialProcurementOrderService.getList(yysMaterialProcurementOrderPagination);
List<Map<String, Object>> realList=new ArrayList<>();
List<YysMaterialProcurementOrderEntity> list = yysMaterialProcurementOrderService.getList(yysMaterialProcurementOrderPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (YysMaterialProcurementOrderEntity entity : list) {
Map<String, Object> yysMaterialProcurementOrderMap=JsonUtil.entityToMap(entity);
yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id"));
//副表数据
//子表数据
Map<String, Object> yysMaterialProcurementOrderMap = JsonUtil.entityToMap(entity);
yysMaterialProcurementOrderMap.put("id", yysMaterialProcurementOrderMap.get("id"));
//副表数据
//子表数据
realList.add(yysMaterialProcurementOrderMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, YysMaterialProcurementOrderConstant.getFormData(), YysMaterialProcurementOrderConstant.getColumnData(), yysMaterialProcurementOrderPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSelectKey())?yysMaterialProcurementOrderPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
realList = generaterSwapUtil.swapDataList(realList, YysMaterialProcurementOrderConstant.getFormData(), YysMaterialProcurementOrderConstant.getColumnData(), yysMaterialProcurementOrderPagination.getModuleId(), false);
String[] keys = !StringUtil.isEmpty(yysMaterialProcurementOrderPagination.getSelectKey()) ? yysMaterialProcurementOrderPagination.getSelectKey() : new String[0];
UserInfo userInfo = userProvider.get();
DownloadVO vo = this.creatModelExcel(configValueUtil.getTemporaryFilePath(), realList, keys, userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "orderNumber" :
entitys.add(new ExcelExportEntity("采购单号" ,"orderNumber"));
break;
case "orderDate" :
entitys.add(new ExcelExportEntity("单据日期" ,"orderDate"));
break;
case "procurementNumber" :
entitys.add(new ExcelExportEntity("采购计划单号" ,"procurementNumber"));
break;
case "supplier" :
entitys.add(new ExcelExportEntity("供应商" ,"supplier"));
break;
case "materialCode" :
entitys.add(new ExcelExportEntity("物料编码" ,"materialCode"));
break;
case "materialName" :
entitys.add(new ExcelExportEntity("物料名称" ,"materialName"));
break;
case "specification" :
entitys.add(new ExcelExportEntity("规格型号" ,"specification"));
break;
case "orderQuantity" :
entitys.add(new ExcelExportEntity("下单数量" ,"orderQuantity"));
break;
case "unit" :
entitys.add(new ExcelExportEntity("计量单位" ,"unit"));
break;
case "totalProductionQuantity" :
entitys.add(new ExcelExportEntity("总投产数量" ,"totalProductionQuantity"));
break;
case "totalSendQuantity" :
entitys.add(new ExcelExportEntity("总发货数量" ,"totalSendQuantity"));
break;
case "requestDeliveryDate" :
entitys.add(new ExcelExportEntity("要求到货日期" ,"requestDeliveryDate"));
break;
case "delayReason" :
entitys.add(new ExcelExportEntity("延期原因" ,"delayReason"));
break;
case "delayedDeliveryDate" :
entitys.add(new ExcelExportEntity("延期交货日期" ,"delayedDeliveryDate"));
break;
case "batchDeliveryDate" :
entitys.add(new ExcelExportEntity("分批发货日期" ,"batchDeliveryDate"));
break;
case "batchShipmentQuantity" :
entitys.add(new ExcelExportEntity("分批发货数量" ,"batchShipmentQuantity"));
break;
case "confirmQuantityReceived" :
entitys.add(new ExcelExportEntity("确认到货数量" ,"confirmQuantityReceived"));
break;
case "orderStatus" :
entitys.add(new ExcelExportEntity("单据状态" ,"orderStatus"));
break;
case "orderFiles" :
entitys.add(new ExcelExportEntity("订单附件" ,"orderFiles"));
break;
*
*/
public DownloadVO creatModelExcel(String path, List<Map<String, Object>> list, String[] keys, UserInfo userInfo) {
DownloadVO vo = DownloadVO.builder().build();
List<ExcelExportEntity> entitys = new ArrayList<>();
if (keys.length > 0) {
for (String key : keys) {
switch (key) {
case "orderNumber":
entitys.add(new ExcelExportEntity("采购单号", "orderNumber"));
break;
case "orderDate":
entitys.add(new ExcelExportEntity("单据日期", "orderDate"));
break;
case "procurementNumber":
entitys.add(new ExcelExportEntity("采购计划单号", "procurementNumber"));
break;
case "supplier":
entitys.add(new ExcelExportEntity("供应商", "supplier"));
break;
case "materialCode":
entitys.add(new ExcelExportEntity("物料编码", "materialCode"));
break;
case "materialName":
entitys.add(new ExcelExportEntity("物料名称", "materialName"));
break;
case "specification":
entitys.add(new ExcelExportEntity("规格型号", "specification"));
break;
case "orderQuantity":
entitys.add(new ExcelExportEntity("下单数量", "orderQuantity"));
break;
case "unit":
entitys.add(new ExcelExportEntity("计量单位", "unit"));
break;
case "totalProductionQuantity":
entitys.add(new ExcelExportEntity("总投产数量", "totalProductionQuantity"));
break;
case "totalSendQuantity":
entitys.add(new ExcelExportEntity("总发货数量", "totalSendQuantity"));
break;
case "requestDeliveryDate":
entitys.add(new ExcelExportEntity("要求到货日期", "requestDeliveryDate"));
break;
case "delayReason":
entitys.add(new ExcelExportEntity("延期原因", "delayReason"));
break;
case "delayedDeliveryDate":
entitys.add(new ExcelExportEntity("延期交货日期", "delayedDeliveryDate"));
break;
case "batchDeliveryDate":
entitys.add(new ExcelExportEntity("分批发货日期", "batchDeliveryDate"));
break;
case "batchShipmentQuantity":
entitys.add(new ExcelExportEntity("分批发货数量", "batchShipmentQuantity"));
break;
case "confirmQuantityReceived":
entitys.add(new ExcelExportEntity("确认到货数量", "confirmQuantityReceived"));
break;
case "orderStatus":
entitys.add(new ExcelExportEntity("单据状态", "orderStatus"));
break;
case "orderFiles":
entitys.add(new ExcelExportEntity("订单附件", "orderFiles"));
break;
default:
break;
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
try {
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
if (entitys.size() > 0) {
if (list.size() == 0) {
list.add(new HashMap<>());
}
//去除空数据
@ -239,8 +248,8 @@ public class YysMaterialProcurementOrderController {
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
String tableField = key.substring(0, key.indexOf("-"));
String field = key.substring(key.indexOf("-") + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
@ -266,7 +275,7 @@ public class YysMaterialProcurementOrderController {
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
@ -283,91 +292,109 @@ public class YysMaterialProcurementOrderController {
}
return vo;
}
/**
*
* @param id
* @param yysMaterialProcurementOrderForm
* @return
*/
*
*
* @param id
* @param yysMaterialProcurementOrderForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid YysMaterialProcurementOrderForm yysMaterialProcurementOrderForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
yysMaterialProcurementOrderForm.setId(id);
if (!isImport) {
String b = yysMaterialProcurementOrderService.checkForm(yysMaterialProcurementOrderForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
String b = yysMaterialProcurementOrderService.checkForm(yysMaterialProcurementOrderForm, 1);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
YysMaterialProcurementOrderEntity entity= yysMaterialProcurementOrderService.getInfo(id);
if(entity!=null){
try{
yysMaterialProcurementOrderService.saveOrUpdate(yysMaterialProcurementOrderForm,id,false);
}catch(Exception e){
YysMaterialProcurementOrderEntity entity = yysMaterialProcurementOrderService.getInfo(id);
if (entity != null) {
try {
yysMaterialProcurementOrderService.saveOrUpdate(yysMaterialProcurementOrderForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
*
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
YysMaterialProcurementOrderEntity entity= yysMaterialProcurementOrderService.getInfo(id);
if(entity!=null){
public ActionResult delete(@PathVariable("id") String id) {
YysMaterialProcurementOrderEntity entity = yysMaterialProcurementOrderService.getInfo(id);
if (entity != null) {
//假删除
entity.setDeleteMark(1);
yysMaterialProcurementOrderService.update(id,entity);
yysMaterialProcurementOrderService.update(id, entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
YysMaterialProcurementOrderEntity entity= yysMaterialProcurementOrderService.getInfo(id);
if(entity==null){
public ActionResult detailInfo(@PathVariable("id") String id) {
YysMaterialProcurementOrderEntity entity = yysMaterialProcurementOrderService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> yysMaterialProcurementOrderMap=JsonUtil.entityToMap(entity);
Map<String, Object> yysMaterialProcurementOrderMap = JsonUtil.entityToMap(entity);
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);
}
/**
* ()
* 使-
* @param id
* @return
*/
* ()
* 使-
*
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
YysMaterialProcurementOrderEntity entity= yysMaterialProcurementOrderService.getInfo(id);
if(entity==null){
public ActionResult info(@PathVariable("id") String id) {
YysMaterialProcurementOrderEntity entity = yysMaterialProcurementOrderService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> yysMaterialProcurementOrderMap=JsonUtil.entityToMap(entity);
Map<String, Object> yysMaterialProcurementOrderMap = JsonUtil.entityToMap(entity);
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);
}
@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);
}
/**
*
*
* @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 lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
import java.math.BigDecimal;
/**
*
*
@ -15,46 +17,50 @@ import java.math.BigDecimal;
*/
@Data
@TableName("yys_material_procurement_item")
public class YysMaterialProcurementItemEntity {
@TableId(value ="ID" )
public class YysMaterialProcurementItemEntity {
@TableId(value = "ID")
private String id;
@TableField("MATERIAL_PROCUREMENT_PLAN_ID")
private String materialProcurementPlanId;
@TableField(value = "MATERIAL_CODE" , updateStrategy = FieldStrategy.IGNORED)
@TableField(value = "MATERIAL_CODE", updateStrategy = FieldStrategy.IGNORED)
private String materialCode;
@TableField(value = "MATERIAL_NAME" , updateStrategy = FieldStrategy.IGNORED)
@TableField(value = "MATERIAL_NAME", updateStrategy = FieldStrategy.IGNORED)
private String materialName;
@TableField(value = "MATERIAL_TYPE" , updateStrategy = FieldStrategy.IGNORED)
@TableField(value = "MATERIAL_TYPE", updateStrategy = FieldStrategy.IGNORED)
private String materialType;
@TableField(value = "SPECIFICATION" , updateStrategy = FieldStrategy.IGNORED)
@TableField(value = "SPECIFICATION", updateStrategy = FieldStrategy.IGNORED)
private String specification;
@TableField(value = "LACK_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
@TableField(value = "LACK_NUMBER", updateStrategy = FieldStrategy.IGNORED)
private BigDecimal lackNumber;
@TableField(value = "UNIT" , updateStrategy = FieldStrategy.IGNORED)
@TableField(value = "UNIT", updateStrategy = FieldStrategy.IGNORED)
private String unit;
@TableField(value = "PROCUREMENT_PLAN_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
@TableField(value = "PROCUREMENT_PLAN_NUMBER", updateStrategy = FieldStrategy.IGNORED)
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;
@TableField(value = "F_CREATOR_USER_ID" , fill = FieldFill.INSERT)
@TableField(value = "F_CREATOR_USER_ID", fill = FieldFill.INSERT)
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;
@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;
@TableField(value = "F_DELETE_TIME" , fill = FieldFill.UPDATE)
@TableField(value = "F_DELETE_TIME", fill = FieldFill.UPDATE)
private Date deleteTime;
@TableField(value = "F_DELETE_USER_ID" , fill = FieldFill.UPDATE)
@TableField(value = "F_DELETE_USER_ID", fill = FieldFill.UPDATE)
private String deleteUserId;
@TableField(value = "F_DELETE_MARK" , updateStrategy = FieldStrategy.IGNORED)
@TableField(value = "F_DELETE_MARK", updateStrategy = FieldStrategy.IGNORED)
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField(value = "COMPANY_ID" , fill = FieldFill.INSERT)
@TableField(value = "COMPANY_ID", fill = FieldFill.INSERT)
private String companyId;
@TableField(value = "DEPARTMENT_ID" , fill = FieldFill.INSERT)
@TableField(value = "DEPARTMENT_ID", fill = FieldFill.INSERT)
private String departmentId;
@TableField(value = "ORGANIZE_JSON_ID" , fill = FieldFill.INSERT)
@TableField(value = "ORGANIZE_JSON_ID", fill = FieldFill.INSERT)
private String organizeJsonId;
@TableField("F_FLOW_ID")
private String flowId;

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

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

@ -47,7 +47,8 @@
<el-col :span="24">
<div style="padding:15px 0px">
<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>
</el-col>
<el-table :data="dataForm.tableField107" size='mini' border>
@ -91,6 +92,16 @@
<p>{{ scope.row.unit }}</p>
</template>
</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>
</jnpf-form-tip-item>
</el-col>

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

Loading…
Cancel
Save