f7392619 康伟

kangwei : 采购计划添加物料用途

            列表添加物料属性查询条件
            采购计划统计添加物料用途
1 个父辈 7a610143
正在显示 17 个修改的文件 包含 184 行增加50 行删除
......@@ -104,9 +104,9 @@ public class MaterialINController {
@ApiOperation(value="erp--物料(药剂)入库-集团审核列表", notes="erp--物料(药剂)入库-集团审核列表")
@GetMapping(value = "/handleList")
public Result<IPage<MaterialIN>> handleList(MaterialIN materialIN,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<MaterialIN>> result = new Result<IPage<MaterialIN>>();
QueryWrapper<MaterialIN> queryWrapper = new QueryWrapper();//QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap());
Page<MaterialIN> page = new Page<MaterialIN>(pageNo, pageSize);
......@@ -133,6 +133,31 @@ public class MaterialINController {
result.setResult(pageList);
return result;
}
@AutoLog(value = "erp--物料(药剂)入库--药剂到货日验收记录")
@ApiOperation(value="erp--物料(药剂)入库-药剂到货日验收记录", notes="erp--物料(药剂)入库-药剂到货日验收记录")
@GetMapping(value = "/arrivalRecordList")
public Result<List<MaterialIN>> arrivalRecordList(MaterialIN materialIN,HttpServletRequest req) {
Result<List<MaterialIN>> result = new Result<List<MaterialIN>>();
QueryWrapper<MaterialIN> queryWrapper = new QueryWrapper();//QueryGenerator.initQueryWrapper(materialIN, req.getParameterMap());
if(StringUtils.isNotBlank(materialIN.getGoodCode())){
queryWrapper.like("good_code",materialIN.getGoodCode());
}
if(StringUtils.isNotBlank(materialIN.getStartTime())){
queryWrapper.ge("arrive_time",materialIN.getStartTime());
}
if(StringUtils.isNotBlank(materialIN.getEndTime())){
queryWrapper.le("arrive_time",materialIN.getEndTime());
}
List<MaterialIN> pageList = materialINService.list( queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
//arrivalRecord
/**
* <pre>
* 添加
......
......@@ -25,7 +25,9 @@ import com.skua.modules.erp.vo.PurchasePlanSearchVO;
import com.skua.modules.erp.vo.PurchasePlanStatisticsVO;
import com.skua.modules.erp.vo.PurchasePlanVO;
import com.skua.modules.guest.util.DateUtil;
import com.skua.modules.quartz.util.BaseUtil;
import com.skua.modules.supplies.service.IEquipmentSparepartTypeService;
import com.skua.modules.system.service.ISysDepartService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -60,6 +62,8 @@ public class PurchasePlanController {
private IPurchasePlanService purchasePlanService;
@Autowired
private IEquipmentSparepartTypeService equipmentSparepartTypeService;
@Autowired
private ISysDepartService departService;
@AutoLog(value = "erp采购计划表-分页列表查询")
@ApiOperation(value="erp采购计划表-分页列表查询", notes="erp采购计划表-分页列表查询")
......@@ -114,7 +118,6 @@ public class PurchasePlanController {
queryWrapper.in("depart_id", BaseContextHandler.getDeparts().split(","));
}
}
if(StringUtils.isNotEmpty( purchasePlan.getStatus() ) ){
queryWrapper.eq("status", purchasePlan.getStatus());
}else{
......@@ -141,7 +144,6 @@ public class PurchasePlanController {
Result<PurchasePlan> result = new Result<PurchasePlan>();
try {
purchasePlanVO.setApplyTime(DateUtil.getCurrentDate());
//purchasePlan.setApplyUser(BaseContextHandler.getUserId());
purchasePlanService.savePurchasePlan(purchasePlanVO);
result.success("添加成功!");
......@@ -244,9 +246,6 @@ public class PurchasePlanController {
}
return result;
}
@AutoLog(value = "erp采购计划表-送审")
@ApiOperation(value="erp采购计划表-送审", notes="erp采购计划表-送审")
@GetMapping(value = "/sendAudit")
......@@ -285,9 +284,6 @@ public class PurchasePlanController {
return result;
}
@AutoLog(value = "erp采购计划表-按物料统计列表")
@ApiOperation(value="erp采购计划表-按物料统计列表", notes="erp采购计划表-按物料统计列表")
@GetMapping(value = "/statisticsList")
......@@ -298,10 +294,7 @@ public class PurchasePlanController {
Result<IPage<PurchasePlanItem>> result = new Result<IPage<PurchasePlanItem>>();
Page<PurchasePlanItem> page = new Page<PurchasePlanItem>(pageNo, pageSize);
//purchasePlanSearchVO.setDepats();
purchasePlanSearchVO.setDeparts(BaseContextHandler.getDeparts());
Set<String> sparepartTypeSet = new HashSet<>();
Set<String> sparepartTypeSet = new HashSet<String>();
String sparepartTypeStr = "";
if (StringUtils.isNotEmpty(purchasePlanSearchVO.getSparepartType())) {
// 查询子集
......@@ -312,6 +305,26 @@ public class PurchasePlanController {
}
purchasePlanSearchVO.setSparepartType( sparepartTypeStr );
}
log.debug("查询物料子分类集合:{}",sparepartTypeStr);
//查询下一级部门集合
if (!"1".equals(BaseContextHandler.get("userType"))) {
Set<String> departsSet = new HashSet<String>();
String departIds = "";
if (StringUtils.isNotEmpty(purchasePlanSearchVO.getDepartId())) {
// 查询子集
departsSet = departService.getAllChildrenDepartIds( purchasePlanSearchVO.getDepartId() );
if(departsSet.size() > 0 ) departIds = String.join(",", departsSet);// 使用String.join()方法转换Set为字符串,以逗号分隔
purchasePlanSearchVO.setDepartIds( departIds );
log.debug("查询部门集合:{}",departIds);
}else{
purchasePlanSearchVO.setDepartIds( BaseContextHandler.getDeparts() );
log.debug("查询权限部门集合:{}", BaseUtil.quoteEach(BaseContextHandler.getDeparts(),","));
}
}
if(StringUtils.isNotEmpty(purchasePlanSearchVO.getSparepartAttribute() )){
purchasePlanSearchVO.setSparepartAttribute( BaseUtil.quoteEach(purchasePlanSearchVO.getSparepartAttribute(),",") ) ;
}
log.debug("查询物料属性:{}",purchasePlanSearchVO.getSparepartAttribute());
IPage<PurchasePlanItem> pageList = purchasePlanService.statisticsPage(page,purchasePlanSearchVO);
result.setSuccess(true);
......@@ -336,4 +349,7 @@ public class PurchasePlanController {
return result;
}
}
......
......@@ -56,6 +56,12 @@ public class PurchasePlanItem implements Serializable{
@Excel(name = "计量单位", width = 15)
@ApiModelProperty(value = "计量单位")
private String measuringUnit;
@Excel(name = "物料属性", width = 15)
@ApiModelProperty(value = "物料属性")
@Dict(dicCode = "sparepart_attribute")
private String sparepartAttribute;
/**计划采购数量*/
@Excel(name = "计划采购数量", width = 15)
@ApiModelProperty(value = "计划采购数量")
......@@ -70,6 +76,10 @@ public class PurchasePlanItem implements Serializable{
@ApiModelProperty(value = "备注")
private String remark;
@Excel(name = "物料用途", width = 15)
@ApiModelProperty(value = "物料用途")
private String purpose;
@Excel(name = "去年出库数量", width = 15)
@ApiModelProperty(value = "去年出库数量")
......
......@@ -3,32 +3,36 @@
<mapper namespace="com.skua.modules.erp.mapper.PurchasePlanMapper">
<!-- 统计查询-->
<select id="statisticsPage" resultType="com.skua.modules.erp.entity.PurchasePlanItem">
select ss.id, ss.sparepart_name,ss.sparepart_type, st.item_textstatisticsPage 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'
select ss.id, ss.sparepart_name,ss.sparepart_type, st.item_text as 'sparepart_type_name' ,ss.sparepart_attribute,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' , group_concat(DISTINCT purpose ) purpose
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where
pp.id = pi.plan_id
pp.id = pi.plan_id and pp.status = 3
<if test="ev.sparepartType != null and ev.sparepartType != '' ">
and pi.sparepart_type in ( ${ev.sparepartType})
</if>
<if test="ev.sparepartCode != null and ev.sparepartCode != '' ">
AND pi.sparepart_code like concat('%', #{ev.sparepartCode}, '%')
AND pi.sparepart_code like '%'#{ev.sparepartCode}'%'
</if>
<if test="ev.sparepartName != null and ev.sparepartName != '' ">
AND pi.sparepart_name like concat('%', #{ev.sparepartName}, '%')
AND pi.sparepart_name like '%'#{ev.sparepartName}'%'
</if>
<if test="ev.applyYear != null and ev.applyYear != '' ">
and pp.apply_year = #{ev.applyYear}
</if>
<if test="ev.departId != null and ev.departId!= ''">
and pp.depart_id in ( ${ev.departId} )
<if test="ev.departIds != null and ev.departIds!= ''">
and pp.depart_id in ( ${ev.departIds} )
</if>
<if test="ev.startTime != null and ev.startTime!= ''">
and pp.apply_time &gt;= #{ev.startTime}
</if>
<if test="ev.endTime != null and ev.endTime != ''">
and pp.apply_time &lt;= #{ev.endTime}
</if>
<if test="ev.sparepartAttribute != null and ev.sparepartAttribute != ''">
and pi.sparepart_attribute in (${ev.sparepartAttribute})
</if>
group by pi.sparepart_id
)aaa
left join equipment_sparepart_supplies ss on aaa.sparepart_id = ss.id
......@@ -37,15 +41,13 @@
</select>
<select id="statisticsPageBySparepartId" resultType="com.skua.modules.erp.vo.PurchasePlanStatisticsVO">
select u.realname 'apply_user_name', aaa.* from (
select pi.purchase_num ,pi.measuring_unit,pi.sparepart_name, pi.unit_price , pi.total_price , pp.*
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where pp.id = pi.plan_id and pi.sparepart_id=#{ev.sparepartId}
select pi.purpose, pi.purchase_num ,pi.measuring_unit, pi.sparepart_name, pi.specification,pi.sparepart_type, pi.unit_price , pi.total_price , pp.*
from erp_purchase_plan_item pi ,erp_purchase_plan pp
where pp.status = 3 and pp.id = pi.plan_id and pi.sparepart_id=#{ev.sparepartId}
<if test="ev.sparepartType != null and ev.sparepartType != '' ">
and pi.sparepart_type = #{ev.sparepartType}
</if> <if test="ev.sparepartName != null and ev.sparepartName != '' ">
AND pi.sparepart_name like concat('%', #{ev.sparepartName}, '%')
AND pi.sparepart_name like '%'#{ev.sparepartName}'%'
</if>
<if test="ev.applyYear != null and ev.applyYear != '' ">
and pp.apply_year = #{ev.applyYear}
......@@ -59,9 +61,6 @@
<if test="ev.endTime != null and ev.endTime != ''">
and pp.apply_time &lt;= #{ev.endTime}
</if>
)aaa
left join sys_depart d on d.id = aaa.depart_id
left join sys_user u on u.id = aaa.apply_user
</select>
<!-- and pp.depart_id in (#{ev.departs})-->
</mapper>
\ No newline at end of file
......
package com.skua.modules.erp.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ArrivalRecordVO到货验收记录", description="到货验收记录")
public class ArrivalRecordVO {
}
......@@ -29,12 +29,16 @@ public class PurchasePlanSearchVO {
public String sparepartCode;
@ApiModelProperty(value = "权限下的部门编号集合")
private String departs;
private String departIds;
@ApiModelProperty(value = "物料属性")
private String sparepartAttribute;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
......
package com.skua.modules.erp.vo;
import com.skua.core.aspect.annotation.Dict;
import com.skua.modules.erp.entity.PurchasePlan;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -18,10 +19,28 @@ public class PurchasePlanStatisticsVO extends PurchasePlan {
@ApiModelProperty(value = "物料名称")
private String sparepartName;
@ApiModelProperty(value = "物料名称")
@ApiModelProperty(value = "申请人名称")
private String applyUserName;
/**物料类别编号*/
@Excel(name = "物料类别编号", width = 15)
@ApiModelProperty(value = "物料类别编号")
@Dict(dictTable = "equipment_sparepart_type", dicCode="id", dicText = "item_text")
private String sparepartType;
@Excel(name = "规格型号", width = 15)
@ApiModelProperty(value = "规格型号")
private String specification;
/**计量单位*/
@Excel(name = "计量单位", width = 15)
@ApiModelProperty(value = "计量单位")
private String measuringUnit;
@Excel(name = "物料用途", width = 15)
@ApiModelProperty(value = "物料用途")
private String purpose;
/**计划采购数量*/
@Excel(name = "计划采购数量", width = 15)
@ApiModelProperty(value = "计划采购数量")
......@@ -31,7 +50,6 @@ public class PurchasePlanStatisticsVO extends PurchasePlan {
@ApiModelProperty(value = "单价")
private String unitPrice;
@Excel(name = "总价", width = 15)
@ApiModelProperty(value = "总价")
private String totalPrice;
......
......@@ -19,6 +19,28 @@ public class BaseUtil {
return df.format(pram);
}
/***
* 分割字符串,然后拼接
* @param str 带分隔字符串
* @param splitStr 分割符号
* @return
*/
public static String quoteEach(String str,String splitStr) {
if( str != null && str.length() > 0 ){
String[] items = str.split(splitStr);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < items.length; i++) {
if (i > 0) {
sb.append(", ");
}
sb.append('\'').append(items[i]).append('\'');
}
return sb.toString();
}
return str;
}
/**
* 获取当前天0点的时间戳
*
......
......@@ -255,17 +255,16 @@ public class HealthRecordsController {
Result<HealthRecordsStatisticsVO> result = new Result<HealthRecordsStatisticsVO>();
// 查询子集
String departAncestors = "";
/*String departAncestors = "";
Set<String> departSet = new HashSet<>();
// 查询子集
departSet = departService.getAllChildrenDepartIds(departId);
if(departSet.size() > 0 ){
// 使用String.join()方法转换Set为字符串,以逗号分隔
departAncestors = String.join(",", departSet);
}
}*/
HealthRecordsStatisticsVO statisticsVO = healthRecordsService.statistics(departAncestors);
HealthRecordsStatisticsVO statisticsVO = healthRecordsService.statistics(departId);
result.setResult(statisticsVO);
result.setSuccess(true);
return result;
......
......@@ -16,11 +16,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface HealthRecordsMapper extends BaseMapper<HealthRecords> {
public IPage<HealthRecordsVO> queryByPage(Page<HealthRecordsVO> page,@Param("healthRecordsVO") HealthRecordsVO healthRecordsVO);
/***
* 统计接口
* @param departAncestors
* @param departId
* @return
*/
public HealthRecordsStatisticsVO statistics(@Param("departAncestors") String departAncestors );
public HealthRecordsStatisticsVO statistics(@Param("departId") String departId );
}
......
......@@ -32,10 +32,20 @@
<!-- 统计接口-->
<select id="statistics" resultType="com.skua.modules.safe.vo.HealthRecordsStatisticsVO">
select
SELECT
( SELECT count( 1 ) FROM sys_factory_user_info WHERE depart_id = #{departId}) 'totalNum',
(SELECT count( 1 ) FROM
( SELECT DISTINCT user_id FROM safety_health_records hr WHERE hr.depart_id = #{departId} ) aa
) 'useNum'
FROM
DUAL
</select>
<!--
select
(select count(1) from sys_user_depart where dep_id in (${departAncestors}) ) 'totalNum',
(select count(1 ) from (select DISTINCT user_id from safety_health_records hr where hr.depart_id in ( ${departAncestors} ) ) aa) 'useNum'
from dual
</select>
-->
</mapper>
\ No newline at end of file
......
......@@ -21,8 +21,8 @@ public interface IHealthRecordsService extends IService<HealthRecords> {
/***
* 统计
* @param departAncestors
* @param departId
* @return
*/
public HealthRecordsStatisticsVO statistics(String departAncestors);
public HealthRecordsStatisticsVO statistics(String departId);
}
......
......@@ -29,10 +29,10 @@ public class HealthRecordsServiceImpl extends ServiceImpl<HealthRecordsMapper, H
/***
* 统计
* @param departAncestors
* @param departId
* @return
*/
public HealthRecordsStatisticsVO statistics(String departAncestors){
return this.baseMapper.statistics( departAncestors );
public HealthRecordsStatisticsVO statistics(String departId){
return this.baseMapper.statistics( departId );
}
}
......
......@@ -80,6 +80,9 @@ public class EquipmentSparepartTypeController {
if (StringUtils.isNotBlank(itemText)) {
queryWrapper.like("item_text",itemText);
}
if (equipmentSparepartType.isMedicament()) {//查询药剂类别
queryWrapper.eq("is_medicament",equipmentSparepartType.isMedicament());
}
List<EquipmentSparepartType> equipmentSparepartTypeList = equipmentSparepartTypeService.list(queryWrapper);
List<EquipmentSparepartTypeVO> voList = new ArrayList<>();
......
......@@ -242,6 +242,10 @@ public class EquipmentSparepartSupplies {
private String sparepartAttribute;
@ApiModelProperty(value = "扩展:物料用途")
@TableField(exist=false)
private String purpose;
@ApiModelProperty(value = "扩展:物料类别名称")
@TableField(exist=false)
......@@ -272,7 +276,7 @@ public class EquipmentSparepartSupplies {
public String getOutNum(){
if(this.outNum == null ){
return "0.0";
return "0";
}
return this.outNum;
}
......
......@@ -68,6 +68,10 @@ public class EquipmentSparepartType {
@Excel(name = "是否叶子节点,1:是 0:不是", width = 15)
@ApiModelProperty(value = "是否叶子节点,1:是 0:不是")
private boolean isLeaf = true;
@Excel(name = "是否药剂,1:是 0:不是", width = 15)
@ApiModelProperty(value = "是否药剂,1:是 0:不是")
private boolean isMedicament = false;
/**
* 创建人
*/
......
......@@ -29,6 +29,12 @@ public class SysBaseConfig {
@TableId(type = IdType.ID_WORKER_STR)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**网站标题*/
@Excel(name = "网站地址", width = 15)
@ApiModelProperty(value = "网站地址")
private java.lang.String websiteUrl;
/**网站标题*/
@Excel(name = "网站标题", width = 15)
@ApiModelProperty(value = "网站标题")
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!