sql: INSERT INTO [dbo].[SYFUNP]([CKDM], [MS], [GNLX], [ZXTBM], [CKCS], [GNLB], [YLZD1], [YLZD2], [YLZD3], [YLZD4], [YLZD5], [YLZD6]) VALUES ('RjhlgzCx', '日计划量跟踪', 'CX', 'PS', '/jhzx/rjhlgzCx.vue', 'rjhlgzCx', '计划执行管理', 'jh04', '040203', NULL, NULL, NULL); INSERT INTO [dbo].[SYIFRP]([CKDM], [GWDM], [MS], [ZXTBM], [GNLB], [YLZD1], [YLZD2], [YLZD3], [YLZD4], [YLZD5], [YLZD6]) VALUES (NULL, 'ALL', '日计划量跟踪', 'PS', 'rjhlgzCx', NULL, NULL, NULL, NULL, NULL, NULL);master
parent
cc5dc59bdd
commit
09b4eb67ba
@ -0,0 +1,20 @@
|
||||
package com.dsic.gj_erp.bean.jhgk.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RjhDto {
|
||||
|
||||
|
||||
private Double pwnum;
|
||||
private Double sk1num;
|
||||
private Double lm1num;
|
||||
private Double sk2num;
|
||||
private Double lm2num;
|
||||
private Double sk3num;
|
||||
private Double lm3num;
|
||||
private Double sk4num;
|
||||
private Double xcnum;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
package com.dsic.gj_erp.controller.jhgk;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateRange;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.dsic.gj_erp.annotation.AuthFunction;
|
||||
import com.dsic.gj_erp.bean.ResultBean;
|
||||
import com.dsic.gj_erp.bean.jcsj.EmGcrl;
|
||||
import com.dsic.gj_erp.bean.jhgk.DmYdjh;
|
||||
import com.dsic.gj_erp.bean.jhgk.dto.RjhDto;
|
||||
import com.dsic.gj_erp.exception.CustomException;
|
||||
import com.dsic.gj_erp.mapper.jhgk.DmYdjhMapper;
|
||||
import com.dsic.gj_erp.service.jcsj.DmCzplpNewService;
|
||||
import com.dsic.gj_erp.service.jcsj.EmGcrlService;
|
||||
import com.dsic.gj_erp.service.jhgk.DmYdjhService;
|
||||
import com.dsic.gj_erp.service.kc.ImCkwpkwpService;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xn
|
||||
* @since 2023-11-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rjhgz")
|
||||
public class RjhgzController {
|
||||
|
||||
@Autowired
|
||||
private DmYdjhMapper dmYdjhMapper;
|
||||
@Autowired
|
||||
private EmGcrlService gcrlService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param yf yyyy/MM
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getRjhList")
|
||||
public ResultBean<?> getRjhList(@RequestParam String yf){
|
||||
//当前月份日期 查询月份 默认当前月
|
||||
//维修时间
|
||||
//当前日期
|
||||
DateTime date= new DateTime();
|
||||
DateTime lastMonth=DateUtil.lastMonth();
|
||||
int days=Integer.parseInt(date.toString("dd"));
|
||||
//如果是本月 那就是今天
|
||||
//如果是其他月 就全月天数
|
||||
if (StrUtil.isNotEmpty(yf)){
|
||||
date= DateUtil.parseDate(yf);
|
||||
lastMonth=DateUtil.offsetMonth(date,-1);
|
||||
}
|
||||
//上月天数
|
||||
int lastMonthDays=Integer.parseInt(DateUtil.endOfMonth(lastMonth).toString("dd"));
|
||||
//本月日期list
|
||||
List<DateTime> dateTimes=DateUtil.rangeToList(DateUtil.beginOfMonth(date)
|
||||
, DateUtil.endOfMonth(date)
|
||||
, DateField.DAY_OF_YEAR);
|
||||
//工厂日历,取休息日
|
||||
List<EmGcrl> dateList=gcrlService.list(new QueryWrapper<EmGcrl>()
|
||||
.eq("substring(gl,0,8)",date.toString("yyyy/MM"))
|
||||
.eq("xxr","0"));
|
||||
|
||||
//字段灵活 map<> list<map> 跨位 计算列1 计算列2 计算列3 1日 2日 3日
|
||||
String[] gw={"抛丸", "数控1", "龙门1", "数控2", "龙门2", "数控3", "龙门3", "数控4", "七跨型材"};
|
||||
List<Map<String,Object>> list=new ArrayList<>();
|
||||
for (String s : gw) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
map.put("gw",s);
|
||||
list.add(map);
|
||||
}
|
||||
for (DateTime dateTime : dateTimes) {
|
||||
if (!dateTime.isAfter(new Date())){
|
||||
RjhDto dtos=dmYdjhMapper.getRjh(dateTime.toString("yyyy/MM/dd"));
|
||||
list.forEach(l->{
|
||||
if (ObjectUtil.isEmpty(dtos)){
|
||||
l.put("field_"+dateTime.toString("dd"),0);
|
||||
}else {
|
||||
if (l.get("gw").equals("抛丸")){
|
||||
l.put("field_"+dateTime.toString("dd"), ObjectUtil.isEmpty(dtos.getPwnum())?0:dtos.getPwnum());
|
||||
}
|
||||
if (l.get("gw").equals("数控1")){
|
||||
l.put("field_"+dateTime.toString("dd"),ObjectUtil.isEmpty(dtos.getSk1num())?0:dtos.getSk1num());
|
||||
}
|
||||
if (l.get("gw").equals("龙门1")){
|
||||
l.put("field_"+dateTime.toString("dd"),ObjectUtil.isEmpty(dtos.getLm1num())?0:dtos.getLm1num());
|
||||
}
|
||||
if (l.get("gw").equals("数控2")){
|
||||
l.put("field_"+dateTime.toString("dd"),ObjectUtil.isEmpty(dtos.getSk2num())?0:dtos.getSk2num());
|
||||
}
|
||||
if (l.get("gw").equals("龙门2")){
|
||||
l.put("field_"+dateTime.toString("dd"),ObjectUtil.isEmpty(dtos.getLm2num())?0:dtos.getLm2num());
|
||||
}
|
||||
if (l.get("gw").equals("数控3")){
|
||||
l.put("field_"+dateTime.toString("dd"),ObjectUtil.isEmpty(dtos.getSk3num())?0:dtos.getSk3num());
|
||||
}
|
||||
if (l.get("gw").equals("龙门3")){
|
||||
l.put("field_"+dateTime.toString("dd"),ObjectUtil.isEmpty(dtos.getLm3num())?0:dtos.getLm3num());
|
||||
}
|
||||
if (l.get("gw").equals("数控4")){
|
||||
l.put("field_"+dateTime.toString("dd"),ObjectUtil.isEmpty(dtos.getSk4num())?0:dtos.getSk4num());
|
||||
}
|
||||
if (l.get("gw").equals("七跨型材")){
|
||||
l.put("field_"+dateTime.toString("dd"),ObjectUtil.isEmpty(dtos.getXcnum())?0:dtos.getXcnum());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//上月日均完成
|
||||
RjhDto syRwc= dmYdjhMapper.getSyRwc(lastMonth.toString("yyyy/MM"),lastMonthDays);
|
||||
//本月日均计划
|
||||
RjhDto byRjh= dmYdjhMapper.getByRjh(date.toString("yyyy/MM"),days);
|
||||
//本月日均完成
|
||||
RjhDto byRwc= dmYdjhMapper.getSyRwc(date.toString("yyyy/MM"),days);
|
||||
|
||||
list.forEach(l->{
|
||||
if (l.get("gw").equals("抛丸")){
|
||||
l.put("rjwc_sy",syRwc.getPwnum());
|
||||
l.put("rjjh_by",byRjh.getPwnum());
|
||||
l.put("rjwc_by",byRwc.getPwnum());
|
||||
}
|
||||
if (l.get("gw").equals("数控1")){
|
||||
l.put("rjwc_sy",syRwc.getSk1num());
|
||||
l.put("rjjh_by",byRjh.getSk1num());
|
||||
l.put("rjwc_by",byRwc.getSk1num());
|
||||
}
|
||||
if (l.get("gw").equals("龙门1")){
|
||||
l.put("rjwc_sy",syRwc.getLm1num());
|
||||
l.put("rjjh_by",byRjh.getLm1num());
|
||||
l.put("rjwc_by",byRwc.getLm1num());
|
||||
}
|
||||
if (l.get("gw").equals("数控2")){
|
||||
l.put("rjwc_sy",syRwc.getSk2num());
|
||||
l.put("rjjh_by",byRjh.getSk2num());
|
||||
l.put("rjwc_by",byRwc.getSk2num());
|
||||
}
|
||||
if (l.get("gw").equals("龙门2")){
|
||||
l.put("rjwc_sy",syRwc.getLm2num());
|
||||
l.put("rjjh_by",byRjh.getLm2num());
|
||||
l.put("rjwc_by",byRwc.getLm2num());
|
||||
}
|
||||
if (l.get("gw").equals("数控3")){
|
||||
l.put("rjwc_sy",syRwc.getSk3num());
|
||||
l.put("rjjh_by",byRjh.getSk3num());
|
||||
l.put("rjwc_by",byRwc.getSk3num());
|
||||
}
|
||||
if (l.get("gw").equals("龙门3")){
|
||||
l.put("rjwc_sy",syRwc.getLm3num());
|
||||
l.put("rjjh_by",byRjh.getLm3num());
|
||||
l.put("rjwc_by",byRwc.getLm3num());
|
||||
}
|
||||
if (l.get("gw").equals("数控4")){
|
||||
l.put("rjwc_sy",syRwc.getSk4num());
|
||||
l.put("rjjh_by",byRjh.getSk4num());
|
||||
l.put("rjwc_by",byRwc.getSk4num());
|
||||
}
|
||||
if (l.get("gw").equals("七跨型材")){
|
||||
l.put("rjwc_sy",syRwc.getXcnum());
|
||||
l.put("rjjh_by",byRjh.getXcnum());
|
||||
l.put("rjwc_by",byRwc.getXcnum());
|
||||
}
|
||||
});
|
||||
return new ResultBean<>(list);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue