ShippingCombinationService.java
4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.huaheng.pc.shipment.shippingCombination.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail;
import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService;
import com.huaheng.pc.config.configValue.domain.ConfigValue;
import com.huaheng.pc.config.configValue.service.ConfigValueService;
import com.huaheng.pc.config.material.domain.Material;
import com.huaheng.pc.config.material.service.MaterialServiceImpl;
import com.huaheng.pc.config.materialType.domain.MaterialType;
import com.huaheng.pc.config.materialType.service.MaterialTypeService;
import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference;
import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService;
import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail;
import com.huaheng.pc.shipment.shippingCombination.domain.ShippingCombinationDetailModel;
import com.huaheng.pc.shipment.shippingCombination.mapper.ShippingCombinationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class ShippingCombinationService {
@Resource
private ShippingCombinationMapper shippingCombinationMapper;
@Resource
InventoryDetailService inventoryDetailService;
@Resource
ConfigValueService configValueService;
@Resource
FilterConfigDetailService filterConfigDetailService;
@Resource
ShipmentPreferenceService shipmentPreferenceService;
@Resource
MaterialServiceImpl materialService;
@Resource
MaterialTypeService materialTypeService;
//根据分配规则查找库存
public List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail) {
String warehouseCode = shipmentDetail.getWarehouseCode();
String companyCode = shipmentDetail.getCompanyCode();
String materialCode = shipmentDetail.getMaterialCode();
String inventorySts = shipmentDetail.getInventorySts();
int shipmentId = shipmentDetail.getShipmentId();
if(StringUtils.isEmpty(warehouseCode)) {
throw new ServiceException("出库详情没有仓库编码");
}
if(StringUtils.isEmpty(companyCode)) {
throw new ServiceException("出库详情没有货主编码");
}
if(StringUtils.isEmpty(materialCode)) {
throw new ServiceException("出库详情没有物料编码");
}
if(StringUtils.isEmpty(inventorySts)) {
throw new ServiceException("出库详情没有物料品质");
}
LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper =Wrappers.lambdaQuery();
inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode)
.eq(InventoryDetail::getCompanyCode, companyCode)
.eq(InventoryDetail::getMaterialCode, materialCode)
// .eq(InventoryDetail::getBatch, shipmentDetail.getBatch())
.eq(InventoryDetail::getInventorySts, inventorySts);
// .eq(StringUtils.isNotEmpty(shipmentDetail.getMoCode()),InventoryDetail::getMoCode, shipmentDetail.getMoCode());
if(StringUtils.isEmpty(shipmentDetail.getMoCode())){
inventoryDetailLambdaQueryWrapper.apply(" (moCode is null or moCode='')");
}
if(StringUtils.isNotEmpty(shipmentDetail.getMoCode())){
inventoryDetailLambdaQueryWrapper.apply(" (moCode is null or moCode='' or moCode='"+shipmentDetail.getMoCode()+"')");
}
List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper);
return inventoryDetailList;
}
public List<ShippingCombinationDetailModel> selectOfView(ShippingCombinationDetailModel shippingCombinationDetailModel) {
return shippingCombinationMapper.selectOfView(shippingCombinationDetailModel);
}
}