|
@@ -8,6 +8,7 @@ import com.sy.model.LandBusinessTypeList; |
|
@@ -8,6 +8,7 @@ import com.sy.model.LandBusinessTypeList; |
8
|
import com.sy.model.LandRoadVe;
|
8
|
import com.sy.model.LandRoadVe;
|
9
|
import com.sy.service.LandBusListService;
|
9
|
import com.sy.service.LandBusListService;
|
10
|
import com.sy.service.LandRoadVeService;
|
10
|
import com.sy.service.LandRoadVeService;
|
|
|
11
|
+import com.sy.socket.CommandClient;
|
11
|
import com.sy.utils.FileTool;
|
12
|
import com.sy.utils.FileTool;
|
12
|
import com.sy.utils.UUIDCreate;
|
13
|
import com.sy.utils.UUIDCreate;
|
13
|
import org.apache.log4j.Logger;
|
14
|
import org.apache.log4j.Logger;
|
|
@@ -44,6 +45,12 @@ public class LogicOperation { |
|
@@ -44,6 +45,12 @@ public class LogicOperation { |
44
|
//读取配置文件里的载重与称重的可控范围
|
45
|
//读取配置文件里的载重与称重的可控范围
|
45
|
private static String checkWt = FileTool.readProperties("grossWt");
|
46
|
private static String checkWt = FileTool.readProperties("grossWt");
|
46
|
|
47
|
|
|
|
48
|
+ //逻辑判断后的结果定义
|
|
|
49
|
+ private static String PERMITTHOUGH = "直接放行";
|
|
|
50
|
+ private static String GROWSSEXCETION = "禁止通行,重量不在可控范围";
|
|
|
51
|
+ private static String INPUTSTATION = "此车辆未做进站申请";
|
|
|
52
|
+ private static String ENTERSTATION = "此车辆未做出站申请";
|
|
|
53
|
+
|
47
|
@PostConstruct
|
54
|
@PostConstruct
|
48
|
public void init(){
|
55
|
public void init(){
|
49
|
logic = this;
|
56
|
logic = this;
|
|
@@ -51,12 +58,14 @@ public class LogicOperation { |
|
@@ -51,12 +58,14 @@ public class LogicOperation { |
51
|
logic.veService = this.veService;
|
58
|
logic.veService = this.veService;
|
52
|
}
|
59
|
}
|
53
|
|
60
|
|
54
|
- public boolean operation(GatherInfo info){
|
|
|
55
|
- //开关
|
|
|
56
|
- boolean sign = false;
|
61
|
+ /**
|
|
|
62
|
+ * @Param info 卡口采集数据
|
|
|
63
|
+ * @Result 计算卡口采集数据并发送报文
|
|
|
64
|
+ * */
|
|
|
65
|
+ public static void operation(GatherInfo info){
|
57
|
BigDecimal grosswt = info.getGrosswt();
|
66
|
BigDecimal grosswt = info.getGrosswt();
|
58
|
//转为double类型
|
67
|
//转为double类型
|
59
|
- double growsswWt = grosswt.doubleValue();
|
68
|
+ double growssWt = grosswt.doubleValue();
|
60
|
String ietype = info.getIetype();
|
69
|
String ietype = info.getIetype();
|
61
|
List<LandBusinessTypeList>lists = null;
|
70
|
List<LandBusinessTypeList>lists = null;
|
62
|
LandRoadVe ve = logic.veService.selectByFrameNo(info.getIcvename());
|
71
|
LandRoadVe ve = logic.veService.selectByFrameNo(info.getIcvename());
|
|
@@ -68,35 +77,36 @@ public class LogicOperation { |
|
@@ -68,35 +77,36 @@ public class LogicOperation { |
68
|
if(list.getContrastflag()=="" | list.getContrastflag()==null){
|
77
|
if(list.getContrastflag()=="" | list.getContrastflag()==null){
|
69
|
//判断载货重量是否符合所设定的范围
|
78
|
//判断载货重量是否符合所设定的范围
|
70
|
double goodsWt = GoodsWt(list.getMasterList(),"E");
|
79
|
double goodsWt = GoodsWt(list.getMasterList(),"E");
|
71
|
- if(checkResult(growsswWt,Double.parseDouble(ve.getSelfWt()),goodsWt)){
|
|
|
72
|
- sign = true;
|
|
|
73
|
- }
|
80
|
+ double selfWt = Double.parseDouble(ve.getSelfWt());
|
|
|
81
|
+ sendBw(info,growssWt,selfWt,goodsWt);
|
74
|
list.setContrastflag("已出站");
|
82
|
list.setContrastflag("已出站");
|
75
|
logic.listService.updateById(list);
|
83
|
logic.listService.updateById(list);
|
76
|
- if("货物流转".equals(list.getBusinesstype()) |"分拨分流".equals(list.getBusinesstype())){
|
84
|
+ if("货物流转".equals(list.getBusinesstype()) | "分拨分流".equals(list.getBusinesstype())){
|
77
|
if(list.getMasterList().length()>0) {
|
85
|
if(list.getMasterList().length()>0) {
|
78
|
createTypeList(list);
|
86
|
createTypeList(list);
|
79
|
}
|
87
|
}
|
80
|
}
|
88
|
}
|
|
|
89
|
+ }else {
|
|
|
90
|
+ CommandClient.Client(info,ENTERSTATION);
|
81
|
}
|
91
|
}
|
82
|
}
|
92
|
}
|
83
|
}else {
|
93
|
}else {
|
84
|
ietype = "进场站";
|
94
|
ietype = "进场站";
|
85
|
- lists = listService.selectByFrameNoAndType(info.getIcvename(),ietype);
|
95
|
+ lists = logic.listService.selectByFrameNoAndType(info.getIcvename(),ietype);
|
86
|
for (LandBusinessTypeList list:lists) {
|
96
|
for (LandBusinessTypeList list:lists) {
|
87
|
//查询是否做了出场申请
|
97
|
//查询是否做了出场申请
|
88
|
if(list.getContrastflag()=="" | list.getContrastflag()==null){
|
98
|
if(list.getContrastflag()=="" | list.getContrastflag()==null){
|
89
|
//判断载货重量是否符合所设定的范围
|
99
|
//判断载货重量是否符合所设定的范围
|
90
|
double goodsWt = GoodsWt(list.getMasterList(),"I");
|
100
|
double goodsWt = GoodsWt(list.getMasterList(),"I");
|
91
|
- if(checkResult(growsswWt,Double.parseDouble(ve.getSelfWt()),goodsWt)){
|
|
|
92
|
- sign = true;
|
|
|
93
|
- }
|
101
|
+ double selfWt = Double.parseDouble(ve.getSelfWt());
|
|
|
102
|
+ sendBw(info,growssWt,selfWt,goodsWt);
|
94
|
list.setContrastflag("已进站");
|
103
|
list.setContrastflag("已进站");
|
95
|
logic.listService.updateById(list);
|
104
|
logic.listService.updateById(list);
|
|
|
105
|
+ }else {
|
|
|
106
|
+ CommandClient.Client(info,INPUTSTATION);
|
96
|
}
|
107
|
}
|
97
|
}
|
108
|
}
|
98
|
}
|
109
|
}
|
99
|
- return sign;
|
|
|
100
|
}
|
110
|
}
|
101
|
|
111
|
|
102
|
//将获取的checkWt进行小数转化
|
112
|
//将获取的checkWt进行小数转化
|
|
@@ -119,7 +129,7 @@ public class LogicOperation { |
|
@@ -119,7 +129,7 @@ public class LogicOperation { |
119
|
* @Result 获取运单重量
|
129
|
* @Result 获取运单重量
|
120
|
* */
|
130
|
* */
|
121
|
//校验载重和称重是否在合理的范围
|
131
|
//校验载重和称重是否在合理的范围
|
122
|
- public boolean checkResult(double grossWt,double wt,double goodsWt){
|
132
|
+ public static boolean checkResult(double grossWt,double wt,double goodsWt){
|
123
|
boolean flag = false;
|
133
|
boolean flag = false;
|
124
|
double result = (grossWt-wt)/goodsWt;
|
134
|
double result = (grossWt-wt)/goodsWt;
|
125
|
BigDecimal bd = new BigDecimal(result);
|
135
|
BigDecimal bd = new BigDecimal(result);
|
|
@@ -183,7 +193,7 @@ public class LogicOperation { |
|
@@ -183,7 +193,7 @@ public class LogicOperation { |
183
|
/**
|
193
|
/**
|
184
|
* 分拨或者流转业务生成新的进站申请
|
194
|
* 分拨或者流转业务生成新的进站申请
|
185
|
* */
|
195
|
* */
|
186
|
- public static int createTypeList(LandBusinessTypeList list){
|
196
|
+ public static void createTypeList(LandBusinessTypeList list){
|
187
|
LandBusinessTypeList typeList = new LandBusinessTypeList();
|
197
|
LandBusinessTypeList typeList = new LandBusinessTypeList();
|
188
|
typeList.setId(UUIDCreate.getUUID());
|
198
|
typeList.setId(UUIDCreate.getUUID());
|
189
|
typeList.setAgentname(list.getAgentname());
|
199
|
typeList.setAgentname(list.getAgentname());
|
|
@@ -205,7 +215,18 @@ public class LogicOperation { |
|
@@ -205,7 +215,18 @@ public class LogicOperation { |
205
|
typeList.setProdectTime(new Date());
|
215
|
typeList.setProdectTime(new Date());
|
206
|
typeList.setMasterList(list.getMasterList());
|
216
|
typeList.setMasterList(list.getMasterList());
|
207
|
typeList.setBusinesstype(list.getBusinesstype());
|
217
|
typeList.setBusinesstype(list.getBusinesstype());
|
208
|
- int result = logic.listService.saveList(typeList);
|
|
|
209
|
- return result;
|
218
|
+ logic.listService.saveList(typeList);
|
|
|
219
|
+ }
|
|
|
220
|
+ /**
|
|
|
221
|
+ *校验重量并发送报文
|
|
|
222
|
+ * */
|
|
|
223
|
+
|
|
|
224
|
+ public static void sendBw(GatherInfo info,double growsswWt,double selfWt,double goodsWt){
|
|
|
225
|
+ String flag = null;
|
|
|
226
|
+ if(checkResult(growsswWt,selfWt,goodsWt)){
|
|
|
227
|
+ CommandClient.Client(info,PERMITTHOUGH);
|
|
|
228
|
+ }else {
|
|
|
229
|
+ CommandClient.Client(info,GROWSSEXCETION);
|
|
|
230
|
+ }
|
210
|
}
|
231
|
}
|
211
|
} |
232
|
} |