bug修复
This commit is contained in:
parent
46a870b3a1
commit
3a5c231d40
|
|
@ -16,6 +16,7 @@ import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
|
|||
import com.nflg.product.bomnew.pojo.vo.BomNewTechnologyPackageTypeVO;
|
||||
import com.nflg.product.bomnew.service.BomNewPbomParentService;
|
||||
import com.nflg.product.bomnew.service.BomNewTechnologyPackageTypeService;
|
||||
import com.nflg.product.bomnew.service.MaterialService;
|
||||
import com.nflg.product.bomnew.service.UserRoleService;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -29,6 +30,7 @@ import javax.validation.Valid;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
/**
|
||||
|
|
@ -230,6 +232,16 @@ public class PBomApi extends BaseApi {
|
|||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
MaterialService materialService;
|
||||
|
||||
@PostMapping("materialAddTest")
|
||||
@ApiOperation("新增物料测试")
|
||||
public ResultVO<Map<String,AddVirtrualMaterialDTO>> materialAddTest(@RequestBody List<AddVirtrualMaterialDTO> parems) {
|
||||
|
||||
return ResultVO.success(materialService.batchAddMaterial(parems));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.nflg.product.bomnew.mapper.master;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialFlowNumberEntity;
|
||||
|
||||
/**
|
||||
* (MaterialFlowNumber)$desc
|
||||
*
|
||||
* @author 大米
|
||||
* @since 2022-08-06 11:34:07
|
||||
*/
|
||||
public interface MaterialFlowNumberMapper extends BaseMapper<MaterialFlowNumberEntity> {
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.product.bomnew.mapper.master;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.CategoryExcelDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialMateVO;
|
||||
|
|
@ -43,8 +44,8 @@ public interface MaterialMainMapper extends BaseMapper<MaterialMainEntity> {
|
|||
|
||||
List<BaseMaterialVO> getMaterialLikeByDrawingNo(@Param("drawingNo") String drawingNo);
|
||||
|
||||
String getMaterialCategory(@Param("categoryCode") String categoryCode);
|
||||
|
||||
|
||||
|
||||
List<CategoryExcelDTO> getList();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,411 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料主数据表(MaterialMain)$desc
|
||||
*
|
||||
* @author 大米
|
||||
* @since 2022-08-14 13:41:49
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "com-nflg-product-material-pojo-vo-MaterialMainEntityVO")
|
||||
public class AddMaterialMainDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 行ID 雪花
|
||||
*/
|
||||
@ApiModelProperty(value = "行ID 雪花")
|
||||
private Long rowId;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
@ExcelColumn("物料编码")
|
||||
private String materialNo;
|
||||
|
||||
@ApiModelProperty(value = "大类行ID")
|
||||
@ExcelColumn("大类行ID")
|
||||
private String firstMaterialCategoryRowId;
|
||||
|
||||
@ApiModelProperty(value = "大类编码")
|
||||
@ExcelColumn("大类编码")
|
||||
private String firstMaterialCategoryCode;
|
||||
|
||||
/**
|
||||
* 大类
|
||||
*/
|
||||
@ApiModelProperty(value = "大类")
|
||||
@ExcelColumn("大类")
|
||||
private String firstMaterialCategoryName;
|
||||
|
||||
/**
|
||||
* 中类编码
|
||||
*/
|
||||
@ApiModelProperty(value = "中类编码")
|
||||
@ExcelColumn("中类编码")
|
||||
private String secondMaterialCategoryCode;
|
||||
|
||||
/**
|
||||
* 中类
|
||||
*/
|
||||
@ApiModelProperty(value = "中类")
|
||||
@ExcelColumn("中类")
|
||||
private String secondMaterialCategoryName;
|
||||
|
||||
/**
|
||||
* 小类编码
|
||||
*/
|
||||
@ApiModelProperty(value = "小类编码")
|
||||
@ExcelColumn("小类编码")
|
||||
private String thirdMaterialCategoryCode;
|
||||
|
||||
/**
|
||||
* 小类
|
||||
*/
|
||||
@ApiModelProperty(value = "小类")
|
||||
@ExcelColumn("小类")
|
||||
private String thirdMaterialCategoryName;
|
||||
|
||||
/**
|
||||
* 细分类编码
|
||||
*/
|
||||
@ApiModelProperty(value = "细分类编码")
|
||||
@ExcelColumn("细分类编码")
|
||||
private String fourthMaterialCategoryCode;
|
||||
|
||||
/**
|
||||
* 细分类
|
||||
*/
|
||||
@ApiModelProperty(value = "细分类")
|
||||
@ExcelColumn("细分类")
|
||||
private String fourthMaterialCategoryName;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@ApiModelProperty(value = "物料名称")
|
||||
@ExcelColumn("物料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 物料描述
|
||||
*/
|
||||
@ApiModelProperty(value = "物料描述")
|
||||
@ExcelColumn("物料描述")
|
||||
private String materialDesc;
|
||||
|
||||
/**
|
||||
* 简化描述
|
||||
*/
|
||||
@ApiModelProperty(value = "简化描述")
|
||||
@ExcelColumn("简化描述")
|
||||
private String shortMaterialDesc;
|
||||
|
||||
/**
|
||||
* 参照物料描述
|
||||
*/
|
||||
@ApiModelProperty(value = "参照物料描述")
|
||||
@ExcelColumn("参照物料描述")
|
||||
private String oldMaterialDesc;
|
||||
|
||||
/**
|
||||
* 参照简化描述
|
||||
*/
|
||||
@ApiModelProperty(value = "参照简化描述")
|
||||
@ExcelColumn("参照简化描述")
|
||||
private String oldShortMaterialDesc;
|
||||
|
||||
/**
|
||||
* 图号
|
||||
*/
|
||||
@ApiModelProperty(value = "图号")
|
||||
@ExcelColumn("图号")
|
||||
private String drawingNo;
|
||||
|
||||
/**
|
||||
* 重量-kg
|
||||
*/
|
||||
@ApiModelProperty(value = "重量-kg")
|
||||
@ExcelColumn("重量-kg")
|
||||
private String materialWeight;
|
||||
|
||||
/**
|
||||
* 品牌
|
||||
*/
|
||||
@ApiModelProperty(value = "品牌")
|
||||
@ExcelColumn("品牌")
|
||||
private String materialBrand;
|
||||
|
||||
/**
|
||||
* 基本计量单位
|
||||
*/
|
||||
@ApiModelProperty(value = "基本计量单位")
|
||||
@ExcelColumn("基本计量单位")
|
||||
private String materialUnit;
|
||||
|
||||
/**
|
||||
* 辅助单位
|
||||
*/
|
||||
@ApiModelProperty(value = "辅助单位")
|
||||
@ExcelColumn("辅助单位")
|
||||
private String materialAssistUnit;
|
||||
|
||||
/**
|
||||
* 是否重复性使用物料 0:否1:是
|
||||
*/
|
||||
@ApiModelProperty(value = "是否重复性使用物料 0:否1:是")
|
||||
private String reuseState;
|
||||
|
||||
/**
|
||||
* 预估年使用量
|
||||
*/
|
||||
@ApiModelProperty(value = "预估年使用量")
|
||||
@ExcelColumn("预估年使用量")
|
||||
private Integer useOfYear;
|
||||
|
||||
/**
|
||||
* 是否一次性使用物料 0:否1:是
|
||||
*/
|
||||
@ApiModelProperty(value = "是否一次性使用物料 0:否1:是")
|
||||
private Integer reuseOfOnceState;
|
||||
|
||||
@ApiModelProperty("是否一次性使用物料")
|
||||
@ExcelColumn("是否一次性使用物料")
|
||||
private String reuseOfOnceStateName;
|
||||
|
||||
@ApiModelProperty("物料重用性")
|
||||
private String reUserState;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
@ExcelColumn("备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 两年出库量
|
||||
*/
|
||||
@ApiModelProperty(value = "两年出库量")
|
||||
@ExcelColumn("两年出库量")
|
||||
private String towYearLssl;
|
||||
|
||||
/**
|
||||
* 两年出库天次
|
||||
*/
|
||||
@ApiModelProperty(value = "两年出库天次")
|
||||
@ExcelColumn("两年出库天次")
|
||||
private String towYearLsslDay;
|
||||
|
||||
/**
|
||||
* 库存量
|
||||
*/
|
||||
@ApiModelProperty(value = "库存量")
|
||||
@ExcelColumn("库存量")
|
||||
private String materialStock;
|
||||
|
||||
/**
|
||||
* 最近采购价格
|
||||
*/
|
||||
@ApiModelProperty(value = "最近采购价格")
|
||||
@ExcelColumn("最近采购价格")
|
||||
private String lastPurchasePrice;
|
||||
|
||||
/**
|
||||
* 最近采购日期
|
||||
*/
|
||||
@ApiModelProperty(value = "最近采购日期")
|
||||
@ExcelColumn("最近采购日期")
|
||||
private String lastPurchaseDate;
|
||||
|
||||
/**
|
||||
* 订单保护价
|
||||
*/
|
||||
@ApiModelProperty(value = "订单保护价")
|
||||
@ExcelColumn("订单保护价")
|
||||
private String orderProtectPrice;
|
||||
|
||||
/**
|
||||
* 配件销售价
|
||||
*/
|
||||
@ApiModelProperty(value = "配件销售价")
|
||||
@ExcelColumn("配件销售价")
|
||||
private String partsSalePrice;
|
||||
|
||||
/**
|
||||
* 物料状态 1:正常 2:禁止采购 3:售后专用 4:冻结 5:完全弃用
|
||||
*/
|
||||
@ApiModelProperty(value = "物料状态 1:正常(激活) 2:禁止采购 3:售后专用 4:禁用(冻结) 5:完全弃用")
|
||||
@ExcelColumn("物料状态 1:禁用 0:启用")
|
||||
private Integer materialState;
|
||||
|
||||
@ApiModelProperty(value = "物料状态名称")
|
||||
@ExcelColumn("物料状态名称")
|
||||
private Integer materialStateName;
|
||||
|
||||
/**
|
||||
* 使用说明
|
||||
*/
|
||||
@ApiModelProperty(value = "使用说明")
|
||||
@ExcelColumn("使用说明")
|
||||
private String useRemark;
|
||||
|
||||
/**
|
||||
* 最近出库时间
|
||||
*/
|
||||
@TableField(value = "last_out_warehouse_time")
|
||||
@ApiModelProperty(value = "最近出库时间")
|
||||
private String lastOutWarehouseTime;
|
||||
|
||||
/**
|
||||
* 申请人编码
|
||||
*/
|
||||
@TableField(value = "apply_user_code")
|
||||
@ApiModelProperty(value = "申请人编码")
|
||||
private String applyUserCode;
|
||||
|
||||
/**
|
||||
* 申请部门
|
||||
*/
|
||||
@TableField(value = "apply_dept_name")
|
||||
@ApiModelProperty(value = "申请部门")
|
||||
private String applyDeptName;
|
||||
|
||||
/**
|
||||
* 变更审请人
|
||||
*/
|
||||
@TableField(value = "updated_by_user_code")
|
||||
@ApiModelProperty(value = "变更审请人")
|
||||
private String updatedByUserCode;
|
||||
|
||||
private LocalDateTime lastApplyTime;
|
||||
|
||||
/**
|
||||
* 替代物料
|
||||
*/
|
||||
@TableField(value = "replace_material_no")
|
||||
@ApiModelProperty(value = "替代物料")
|
||||
private String replaceMaterialNo;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updatedBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updatedTime;
|
||||
|
||||
/**
|
||||
* 物料规格
|
||||
*/
|
||||
@ApiModelProperty(value = "物料规格")
|
||||
@ExcelColumn("物料规格")
|
||||
private String materialSpecifications;
|
||||
|
||||
/**
|
||||
* 是否标准件:0:否 1:是
|
||||
*/
|
||||
@ApiModelProperty(value = "是否标准件:0:否 1:是")
|
||||
private Integer standardState;
|
||||
|
||||
/**
|
||||
* 物料类型:0:外购 1:自制
|
||||
*/
|
||||
@ApiModelProperty(value = "物料类型:0:外购 1:自制")
|
||||
private Integer materialType;
|
||||
|
||||
/**
|
||||
* 流程状态:0:申请中 1:已审核
|
||||
*/
|
||||
@ApiModelProperty(value = "流程状态:0:待提交 2:已驳回 5: 变更申请中 10:申请审核中 15:已审核")
|
||||
private Integer processState;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "流程状态名称")
|
||||
private Integer processStateName;
|
||||
|
||||
/**
|
||||
* 旧物料分类编码
|
||||
*/
|
||||
@ApiModelProperty(value = "旧物料分类编码")
|
||||
@ExcelColumn("旧物料分类编码")
|
||||
private String oldMaterialCategoryCode;
|
||||
|
||||
/**
|
||||
* 物料分类编码
|
||||
*/
|
||||
@ApiModelProperty(value = "物料分类编码")
|
||||
private String materialCategoryCode;
|
||||
|
||||
/**
|
||||
* 物料图片
|
||||
*/
|
||||
@ApiModelProperty("物料图片")
|
||||
private String picUrl = "";
|
||||
|
||||
|
||||
@ApiModelProperty("是否已收藏 0:否 1:是")
|
||||
private Integer favoritesState;
|
||||
|
||||
@ApiModelProperty("物料分类编码前两位")
|
||||
private String preTwoCateGory;
|
||||
|
||||
@ApiModelProperty("材质")
|
||||
private String materialTexture;
|
||||
|
||||
@ApiModelProperty(value = "旧分类名称树(如:采购物料/原材料/板材)")
|
||||
private String oldCategoryNameTree;
|
||||
|
||||
@ApiModelProperty("对应的物料大类")
|
||||
private String relCategoryCode;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "是否使用类别通用外形图:1=不使用、2=使用")
|
||||
private Integer commonZeroFile;
|
||||
|
||||
@ApiModelProperty(value = "制作物料获取类型:1=自制、2=外协、3=采购")
|
||||
private Integer materialGetType;
|
||||
|
||||
// 变更原因
|
||||
private String updateResion;
|
||||
|
||||
private String categoryNameTree;
|
||||
|
||||
/**
|
||||
* 项目类别
|
||||
*/
|
||||
@ApiModelProperty(value = "项目类别")
|
||||
private String projectType;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 新增虚拟包-参数
|
||||
*/
|
||||
@Data
|
||||
public class AddVirtrualMaterialDTO {
|
||||
|
||||
private String key;
|
||||
private String drawingNo;
|
||||
private String materialName;
|
||||
private String materialDesc ;
|
||||
private String materialCategoryCode;
|
||||
|
||||
@ApiModelProperty("申请后返回的物料编码")
|
||||
private String materialNo;
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
|
||||
/**
|
||||
* @decription
|
||||
* @Author 大米
|
||||
* @Date 2022/8/9 14:03
|
||||
**/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class CategoryExcelDTO extends BaseImportExcelDTO {
|
||||
|
||||
public CategoryExcelDTO(){
|
||||
|
||||
}
|
||||
|
||||
@ExcelColumn("大类代码")
|
||||
private String firstCategoryCode;
|
||||
@ExcelColumn("大类名称")
|
||||
private String firstCategoryName;
|
||||
|
||||
@ExcelColumn("中类代码")
|
||||
private String secondCategoryCode;
|
||||
|
||||
@ExcelColumn("中类名称")
|
||||
private String secondCategoryName;
|
||||
|
||||
@ExcelColumn("小类代码")
|
||||
private String thirdCategoryCode;
|
||||
|
||||
@ExcelColumn("小类名称")
|
||||
private String thirdCategoryName;
|
||||
|
||||
@ExcelColumn("细分类代码")
|
||||
private String fourthCategoryCode;
|
||||
|
||||
@ExcelColumn("细分类名称")
|
||||
private String fourthCategoryName;
|
||||
|
||||
@ExcelColumn("状态")
|
||||
private String enableState;
|
||||
|
||||
|
||||
private String rowId;
|
||||
private String categoryCode;
|
||||
private String categoryName;
|
||||
|
||||
private String parentTree;
|
||||
|
||||
@ApiModelProperty("对应的物料大类")
|
||||
@ExcelColumn("对应的物料大类")
|
||||
private String relCategoryCode;
|
||||
|
||||
private int rowNum;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FlowNumberDto {
|
||||
|
||||
private int nextId;//下一个ID
|
||||
private int nextNum;//下一个流水
|
||||
private String prefix;//下一个前缀
|
||||
private String suffix;//下一个后缀
|
||||
private String flowNumber;//下一个流水号
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @decription
|
||||
* @Author 大米
|
||||
* @Date 2022/9/21 11:27
|
||||
**/
|
||||
@Data
|
||||
public class OaResult {
|
||||
|
||||
@ApiModelProperty("物料号")
|
||||
private String MATNR;
|
||||
|
||||
@ApiModelProperty("oa行ID")
|
||||
private Long instId;
|
||||
|
||||
// 图号
|
||||
private String MNUMB;
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.nflg.product.bomnew.pojo.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* (MaterialFlowNumber)$desc
|
||||
*
|
||||
* @author 大米
|
||||
* @since 2022-08-06 11:34:07
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "com-nflg-product-material-pojo-entity-MaterialFlowNumberEntity")
|
||||
@TableName(value = "t_material_flow_number")
|
||||
public class MaterialFlowNumberEntity implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "row_id", type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "")
|
||||
private Long rowId;
|
||||
|
||||
/**
|
||||
* 流水号前缀
|
||||
*/
|
||||
@TableField(value = "flow_prefix")
|
||||
@ApiModelProperty(value = "流水号前缀")
|
||||
private String flowPrefix;
|
||||
|
||||
/**
|
||||
* 当前到达流水
|
||||
*/
|
||||
@TableField(value = "flow_num")
|
||||
@ApiModelProperty(value = "当前到达流水")
|
||||
private Integer flowNum;
|
||||
|
||||
/**
|
||||
* 倍数
|
||||
*/
|
||||
@TableField(value = "flow_multiple")
|
||||
@ApiModelProperty(value = "倍数")
|
||||
private String flowMultiple;
|
||||
|
||||
/**
|
||||
* 最大流水
|
||||
*/
|
||||
@TableField(value = "max_num")
|
||||
@ApiModelProperty(value = "最大流水")
|
||||
private Integer maxNum;
|
||||
|
||||
/**
|
||||
* 失败流水号
|
||||
*/
|
||||
@TableField(value = "left_num")
|
||||
@ApiModelProperty(value = "失败流水号")
|
||||
private String leftNum;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
@ApiModelProperty(value = "说明")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 重置模式(NONE不重置,DAY按天重置,MONTH按月重置,YEAR按年重置)
|
||||
*/
|
||||
@TableField(value = "reset_mode")
|
||||
@ApiModelProperty(value = "重置模式(NONE不重置,DAY按天重置,MONTH按月重置,YEAR按年重置)")
|
||||
private String resetMode;
|
||||
|
||||
/**
|
||||
* 上一次重置时间
|
||||
*/
|
||||
@TableField(value = "reset_time")
|
||||
@ApiModelProperty(value = "上一次重置时间")
|
||||
private Date resetTime;
|
||||
|
||||
/**
|
||||
* 行变更时间
|
||||
*/
|
||||
@TableField(value = "data_modify_time", fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "行变更时间")
|
||||
private Date dataModifyTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
|
||||
import com.nflg.product.bomnew.mapper.master.MaterialFlowNumberMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.FlowNumberDto;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialFlowNumberEntity;
|
||||
import lombok.Synchronized;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* (MaterialFlowNumber)$desc
|
||||
*
|
||||
* @author 大米
|
||||
* @since 2022-08-06 11:34:07
|
||||
*/
|
||||
@Service
|
||||
public class MaterialFlowNumberService extends ServiceImpl<MaterialFlowNumberMapper, MaterialFlowNumberEntity> {
|
||||
@Synchronized
|
||||
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||
public List<FlowNumberDto> getFlowNumber(String prefix, int needNum, boolean needDate, boolean needPreFix) {
|
||||
|
||||
//获取流水信息
|
||||
MaterialFlowNumberEntity flowNumber = this.lambdaQuery().eq(MaterialFlowNumberEntity::getFlowPrefix, prefix).one();
|
||||
if (flowNumber == null || flowNumber.getFlowNum() == null || flowNumber.getFlowNum() < 0) {
|
||||
throw new NflgBusinessException(STATE.BusinessError, "未找到该前缀流水号配置:" + prefix);
|
||||
}
|
||||
//当前流水号
|
||||
int flowNum = flowNumber.getFlowNum();
|
||||
int maxNum = flowNumber.getMaxNum();
|
||||
String multipleFormat = flowNumber.getFlowMultiple();
|
||||
String timeStr = "";
|
||||
if (needDate) {
|
||||
timeStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
}
|
||||
List<FlowNumberDto> list = new ArrayList<>();
|
||||
while (needNum > 0) {
|
||||
FlowNumberDto dto = new FlowNumberDto();
|
||||
dto.setPrefix(prefix);
|
||||
dto.setNextNum(++flowNum);
|
||||
String nextSuffix = new DecimalFormat(multipleFormat).format(dto.getNextNum());
|
||||
String nextFlow = (needPreFix ? dto.getPrefix() : "") + (needDate ? timeStr : "") + nextSuffix;
|
||||
|
||||
dto.setFlowNumber(nextFlow);
|
||||
dto.setSuffix(nextSuffix);
|
||||
list.add(dto);
|
||||
needNum--;
|
||||
}
|
||||
flowNumber.setFlowNum(flowNum);
|
||||
//更新flowNum
|
||||
this.updateById(flowNumber);
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.product.bomnew.service;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
|
|
@ -8,33 +9,43 @@ import cn.hutool.core.date.DateUtil;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
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.config.NacosConfig;
|
||||
import com.nflg.product.bomnew.pojo.dto.AddMaterialResultDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.MaterialMainDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.util.HttpUtils;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import com.nflg.product.bomnew.util.FlowUtil;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MaterialService {
|
||||
|
||||
|
||||
@Resource
|
||||
MaterialMainClient materialMainClient;
|
||||
@Resource
|
||||
MaterialMainService materialMainService;
|
||||
|
||||
/**
|
||||
* 申请物料
|
||||
|
|
@ -149,4 +160,225 @@ public class MaterialService {
|
|||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
//****************************************本地生成,不调主数据**************************************************
|
||||
public Map<String,AddVirtrualMaterialDTO> batchAddMaterial(List<AddVirtrualMaterialDTO> mds){
|
||||
List<MaterialMainEntity> resultList=new ArrayList<>();
|
||||
|
||||
List<AddMaterialMainDTO> syncOaEnts=new ArrayList<>();
|
||||
Map<String,AddVirtrualMaterialDTO> result = new HashMap<>();
|
||||
for (AddVirtrualMaterialDTO md :mds) {
|
||||
String relMaterialCategory = materialMainService.getBaseMapper().getMaterialCategory(md.getMaterialCategoryCode());
|
||||
MaterialMainEntity ma =new MaterialMainEntity();
|
||||
ma.setRowId(IdWorker.getId());
|
||||
ma.setMaterialNo(generateMaterialNo(ma.getMaterialCategoryCode(),relMaterialCategory));
|
||||
ma.setDrawingNo(md.getDrawingNo());
|
||||
ma.setMaterialName(md.getMaterialName());
|
||||
ma.setMaterialDesc(md.getMaterialDesc());
|
||||
ma.setMaterialCategoryCode(md.getMaterialCategoryCode());
|
||||
ma.setCreatedBy(SessionUtil.getUserCode());
|
||||
ma.setCreatedTime(LocalDateTime.now());
|
||||
ma.setUpdatedBy(SessionUtil.getUserCode());
|
||||
ma.setUpdatedTime(LocalDateTime.now());
|
||||
ma.setMaterialClass(0);
|
||||
ma.setProcessState(0);
|
||||
ma.setApplyUserCode(SessionUtil.getRealName());
|
||||
resultList.add(ma);
|
||||
|
||||
AddMaterialMainDTO ent=new AddMaterialMainDTO();
|
||||
BeanUtil.copyProperties(ma,ent);
|
||||
ent.setRelCategoryCode(relMaterialCategory);
|
||||
ent.setReuseOfOnceState(0);
|
||||
syncOaEnts.add(ent);
|
||||
|
||||
md.setMaterialNo(ma.getMaterialNo());
|
||||
result.put(md.getKey(),md);
|
||||
}
|
||||
materialMainService.saveOrUpdateBatch(resultList);
|
||||
initCategoryInfo(syncOaEnts);
|
||||
//同步OA
|
||||
sysnToOa(syncOaEnts);
|
||||
return result;
|
||||
}
|
||||
|
||||
private void checkMaterial(List<AddVirtrualMaterialDTO> mds){
|
||||
List<AddVirtrualMaterialDTO> noCateGoryCodes = mds.stream().filter(u -> StrUtil.isBlank(u.getMaterialCategoryCode())).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noCateGoryCodes)).throwMessage("最小物料类别不能为空");
|
||||
|
||||
List<AddVirtrualMaterialDTO> noMaterialDescs = mds.stream().filter(u -> StrUtil.isBlank(u.getMaterialDesc())).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noMaterialDescs)).throwMessage("物料描述不能为空");
|
||||
|
||||
//
|
||||
// List<MaterialMainEntity> materialDescList = materialMainService.lambdaQuery().in(MaterialMainEntity::getMaterialDesc, paramDto.getMaterialDesc()).list();
|
||||
// if (materialDescList.size() > 0) {
|
||||
// return ResultVO.error("该物料描述与已有物料的物料描述相同");
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化物料分类信息
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
public void initCategoryInfo(List<AddMaterialMainDTO> list) {
|
||||
|
||||
List<CategoryExcelDTO> categoryList = materialMainService.getBaseMapper().getList();
|
||||
Map<String, CategoryExcelDTO> cateogryMp = ListCommonUtil.listToMap(categoryList, CategoryExcelDTO::getCategoryCode);
|
||||
list.forEach(k -> {
|
||||
String first = StrUtil.padAfter(StrUtil.sub(k.getMaterialCategoryCode(), 0, 2), 2, '0');
|
||||
String second = StrUtil.padAfter(StrUtil.sub(k.getMaterialCategoryCode(), 0, 4), 4, '0');
|
||||
String third = StrUtil.padAfter(StrUtil.sub(k.getMaterialCategoryCode(), 0, 6), 6, '0');
|
||||
String fourth = StrUtil.padAfter(StrUtil.sub(k.getMaterialCategoryCode(), 0, 8), 8, '0');
|
||||
String oldCategoryNameTree = "";
|
||||
if (cateogryMp.containsKey(k.getMaterialCategoryCode())) {
|
||||
k.setRelCategoryCode(cateogryMp.get(k.getMaterialCategoryCode()).getRelCategoryCode());
|
||||
}
|
||||
if (cateogryMp.containsKey(first)) {
|
||||
k.setFirstMaterialCategoryRowId(cateogryMp.get(first).getRowId());
|
||||
k.setFirstMaterialCategoryCode(cateogryMp.get(first).getCategoryCode());
|
||||
k.setFirstMaterialCategoryName(cateogryMp.get(first).getCategoryName());
|
||||
oldCategoryNameTree += cateogryMp.get(first).getCategoryName().concat("/");
|
||||
}
|
||||
if (cateogryMp.containsKey(second)) {
|
||||
k.setSecondMaterialCategoryName(cateogryMp.get(second).getCategoryName());
|
||||
k.setSecondMaterialCategoryCode(cateogryMp.get(second).getCategoryCode());
|
||||
oldCategoryNameTree += cateogryMp.get(second).getCategoryName().concat("/");
|
||||
}
|
||||
if (cateogryMp.containsKey(third)) {
|
||||
k.setThirdMaterialCategoryName(cateogryMp.get(third).getCategoryName());
|
||||
k.setThirdMaterialCategoryCode(cateogryMp.get(third).getCategoryCode());
|
||||
if (cateogryMp.containsKey(fourth)) {
|
||||
oldCategoryNameTree += cateogryMp.get(third).getCategoryName().concat("/");
|
||||
} else {
|
||||
oldCategoryNameTree += cateogryMp.get(third).getCategoryName();
|
||||
}
|
||||
}
|
||||
if (cateogryMp.containsKey(fourth)) {
|
||||
k.setFourthMaterialCategoryName(cateogryMp.get(fourth).getCategoryName());
|
||||
k.setFourthMaterialCategoryCode(cateogryMp.get(fourth).getCategoryCode());
|
||||
oldCategoryNameTree += cateogryMp.get(fourth).getCategoryName();
|
||||
}
|
||||
k.setOldCategoryNameTree(oldCategoryNameTree);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成物料编码
|
||||
*
|
||||
* @param materialCategoryCode
|
||||
* @return
|
||||
*/
|
||||
public String generateMaterialNo(String materialCategoryCode ,String preCategory) {
|
||||
// String preCategory =materialMainService.getBaseMapper().getMaterialCategory(materialCategoryCode);
|
||||
if (StrUtil.isBlank(preCategory)) {
|
||||
throw new NflgBusinessException(STATE.ParamErr, materialCategoryCode.concat("未设置对应分类"));
|
||||
}
|
||||
|
||||
FlowNumberDto flow = FlowUtil.getFlowNumberOne("M_" + preCategory, false, false);
|
||||
if (Objects.isNull(flow)) {
|
||||
throw new NflgBusinessException(STATE.ParamErr, preCategory.concat(" 分类获取物料流水失败"));
|
||||
}
|
||||
return preCategory.concat(flow.getFlowNumber());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 物料同步OA
|
||||
* @param data
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void sysnToOa(List<AddMaterialMainDTO> data) {
|
||||
Map<String, Object> result = getHttpMap();
|
||||
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
data.forEach(u -> {
|
||||
Map<String, String> material = new LinkedHashMap<>();
|
||||
|
||||
String relCategoryCode = u.getRelCategoryCode();
|
||||
material.put("MATNR", u.getMaterialNo());
|
||||
material.put("MAKTX", StrUtil.isNotBlank(u.getShortMaterialDesc()) ? u.getShortMaterialDesc() : u.getMaterialDesc());
|
||||
material.put("dl", u.getSecondMaterialCategoryCode());
|
||||
material.put("xl", u.getThirdMaterialCategoryCode());
|
||||
material.put("xfl", u.getFourthMaterialCategoryCode());
|
||||
material.put("xl_copy", u.getThirdMaterialCategoryCode());
|
||||
material.put("MATKL", u.getThirdMaterialCategoryCode());
|
||||
material.put("MNAME", u.getMaterialName());
|
||||
material.put("MNUMB", u.getDrawingNo());
|
||||
material.put("MTEXT", u.getMaterialTexture());
|
||||
material.put("MSPEC", u.getMaterialSpecifications());
|
||||
material.put("MREMA", u.getMaterialDesc());
|
||||
material.put("MMANU", u.getMaterialBrand());
|
||||
material.put("ATTYP", relCategoryCode);
|
||||
material.put("ERNAM", "qhr11072925");
|
||||
material.put("MEINS", u.getMaterialUnit());
|
||||
material.put("DUPLICATEITEMS", u.getReuseOfOnceState().equals(1) ? "2" : "1");// 是否一次性使用物料 0:否1:是
|
||||
material.put("categoryTreeName", u.getCategoryNameTree());
|
||||
|
||||
if (StringUtils.isNotEmpty(String.valueOf(u.getUseOfYear()))) {
|
||||
material.put("USAGEYEAR", String.valueOf(u.getUseOfYear()));
|
||||
}
|
||||
|
||||
material.put("picUrl", u.getPicUrl());
|
||||
list.add(material);
|
||||
});
|
||||
result.put("List", list);
|
||||
log.error("物料申请-JSON:" + JSONArray.toJSONString(list));
|
||||
HttpUtils httpUtils = new HttpUtils();
|
||||
try {
|
||||
String url = NacosConfig.getNacosConfig().getOaUrl();
|
||||
String reqResult = httpUtils.doPost(url, JSON.toJSONString(result));
|
||||
JSONObject jsonObject = JSONObject.parseObject(reqResult);
|
||||
Boolean postResult = jsonObject.getBoolean("success");
|
||||
if (postResult) {
|
||||
String resultData = jsonObject.getString("data");
|
||||
List<OaResult> da = JSON.parseArray(resultData, OaResult.class);
|
||||
handlerResult(da);
|
||||
|
||||
} else {
|
||||
String message = jsonObject.getString("message");
|
||||
message = StrUtil.isNotBlank(message) ? message : "";
|
||||
throw new NflgBusinessException(STATE.BusinessError, "同步OA出错".concat(message));
|
||||
}
|
||||
// return null;
|
||||
} catch (Exception ex) {
|
||||
throw new NflgBusinessException(STATE.BusinessError, "同步OA出错" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> getHttpMap() {
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("userid", "qhr11072925");
|
||||
result.put("summary", NacosConfig.getNacosConfig().getSummary());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handlerResult(List<OaResult> data) {
|
||||
if (CollectionUtil.isEmpty(data)) {
|
||||
return;
|
||||
}
|
||||
List<String> materialNoList = data.stream().map(OaResult::getMATNR).distinct().collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(materialNoList)) {
|
||||
log.info("没有找到物料编码");
|
||||
return;
|
||||
}
|
||||
List<MaterialMainEntity> entityList = materialMainService.lambdaQuery().in(MaterialMainEntity::getMaterialNo, materialNoList).list();
|
||||
if (CollectionUtil.isEmpty(entityList)) {
|
||||
log.info("没有找到物料");
|
||||
return;
|
||||
}
|
||||
|
||||
for (MaterialMainEntity materialMainEntity : entityList) {
|
||||
Optional<OaResult> optional = data.stream().filter(item -> item.getMATNR().equals(materialMainEntity.getMaterialNo())).findFirst();
|
||||
if (optional.isPresent()) {
|
||||
OaResult oaResult = optional.get();
|
||||
materialMainEntity.setOaRowId(oaResult.getInstId());
|
||||
materialMainEntity.setProcessState(100);
|
||||
}
|
||||
}
|
||||
materialMainService.updateBatchById(entityList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import com.nflg.product.bomnew.constant.EBomSourceEnum;
|
|||
import com.nflg.product.bomnew.constant.EbomEditStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.ProjectTypeInputTypeEnum;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.dto.AddMaterialMainDTO;
|
||||
import com.nflg.product.bomnew.pojo.dto.AddVirtrualMaterialDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
|
|
@ -27,9 +29,7 @@ import sun.security.krb5.internal.PAData;
|
|||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -50,37 +50,76 @@ public abstract class VirtualPackageBase {
|
|||
@ApiModelProperty("虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包")
|
||||
protected List<Integer> virtualPackageValue;
|
||||
|
||||
protected BomNewEbomParentEntity buildParentVirtualPackage(String drawingNo, String materialName, VirtualPackageTypeEnum virtualPackageType) throws IOException {
|
||||
//申请物料
|
||||
//虚拟包编码
|
||||
protected Map<String, AddVirtrualMaterialDTO> vMNos=new HashMap<>();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 申请虚拟包
|
||||
* @param child
|
||||
* @param virtualPackageTypeEnums
|
||||
* @return
|
||||
*/
|
||||
protected void generateVMNo(List<BomNewEbomParentVO> child,VirtualPackageTypeEnum ... virtualPackageTypeEnums){
|
||||
List<AddVirtrualMaterialDTO> params=new ArrayList<>();
|
||||
for ( BomNewEbomParentVO ch: child ) {
|
||||
for (VirtualPackageTypeEnum vpy : virtualPackageTypeEnums) {
|
||||
params.add(buildAddMaterialParamDo(StrUtil.join("",ch.getRowId().toString(), vpy.getConMaterialName()), ch.getDrawingNo(), ch.getMaterialName(), vpy));
|
||||
}
|
||||
}
|
||||
List<AddVirtrualMaterialDTO> addM = params.stream().filter(u -> StrUtil.isBlank(u.getMaterialNo())).collect(Collectors.toList());
|
||||
vMNos= SpringUtil.getBean(MaterialService.class).batchAddMaterial(addM);
|
||||
|
||||
}
|
||||
|
||||
//申请物料编码
|
||||
private AddVirtrualMaterialDTO buildAddMaterialParamDo(String key, String drawingNo, String materialName, VirtualPackageTypeEnum virtualPackageType){
|
||||
|
||||
String vDrawingNo = String.join("","(",drawingNo,")","(",virtualPackageType.getConMaterialName(),")" );
|
||||
String vMaterialName = StrUtil.join("","(",materialName,")","(",virtualPackageType.getConMaterialName(),")");
|
||||
String vMaterialDesc = StrUtil.join("", "(",drawingNo,")" ,"(", materialName,")","(",virtualPackageType.getConMaterialName(),")");
|
||||
BomNewEbomParentEntity oldParent=null;
|
||||
List<MaterialMainEntity> oldMaterialList = SpringUtil.getBean(MaterialMainService.class).lambdaQuery().eq(MaterialMainEntity::getMaterialName, vMaterialName)
|
||||
.eq(MaterialMainEntity::getMaterialDesc, vMaterialDesc).list();
|
||||
|
||||
List<MaterialMainEntity> oldMaterialList = SpringUtil.getBean(MaterialMainService.class).lambdaQuery().eq(MaterialMainEntity::getDrawingNo, vDrawingNo)
|
||||
.list();
|
||||
AddVirtrualMaterialDTO ent=new AddVirtrualMaterialDTO();
|
||||
if(CollUtil.isNotEmpty(oldMaterialList)){
|
||||
oldParent= SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, oldMaterialList.get(0).getMaterialNo()).eq(BomNewEbomParentEntity::getLastVersionIs,1).one();
|
||||
ent.setKey(key);
|
||||
ent.setDrawingNo(vDrawingNo);
|
||||
ent.setMaterialNo(oldMaterialList.get(0).getMaterialNo());
|
||||
ent.setMaterialName(oldMaterialList.get(0).getMaterialName());
|
||||
ent.setMaterialDesc(oldMaterialList.get(0).getMaterialDesc());
|
||||
ent.setMaterialCategoryCode(oldMaterialList.get(0).getMaterialCategoryCode());
|
||||
}
|
||||
else {
|
||||
ent.setKey(key);
|
||||
ent.setDrawingNo(vDrawingNo);
|
||||
ent.setMaterialName(vMaterialName);
|
||||
ent.setMaterialDesc(vMaterialDesc);
|
||||
ent.setMaterialCategoryCode(virtualPackageType.getMaterialCategoryCode());
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
protected BomNewEbomParentEntity buildParentVirtualPackage(Long rowId,VirtualPackageTypeEnum virtualPackageTypeEnum) throws IOException {
|
||||
|
||||
AddVirtrualMaterialDTO addM = vMNos.get(StrUtil.join("",rowId,virtualPackageTypeEnum.getConMaterialName()));
|
||||
BomNewEbomParentEntity oldParent= SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, addM.getMaterialNo()).eq(BomNewEbomParentEntity::getLastVersionIs,1).one();
|
||||
|
||||
if(Objects.nonNull(oldParent)){
|
||||
oldParent.setLastVersionIs(0);
|
||||
this.parentResult.add(oldParent);
|
||||
}
|
||||
if(!VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.equalsValue(virtualPackageType.getValue())){
|
||||
drawingNo="";
|
||||
}
|
||||
else {
|
||||
drawingNo= vDrawingNo;
|
||||
}
|
||||
String materialDesc= drawingNo+vMaterialName;
|
||||
|
||||
String materialNo = SpringUtil.getBean(MaterialService.class).addMaterial(drawingNo, vMaterialName,materialDesc, virtualPackageType.getMaterialCategoryCode());
|
||||
|
||||
// String materialNo = SpringUtil.getBean(MaterialService.class).addMaterial(drawingNo, vMaterialName,materialDesc, virtualPackageType.getMaterialCategoryCode());
|
||||
BomNewEbomParentEntity parent =new BomNewEbomParentEntity();
|
||||
parent.setRowId(IdWorker.getId());
|
||||
parent.setOrderNumber("001");
|
||||
parent.setDrawingNo(vDrawingNo );
|
||||
parent.setMaterialNo(materialNo);
|
||||
parent.setMaterialName(vMaterialName);
|
||||
parent.setMaterialDesc(vMaterialDesc);
|
||||
parent.setDrawingNo(addM.getDrawingNo() );
|
||||
parent.setMaterialNo(addM.getMaterialNo());
|
||||
parent.setMaterialName(addM.getMaterialName());
|
||||
parent.setMaterialDesc(addM.getMaterialDesc());
|
||||
parent.setCurrentVersion(VersionUtil.getNextVersion(Objects.nonNull(oldParent)?oldParent.getCurrentVersion():""));
|
||||
parent.setVirtualPackageIs(1);
|
||||
// parent.setProjectType("L");
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.nflg.product.bomnew.service.domain.EBom;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.dto.AddVirtrualMaterialDTO;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
|
|
@ -29,19 +32,32 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
|
|||
this.virtualPackageValue = virtualPackageValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 31物料生成虚拟包
|
||||
*/
|
||||
@Override
|
||||
public void generateVirtualPackage() throws IOException {
|
||||
|
||||
|
||||
BomNewEbomParentEntity parent = getParentByRowId(bomRowId);
|
||||
BomNewEbomParentVO vo= Convert.convert(BomNewEbomParentVO.class,parent );
|
||||
|
||||
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
|
||||
generateVMNo(ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
}
|
||||
else {
|
||||
generateVMNo(ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
}
|
||||
|
||||
|
||||
BomNewEbomParentEntity makingPackage=null;
|
||||
if((parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.MAKING_PACKAGE.getValue())!=VirtualPackageTypeEnum.MAKING_PACKAGE.getValue()) {
|
||||
//构建构建发货包下制作包
|
||||
makingPackage = buildParentVirtualPackage(parent.getDrawingNo(), parent.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE);
|
||||
makingPackage = buildParentVirtualPackage( parent.getRowId(), VirtualPackageTypeEnum.MAKING_PACKAGE);
|
||||
//构建构建发货包下直发
|
||||
BomNewEbomParentEntity directDeliveryPackage = buildParentVirtualPackage(parent.getDrawingNo(), parent.getMaterialName(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
BomNewEbomParentEntity directDeliveryPackage = buildParentVirtualPackage(parent.getRowId(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
//构建产品-子级为制作包合直发包
|
||||
buildChild(makingPackage, bomRowId, "001", VirtualPackageTypeEnum.MAKING_PACKAGE,parent.getMaterialNo());
|
||||
buildChild(directDeliveryPackage, bomRowId, "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,parent.getMaterialNo());
|
||||
|
|
@ -52,7 +68,7 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
|
|||
if(Objects.isNull(makingPackage)){
|
||||
makingPackage=getParentZhiZuo();
|
||||
}
|
||||
BomNewEbomParentEntity preAssemblyPackage = buildParentVirtualPackage(parent.getDrawingNo(), parent.getMaterialName(), VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
BomNewEbomParentEntity preAssemblyPackage = buildParentVirtualPackage(parent.getRowId(), VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
buildChild(preAssemblyPackage, makingPackage.getRowId(), "001", VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE,parent.getMaterialNo());
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.nflg.product.bomnew.service.domain.EBom;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.VirtualPackageTypeEnum;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
|
|
@ -10,6 +12,7 @@ import com.nflg.product.bomnew.util.VUtils;
|
|||
import nflg.product.common.constant.STATE;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
|
|
@ -38,16 +41,29 @@ public class VirtualPackageFor31 extends VirtualPackageBase {
|
|||
BomNewEbomParentEntity parent = getParentByRowId(bomRowId);
|
||||
|
||||
try {
|
||||
//生成虚拟包
|
||||
if(CollUtil.isNotEmpty(child)) {
|
||||
if (virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue() & parent.getVirtrualPackageEnum()) != VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
|
||||
generateVMNo(child , VirtualPackageTypeEnum.DELIVERY_PACKAGE,VirtualPackageTypeEnum.MAKING_PACKAGE
|
||||
,VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE, VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
}
|
||||
else {
|
||||
generateVMNo(child, VirtualPackageTypeEnum.DELIVERY_PACKAGE, VirtualPackageTypeEnum.MAKING_PACKAGE
|
||||
, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (BomNewEbomParentVO item : child) {
|
||||
BomNewEbomParentEntity makingPackage=null;
|
||||
if((VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue()&parent.getVirtrualPackageEnum())!=VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue()) {
|
||||
//构建发货包
|
||||
BomNewEbomParentEntity deliveryPackage = buildParentVirtualPackage(item.getDrawingNo(), item.getMaterialName(), VirtualPackageTypeEnum.DELIVERY_PACKAGE);
|
||||
BomNewEbomParentEntity deliveryPackage = buildParentVirtualPackage(item.getRowId(), VirtualPackageTypeEnum.DELIVERY_PACKAGE);
|
||||
//构建构建发货包下制作包
|
||||
makingPackage = buildParentVirtualPackage(item.getDrawingNo(), item.getMaterialName(), VirtualPackageTypeEnum.MAKING_PACKAGE);
|
||||
makingPackage = buildParentVirtualPackage(item.getRowId(), VirtualPackageTypeEnum.MAKING_PACKAGE);
|
||||
//构建构建发货包下直发
|
||||
BomNewEbomParentEntity directDeliveryPackage = buildParentVirtualPackage(item.getDrawingNo(), item.getMaterialName(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
BomNewEbomParentEntity directDeliveryPackage = buildParentVirtualPackage(item.getRowId(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
|
||||
//构建-产品下发货包-子级
|
||||
buildChild(deliveryPackage, bomRowId, "001", VirtualPackageTypeEnum.DELIVERY_PACKAGE,parent.getMaterialNo());
|
||||
|
|
@ -63,7 +79,7 @@ public class VirtualPackageFor31 extends VirtualPackageBase {
|
|||
}
|
||||
// 包含发货前装配包
|
||||
if (virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue() & parent.getVirtrualPackageEnum()) != VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) {
|
||||
BomNewEbomParentEntity preAssemblyPackage = buildParentVirtualPackage(item.getDrawingNo(), item.getMaterialName(), VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
BomNewEbomParentEntity preAssemblyPackage = buildParentVirtualPackage(item.getRowId(), VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
//构建构建发货前装配包
|
||||
if(Objects.isNull(makingPackage)){
|
||||
makingPackage=getParentZhiZuo();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.nflg.product.bomnew.util;
|
||||
|
||||
|
||||
import com.nflg.product.base.core.config.SpringContextUtils;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.pojo.dto.FlowNumberDto;
|
||||
import com.nflg.product.bomnew.service.MaterialFlowNumberService;
|
||||
|
||||
import nflg.product.common.constant.STATE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @decription
|
||||
* @Author 大米
|
||||
* @Date 2022/8/6 11:57
|
||||
**/
|
||||
public class FlowUtil {
|
||||
|
||||
public static List<FlowNumberDto> getFlowNumber(String prefix, int needNum, boolean needDate, boolean needPreFix) {
|
||||
return SpringContextUtils.getBean(MaterialFlowNumberService.class).getFlowNumber(prefix, needNum, needDate, needPreFix);
|
||||
}
|
||||
|
||||
|
||||
public static FlowNumberDto getFlowNumberOne(String prefix, boolean needDate, boolean needPreFix) {
|
||||
try {
|
||||
return SpringContextUtils.getBean(MaterialFlowNumberService.class).getFlowNumber(prefix, 1, needDate, needPreFix).get(0);
|
||||
} catch (Exception ex) {
|
||||
throw new NflgBusinessException(STATE.ParamErr, "生成流水号出错" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -201,6 +201,41 @@ public class HttpUtils {
|
|||
return response.body().string();
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求(JSON)
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param json json字符串
|
||||
* @return String
|
||||
* @throws IOException e
|
||||
*/
|
||||
public String doPost(String url, String json) throws IOException {
|
||||
System.out.println(url);
|
||||
System.out.println(json);
|
||||
Response response = doPostRtnRsp(url, json);
|
||||
if (response == null || response.body() == null) {
|
||||
return null;
|
||||
}
|
||||
return response.body().string();
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求(JSON)
|
||||
*
|
||||
* @param url URL地址
|
||||
* @param json json字符串
|
||||
* @return Response
|
||||
* @throws IOException e
|
||||
*/
|
||||
public Response doPostRtnRsp(String url, String json) throws IOException {
|
||||
RequestBody requestBody = RequestBody.create(jsonMediaType, json);
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.post(requestBody)
|
||||
.build();
|
||||
return getOkHttpClient().newCall(request).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* post请求(JSON)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nflg.product.bomnew.mapper.master.MaterialFlowNumberMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.nflg.product.bomnew.pojo.entity.MaterialFlowNumberEntity">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table t_material_flow_number -->
|
||||
<id column="row_id" property="rowId" jdbcType="BIGINT"/>
|
||||
<result column="flow_prefix" property="flowPrefix" jdbcType="VARCHAR"/>
|
||||
<result column="flow_num" property="flowNum" jdbcType="INTEGER"/>
|
||||
<result column="flow_multiple" property="flowMultiple" jdbcType="VARCHAR"/>
|
||||
<result column="max_num" property="maxNum" jdbcType="INTEGER"/>
|
||||
<result column="left_num" property="leftNum" jdbcType="VARCHAR"/>
|
||||
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
||||
<result column="reset_mode" property="resetMode" jdbcType="VARCHAR"/>
|
||||
<result column="reset_time" property="resetTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="data_modify_time" property="dataModifyTime" jdbcType="TIMESTAMP"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
row_id, flow_prefix, flow_num, flow_multiple, max_num, left_num, remark, reset_mode, reset_time, data_modify_time
|
||||
</sql>
|
||||
|
||||
<sql id="where_time">
|
||||
<if test="query.resetTimeStart != null">
|
||||
AND #{query.resetTimeStart} <= number.reset_time
|
||||
</if>
|
||||
<if test="query.resetTimeStartEnd != null">
|
||||
AND number.reset_time <= #{query.resetTimeStartEnd}
|
||||
</if>
|
||||
|
||||
<if test="query.dataModifyTimeStart != null">
|
||||
AND #{query.dataModifyTimeStart} <= number.data_modify_time
|
||||
</if>
|
||||
<if test="query.dataModifyTimeStartEnd != null">
|
||||
AND number.data_modify_time <= #{query.dataModifyTimeStartEnd}
|
||||
</if>
|
||||
</sql>
|
||||
</mapper>
|
||||
|
|
@ -160,4 +160,13 @@
|
|||
select COUNT(1) from t_authority_role_user a join t_authority_role b on a.role_row_id=b.row_id
|
||||
where user_row_id=#{userRowId} and b.multiplant_factory_state=1 and b.enable_state=1
|
||||
</select>
|
||||
|
||||
<select id="getMaterialCategory" resultType="java.lang.String">
|
||||
select rel_category_code from t_material_category where category_code=#{categoryCode}
|
||||
</select>
|
||||
|
||||
<select id="getList" resultType="com.nflg.product.bomnew.pojo.dto.CategoryExcelDTO">
|
||||
select row_id, category_code, category_name, enable_state ,rel_category_code
|
||||
from t_material_category
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue