作者 shenhailong

远程调用 预配录入 添加 货主信息与主单号 绑定关系

@@ -1268,7 +1268,7 @@ public class ManifestController extends BasicController { @@ -1268,7 +1268,7 @@ public class ManifestController extends BasicController {
1268 || StringUtils.isBlank(manifest.getDestinationstation()) || StringUtils.isBlank(manifest.getTotalpiece()) 1268 || StringUtils.isBlank(manifest.getDestinationstation()) || StringUtils.isBlank(manifest.getTotalpiece())
1269 || StringUtils.isBlank(manifest.getTotalweight()) || StringUtils.isBlank(manifest.getPaymode()) 1269 || StringUtils.isBlank(manifest.getTotalweight()) || StringUtils.isBlank(manifest.getPaymode())
1270 || StringUtils.isBlank(manifest.getCustomsstatus()) || StringUtils.isBlank(manifest.getCustomscode()) 1270 || StringUtils.isBlank(manifest.getCustomsstatus()) || StringUtils.isBlank(manifest.getCustomscode())
1271 - || StringUtils.isBlank(manifest.getName_ofgoods()) || StringUtils.isBlank(manifest.getCo_company()) 1271 + || StringUtils.isBlank(manifest.getProductname()) || StringUtils.isBlank(manifest.getCo_company())
1272 || StringUtils.isBlank(manifest.getCo_address()) || StringUtils.isBlank(manifest.getShpcusid()) 1272 || StringUtils.isBlank(manifest.getCo_address()) || StringUtils.isBlank(manifest.getShpcusid())
1273 || StringUtils.isBlank(manifest.getCo_country()) || StringUtils.isBlank(manifest.getSh_company()) 1273 || StringUtils.isBlank(manifest.getCo_country()) || StringUtils.isBlank(manifest.getSh_company())
1274 || StringUtils.isBlank(manifest.getSh_address()) || StringUtils.isBlank(manifest.getCnecusid()) 1274 || StringUtils.isBlank(manifest.getSh_address()) || StringUtils.isBlank(manifest.getCnecusid())
@@ -1304,6 +1304,95 @@ public class ManifestController extends BasicController { @@ -1304,6 +1304,95 @@ public class ManifestController extends BasicController {
1304 manifest.setCarrier(carrier); 1304 manifest.setCarrier(carrier);
1305 manifest.setFlightno(flightno); 1305 manifest.setFlightno(flightno);
1306 1306
  1307 + // 发货人 简称 跟类型 用,隔开
  1308 + String de_trstation = manifest.getDe_trstation();
  1309 + // 订舱代理 。。。。。。。。。
  1310 + String de_packing = manifest.getDe_packing();
  1311 + // 操作代理 。。。。。。。。。
  1312 + String de_remarks = manifest.getDe_remarks();
  1313 + // 货主信息
  1314 + if(StringUtils.isBlank(de_trstation) && StringUtils.isBlank(de_packing) && StringUtils.isBlank(de_remarks)){
  1315 +
  1316 + model.setStatus(205);
  1317 + model.setMsg("货主信息三选一,不能为空");
  1318 +
  1319 + return model;
  1320 +
  1321 + }else {
  1322 + if (StringUtils.isNotBlank(de_trstation)){
  1323 + String s = de_trstation.replace(",", ",");
  1324 + String[] split = s.split(",");
  1325 + Long id = hzInfoService.selectForShortType(split[0], split[1]);
  1326 + if (id != null){
  1327 + HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
  1328 + hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
  1329 + hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
  1330 + if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0){
  1331 + model.setStatus(209);
  1332 + model.setMsg("发货人不能重复录入");
  1333 + return model;
  1334 + }else {
  1335 + hzWaybillService.save(hzwaybllinfoEntity);
  1336 + }
  1337 + }else {
  1338 + model.setStatus(206);
  1339 + model.setMsg("发货人,简称和类型有误!");
  1340 + hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
  1341 + return model;
  1342 + }
  1343 + }
  1344 +
  1345 + if (StringUtils.isNotBlank(de_packing)){
  1346 + String s = de_packing.replace(",", ",");
  1347 + String[] split = s.split(",");
  1348 + Long id = hzInfoService.selectForShortType(split[0], split[1]);
  1349 + if (id != null){
  1350 + HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
  1351 + hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
  1352 + hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
  1353 +
  1354 + if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0 ){
  1355 + model.setStatus(210);
  1356 + model.setMsg("订舱代理不能重复录入");
  1357 + hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
  1358 +
  1359 + return model;
  1360 + }else {
  1361 + hzWaybillService.save(hzwaybllinfoEntity);
  1362 + }
  1363 + }else {
  1364 + model.setStatus(207);
  1365 + model.setMsg("订舱代理,简称和类型有误!");
  1366 + hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
  1367 + return model;
  1368 + }
  1369 + }
  1370 +
  1371 + if (StringUtils.isNotBlank(de_remarks)){
  1372 + String s = de_remarks.replace(",", ",");
  1373 + String[] split = s.split(",");
  1374 + Long id = hzInfoService.selectForShortType(split[0], split[1]);
  1375 + if (id != null){
  1376 + HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
  1377 + hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
  1378 + hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
  1379 + if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0){
  1380 + model.setStatus(211);
  1381 + model.setMsg("操作代理不能重复录入");
  1382 + return model;
  1383 + }else {
  1384 + hzWaybillService.save(hzwaybllinfoEntity);
  1385 + }
  1386 +
  1387 + }else {
  1388 + model.setStatus(208);
  1389 + model.setMsg("操作代理,简称和类型有误!");
  1390 + return model;
  1391 + }
  1392 + }
  1393 +
  1394 + }
  1395 +
1307 1396
1308 // 判断主单是否存在 1397 // 判断主单是否存在
1309 ManifestEntity wbm = manifestService.findWbm(manifest.getWaybillnomaster()); 1398 ManifestEntity wbm = manifestService.findWbm(manifest.getWaybillnomaster());
@@ -1321,6 +1410,9 @@ public class ManifestController extends BasicController { @@ -1321,6 +1410,9 @@ public class ManifestController extends BasicController {
1321 manifest.setResponse_text(type.getName()); 1410 manifest.setResponse_text(type.getName());
1322 manifest.setSave_time(System.currentTimeMillis()); 1411 manifest.setSave_time(System.currentTimeMillis());
1323 1412
  1413 + manifest.setDe_trstation("");
  1414 + manifest.setDe_packing("");
  1415 + manifest.setDe_remarks("");
1324 manifestService.save(manifest); 1416 manifestService.save(manifest);
1325 1417
1326 model.setData(manifest); 1418 model.setData(manifest);
@@ -1363,7 +1455,7 @@ public class ManifestController extends BasicController { @@ -1363,7 +1455,7 @@ public class ManifestController extends BasicController {
1363 pe.setPaymode(manifest.getPaymode()); 1455 pe.setPaymode(manifest.getPaymode());
1364 pe.setCustomsstatus(manifest.getCustomsstatus()); 1456 pe.setCustomsstatus(manifest.getCustomsstatus());
1365 pe.setCustomscode(manifest.getCustomscode()); 1457 pe.setCustomscode(manifest.getCustomscode());
1366 - pe.setName_ofgoods(manifest.getName_ofgoods()); 1458 + pe.setProductname(manifest.getProductname());
1367 pe.setCo_company(manifest.getCo_company()); 1459 pe.setCo_company(manifest.getCo_company());
1368 pe.setCo_address(manifest.getCo_address()); 1460 pe.setCo_address(manifest.getCo_address());
1369 pe.setShpcusid(manifest.getShpcusid()); 1461 pe.setShpcusid(manifest.getShpcusid());
@@ -44,4 +44,7 @@ public interface HzInfoRepository extends PagingAndSortingRepository<HZSHIPPERIN @@ -44,4 +44,7 @@ public interface HzInfoRepository extends PagingAndSortingRepository<HZSHIPPERIN
44 44
45 @Query(value = "select * from HZ_SHIPPER_INFORMATION where id=?1 and delete_flag = 1", nativeQuery = true) 45 @Query(value = "select * from HZ_SHIPPER_INFORMATION where id=?1 and delete_flag = 1", nativeQuery = true)
46 HZSHIPPERINFORMATIONEntity findOnes(Long id); 46 HZSHIPPERINFORMATIONEntity findOnes(Long id);
  47 +
  48 + @Query(value = "select id from HZ_SHIPPER_INFORMATION where for_short=?1 and the_shipper_type=?2 and delete_flag=1", nativeQuery = true)
  49 + Long selectForShortType(String forshort, String type);
47 } 50 }
@@ -24,6 +24,8 @@ public interface HzWaybillRepository extends PagingAndSortingRepository<HZWAYBLL @@ -24,6 +24,8 @@ public interface HzWaybillRepository extends PagingAndSortingRepository<HZWAYBLL
24 @Query(value = "select * from HZ_WAYBILL_INFO where waybill_id = ?1", nativeQuery = true) 24 @Query(value = "select * from HZ_WAYBILL_INFO where waybill_id = ?1", nativeQuery = true)
25 List<HZWAYBLLINFOEntity> findHzId(String wabyill); 25 List<HZWAYBLLINFOEntity> findHzId(String wabyill);
26 26
  27 + @Query(value = "select count(*) from HZ_WAYBILL_INFO where waybill_id=?1 and hzinfor_id=?2", nativeQuery = true)
  28 + int awbHzId(String awb, String hzId);
27 29
28 30
29 } 31 }
@@ -87,4 +87,11 @@ public class HzInfoService extends BasicService<HZSHIPPERINFORMATIONEntity> { @@ -87,4 +87,11 @@ public class HzInfoService extends BasicService<HZSHIPPERINFORMATIONEntity> {
87 return hzInfoRepository.findOperaion(); 87 return hzInfoRepository.findOperaion();
88 } 88 }
89 89
  90 +
  91 + // 通过简称类型查看是否存在
  92 + public Long selectForShortType(String forshort, String type){
  93 +
  94 + return hzInfoRepository.selectForShortType(forshort, type);
  95 + }
  96 +
90 } 97 }
@@ -5,8 +5,10 @@ import com.agent.entity.agent.HZWAYBLLINFOEntity; @@ -5,8 +5,10 @@ import com.agent.entity.agent.HZWAYBLLINFOEntity;
5 import com.agent.repository.system.HzWaybillRepository; 5 import com.agent.repository.system.HzWaybillRepository;
6 import com.agent.service.BasicService; 6 import com.agent.service.BasicService;
7 import org.springframework.stereotype.Service; 7 import org.springframework.stereotype.Service;
  8 +import org.springframework.transaction.annotation.Transactional;
8 9
9 import javax.annotation.Resource; 10 import javax.annotation.Resource;
  11 +import java.beans.Transient;
10 import java.util.List; 12 import java.util.List;
11 13
12 /** 14 /**
@@ -19,8 +21,12 @@ public class HzWaybillService extends BasicService<HZSHIPPERINFORMATIONEntity> { @@ -19,8 +21,12 @@ public class HzWaybillService extends BasicService<HZSHIPPERINFORMATIONEntity> {
19 @Resource 21 @Resource
20 private HzWaybillRepository hzWaybillRepository; 22 private HzWaybillRepository hzWaybillRepository;
21 23
  24 +
22 public HZWAYBLLINFOEntity save(HZWAYBLLINFOEntity hzwaybllinfoEntity){ 25 public HZWAYBLLINFOEntity save(HZWAYBLLINFOEntity hzwaybllinfoEntity){
23 - return hzWaybillRepository.save(hzwaybllinfoEntity); 26 +
  27 +
  28 + return hzWaybillRepository.save(hzwaybllinfoEntity);
  29 +
24 } 30 }
25 31
26 public List<HZWAYBLLINFOEntity> findHzId(String waybill){ 32 public List<HZWAYBLLINFOEntity> findHzId(String waybill){
@@ -31,4 +37,11 @@ public class HzWaybillService extends BasicService<HZSHIPPERINFORMATIONEntity> { @@ -31,4 +37,11 @@ public class HzWaybillService extends BasicService<HZSHIPPERINFORMATIONEntity> {
31 return hzWaybillRepository.deleteAlls(waybill); 37 return hzWaybillRepository.deleteAlls(waybill);
32 } 38 }
33 39
  40 +
  41 + public int awbHzid(HZWAYBLLINFOEntity hzwaybllinfoEntity){
  42 +
  43 + return hzWaybillRepository.awbHzId(hzwaybllinfoEntity.getWaybill_id(), hzwaybllinfoEntity.getHzinfor_id());
  44 + }
  45 +
  46 +
34 } 47 }