1.增加终止排产,当bom无法上料时终止并进行提醒

master
董哲奇 12 months ago
parent ab4fab389f
commit 603ea180df

@ -41,6 +41,13 @@ public class 三月滚动排产控制器 {
.execute(from,to); .execute(from,to);
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (RuntimeException e) {
e.printStackTrace();
ResultBean<?> resultBean = new ResultBean<>();
resultBean.setStatus(10000);
resultBean.setSuccess(false);
resultBean.setMessage(e.getMessage());
return resultBean;
} finally { } finally {
semaphore.release(); semaphore.release();
} }

@ -30,6 +30,7 @@ import java.io.OutputStream;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -48,11 +49,12 @@ public class DataFactory {
CountDownLatch latch = new CountDownLatch(.getBomList().size()); CountDownLatch latch = new CountDownLatch(.getBomList().size());
.getBomList().forEach(bom -> { .getBomList().forEach(bom -> {
_ = (bom); _ = (bom);
AtomicBoolean atomicBoolean = new AtomicBoolean(false);
if (_!=null){ if (_!=null){
_.set(.getXzglxq()); _.set(.getXzglxq());
es.execute(() -> { es.execute(() -> {
try{ try{
_.run(); _.run(atomicBoolean);
}finally { }finally {
latch.countDown(); latch.countDown();
} }
@ -60,6 +62,12 @@ public class DataFactory {
}else { }else {
latch.countDown(); latch.countDown();
} }
if(atomicBoolean.get()){
String errText = StrUtil.format("船号:{},批量:{},图号:{},需求日期:{},不满足上料需求",
bom.getDcch(), bom.getPl(), bom.getTzbh(), bom.getXzglxq());
(list);
throw new RuntimeException(errText);
}
}); });
try { try {
latch.await(10, TimeUnit.SECONDS);// 指定超时时间 latch.await(10, TimeUnit.SECONDS);// 指定超时时间
@ -68,7 +76,10 @@ public class DataFactory {
} }
}); });
System.out.println(Manager..size()); System.out.println(Manager..size());
//清理冗余数据 (list);
}
private static void (List<> list){
list.forEach(->{ list.forEach(->{
.getBomList().forEach(bom -> { .getBomList().forEach(bom -> {
if (bom.get()!=null){ if (bom.get()!=null){

@ -33,8 +33,7 @@ public abstract class 套料图工序 implements 套料图工序接口 {
protected Date _; protected Date _;
protected List<Constant.> ; protected List<Constant.> ;
@Override public void run(AtomicBoolean atomicBoolean) {
public void run() {
if (ObjUtil.isEmpty(this.bom)||StrUtil.isEmpty(this.bom.getTzbh())){ if (ObjUtil.isEmpty(this.bom)||StrUtil.isEmpty(this.bom.getTzbh())){
return; return;
} }
@ -56,11 +55,9 @@ public abstract class 套料图工序 implements 套料图工序接口 {
} }
} }
if (bom.get().size()==0||bom.get().get(0) != _) { if (bom.get().size()==0||bom.get().get(0) != Constant..) {
if (_ == Constant..){ Manager..add(this.bom);
Manager..add(this.bom); atomicBoolean.set(true);
System.out.println(this.bom.toString());
}
} }
} }
}); });

@ -17,17 +17,15 @@ public class 排产 {
List<> list; List<> list;
public static void execute(@NotNull String from, @NotNull String to) { public static void execute(@NotNull String from, @NotNull String to) {
_=null; _ = .of(from, to);
try { Manager. = _;
_ = .of(from,to); Manager.from = from;
DataFactory.2(); Manager.to = to;
}catch (Exception e){ DataFactory.();
e.printStackTrace(); DataFactory.();
}finally { DataFactory.();
if (_!=null){ DataFactory.();
_.complete = true; DataFactory.2();
}
}
} }
private static of(@NotNull String from, @NotNull String to){ private static of(@NotNull String from, @NotNull String to){
@ -36,13 +34,6 @@ public class 排产 {
.to = to; .to = to;
.complete = false; .complete = false;
.list = new ArrayList<>(); .list = new ArrayList<>();
Manager. = ;
Manager.from = from;
Manager.to = to;
DataFactory.();
DataFactory.();
DataFactory.();
DataFactory.();
return Manager.; return Manager.;
} }

@ -153,8 +153,8 @@ public class SYService {
* @param bmm * @param bmm
* @return * @return
*/ */
@Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class) // @Transactional(propagation = Propagation.REQUIRES_NEW,rollbackFor = Exception.class)
// @Transactional @Transactional
public String f_getpjh(String zxt,String jg,String bmm){ public String f_getpjh(String zxt,String jg,String bmm){
entityManager.clear(); // 清除缓存 entityManager.clear(); // 清除缓存
QDmBhdyp bhdy=QDmBhdyp.dmBhdyp; QDmBhdyp bhdy=QDmBhdyp.dmBhdyp;

Loading…
Cancel
Save