fb98e2d0 康伟

kangwei: 药剂入库批量审核

   巡检分析功能每个统计的数据都需要增加详情(巡检分析详情)
1 个父辈 eddb0df0
......@@ -342,6 +342,23 @@ public class MaterialINController {
}
return result;
}
@AutoLog(value = "erp--erp采购合同-批量审批")
@ApiOperation(value="erp--采购合同-批量审批", notes="erp--采购合同-批量审批")
@GetMapping(value = "/auditBatch")
public Result<String> auditBatchMaterialINVO(@RequestParam(name="ids",required=true) String ids,String approveState,String approveMessage) {
Result<String> result = new Result<String>();
String errMsg = null;
try {
errMsg = materialINService.auditBatchMaterialINVO(ids,approveState,approveMessage);
//result.setResult(materialINVO);
result.setSuccess(true);
} catch (Exception e) {
log.error("审批失败",errMsg);
result.error500("审批失败:"+ errMsg);
}
return result;
}
/**
* <pre>
* 导出excel
......
......@@ -92,6 +92,12 @@ public class MaterialIN {
@ApiModelProperty(value = "数量")
private String purchaseNum;
@Excel(name = "入库仓库", width = 15)
@ApiModelProperty(value = "入库仓库")
@Dict(dictTable = "supplies_warehouse", dicCode="id", dicText = "warehouse_name")
private String inWarehouseId;
/**供应商编号*/
@Excel(name = "供应商编号", width = 15)
@ApiModelProperty(value = "供应商编号")
......
......@@ -51,4 +51,10 @@ public interface IMaterialINService extends IService<MaterialIN> {
* @return
*/
MaterialIN queryById(String id);
/***
* 批量审批
* @param ids
*/
String auditBatchMaterialINVO(String ids , String approveState,String approveMessage)throws Exception;
}
......
......@@ -67,6 +67,25 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
@Autowired
private ICommonSqlService commonSqlService;
/***
* 批量审批
* @param ids
*/
@Transactional
public String auditBatchMaterialINVO(String ids , String approveState,String approveMessage)throws Exception{
String[] idsList = ids.split(",");
StringBuffer sb = new StringBuffer();
for(String id : idsList){
if(StringUtils.isNotEmpty(id)) {
String errMsg = auditMaterialIn(id, approveState, approveMessage);
if (StringUtils.isNotEmpty(errMsg)) {
sb.append(errMsg);
}
}
}
return sb.toString();
}
/***
* 审核药剂入库单
* @param materialINVO
......@@ -74,46 +93,54 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia
@Transactional
public String auditMaterialINVO(MaterialINVO materialINVO)throws Exception {
boolean inAndOutStock = false;
String errMsg = null;
String errMsg = auditMaterialIn(materialINVO.getId(),materialINVO.getApproveState(),materialINVO.getApproveMessage());
return errMsg;
}
@Transactional
public String auditMaterialIn(String id , String approveState,String approveMessage) throws Exception{
String errMsg = null;
boolean inAndOutStock = false;
//保存
MaterialIN materialINTemp = this.baseMapper.selectById(materialINVO.getId());
/* QueryWrapper<SuppliesWarehouse> queryWrapper = new QueryWrapper<SuppliesWarehouse>();
MaterialIN materialINTemp = this.baseMapper.selectById(id);
if(!"3".equals(materialINTemp.getAuditStatus())){
/* QueryWrapper<SuppliesWarehouse> queryWrapper = new QueryWrapper<SuppliesWarehouse>();
queryWrapper.eq("depart_id",materialINVO.getDepartId());*/
String inWarehouseId = null;
//主库数据源
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
if(materialINTemp != null && StringUtils.isNotEmpty(materialINTemp.getDepartId())){
String warehouseSql = "select id from supplies_warehouse where depart_id = '"+materialINTemp.getDepartId()+"' order by create_time desc limit 1";
inWarehouseId = masterDB.queryForObject( warehouseSql,String.class );
}
if(StringUtils.isEmpty(inWarehouseId)){
String departSql = "select depart_name from sys_depart where id = '"+materialINTemp.getDepartId()+"'";
String departName = masterDB.queryForObject( departSql,String.class );
return "所属厂站["+ ConvertUtils.getString(departName) +"]下没有找到仓库信息!";
}
//purchasePlan.getApproveState() 审批状态 1通过2不通过
if("1".equals( materialINVO.getApproveState() )){
materialINTemp.setAuditStatus( "3" );
inAndOutStock = true;
}
if("2".equals( materialINVO.getApproveState() )){
materialINTemp.setAuditStatus( "2" );
}
// 审核通过,生成入库单据、物料单
if(inAndOutStock ){
//出库
errMsg = syncEquipmentOut(materialINTemp);
//入库
errMsg = syncEquipmentIn(materialINTemp,inWarehouseId);
String inWarehouseId = materialINTemp.getInWarehouseId();
if(StringUtils.isEmpty(inWarehouseId)){
//主库数据源
JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master");
if(materialINTemp != null && StringUtils.isNotEmpty(materialINTemp.getDepartId())){
String warehouseSql = "select id from supplies_warehouse where depart_id = '"+materialINTemp.getDepartId()+"' order by create_time desc limit 1";
inWarehouseId = masterDB.queryForObject( warehouseSql,String.class );
}
if(StringUtils.isEmpty(inWarehouseId)){
String departSql = "select depart_name from sys_depart where id = '"+materialINTemp.getDepartId()+"'";
String departName = masterDB.queryForObject( departSql,String.class );
return "所属厂站["+ ConvertUtils.getString(departName) +"]下没有找到仓库信息!";
}
}
//purchasePlan.getApproveState() 审批状态 1通过2不通过
if("1".equals( approveState )){
materialINTemp.setAuditStatus( "3" );
inAndOutStock = true;
}
if("2".equals( approveState )){
materialINTemp.setAuditStatus( "2" );
}
// 审核通过,生成入库单据、物料单
if(inAndOutStock ){
//出库
errMsg = syncEquipmentOut(materialINTemp);
//入库
errMsg = syncEquipmentIn(materialINTemp,inWarehouseId);
}
materialINTemp.setApproveMessage(approveMessage);//审批意见
this.baseMapper.updateById( materialINTemp ) ;
//审批记录
ApproveRecord record = new ApproveRecord( "YJIN", materialINTemp.getApplyUser(), materialINTemp.getId(), BaseContextHandler.getUserId(), approveMessage, approveState);
recordMapper.insert( record ) ;
}
materialINTemp.setApproveMessage(materialINVO.getApproveMessage());//审批意见
this.baseMapper.updateById( materialINTemp ) ;
//审批记录
ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState());
recordMapper.insert( record ) ;
return errMsg;
}
......
package com.skua.modules.inspection.controller.web;
import com.skua.core.api.vo.Result;
import com.skua.core.context.BaseContextHandler;
import com.skua.modules.inspection.service.IInspectionAnalysisService;
import com.skua.modules.inspection.vo.*;
import com.skua.tool.util.JSUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -126,6 +129,19 @@ public class InspectionAnalysisController {
return result;
}
@ApiOperation(value = "巡检分析-巡检任务异常项趋势-详情", notes = "巡检分析-巡检任务异常项趋势-详情")
@GetMapping("/getInspectionAbnormalItemsTrendDetail")
public Result<List<InspectionAbnormalItemsTrendVO> > getInspectionAbnormalItemsTrendDetail(String departId , String startDate, String endDate){
Result<List<InspectionAbnormalItemsTrendVO> > result = new Result<>();
if(StringUtils.isEmpty(departId)){
departId = BaseContextHandler.getDeparts();
}
List<InspectionAbnormalItemsTrendVO> inspectionAbnormalItemsTrendVOList = inspectionAnalysisService.getInspectionAbnormalItemsTrendDetail(JSUtils.quoteEach(departId,","),startDate,endDate);
result.setSuccess(true);
result.setResult(inspectionAbnormalItemsTrendVOList);
return result;
}
/**
* <pre>
* 巡检分析-巡检任务指标
......
package com.skua.modules.inspection.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.skua.modules.inspection.entity.InspectionFillChoice;
import com.skua.modules.inspection.vo.InspectionAbnormalItemsTrendVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* @auther kangwei
* @create 2025-01-17-11:01
*/
public interface InspectionAnalysisMapper {
/***
* 巡检分析-巡检任务异常项趋势-详情
* @param departIds
* @param startDate
* @param endDate
* @return
*/
public List<InspectionAbnormalItemsTrendVO> getInspectionAbnormalItemsTrendDetail(@Param("departIds") String departIds,@Param("startDate") String startDate, @Param("endDate") String endDate);
}
<?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.inspection.mapper.InspectionAnalysisMapper">
<!-- 巡检分析-巡检任务异常项趋势-详情 -->
<select id="getInspectionAbnormalItemsTrendDetail" resultType="com.skua.modules.inspection.vo.InspectionAbnormalItemsTrendVO">
select d.depart_name ,ifnull(ddd.total_count,0) 'total_count' , (ifnull(ddd.total_count,0) -ifnull(ddd.checked_count,0)) 'not_checked_items_Count' , ifnull(ddd.checked_count,0) 'checked_items_count',ifnull(ddd.abnormal_checked_count ,0)'abnormal_item_count'
from sys_depart d
left join(
select t.depart_id , sum(ifnull(aaa.total_count,0)) 'total_count' ,sum(ifnull(bbb.checked_count,0)) 'checked_count',sum(ifnull(ccc.abnormal_checked_count ,0))'abnormal_checked_count'
FROM inspection_task t
left join (
SELECT inspection_task_id , ifnull(count(inspection_task_id),0) total_count FROM inspection_task_fill_group_fill GROUP BY inspection_task_id
)aaa on aaa.inspection_task_id = t.id
left join (
SELECT inspection_task_id , ifnull(count(inspection_task_id),0) checked_count FROM inspection_task_fill_content WHERE fill_content IS NOT NULL AND fill_content &lt;&gt; '' GROUP BY inspection_task_id
)bbb on bbb.inspection_task_id = t.id
left join(
SELECT inspection_task_id , ifnull(count(inspection_task_id),0) abnormal_checked_count FROM inspection_task_fill_content WHERE fill_content IS NOT NULL AND fill_content &lt;&gt; '' AND choice_state = '0' GROUP BY inspection_task_id
)ccc on ccc.inspection_task_id = t.id
WHERE t.task_state IN ('2','3')
<if test="startDate != null ">
AND DATE_FORMAT(t.inspection_cycle_start_date,'%Y-%m-%d') &gt;= #{startDate}
</if>
<if test="endDate != null ">
AND DATE_FORMAT(t.inspection_cycle_start_date,'%Y-%m-%d') &lt;= #{endDate}
</if>
group by t.depart_id
)ddd on d.id = ddd.depart_id
where d.depart_type = 1
<if test="departIds != null ">
and d.id in(${departIds})
</if>
order by ddd.total_count desc
</select>
</mapper>
......@@ -15,11 +15,38 @@ public interface IInspectionAnalysisService {
InspectionTaskIndicatorsVO getInspectionTaskIndicators(String startDate, String endDate);
/***
* 巡检分析-巡检设备指标
* @param startDate
* @param endDate
* @return
*/
InspectionEquipIndicatorsVO getInspectionEquipIndicators(String startDate, String endDate);
InspectionTaskOverviewVO getInspectionTaskOverview(String startDate, String endDate);
/***
* 巡检分析-巡检设备概况
* @param startDate
* @param endDate
* @return
*/
InspectionEquipOverviewVO getInspectionEquipOverview(String startDate, String endDate);
/***
* 巡检分析-巡检任务异常项趋势
* @param startDate
* @param endDate
* @return
*/
List<InspectionAbnormalItemsTrendVO> getInspectionAbnormalItemsTrend(String startDate, String endDate);
/***
* 巡检分析-巡检任务异常项趋势-详情
* @param departIds
* @param startDate
* @param endDate
* @return
*/
List<InspectionAbnormalItemsTrendVO> getInspectionAbnormalItemsTrendDetail(String departIds, String startDate, String endDate);
}
......
......@@ -7,6 +7,7 @@ import com.skua.core.util.DateUtils;
import com.skua.modules.flow.business.service.FlowBusinessService;
import com.skua.modules.flow.engine.constant.FlowEngineConstant;
import com.skua.modules.inspection.entity.*;
import com.skua.modules.inspection.mapper.InspectionAnalysisMapper;
import com.skua.modules.inspection.service.*;
import com.skua.modules.inspection.vo.*;
import com.skua.modules.system.entity.ProblemReportPlan;
......@@ -49,10 +50,10 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService
@Autowired
private IInspectionTaskPointFillGroupService inspectionTaskPointFillGroupService;
@Autowired
private IInspectionTaskFillService inspectionTaskFillService;
@Autowired
private IInspectionTaskFillGroupFillService inspectionTaskFillGroupFillService;
@Autowired
private InspectionAnalysisMapper inspectionAnalysisMapper;
private static NumberFormat numberFormat;
static {
......@@ -469,6 +470,12 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService
return inspectionTaskIndicatorsVO;
}
/***
* 巡检分析-巡检设备指标
* @param startDate
* @param endDate
* @return
*/
@Override
public InspectionEquipIndicatorsVO getInspectionEquipIndicators(String startDate, String endDate) {
InspectionEquipIndicatorsVO inspectionEquipIndicatorsVO = new InspectionEquipIndicatorsVO();
......@@ -500,7 +507,7 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService
Integer totalInspectionEquipCount = equipInfoIdList.stream().map(m -> ConvertUtils.getString(m.get("equipInfoId"))).collect(Collectors.toSet()).size();
//查询已巡检设备数量
List<String> inspectionPointFillGroupIdList = equipInfoIdList.stream().map(m -> ConvertUtils.getString(m.get("inspectionPointFillGroupId"))).collect(Collectors.toList());
List<String> inspectionFillGroupIdList = equipInfoIdList.stream().map(m -> ConvertUtils.getString(m.get("inspectionFillGroupId"))).collect(Collectors.toList());
List<String> inspectionFillGroupIdList = equipInfoIdList.stream().map(m -> ConvertUtils.getString(m.get("inspectionFillGroupId"))).collect(Collectors.toList());//构筑物
int checkedInspectionEquipCount = 0;
int notCheckedInspectionEquipCount = 0;
int abnormalInspectionEquipCount = 0;
......@@ -692,6 +699,12 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService
return inspectionTaskOverviewVO;
}
/***
* 巡检分析-巡检设备概况
* @param startDate
* @param endDate
* @return
*/
@Override
public InspectionEquipOverviewVO getInspectionEquipOverview(String startDate, String endDate) {
InspectionEquipOverviewVO inspectionEquipOverviewVO = new InspectionEquipOverviewVO();
......@@ -870,6 +883,17 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService
}
/***
* 巡检分析-巡检任务异常项趋势-详情
* @param departIds
* @param startDate
* @param endDate
* @return
*/
public List<InspectionAbnormalItemsTrendVO> getInspectionAbnormalItemsTrendDetail(String departIds, String startDate, String endDate){
return inspectionAnalysisMapper.getInspectionAbnormalItemsTrendDetail( departIds, startDate, endDate);
}
public static List<String[]> getCycleList(int cycleNum, String startTime, String endTime) throws ParseException {
// System.out.println("统计的时间段为:从" + startTime + "到" + endTime);
Date endParse = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(endTime);
......
......@@ -17,10 +17,21 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="巡检任务异常项趋势", description="巡检任务异常项趋势")
public class InspectionAbnormalItemsTrendVO {
@ApiModelProperty(value = "未检项")
@ApiModelProperty(value = "厂站名称")
private String departName;
@ApiModelProperty(value = "总的填报项数量")
private Integer totalCount;
@ApiModelProperty(value = "填报项数量")
private Integer checkedItemsCount;
@ApiModelProperty(value = "日期")
private String inspectionTaskDate;
@ApiModelProperty(value = "未检项")
@ApiModelProperty(value = "未检项数量")
private Integer notCheckedItemsCount;
@ApiModelProperty(value = "异常项")
@ApiModelProperty(value = "异常项数量")
private Integer abnormalItemsCount;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!