831cef07 康伟

kangwei : 采购计划统计接口

1 个父辈 6c8e9266
正在显示 18 个修改的文件 包含 194 行增加18 行删除
......@@ -12,6 +12,7 @@ import com.skua.modules.erp.entity.ApproveRecord;
import com.skua.modules.erp.entity.PurchaseMaterial;
import com.skua.modules.erp.service.IDistributMaterialService;
import com.skua.modules.erp.service.IPurchaseMaterialService;
import com.skua.modules.erp.vo.MaterialSearchVO;
import com.skua.modules.supplies.entity.EquipmentSparepartSupplies;
import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService;
import com.skua.modules.system.entity.SysUser;
......@@ -36,16 +37,17 @@ public class ErpCommonController {
@Autowired
private IDistributMaterialService distributMaterialService;
@AutoLog(value = "ERP-物料列表")
@ApiOperation(value = "ERP-物料列表", notes = "ERP-物料列表")
@AutoLog(value = "ERP-采购计划--物料列表")
@ApiOperation(value = "ERP-采购计划--物料列表", notes = "ERP-采购计划--物料列表")
@RequestMapping(value = "/sparepartList", method = RequestMethod.GET)
public Result<IPage<EquipmentSparepartSupplies>> sparepartList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
public Result<IPage<EquipmentSparepartSupplies>> sparepartList(MaterialSearchVO materialSearchVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
Result<IPage<EquipmentSparepartSupplies>> result = new Result<IPage<EquipmentSparepartSupplies>>();
Page<EquipmentSparepartSupplies> page = new Page<EquipmentSparepartSupplies>(pageNo, pageSize);
String depId = BaseContextHandler.getRealDepartId();//临时参数
// String username = req.getParameter("username");
IPage<EquipmentSparepartSupplies> pageList = sparepartSuppliesService.queryPageByOut(page, depId);
IPage<EquipmentSparepartSupplies> pageList = sparepartSuppliesService.queryPageByOut(page, depId , materialSearchVO.getSparepartName() ,materialSearchVO.getSparepartType(),materialSearchVO.getSparepartCode());
result.setSuccess(true);
result.setResult(pageList);
return result;
......
......@@ -158,4 +158,19 @@ public class PurchaseContractController {
}
return result;
}
@AutoLog(value = "erp采购合同-同步入库")
@ApiOperation(value="erp采购合同-同步入库", notes="erp采购合同-同步入库")
@PutMapping(value = "/syncEquipmentIn")
public Result<String> syncEquipmentIn(@RequestParam(name="id",required=true) String id ) {
Result<String> result = new Result<String>();
try {
PurchaseContractVO purchaseContractVO = purchaseContractService.queryById( id) ;
//调用接口,同步到入库单
purchaseContractService.syncEquipmentIn(purchaseContractVO);
} catch (Exception e) {
log.error("同步入库失败",e.getMessage());
result.setSuccess(true);
}
return result;
}
}
......
......@@ -46,6 +46,7 @@ public class ERPPurchaseContract {
/**采购类型:招标采购/询价采购*/
@Excel(name = "采购类型:招标采购/询价采购", width = 15)
@ApiModelProperty(value = "采购类型:招标采购/询价采购")
@Dict(dicCode = "purchase_type")
private java.lang.String purchaseType;
/**合同编号*/
@Excel(name = "合同编号", width = 15)
......@@ -90,6 +91,9 @@ public class ERPPurchaseContract {
@ApiModelProperty(value = "申请时间")
private String applyTime;
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
/**创建人id*/
@Excel(name = "创建人id", width = 15)
......@@ -123,4 +127,7 @@ public class ERPPurchaseContract {
@Excel(name = "删除标识,0:有效,1:删除", width = 15)
@ApiModelProperty(value = "删除标识,0:有效,1:删除")
private java.lang.Integer delFlag;
@ApiModelProperty(value = "删除标识,0:有效,1:删除")
private String equipmentInId;
}
......
<?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.skua.modules.erp.mapper.PurchasePlanMapper">
<!-- 统计查询-->
<select id="statisticsPage" resultType="com.skua.modules.erp.entity.PurchasePlanItem">
select ss.sparepart_name,ss.sparepart_type,ss.specification,ss.measuring_unit, aaa.* from (
select ss.id, ss.sparepart_name,ss.sparepart_type, st.item_text as 'sparepart_type_name' ,ss.sparepart_code, ss.specification,ss.measuring_unit, aaa.* from (
select pi.sparepart_id,sum(pi.purchase_num ) as 'purchase_num' , sum(pi.total_price) 'total_price'
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where
......@@ -30,6 +28,7 @@
group by pi.sparepart_id
)aaa
left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id
left join equipment_sparepart_type st on st.id = aaa.sparepart_type
</select>
......
......@@ -55,6 +55,11 @@ public interface IEROPurchaseContractService extends IService<ERPPurchaseContrac
*/
public void auditPurchaseContract(PurchaseContractVO purchaseContractVO);
/***
* 同步入库操作
* @param purchaseContractVO
* @return
*/
public int syncEquipmentIn(PurchaseContractVO purchaseContractVO)throws Exception;
}
......
package com.skua.modules.erp.service.impl;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.util.DateUtils;
import com.skua.modules.equipment.dto.EquipmentInDTO;
import com.skua.modules.equipment.entity.EquipmentIn;
import com.skua.modules.equipment.entity.EquipmentInChild;
import com.skua.modules.equipment.service.IEquipmentInService;
import com.skua.modules.equipment.vo.EquipmentInExcel;
import com.skua.modules.erp.entity.*;
import com.skua.modules.erp.mapper.ApproveRecordMapper;
import com.skua.modules.erp.mapper.ERPPurchaseContractMapper;
import com.skua.modules.erp.mapper.PurchaseMaterialMapper;
import com.skua.modules.erp.service.IEROPurchaseContractService;
import com.skua.modules.erp.vo.PurchaseContractVO;
import com.skua.modules.guest.util.DateUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* 采购合同
......@@ -27,6 +39,9 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
@Resource
private ApproveRecordMapper recordMapper;
@Autowired
private IEquipmentInService equipmentInService;
/***
* 新增purchaseContractVO
* @param purchaseContractVO
......@@ -131,7 +146,56 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr
recordMapper.insert( record ) ;
// 审核通过,生成入库单据、物料单
if(inStock ){
try {
syncEquipmentIn(purchaseContractVO);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/***
* 同步入库
* @param purchaseContractVO
* @return
*/
public int syncEquipmentIn(PurchaseContractVO purchaseContractVO) throws Exception{
EquipmentInDTO equipmentInDTO = new EquipmentInDTO();
// EquipmentIn equipmentIn = new EquipmentIn();
//入库类型
equipmentInDTO.setDepartId( purchaseContractVO.getDepartId() );//所属厂站
equipmentInDTO.setSuppliesWarehouseId( purchaseContractVO.getInWarehouseId() ) ;//入库仓库
equipmentInDTO.setInDate(DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss"));
equipmentInDTO.setUseBy( BaseContextHandler.getUserId() ) ;//经办人
equipmentInDTO.setChooseTime( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss") );//经办时间
equipmentInDTO.setRemark( purchaseContractVO.getRemark() );//备注
List<EquipmentInChild> equipmentInChildrenList = new ArrayList<>();
EquipmentInChild equipmentInChild = new EquipmentInChild();//
if(purchaseContractVO.getMaterialList() != null ){
for( PurchaseMaterial purchaseMaterial : purchaseContractVO.getMaterialList()){
equipmentInChild = new EquipmentInChild();//
equipmentInChild.setSparepartId( purchaseMaterial.getSparepartId());//物料编号
equipmentInChild.setInNum( new BigDecimal(purchaseMaterial.getPurchaseNum())); //物料类别
equipmentInChild.setBatchNum(purchaseMaterial.getGoodCode() ) ;//批次号
equipmentInChildrenList.add( equipmentInChild ) ;
}
}
equipmentInDTO.setEquipmentInChildList( equipmentInChildrenList );
//调用接口入库
equipmentInService.saveEquipmentIn(equipmentInDTO ) ;
/* ERPPurchaseContract erpPurchaseContract = this.baseMapper.selectById(purchaseContractVO.getId());
if(erpPurchaseContract == null ){
throw new Exception("采购合同记录不存在");
}*/
purchaseContractVO.setEquipmentInId( equipmentInDTO.getId() ) ;//记录入库单号
this.baseMapper.updateById(purchaseContractVO ) ;
return 1;
}
}
......
package com.skua.modules.erp.vo;
import com.skua.core.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Material物料查询对象", description="Material物料查询对象")
public class MaterialSearchVO {
@ApiModelProperty(value = "物料编号")
private String sparepartCode;
@ApiModelProperty(value = "物料名称")
private String sparepartName;
@ApiModelProperty(value = "物料类型")
private String sparepartType;
@ApiModelProperty(value = "所属厂站")
private String departId;
}
......@@ -78,6 +78,20 @@ public class DangerLevelManageController {
result.setResult(pageList);
return result;
}
@AutoLog(value = "风险分级管控清单-列表查询")
@ApiOperation(value="风险分级管控清单-列表查询", notes="风险分级管控清单-分页列表查询")
@GetMapping(value = "/dangerList")
public Result<List<DangerLevelManage>> queryByDangerList( @RequestParam(name="departId")String departId ) {
Result<List<DangerLevelManage>> result = new Result<List<DangerLevelManage>>();
QueryWrapper<DangerLevelManage> queryWrapper = new QueryWrapper();//QueryGenerator.initQueryWrapper(dangerLevelManage, req.getParameterMap());
queryWrapper.eq("depart_id" ,departId);
List<DangerLevelManage> pageList = dangerLevelManageService.list(queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* 添加
......
......@@ -58,8 +58,9 @@ public class APPDangerInspectionRecordController {
Result<IPage<DangerInspectionRecord>> result = new Result<IPage<DangerInspectionRecord>>();
QueryWrapper<DangerInspectionRecord> queryWrapper = new QueryWrapper<DangerInspectionRecord>();// QueryGenerator.initQueryWrapper(dangerInspectionRecord, req.getParameterMap());
Page<DangerInspectionRecord> page = new Page<DangerInspectionRecord>(pageNo, pageSize);
queryWrapper.eq("danger_id", dangerInspectionRecord.getDangerId());
if(dangerInspectionRecord.getDangerId() != null ){
queryWrapper.eq("danger_id", dangerInspectionRecord.getDangerId());
}
if(StringUtils.isNotBlank(dangerInspectionRecord.getStartTime())){
queryWrapper.ge("report_date", dangerInspectionRecord.getStartTime() ) ;
}
......
......@@ -242,8 +242,6 @@ public class EquipmentInController {
@ApiOperation(value = "入库-添加", notes = "入库-添加")
@PostMapping(value = "/add")
public Result<Object> add(@RequestBody EquipmentInDTO equipmentInDTO) throws Exception {
List<SuppliesWarehouse> suppliesWarehouseList = suppliesWarehouseService.list();
Map<String, String> warehouseDictMap = suppliesWarehouseList.stream().collect(Collectors.toMap(SuppliesWarehouse::getId, SuppliesWarehouse::getDepartId));
Result<Object> result = new Result<>();
......
......@@ -147,4 +147,20 @@ public class EquipmentIn {
@ApiModelProperty(value = "采购部门")
@Dict(dicCode="departCode")
private String purchaseDepart;
public EquipmentIn( ) {
}
public EquipmentIn(String departId, String inOrder, String purchaseCode, String purchaseId, String inType, String inDate, String suppliesWarehouseId, Integer isConfirm, String chooseTime, String purchaseDepart) {
this.departId = departId;
this.inOrder = inOrder;
this.purchaseCode = purchaseCode;
this.purchaseId = purchaseId;
this.inType = inType;
this.inDate = inDate;
this.suppliesWarehouseId = suppliesWarehouseId;
this.isConfirm = isConfirm;
this.chooseTime = chooseTime;
this.purchaseDepart = purchaseDepart;
}
}
......
......@@ -2,6 +2,7 @@ package com.skua.modules.equipment.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.skua.modules.equipment.dto.EquipmentInDTO;
import com.skua.modules.equipment.entity.EquipmentIn;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.equipment.vo.EquipmentInExcel;
......@@ -17,4 +18,9 @@ public interface IEquipmentInService extends IService<EquipmentIn> {
List<EquipmentInExcel> queryExport(@Param(Constants.WRAPPER) QueryWrapper<EquipmentIn> queryWrapper);
/***
* 入库新增
* @param equipmentInDTO
*/
public int saveEquipmentIn(EquipmentInDTO equipmentInDTO) throws Exception;
}
......
......@@ -257,4 +257,15 @@ public class EquipmentSparepartSupplies {
@TableField(exist=false)
@ApiModelProperty(value = "计划采购数量")
private String purchaseNum;
@TableField(exist=false)
@ApiModelProperty(value = "计划采购数量")
private String sparepartId;
public String getSparepartId() {
return id;
}
}
......
......@@ -18,5 +18,7 @@ public interface EquipmentSparepartSuppliesMapper extends BaseMapper<EquipmentSp
* @param depId
* @return
*/
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId);
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page,
@Param("depId") String depId ,@Param("sparepartName")String sparepartName,
@Param("sparepartType")String sparepartType ,@Param("sparepartCode")String sparepartCode);
}
......
......@@ -6,12 +6,22 @@
<select id="queryPageByOut" resultType="com.skua.modules.supplies.entity.EquipmentSparepartSupplies">
select st.item_text 'sparepart_type_name' , aaa.out_num, ss.* from equipment_sparepart_supplies ss
left join equipment_sparepart_type st on ss.sparepart_type = st.id
left join (
select sum(out_num) out_num ,sparepart_id from equipment_out_child
where
YEAR(create_time) = YEAR(CURRENT_DATE - INTERVAL 1 YEAR)
group by sparepart_id
) aaa on aaa.sparepart_id = ss.id
<where>
<if test="sparepartName != null and sparepartName !=''">
and ss.sparepart_name like CONCAT('%', #{sparepartName},'%')
</if>
<if test="sparepartCode != null and sparepartCode !=''">
and ss.sparepart_code like CONCAT('%', #{sparepartCode},'%')
</if>
<if test="sparepartType != null and sparepartType !=''">
and ss.sparepart_type = #{sparepartType}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......
......@@ -15,5 +15,5 @@ public interface IEquipmentSparepartSuppliesService extends IService<EquipmentSp
* @param depId
* @return
*/
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId);
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId ,String sparepartName,String sparepartType ,String sparepartCode);
}
......
......@@ -20,7 +20,7 @@ public class EquipmentSparepartSuppliesServiceImpl extends ServiceImpl<Equipment
* @param depId
* @return
*/
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId){
return baseMapper.queryPageByOut(page,depId);
public IPage<EquipmentSparepartSupplies> queryPageByOut(Page<EquipmentSparepartSupplies> page, String depId ,String sparepartName,String sparepartType ,String sparepartCode){
return baseMapper.queryPageByOut(page,depId ,sparepartName,sparepartType,sparepartCode);
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!