|
|
@@ -9,10 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.ruoyi.approvalFlow.domain.AuditItems;
|
|
|
import com.ruoyi.approvalFlow.mapper.AuditItemsMapper;
|
|
|
import com.ruoyi.approvalFlow.service.impl.AuditItemsServiceImpl;
|
|
|
-import com.ruoyi.basicData.domain.TCorps;
|
|
|
-import com.ruoyi.basicData.domain.TFees;
|
|
|
-import com.ruoyi.basicData.domain.TGoods;
|
|
|
-import com.ruoyi.basicData.domain.TWarehouseArea;
|
|
|
+import com.ruoyi.basicData.domain.*;
|
|
|
import com.ruoyi.basicData.mapper.*;
|
|
|
import com.ruoyi.basicData.service.impl.TWarehouseServiceImpl;
|
|
|
import com.ruoyi.common.config.RuoYiConfig;
|
|
|
@@ -41,12 +38,16 @@ import com.ruoyi.shipping.excel.TWarehousebillsCntritemsExcel;
|
|
|
import com.ruoyi.shipping.mapper.*;
|
|
|
import com.ruoyi.system.domain.SysCheckCode;
|
|
|
import com.ruoyi.system.domain.SysConfig;
|
|
|
-import com.ruoyi.system.mapper.*;
|
|
|
+import com.ruoyi.system.mapper.SysConfigMapper;
|
|
|
+import com.ruoyi.system.mapper.SysDeptMapper;
|
|
|
+import com.ruoyi.system.mapper.SysDictDataMapper;
|
|
|
+import com.ruoyi.system.mapper.SysUserMapper;
|
|
|
import com.ruoyi.system.service.ISysConfigService;
|
|
|
import com.ruoyi.system.service.impl.SysConfigServiceImpl;
|
|
|
-import com.ruoyi.warehouseBusiness.component.impl.QueryWhgenlegServiceImpl;
|
|
|
+import com.ruoyi.warehouseBusiness.component.WarehouseBillsfilterService;
|
|
|
import com.ruoyi.warehouseBusiness.domain.*;
|
|
|
import com.ruoyi.warehouseBusiness.domain.dto.CalculateStorageFeesDTO;
|
|
|
+import com.ruoyi.warehouseBusiness.domain.dto.WarehousebillsDTO;
|
|
|
import com.ruoyi.warehouseBusiness.domain.enums.FeesTypeEnum;
|
|
|
import com.ruoyi.warehouseBusiness.domain.enums.WarehouseActIdEnum;
|
|
|
import com.ruoyi.warehouseBusiness.domain.enums.WarehouseTypeEnum;
|
|
|
@@ -115,9 +116,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
private SysDeptMapper sysDeptMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- private SysRoleMapper sysRoleMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private BillnoDelMapper billnoDelMapper;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -178,7 +176,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
private TWarehouseAgreementServiceImpl tWarehouseAgreementService;
|
|
|
|
|
|
@Autowired
|
|
|
- private TWarehouseAgreementitemsMapper tWarehouseAgreementitemsMapper;
|
|
|
+ private WarehouseBillsfilterService warehouseBillsfilterService;
|
|
|
|
|
|
@Autowired
|
|
|
private TWarehousebillsCntritemsMapper tWarehousebillsCntritemsMapper;
|
|
|
@@ -792,7 +790,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
wbDr.setfChargedate(warehouseBills.getfChargedate());
|
|
|
wbDr.setfBillingDeadline(warehouseBills.getfChargedate());
|
|
|
wbDr.setCreateBy(loginUser.getUser().getUserName());
|
|
|
- if (warehouseBills.getfBsdate() != null && !warehouseBills.getfBsdate().equals("")) {
|
|
|
+ if (warehouseBills.getfBsdate() != null && !"".equals(warehouseBills.getfBsdate())) {
|
|
|
wbDr.setfBsdate(warehouseBills.getfBsdate());
|
|
|
}
|
|
|
tWarehousebillsfeesMapper.insertTWarehousebillsfees(wbDr);
|
|
|
@@ -887,7 +885,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
warehousebillsCntr.setfPid(warehouseBills.getfId());
|
|
|
warehousebillsCntr.setCreateTime(DateUtils.getNowDate());
|
|
|
warehousebillsCntr.setCreateBy(SecurityUtils.getUsername());
|
|
|
- int cntr = tWarehousebillsCntrMapper.insertTWarehousebillsCntr(warehousebillsCntr);
|
|
|
+ tWarehousebillsCntrMapper.insertTWarehousebillsCntr(warehousebillsCntr);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2080,7 +2078,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
if (tCntrno == null) {
|
|
|
tCnTrNoList.add(cell.getStringCellValue());
|
|
|
} else {
|
|
|
- if (tCntrno.getfTypeid() != null && tCntrno.getfTypeid() != tWarehousebillsCntr.getfCntrid()) {
|
|
|
+ if (tCntrno.getfTypeid() != null && !Objects.equals(tCntrno.getfTypeid(), tWarehousebillsCntr.getfCntrid())) {
|
|
|
List.add(cell.getStringCellValue());
|
|
|
}
|
|
|
}
|
|
|
@@ -3347,10 +3345,10 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
}
|
|
|
if (!businessStatus) {
|
|
|
// 查询库容量 是否可入库
|
|
|
- if (calculation(tWarehouseBills.getfWarehouseid(), item.getfGrossweight()) == 0) {
|
|
|
- TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
- return AjaxResult.error("更新库存总账失败-->入库毛重大于库容");
|
|
|
+ if (calculation(tWarehouseBills.getfWarehouseid(), item.getfGrossweight()) <= 0) {
|
|
|
+ throw new WarehouseException("更新库存总账失败-->入库毛重大于库容");
|
|
|
}
|
|
|
+
|
|
|
item.setfOriginalbilldate(item.getfBsdate());
|
|
|
item.setfBillingway(tWarehouseBills.getfBillingway());
|
|
|
if ("1".equals(tWarehouseBills.getfChargetype())) {
|
|
|
@@ -6592,12 +6590,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
//TCntr tCntr = tCntrMapper.selectTCntrById(fId);//查询货物信息对应的箱类型
|
|
|
TCntrno cnTrNo = tCntrnoMapper.selectTCnTrNoByfNo(tWarehousebillsCntritems.getfCntrno());//查询箱号对应的箱信息
|
|
|
TCntr tCntr = tCntrMapper.selectTCntrById(cnTrNo.getfTypeid());//查询箱类型
|
|
|
- if (cnTrNo != null && cnTrNo.getfTypeid() == tWarehousebillsCntritems.getfCntrid()) {
|
|
|
- if (tWarehousebillsCntritems.getfCntrid() != fId) {
|
|
|
+ if (cnTrNo != null && Objects.equals(cnTrNo.getfTypeid(), tWarehousebillsCntritems.getfCntrid())) {
|
|
|
+ if (!Objects.equals(tWarehousebillsCntritems.getfCntrid(), fId)) {
|
|
|
TCntr cntr = tCntrMapper.selectTCntrById(fId);
|
|
|
return AjaxResult.error("箱号" + tWarehousebillsCntritems.getfCntrno() + "跟货物信息中箱类型不一致,箱类型应为:" + cntr.getfNo());
|
|
|
}
|
|
|
- } else if (cnTrNo != null && cnTrNo.getfTypeid() != tWarehousebillsCntritems.getfCntrid()) {
|
|
|
+ } else if (cnTrNo != null && !Objects.equals(cnTrNo.getfTypeid(), tWarehousebillsCntritems.getfCntrid())) {
|
|
|
return AjaxResult.error("箱号" + tWarehousebillsCntritems.getfCntrno() + "跟基础信息中箱类型不一致,箱类型应为:" + tCntr.getfNo());
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
@@ -7146,36 +7144,285 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
/**
|
|
|
* 货转根据提单号查询可用客户、仓库信息
|
|
|
*
|
|
|
- * @param fMblno 提单号
|
|
|
+ * @param warehousebillsDTO 查询条件
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public AjaxResult corpOrWarehouseByMblno(String fMblno) {
|
|
|
+ public AjaxResult corpOrWarehouseByMblno(WarehousebillsDTO warehousebillsDTO) {
|
|
|
+ String fMblno = warehousebillsDTO.getfMblno();
|
|
|
WarehouseBillsVO billsVO = new WarehouseBillsVO();
|
|
|
- // 查询符合条件的库存总帐
|
|
|
- TWhgenleg tWhgenleg = new TWhgenleg();
|
|
|
- tWhgenleg.setfMblno(fMblno);
|
|
|
- List<TWhgenleg> tWhgenlegs = tWhgenlegMapper.selectTWhgenlegList(tWhgenleg);
|
|
|
- if (CollectionUtils.isNotEmpty(tWhgenlegs)) {
|
|
|
- // 查询仓库信息
|
|
|
- List<Long> warehouseIds = tWhgenlegs.stream().filter(leg -> Objects.nonNull(leg.getfWarehouseid())).map(TWhgenleg::getfWarehouseid)
|
|
|
- .distinct().collect(toList());
|
|
|
- if (CollectionUtils.isNotEmpty(warehouseIds)) {
|
|
|
- List<TWarehouse> warehouseList = tWarehouseMapper.selectByIds(warehouseIds);
|
|
|
- billsVO.setWarehouseList(warehouseList);
|
|
|
- }
|
|
|
- // 查询客户
|
|
|
- List<Long> corpIds = tWhgenlegs.stream().filter(leg -> Objects.nonNull(leg.getfCorpid())).map(TWhgenleg::getfCorpid)
|
|
|
- .distinct().collect(toList());
|
|
|
- if (CollectionUtils.isNotEmpty(corpIds)) {
|
|
|
- List<TCorps> corpsList = tCorpsMapper.selectByIds(corpIds);
|
|
|
- billsVO.setCorpsList(corpsList);
|
|
|
+ // 查询客户
|
|
|
+ if (WarehouseTypeEnum.BY_MBLNO.getType().equals(warehousebillsDTO.getType())) {
|
|
|
+ // 查询符合条件的库存总帐
|
|
|
+ TWhgenleg tWhgenleg = new TWhgenleg();
|
|
|
+ tWhgenleg.setfMblno(fMblno);
|
|
|
+ List<TWhgenleg> tWhgenlegs = tWhgenlegMapper.selectTWhgenlegList(tWhgenleg);
|
|
|
+ if (CollectionUtils.isNotEmpty(tWhgenlegs)) {
|
|
|
+ // 查询客户
|
|
|
+ List<Long> corpIds = tWhgenlegs.stream().filter(leg -> Objects.nonNull(leg.getfCorpid())).map(TWhgenleg::getfCorpid)
|
|
|
+ .distinct().collect(toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(corpIds)) {
|
|
|
+ List<TCorps> corpsList = tCorpsMapper.selectByIds(corpIds);
|
|
|
+ billsVO.setCorpsList(corpsList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success(billsVO);
|
|
|
+ } else if (WarehouseTypeEnum.BY_CPRP.getType().equals(warehousebillsDTO.getType())) {
|
|
|
+ if (StringUtils.isNull(warehousebillsDTO.getCorpId())) {
|
|
|
+ throw new WarehouseException("未找到客户查询条件");
|
|
|
+ }
|
|
|
+ // 查询符合条件的库存总帐
|
|
|
+ TWhgenleg tWhgenleg = new TWhgenleg();
|
|
|
+ tWhgenleg.setfMblno(fMblno);
|
|
|
+ tWhgenleg.setfCorpid(warehousebillsDTO.getCorpId());
|
|
|
+ List<TWhgenleg> tWhgenlegs = tWhgenlegMapper.selectTWhgenlegList(tWhgenleg);
|
|
|
+ if (CollectionUtils.isNotEmpty(tWhgenlegs)) {
|
|
|
+ // 查询仓库信息
|
|
|
+ List<Long> warehouseIds = tWhgenlegs.stream().filter(leg -> Objects.nonNull(leg.getfWarehouseid()))
|
|
|
+ .map(TWhgenleg::getfWarehouseid).distinct().collect(toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(warehouseIds)) {
|
|
|
+ List<TWarehouse> warehouseList = tWarehouseMapper.selectByIds(warehouseIds);
|
|
|
+ billsVO.setWarehouseList(warehouseList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success(billsVO);
|
|
|
+ } else if (WarehouseTypeEnum.BY_WAREHOUSE.getType().equals(warehousebillsDTO.getType())) {
|
|
|
+ if (StringUtils.isNull(warehousebillsDTO.getCorpId()) ||
|
|
|
+ StringUtils.isNull(warehousebillsDTO.getWarehouseId())) {
|
|
|
+ throw new WarehouseException("未找到客户、仓库查询条件");
|
|
|
+ }
|
|
|
+ // 查询符合条件的库存总帐
|
|
|
+ TWhgenleg tWhgenleg = new TWhgenleg();
|
|
|
+ tWhgenleg.setfMblno(fMblno);
|
|
|
+ tWhgenleg.setfCorpid(warehousebillsDTO.getCorpId());
|
|
|
+ tWhgenleg.setfWarehouseid(warehousebillsDTO.getWarehouseId());
|
|
|
+ List<TWhgenleg> tWhgenlegs = tWhgenlegMapper.selectTWhgenlegList(tWhgenleg);
|
|
|
+ if (CollectionUtils.isNotEmpty(tWhgenlegs)) {
|
|
|
+
|
|
|
+ List<Long> goodsIds = tWhgenlegs.stream().filter(l -> Objects.nonNull(l.getfGoodsid())).map(TWhgenleg::getfGoodsid).distinct()
|
|
|
+ .collect(toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsIds)) {
|
|
|
+ List<TGoods> goodsList = tGoodsMapper.selectByIds(goodsIds);
|
|
|
+ List<GoodsVO> voList = new ArrayList<>();
|
|
|
+
|
|
|
+ goodsList.forEach(vo -> {
|
|
|
+// TGoods goods = goodsList.stream().filter(li -> Objects.equals(vo.getfGoodsid(), li.getfId())).findFirst()
|
|
|
+// .orElseThrow(() -> new WarehouseException("商品信息找不到"));
|
|
|
+ GoodsVO goodsVO = new GoodsVO();
|
|
|
+ goodsVO.setfId(vo.getfId());
|
|
|
+ goodsVO.setfName(vo.getfName());
|
|
|
+// goodsVO.setFMarks(vo.getfMarks());
|
|
|
+// goodsVO.setFBusinessType(vo.getfBusinessType());
|
|
|
+ voList.add(goodsVO);
|
|
|
+ });
|
|
|
+ billsVO.setGoodsVOList(voList);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(billsVO);
|
|
|
}
|
|
|
}
|
|
|
return AjaxResult.success(billsVO);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 快速入库、出库
|
|
|
+ *
|
|
|
+ * @param warehousebillsDTO 出库信息
|
|
|
+ * @param loginUser 登陆人
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public AjaxResult quickOperation(WarehousebillsDTO warehousebillsDTO, LoginUser loginUser) {
|
|
|
+ if (CollectionUtils.isEmpty(warehousebillsDTO.getWarehousebillsitemsList())) {
|
|
|
+ throw new WarehouseException("未找到仓储的明细数据");
|
|
|
+ }
|
|
|
+ // 校验必填项
|
|
|
+ warehouseBillsfilterService.filter(warehousebillsDTO);
|
|
|
+ // 生成编号
|
|
|
+ String billNo = billnoSerialServiceImpl.getBillNo(warehousebillsDTO.getfBilltype(), warehousebillsDTO.getfBsdate());
|
|
|
+ warehousebillsDTO.setfBillno(billNo);
|
|
|
+ // 如果是入库则需要赋值客户存货编号
|
|
|
+ if (WarehouseTypeEnum.SJRK.getType().equals(warehousebillsDTO.getType())) {
|
|
|
+ Date time = new Date();
|
|
|
+ String bscorpno = billnoSerialServiceImpl.getCorpNo(warehousebillsDTO.getfCorpid(), time);
|
|
|
+ warehousebillsDTO.setfBscorpno(bscorpno);
|
|
|
+ }
|
|
|
+ warehousebillsDTO.setfDateChanged(DateUtils.getTimestamp(new Date()).toString() + (int) (Math.random() * 900) + 100);
|
|
|
+ warehousebillsDTO.setCreateTime(new Date());
|
|
|
+ warehousebillsDTO.setCreateBy(loginUser.getUsername());
|
|
|
+ warehousebillsDTO.setfBsdeptid(loginUser.getUser().getDeptId());
|
|
|
+ warehousebillsDTO.setfChargedate(warehousebillsDTO.getfBsdate());
|
|
|
+ warehousebillsDTO.setfBillstatus(Long.parseLong(WarehouseTypeEnum.SAVE.getType()));
|
|
|
+ warehousebillsDTO.setfItemstatus(Long.parseLong(WarehouseTypeEnum.DETAILED_STATUS_PROCESSED.getType()));
|
|
|
+ tWarehouseBillsMapper.insertTWarehousebills(warehousebillsDTO);
|
|
|
+ // 遍历进行入库、出库确认
|
|
|
+ List<TWarehousebillsitems> itemList = warehousebillsDTO.getWarehousebillsitemsList();
|
|
|
+ int line = 1;
|
|
|
+ Long qty = 0L;
|
|
|
+ BigDecimal volumn = BigDecimal.ZERO;
|
|
|
+ BigDecimal netweight = BigDecimal.ZERO;
|
|
|
+ BigDecimal grossweight = BigDecimal.ZERO;
|
|
|
+ for (TWarehousebillsitems li : itemList) {
|
|
|
+ qty += li.getfQty();
|
|
|
+ volumn = volumn.add(li.getfVolumn());
|
|
|
+ netweight = netweight.add(li.getfNetweight());
|
|
|
+ grossweight = grossweight.add(li.getfGrossweight());
|
|
|
+ grossweight = grossweight.add(li.getfGrossweight());
|
|
|
+ // 如果业务时间超出当前时间则不允许
|
|
|
+ if (li.getfBsdate().after(new Date())) {
|
|
|
+ throw new WarehouseException("业务日期不得超出当前日期");
|
|
|
+ }
|
|
|
+ li.setfPid(warehousebillsDTO.getfId());
|
|
|
+ li.setfBillstatus(40L);
|
|
|
+ li.setfBillno(warehousebillsDTO.getfBillno());
|
|
|
+ li.setfBilltype(warehousebillsDTO.getfBilltype());
|
|
|
+ li.setCreateTime(new Date());
|
|
|
+ li.setCreateBy(loginUser.getUsername());
|
|
|
+ if (warehousebillsDTO.getfBilltype().equals(WarehouseTypeEnum.SJRK.getType())) {
|
|
|
+ quickStorage(warehousebillsDTO, li, loginUser, line);
|
|
|
+ } else if (warehousebillsDTO.getfBilltype().equals(WarehouseTypeEnum.SJCK.getType())) {
|
|
|
+ quickDelivery(warehousebillsDTO, li, loginUser, line);
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ warehousebillsDTO.setfPlanqty(qty);
|
|
|
+ warehousebillsDTO.setfPlanvolumn(volumn);
|
|
|
+ warehousebillsDTO.setfPlannetweight(netweight);
|
|
|
+ warehousebillsDTO.setfPlangrossweight(grossweight);
|
|
|
+ warehousebillsDTO.setfQty(qty);
|
|
|
+ warehousebillsDTO.setfVolumn(volumn);
|
|
|
+ warehousebillsDTO.setfNetweight(netweight);
|
|
|
+ warehousebillsDTO.setfGrossweight(grossweight);
|
|
|
+ tWarehouseBillsMapper.updateTWarehousebills(warehousebillsDTO);
|
|
|
+
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 快速入库
|
|
|
+ *
|
|
|
+ * @param warehousebillsDTO 主表信息
|
|
|
+ * @param item 明细信息
|
|
|
+ * @param loginUser 用户信息
|
|
|
+ * @param line 序号
|
|
|
+ */
|
|
|
+ private void quickStorage(WarehousebillsDTO warehousebillsDTO, TWarehousebillsitems item, LoginUser loginUser, int line) {
|
|
|
+ // 查询库容量 是否可入库
|
|
|
+ if (calculation(warehousebillsDTO.getfWarehouseid(), item.getfGrossweight()) <= 0) {
|
|
|
+ throw new WarehouseException("仓储明细第" + line + "行入库毛重大于库容");
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(warehousebillsDTO.getfCustomno())) {
|
|
|
+ item.setfCustomno(warehousebillsDTO.getfCustomno());
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(warehousebillsDTO.getRemark())) {
|
|
|
+ item.setRemark(warehousebillsDTO.getRemark());
|
|
|
+ }
|
|
|
+ item.setfOriginalbilldate(item.getfBsdate());
|
|
|
+ item.setfBillingway(warehousebillsDTO.getfBillingway());
|
|
|
+ if ("1".equals(warehousebillsDTO.getfChargetype())) {
|
|
|
+ item.setfChargedate(item.getfBsdate());
|
|
|
+ } else {
|
|
|
+ item.setfChargedate(new Date());
|
|
|
+ }
|
|
|
+ // 校验商品是否区分箱号
|
|
|
+ TGoods goods = tGoodsMapper.selectTGoodsById(item.getfGoodsid());
|
|
|
+ if ("1".equals(goods.getIfCntrno()) && StringUtils.isNull(item.getfCntrno())) {
|
|
|
+ throw new WarehouseException("仓库明细第" + line + "行未找到箱号");
|
|
|
+ }
|
|
|
+ TWhgenleg tWhgenle = queryTWhgenleg(warehousebillsDTO, item, goods.getIfCntrno());
|
|
|
+ if (Objects.nonNull(tWhgenle)) {
|
|
|
+ updateTWhgenlegData(item, tWhgenle.getfId(), warehousebillsDTO.getfBilltype());
|
|
|
+ } else {
|
|
|
+ instalTWhgenleg(warehousebillsDTO, item, loginUser.getUser());
|
|
|
+ }
|
|
|
+ item.setfIsInventory(Long.parseLong(WarehouseTypeEnum.INVENTORY.getType()));
|
|
|
+ tWarehousebillsitemsMapper.insertTWarehousebillsitems(item);
|
|
|
+ // 添加状态log
|
|
|
+ insertTWarehousebillsLog(item, 40L, loginUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 快速出库
|
|
|
+ *
|
|
|
+ * @param warehousebillsDTO 主表信息
|
|
|
+ * @param item 明细信息
|
|
|
+ * @param loginUser 用户信息
|
|
|
+ * @param line 序号
|
|
|
+ */
|
|
|
+ private void quickDelivery(WarehousebillsDTO warehousebillsDTO, TWarehousebillsitems item, LoginUser loginUser, int line) {
|
|
|
+ // 校验商品是否区分箱号
|
|
|
+ TGoods goods = tGoodsMapper.selectTGoodsById(item.getfGoodsid());
|
|
|
+ if ("1".equals(goods.getIfCntrno()) && StringUtils.isNull(item.getfCntrno())) {
|
|
|
+ throw new WarehouseException("仓库明细未找到箱号");
|
|
|
+ }
|
|
|
+ // 查询总账是否存在
|
|
|
+ TWhgenleg tWhgenle = queryTWhgenleg(warehousebillsDTO, item, goods.getIfCntrno());
|
|
|
+ if (Objects.nonNull(tWhgenle) && item.getfBsdate().before(item.getfChargedate())) {
|
|
|
+ throw new WarehouseException("出库明细第" + line + "行业务日期不得超出库存总帐日期");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(tWhgenle)) {
|
|
|
+ throw new WarehouseException("出库库存总帐第" + line + "行不存在");
|
|
|
+ }
|
|
|
+ //校验计费日期是等于库存总帐计费日,如果不相等则报错
|
|
|
+ checkWhgenleg(item, tWhgenle);
|
|
|
+ // 库存 < 出库件数
|
|
|
+ if (tWhgenle.getfQtyblc() < item.getfQty()) {
|
|
|
+ throw new WarehouseException("库存明细第" + line + "行库存不足");
|
|
|
+ }
|
|
|
+ // 更新库存总账
|
|
|
+ updateTWhgenlegData(item, tWhgenle.getfId(), warehousebillsDTO.getfBilltype());
|
|
|
+ DateUtils.getDateDay(warehousebillsDTO.getfBsdate(), item.getfChargedate());
|
|
|
+ tWarehousebillsitemsMapper.insertTWarehousebillsitems(item);
|
|
|
+ // 添加状态log
|
|
|
+ insertTWarehousebillsLog(item, 40L, loginUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 校验提单号是否在同一天出现第二次
|
|
|
+ *
|
|
|
+ * @param warehousebillsDTO 查询条件
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void checkMblNoRepeat(WarehousebillsDTO warehousebillsDTO) {
|
|
|
+ if (CollectionUtils.isNotEmpty(warehousebillsDTO.getWarehousebillsitemsList())) {
|
|
|
+ List<TWarehousebillsitems> items = warehousebillsDTO.getWarehousebillsitemsList();
|
|
|
+ int line = 1;
|
|
|
+ for (TWarehousebillsitems li : items) {
|
|
|
+ if (StringUtils.isNotEmpty(li.getfCntrno())) {
|
|
|
+ warehousebillsDTO.setfCntrno(li.getfCntrno());
|
|
|
+ }
|
|
|
+ int num = tWarehouseBillsMapper.selectByMblnoOrCntrnoCount(warehousebillsDTO);
|
|
|
+ if (num > 0 && StringUtils.isNotEmpty(li.getfCntrno())) {
|
|
|
+ throw new WarehouseException("该提单号与第" + line + "行明细箱号存在重复录入");
|
|
|
+ }
|
|
|
+ if (num > 0 && StringUtils.isEmpty(li.getfCntrno())) {
|
|
|
+ throw new WarehouseException("该提单号存在重复录入");
|
|
|
+ }
|
|
|
+ line++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * app查询库存总帐明细
|
|
|
+ *
|
|
|
+ * @param id 查询条件
|
|
|
+ * @return 库存总帐明细
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AjaxResult selectWhgenlegDetail(Long id) {
|
|
|
+ // 查询明细
|
|
|
+ List<WarehouseBillsVO> warehouseBillsVOList = tWarehouseBillsMapper.selectWhgenlegDetailById(id);
|
|
|
+
|
|
|
+ warehouseBillsVOList.forEach(vo -> {
|
|
|
+ WarehouseTypeEnum warehouseTypeEnum = WarehouseTypeEnum.fromType(vo.getfBilltype());
|
|
|
+ vo.setBillTypeName(warehouseTypeEnum.getName());
|
|
|
+ });
|
|
|
+
|
|
|
+ return AjaxResult.success(warehouseBillsVOList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 如果是入库
|
|
|
*
|
|
|
* @param infoVO
|
|
|
@@ -7190,7 +7437,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
// 计费单位
|
|
|
if (StringUtils.isNotNull(infoVO.getfFeetunit())) {
|
|
|
String type = "data_unitfees";
|
|
|
- String dictLabel = DictUtils.getDictLabel(type, infoVO.getfFeetunit().toString());
|
|
|
+ String dictLabel = DictUtils.getDictLabel(type, infoVO.getfFeetunit());
|
|
|
if (StringUtils.isNotEmpty(dictLabel)) {
|
|
|
infoVO.setFeetunitName(dictLabel);
|
|
|
}
|