三月滚动计划重新排产

master
xiaoning 1 year ago
parent dee18115ca
commit 7bbe788e2f

@ -301,5 +301,10 @@ public class EmSbjbb implements Serializable {
private Integer xqrs;
private String gz;
private String tzbh;
private String gx;
}

@ -53,7 +53,7 @@ public class EmSbjgry implements Serializable {
@ApiModelProperty(value = "设备编号")
private String sbbh;
@ApiModelProperty(value = "状态;01在职02离职")
@ApiModelProperty(value = "状态;YGZT ")
private String zt;
private String gz;

@ -3,6 +3,7 @@ package com.dsic.gj_erp.controller.jhgk;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsic.gj_erp.annotation.AuthFunction;
import com.dsic.gj_erp.bean.ResultBean;
@ -13,6 +14,7 @@ import com.dsic.gj_erp.bean.jcsj.EmSbjbb;
import com.dsic.gj_erp.bean.jhgk.DmQfxq;
import com.dsic.gj_erp.bean.jhgk.DmSygd;
import com.dsic.gj_erp.bean.jhgk.DmSygdMx;
import com.dsic.gj_erp.handler.ComputePlan;
import com.dsic.gj_erp.service.jcsj.EmGcrlService;
import com.dsic.gj_erp.service.jcsj.EmSbcnpService;
import com.dsic.gj_erp.service.jhgk.DmSygdMxService;
@ -113,6 +115,7 @@ public class DmSygdMxController {
@RequestMapping("/sygdPC")
@AuthFunction
public ResultBean sygdPC(){
return service.sygdPC();
}

@ -4,25 +4,23 @@ 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.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsic.gj_erp.bean.SpringContextHolder;
import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.bean.jcsj.EmGcrl;
import com.dsic.gj_erp.bean.jcsj.EmSbcnp;
import com.dsic.gj_erp.bean.jcsj.EmSbjbb;
import com.dsic.gj_erp.bean.jcsj.*;
import com.dsic.gj_erp.bean.jhgk.DmSygdMx;
import com.dsic.gj_erp.handler.dto.RealCapacity;
import com.dsic.gj_erp.service.jcsj.EmGcrlService;
import com.dsic.gj_erp.service.jcsj.EmSbcnpService;
import com.dsic.gj_erp.service.jcsj.EmSbjbbService;
import com.dsic.gj_erp.service.jcsj.EmSbjgryService;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Getter
@ -35,13 +33,15 @@ public class ComputePlan {
Map<String, EmSbcnp> baseCapacity;
Map<String,Integer> empSizeByDay;
Map<String,List<EmSbjgry>> empSizeByDay;
List<EmGcrl> gcrlList;
JSONObject realCapacityMap;
Map<String,List<RealCapacity>> realCapacityMap;
List<EmSbjbb> deviceList;
List<EmSbcnp> sbcnList;
JSONObject realDeviceList;
@ -65,12 +65,16 @@ public class ComputePlan {
* @param to
*/
public static void computeRealCapacity(Date from, Date to) {
JSONObject _realCapacity = instance().realCapacityMap = new JSONObject();
Map<String,List<RealCapacity>> _realCapacity = instance().realCapacityMap = new TreeMap<>();
//加载工厂日历
initGcrl();
//加载设备信息
initDevice();
//加载工作人员
initEmp(from, to);
//加载产能信息
initSbcn();
//计算周期内按天分解的实际可用设备产能
initRealDeviceList(from, to);
@ -81,9 +85,9 @@ public class ComputePlan {
.filter(item -> "1".equals(item.getXxr()))
.filter(item -> DateUtil.isIn(DateUtil.parse(item.getGl(), "yyyy/MM/dd"), from, to))
.collect(Collectors.toList());
// Collections.sort(gcrlList,Comparator.comparing(EmGcrl::getGl,(t1,t2)->t1.compareTo(t2)));
gcrlList.forEach(gcrl -> {
if (realDeviceList == null) {
if (realDeviceList .size()<1 || ObjectUtil.isEmpty(realDeviceList.getJSONArray(gcrl.getGl()))) {
return;
}
//日可用设备
@ -91,14 +95,21 @@ public class ComputePlan {
JSONObject deviceJson = realDeviceList.getJSONArray(gcrl.getGl()).getJSONObject(i);
//日实际产能
//todo 设备和产能对应关系,找出当前设备产能
RealCapacity realCapacity = initRealCapacity(gcrl, deviceJson.getString("sbbh"), new EmSbcnp());
//todo 设备和产能对应关系,找出当前设备产能 (日期 产能 工序 图纸名称)
RealCapacity realCapacity = initRealCapacity(gcrl, deviceJson);
if (realCapacity.getCapacity()==0){
continue;
}
if (_realCapacity.containsKey(gcrl.getGl())) {
_realCapacity.getJSONObject(gcrl.getGl()).put(realCapacity.getDeviceName(), realCapacity.getCapacity());
_realCapacity.get(gcrl.getGl()).
// put(realCapacity.getDeviceName(), realCapacity.getCapacity());
add(realCapacity);
} else {
JSONObject object = new JSONObject();
object.put(realCapacity.getDeviceName(), realCapacity.getCapacity());
_realCapacity.put(gcrl.getGl(), object);
// JSONObject object = new JSONObject();
// object.put(realCapacity.getDeviceName(), realCapacity.getCapacity());
List<RealCapacity> list=new ArrayList<>();
list.add(realCapacity);
_realCapacity.put(gcrl.getGl(), list);
}
}
});
@ -109,11 +120,21 @@ public class ComputePlan {
*
*/
public static void initGcrl() {
if (instance().gcrlList == null){
// if (instance().gcrlList == null){
instance().gcrlList = getBean(EmGcrlService.class).getList(new JSONObject());
}
// }
}
/**
*
*/
public static void initSbcn() {
// if (instance().sbcnList == null){
instance().sbcnList = getBean(EmSbcnpService.class).getList(new JSONObject());
// }
}
public static void initDeviceCapacity() {
if (instance().baseCapacity == null) {
instance().baseCapacity = getBean(EmSbcnpService.class).getMap();
@ -131,24 +152,38 @@ public class ComputePlan {
* @param flag
*/
public static void initRealDeviceList(Date from, Date to,boolean flag) {
if (instance().realDeviceList == null||flag) {
// if (ObjectUtil.isEmpty(instance().realDeviceList)||flag) {
JSONObject realDeviceList = instance().realDeviceList = new JSONObject();
List<EmSbjbb> list = instance().deviceList;
DateRange dateRange = new DateRange(from, to, DateField.DAY_OF_YEAR);
List<EmSbjbb> canUseDevice = list.stream().filter(item -> "0".equals(item.getSbyxzt())).collect(Collectors.toList());
//计算可用设备的可用日期
Map<String, Integer> _empSizeByDay = instance().empSizeByDay;
Map<String, List<EmSbjgry>> _empSizeByDay = instance().empSizeByDay;
canUseDevice.forEach(item -> {
String[] whArr = item.getWhsj().split("_");
if (whArr.length < 2) {
//未定义图纸及工序的设备,无法参加排产
if (StrUtil.hasEmpty(item.getTzbh(),item.getGx())){
return;
}
DateRange tmpRange = new DateRange(DateUtil.parse(whArr[0], "yyyy/MM/dd"), DateUtil.parse(whArr[1], "yyyy/MM/dd"), DateField.DAY_OF_YEAR);
List<DateTime> dateTimes = DateUtil.rangeNotContains(dateRange, tmpRange);
//维修时间
List<DateTime> dateTimes ;
if (StrUtil.isNotEmpty(item.getWhsj())){
String[] whArr = item.getWhsj().split("_");
if (whArr.length < 2) {
return;
}
DateRange dateRange = new DateRange(from, to, DateField.DAY_OF_YEAR);//需要放到循环内,放外边不能重复使用
DateRange tmpRange = new DateRange(DateUtil.parse(whArr[0], "yyyy/MM/dd"), DateUtil.parse(whArr[1], "yyyy/MM/dd"), DateField.DAY_OF_YEAR);
dateTimes = DateUtil.rangeNotContains( tmpRange,dateRange);
}else {
dateTimes=DateUtil.rangeToList(from, to, DateField.DAY_OF_YEAR);
}
dateTimes.forEach(date -> {
String dateStr = date.toString("yyyy/MM/dd");
//todo 根据人员请假情况,计算当前日期设备是否可用
if (_empSizeByDay.get(dateStr)<=0){
if (ObjectUtil.isEmpty(_empSizeByDay)||_empSizeByDay.get(dateStr).size()<=0){
return;
}
if (realDeviceList.get(dateStr) == null) {
@ -160,10 +195,34 @@ public class ComputePlan {
}
});
});
}
// }
}
public static void initEmp(Date from,Date to){
//设备编号? 人员 休假日期 状态(在职)
if (ObjectUtil.isEmpty(instance().empSizeByDay)){
Map<String,List<EmSbjgry>> empSizeByDay= instance().empSizeByDay=new HashMap<>();
//1.全部工作人员 状态(在职)
List<EmSbjgry> empList = getBean(EmSbjgryService.class).list(Wrappers.<EmSbjgry>lambdaQuery().eq(EmSbjgry::getZt,"01"));
//2.根据休息时间范围取差集
empList.forEach(emp->{
DateRange dateRange = new DateRange(from, to, DateField.DAY_OF_YEAR);//需要放到循环内,放外边不能重复使用
DateRange tmpRange = new DateRange(DateUtil.parse(emp.getXjsjKs(), "yyyy/MM/dd"), DateUtil.parse(emp.getXjsjJs(), "yyyy/MM/dd"), DateField.DAY_OF_YEAR);
List<DateTime> dateTimes = DateUtil.rangeNotContains( tmpRange,dateRange);
dateTimes.forEach(date->{
String dateStr = date.toString("yyyy/MM/dd");
if (ObjectUtil.isEmpty(empSizeByDay)||empSizeByDay.get(dateStr) == null) {
List<EmSbjgry> arr = new ArrayList<>();
arr.add(emp);
empSizeByDay.put(dateStr, arr);
} else {
empSizeByDay.get(dateStr).add(emp);
}
});
});
}
}
@ -181,23 +240,38 @@ public class ComputePlan {
return instance;
}
private static RealCapacity initRealCapacity(EmGcrl gcrl, String name, EmSbcnp sbcnp) {
private static RealCapacity initRealCapacity(EmGcrl gcrl, JSONObject deviceJson) {
//设备产能,根据图号和工序去重,注意:同图号和工序下,不同组立对应的产能要一致
List<EmSbcnp> list = instance().sbcnList.stream()
.collect(Collectors.collectingAndThen(Collectors.toCollection(()->
new TreeSet<>(Comparator.comparing(o->o.getTzbh()+o.getGx()))),ArrayList::new));
String gx=deviceJson.getString("gx");
String tzbh=deviceJson.getString("tzbh");
RealCapacity capacity = new RealCapacity();
if ("3".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegs() * 7 + sbcnp.getDegsYb() * 7);
}
if ("1".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegs() * 7);
}
if ("2".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegsYb() * 7);
}
capacity.setDeviceName(name);
list.forEach(sbcnp->{
if (sbcnp.getGx().equals(gx)&&
sbcnp.getTzbh().equals(tzbh)){
if ("3".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegs() * 7 + sbcnp.getDegsYb() * 7);
}
if ("1".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegs() * 7);
}
if ("2".equals(gcrl.getPb())) {
capacity.setCapacity(sbcnp.getDegsYb() * 7);
}
}
});
capacity.setDeviceName(deviceJson.getString("sbbh"));
capacity.setDate(gcrl.getGl());
capacity.setGx(gx);
capacity.setTzbh(tzbh);
return capacity;
}
private static <T> T getBean(Class<T> clazz) {
return SpringContextHolder.getBean(clazz);
}
}

@ -11,4 +11,5 @@ public class RealCapacity {
String date;
Double capacity;
String gx;
String tzbh;
}

@ -2,6 +2,7 @@ package com.dsic.gj_erp.service.jhgk.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@ -16,6 +17,8 @@ import com.dsic.gj_erp.bean.jcsj.EmSbcnp;
import com.dsic.gj_erp.bean.jcsj.excel.PlExcel;
import com.dsic.gj_erp.bean.jhgk.*;
import com.dsic.gj_erp.bean.jhgk.dto.*;
import com.dsic.gj_erp.handler.ComputePlan;
import com.dsic.gj_erp.handler.dto.RealCapacity;
import com.dsic.gj_erp.mapper.jcsj.DmBomMapper;
import com.dsic.gj_erp.mapper.jcsj.EmGcrlMapper;
import com.dsic.gj_erp.mapper.jhgk.DmSygdMxMapper;
@ -78,15 +81,15 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
* @return
*/
@Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Transactional
public ResultBean sygdPC() {
//todo 重复导入(三月滚动计划)的数据处理
//零件 删除
// String begin=DateUtil.format(DateUtil.nextMonth(),"yyyy/MM/01");
// String end =DateUtil.format(DateUtil.endOfMonth(DateUtil.offsetMonth(DateUtil.date(),3)),"yyyy/MM/dd");
String begin=DateUtil.format(DateUtil.nextMonth(),"yyyy/MM/01");
String end =DateUtil.format(DateUtil.endOfMonth(DateUtil.offsetMonth(DateUtil.date(),3)),"yyyy/MM/dd");
//测试日期
String begin = "2023/08/01";
String end = "2023/10/31";
// String begin = "2023/08/01";
// String end = "2023/10/31";
//todo 零件
ljService.remove(new QueryWrapper<DmSygdMxLj>().between("xzglxq", begin, end));
//todo 三月滚动明细
@ -117,11 +120,130 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
* @param list
*/
public void ypc(List<DmSygdMx> list) {
Map<String, List<DmSygdMx>> mxMap = list.stream().filter(l->StrUtil.isNotEmpty(l.getTzbh())).collect(Collectors.groupingBy(l -> l.getKw() + l.getZl()));
ComputePlan c=ComputePlan.instance();
c.computeRealCapacity();
Map<String,List<RealCapacity>> rel=c.getRealCapacityMap();
//加工工序list
List<EmSbcnp> sbcnp =c.getSbcnList();
Map<String, List<EmSbcnp>> cnMap = sbcnp.stream().collect(Collectors.groupingBy(l -> l.getTzbh() + l.getZl()));
for (String ljkey : mxMap.keySet()) {
//对应加工顺序
List<EmSbcnp> jgsxList= cnMap.get(ljkey);
//加工板材
List<DmSygdMx> mxs = mxMap.get(ljkey);
if (ObjectUtil.isEmpty(jgsxList)||jgsxList.size()<1 ){
continue;
}
mxs.forEach(l->{
jggx(rel,l,jgsxList);
});
}
}
/**
*
* @param rel
* @param l
* @param list
*/
public void jggx(Map<String,List<RealCapacity>> rel,DmSygdMx l,List<EmSbcnp> list){
String date="";
for (EmSbcnp cn : list) {
//上料
if (cn.getGx().equals("19")) {
date=xhcn(rel,l.getKw(),cn.getGx(),1, date);
l.setSlrq(date);
}
//抛丸
if (cn.getGx().equals("20")) {
date=xhcn(rel,l.getKw(),cn.getGx(),1, date);
l.setPwrq(date);
}
//理料
if (cn.getGx().equals("21")) {
date=xhcn(rel,l.getKw(),cn.getGx(),1, date);
l.setLlrq(date);
}
// 划线
if ("01,02".indexOf(cn.getGx()) > -1) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getHxcd(), date);
l.setHxrq(date);
}
//切割
if ("03,04,05,06,07".indexOf(cn.getGx()) > -1) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getQgcd(), date);
l.setQgrq(date);
}
// 坡口
if (ObjectUtil.isNotEmpty(l.getPkcd()) && ("08,10".indexOf(cn.getGx()) > 0)) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getPkcd(), date);
l.setPkrq(date);
}
// 打磨
if (ObjectUtil.isNotEmpty(l.getDmcd()) && ("16,13".indexOf(cn.getGx()) > 0)) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getDmcd(), date);
l.setDmrq(date);
}
// 曲 (个)
if (StrUtil.isNotEmpty(l.getQbs()) && cn.getGx().equals("18")) {
date=xhcn(rel,l.getKw(),cn.getGx(),l.getLjsl(), date);
l.setQjgrq(date);
}
// 号料 手工切割 倒棱 切端头 自由边 预组
}
}
/**
*
* @param rel ,
* @param tzbh tzbhkw
* @param gx
* @param gzl
* @param kssj
* @return
*/
public String xhcn(Map<String,List<RealCapacity>> rel,String tzbh,String gx,double gzl ,String kssj){
String jgsj="";
if (gzl==0)return jgsj;
for (String date:rel.keySet()){
if (date.compareTo(kssj)>=0||StrUtil.isEmpty(kssj)){
for (RealCapacity l:rel.get(date)){
if (l.getTzbh().equals(tzbh)&&l.getGx().equals(gx)){
if (l.getCapacity()>=gzl){
int index = rel.get(date).indexOf(l);
l.setCapacity(l.getCapacity()-gzl);
rel.get(date).set(index,l);
jgsj=l.getDate();
return jgsj;
}else if (l.getCapacity()!=0.0){
gzl=gzl-l.getCapacity();
l.setCapacity(new Double(0.0));
int index = rel.get(date).indexOf(l);
rel.get(date).set(index,l);
break;
}
}
}
}
}
return jgsj;
}
public void ypc_old(List<DmSygdMx> list) {
Map<String, List<DmSygdMx>> mxMap = list.stream().collect(Collectors.groupingBy(x -> x.getKw() + x.getZl()));
//加工工序list
List<EmSbcnp> sbcnp = sbcnpService.list(new QueryWrapper<EmSbcnp>().orderByDesc("tzbh,zl,jgsx"));
Map<String, List<EmSbcnp>> cnMap = sbcnp.stream().collect(Collectors.groupingBy(l -> l.getTzbh() + l.getZl()));
for (String ljkey : mxMap.keySet()) {
List<EmSbcnp> jgsx= cnMap.get(ljkey);
for (String cnkey : cnMap.keySet()) {
if (ljkey.equals(cnkey)) {
List<DmSygdMx> mxs = mxMap.get(ljkey);
@ -181,51 +303,18 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
if (pwflag.get()&&StrUtil.isNotEmpty(l.getQgrq())){
l.setPwrq(DateUtil.offsetDay(DateUtil.parse(l.getQgrq(),"yyyy/MM/dd"),-2).toString("yyyy/MM/dd"));
}
if (slflag.get()&&StrUtil.isNotEmpty(l.getPwrq())){
l.setSlrq(DateUtil.offsetDay(DateUtil.parse(l.getPwrq(),"yyyy/MM/dd"),-2).toString("yyyy/MM/dd"));
}
this.save(l);
});
}
}
}
//********************************************************************
//1.根据组立结束时间排序,决定生产顺序
// list = list.stream().sorted(Comparator.comparing(DmSygdMx::getQgjssj, Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList());
// double days=list.size()/266.0;
// int day=(int)days;
// day+=((days-day)>0?1:0);
// //2.未来工厂日历信息
// String begin=list.get(0).getJssj();
// String end =DateUtil.format(DateUtil.offsetDay(DateUtil.parseDate(begin),day),"yyyy/MM/dd");
// List<EmGcrl> gcrlList = gcrlMapper.selectList(new QueryWrapper<EmGcrl>()
// .between("gl",begin,end)
// .orderByAsc("gl"));
//3.预排产
// 假设产能测算266.9;又套料图需当天完成
// for (int i = 0; i < gcrlList.size(); i++) {
// for (int j = 0; j < 266; j++) {
// int index = 266 * i + j;
// if (list.size() > index) {
// String sl= DateUtil.format(DateUtil.offsetDay(DateUtil.parseDate(gcrlList.get(i).getGl()),-1),"yyyy/MM/dd");
// list.get(index).setSlrq(sl);
// list.get(index).setPwrq(sl);
// list.get(index).setPw("1抛");
// list.get(index).setHxrq(gcrlList.get(i).getGl());
// list.get(index).setQgrq(gcrlList.get(i).getGl());
// list.get(index).setXxr(gcrlList.get(i).getXxr());
// } else {
// j = 266;
// i = gcrlList.size();
// }
// }
// //
// }
// this.saveBatch(list);
}
public String getRq(Double gs, String rq) {
double ts = gs / 8;
int num = (int) ts;

@ -1,6 +1,7 @@
package com.dsic.gj_erp.service.jhgk.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -10,6 +11,7 @@ import com.dsic.gj_erp.mapper.jhgk.DmXbjhMapper;
import com.dsic.gj_erp.service.jhgk.DmXbjhService;
import com.dsic.gj_erp.util.ExcelUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.tomcat.util.http.parser.Ranges;
import org.modelmapper.ModelMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -17,9 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -52,11 +52,25 @@ public class DmXbjhServiceImpl extends ServiceImpl<DmXbjhMapper, DmXbjh> impleme
String endTime=nf.split("~")[1];
queryWrapper.between("nf",startTime,endTime);
}
queryWrapper.orderByDesc("zl");
List<DmXbjh> dmTzjhs=dmXbjhMapper.selectList(queryWrapper);
Map<String,List<DmXbjh>> map=dmTzjhs.stream().collect(Collectors.groupingBy(DmXbjh::getDcCh));
return map;
Map<String,List<DmXbjh>> map=dmTzjhs.stream()
.collect(Collectors.groupingBy(DmXbjh::getDcCh));
//对map的value进行排序并返回降序以后的map集合
LinkedHashMap<String, List<DmXbjh>> collect = map.entrySet().stream().sorted((entry1, entry2) -> {
Double zl1=entry1.getValue().stream().filter(l->ObjectUtil.isNotEmpty(l.getZl())).mapToDouble(DmXbjh::getZl).sum();
Double zl2=entry2.getValue().stream().filter(l->ObjectUtil.isNotEmpty(l.getZl())).mapToDouble(DmXbjh::getZl).sum();
//降序排序
return zl2.compareTo(zl1);
}).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,(oldValue, newValue) -> oldValue, LinkedHashMap::new));
return collect;
}
@Override
public JSONObject upload(MultipartFile file) throws IOException {
// ExcelReader reader = ExcelUtil.getReader(file.getInputStream());

@ -80,10 +80,10 @@ public class DmYdjhServiceImpl extends ServiceImpl<DmYdjhMapper, DmYdjh> impleme
Map<String,Object> map=new HashMap<>();
//月度计划汇总
//汇总时生成切割之前的派工单 状态为空
// String begin= DateUtil.format(DateUtil.nextMonth(),"yyyy/MM/01");
// String end =DateUtil.format(DateUtil.endOfMonth(DateUtil.offsetMonth(DateUtil.date(),1)),"yyyy/MM/dd");
String begin="2023/08/01";
String end ="2023/08/31";
String begin= DateUtil.format(DateUtil.nextMonth(),"yyyy/MM/01");
String end =DateUtil.format(DateUtil.endOfMonth(DateUtil.offsetMonth(DateUtil.date(),1)),"yyyy/MM/dd");
// String begin="2023/08/01";
// String end ="2023/08/31";
//图纸计划
List<PgdTzjh> tzjhList=tzjhService.list(new QueryWrapper<PgdTzjh>().between("qgxqrq",begin,end).orderByAsc("czbh,pl,qgxqrq"));

@ -58,6 +58,9 @@ public class DmZrcjhServiceImpl extends ServiceImpl<DmZrcjhMapper, DmZrcjh> impl
if (StringUtils.isNotEmpty(json.getString("Zt"))) {
queryWrapper.eq("zt", json.getString("Zt"));
}
if (StringUtils.isNotEmpty(json.getString("dcCh"))) {
queryWrapper.eq("DC_CH", json.getString("dcCh"));
}
queryWrapper.orderByAsc("DC_CH,cast(DC_PL as int)");
// queryWrapper.orderByAsc("DC_PL");
List<DmZrcjh> dmZrcjhs = dmZrcjhMapper.selectList(queryWrapper);

@ -23,13 +23,37 @@ public class ExcelUtil {
public static Map<String,String> ZRCJHKeyMap=new HashMap<String,String>(){
{
//put("状态","zt");put("周期(天)","b");
put("船号","dcCh");put("区域","qy");put("总段号","zdh"); put("预组段","yzd");put("分段号","dcFd");put("重量","zl");
put("批量号","dcPl");put("大组开始","kssjDz");put("钢加结束大组","gjjsDz");put("小组结束","jssjXz");put("小组周期","xzzq"); put("小组开始","kssjXz");
put("线表重量","xbzl");put("批量表(钢加大组结束)","gjjsDzPl");put("时间差L-P","sjcLp");put("钢加小组结束","gjjsXz");put("批量表(钢加小组结束)","gjjsXzPl");
put("船号","dcCh");
put("区域","qy");
put("总段号","zdh");
put("预组段","yzd");
put("分段号","dcFd");
put("重量","zl");
put("批量号","dcPl");
put("大组开始","kssjDz");
put("钢加结束大组","gjjsDz");
put("小组结束","jssjXz");
put("小组周期","xzzq");
put("小组开始","kssjXz");
put("线表重量","xbzl");
put("批量表(钢加大组结束)","gjjsDzPl");
put("时间差L-P","sjcLp");
put("钢加小组结束","gjjsXz");
put("批量表(钢加小组结束)","gjjsXzPl");
put("时间差R-S","sjcRs");
put("钢加开始","gjks"); put("批量表(钢加开始)","gjksPl");put("时间差U-V","sjcUv");put("套料图下发","xfqTlt");
put("套料图接收","jsqTlt");put("板材领取表下发","xfqLqb");put("板材领取表接收","jsqLqb");put("零件配套表下发","xfqPtb");put("零件配套表接收","jsqPtb");
put("订货清单号","dhqd");put("订货清单下发","xfqDhqd");put("实际订货日期","sjdhq");put("板材计划到齐","bcdq");
put("钢加开始","gjks");
put("批量表(钢加开始)","gjksPl");
put("时间差U-V","sjcUv");
put("套料图下发","xfqTlt");
put("套料图接收","jsqTlt");
put("板材领取表下发","xfqLqb");
put("板材领取表接收","jsqLqb");
put("零件配套表下发","xfqPtb");
put("零件配套表接收","jsqPtb");
put("订货清单号","dhqd");
put("订货清单下发","xfqDhqd");
put("实际订货日期","sjdhq");
put("板材计划到齐","bcdq");
}
};
@ -169,7 +193,7 @@ public class ExcelUtil {
Workbook workbook=isWorkBook(file);
// 获取第一张表
Sheet sheet = workbook.getSheetAt(0);
Row monthRow=sheet.getRow(3);
Row monthRow=sheet.getRow(2);
Map<Integer,String> monthMap=new HashMap<>();
for (int index = 0; index < monthRow.getPhysicalNumberOfCells(); index++){
Cell cell = monthRow.getCell(index);
@ -181,7 +205,7 @@ public class ExcelUtil {
// List<Map<String,Object>> mapList=new ArrayList<>();
// List<DmXbjh> dmXbjhs=new ArrayList<>();
JSONObject jsonObject=new JSONObject();
for (int i = 4; i < sheet.getPhysicalNumberOfRows(); i++) {
for (int i = 3; i < sheet.getPhysicalNumberOfRows(); i++) {
Row row = sheet.getRow(i);
String dcch=row.getCell(0).toString();
if (dcch.contains("待接")||dcch.contains("已接")||dcch.contains("合计")){
@ -199,7 +223,7 @@ public class ExcelUtil {
continue;
}
String cl=cell+"";
String year=getMergedRegionValue(sheet,2,index).toString();
String year=getMergedRegionValue(sheet,1,index).toString();
// DmXbjh dmXbjh=new DmXbjh();
Map map=new HashMap();
map.put("zt","0");

Loading…
Cancel
Save