|
|
@@ -0,0 +1,590 @@
|
|
|
+package org.springblade.los.Util;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
+import org.springblade.los.box.dynamics.entity.BoxDynamicsRecordItems;
|
|
|
+import org.springblade.los.box.entity.PutBox;
|
|
|
+import org.springblade.los.box.entity.PutBoxItems;
|
|
|
+import org.springblade.los.box.entity.TradingBox;
|
|
|
+import org.springblade.los.box.entity.TradingBoxItem;
|
|
|
+import org.springblade.los.business.sea.entity.Bills;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneId;
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author :jixinyuan
|
|
|
+ * @date : 2026/3/25
|
|
|
+ */
|
|
|
+public class EntryExitDataHandleUtils {
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 放箱号箱明细数据处理
|
|
|
+ *
|
|
|
+ * @param putBoxItem 箱明细数据
|
|
|
+ * @param item 进出场记录数据
|
|
|
+ * @param putBoxData 放箱号数据
|
|
|
+ * @param whetherExistence 提单号对应海运单据是否存在
|
|
|
+ * @param bills 海运单据数据
|
|
|
+ * @param boxDynamics 箱动态
|
|
|
+ * @param status 箱状态
|
|
|
+ * @param type 1=进场,2=调拨进场,3=出场,4=调箱出场,5=客户还箱,6=无货返空,7=退租出场,8=OW放箱出场
|
|
|
+ */
|
|
|
+ public static PutBoxItems putBoxItemDataHandle(PutBoxItems putBoxItem, BoxDynamicsRecordItems item, PutBox putBoxData,
|
|
|
+ boolean whetherExistence, Bills bills, String boxDynamics, String status, String type) {
|
|
|
+ if ("8".equals(type)) {
|
|
|
+ putBoxItem = new PutBoxItems();
|
|
|
+ putBoxItem.setBoxClass(putBoxData.getBoxClass());
|
|
|
+ putBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ putBoxItem.setBoxCondition("新");
|
|
|
+ putBoxItem.setStatus(status);
|
|
|
+ putBoxItem.setPid(putBoxData.getId());
|
|
|
+ putBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ putBoxItem.setBoxCode(item.getBoxCode());
|
|
|
+ putBoxItem.setBoxType(item.getBoxType());
|
|
|
+ putBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setCreateTime(new Date());
|
|
|
+ //放箱号目的港是否单一港口 是 明细目的港场站自动赋值主表
|
|
|
+ if (ObjectUtils.isNotNull(putBoxData.getPodId()) && !putBoxData.getPodId().contains(",")) {
|
|
|
+ putBoxItem.setPodStationId(putBoxData.getPodStationId());
|
|
|
+ putBoxItem.setPodStationCode(putBoxData.getPodStationCode());
|
|
|
+ putBoxItem.setPodStationCname(putBoxData.getPodStationCname());
|
|
|
+ putBoxItem.setPodStationEname(putBoxData.getPodStationEname());
|
|
|
+ putBoxItem.setPodCyAddress(putBoxData.getPodCyAddress());
|
|
|
+ putBoxItem.setPodCyContact(putBoxData.getPodCyContact());
|
|
|
+ putBoxItem.setPodCyEmail(putBoxData.getPodCyEmail());
|
|
|
+ putBoxItem.setPodCyTel(putBoxData.getPodCyTel());
|
|
|
+ }
|
|
|
+ putBoxItem.setPolCyId(item.getStationId());
|
|
|
+ putBoxItem.setPolCyCode(item.getStationCode());
|
|
|
+ putBoxItem.setPolCyCname(item.getStationCname());
|
|
|
+ putBoxItem.setPolCyEname(item.getStationEname());
|
|
|
+ if (ObjectUtils.isNull(putBoxItem.getPolPickUpDate())) {
|
|
|
+ putBoxItem.setPolPickUpDate(item.getApproachExitDate());
|
|
|
+ putBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
|
|
|
+ }
|
|
|
+ putBoxItem.setPolStationEmptyContainerExitDate(item.getApproachExitDate());
|
|
|
+ putBoxItem.setHblno(item.getHblno());
|
|
|
+ } else if ("3".equals(type)) {
|
|
|
+ putBoxItem.setPid(putBoxData.getId());
|
|
|
+ putBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setUpdateTime(new Date());
|
|
|
+ //放箱号目的港是否单一港口 是 明细目的港场站自动赋值主表
|
|
|
+ if (ObjectUtils.isNotNull(putBoxData.getPodId()) && !putBoxData.getPodId().contains(",")) {
|
|
|
+ putBoxItem.setPodStationId(putBoxData.getPodStationId());
|
|
|
+ putBoxItem.setPodStationCode(putBoxData.getPodStationCode());
|
|
|
+ putBoxItem.setPodStationCname(putBoxData.getPodStationCname());
|
|
|
+ putBoxItem.setPodStationEname(putBoxData.getPodStationEname());
|
|
|
+ putBoxItem.setPodCyAddress(putBoxData.getPodCyAddress());
|
|
|
+ putBoxItem.setPodCyContact(putBoxData.getPodCyContact());
|
|
|
+ putBoxItem.setPodCyEmail(putBoxData.getPodCyEmail());
|
|
|
+ putBoxItem.setPodCyTel(putBoxData.getPodCyTel());
|
|
|
+ }
|
|
|
+ putBoxItem.setPolCyId(item.getStationId());
|
|
|
+ putBoxItem.setPolCyCode(item.getStationCode());
|
|
|
+ putBoxItem.setPolCyCname(item.getStationCname());
|
|
|
+ putBoxItem.setPolCyEname(item.getStationEname());
|
|
|
+ if (ObjectUtils.isNull(putBoxItem.getPolPickUpDate())) {
|
|
|
+ putBoxItem.setPolPickUpDate(item.getApproachExitDate());
|
|
|
+ putBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
|
|
|
+ }
|
|
|
+ putBoxItem.setPolStationEmptyContainerExitDate(item.getApproachExitDate());
|
|
|
+ //海运出口信息赋值
|
|
|
+ if (whetherExistence && bills != null) {
|
|
|
+ putBoxItem.setMblno(bills.getMblno());
|
|
|
+ putBoxItem.setAgentName(bills.getForeignAgencyCnName());
|
|
|
+ putBoxItem.setCorpId(bills.getCorpId());
|
|
|
+ putBoxItem.setCorpName(bills.getCorpCnName());
|
|
|
+ putBoxItem.setVoyage(bills.getVoyageNo());
|
|
|
+ putBoxItem.setShipNameId(bills.getVesselId());
|
|
|
+ putBoxItem.setAgentName(bills.getForeignAgencyCnName());
|
|
|
+ putBoxItem.setShipCname(bills.getVesselCnName());
|
|
|
+ putBoxItem.setShipEname(bills.getVesselEnName());
|
|
|
+ putBoxItem.setEtd(bills.getEtd());
|
|
|
+ putBoxItem.setActualEtd(bills.getActualEtd());
|
|
|
+ putBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ } else {
|
|
|
+ //未查到海运单据则未占用
|
|
|
+ putBoxItem.setUnoccupied("1");
|
|
|
+ }
|
|
|
+ putBoxItem.setHblno(item.getHblno());
|
|
|
+ } else if ("4".equals(type)) {
|
|
|
+ if (putBoxItem != null) {
|
|
|
+ putBoxItem.setPid(putBoxData.getId());
|
|
|
+ putBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setUpdateTime(new Date());
|
|
|
+ } else {
|
|
|
+ putBoxItem = new PutBoxItems();
|
|
|
+ putBoxItem.setBoxClass(putBoxData.getBoxClass());
|
|
|
+ putBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ putBoxItem.setBoxCondition("新");
|
|
|
+ putBoxItem.setPid(putBoxData.getId());
|
|
|
+ putBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ putBoxItem.setBoxCode(item.getBoxCode());
|
|
|
+ putBoxItem.setBoxType(item.getBoxType());
|
|
|
+ putBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setCreateTime(new Date());
|
|
|
+ }
|
|
|
+ putBoxItem.setPolCyId(item.getStationId());
|
|
|
+ putBoxItem.setPolCyCode(item.getStationCode());
|
|
|
+ putBoxItem.setPolCyCname(item.getStationCname());
|
|
|
+ putBoxItem.setPolCyEname(item.getStationEname());
|
|
|
+ putBoxItem.setPolStationEmptyContainerExitDate(item.getApproachExitDate());
|
|
|
+ } else if ("7".equals(type)) {
|
|
|
+ putBoxItem.setPid(putBoxData.getId());
|
|
|
+ putBoxItem.setPodStationId(item.getStationId());
|
|
|
+ putBoxItem.setPodStationCode(item.getStationCname());
|
|
|
+ putBoxItem.setPodStationCname(item.getStationEname());
|
|
|
+ putBoxItem.setPodStationEname(item.getStationCode());
|
|
|
+
|
|
|
+ putBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setUpdateTime(new Date());
|
|
|
+ } else if ("1".equals(type)) {
|
|
|
+ if (putBoxItem != null) {
|
|
|
+ if ("使用中".equals(putBoxItem.getStatus())) {
|
|
|
+ putBoxItem.setTemporaryStatus(true);
|
|
|
+ }
|
|
|
+ putBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ putBoxItem.setPodEmptyContainerReturnDate(null);
|
|
|
+ putBoxItem.setPodStationId(null);
|
|
|
+ putBoxItem.setPodStationCode(null);
|
|
|
+ putBoxItem.setPodStationCname(null);
|
|
|
+ putBoxItem.setPodStationEname(null);
|
|
|
+ putBoxItem.setEta(null);
|
|
|
+ putBoxItem.setCorpId(0L);
|
|
|
+ putBoxItem.setCorpName("");
|
|
|
+ putBoxItem.setMblno("");
|
|
|
+ putBoxItem.setHblno("");
|
|
|
+ putBoxItem.setShipNameId(0L);
|
|
|
+ putBoxItem.setShipCname("");
|
|
|
+ putBoxItem.setShipEname("");
|
|
|
+ putBoxItem.setShipCode("");
|
|
|
+ putBoxItem.setVoyage("");
|
|
|
+ putBoxItem.setPodCyAddress("");
|
|
|
+ putBoxItem.setPodCyContact("");
|
|
|
+ putBoxItem.setPodCyEmail("");
|
|
|
+ putBoxItem.setPodCyTel("");
|
|
|
+ putBoxItem.setEtd(null);
|
|
|
+ putBoxItem.setPolFreeBoxUseDays(0);
|
|
|
+ putBoxItem.setPolStationEmptyContainerExitDate(null);
|
|
|
+ putBoxItem.setPolReturnDate(null);
|
|
|
+ putBoxItem.setPolOverdueBoxUseDays(0);
|
|
|
+ putBoxItem.setPodFreeBoxUseDays(0);
|
|
|
+ putBoxItem.setPodBoxUseDays(0);
|
|
|
+ putBoxItem.setAgentName("");
|
|
|
+ putBoxItem.setActualEtd(null);
|
|
|
+ putBoxItem.setActualEta(null);
|
|
|
+ } else {
|
|
|
+ putBoxItem = new PutBoxItems();
|
|
|
+ putBoxItem.setBoxClass(putBoxData.getBoxClass());
|
|
|
+ putBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ putBoxItem.setBoxCondition("新");
|
|
|
+ putBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ putBoxItem.setBoxCode(item.getBoxCode());
|
|
|
+ putBoxItem.setBoxType(item.getBoxType());
|
|
|
+ putBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setCreateTime(new Date());
|
|
|
+ putBoxItem.setTemporaryStatus(false);
|
|
|
+ putBoxItem.setPid(putBoxData.getId());
|
|
|
+ }
|
|
|
+ putBoxItem.setMblno(item.getMblno());
|
|
|
+ putBoxItem.setPolCyId(item.getStationId());
|
|
|
+ putBoxItem.setPolCyCode(item.getStationCode());
|
|
|
+ putBoxItem.setPolCyCname(item.getStationCname());
|
|
|
+ putBoxItem.setPolCyEname(item.getPortEname());
|
|
|
+ putBoxItem.setPolPickUpDate(item.getApproachExitDate());
|
|
|
+ putBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
|
|
|
+ } else if ("5".equals(type)) {
|
|
|
+ putBoxItem.setPodEmptyContainerReturnDate(item.getApproachExitDate());
|
|
|
+ putBoxItem.setPodStationId(item.getStationId());
|
|
|
+ putBoxItem.setPodStationCode(item.getStationCname());
|
|
|
+ putBoxItem.setPodStationCname(item.getStationEname());
|
|
|
+ putBoxItem.setPodStationEname(item.getStationCode());
|
|
|
+ putBoxItem.setBoxStatus(item.getBoxStatus());
|
|
|
+ if ("待使用".equals(putBoxItem.getStatus())) {
|
|
|
+ putBoxItem.setTemporaryStatus(true);
|
|
|
+ }
|
|
|
+ putBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setUpdateTime(new Date());
|
|
|
+ if (ObjectUtils.isNotNull(putBoxItem.getPolStationEmptyContainerExitDate()) &&
|
|
|
+ ObjectUtils.isNotNull(putBoxItem.getPodEmptyContainerReturnDate())) {
|
|
|
+ LocalDateTime ldt2 = putBoxItem.getPolStationEmptyContainerExitDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ LocalDateTime ldt1 = putBoxItem.getPodEmptyContainerReturnDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ int overdueDays = (int) ChronoUnit.DAYS.between(ldt2, ldt1);
|
|
|
+ putBoxItem.setPodBoxUseDays(Integer.parseInt(overdueDays + ""));
|
|
|
+ }
|
|
|
+ }else if ("2".equals(type)){
|
|
|
+ if (putBoxItem != null) {
|
|
|
+ if ("使用中".equals(putBoxItem.getStatus())) {
|
|
|
+ putBoxItem.setTemporaryStatus(true);
|
|
|
+ }
|
|
|
+ putBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setUpdateTime(new Date());
|
|
|
+ } else {
|
|
|
+ putBoxItem = new PutBoxItems();
|
|
|
+ putBoxItem.setBoxClass(putBoxData.getBoxClass());
|
|
|
+ putBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ putBoxItem.setBoxCondition("新");
|
|
|
+ putBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ putBoxItem.setBoxCode(item.getBoxCode());
|
|
|
+ putBoxItem.setBoxType(item.getBoxType());
|
|
|
+ putBoxItem.setBoxClass(putBoxData.getBoxClass());
|
|
|
+ putBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setCreateTime(new Date());
|
|
|
+ putBoxItem.setPid(putBoxData.getId());
|
|
|
+ }
|
|
|
+ putBoxItem.setPolCyId(item.getStationId());
|
|
|
+ putBoxItem.setPolCyCode(item.getStationCode());
|
|
|
+ putBoxItem.setPolCyCname(item.getStationCname());
|
|
|
+ putBoxItem.setPolCyEname(item.getPortEname());
|
|
|
+ putBoxItem.setPolPickUpDate(item.getApproachExitDate());
|
|
|
+ putBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
|
|
|
+ }else if ("6".equals(type)){
|
|
|
+ putBoxItem.setPolCyId(item.getStationId());
|
|
|
+ putBoxItem.setPolCyCode(item.getStationCode());
|
|
|
+ putBoxItem.setPolCyCname(item.getStationCname());
|
|
|
+ putBoxItem.setPolCyEname(item.getPortEname());
|
|
|
+ putBoxItem.setPolReturnDate(item.getApproachExitDate());
|
|
|
+ putBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ putBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ putBoxItem.setUpdateTime(new Date());
|
|
|
+ putBoxItem.setTemporaryMblno(putBoxItem.getHblno());
|
|
|
+
|
|
|
+ putBoxItem.setPodEmptyContainerReturnDate(null);
|
|
|
+ putBoxItem.setPodStationId(null);
|
|
|
+ putBoxItem.setPodStationCode(null);
|
|
|
+ putBoxItem.setPodStationCname(null);
|
|
|
+ putBoxItem.setPodStationEname(null);
|
|
|
+ putBoxItem.setEta(null);
|
|
|
+ putBoxItem.setCorpId(0L);
|
|
|
+ putBoxItem.setCorpName("");
|
|
|
+ putBoxItem.setMblno("");
|
|
|
+ putBoxItem.setHblno("");
|
|
|
+ putBoxItem.setShipNameId(0L);
|
|
|
+ putBoxItem.setShipCname("");
|
|
|
+ putBoxItem.setShipEname("");
|
|
|
+ putBoxItem.setShipCode("");
|
|
|
+ putBoxItem.setVoyage("");
|
|
|
+ putBoxItem.setPodCyAddress("");
|
|
|
+ putBoxItem.setPodCyContact("");
|
|
|
+ putBoxItem.setPodCyEmail("");
|
|
|
+ putBoxItem.setPodCyTel("");
|
|
|
+ putBoxItem.setEtd(null);
|
|
|
+ putBoxItem.setPolFreeBoxUseDays(0);
|
|
|
+ putBoxItem.setPolStationEmptyContainerExitDate(null);
|
|
|
+ putBoxItem.setPolReturnDate(null);
|
|
|
+ putBoxItem.setPolOverdueBoxUseDays(0);
|
|
|
+ putBoxItem.setPodFreeBoxUseDays(0);
|
|
|
+ putBoxItem.setPodBoxUseDays(0);
|
|
|
+ putBoxItem.setAgentName("");
|
|
|
+ putBoxItem.setActualEtd(null);
|
|
|
+ putBoxItem.setActualEta(null);
|
|
|
+ }
|
|
|
+ putBoxItem.setBoxStatus(item.getBoxStatus());
|
|
|
+ putBoxItem.setStatus(status);
|
|
|
+ putBoxItem.setBoxDynamics(boxDynamics);
|
|
|
+ putBoxItem.setTemporaryId(item.getTemporaryId());
|
|
|
+ return putBoxItem;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * OW箱单据箱明细数据处理
|
|
|
+ *
|
|
|
+ * @param tradingBoxItem 箱明细数据
|
|
|
+ * @param item 进出场记录数据
|
|
|
+ * @param tradingBox OW箱单据
|
|
|
+ * @param whetherExistence 提单号对应海运单据是否存在
|
|
|
+ * @param bills 海运单据数据
|
|
|
+ * @param boxDynamics 箱动态
|
|
|
+ * @param status 箱状态
|
|
|
+ * @param type 1=进场,2=调拨进场,3=出场,4=调箱出场,5=客户还箱,6=无货返空,7=退租出场,8=OW放箱出场
|
|
|
+ */
|
|
|
+ public static TradingBoxItem tradingBoxItemDataHandle(TradingBoxItem tradingBoxItem, BoxDynamicsRecordItems item, TradingBox tradingBox,
|
|
|
+ Boolean whetherExistence, Bills bills, String boxDynamics, String status, String type) {
|
|
|
+ if ("3".equals(type)) {
|
|
|
+ tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setUpdateTime(new Date());
|
|
|
+ //OW(拿)单据目的港是否单一港口 是 明细目的港场站自动赋值主表
|
|
|
+ if (ObjectUtils.isNotNull(tradingBox.getPodId()) && !tradingBox.getPodId().contains(",")) {
|
|
|
+ tradingBoxItem.setPodStationId(tradingBox.getPodStationId());
|
|
|
+ tradingBoxItem.setPodStationCode(tradingBox.getPodStationCode());
|
|
|
+ tradingBoxItem.setPodStationCname(tradingBox.getPodStationCname());
|
|
|
+ tradingBoxItem.setPodStationEname(tradingBox.getPodStationEname());
|
|
|
+ tradingBoxItem.setPodCyAddress(tradingBox.getPodCyAddress());
|
|
|
+ tradingBoxItem.setPodCyContact(tradingBox.getPodCyContact());
|
|
|
+ tradingBoxItem.setPodCyEmail(tradingBox.getPodCyEmail());
|
|
|
+ tradingBoxItem.setPodCyTel(tradingBox.getPodCyTel());
|
|
|
+ }
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ if (ObjectUtils.isNull(tradingBoxItem.getPolPickUpDate())) {
|
|
|
+ tradingBoxItem.setRentEndDate(item.getApproachExitDate());
|
|
|
+ tradingBoxItem.setPolPickUpDate(item.getApproachExitDate());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
|
|
|
+ }
|
|
|
+ tradingBoxItem.setPolStationEmptyContainerExitDate(item.getApproachExitDate());
|
|
|
+ //海运出口信息赋值
|
|
|
+ if (whetherExistence && bills != null) {
|
|
|
+ tradingBoxItem.setAgentName(bills.getForeignAgencyCnName());
|
|
|
+ tradingBoxItem.setActualEtd(bills.getActualEtd());
|
|
|
+ tradingBoxItem.setMblno(bills.getMblno());
|
|
|
+ tradingBoxItem.setCorpId(bills.getCorpId());
|
|
|
+ tradingBoxItem.setCorpName(bills.getCorpCnName());
|
|
|
+ tradingBoxItem.setVoyage(bills.getVoyageNo());
|
|
|
+ tradingBoxItem.setShipNameId(bills.getVesselId());
|
|
|
+ tradingBoxItem.setShipCname(bills.getVesselCnName());
|
|
|
+ tradingBoxItem.setShipEname(bills.getVesselEnName());
|
|
|
+ tradingBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ tradingBoxItem.setEtd(bills.getEtd());
|
|
|
+ tradingBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
|
|
|
+ }
|
|
|
+ } else if ("4".equals(type)) {
|
|
|
+ if (tradingBoxItem != null) {
|
|
|
+ tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setUpdateTime(new Date());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem = new TradingBoxItem();
|
|
|
+ tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ if ("OW-N".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("OW(拿)");
|
|
|
+ } else if ("DL".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("代理箱");
|
|
|
+ } else if ("ZR".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("租箱");
|
|
|
+ }
|
|
|
+ tradingBoxItem.setBoxCondition("新");
|
|
|
+ tradingBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ tradingBoxItem.setCode(item.getBoxCode());
|
|
|
+ tradingBoxItem.setBoxType(item.getBoxType());
|
|
|
+ tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
|
|
|
+ tradingBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setCreateTime(new Date());
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(item.getApproachExitDate())) {
|
|
|
+ tradingBoxItem.setPolStationEmptyContainerExitDate(item.getApproachExitDate());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
|
|
|
+ }
|
|
|
+ } else if ("7".equals(type)) {
|
|
|
+ if (tradingBoxItem != null) {
|
|
|
+ tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setUpdateTime(new Date());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem = new TradingBoxItem();
|
|
|
+ tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ tradingBoxItem.setBoxCondition("新");
|
|
|
+ tradingBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ tradingBoxItem.setCode(item.getBoxCode());
|
|
|
+ tradingBoxItem.setBoxType(item.getBoxType());
|
|
|
+ tradingBoxItem.setTenantId(item.getTenantId());
|
|
|
+ tradingBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setCreateTime(new Date());
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(item.getApproachExitDate())) {
|
|
|
+ tradingBoxItem.setRentingOutDate(item.getApproachExitDate());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setRentingOutDate(new Date());
|
|
|
+ }
|
|
|
+ } else if ("1".equals(type)) {
|
|
|
+ if (tradingBoxItem != null) {
|
|
|
+ tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ tradingBoxItem.setPodReturnDate(null);
|
|
|
+ tradingBoxItem.setEtd(null);
|
|
|
+ tradingBoxItem.setPolFreeBoxUseDays(0);
|
|
|
+ tradingBoxItem.setPolOverdueBoxUseDays(0);
|
|
|
+ tradingBoxItem.setEta(null);
|
|
|
+ tradingBoxItem.setPodEmptyContainerReturnDate(null);
|
|
|
+ tradingBoxItem.setPodStationId(0L);
|
|
|
+ tradingBoxItem.setPodStationCode("");
|
|
|
+ tradingBoxItem.setPodStationCname("");
|
|
|
+ tradingBoxItem.setPodStationEname("");
|
|
|
+ tradingBoxItem.setPodFreeBoxUseDays(0);
|
|
|
+ tradingBoxItem.setPodBoxUseDays(0);
|
|
|
+ tradingBoxItem.setAgentName("");
|
|
|
+ tradingBoxItem.setCorpId(0L);
|
|
|
+ tradingBoxItem.setCorpName("");
|
|
|
+ tradingBoxItem.setMblno("");
|
|
|
+ tradingBoxItem.setHblno("");
|
|
|
+ tradingBoxItem.setShipNameId(0L);
|
|
|
+ tradingBoxItem.setShipCname("");
|
|
|
+ tradingBoxItem.setShipEname("");
|
|
|
+ tradingBoxItem.setShipCode("");
|
|
|
+ tradingBoxItem.setVoyage("");
|
|
|
+ tradingBoxItem.setPodCyAddress("");
|
|
|
+ tradingBoxItem.setPodCyContact("");
|
|
|
+ tradingBoxItem.setPodCyEmail("");
|
|
|
+ tradingBoxItem.setPodCyTel("");
|
|
|
+ tradingBoxItem.setActualEtd(null);
|
|
|
+ tradingBoxItem.setActualEta(null);
|
|
|
+ } else {
|
|
|
+ tradingBoxItem = new TradingBoxItem();
|
|
|
+ tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ if ("OW-N".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("OW(拿)");
|
|
|
+ } else if ("DL".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("代理箱");
|
|
|
+ } else if ("ZR".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("租箱");
|
|
|
+ }
|
|
|
+ tradingBoxItem.setBoxCondition("新");
|
|
|
+ tradingBoxItem.setBoxStatus(item.getBoxStatus());
|
|
|
+ tradingBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ tradingBoxItem.setCode(item.getBoxCode());
|
|
|
+ tradingBoxItem.setBoxType(item.getBoxType());
|
|
|
+ tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
|
|
|
+ tradingBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setCreateTime(new Date());
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(item.getApproachExitDate())) {
|
|
|
+ tradingBoxItem.setRentEndDate(item.getApproachExitDate());
|
|
|
+ tradingBoxItem.setPolPickUpDate(item.getApproachExitDate());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setRentEndDate(new Date());
|
|
|
+ tradingBoxItem.setPolPickUpDate(new Date());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(new Date());
|
|
|
+ }
|
|
|
+ } else if ("5".equals(type)) {
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ tradingBoxItem.setPodEmptyContainerReturnDate(item.getApproachExitDate());
|
|
|
+ tradingBoxItem.setPodStationId(item.getStationId());
|
|
|
+ tradingBoxItem.setPodStationCode(item.getStationCname());
|
|
|
+ tradingBoxItem.setPodStationCname(item.getStationEname());
|
|
|
+ tradingBoxItem.setPodStationEname(item.getStationCode());
|
|
|
+ tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setUpdateTime(new Date());
|
|
|
+ if (bills != null) {
|
|
|
+ tradingBoxItem.setPodFreeBoxUseDays(bills.getPodFreeBoxUseDays());
|
|
|
+ tradingBoxItem.setEta(bills.getEta());
|
|
|
+ tradingBoxItem.setActualEta(bills.getActualEta());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(tradingBoxItem.getPolStationEmptyContainerExitDate()) &&
|
|
|
+ ObjectUtils.isNotNull(tradingBoxItem.getPodEmptyContainerReturnDate())) {
|
|
|
+ LocalDateTime ldt2 = tradingBoxItem.getPolStationEmptyContainerExitDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ LocalDateTime ldt1 = tradingBoxItem.getPodEmptyContainerReturnDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ int overdueDays = (int) ChronoUnit.DAYS.between(ldt2, ldt1);
|
|
|
+ tradingBoxItem.setPodBoxUseDays(Integer.parseInt(overdueDays + ""));
|
|
|
+ }
|
|
|
+ }else if ("2".equals(type)){
|
|
|
+ if (tradingBoxItem != null) {
|
|
|
+ tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setUpdateTime(new Date());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem = new TradingBoxItem();
|
|
|
+ tradingBoxItem.setBoxBelongsTo("SOC");
|
|
|
+ if ("OW-N".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("OW(拿)");
|
|
|
+ } else if ("DL".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("代理箱");
|
|
|
+ } else if ("ZR".equals(tradingBox.getType())) {
|
|
|
+ tradingBoxItem.setBoxCategory("租箱");
|
|
|
+ }
|
|
|
+ tradingBoxItem.setBoxSource(tradingBox.getBoxClass());
|
|
|
+ tradingBoxItem.setBoxCondition("新");
|
|
|
+ tradingBoxItem.setBoxStatus(item.getBoxStatus());
|
|
|
+ tradingBoxItem.setContainerNumber(item.getContainerNumber());
|
|
|
+ tradingBoxItem.setCode(item.getBoxCode());
|
|
|
+ tradingBoxItem.setBoxType(item.getBoxType());
|
|
|
+ tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
|
|
|
+ tradingBoxItem.setCreateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setCreateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setCreateTime(new Date());
|
|
|
+ tradingBoxItem.setPid(tradingBox.getId());
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(item.getApproachExitDate())) {
|
|
|
+ tradingBoxItem.setRentEndDate(item.getApproachExitDate());
|
|
|
+ tradingBoxItem.setPolPickUpDate(item.getApproachExitDate());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
|
|
|
+ } else {
|
|
|
+ tradingBoxItem.setRentEndDate(new Date());
|
|
|
+ tradingBoxItem.setPolPickUpDate(new Date());
|
|
|
+ tradingBoxItem.setPolPreAppearanceDate(new Date());
|
|
|
+ }
|
|
|
+ }else if ("6".equals(type)){
|
|
|
+ tradingBoxItem.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ tradingBoxItem.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ tradingBoxItem.setUpdateTime(new Date());
|
|
|
+ tradingBoxItem.setPolReturnDate(item.getApproachExitDate());
|
|
|
+
|
|
|
+ tradingBoxItem.setPodReturnDate(null);
|
|
|
+ tradingBoxItem.setEtd(null);
|
|
|
+ tradingBoxItem.setPolFreeBoxUseDays(0);
|
|
|
+ tradingBoxItem.setPolOverdueBoxUseDays(0);
|
|
|
+ tradingBoxItem.setEta(null);
|
|
|
+ tradingBoxItem.setPodEmptyContainerReturnDate(null);
|
|
|
+ tradingBoxItem.setPodStationId(0L);
|
|
|
+ tradingBoxItem.setPodStationCode("");
|
|
|
+ tradingBoxItem.setPodStationCname("");
|
|
|
+ tradingBoxItem.setPodStationEname("");
|
|
|
+ tradingBoxItem.setPodFreeBoxUseDays(0);
|
|
|
+ tradingBoxItem.setPodBoxUseDays(0);
|
|
|
+ tradingBoxItem.setAgentName("");
|
|
|
+ tradingBoxItem.setCorpId(0L);
|
|
|
+ tradingBoxItem.setCorpName("");
|
|
|
+ tradingBoxItem.setMblno("");
|
|
|
+ tradingBoxItem.setHblno("");
|
|
|
+ tradingBoxItem.setShipNameId(0L);
|
|
|
+ tradingBoxItem.setShipCname("");
|
|
|
+ tradingBoxItem.setShipEname("");
|
|
|
+ tradingBoxItem.setShipCode("");
|
|
|
+ tradingBoxItem.setVoyage("");
|
|
|
+ tradingBoxItem.setPodCyAddress("");
|
|
|
+ tradingBoxItem.setPodCyContact("");
|
|
|
+ tradingBoxItem.setPodCyEmail("");
|
|
|
+ tradingBoxItem.setPodCyTel("");
|
|
|
+ tradingBoxItem.setActualEtd(null);
|
|
|
+ tradingBoxItem.setActualEta(null);
|
|
|
+ tradingBoxItem.setTemporaryId(item.getTemporaryId());
|
|
|
+ }
|
|
|
+ tradingBoxItem.setHblno(item.getHblno());
|
|
|
+ tradingBoxItem.setBoxDynamics(boxDynamics);
|
|
|
+ tradingBoxItem.setBoxStatus(item.getBoxStatus());
|
|
|
+ tradingBoxItem.setPortId(item.getPortId());
|
|
|
+ tradingBoxItem.setPortCode(item.getPortCode());
|
|
|
+ tradingBoxItem.setPortCname(item.getPortCname());
|
|
|
+ tradingBoxItem.setPortEname(item.getPortEname());
|
|
|
+ tradingBoxItem.setStationId(item.getStationId());
|
|
|
+ tradingBoxItem.setStationCode(item.getStationCode());
|
|
|
+ tradingBoxItem.setStationCname(item.getStationCname());
|
|
|
+ tradingBoxItem.setStationEname(item.getStationEname());
|
|
|
+ tradingBoxItem.setPolCyId(item.getStationId());
|
|
|
+ tradingBoxItem.setPolCyCode(item.getStationCode());
|
|
|
+ tradingBoxItem.setPolCyCname(item.getStationCname());
|
|
|
+ tradingBoxItem.setPolCyEname(item.getStationEname());
|
|
|
+ tradingBoxItem.setStatus(status);
|
|
|
+ tradingBoxItem.setBoxEastId(tradingBox.getPurchaseCompanyId());
|
|
|
+ tradingBoxItem.setBoxEastName(tradingBox.getPurchaseCompanyName());
|
|
|
+ tradingBoxItem.setTemporaryId(item.getTemporaryId());
|
|
|
+ return tradingBoxItem;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|