Browse Source

[update]:BOM导出功能

dev
youjianchi 9 months ago
parent
commit
af1fd1a062
  1. 3
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java
  2. 24
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java
  3. 2
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java
  4. 17
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  5. 40
      ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
  6. 2
      ruoyi-admin/src/main/resources/templates/erp/bom/edit.html

3
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java

@ -86,7 +86,8 @@ public class ErpBomController extends BaseController
@ResponseBody
public AjaxResult export(ErpBom erpBom)
{
List<ErpBom> list = erpBomService.selectErpBomList(erpBom);
erpBom.setParentId(0L);
List<ErpBom> list = erpBomService.getExportList(erpBom);
ExcelUtil<ErpBom> util = new ExcelUtil<ErpBom>(ErpBom.class);
return util.exportExcel(list, "bom数据");
}

24
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java

@ -25,64 +25,56 @@ public class ErpBom extends BaseEntity
private String delFlag;
/** bom号 */
@Excel(name = "bom号")
private String bomNo;
/** 料号 */
@Excel(name = "料号")
@Excel(name = "料号",sort = 2)
private String materialNo;
@Excel(name = "图片地址")
private String photoUrl;
/** 物料名称 */
@Excel(name = "物料名称")
@Excel(name = "品名",sort = 3)
private String materialName;
/** 物料类型 */
@Excel(name = "物料类型")
private String materialType;
/** 加工方式 */
@Excel(name = "加工方式")
@Excel(name = "半成品类型",sort = 6,dictType = "processMethod")
private String processMethod;
/** 单位 */
@Excel(name = "单位")
@Excel(name = "单位",sort = 7)
private String unit;
/** 品牌 */
@Excel(name = "品牌")
@Excel(name = "品牌",sort = 5)
private String brand;
/** 描述 */
@Excel(name = "描述")
@Excel(name = "描述",sort = 4)
private String describe;
/** 用量 */
@Excel(name = "用量")
@Excel(name = "用量",sort = 8)
private Long useNum;
/** 损耗率 */
@Excel(name = "损耗率")
private BigDecimal lossRate;
/** 父级id */
@Excel(name = "父级id")
private Long parentId;
/** 层级 */
@Excel(name = "层级")
@Excel(name = "展示层",sort = 1,dictType = "bomLevel")
private Long level;
/** 排序 */
@Excel(name = "排序")
private Long sortNo;
/** 审核状态 */
@Excel(name = "审核状态")
private String auditStatus;
/** 使用状态 */
@Excel(name = "使用状态")
private String useStatus;
/** bom信息 */

2
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java

@ -101,4 +101,6 @@ public interface IErpBomService
String checkMaterialNoUnique(String materialNo);
List<ErpBom> getExportList(ErpBom erpBom);
}

17
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java

@ -117,6 +117,7 @@ public class ErpBomServiceImpl implements IErpBomService
erpBom.setCreateBy(loginName);
erpBom.setCreateTime(DateUtils.getNowDate());
erpBom.setParentId(0L);
erpBom.setLevel(0L);
String billNo = redisCache.generateBillNo("BOM");
erpBom.setBomNo(billNo);
int rows = erpBomMapper.insertErpBom(erpBom);
@ -258,6 +259,22 @@ public class ErpBomServiceImpl implements IErpBomService
return "0";
}
@Override
public List<ErpBom> getExportList(ErpBom erpBom) {
List<ErpBom> resultList = new ArrayList<>();
List<ErpBom> zeroLevelList = erpBomMapper.selectErpBomList(erpBom);
if(CollectionUtils.isNotEmpty(zeroLevelList)){
for (ErpBom bom:zeroLevelList) {
resultList.add(bom);
ErpBom bom1 = new ErpBom();
bom1.setParentId(bom.getId());
List<ErpBom> subLevelList = selectErpBomAllLevelList(bom1);
resultList.addAll(subLevelList);
}
}
return resultList;
}
/**
* 新增bom信息
*

40
ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml

@ -162,15 +162,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="bomNo != null">#{bomNo},</if>
<if test="materialNo != null">#{materialNo},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialType != null">#{materialType},</if>
<if test="processMethod != null">#{processMethod},</if>
<if test="unit != null">#{unit},</if>
<if test="brand != null">#{brand},</if>
<if test="describe != null">#{describe},</if>
<if test="remark != null and remark != '' ">#{remark},</if>
<if test="bomNo != null and bomNo != '' ">#{bomNo},</if>
<if test="materialNo != null and materialNo != '' ">#{materialNo},</if>
<if test="materialName != null and materialName != '' ">#{materialName},</if>
<if test="materialType != null and materialType != '' ">#{materialType},</if>
<if test="processMethod != null and processMethod != '' ">#{processMethod},</if>
<if test="unit != null and unit != '' ">#{unit},</if>
<if test="brand != null and brand != '' ">#{brand},</if>
<if test="describe != null and describe != '' ">#{describe},</if>
<if test="useNum != null">#{useNum},</if>
<if test="lossRate != null">#{lossRate},</if>
<if test="parentId != null">#{parentId},</if>
@ -189,22 +189,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="bomNo != null">bom_no = #{bomNo},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialType != null">material_type = #{materialType},</if>
<if test="processMethod != null">process_method = #{processMethod},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="brand != null">brand = #{brand},</if>
<if test="describe != null">`describe` = #{describe},</if>
<if test="remark != null and remark != '' ">remark = #{remark},</if>
<if test="bomNo != null and bomNo != '' ">bom_no = #{bomNo},</if>
<if test="materialNo != null and materialNo != '' ">material_no = #{materialNo},</if>
<if test="materialName != null and materialName != '' ">material_name = #{materialName},</if>
<if test="materialType != null and materialType != '' ">material_type = #{materialType},</if>
<if test="processMethod != null and processMethod != '' ">process_method = #{processMethod},</if>
<if test="unit != null and unit != '' ">unit = #{unit},</if>
<if test="brand != null and brand != '' ">brand = #{brand},</if>
<if test="describe != null and describe != '' ">`describe` = #{describe},</if>
<if test="useNum != null">use_num = #{useNum},</if>
<if test="lossRate != null">loss_rate = #{lossRate},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="level != null">`level` = #{level},</if>
<if test="sortNo != null">sort_no = #{sortNo},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
<if test="auditStatus != null and auditStatus != '' ">audit_status = #{auditStatus},</if>
<if test="useStatus != null and useStatus != '' ">use_status = #{useStatus},</if>
</trim>
where id = #{id}
</update>

2
ruoyi-admin/src/main/resources/templates/erp/bom/edit.html

@ -353,7 +353,7 @@
id:rowData.subId,
materialNo: rowData.materialNo,
bomNo: rowData.bomNo,
level:rowData.level,
level: "1",
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,

Loading…
Cancel
Save