|
@@ -24,6 +24,7 @@ import com.ruoyi.common.core.domain.entity.TWarehouse;
|
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
import com.ruoyi.common.exception.WarehouseException;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
+import com.ruoyi.common.utils.DictUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.ip.AddressUtils;
|
|
@@ -44,10 +45,11 @@ import com.ruoyi.system.mapper.*;
|
|
|
import com.ruoyi.system.service.ISysConfigService;
|
|
|
import com.ruoyi.system.service.impl.SysConfigServiceImpl;
|
|
|
import com.ruoyi.warehouseBusiness.domain.*;
|
|
|
-import com.ruoyi.warehouseBusiness.domain.dto.CalculateStorageFeesDto;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.dto.CalculateStorageFeesDTO;
|
|
|
import com.ruoyi.warehouseBusiness.domain.enums.FeesTypeEnum;
|
|
|
import com.ruoyi.warehouseBusiness.domain.enums.WarehouseActIdEnum;
|
|
|
import com.ruoyi.warehouseBusiness.domain.enums.WarehouseTypeEnum;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.vo.AppWarehouseInfoVO;
|
|
|
import com.ruoyi.warehouseBusiness.domain.vo.StorageFeeCalculationResultVO;
|
|
|
import com.ruoyi.warehouseBusiness.excel.*;
|
|
|
import com.ruoyi.warehouseBusiness.mapper.*;
|
|
@@ -3997,7 +3999,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
if (StringUtils.isNull(item.get("fBillingway"))) {
|
|
|
throw new WarehouseException("单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到库存总账的计费单位,请确认");
|
|
|
}
|
|
|
- CalculateStorageFeesDto storageFeesDto = new CalculateStorageFeesDto();
|
|
|
+ CalculateStorageFeesDTO storageFeesDto = new CalculateStorageFeesDTO();
|
|
|
storageFeesDto.setfCorpid(warehouseBills.getfCorpid());
|
|
|
storageFeesDto.setCangKey(cangKey);
|
|
|
storageFeesDto.setWarehouseId(Long.parseLong(String.valueOf(item.get("warehouse"))));
|
|
@@ -4022,12 +4024,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
// 要计费天数
|
|
|
long fBillingDays;
|
|
|
if (WarehouseTypeEnum.SJCK.getType().equals(fBilltype)) {
|
|
|
- fInventoryDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fOriginalbilldate"));
|
|
|
+ fInventoryDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fChargedate"));
|
|
|
fBillingDays = fInventoryDays;
|
|
|
storageFeesDto.setStartTime((Date) item.get("fOriginalbilldate"));
|
|
|
storageFeesDto.setEndTime(fBsdate);
|
|
|
} else if (WarehouseTypeEnum.HQZY.getType().equals(fBilltype)) {
|
|
|
- fInventoryDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fOriginalbilldate")) ;
|
|
|
+ fInventoryDays = DateUtils.getDateDay(fBsdate, (Date) item.get("fOriginalbilldate"));
|
|
|
fBillingDays = fInventoryDays;
|
|
|
storageFeesDto.setStartTime(fBsdate);
|
|
|
storageFeesDto.setEndTime((Date) item.get("fOriginalbilldate"));
|
|
@@ -4094,7 +4096,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
}
|
|
|
fees.setfTaxrate(new BigDecimal(taxRate.get(0).getDictValue()));
|
|
|
fees.setfOriginalbilldate((Date) item.get("fOriginalbilldate"));
|
|
|
- fees.setfBillingway(Long.parseLong(String.valueOf(item.get("fBillingway"))));
|
|
|
+
|
|
|
+ fees.setfBillingway(feeCalculationResultVO.getUnit());
|
|
|
+
|
|
|
tWarehousebillsfeesMapper.insertTWarehousebillsfees(fees);
|
|
|
itemsList.add(fees);
|
|
|
}
|
|
@@ -4291,8 +4295,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
BigDecimal netweightcBlc = whgenleg.getfNetweightblc().add(item.getfNetweight());
|
|
|
whgenleg.setfNetweightc(netweightcBlc);
|
|
|
return whgenleg;
|
|
|
- } else
|
|
|
- // 调拨
|
|
|
+ } else
|
|
|
+ // 调拨
|
|
|
if (WarehouseTypeEnum.CKDB.getType().equals(item.getfBilltype())) {
|
|
|
BigDecimal netweightcBlc;
|
|
|
BigDecimal grossweightblc;
|
|
@@ -4374,7 +4378,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
map.put("error", "单号:" + item.get("fBillno") + ",业务日期:" + item.get("fBsdate") + "未找到库存总账的计费单位,请确认");
|
|
|
return map;
|
|
|
}
|
|
|
- CalculateStorageFeesDto storageFeesDto = new CalculateStorageFeesDto();
|
|
|
+ CalculateStorageFeesDTO storageFeesDto = new CalculateStorageFeesDTO();
|
|
|
storageFeesDto.setfCorpid(warehouseBills.getfCorpid());
|
|
|
storageFeesDto.setCangKey(warehouse);
|
|
|
storageFeesDto.setWarehouseId(Long.parseLong(String.valueOf(item.get("warehouse"))));
|
|
@@ -6171,7 +6175,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
} else if (WarehouseTypeEnum.HWTG.getType().equals(billsType)) {
|
|
|
actId = 160L;
|
|
|
} else if ("CDZZ".equals(billsType)) {
|
|
|
- actId = 170L;
|
|
|
+ actId = 190L;
|
|
|
}
|
|
|
return actId;
|
|
|
}
|
|
@@ -6767,7 +6771,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据id撤销已费用审核状态
|
|
|
+ * 根据id撤销已费用审核状态
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
@@ -6784,4 +6789,226 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
return AjaxResult.success(tWarehousebillsfeesMapper.selectTWarehousebillsfeesById(id));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * app根据id查询详情
|
|
|
+ *
|
|
|
+ * @param id 主表id
|
|
|
+ * @param typeEnum 类型
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AjaxResult appQueryInit(Long id, String typeEnum) {
|
|
|
+ if (Objects.isNull(id)) {
|
|
|
+ return AjaxResult.error("无效id");
|
|
|
+ }
|
|
|
+ TWarehouseBills warehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(id);
|
|
|
+ if (Objects.isNull(warehouseBills)) {
|
|
|
+ return AjaxResult.error("仓库信息无效");
|
|
|
+ }
|
|
|
+ AppWarehouseInfoVO infoVO = new AppWarehouseInfoVO();
|
|
|
+
|
|
|
+ BeanUtils.copyProperties(warehouseBills, infoVO);
|
|
|
+ // 如果是入库
|
|
|
+ if (infoVO.getfBilltype().equals(WarehouseTypeEnum.SJRK.getType())) {
|
|
|
+ isInStock(infoVO);
|
|
|
+ }
|
|
|
+ // 如果是入库
|
|
|
+ if (infoVO.getfBilltype().equals(WarehouseTypeEnum.SJCK.getType())) {
|
|
|
+ isOutStock(infoVO);
|
|
|
+ }
|
|
|
+ // 如果是货权转移
|
|
|
+ if (warehouseBills.getfBilltype().equals(WarehouseTypeEnum.HQZY.getType())) {
|
|
|
+ isGoodsForwarding(infoVO);
|
|
|
+ }
|
|
|
+ // 如果是调拨
|
|
|
+ if (warehouseBills.getfBilltype().equals(WarehouseTypeEnum.CKDB.getType())) {
|
|
|
+ isTransfer(infoVO);
|
|
|
+ }
|
|
|
+ // 查询订单附件
|
|
|
+ List<TEnclosure> tEnclosureList = tEnclosureMapper.selectTEnclosureByPId(infoVO.getfId());
|
|
|
+ if (CollectionUtils.isNotEmpty(tEnclosureList)) {
|
|
|
+ infoVO.setEnclosureList(tEnclosureList);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(infoVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 如果是入库
|
|
|
+ *
|
|
|
+ * @param infoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private void isInStock(AppWarehouseInfoVO infoVO) {
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfCorpid())) {
|
|
|
+ TCorps corps = tCorpsMapper.selectTCorpsById(infoVO.getfCorpid());
|
|
|
+ // 赋值客户id
|
|
|
+ infoVO.setCorpName(corps.getfName());
|
|
|
+ }
|
|
|
+ // 计费单位
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfFeetunit())) {
|
|
|
+ String type = "data_unitfees";
|
|
|
+ String dictLabel = DictUtils.getDictLabel(type, infoVO.getfFeetunit().toString());
|
|
|
+ if (StringUtils.isNotEmpty(dictLabel)) {
|
|
|
+ infoVO.setFeetunitName(dictLabel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 商品信息
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfGoodsid())) {
|
|
|
+ // 添加商品信息
|
|
|
+ TGoods tGoods = tGoodsMapper.selectTGoodsById(infoVO.getfGoodsid());
|
|
|
+ if (Objects.nonNull(tGoods)) {
|
|
|
+ infoVO.setGoodsName(tGoods.getfName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 查询仓库信息
|
|
|
+ TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(infoVO.getfWarehouseid());
|
|
|
+ if (Objects.nonNull(tWarehouse)) {
|
|
|
+ infoVO.setWarehouseName(tWarehouse.getfName());
|
|
|
+ }
|
|
|
+ // 入库查询箱型箱量
|
|
|
+ TWarehousebillsCntr warehousebillsCntr = new TWarehousebillsCntr();
|
|
|
+ warehousebillsCntr.setfPid(infoVO.getfId());
|
|
|
+ List<TWarehousebillsCntr> cntrsList = tWarehousebillsCntrMapper.selectTWarehousebillsCntrList(warehousebillsCntr);
|
|
|
+ if (CollectionUtils.isNotEmpty(cntrsList)) {
|
|
|
+ List<Long> cntrIds = cntrsList.stream().map(TWarehousebillsCntr::getfCntrid).distinct().collect(toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(cntrIds)) {
|
|
|
+ List<TCntr> cntrList = tCntrMapper.selectByIds(cntrIds);
|
|
|
+
|
|
|
+ cntrsList.forEach(li -> {
|
|
|
+ TCntr cntr = cntrList.stream().filter(c -> Objects.equals(c.getfId(), li.getfCntrid())).findFirst()
|
|
|
+ .orElseThrow(() -> new WarehouseException("找不到集装箱信息"));
|
|
|
+ li.setCntrName(cntr.getfName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ infoVO.setCntrsList(cntrsList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 如果是出库
|
|
|
+ *
|
|
|
+ * @param infoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private void isOutStock(AppWarehouseInfoVO infoVO) {
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfCorpid())) {
|
|
|
+ TCorps corps = tCorpsMapper.selectTCorpsById(infoVO.getfCorpid());
|
|
|
+ // 赋值客户id
|
|
|
+ infoVO.setCorpName(corps.getfName());
|
|
|
+ }
|
|
|
+ // 结算方式
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfStltypeid())) {
|
|
|
+ // 定义结算方式
|
|
|
+ String fStltypeid = "data_stltype_type";
|
|
|
+ String dictLabel = DictUtils.getDictLabel(fStltypeid, infoVO.getfStltypeid().toString());
|
|
|
+ infoVO.setStltypeName(dictLabel);
|
|
|
+ }
|
|
|
+ // 查询仓库信息
|
|
|
+ TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(infoVO.getfWarehouseid());
|
|
|
+ if (Objects.nonNull(tWarehouse)) {
|
|
|
+ infoVO.setWarehouseName(tWarehouse.getfName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 如果是货转
|
|
|
+ *
|
|
|
+ * @param infoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private void isGoodsForwarding(AppWarehouseInfoVO infoVO) {
|
|
|
+ // 查询客户信息
|
|
|
+ List<Long> corpIds = new ArrayList<>();
|
|
|
+ // 如果是货转客户那么也要查询
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfTocorpid())) {
|
|
|
+ corpIds.add(infoVO.getfTocorpid());
|
|
|
+ }
|
|
|
+ corpIds.add(infoVO.getfCorpid());
|
|
|
+ List<TCorps> corpsList = tCorpsMapper.selectByIds(corpIds);
|
|
|
+ // 赋值客户id
|
|
|
+ TCorps corps = corpsList.stream().filter(li -> Objects.equals(li.getfId(), infoVO.getfCorpid())).findFirst()
|
|
|
+ .orElseThrow(() -> new WarehouseException("客户不存在"));
|
|
|
+ infoVO.setCorpName(corps.getfName());
|
|
|
+ // 赋值货转客户id
|
|
|
+ TCorps toCorp = corpsList.stream().filter(li -> Objects.equals(li.getfId(), infoVO.getfTocorpid())).findFirst()
|
|
|
+ .orElseThrow(() -> new WarehouseException("客户不存在"));
|
|
|
+ infoVO.setToCorpName(toCorp.getfName());
|
|
|
+ // 查询仓库信息
|
|
|
+ TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(infoVO.getfWarehouseid());
|
|
|
+ if (Objects.nonNull(tWarehouse)) {
|
|
|
+ infoVO.setWarehouseName(tWarehouse.getfName());
|
|
|
+ }
|
|
|
+ // 结算方式
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfStltypeid())) {
|
|
|
+ // 定义结算方式
|
|
|
+ String fStltypeid = "data_stltype_type";
|
|
|
+ String dictLabel = DictUtils.getDictLabel(fStltypeid, infoVO.getfStltypeid().toString());
|
|
|
+ infoVO.setStltypeName(dictLabel);
|
|
|
+ }
|
|
|
+ // 贸易方式
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfNewTrademodeid())) {
|
|
|
+ String type = "data_trademodes";
|
|
|
+ // 转换贸易方式
|
|
|
+ String dictLabel = DictUtils.getDictLabel(type, infoVO.getfNewTrademodeid().toString());
|
|
|
+ if (StringUtils.isNotEmpty(dictLabel)) {
|
|
|
+ infoVO.setNewTrademodeName(dictLabel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 计费单位
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfFeetunit())) {
|
|
|
+ String type = "data_unitfees";
|
|
|
+ String dictLabel = DictUtils.getDictLabel(type, infoVO.getfFeetunit().toString());
|
|
|
+ if (StringUtils.isNotEmpty(dictLabel)) {
|
|
|
+ infoVO.setFeetunitName(dictLabel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 商品信息
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfGoodsid())) {
|
|
|
+ // 添加商品信息
|
|
|
+ TGoods tGoods = tGoodsMapper.selectTGoodsById(infoVO.getfGoodsid());
|
|
|
+ if (Objects.nonNull(tGoods)) {
|
|
|
+ infoVO.setGoodsName(tGoods.getfName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 如果是调拨
|
|
|
+ *
|
|
|
+ * @param infoVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private void isTransfer(AppWarehouseInfoVO infoVO) {
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfCorpid())) {
|
|
|
+ TCorps corps = tCorpsMapper.selectTCorpsById(infoVO.getfCorpid());
|
|
|
+ // 赋值客户id
|
|
|
+ infoVO.setCorpName(corps.getfName());
|
|
|
+ }
|
|
|
+ // 作业类型
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfBusinessType())) {
|
|
|
+ String type = "st_trans_type";
|
|
|
+ String dictLabel = DictUtils.getDictLabel(type, infoVO.getfBusinessType().toString());
|
|
|
+ if (StringUtils.isNotEmpty(dictLabel)) {
|
|
|
+ infoVO.setBusinessTypeName(dictLabel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 仓库id集合
|
|
|
+ List<Long> warehouseIds = new ArrayList<>();
|
|
|
+ if (StringUtils.isNotNull(infoVO.getfInwarehouseid())) {
|
|
|
+ warehouseIds.add(infoVO.getfInwarehouseid());
|
|
|
+ }
|
|
|
+ warehouseIds.add(infoVO.getfWarehouseid());
|
|
|
+ // 查询仓库信息
|
|
|
+ List<TWarehouse> tWarehouseList = tWarehouseMapper.selectByIds(warehouseIds);
|
|
|
+
|
|
|
+ TWarehouse tWarehouse = tWarehouseList.stream().filter(li -> Objects.equals(li.getfId(), infoVO.getfWarehouseid())).findFirst()
|
|
|
+ .orElseThrow(() -> new WarehouseException("仓库不存在"));
|
|
|
+ infoVO.setWarehouseName(tWarehouse.getfName());
|
|
|
+ // 调入仓库
|
|
|
+ TWarehouse inWarehouse = tWarehouseList.stream().filter(li -> Objects.equals(li.getfId(), infoVO.getfInwarehouseid())).findFirst()
|
|
|
+ .orElseThrow(() -> new WarehouseException("仓库不存在"));
|
|
|
+ infoVO.setInWarehouseName(inWarehouse.getfName());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|