作者 shenhailong

修改 远程 预配录入 判断 返回信息 发货人不能重复录入

@@ -1310,96 +1310,96 @@ public class ManifestController extends BasicController { @@ -1310,96 +1310,96 @@ public class ManifestController extends BasicController {
1310 String de_packing = manifest.getDe_packing(); 1310 String de_packing = manifest.getDe_packing();
1311 // 操作代理 。。。。。。。。。 1311 // 操作代理 。。。。。。。。。
1312 String de_remarks = manifest.getDe_remarks(); 1312 String de_remarks = manifest.getDe_remarks();
1313 - // 货主信息  
1314 - if(StringUtils.isBlank(de_trstation) && StringUtils.isBlank(de_packing) && StringUtils.isBlank(de_remarks)){  
1315 1313
1316 - model.setStatus(205);  
1317 - model.setMsg("货主信息三选一,不能为空"); 1314 + // 判断主单是否存在
  1315 + ManifestEntity wbm = manifestService.findWbm(manifest.getWaybillnomaster());
  1316 + if (wbm != null) {
  1317 + model.setStatus(201);
  1318 + model.setMsg("主单号已存在!");
  1319 + } else {
  1320 + // 货主信息
  1321 + if(StringUtils.isBlank(de_trstation) && StringUtils.isBlank(de_packing) && StringUtils.isBlank(de_remarks)){
1318 1322
1319 - return model; 1323 + model.setStatus(205);
  1324 + model.setMsg("货主信息三选一,不能为空");
1320 1325
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; 1326 + return model;
  1327 +
  1328 + }else {
  1329 + if (StringUtils.isNotBlank(de_trstation)){
  1330 + String s = de_trstation.replace(",", ",");
  1331 + String[] split = s.split(",");
  1332 + Long id = hzInfoService.selectForShortType(split[0], split[1]);
  1333 + if (id != null){
  1334 + HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
  1335 + hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
  1336 + hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
  1337 + if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0){
  1338 + model.setStatus(209);
  1339 + model.setMsg("发货人不能重复录入");
  1340 + return model;
  1341 + }else {
  1342 + hzWaybillService.save(hzwaybllinfoEntity);
  1343 + }
1334 }else { 1344 }else {
1335 - hzWaybillService.save(hzwaybllinfoEntity); 1345 + model.setStatus(206);
  1346 + model.setMsg("发货人,简称和类型有误!");
  1347 + hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
  1348 + return model;
1336 } 1349 }
1337 - }else {  
1338 - model.setStatus(206);  
1339 - model.setMsg("发货人,简称和类型有误!");  
1340 - hzWaybillService.deleteAlls(manifest.getWaybillnomaster());  
1341 - return model;  
1342 } 1350 }
1343 - }  
1344 1351
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("订舱代理不能重复录入"); 1352 + if (StringUtils.isNotBlank(de_packing)){
  1353 + String s = de_packing.replace(",", ",");
  1354 + String[] split = s.split(",");
  1355 + Long id = hzInfoService.selectForShortType(split[0], split[1]);
  1356 + if (id != null){
  1357 + HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
  1358 + hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
  1359 + hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
  1360 +
  1361 + if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0 ){
  1362 + model.setStatus(210);
  1363 + model.setMsg("订舱代理不能重复录入");
  1364 + hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
  1365 +
  1366 + return model;
  1367 + }else {
  1368 + hzWaybillService.save(hzwaybllinfoEntity);
  1369 + }
  1370 + }else {
  1371 + model.setStatus(207);
  1372 + model.setMsg("订舱代理,简称和类型有误!");
1357 hzWaybillService.deleteAlls(manifest.getWaybillnomaster()); 1373 hzWaybillService.deleteAlls(manifest.getWaybillnomaster());
1358 -  
1359 return model; 1374 return model;
1360 - }else {  
1361 - hzWaybillService.save(hzwaybllinfoEntity);  
1362 } 1375 }
1363 - }else {  
1364 - model.setStatus(207);  
1365 - model.setMsg("订舱代理,简称和类型有误!");  
1366 - hzWaybillService.deleteAlls(manifest.getWaybillnomaster());  
1367 - return model;  
1368 } 1376 }
1369 - }  
1370 1377
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; 1378 + if (StringUtils.isNotBlank(de_remarks)){
  1379 + String s = de_remarks.replace(",", ",");
  1380 + String[] split = s.split(",");
  1381 + Long id = hzInfoService.selectForShortType(split[0], split[1]);
  1382 + if (id != null){
  1383 + HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
  1384 + hzwaybllinfoEntity.setHzinfor_id(String.valueOf(id));
  1385 + hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
  1386 + if (hzWaybillService.awbHzid(hzwaybllinfoEntity) != 0){
  1387 + model.setStatus(211);
  1388 + model.setMsg("操作代理不能重复录入");
  1389 + return model;
  1390 + }else {
  1391 + hzWaybillService.save(hzwaybllinfoEntity);
  1392 + }
  1393 +
1383 }else { 1394 }else {
1384 - hzWaybillService.save(hzwaybllinfoEntity); 1395 + model.setStatus(208);
  1396 + model.setMsg("操作代理,简称和类型有误!");
  1397 + return model;
1385 } 1398 }
1386 -  
1387 - }else {  
1388 - model.setStatus(208);  
1389 - model.setMsg("操作代理,简称和类型有误!");  
1390 - return model;  
1391 } 1399 }
1392 - }  
1393 -  
1394 - }  
1395 1400
  1401 + }
1396 1402
1397 - // 判断主单是否存在  
1398 - ManifestEntity wbm = manifestService.findWbm(manifest.getWaybillnomaster());  
1399 - if (wbm != null) {  
1400 - model.setStatus(201);  
1401 - model.setMsg("主单号已存在!");  
1402 - } else {  
1403 WaybillReceiptType type = WaybillReceiptType.TEMP_SAVE; 1403 WaybillReceiptType type = WaybillReceiptType.TEMP_SAVE;
1404 1404
1405 String stowagedate = request.getParameter("stowagedate"); 1405 String stowagedate = request.getParameter("stowagedate");