作者 朱兆平

进口提货运单放行指令提示优化

... ... @@ -31,11 +31,7 @@ import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
... ... @@ -220,7 +216,7 @@ public class LiftBar {
if (logic.weightCheckHandleService.checkImportDlv(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt)){
checkResult=true;
//检查运单放行
if (logic.resMessageService.checkManifestRelease(list.getMasterList())){
if (logic.resMessageService.checkManifestRelease(info,list.getMasterList())){
checkResult=true;
}else {
//有运单未放行
... ... @@ -257,7 +253,7 @@ public class LiftBar {
if (logic.weightCheckHandleService.checkAllocateOrDispatch(growssWt, Double.parseDouble(ve.getSelfWt()), goodsWt,inWt)){
checkResult=true;
//检查运单放行
if (logic.resMessageService.checkManifestRelease(list.getMasterList())){
if (logic.resMessageService.checkManifestRelease(info,list.getMasterList())){
checkResult=true;
}else {
//有运单未放行
... ...
package com.sy.service;
import com.sy.model.GatherInfo;
import com.sy.model.RESMESSAGE;
import java.util.List;
... ... @@ -20,5 +21,5 @@ public interface ResMessageService {
* @param manifestList 运单号数组字符串 格式为"'69515289724','40692420145','17233862076'"
* @return 全部放行 返回true 未全部放行返回false
*/
boolean checkManifestRelease(String manifestList);
boolean checkManifestRelease(GatherInfo info, String manifestList);
}
... ...
package com.sy.service.impl;
import com.sy.logic.LiftBar;
import com.sy.mapper.RESMESSAGEMapper;
import com.sy.model.GatherInfo;
import com.sy.model.RESMESSAGE;
import com.sy.service.ResMessageService;
import com.sy.socket.CommandClient;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
/**
* @author
... ... @@ -17,7 +20,8 @@ import java.util.List;
@Service
public class ResMessageServiceImpl implements ResMessageService {
private static final Logger logger = Logger.getLogger(ResMessageServiceImpl.class);
private static String FANGXING="-等运单未放行";
private static String AWB_EMPTY="未申请装载运单";
@Autowired
private RESMESSAGEMapper mapper;
... ... @@ -38,13 +42,13 @@ public class ResMessageServiceImpl implements ResMessageService {
}
@Override
public boolean checkManifestRelease(String manifestList) {
public boolean checkManifestRelease(GatherInfo info,String manifestList) {
List<String> noRelease = new Vector<>();
if (manifestList.length() < 1) {
CommandClient.Client(info, AWB_EMPTY);
return false;
}
manifestList = manifestList.replace("-", "");
//中文逗号替换
manifestList = manifestList.replace(",", ",");
manifestList = manifestList.replace("-", "").replace(",", ",");
String[] maifest = manifestList.split(",");
logger.info("运单列表:" + manifestList);
boolean flag = false;
... ... @@ -53,6 +57,22 @@ public class ResMessageServiceImpl implements ResMessageService {
if (list.size() == maifest.length) {
flag = true;
}else{
//返回未放行的运单列表
if (maifest.length>0){
for (String awb : maifest) {
boolean anyMatch = list.stream().anyMatch(resmessage -> {
return resmessage.getManifest().equals(awb);
});
if (!anyMatch){
noRelease.add(awb);
}
}
if (!noRelease.isEmpty()) {
logger.info(Arrays.toString(noRelease.toArray())+FANGXING);
CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING);
}
}
}
return flag;
}
... ...
... ... @@ -3,7 +3,8 @@ package com.sy.service.impl;
import com.sy.logic.LiftBar;
import com.sy.service.WeightCheckHandleService;
import com.sy.utils.FileTool;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
... ... @@ -12,8 +13,7 @@ import java.text.ParseException;
@Service
public class WeightCheckHandleServiceImpl implements WeightCheckHandleService {
private static final Logger logger = Logger.getLogger(WeightCheckHandleServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(LiftBar.class);
//从配置文件中读取货物重差可控范围
private static String checkWt = FileTool.readProperties("grossWt");
... ... @@ -73,9 +73,10 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService {
double result2= 0.0;
if(Double.doubleToLongBits(grossWt)>Double.doubleToLongBits(0)){
result = Double.parseDouble(df.format(Math.abs((inWt - goodsWt - grossWt)) / grossWt));
System.out.println("进出场比对差值:"+result);
result2 = Double.parseDouble(df.format(Math.abs((grossWt-wt)) / grossWt));
System.out.println("空车出场差值:"+result2);
logger.info("[WEIGHT-CHECK]-进出场比对差值:{},空车出场差值:{},进出场比对重量差:{},空车比对重量差:{}",result,result2,Math.abs(inWt - goodsWt - grossWt),Math.abs(grossWt-wt));
}
double range = valueDob();
if (result <= range || result2 <= range) {
... ... @@ -117,8 +118,8 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService {
result1 = Double.parseDouble(df.format(Math.abs((wt + goodsWt - grossWt)) / grossWt));
}
double range = valueDob();
System.out.println("进出场差值:"+result);
System.out.println("提货离场差值:"+result1);
logger.info("[WEIGHT-CHECK]-进出场比对差值:{},提货离场差值:{},进出场比对重量差:{}",result,result1,Math.abs(inWt - grossWt));
if (result <= range) {
... ... @@ -148,7 +149,7 @@ public class WeightCheckHandleServiceImpl implements WeightCheckHandleService {
*/
@Override
public boolean checkAllocateOrDispatch(double grossWt, double wt, double goodsWt,double inWt){
//todo:调拨分拨中的第二.三...场站的如卡口判断 都应该以带货入场进行判定.离场都应该空车进行判定.
//todo:调拨分拨中的第二.三...场站的如卡口判断 都应该以带货入场进行判定.离场都应该空车进行判定.
DecimalFormat df = new DecimalFormat("0.00");
boolean flag = false;
//载货离场判定
... ...
... ... @@ -27,7 +27,7 @@ class ResMessageServiceImplTest {
@Test
void checkManifestRelease() {
boolean re = resMessageService.checkManifestRelease("157-55140831,157-55140853,157-55140724,157-76344026");
boolean re = resMessageService.checkManifestRelease(null,"157-55140831,157-55140853,157-55140724,157-76344026,157-76344022");
logger.info("结果:"+re);
}
}
... ...