功能实现

main
Dayu 12 months ago
parent 3523de2d8f
commit fd9f7aa575
  1. 23
      src/main/java/org/energy/modules/spares/controller/MaterialController.java
  2. 19
      src/main/java/org/energy/modules/spares/controller/OutboundController.java
  3. 53
      src/main/java/org/energy/modules/spares/mapper/MaterialMapper.xml
  4. 5
      src/main/java/org/energy/modules/spares/mapper/OutboundMapper.java
  5. 4
      src/main/java/org/energy/modules/spares/mapper/OutboundMapper.xml
  6. 4
      src/main/java/org/energy/modules/spares/service/IMaterialService.java
  7. 5
      src/main/java/org/energy/modules/spares/service/IOutboundService.java
  8. 8
      src/main/java/org/energy/modules/spares/service/impl/MaterialServiceImpl.java
  9. 6
      src/main/java/org/energy/modules/spares/service/impl/OutboundServiceImpl.java
  10. 8
      src/main/java/org/energy/modules/spares/vo/MaterialVO.java

@ -38,6 +38,7 @@ import org.apache.commons.codec.Charsets;
import org.energy.modules.inspection.entity.InspectionRoute;
import org.energy.modules.inspection.excel.InspectionRouteExcel;
import org.energy.modules.spares.excel.MaterialExcel;
import org.energy.modules.system.util.DataUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -195,8 +196,8 @@ public class MaterialController extends DafController {
@GetMapping("/getDetailList")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "获取物资信息", notes = "获取物资信息")
public R<Material> getDetailList(String materialNo) {
Material DetailList = materialService.getDetailList("'" + materialNo + "'");
public R<MaterialVO> getDetailList(String materialNo) {
MaterialVO DetailList = materialService.getDetailList(materialNo);
return R.data(DetailList);
}
@ -209,15 +210,15 @@ public class MaterialController extends DafController {
@ApiOperation(value = "导出", notes = "传入")
@ApiLog
public void exportMaterial(@ApiIgnore @RequestParam Map<String, Object> entity, HttpServletResponse response) {
if (entity.containsKey("station_equal")) {
entity.put("station_equal", Integer.parseInt((String) entity.get("station_equal")));
}
QueryWrapper<Material> queryWrapper = Condition.getQueryWrapper(entity, Material.class);
queryWrapper.lambda().eq(Material::getIsDeleted, DafConstant.DB_NOT_DELETED);
queryWrapper.orderByAsc("material_no");
List<MaterialExcel> list = materialService.exportData(queryWrapper);
entity.remove("daf-auth");
entity.forEach((key, value) -> {
if (!"station".equals(key))
{
entity.put(key, "%" + value + "%");
}
});
Material vo = DataUtils.mapToEntity(entity, Material::new);
List<MaterialExcel> list = materialService.exportData(vo);
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding(Charsets.UTF_8.name());
String fileName = URLEncoder.encode("物资数据导出", Charsets.UTF_8.name());

@ -15,6 +15,7 @@
*/
package org.energy.modules.spares.controller;
import com.xkcoding.http.util.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -35,6 +36,8 @@ import org.energy.modules.spares.vo.OutboundVO;
import org.energy.modules.spares.service.IOutboundService;
import com.dayu.daf.core.boot.ctrl.DafController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
@ -111,6 +114,22 @@ public class OutboundController extends DafController {
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入outbound")
public R submit(@Valid @RequestBody Outbound outbound) {
String maxNo = outboundService.getMaxNo("'%" + outbound.getMaterialNo() + "%'");
int number;
if (StringUtil.isNotEmpty(maxNo)){
number = Integer.parseInt(maxNo.substring(11));
number++;
}else{
number = 1;
}
String numFormat = String.format("%06d", number);
String no = outbound.getMaterialNo() + "OUT" + numFormat;
outbound.setOutboundNo(no);
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String time = sdf.format(date);
outbound.setOutboundTime(time);
outbound.setIstatus(1L);
return R.status(outboundService.saveOrUpdate(outbound));
}

@ -16,7 +16,7 @@
<result column="material_class_code" property="materialClassCode"/>
<result column="model" property="model"/>
<result column="manufacturer_name" property="manufacturerName"/>
<result column="sipplier_name" property="sipplierName"/>
<result column="supplier_name" property="supplierName"/>
<result column="warehouse" property="warehouse"/>
<result column="inventory_count" property="inventoryCount"/>
<result column="material_description" property="materialDescription"/>
@ -37,31 +37,42 @@
select material_no from s_material where is_deleted = 0
</select>
<select id="getDetailList" resultMap="materialResultMap">
<select id="getDetailList" resultType="org.energy.modules.spares.vo.MaterialVO">
select material_name, model
-- ,b.warehouse_name
,b.name as warehouse_name
,inventory_count
from s_material
-- inner join (
-- select warehouse_name
-- ,warehouse
-- from warehouse
-- where warehouse in (select warehouse from s_material where material_no = ${materialNo} and is_deleted = 0)
-- ) as b
-- on b.warehouse = s_material.warehouse
where material_no = ${materialNo} and is_deleted = 0
inner join (
select code
,name
from spt_warehouse
where code in (select warehouse from s_material where material_no = #{materialNo} and is_deleted = 0)
) as b
on b.code = s_material.warehouse
where material_no = #{materialNo} and is_deleted = 0
</select>
<select id="exportData" resultType="org.energy.modules.spares.excel.MaterialExcel">
SELECT material_no
,CASE
WHEN station = '1' THEN '景和光伏'
WHEN station = '2' THEN '北沙一光伏'
WHEN station = '3' THEN '北沙二光伏'
WHEN station = '4' THEN '达坂城风电一场'
ELSE ''
END AS station_ext
,material_name, model, inventory_count, material_description
FROM s_material ${ew.customSqlSegment}
SELECT material_no, dic1.dict_value AS stationExt, material_name
, model, inventory_count, material_description
FROM s_material a
LEFT JOIN sys_dict dic1 ON dic1.code = 'station' AND dic1.dict_key = a.station AND dic1.is_deleted = '0'
WHERE a.is_deleted = 0
<if test="entity.materialNo != null and entity.materialNo != ''">
AND a.material_no LIKE #{entity.materialNo}
</if>
<if test="entity.station != null and entity.station != ''">
AND a.station = #{entity.station}
</if>
<if test="entity.materialName != null and entity.materialName != ''">
AND a.material_name LIKE #{entity.materialName}
</if>
<if test="entity.model != null and entity.model != ''">
AND a.model LIKE #{entity.model}
</if>
<if test="entity.inventoryCount != null and entity.inventoryCount != ''">
AND a.inventory_count LIKE #{entity.inventoryCount}
</if>
</select>
</mapper>

@ -23,4 +23,9 @@ public interface OutboundMapper extends BaseMapper<Outbound> {
*/
List<OutboundVO> selectOutboundPage(IPage page, OutboundVO outbound);
/**
* 获取最大编号
*/
String getMaxNo(String materialNo);
}

@ -25,4 +25,8 @@
select * from s_outbound where is_deleted = 0
</select>
<select id="getMaxNo" resultType="java.lang.String">
select max(outbound_no) from s_outbound where is_deleted = 0 and outbound_no like ${materialNo}
</select>
</mapper>

@ -30,7 +30,7 @@ public interface IMaterialService extends BaseService<Material> {
/**
* 导出
*/
List<MaterialExcel> exportData(Wrapper<Material> queryWrapper);
List<MaterialExcel> exportData(Material material);
/**
* 获取物资编号
@ -45,6 +45,6 @@ public interface IMaterialService extends BaseService<Material> {
/**
* 获取物资的信息
*/
Material getDetailList(String materialNo);
MaterialVO getDetailList(String materialNo);
}

@ -22,4 +22,9 @@ public interface IOutboundService extends BaseService<Outbound> {
*/
IPage<OutboundVO> selectOutboundPage(IPage<OutboundVO> page, OutboundVO outbound);
/**
* 获取最大编号
*/
String getMaxNo(String materialNo);
}

@ -29,8 +29,8 @@ public class MaterialServiceImpl extends BaseServiceImpl<MaterialMapper, Materia
}
@Override
public List<MaterialExcel> exportData(Wrapper<Material> queryWrapper) {
List<MaterialExcel> list = baseMapper.exportData(queryWrapper);
public List<MaterialExcel> exportData(Material material) {
List<MaterialExcel> list = baseMapper.exportData(material);
return list;
}
@ -47,8 +47,8 @@ public class MaterialServiceImpl extends BaseServiceImpl<MaterialMapper, Materia
}
@Override
public Material getDetailList(String materialNo) {
Material DetailList = baseMapper.getDetailList(materialNo);
public MaterialVO getDetailList(String materialNo) {
MaterialVO DetailList = baseMapper.getDetailList(materialNo);
return DetailList;
}

@ -22,4 +22,10 @@ public class OutboundServiceImpl extends BaseServiceImpl<OutboundMapper, Outboun
return page.setRecords(baseMapper.selectOutboundPage(page, outbound));
}
@Override
public String getMaxNo(String materialNo){
String maxNo = baseMapper.getMaxNo(materialNo);
return maxNo;
}
}

@ -17,14 +17,8 @@ import io.swagger.annotations.ApiModel;
public class MaterialVO extends Material {
private static final long serialVersionUID = 1L;
// 物资名称
private static final String materialName = "";
// 规格模型
private static final String model = "";
// 仓库名
private static final String warehouseName = "";
private String warehouseName;

Loading…
Cancel
Save