|
|
@@ -29,10 +29,7 @@ import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
-import org.springblade.los.Util.BigDecimalUtils;
|
|
|
-import org.springblade.los.Util.IDeptUtils;
|
|
|
-import org.springblade.los.Util.StringTools;
|
|
|
-import org.springblade.los.Util.ZrUtil;
|
|
|
+import org.springblade.los.Util.*;
|
|
|
import org.springblade.los.basic.business.entity.BusinessType;
|
|
|
import org.springblade.los.basic.business.service.IBusinessTypeService;
|
|
|
import org.springblade.los.basic.corps.entity.BCorps;
|
|
|
@@ -55,6 +52,7 @@ import org.springblade.los.business.sea.entity.*;
|
|
|
import org.springblade.los.business.sea.mapper.BillsMapper;
|
|
|
import org.springblade.los.business.sea.service.*;
|
|
|
import org.springblade.los.business.sea.vo.BillsVO;
|
|
|
+import org.springblade.los.business.sea.vo.UpdateBillsFieldVo;
|
|
|
import org.springblade.los.check.dto.LosAuditProecessDTO;
|
|
|
import org.springblade.los.check.entity.LosAuditPathsActs;
|
|
|
import org.springblade.los.check.entity.LosAuditPathsLevels;
|
|
|
@@ -161,10 +159,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
private final ZrUtil zrUtil;
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public IPage<BillsVO> selectBillsPage(IPage<BillsVO> page, BillsVO bills) {
|
|
|
return page.setRecords(baseMapper.selectBillsPage(page, bills));
|
|
|
@@ -303,15 +297,14 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
// 初始创建为1
|
|
|
bills.setVersion("1");
|
|
|
this.save(bills);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
Bills dataSourceBill = baseMapper.selectOne(new LambdaQueryWrapper<Bills>().select(Bills::getId, Bills::getVersion).eq(Bills::getId, bills.getId()));
|
|
|
if (!Objects.equals(dataSourceBill.getVersion(), bills.getVersion())) {
|
|
|
return R.fail(601, "数据已被其他用户更新,请等待刷新后重试");
|
|
|
}
|
|
|
// 每更新一次往上累加一次版本
|
|
|
// 旧数据处理
|
|
|
- int version = StringUtil.isBlank(dataSourceBill.getVersion()) ? 1 :Integer.parseInt(dataSourceBill.getVersion());
|
|
|
+ int version = StringUtil.isBlank(dataSourceBill.getVersion()) ? 1 : Integer.parseInt(dataSourceBill.getVersion());
|
|
|
bills.setVersion(String.valueOf(version + 1));
|
|
|
List<Long> ids = count.stream().map(Bills::getId).distinct().collect(Collectors.toList());
|
|
|
if (!"MH".equals(bills.getBillType())) {
|
|
|
@@ -567,6 +560,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
.eq(Containers::getIsDeleted, 0));
|
|
|
if (!containersList.isEmpty()) {
|
|
|
for (Containers item : containersList) {
|
|
|
+ BoxNumUtils.containerNumberVerification(item.getCntrNo());
|
|
|
item.setUpdateUser(AuthUtil.getUserId());
|
|
|
item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
item.setUpdateTime(new Date());
|
|
|
@@ -586,7 +580,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
.distinct().filter(Objects::nonNull).collect(Collectors.joining(",")));
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
bills.setQuantityCntrDescr(null);
|
|
|
}
|
|
|
bills.setQuantityV20(V20);
|
|
|
@@ -753,7 +747,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
measurement = measurement.add(details.stream().map(Bills::getMeasurement).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
|
|
|
}
|
|
|
- } else if ("MH".equals(bills.getBillType()) && ObjectUtils.isNotNull(bills.getId())) {
|
|
|
+ }
|
|
|
+ else if ("MH".equals(bills.getBillType()) && ObjectUtils.isNotNull(bills.getId())) {
|
|
|
Bills details = baseMapper.selectOne(new LambdaQueryWrapper<Bills>()
|
|
|
.select(Bills::getAmountDr, Bills::getAmountCr, Bills::getAmountProfit, Bills::getAmountDrUsd, Bills::getAmountCrUsd
|
|
|
, Bills::getAmountProfitUsd, Bills::getAmountDrLoc, Bills::getAmountCrLoc, Bills::getAmountProfitLoc
|
|
|
@@ -898,7 +893,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
}
|
|
|
hmmEdiService.saveOrUpdate(bills.getHmmEdi());
|
|
|
}
|
|
|
-
|
|
|
if (ObjectUtils.isNotNull(bills.getFilesList())) {
|
|
|
for (FilesCenter item : bills.getFilesList()) {
|
|
|
item.setPid(bills.getId());
|
|
|
@@ -3860,4 +3854,79 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
return R.data("操作成功");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R<String> updateBatchField(UpdateBillsFieldVo updateBillsFieldVo) {
|
|
|
+ List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>().in(Bills::getId, updateBillsFieldVo.getIds()));
|
|
|
+ List<Integer> statusList = Arrays.asList(1, 2, 3);
|
|
|
+ // 筛选不可更改状态的数据
|
|
|
+ Bills notUpdateBills = billsList.stream().filter(e -> !statusList.contains(e.getStatus()) || e.getIsDeleted() == 1).findFirst().orElse(null);
|
|
|
+ if (notUpdateBills != null) {
|
|
|
+ return R.fail("单据编号为" + notUpdateBills.getBillNo() + "的记录不能修改");
|
|
|
+ }
|
|
|
+ for (Bills bills : billsList) {
|
|
|
+ Bills updateBills = new Bills();
|
|
|
+ BeanUtil.copyProperties(updateBillsFieldVo, updateBills);
|
|
|
+ updateBills.setId(bills.getId());
|
|
|
+ updateBills.setBillDate(bills.getBillDate());
|
|
|
+ updateBills.setAccountDate(bills.getAccountDate());
|
|
|
+ updateBills.setBookingDate(bills.getBookingDate());
|
|
|
+ updateBills.setBookingWithdrawTime(bills.getBookingWithdrawTime());
|
|
|
+ updateBills.setEtd(bills.getEtd());
|
|
|
+ updateBills.setEta(bills.getEta());
|
|
|
+ updateBills.setIssueDate(bills.getIssueDate());
|
|
|
+ updateBills.setQuantityCntrDescr(bills.getQuantityCntrDescr());
|
|
|
+ updateBills.setCyTrailerTime(bills.getCyTrailerTime());
|
|
|
+ updateBills.setCyReturnTime(bills.getCyReturnTime());
|
|
|
+ updateBills.setActualEtd(bills.getActualEtd());
|
|
|
+ updateBills.setActualEta(bills.getActualEta());
|
|
|
+ updateBills.setReturnEmptyDate(bills.getReturnEmptyDate());
|
|
|
+ updateBills.setClearanceDate(bills.getClearanceDate());
|
|
|
+ updateBills.setChangeOrderDate(bills.getChangeOrderDate());
|
|
|
+ updateBills.setApprovedDate(bills.getApprovedDate());
|
|
|
+ updateBills.setQuotationMethod(bills.getQuotationMethod());
|
|
|
+ updateBills.setAccountPeriodType(bills.getAccountPeriodType());
|
|
|
+ updateBills.setChargeableWeight(bills.getChargeableWeight());
|
|
|
+ updateBills.setCntrGoodType(bills.getCntrGoodType());
|
|
|
+ baseMapper.updateById(updateBills);
|
|
|
+ log.error("updateBills:{}" + JSONObject.toJSONString(updateBills));
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R updateBillType(String ids, String billType) {
|
|
|
+ if (ObjectUtils.isNull(ids)) {
|
|
|
+ throw new RuntimeException("缺少必要参数");
|
|
|
+ }
|
|
|
+ List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .in(Bills::getId, Func.toLongList(ids)));
|
|
|
+ if (billsList.isEmpty()) {
|
|
|
+ throw new SecurityException("未查到单据信息");
|
|
|
+ }
|
|
|
+ List<Long> idList = billsList.stream().map(Bills::getId).collect(Collectors.toList());
|
|
|
+ List<Bills> billsLists = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0)
|
|
|
+ .in(Bills::getMasterId, idList));
|
|
|
+ for (Bills item : billsList) {
|
|
|
+ if ("MH".equals(item.getBillType()) && "DD,MM".contains(billType)) {
|
|
|
+ if (ObjectUtils.isNotNull(item.getMasterBillNo())) {
|
|
|
+ throw new RuntimeException("提单号:" + item.getMblno() + "已填加到主单");
|
|
|
+ }
|
|
|
+ } else if ("MM".equals(item.getBillType()) && "DD,MH".contains(billType)) {
|
|
|
+ List<Bills> bills = billsLists.stream().filter(e -> e.getMasterId().equals(item.getId())).collect(Collectors.toList());
|
|
|
+ if (!bills.isEmpty()) {
|
|
|
+ throw new RuntimeException("提单号:" + item.getMblno() + "中存在分单");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item.setBillType(billType);
|
|
|
+ }
|
|
|
+ this.updateBatchById(billsList);
|
|
|
+ return R.data("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
}
|