|
@@ -2,6 +2,7 @@ package com.fjhx.victoriatourist.service.excess.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.common.utils.Assert;
|
|
@@ -17,7 +18,10 @@ import com.fjhx.victoriatourist.mapper.excess.ExcessGoodsDetailsMapper;
|
|
|
import com.fjhx.victoriatourist.service.excess.ExcessGoodsDetailsService;
|
|
|
import com.fjhx.victoriatourist.service.excess.ExcessGoodsRegisterService;
|
|
|
import com.fjhx.victoriatourist.service.logistics.LogisticsInfosService;
|
|
|
+import com.fjhx.wms.entity.stock.emums.StockWaitType;
|
|
|
import com.fjhx.wms.entity.stock.po.StockWait;
|
|
|
+import com.fjhx.wms.entity.stock.po.StockWaitDetails;
|
|
|
+import com.fjhx.wms.service.stock.StockWaitDetailsService;
|
|
|
import com.fjhx.wms.service.stock.StockWaitService;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -47,6 +51,8 @@ public class ExcessGoodsDetailsServiceImpl extends ServiceImpl<ExcessGoodsDetail
|
|
|
private StockWaitService stockWaitService;
|
|
|
@Autowired
|
|
|
private LogisticsInfosService logisticsInfosService;
|
|
|
+ @Autowired
|
|
|
+ private StockWaitDetailsService stockWaitDetailsService;
|
|
|
|
|
|
private IWrapper<ExcessGoodsDetails> getWrapper(ExcessGoodsDetailsSelectDto dto) {
|
|
|
IWrapper<ExcessGoodsDetails> wrapper = getWrapper();
|
|
@@ -139,6 +145,7 @@ public class ExcessGoodsDetailsServiceImpl extends ServiceImpl<ExcessGoodsDetail
|
|
|
LogisticsInfos one = logisticsInfosService.getOne(q -> q.eq(LogisticsInfos::getBusinessId, stockWait.getDeliverGoodsId()));
|
|
|
if (ObjectUtil.isNotEmpty(one)) {
|
|
|
dto.setLogisticsInfosId(one.getId());
|
|
|
+ dto.setPurchaseId(one.getPurchaseId());
|
|
|
}
|
|
|
this.save(dto);
|
|
|
}
|
|
@@ -153,4 +160,70 @@ public class ExcessGoodsDetailsServiceImpl extends ServiceImpl<ExcessGoodsDetail
|
|
|
this.removeById(id);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 退货
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @DSTransactional
|
|
|
+ public void backGoods(ExcessGoodsDetailsDto dto) {
|
|
|
+ Assert.notEmpty(this.getById(dto.getId()), "查询不到多货信息!");
|
|
|
+ dto.setProcessingMethod(10);//退货
|
|
|
+ this.updateById(dto);
|
|
|
+
|
|
|
+// long logisticsInfosId = IdWorker.getId();
|
|
|
+// LogisticsInfos logisticsInfos = new LogisticsInfos();
|
|
|
+// logisticsInfos.setBusinessId(dto.getId());
|
|
|
+// logisticsInfos.setBusinessType(5);
|
|
|
+// logisticsInfos.setId(logisticsInfosId);
|
|
|
+// logisticsInfos.setIsKd100(1);
|
|
|
+// logisticsInfos.setExcessGoodsId(dto.getId());
|
|
|
+// logisticsInfos.setStockWaitId(excessGoodsDetails.getStockWaitId());
|
|
|
+// logisticsInfos.setPurchaseId(excessGoodsDetails.getPurchaseId());
|
|
|
+// //发起快递100订阅
|
|
|
+// String activeProfile = SpringUtil.getActiveProfile();
|
|
|
+// DynamicDataSourceContextHolder.push(SourceConstant.KD100);
|
|
|
+// Integer state = !"prod".equals(activeProfile) ? -1 : KD100Util.monitor(logisticsInfos.getLogisticsCompanyCode(), logisticsInfos.getCode(), logisticsInfosId, 1, LogisticsInfos.class).getState();
|
|
|
+// DynamicDataSourceContextHolder.poll();
|
|
|
+// logisticsInfos.setLogisticsStatus(state);
|
|
|
+// logisticsInfos.setIsKd100(1);
|
|
|
+// logisticsInfosService.save(logisticsInfos);
|
|
|
+// LogisticsDetails logisticsDetails = new LogisticsDetails();
|
|
|
+// logisticsDetails.setLogisticsInfoId(logisticsInfos.getId());
|
|
|
+// logisticsDetailsService.save(logisticsDetails);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 入库
|
|
|
+ */
|
|
|
+ @DSTransactional
|
|
|
+ @Override
|
|
|
+ public void inStock(ExcessGoodsDetailsDto dto) {
|
|
|
+ ExcessGoodsDetails byId = this.getById(dto.getId());
|
|
|
+ Assert.notEmpty(byId, "查询不到多货信息!");
|
|
|
+ dto.setProcessingMethod(20);//入库
|
|
|
+ this.updateById(dto);
|
|
|
+
|
|
|
+ StockWait byId1 = stockWaitService.getById(byId.getStockWaitId());
|
|
|
+
|
|
|
+ //添加一份待出库数据
|
|
|
+ StockWait stockWait = new StockWait();
|
|
|
+ stockWait.setType(1);
|
|
|
+ stockWait.setStatus(0);
|
|
|
+ stockWait.setBusinessId(byId.getId());
|
|
|
+ stockWait.setBusinessType(StockWaitType.EXCESS_GOODS_IN.getDetailType());//退货出库
|
|
|
+ stockWait.setPurchaseId(byId.getPurchaseId());
|
|
|
+ stockWait.setBusinessCode(byId1.getBusinessCode());
|
|
|
+ stockWait.setExcessGoodsId(byId.getId());
|
|
|
+ stockWaitService.save(stockWait);
|
|
|
+
|
|
|
+ StockWaitDetails stockWaitDetails = new StockWaitDetails();
|
|
|
+ stockWaitDetails.setStockWaitId(stockWait.getId());
|
|
|
+ stockWaitDetails.setProductId(byId.getProductId());
|
|
|
+ stockWaitDetails.setQuantity(byId.getQuantity());
|
|
|
+
|
|
|
+ stockWaitDetails.setBusinessDetailsId(byId.getId());
|
|
|
+ stockWaitDetails.setExcessGoodsDetailsId(byId.getId());
|
|
|
+ stockWaitDetailsService.save(stockWaitDetails);
|
|
|
+ }
|
|
|
+
|
|
|
}
|