|
|
@@ -19,8 +19,11 @@ package org.springblade.salesPart.ship.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.client.entity.CorpsDesc;
|
|
|
import org.springblade.client.feign.ISerialClient;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
@@ -30,6 +33,7 @@ import org.springblade.core.tool.utils.ObjectUtil;
|
|
|
import org.springblade.mocha.entity.BusinessOverpaymentItem;
|
|
|
import org.springblade.salesPart.entity.*;
|
|
|
import org.springblade.salesPart.enums.OrderTypeEnum;
|
|
|
+import org.springblade.salesPart.excel.ShipItemImportExcel;
|
|
|
import org.springblade.salesPart.goods.mapper.GoodsDescMapper;
|
|
|
import org.springblade.salesPart.history.mapper.HistoryMapper;
|
|
|
import org.springblade.salesPart.order.mapper.OrderItemsMapper;
|
|
|
@@ -50,6 +54,7 @@ import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.MathContext;
|
|
|
@@ -149,6 +154,12 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setStockClerkName(userClient.userInfoById(ship.getStockClerkId()).getData().getRealName());
|
|
|
ship.setStorageName(storageDescMapper.selectById(ship.getStorageId()).getCname());
|
|
|
|
|
|
+ if (ship.getBizTypeName().equals(OrderTypeEnum.SHGD.getType())){
|
|
|
+ ship.setStatusName(OrderTypeEnum.TREATWAREHOUSING.getType());
|
|
|
+ }else {
|
|
|
+ ship.setStatusName(OrderTypeEnum.TOBESHIPPEDOUT.getType());
|
|
|
+ }
|
|
|
+
|
|
|
if (ship.getId() == null){
|
|
|
// 获取系统编号
|
|
|
R billNo = serialClient.getBillNo(ship.getBizTypeName(), ship.getBizTypeName(), ship.getBizTypeName());
|
|
|
@@ -161,18 +172,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
ship.setCreateUser(AuthUtil.getUserId());
|
|
|
ship.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
ship.setTenantId(AuthUtil.getTenantId());
|
|
|
- if (ship.getBizTypeName().equals(OrderTypeEnum.SHGD.getType())){
|
|
|
- ship.setStatusName(OrderTypeEnum.TREATWAREHOUSING.getType());
|
|
|
- }else {
|
|
|
- ship.setStatusName(OrderTypeEnum.TOBESHIPPEDOUT.getType());
|
|
|
- }
|
|
|
baseMapper.insert(ship);
|
|
|
}else {
|
|
|
- if (ship.getBizTypeName().equals(OrderTypeEnum.SHGD.getType())){
|
|
|
- ship.setStatusName(OrderTypeEnum.TREATWAREHOUSING.getType());
|
|
|
- }else {
|
|
|
- ship.setStatusName(OrderTypeEnum.TOBESHIPPEDOUT.getType());
|
|
|
- }
|
|
|
ship.setUpdateUser(AuthUtil.getUserId());
|
|
|
ship.setUpdateTime(new Date());
|
|
|
baseMapper.updateById(ship);
|
|
|
@@ -602,6 +603,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
LambdaQueryWrapper<PjStockDesc> lambdaQueryWrapperList = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapperList.eq(PjStockDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PjStockDesc::getIsDeleted, 0)
|
|
|
+ .eq(PjStockDesc::getSalesCompanyId, ship.getSalesCompanyId())
|
|
|
.eq(PjStockDesc::getGoodsId, goodsDesc.getId());
|
|
|
List<PjStockDesc> stockDescList = stockDescMapper.selectList(lambdaQueryWrapperList);
|
|
|
|
|
|
@@ -612,6 +614,7 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
LambdaQueryWrapper<PjProductLaunch> productLaunchQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
productLaunchQueryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PjProductLaunch::getIsDeleted, 0)
|
|
|
+ .eq(PjProductLaunch::getSalesCompanyId, ship.getSalesCompanyId())
|
|
|
.eq(PjProductLaunch::getGoodsId, stockDesc.getGoodsId());
|
|
|
List<PjProductLaunch> productLaunch = productLaunchMapper.selectList(productLaunchQueryWrapper);
|
|
|
|
|
|
@@ -648,6 +651,73 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 入库明细导入
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
+ public R<List<PjShipItems>> importItem(List<ShipItemImportExcel> excelList) {
|
|
|
+ if(CollectionUtils.isEmpty(excelList)){
|
|
|
+ throw new SecurityException("导入数据不能为空");
|
|
|
+ }
|
|
|
+ List<PjShipItems> list = new ArrayList<>();
|
|
|
+ for(int i = 0; i < excelList.size(); i++)
|
|
|
+ {
|
|
|
+ //判断必填项是否为空
|
|
|
+ ShipItemImportExcel itemExcel = excelList.get(i);
|
|
|
+ if (ObjectUtil.isEmpty(itemExcel.getGoodsName())){
|
|
|
+ throw new SecurityException("第"+(i+2)+"行,商品名称为空");
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isEmpty(itemExcel.getPrice())){
|
|
|
+ throw new SecurityException("第"+(i+2)+"行,价格为空");
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isEmpty(itemExcel.getGoodsNum())){
|
|
|
+ throw new SecurityException("第"+(i+2)+"行,数量为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ PjShipItems item = new PjShipItems();
|
|
|
+ BeanUtil.copy(itemExcel,item);
|
|
|
+
|
|
|
+ //查询商品信息
|
|
|
+ LambdaQueryWrapper<PjGoodsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PjGoodsDesc::getIsDeleted, 0)
|
|
|
+ .eq(PjGoodsDesc::getSalesCompanyId, AuthUtil.getDeptId())
|
|
|
+ .eq(PjGoodsDesc::getCname, itemExcel.getGoodsName());
|
|
|
+ PjGoodsDesc goodsDesc = goodsDescMapper.selectOne(lambdaQueryWrapper);
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(goodsDesc)){
|
|
|
+ item.setGoodsId(goodsDesc.getId());
|
|
|
+ item.setGoodsName(goodsDesc.getCname());
|
|
|
+ item.setGoodsNo(goodsDesc.getCode());
|
|
|
+ item.setBrandId(goodsDesc.getBrandId());
|
|
|
+ item.setBrandName(goodsDesc.getBrandName());
|
|
|
+ item.setPropertyName(goodsDesc.getSpecificationAndModel());
|
|
|
+ item.setPattern(goodsDesc.getBrandItem());
|
|
|
+ item.setGoodsDescription(goodsDesc.getGoodsDescription());
|
|
|
+
|
|
|
+ if (goodsDesc.getWhether().equals("0")){//未开启管理批次号
|
|
|
+ if (ObjectUtil.isNotEmpty(itemExcel.getDot())){
|
|
|
+ item.setDot(null);
|
|
|
+ }
|
|
|
+ }else {//已开启批次号管理
|
|
|
+ if (ObjectUtil.isEmpty(itemExcel.getDot())){
|
|
|
+ throw new RuntimeException("第"+(i+2)+"行,商品已开启管理批次号,请填写批次号");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ item.setUnits(goodsDesc.getUnit());
|
|
|
+ item.setSendNum(itemExcel.getGoodsNum());
|
|
|
+ }else {
|
|
|
+ throw new RuntimeException("第"+(i+2)+"行,商品名称不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ list.add(item);
|
|
|
+ }
|
|
|
+ return R.data(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 生成工单历史记录
|
|
|
*/
|
|
|
public void saveHistory(Long pid, String status){
|