1.取消强占功能,资源不足时需要做提醒

master
董哲奇 12 months ago
parent c8eacf4703
commit 3924cc8ad6

@ -30,6 +30,7 @@ import java.io.OutputStream;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import static com.dsic.gj_erp.pc.Constant.CD;
@ -40,6 +41,7 @@ public class DataFactory {
public static void 2() {
.clear();
Manager.=new ArrayList<>();
List<> list=();
list.forEach( -> {
@ -65,6 +67,7 @@ public class DataFactory {
throw new RuntimeException(e);
}
});
System.out.println(Manager..size());
//清理冗余数据
list.forEach(->{
.getBomList().forEach(bom -> {
@ -79,10 +82,8 @@ public class DataFactory {
}
public static List<> (){
List<> list=new ArrayList<>();
List<DmSygdxq> = getBean(DmSygdxqService.class).getXqWithBom(from, to);
.forEach(item-> list.add(.of(item)));
return list;
return .stream().map(::of).collect(Collectors.toList());
}
public static void () {
@ -190,6 +191,9 @@ public class DataFactory {
return .values().stream().filter(->{
= .getMAP().get();
Date =DateUtil.parse(.getDate(),"yyyy/MM/dd");
if (==null){
return false;
}
return .()&&.after()&&.before();
}).findFirst();
}

@ -2,6 +2,7 @@ package com.dsic.gj_erp.pc;
import com.dsic.gj_erp.bean.jcsj.EmGcrl;
import com.dsic.gj_erp.bean.jcsj.EmSbjbb;
import com.dsic.gj_erp.pc.dto.data.Bom;
import com.dsic.gj_erp.pc.dto.data.;
import com.dsic.gj_erp.pc.dto.;
@ -24,7 +25,7 @@ public class Manager {
public static final ExecutorService es;
public static List<> ;
public static List<Bom> ;
static {
int poolSize =Runtime.getRuntime().availableProcessors() * 2;

@ -1,12 +1,16 @@
package com.dsic.gj_erp.pc.dto.data;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.dsic.gj_erp.bean.jcsj.DmBom;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.dto.;
import com.dsic.gj_erp.pc.dto.;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Getter
@ -28,12 +32,18 @@ public class Bom {
private Map<String,String> degs;
private ;
private ;
private List<Constant.> ;
public static Bom of(String xzxq, String dzxq, DmBom bom){
Bom _bom = new Bom();
BeanUtil.copyProperties(bom,_bom);
_bom.xzglxq=xzxq;
_bom.dzglxq=dzxq;
_bom. =new ArrayList<>();
return _bom;
}
public String toString() {
return JSONObject.toJSONString(this);
}
}

@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.dsic.gj_erp.pc.Constant;
import com.dsic.gj_erp.pc.Manager;
import com.dsic.gj_erp.pc.dto.data.Bom;
import com.dsic.gj_erp.pc.dto.data.;
import com.dsic.gj_erp.pc.service.;
@ -20,7 +21,6 @@ import static com.dsic.gj_erp.pc.Constant.工序CD;
import static com.dsic.gj_erp.pc.DataFactory.;
import static com.dsic.gj_erp.pc.DataFactory.;
import static com.dsic.gj_erp.pc.Manager.from;
import static com.dsic.gj_erp.pc.Manager.;
@Getter
@Setter
@ -41,18 +41,26 @@ public abstract class 套料图工序 implements 套料图工序接口 {
this._ = DateUtil.parse(this., "yyyy/MM/dd");
double = 1;
this..forEach(_ -> {
if (!this.(_)&&!this.(_,)){
if (bom.get() == null) {
Optional<> = (_, DateUtil.parse(from, "yyyy/MM/dd"), this._, );
if (!this.(_,)){
if (bom.get().size()==0||bom.get().get(0) != _) {
//可用资源最大前推日期设置为N天,最大前推日期意味从上料开始最小施工周期
//fixme 这里应该安装工序设置,暂时写死一个日期
Optional<> = (_, DateUtil.parse(from, "yyyy/MM/dd"), DateUtil.offsetDay(this._,0), );
if (!=null){
.ifPresent(_ -> {
_.(_,this.bom,);
if (_.(_,this.bom,)){
this.bom.set(_);
this.bom.get().add(0,_);
}
});
}
}
//没有可用资源放入月末(强占),待手工调整
if (bom.get() == null) {
_ = (DateUtil.endOfMonth(DateUtil.parse(this., "yyyy/MM/dd")));
_.(_,this.bom,);
if (bom.get().size()==0||bom.get().get(0) != _) {
if (_ == Constant..){
Manager..add(this.bom);
System.out.println(this.bom.toString());
}
}
}
});
@ -64,18 +72,20 @@ public abstract class 套料图工序 implements 套料图工序接口 {
_ = (dateTime);
AtomicBoolean =new AtomicBoolean(false);
try {
_.(_,this.bom,);
if (_.(_,this.bom,)){
this.bom.set(_);
this.bom.get().add(0,_);
.set(true);
}
}catch (Exception e){
e.printStackTrace();
}
return .get();
}
protected boolean (Constant. _){
= this.();
protected boolean (Constant. _,String ){
= .();
= null;
if ( != null) {
= .getMAP().get(_);
@ -89,10 +99,6 @@ public abstract class 套料图工序 implements 套料图工序接口 {
return false;
}
protected () {
return .get(this.bom.getTzbh());
}
@Override
public ( _) {
this._=_;

@ -70,8 +70,7 @@ public abstract class 工序产能 implements 工序排产处理接口 {
}
public Optional<> (double ){
return this..values().stream()
.filter(item -> this.(item., )).findFirst();
return this..values().stream().findAny();
}
public boolean (String ,double ){

@ -7,6 +7,10 @@ import lombok.Setter;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.dsic.gj_erp.pc.Manager.;
@Getter
@Setter
@ -24,14 +28,17 @@ public class 资源 {
});
}
public void (Constant. , Bom bom, double ){
public boolean (Constant. , Bom bom, double ){
AtomicBoolean atomicBoolean = new AtomicBoolean(false);
= MAP.get();
Optional.of().ifPresent(it->{
Optional.ofNullable().ifPresent(it->{
if (it.()){
it.(,bom);
(bom.getTzbh());
atomicBoolean.set(true);
}
});
return atomicBoolean.get();
}
public void (Constant. ,Bom bom,double ){
@ -42,8 +49,28 @@ public class 资源 {
});
}
private static Semaphore semaphore = new Semaphore(1);
protected static (String ) {
try {
semaphore.acquire();
return .get();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}finally {
semaphore.release();
}
}
protected void (String ) {
//套料图所占工序的资源.put(套料图号,this);
try {
semaphore.acquire();
.put(,this);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}finally {
semaphore.release();
}
}
public static of(String date,Map<Constant.,> MAP){

Loading…
Cancel
Save