| ... | ... | @@ -8,6 +8,7 @@ import com.sy.model.LandBusinessTypeList; | 
|  |  | import com.sy.model.LandRoadVe; | 
|  |  | import com.sy.service.LandBusListService; | 
|  |  | import com.sy.service.LandRoadVeService; | 
|  |  | import com.sy.socket.CommandClient; | 
|  |  | import com.sy.utils.FileTool; | 
|  |  | import com.sy.utils.UUIDCreate; | 
|  |  | import org.apache.log4j.Logger; | 
| ... | ... | @@ -44,6 +45,12 @@ public class LogicOperation { | 
|  |  | //读取配置文件里的载重与称重的可控范围 | 
|  |  | private static String checkWt = FileTool.readProperties("grossWt"); | 
|  |  |  | 
|  |  | //逻辑判断后的结果定义 | 
|  |  | private static String PERMITTHOUGH = "直接放行"; | 
|  |  | private static String GROWSSEXCETION = "禁止通行,重量不在可控范围"; | 
|  |  | private static String INPUTSTATION = "此车辆未做进站申请"; | 
|  |  | private static String ENTERSTATION = "此车辆未做出站申请"; | 
|  |  |  | 
|  |  | @PostConstruct | 
|  |  | public void init(){ | 
|  |  | logic = this; | 
| ... | ... | @@ -51,12 +58,14 @@ public class LogicOperation { | 
|  |  | logic.veService = this.veService; | 
|  |  | } | 
|  |  |  | 
|  |  | public boolean operation(GatherInfo info){ | 
|  |  | //开关 | 
|  |  | boolean sign = false; | 
|  |  | /** | 
|  |  | * @Param info 卡口采集数据 | 
|  |  | * @Result 计算卡口采集数据并发送报文 | 
|  |  | * */ | 
|  |  | public static void operation(GatherInfo info){ | 
|  |  | BigDecimal grosswt = info.getGrosswt(); | 
|  |  | //转为double类型 | 
|  |  | double growsswWt = grosswt.doubleValue(); | 
|  |  | double growssWt = grosswt.doubleValue(); | 
|  |  | String ietype = info.getIetype(); | 
|  |  | List<LandBusinessTypeList>lists = null; | 
|  |  | LandRoadVe ve = logic.veService.selectByFrameNo(info.getIcvename()); | 
| ... | ... | @@ -68,35 +77,36 @@ public class LogicOperation { | 
|  |  | if(list.getContrastflag()=="" | list.getContrastflag()==null){ | 
|  |  | //判断载货重量是否符合所设定的范围 | 
|  |  | double goodsWt = GoodsWt(list.getMasterList(),"E"); | 
|  |  | if(checkResult(growsswWt,Double.parseDouble(ve.getSelfWt()),goodsWt)){ | 
|  |  | sign = true; | 
|  |  | } | 
|  |  | double selfWt = Double.parseDouble(ve.getSelfWt()); | 
|  |  | sendBw(info,growssWt,selfWt,goodsWt); | 
|  |  | list.setContrastflag("已出站"); | 
|  |  | logic.listService.updateById(list); | 
|  |  | if("货物流转".equals(list.getBusinesstype()) |"分拨分流".equals(list.getBusinesstype())){ | 
|  |  | if("货物流转".equals(list.getBusinesstype()) | "分拨分流".equals(list.getBusinesstype())){ | 
|  |  | if(list.getMasterList().length()>0) { | 
|  |  | createTypeList(list); | 
|  |  | } | 
|  |  | } | 
|  |  | }else { | 
|  |  | CommandClient.Client(info,ENTERSTATION); | 
|  |  | } | 
|  |  | } | 
|  |  | }else { | 
|  |  | ietype = "进场站"; | 
|  |  | lists = listService.selectByFrameNoAndType(info.getIcvename(),ietype); | 
|  |  | lists = logic.listService.selectByFrameNoAndType(info.getIcvename(),ietype); | 
|  |  | for (LandBusinessTypeList list:lists) { | 
|  |  | //查询是否做了出场申请 | 
|  |  | if(list.getContrastflag()=="" | list.getContrastflag()==null){ | 
|  |  | //判断载货重量是否符合所设定的范围 | 
|  |  | double goodsWt = GoodsWt(list.getMasterList(),"I"); | 
|  |  | if(checkResult(growsswWt,Double.parseDouble(ve.getSelfWt()),goodsWt)){ | 
|  |  | sign = true; | 
|  |  | } | 
|  |  | double selfWt = Double.parseDouble(ve.getSelfWt()); | 
|  |  | sendBw(info,growssWt,selfWt,goodsWt); | 
|  |  | list.setContrastflag("已进站"); | 
|  |  | logic.listService.updateById(list); | 
|  |  | }else { | 
|  |  | CommandClient.Client(info,INPUTSTATION); | 
|  |  | } | 
|  |  | } | 
|  |  | } | 
|  |  | return sign; | 
|  |  | } | 
|  |  |  | 
|  |  | //将获取的checkWt进行小数转化 | 
| ... | ... | @@ -119,7 +129,7 @@ public class LogicOperation { | 
|  |  | * @Result 获取运单重量 | 
|  |  | * */ | 
|  |  | //校验载重和称重是否在合理的范围 | 
|  |  | public boolean checkResult(double grossWt,double wt,double goodsWt){ | 
|  |  | public static boolean checkResult(double grossWt,double wt,double goodsWt){ | 
|  |  | boolean flag = false; | 
|  |  | double result = (grossWt-wt)/goodsWt; | 
|  |  | BigDecimal bd = new BigDecimal(result); | 
| ... | ... | @@ -183,7 +193,7 @@ public class LogicOperation { | 
|  |  | /** | 
|  |  | * 分拨或者流转业务生成新的进站申请 | 
|  |  | * */ | 
|  |  | public static int  createTypeList(LandBusinessTypeList list){ | 
|  |  | public static void createTypeList(LandBusinessTypeList list){ | 
|  |  | LandBusinessTypeList typeList = new LandBusinessTypeList(); | 
|  |  | typeList.setId(UUIDCreate.getUUID()); | 
|  |  | typeList.setAgentname(list.getAgentname()); | 
| ... | ... | @@ -205,7 +215,18 @@ public class LogicOperation { | 
|  |  | typeList.setProdectTime(new Date()); | 
|  |  | typeList.setMasterList(list.getMasterList()); | 
|  |  | typeList.setBusinesstype(list.getBusinesstype()); | 
|  |  | int result = logic.listService.saveList(typeList); | 
|  |  | return  result; | 
|  |  | logic.listService.saveList(typeList); | 
|  |  | } | 
|  |  | /** | 
|  |  | *校验重量并发送报文 | 
|  |  | * */ | 
|  |  |  | 
|  |  | public static void sendBw(GatherInfo info,double growsswWt,double selfWt,double goodsWt){ | 
|  |  | String flag = null; | 
|  |  | if(checkResult(growsswWt,selfWt,goodsWt)){ | 
|  |  | CommandClient.Client(info,PERMITTHOUGH); | 
|  |  | }else { | 
|  |  | CommandClient.Client(info,GROWSSEXCETION); | 
|  |  | } | 
|  |  | } | 
|  |  | } | 
... | ... |  |