|
|
|
@ -89,8 +89,8 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
|
|
|
|
|
// 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 = "2024/04/01";
|
|
|
|
|
String end = "2024/05/01";
|
|
|
|
|
String begin = "2023/08/01";
|
|
|
|
|
String end = "2023/10/31";
|
|
|
|
|
//todo 零件
|
|
|
|
|
ljService.remove(new QueryWrapper<DmSygdMxLj>().between("xzglxq", begin, end));
|
|
|
|
|
//todo 三月滚动明细
|
|
|
|
@ -111,7 +111,10 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
|
|
|
|
|
ypc(mxList);
|
|
|
|
|
this.saveBatch(mxList);
|
|
|
|
|
baseMapper.setParent(begin, end);
|
|
|
|
|
ResultBean r = new ResultBean(mxList);
|
|
|
|
|
|
|
|
|
|
List<DmYdjhxf> list= tqSygd1(begin,end);
|
|
|
|
|
// ResultBean r = new ResultBean(mxList);
|
|
|
|
|
ResultBean r = new ResultBean(list);
|
|
|
|
|
r.setSuccess(true);
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
@ -125,7 +128,7 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
|
|
|
|
|
// 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(DateUtil.beginOfMonth(DateUtil.date()), DateUtil.endOfMonth(DateUtil.date()));
|
|
|
|
|
Map<String,List<RealCapacity>> rel=c.getRealCapacityMap();
|
|
|
|
|
Map<String,Map<String,List<RealCapacity>>> rel=c.getRealCapacityMap();
|
|
|
|
|
|
|
|
|
|
//加工工序list
|
|
|
|
|
List<EmSbcnp> sbcnp =c.getSbcnList();
|
|
|
|
@ -146,48 +149,65 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
|
|
|
|
|
* @param l 当前加工钢板
|
|
|
|
|
* @param list 加工顺序
|
|
|
|
|
*/
|
|
|
|
|
public void jggx(Map<String,List<RealCapacity>> rel,DmSygdMx l,List<EmSbcnp> list){
|
|
|
|
|
public void jggx( Map<String,Map<String,List<RealCapacity>>> rel,DmSygdMx l,List<EmSbcnp> list){
|
|
|
|
|
String date="";
|
|
|
|
|
Map<String,String> map=new TreeMap<>();
|
|
|
|
|
for (EmSbcnp cn : list) {
|
|
|
|
|
//上料
|
|
|
|
|
if (cn.getGx().equals("19")) {
|
|
|
|
|
date=xhcn(rel,cn.getSbbh(),cn.getGx(),1, date);
|
|
|
|
|
map=xhcn(rel,null,cn.getGx(),1, date);
|
|
|
|
|
date=map.get("jgsj");
|
|
|
|
|
l.setSlrq(date);
|
|
|
|
|
l.setSlsb(map.get("sbbh"));
|
|
|
|
|
}
|
|
|
|
|
//抛丸
|
|
|
|
|
if (cn.getGx().equals("20")) {
|
|
|
|
|
date=xhcn(rel,cn.getSbbh(),cn.getGx(),1, date);
|
|
|
|
|
map=xhcn(rel,null,cn.getGx(),1, date);
|
|
|
|
|
date=map.get("jgsj");
|
|
|
|
|
l.setPwrq(date);
|
|
|
|
|
l.setPwsb(map.get("sbbh"));
|
|
|
|
|
}
|
|
|
|
|
//理料
|
|
|
|
|
if (cn.getGx().equals("21")) {
|
|
|
|
|
date=xhcn(rel,cn.getSbbh(),cn.getGx(),1, date);
|
|
|
|
|
map=xhcn(rel,null,cn.getGx(),1, date);
|
|
|
|
|
date=map.get("jgsj");
|
|
|
|
|
l.setLlrq(date);
|
|
|
|
|
l.setLlsb(map.get("sbbh"));
|
|
|
|
|
}
|
|
|
|
|
// 划线
|
|
|
|
|
if ("01,02".indexOf(cn.getGx()) > -1 && l.getHxcd()>0) {
|
|
|
|
|
date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getHxcd(), date);
|
|
|
|
|
map=xhcn(rel,cn.getKw(),cn.getGx(),1, date);
|
|
|
|
|
date=map.get("jgsj");
|
|
|
|
|
l.setHxrq(date);
|
|
|
|
|
l.setHxsb(map.get("sbbh"));
|
|
|
|
|
}
|
|
|
|
|
//切割
|
|
|
|
|
if ("03,04,05,06,07".indexOf(cn.getGx()) > -1 && l.getQgcd()>0) {
|
|
|
|
|
date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getQgcd(), date);
|
|
|
|
|
map=xhcn(rel,cn.getKw(),cn.getGx(),1, date);
|
|
|
|
|
date=map.get("jgsj");
|
|
|
|
|
l.setQgrq(date);
|
|
|
|
|
l.setQgsb(map.get("sbbh"));
|
|
|
|
|
}
|
|
|
|
|
// 坡口
|
|
|
|
|
if (ObjectUtil.isNotEmpty(l.getPkcd()) && ("08,10".indexOf(cn.getGx()) > 0)) {
|
|
|
|
|
date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getPkcd(), date);
|
|
|
|
|
map=xhcn(rel,cn.getKw(),cn.getGx(),1, date);
|
|
|
|
|
date=map.get("jgsj");
|
|
|
|
|
l.setPkrq(date);
|
|
|
|
|
l.setPksb(map.get("sbbh"));
|
|
|
|
|
}
|
|
|
|
|
// 打磨
|
|
|
|
|
if (ObjectUtil.isNotEmpty(l.getDmcd()) && ("16,13".indexOf(cn.getGx()) > 0)) {
|
|
|
|
|
date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getDmcd(), date);
|
|
|
|
|
map=xhcn(rel,cn.getKw(),cn.getGx(),1, date);
|
|
|
|
|
date=map.get("jgsj");
|
|
|
|
|
l.setDmrq(date);
|
|
|
|
|
l.setDmsb(map.get("sbbh"));
|
|
|
|
|
}
|
|
|
|
|
// 曲 (个)
|
|
|
|
|
if (StrUtil.isNotEmpty(l.getQbs()) && cn.getGx().equals("18")) {
|
|
|
|
|
date=xhcn(rel,cn.getSbbh(),cn.getGx(),l.getLjsl(), date);
|
|
|
|
|
map=xhcn(rel,cn.getKw(),cn.getGx(),1, date);
|
|
|
|
|
date=map.get("jgsj");
|
|
|
|
|
l.setQjgrq(date);
|
|
|
|
|
l.setQsb(map.get("sbbh"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 号料 手工切割 倒棱 切端头 自由边 预组
|
|
|
|
@ -197,38 +217,56 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
|
|
|
|
|
/**
|
|
|
|
|
* 消耗产能
|
|
|
|
|
* @param rel 实际产能,默认未来三个月
|
|
|
|
|
* @param sbbh 设备编号
|
|
|
|
|
* @param kw 跨位
|
|
|
|
|
* @param gx 工序
|
|
|
|
|
* @param gzl 工作量
|
|
|
|
|
* @param kssj 上一道工序的加工时间
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String xhcn(Map<String,List<RealCapacity>> rel,String sbbh,String gx,double gzl ,String kssj){
|
|
|
|
|
String jgsj="";
|
|
|
|
|
if (gzl==0)return jgsj;
|
|
|
|
|
public Map xhcn(Map<String,Map<String,List<RealCapacity>>> rel,String kw,String gx,double gzl ,String kssj){
|
|
|
|
|
Map<String,String> map=new TreeMap<>();
|
|
|
|
|
map.put("jgsj","");
|
|
|
|
|
map.put("sbbh","");
|
|
|
|
|
if (gzl==0)return map;
|
|
|
|
|
String kwAndGx=kw+gx;
|
|
|
|
|
for (String date:rel.keySet()){
|
|
|
|
|
if (date.compareTo(kssj)>=0||StrUtil.isEmpty(kssj)){
|
|
|
|
|
for (RealCapacity l:rel.get(date)){
|
|
|
|
|
if (l.getDeviceName().equals(sbbh)&&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;
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isEmpty(kssj)||date.compareTo(kssj)>=0){
|
|
|
|
|
//日期下 跨位+工序分组
|
|
|
|
|
Map<String,List<RealCapacity>> kwMap= rel.get(date);
|
|
|
|
|
if (ObjectUtil.isEmpty(kwMap.get(kwAndGx)))break;
|
|
|
|
|
for (RealCapacity l : kwMap.get(kwAndGx)) {
|
|
|
|
|
if (l.getCapacity()>=gzl){
|
|
|
|
|
int index = rel.get(date).get(kwAndGx).indexOf(l);
|
|
|
|
|
l.setCapacity(l.getCapacity()-gzl);
|
|
|
|
|
rel.get(date).get(kwAndGx).set(index,l);
|
|
|
|
|
map.put("jgsj",l.getDate());
|
|
|
|
|
map.put("sbbh",l.getDeviceName());
|
|
|
|
|
return map;
|
|
|
|
|
}else if (l.getCapacity()!=0.0){
|
|
|
|
|
gzl=gzl-l.getCapacity();
|
|
|
|
|
l.setCapacity(new Double(0.0));
|
|
|
|
|
int index = rel.get(date).get(kwAndGx).indexOf(l);
|
|
|
|
|
rel.get(date).get(kwAndGx).set(index,l);
|
|
|
|
|
map.put("jgsj",l.getDate());
|
|
|
|
|
map.put("sbbh",l.getDeviceName());
|
|
|
|
|
// break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// for (String kwAndGx :kwMap.keySet()){
|
|
|
|
|
// if (kwAndGx.equals(kw+gx)){
|
|
|
|
|
// // 设备 list
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// for (RealCapacity l:rel.get(date)){
|
|
|
|
|
// //设备 改为 跨位
|
|
|
|
|
// if (l.getKw().equals(kw)&&l.getGx().equals(gx)){
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return jgsj;
|
|
|
|
|
return map;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -762,4 +800,45 @@ public class DmSygdMxServiceImpl extends ServiceImpl<DmSygdMxMapper, DmSygdMx> i
|
|
|
|
|
sygdService.saveBatch(sygdList);
|
|
|
|
|
return new ResultBean(sygdList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
public List<DmYdjhxf> tqSygd1(String begin,String end){
|
|
|
|
|
|
|
|
|
|
List<DmYdjhxf> list= baseMapper.tqSygd1(begin,end);
|
|
|
|
|
List<DmYdjhxf> list2=new ArrayList<>();
|
|
|
|
|
//1行分为两行
|
|
|
|
|
for (DmYdjhxf l : list) {
|
|
|
|
|
DmYdjhxf ydjhxf1=new DmYdjhxf();//第二行
|
|
|
|
|
ydjhxf1.setDcCh(l.getDcCh());
|
|
|
|
|
ydjhxf1.setDcPl(l.getDcPl());
|
|
|
|
|
String[] fds= l.getDcFd().split(" ");
|
|
|
|
|
double count= fds.length%2;
|
|
|
|
|
int index;
|
|
|
|
|
if (count>0){
|
|
|
|
|
index= (fds.length/2)+1;
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
index= fds.length/2;
|
|
|
|
|
}
|
|
|
|
|
String fd1= Arrays.toString(Arrays.copyOfRange(fds, 0, index)).replace(","," ");// 截取索引0(包括)到索引index(不包括)的元素
|
|
|
|
|
String fd2= Arrays.toString(Arrays.copyOfRange(fds, index, fds.length)).replace(","," ");
|
|
|
|
|
|
|
|
|
|
l.setDcFd(fd1.substring(1,fd1.lastIndexOf("]")));
|
|
|
|
|
ydjhxf1.setDcFd(fd2.substring(1,fd2.lastIndexOf("]")));
|
|
|
|
|
ydjhxf1.setEksk(l.getEksk2());
|
|
|
|
|
ydjhxf1.setEkskks(l.getEkskks2());
|
|
|
|
|
if (StrUtil.isNotEmpty(l.getSkbs())){
|
|
|
|
|
l.setZl("X");//4跨普通板
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.isNotEmpty(l.getSkbs2())){
|
|
|
|
|
ydjhxf1.setZl("Z");//2跨T型材腹板
|
|
|
|
|
}
|
|
|
|
|
ydjhxf1.setSkbs(l.getSkbs2());
|
|
|
|
|
ydjhxf1.setSkqgks(l.getSkqgks2());
|
|
|
|
|
list2.add(l);
|
|
|
|
|
list2.add(ydjhxf1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|