From 5f3f973c3e2c7a82e5313cc5571b85c33b242091 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 22 Nov 2019 17:13:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=A5=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../estsh/i3plus/pojo/aps/bean/ExportProject.java | 3 +- .../estsh/i3plus/pojo/aps/bean/ImportProject.java | 2 +- .../i3plus/pojo/aps/bean/OvertimeCalendar.java | 5 + .../estsh/i3plus/pojo/aps/common/DateDuration.java | 104 ++++++++------------- .../cn/estsh/i3plus/pojo/aps/model/APSPager.java | 9 ++ .../estsh/i3plus/pojo/aps/model/ReportPager.java | 25 +++++ .../src/main/resources/relations/ExportProject.xml | 2 +- .../src/main/resources/relations/ImportProject.xml | 2 +- .../i3plus/pojo/base/enumutil/ApsEnumUtil.java | 56 ++++++++++- 9 files changed, 135 insertions(+), 73 deletions(-) create mode 100644 modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/model/ReportPager.java diff --git a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/ExportProject.java b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/ExportProject.java index 1a44c20..b8563c0 100644 --- a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/ExportProject.java +++ b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/ExportProject.java @@ -35,8 +35,7 @@ public class ExportProject extends BaseAPS { @Column(name="LINK_ID") @ApiParam(value ="数据连接对象") - @FieldAnnotation(property = false) - @JsonIgnore + @FieldAnnotation(relation = "Link", notEmpty = true) private Long linkId; public DataLink getLink() { diff --git a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/ImportProject.java b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/ImportProject.java index 3c78c4c..7d8f02d 100644 --- a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/ImportProject.java +++ b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/ImportProject.java @@ -34,7 +34,7 @@ public class ImportProject extends BaseAPS { @Column(name="LINK_ID") @ApiParam(value ="数据连接对象") - @FieldAnnotation(property = false) + @FieldAnnotation(relation = "Link", notEmpty = true) private Long linkId; public DataLink getLink() { diff --git a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/OvertimeCalendar.java b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/OvertimeCalendar.java index b16377c..0281199 100644 --- a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/OvertimeCalendar.java +++ b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/bean/OvertimeCalendar.java @@ -1,5 +1,6 @@ package cn.estsh.i3plus.pojo.aps.bean; +import cn.estsh.i3plus.pojo.aps.annotation.FieldAnnotation; import cn.estsh.i3plus.pojo.aps.common.BaseAPS; import cn.estsh.i3plus.pojo.base.enumutil.ApsEnumUtil; import io.swagger.annotations.Api; @@ -27,17 +28,21 @@ import java.util.Date; public class OvertimeCalendar extends BaseAPS { @Column(name="RES_CODES") @ApiParam(value ="资源代码") + @FieldAnnotation(editType = ApsEnumUtil.EDIT_TYPE.MULTI_OBJECT, typeName = "Resource", notEmpty = true) private String resCodes; @Column(name="START") @ApiParam(value ="开始时间") + @FieldAnnotation(notEmpty = true) private Date start; @Column(name="END") @ApiParam(value ="结束时间") + @FieldAnnotation(notEmpty = true) private Date end; @Column(name="TYPE") @ApiParam(value ="类型") + @FieldAnnotation(defaultValue = "ENABLE") private ApsEnumUtil.CALENDAR_TYPE type; } diff --git a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/common/DateDuration.java b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/common/DateDuration.java index 2760736..2fa0ef7 100644 --- a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/common/DateDuration.java +++ b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/common/DateDuration.java @@ -52,7 +52,7 @@ public class DateDuration { * 是否为有效时间区间,若用户指定了时间区间,但解析错误,其时间区间为0 * @return */ - public boolean Valid() { + public boolean valid() { return this.bValid; } @@ -124,7 +124,7 @@ public class DateDuration { return strExtraString.toString(); } - public void Divide(double val) { + public void divide(double val) { if (val < PRECISION) { return; } @@ -165,7 +165,7 @@ public class DateDuration { return; } - if (!ValueValid()) { + if (!valueValid()) { this.time = 0; this.rate = 0.0f; this.bValid = false; @@ -173,42 +173,35 @@ public class DateDuration { } ArrayList lst = new ArrayList(); - Decompound(lst); + decompound(lst); boolean oFlg = lst.size() == 1; for (EV_STRING evs : lst) { - if (evs.type == EV_STRING_TYPE.EVS_GOOD) - { - AbstractMap.SimpleEntry extraTime = TransTime_Each(evs.value); - if (extraTime.getKey() || !oFlg) - { + if (evs.type == EV_STRING_TYPE.EVS_GOOD) { + AbstractMap.SimpleEntry extraTime = transTimeEach(evs.value); + if (extraTime.getKey() || !oFlg) { this.time += extraTime.getValue(); - } - else - { + } else { this.time += extraTime.getValue() * 1; } } - else - { - AbstractMap.SimpleEntry extraPer = TransRate_Each(evs.value); - if (extraPer.getKey()) - { + else { + AbstractMap.SimpleEntry extraPer = transRateEach(evs.value); + if (extraPer.getKey()) { this.rate = extraPer.getValue(); } } } - if (this.time < 0) - { + if (this.time < 0) { this.time = 0; this.rate = 0.0f; this.bValid = false; } } - private boolean ValueValid() { + private boolean valueValid() { for (char ch : this.value.toCharArray()) { if (ch <= 'z' && ch >= 'a') { ch -= 32; @@ -232,61 +225,46 @@ public class DateDuration { || ch == 'M' || ch == 'S' || ch == '+'||ch == '-'||ch == 'P'); } - private void Decompound(ArrayList lst) { + private void decompound(ArrayList lst) { int len = this.value.length(); int iStr = 0; EV_STRING evs = new EV_STRING(); evs.type = EV_STRING_TYPE.EVS_GOOD; - while(iStr < len) - { + while(iStr < len) { char ch = this.value.charAt(iStr); - if (ch == '+') - { + if (ch == '+') { lst.add(evs.clone()); evs.value = ""; evs.type = EV_STRING_TYPE.EVS_GOOD; iStr++; continue; - } - else if (ch == '-') - { + } else if (ch == '-') { int iPre = iStr; - if (iPre != 0) - { + if (iPre != 0) { iPre--; char cp = this.value.charAt(iPre); if (!(cp == 'D' || cp == 'H' - || cp == 'M' || cp == 'S')) - { + || cp == 'M' || cp == 'S')) { evs.value = evs.value + 'S'; } } - } - else if (ch == 'P') - { + } else if (ch == 'P') { int iTempIndex = 0; StringBuffer temp1 = new StringBuffer(); StringBuffer temp2 = new StringBuffer(); int iTemp = evs.value.length() - 1; - for (;iTemp >= 0;iTemp--) - { + for (;iTemp >= 0;iTemp--) { char cTemp = evs.value.charAt(iTemp); if (cTemp == 'D' || cTemp == 'H' - || cTemp == 'M' || cTemp == 'S') - { + || cTemp == 'M' || cTemp == 'S') { iTempIndex++; - } - if (iTempIndex >= 2) - { + } if (iTempIndex >= 2) { temp1.insert(0,cTemp); - } - else - { + } else { temp2.insert(0,cTemp); } } - if (!temp1.toString().isEmpty()) - { + if (!temp1.toString().isEmpty()) { EV_STRING evs1 = new EV_STRING(); evs1.type = EV_STRING_TYPE.EVS_GOOD; evs1.value = temp1.toString(); @@ -296,12 +274,10 @@ public class DateDuration { evs.type = EV_STRING_TYPE.EVS_HAVE_P; evs.value = evs.value + ch; iStr++; - if (iStr != len) - { + if (iStr != len) { char cp = this.value.charAt(iStr); if (cp == 'D' || cp == 'H' - || cp == 'M' || cp == 'S') - { + || cp == 'M' || cp == 'S') { evs.value = evs.value + cp; iStr++; } @@ -315,13 +291,12 @@ public class DateDuration { evs.value = evs.value + ch; iStr++; } - if (!evs.value.isEmpty()) - { + if (!evs.value.isEmpty()) { lst.add(evs); } } - private AbstractMap.SimpleEntry TransTime_Each(String extraValue) { + private AbstractMap.SimpleEntry transTimeEach(String extraValue) { if (extraValue.isEmpty()) return new AbstractMap.SimpleEntry(false, 0); @@ -330,16 +305,13 @@ public class DateDuration { boolean flg = false; for (int i = 0; i < extraValue.length(); i++) { char ch = extraValue.charAt(i); - int rate = TimeUnit(ch); - if (rate > 0) - { + int rate = timeUnit(ch); + if (rate > 0) { double iC = Double.parseDouble(temp.toString()); extraTime += (int)(iC*rate); temp.setLength(0); flg = true; - } - else - { + } else { temp.append(ch); } } @@ -347,7 +319,7 @@ public class DateDuration { extraTime += Double.parseDouble(temp.toString()); return new AbstractMap.SimpleEntry(flg, extraTime); } - private AbstractMap.SimpleEntry TransRate_Each(String extraValue) { + private AbstractMap.SimpleEntry transRateEach(String extraValue) { if (extraValue.isEmpty()) return new AbstractMap.SimpleEntry(false, 0.0); @@ -356,8 +328,7 @@ public class DateDuration { boolean flg = false; for (int i = 0; i < extraValue.length(); i++) { char ch = extraValue.charAt(i); - switch(ch) - { + switch(ch) { case 'D': extraPer = flg ? (1 / Double.parseDouble(temp.toString())) * 86400 : Double.parseDouble(temp.toString()) * 86400; return new AbstractMap.SimpleEntry(true, extraPer); case 'H': extraPer = flg ? (1 / Double.parseDouble(temp.toString())) * 3600: Double.parseDouble(temp.toString()) * 3600; return new AbstractMap.SimpleEntry(true, extraPer); case 'M': extraPer = flg ? (1 / Double.parseDouble(temp.toString())) * 60 : Double.parseDouble(temp.toString()) * 60; return new AbstractMap.SimpleEntry(true, extraPer); @@ -366,12 +337,11 @@ public class DateDuration { default : temp.append(ch); } } - return new AbstractMap.SimpleEntry(true, extraPer); + return new AbstractMap.SimpleEntry<>(true, extraPer); } - private int TimeUnit(char ch) { - switch(ch) - { + private int timeUnit(char ch) { + switch(ch) { case 'D': return 86400; case 'H': return 3600; case 'M': return 60; diff --git a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/model/APSPager.java b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/model/APSPager.java index 97f2c22..51f1ba0 100644 --- a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/model/APSPager.java +++ b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/model/APSPager.java @@ -1,11 +1,20 @@ package cn.estsh.i3plus.pojo.aps.model; import cn.estsh.i3plus.pojo.base.common.Pager; +import io.swagger.annotations.Api; import lombok.Data; import java.util.List; +/** + * @Description : 表格分页查询参数 + * @Reference : + * @Author : jason.niu + * @CreateDate : 2019-11-22 + * @Modify: + **/ @Data +@Api("表格分页查询参数") public class APSPager extends Pager { public static class SortData { // 排序对象 diff --git a/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/model/ReportPager.java b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/model/ReportPager.java new file mode 100644 index 0000000..aa9b938 --- /dev/null +++ b/modules/i3plus-pojo-aps/src/main/java/cn/estsh/i3plus/pojo/aps/model/ReportPager.java @@ -0,0 +1,25 @@ +package cn.estsh.i3plus.pojo.aps.model; + +import cn.estsh.i3plus.pojo.base.common.Pager; +import cn.estsh.i3plus.pojo.base.enumutil.ApsEnumUtil; +import io.swagger.annotations.Api; +import lombok.Data; + +import java.util.Date; + +/** + * @Description : 报表分页查询参数 + * @Reference : + * @Author : jason.niu + * @CreateDate : 2019-11-22 + * @Modify: + **/ +@Data +@Api("报表分页查询参数") +public class ReportPager extends Pager { + private String filter; // 物料筛选条件 + private Date begin; // 统计开始时间 + private Date end; // 统计结束时间 + private ApsEnumUtil.MATERIAL_REPORT_TYPE type; + private ApsEnumUtil.REPORT_TIME_SPAN span; // 统计时间间隔 +} diff --git a/modules/i3plus-pojo-aps/src/main/resources/relations/ExportProject.xml b/modules/i3plus-pojo-aps/src/main/resources/relations/ExportProject.xml index 443516d..778bd55 100644 --- a/modules/i3plus-pojo-aps/src/main/resources/relations/ExportProject.xml +++ b/modules/i3plus-pojo-aps/src/main/resources/relations/ExportProject.xml @@ -1,6 +1,6 @@ - + diff --git a/modules/i3plus-pojo-aps/src/main/resources/relations/ImportProject.xml b/modules/i3plus-pojo-aps/src/main/resources/relations/ImportProject.xml index 624a636..6906c5f 100644 --- a/modules/i3plus-pojo-aps/src/main/resources/relations/ImportProject.xml +++ b/modules/i3plus-pojo-aps/src/main/resources/relations/ImportProject.xml @@ -1,6 +1,6 @@ - + diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/ApsEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/ApsEnumUtil.java index 5528aeb..1f6c237 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/ApsEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/ApsEnumUtil.java @@ -80,6 +80,61 @@ public class ApsEnumUtil { } /** + * 物料报表统计类型 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum MATERIAL_REPORT_TYPE { + PRODUCE("PRODUCE", "生产"), + PURCHASE("PURCHASE", "采购"), + INVENTORY("INVENTORY", "库存"); + + private String value; + private String description; + + MATERIAL_REPORT_TYPE(String value, String description) { + this.value = value; + this.description = description; + } + + public String getValue() { + return value; + } + + public String getDescription() { + return description; + } + } + + /** + * 报表时间间隔 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum REPORT_TIME_SPAN { + ONE_HOUR("ONE_HOUR", "1小时"), + EIGHT_HOUR("EIGHT_HOUR", "8小时"), + TWELVE_HOUR("TWELVE_HOUR", "12小时"), + ONE_DAY("ONE_DAY", "一天"), + ONE_WEEK("ONE_WEEK", "一周"), + ONE_MONTH("ONE_MONTH", "一月"); + + private String value; + private String description; + + REPORT_TIME_SPAN(String value, String description) { + this.value = value; + this.description = description; + } + + public String getValue() { + return value; + } + + public String getDescription() { + return description; + } + } + + /** * 备料类型 */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) @@ -618,7 +673,6 @@ public class ApsEnumUtil { MIN_OPERATION_REMAIN_TIME("MIN_OPERATION_REMAIN_TIME", "最小工序宽裕时间"), WORK_LET("WORK_LET", "工作最晚结束时刻"), WORK_EST("WORK_EST", "工作最早开始时刻"), - INVENTORY_RELA("INVENTORY_RELA", "订单物品库存量相对值"), FIRST_WORK_BEGIN("FIRST_WORK_BEGIN", "订单首工作上次开始时刻"), HAVE_HIGH_WORK("HAVE_HIGH_WORK", "订单中含有高级别工作"), WORK_RESOURCE_SIZE("WORK_RESOURCE_SIZE", "工作的可用资源数"),