add mrp function to aps

yun-zuoyi
钮海涛 6 years ago
parent 76149da904
commit 5c68a15d0c

@ -0,0 +1,13 @@
package cn.estsh.i3plus.pojo.aps.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface RippleAnnotation {
String[] dependence() default {};
String method() default "";
}

@ -1,5 +1,6 @@
package cn.estsh.i3plus.pojo.aps.bean; package cn.estsh.i3plus.pojo.aps.bean;
import cn.estsh.i3plus.pojo.aps.annotation.RippleAnnotation;
import cn.estsh.i3plus.pojo.aps.common.BaseCode; import cn.estsh.i3plus.pojo.aps.common.BaseCode;
import cn.estsh.i3plus.pojo.aps.common.BeanRelation; import cn.estsh.i3plus.pojo.aps.common.BeanRelation;
import cn.estsh.i3plus.pojo.aps.enums.MATERIAL_TYPE; import cn.estsh.i3plus.pojo.aps.enums.MATERIAL_TYPE;
@ -66,6 +67,7 @@ public class Material extends BaseCode {
@Column(name="LEVEL") @Column(name="LEVEL")
@ApiParam(value ="低阶码") @ApiParam(value ="低阶码")
@RippleAnnotation(dependence = {"OperOutputs.Operation.ProductRouting.Material"}, method = "calcLevel")
private Integer level; private Integer level;
@Column(name="IS_AUTO_FIX_PEGGING") @Column(name="IS_AUTO_FIX_PEGGING")

@ -24,7 +24,7 @@ import java.util.List;
**/ **/
@Data @Data
@Entity @Entity
@Table(name = "APS_PRODUCTROUTING") @Table(name = "APS_PRODUCT_ROUTING")
@Api("物料") @Api("物料")
public class ProductRouting extends BaseCode { public class ProductRouting extends BaseCode {
@Column(name="VALID_START") @Column(name="VALID_START")

@ -155,13 +155,13 @@ public class Work extends BaseCode {
} }
@JsonBackReference @JsonBackReference
public List<WorkRelation> getWorkRelationInputs() { public List<WorkRelation> getPrevRelations() {
return BeanRelation.list(this, EWork.WorkRelationInputs); return BeanRelation.list(this, EWork.PrevRelations);
} }
@JsonBackReference @JsonBackReference
public List<WorkRelation> getWorkRelationOutputs() { public List<WorkRelation> getPostRelations() {
return BeanRelation.list(this, EWork.WorkRelationOutputs); return BeanRelation.list(this, EWork.PostRelations);
} }
@JsonBackReference @JsonBackReference

@ -117,6 +117,17 @@ public class BeanRelation {
return result; return result;
} }
public static <T extends BaseBean> List<T> listByClass(BaseBean bean, Class<T> cls, Enum<?> holder, Enum<?>... args) {
List<T> beans = new ArrayList<>();
List<BaseBean> nextBeans = list(bean, holder, args);
for (BaseBean nextBean : nextBeans) {
if (nextBean.getClass() == cls) {
beans.add((T)nextBean);
}
}
return beans;
}
private static <T extends BaseBean> void listImpl(List<T> result, BaseBean bean, Predicate<T> pred, Enum<?>[] holders, int index) { private static <T extends BaseBean> void listImpl(List<T> result, BaseBean bean, Predicate<T> pred, Enum<?>[] holders, int index) {
if (index >= holders.length) { if (index >= holders.length) {
if (pred == null || pred.test((T)bean)) { if (pred == null || pred.test((T)bean)) {
@ -191,7 +202,7 @@ public class BeanRelation {
* @param holder * @param holder
*/ */
private static void remove(BaseBean bean, Enum<?> holder) { private static void remove(BaseBean bean, Enum<?> holder) {
if (holder == null) { if (bean == null || holder == null) {
return; return;
} }
BeanInfo beanInfo = BeanInfo.getBeanInfo(bean.getClass()); BeanInfo beanInfo = BeanInfo.getBeanInfo(bean.getClass());
@ -215,7 +226,7 @@ public class BeanRelation {
* @param relaBean * @param relaBean
*/ */
private static void remove(BaseBean bean, Enum<?> holder, BaseBean relaBean) { private static void remove(BaseBean bean, Enum<?> holder, BaseBean relaBean) {
if (bean == null) { if (bean == null || holder == null) {
return; return;
} }
BeanInfo beanInfo = BeanInfo.getBeanInfo(bean.getClass()); BeanInfo beanInfo = BeanInfo.getBeanInfo(bean.getClass());

@ -6,8 +6,8 @@ public enum EWork {
WorkResources, WorkResources,
WorkInputs, WorkInputs,
WorkOutputs, WorkOutputs,
WorkRelationInputs, PrevRelations,
WorkRelationOutputs, PostRelations,
Operation, Operation,
PlanFeedbacks PlanFeedbacks
} }

@ -4,8 +4,8 @@
</Relation> </Relation>
<Relation field="Works" name="Work" reverse="Order" type="ONE_TO_MULTI" owner="true"> <Relation field="Works" name="Work" reverse="Order" type="ONE_TO_MULTI" owner="true">
</Relation> </Relation>
<Relation field="PrevRelations" name="WorkRelation" reverse="PrevOrder" type="ONE_TO_MULTI" owner="false"> <Relation field="PostRelations" name="WorkRelation" reverse="PrevOrder" type="ONE_TO_MULTI" owner="false">
</Relation> </Relation>
<Relation field="PostRelations" name="WorkRelation" reverse="PostOrder" type="ONE_TO_MULTI" owner="false"> <Relation field="PrevRelations" name="WorkRelation" reverse="PostOrder" type="ONE_TO_MULTI" owner="false">
</Relation> </Relation>
</Class> </Class>

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Class name="OperResource"> <Class name="OperResource">
<Relation field="Resource" name="Resource" reverse="OperResources" type="MULTI_TO_ONE" owner="false"> <Relation field="Resource" name="Resource" type="MULTI_TO_ONE" owner="false">
</Relation> </Relation>
</Class> </Class>

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Class name="Operation"> <Class name="Operation">
<Relation field="StandOperation" name="StandOperation" type="MULTI_TO_ONE" owner="false">
</Relation>
<Relation field="OperInputs" name="OperInput" reverse="Operation" type="ONE_TO_MULTI" owner="true"> <Relation field="OperInputs" name="OperInput" reverse="Operation" type="ONE_TO_MULTI" owner="true">
</Relation> </Relation>
<Relation field="OperOutputs" name="OperOutput" reverse="Operation" type="ONE_TO_MULTI" owner="true"> <Relation field="OperOutputs" name="OperOutput" reverse="Operation" type="ONE_TO_MULTI" owner="true">

@ -1,5 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Class name="StandOperation"> <Class name="StandOperation">
<Relation field="Operations" name="Operation" reverse="StandOperation" type="ONE_TO_MULTI" owner="false">
</Relation>
</Class> </Class>

@ -6,9 +6,9 @@
</Relation> </Relation>
<Relation field="WORK_RESOURCES" name="WorkResource" reverse="Work" type="ONE_TO_MULTI" owner="true"> <Relation field="WORK_RESOURCES" name="WorkResource" reverse="Work" type="ONE_TO_MULTI" owner="true">
</Relation> </Relation>
<Relation field="WorkRelationOutputs" name="WorkRelation" reverse="PrevWork" type="ONE_TO_MULTI" owner="false"> <Relation field="PostRelations" name="WorkRelation" reverse="PrevWork" type="ONE_TO_MULTI" owner="false">
</Relation> </Relation>
<Relation field="WorkRelationInputs" name="WorkRelation" reverse="PostWork" type="ONE_TO_MULTI" owner="false"> <Relation field="PrevRelations" name="WorkRelation" reverse="PostWork" type="ONE_TO_MULTI" owner="false">
</Relation> </Relation>
<Relation field="Operation" name="Operation" type="MULTI_TO_ONE" owner="false"> <Relation field="Operation" name="Operation" type="MULTI_TO_ONE" owner="false">
</Relation> </Relation>

Loading…
Cancel
Save