申请物料

This commit is contained in:
大米 2023-12-05 13:32:40 +08:00
parent 0dc3d72972
commit 5c11ad0006
4 changed files with 180 additions and 1 deletions

View File

@ -1413,7 +1413,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
materialSubmitService.submit(ImmutableList.of(materialMainEntity.getRowId()));
materialFilesService.getBaseMapper().updateRowIdToMaterialNo(materialMainEntity.getMaterialNo(), materialMainEntity.getRowId().toString());
}
return ResultVO.success();
return ResultVO.success(materialMainEntity.getMaterialNo());
}
@Nullable

View File

@ -0,0 +1,20 @@
package com.nflg.product.bomnew.client;
import com.nflg.product.bomnew.pojo.dto.MaterialMainDTO;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(value = "service-material")
public interface MaterialMainClient {
@PostMapping("main/add")
@ApiOperation("申请物料")
ResultVO<String> addMaterialMainEntity(@RequestBody MaterialMainDTO paramDto);
}

View File

@ -0,0 +1,111 @@
package com.nflg.product.bomnew.pojo.dto;
import com.nflg.product.material.pojo.entity.MaterialFilesEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.naming.ldap.PagedResultsControl;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 物料主数据表(MaterialMain)$desc
*
* @author 大米
* @since 2022-08-14 13:41:48
*/
@Data
@Accessors(chain = true)
@ApiModel(value="com-nflg-product-material-pojo-dto-MaterialMainEntityDTO")
public class MaterialMainDTO implements Serializable {
/**
* 物料名称
*/
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 物料描述
*/
@ApiModelProperty(value = "物料描述")
@NotNull(message = "物料描述不能为空")
private String materialDesc;
/**
* 物料描述(简写)
*/
@ApiModelProperty(value = "物料描述(简写)")
private String shortMaterialDesc;
/**
* 图号
*/
@ApiModelProperty(value = "图号")
private String drawingNo;
/**
* 是否一次性使用物料 0:否1
*/
@ApiModelProperty(value = "是否一次性使用物料 0:否1")
private Integer reuseOfOnceState=0;
/**
* 物料分类编码
*/
@ApiModelProperty(value = "物料分类编码")
@NotNull(message = "物料分类编码不能为空")
private String materialCategoryCode;
@ApiModelProperty("操作类型0保存草稿 1提交申请 ")
@NotNull(message = "参数操作类型不能为空")
private Integer opEnum=1;
/**
* 项目类别FQL
*/
@ApiModelProperty(value = "项目类别F、Q、L")
private String projectType="L";
@ApiModelProperty(value = "申请部门")
private String applyDeptName;
private Integer materialState=1;
private Integer materialGetType=1;
private Integer materialType=1;
private String materialUnit="PC";
private Long rowId=0L;
private String materialNo="";
private List<String> materialTypeThreeFiles=new ArrayList<>();
private Object materialTypeZeroFile=new Object();
private Object materialTypeOneFile=new Object();
private Object materialTypeTwoFile=new Object();
private List<String> attrs=new ArrayList<>();
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,48 @@
package com.nflg.product.bomnew.service;
import cn.hutool.core.util.StrUtil;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.base.core.exception.NflgBusinessException;
import com.nflg.product.bomnew.client.MaterialMainClient;
import com.nflg.product.bomnew.pojo.dto.MaterialMainDTO;
import nflg.product.common.constant.STATE;
import nflg.product.common.vo.ResultVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class MaterialService {
@Resource
MaterialMainClient materialMainClient;
/**
* 申请物料
* @param drawingNo
* @param materialName
* @param materialCategoryCode
* @return
*/
public String addMaterial(String drawingNo, String materialName, String materialCategoryCode){
MaterialMainDTO materialMainDTO=new MaterialMainDTO();
materialMainDTO.setMaterialName(materialName);
materialMainDTO.setDrawingNo(drawingNo);
materialMainDTO.setMaterialDesc(StrUtil.join(" ",drawingNo,materialName));
materialMainDTO.setMaterialCategoryCode(materialCategoryCode);
materialMainDTO.setOpEnum(1);
materialMainDTO.setApplyDeptName(SessionUtil.getDepartName());
ResultVO<String> stringResultVO = materialMainClient.addMaterialMainEntity(materialMainDTO);
if(stringResultVO.getState().equals(STATE.Success)){
return stringResultVO.getData();
}
else {
throw new NflgBusinessException(STATE.Error, "申请编码失败"+stringResultVO.getMsg());
}
}
}