作者 朱兆平

运单未放行指令记录优化

1 package com.sy.service; 1 package com.sy.service;
2 2
  3 +import com.sy.model.GatherInfo;
  4 +import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
  5 +import com.sy.model.LandBusinessTypeList;
3 import com.sy.model.commandLog; 6 import com.sy.model.commandLog;
4 7
  8 +import java.util.List;
  9 +
5 public interface CommandLogService { 10 public interface CommandLogService {
6 int insert(commandLog command); 11 int insert(commandLog command);
  12 +
  13 + /**
  14 + * 根据进出场信息写入日志
  15 + * @param info 过卡信息
  16 + * @param check 过卡状态
  17 + * @param reason 抬杆指令内容
  18 + * @param land 流转申请信息
  19 + * @param listInfos 流转单列表
  20 + * @param selfWt 车辆备案重量
  21 + * @param inWt 车辆入场重量
  22 + * @param goodsWt 车辆装载货物重量
  23 + * @param diffVal 进出场差值
  24 + */
  25 + public void commandlog(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> listInfos,
  26 + Double selfWt,Double inWt,Double goodsWt,Double diffVal
  27 + );
7 } 28 }
1 package com.sy.service.impl; 1 package com.sy.service.impl;
2 2
3 import com.sy.mapper.commandLogMapper; 3 import com.sy.mapper.commandLogMapper;
  4 +import com.sy.model.GatherInfo;
  5 +import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
  6 +import com.sy.model.LandBusinessTypeList;
4 import com.sy.model.commandLog; 7 import com.sy.model.commandLog;
5 import com.sy.service.CommandLogService; 8 import com.sy.service.CommandLogService;
6 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
8 11
  12 +import javax.annotation.Resource;
  13 +import java.util.Arrays;
  14 +import java.util.List;
  15 +import java.util.UUID;
  16 +
  17 +import static com.sy.service.impl.ResMessageServiceImpl.toStrArry;
  18 +
9 @Service 19 @Service
10 public class CommandLogImpl implements CommandLogService { 20 public class CommandLogImpl implements CommandLogService {
11 - @Autowired 21 + @Resource
12 commandLogMapper mapper; 22 commandLogMapper mapper;
13 @Override 23 @Override
14 public int insert(commandLog command) { 24 public int insert(commandLog command) {
15 return mapper.insertSelective(command); 25 return mapper.insertSelective(command);
16 } 26 }
  27 +
  28 +
  29 + @Override
  30 + public void commandlog(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos,
  31 + Double selfWt,Double inWt,Double goodsWt,Double diffVal
  32 + ){
  33 + String flag="",type="";
  34 + commandLog command=new commandLog();
  35 + command.setId(UUID.randomUUID().toString());
  36 + command.setBarcode(info.getBarcode());
  37 + if(land!=null){
  38 + command.setBusnessType(land.getBusinesstype());
  39 + }
  40 + command.setAreaId(info.getAreaid());
  41 + command.setChnlNo(info.getChnlno());
  42 + if (check){
  43 + flag = "00";
  44 + } else{
  45 + flag = "11";
  46 + }
  47 + if("I".equals(info.getIetype())){
  48 + type="000000200000000000";
  49 + }else{
  50 + type="000000100000000000";
  51 + }
  52 + command.setReasonCode(flag+type);
  53 + command.setReasonText(reason);
  54 + command.setVeName(info.getVename());
  55 + command.setVeWeight(selfWt);
  56 + command.setIeType(info.getIetype());
  57 + command.setExitGrossWeight(info.getGrosswt().doubleValue());
  58 + command.setInGrossWeight(inWt);
  59 + command.setGoodsWeight(goodsWt);
  60 + command.setActualGoodsWeight(diffVal);
  61 + if(list_infos.size()>0){
  62 + command.setMasterList(Arrays.toString(toStrArry(list_infos)));
  63 + }
  64 + insert(command);
  65 + }
17 } 66 }
@@ -4,6 +4,7 @@ import com.sy.mapper.RESMESSAGEMapper; @@ -4,6 +4,7 @@ import com.sy.mapper.RESMESSAGEMapper;
4 import com.sy.model.GatherInfo; 4 import com.sy.model.GatherInfo;
5 import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO; 5 import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
6 import com.sy.model.RESMESSAGE; 6 import com.sy.model.RESMESSAGE;
  7 +import com.sy.service.CommandLogService;
7 import com.sy.service.ResMessageService; 8 import com.sy.service.ResMessageService;
8 import com.sy.socket.CommandClient; 9 import com.sy.socket.CommandClient;
9 import org.apache.log4j.Logger; 10 import org.apache.log4j.Logger;
@@ -27,6 +28,9 @@ public class ResMessageServiceImpl implements ResMessageService { @@ -27,6 +28,9 @@ public class ResMessageServiceImpl implements ResMessageService {
27 @Autowired 28 @Autowired
28 private RESMESSAGEMapper mapper; 29 private RESMESSAGEMapper mapper;
29 30
  31 + @Autowired
  32 + CommandLogService commandLogService;
  33 +
30 34
31 @Override 35 @Override
32 public int saveEnter(RESMESSAGE resmessage){ 36 public int saveEnter(RESMESSAGE resmessage){
@@ -71,6 +75,8 @@ public class ResMessageServiceImpl implements ResMessageService { @@ -71,6 +75,8 @@ public class ResMessageServiceImpl implements ResMessageService {
71 } 75 }
72 if (!noRelease.isEmpty()) { 76 if (!noRelease.isEmpty()) {
73 logger.info(Arrays.toString(noRelease.toArray())+FANGXING); 77 logger.info(Arrays.toString(noRelease.toArray())+FANGXING);
  78 + commandLogService.commandlog(info,false,Arrays.toString(noRelease.toArray())+FANGXING,null,list_infos,
  79 + new Double("0.0"),new Double("0.0"),new Double("0.0"),new Double("0.0"));
74 CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING); 80 CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING);
75 } 81 }
76 } 82 }