|
1
|
package com.huaheng.pc.config.warehouse.service;
|
|
2
|
|
|
3
4
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
5
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
6
|
import com.huaheng.common.exception.service.ServiceException;
|
|
7
|
import com.huaheng.pc.config.FilterConfigHeader.service.FilterConfigHeaderService;
|
|
8
|
import com.huaheng.pc.config.address.domain.Address;
|
|
9
10
11
12
13
14
15
16
17
|
import com.huaheng.pc.config.address.service.AddressService;
import com.huaheng.pc.config.configValue.service.ConfigValueService;
import com.huaheng.pc.config.containerType.service.ContainerTypeService;
import com.huaheng.pc.config.cycleCountPreference.service.CycleCountPreferenceService;
import com.huaheng.pc.config.locationType.service.LocationTypeService;
import com.huaheng.pc.config.receiptPreference.service.ReceiptPreferenceService;
import com.huaheng.pc.config.receiptType.service.ReceiptTypeService;
import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService;
import com.huaheng.pc.config.shipmentType.service.ShipmentTypeService;
|
|
18
|
import com.huaheng.pc.config.statusFlow.service.StatusFlowHeaderService;
|
|
19
20
21
22
|
import com.huaheng.pc.config.warehouse.domain.Warehouse;
import com.huaheng.pc.config.warehouse.mapper.WarehouseMapper;
import com.huaheng.pc.config.warehouseCompany.domain.WarehouseCompany;
import com.huaheng.pc.config.warehouseCompany.service.WarehouseCompanyService;
|
|
23
|
import com.huaheng.pc.config.waveMaster.service.WaveMasterService;
|
|
24
|
import com.huaheng.pc.config.zone.service.ZoneService;
|
|
25
26
27
28
|
import com.huaheng.pc.system.dict.service.IDictTypeService;
import com.huaheng.pc.system.menu.service.IMenuService;
import com.huaheng.pc.system.role.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
|
|
29
|
import org.springframework.stereotype.Service;
|
|
30
|
import org.springframework.transaction.annotation.Transactional;
|
|
31
|
|
|
32
33
34
35
|
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
|
|
36
|
@Service("WarehouseService")
|
|
37
|
public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse> implements WarehouseService {
|
|
38
|
|
|
39
|
@Resource
|
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
private AddressService addressService;
@Resource
private ConfigValueService configValueService;
@Resource
private ContainerTypeService containerTypeService;
@Resource
private CycleCountPreferenceService cycleCountPreferenceService;
@Resource
private LocationTypeService locationTypeService;
@Resource
private ReceiptPreferenceService receiptPreferenceService;
@Resource
private ReceiptTypeService receiptTypeService;
@Resource
private ShipmentPreferenceService shipmentPreferenceService;
@Resource
private ShipmentTypeService shipmentTypeService;
@Resource
|
|
58
59
60
|
private WarehouseMapper warehouseMapper;
@Resource
private WarehouseCompanyService warehouseCompanyService;
|
|
61
62
63
64
65
66
67
68
69
70
71
72
|
@Autowired
private IRoleService roleService;
@Autowired
private IDictTypeService dictTypeService;
@Autowired
private IMenuService menuService;
@Autowired
private FilterConfigHeaderService filterConfigHeaderService;
@Autowired
private StatusFlowHeaderService statusFlowHeaderService;
@Autowired
private WaveMasterService waveMasterService;
|
|
73
74
|
@Autowired
private ZoneService zoneService;
|
|
75
76
77
78
79
80
81
82
83
84
85
|
@Override
public List<Map<String, Object>> getWarehouseList(Integer id) {
/**
* 查询仓库的code、name、enable
*/
LambdaQueryWrapper<Warehouse> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.select(Warehouse::getCode, Warehouse::getName, Warehouse::getEnable);
List<Map<String, Object>> warehouseList = warehouseMapper.selectMaps(lambdaQueryWrapper);
LambdaQueryWrapper<WarehouseCompany> lambdaQueryWrapper1 = Wrappers.lambdaQuery();
|
|
86
|
lambdaQueryWrapper1.select(WarehouseCompany::getCompanyCode,WarehouseCompany::getWarehouseCode)
|
|
87
88
89
90
91
92
|
.eq(WarehouseCompany::getCompanyId,id);
List<Map<String, Object>> warehouseCompanies = warehouseCompanyService.listMaps(lambdaQueryWrapper1);
for(Map<String, Object> item : warehouseList){
item.put("flag",false);
item.put("value", item.get("code").toString());
|
|
93
94
|
for (Map<String, Object> warehouseI:warehouseCompanies) {
if (item.get("code").toString().equals(warehouseI.get("warehouseCode").toString())) {
|
|
95
96
97
98
99
100
101
|
item.put("flag",true);
break;
}
}
}
return warehouseList;
}
|
|
102
103
104
105
106
107
108
109
|
@Override
public List<Warehouse> selectWarehouseByUserId(Integer userId)
{
List<Warehouse> userWarhouses = warehouseMapper.selectWarehouseByUserId(userId);
List<Warehouse> warehouses = warehouseMapper.selectWarehouseAll();
for (Warehouse warehouse : warehouses)
{
|
|
110
|
for (Warehouse userWarehouse: userWarhouses)
|
|
111
112
113
114
115
116
117
118
119
120
121
|
{
if (warehouse.getCode().equals(userWarehouse.getCode()))
{
warehouse.setFlag(true);
break;
}
}
}
return warehouses;
}
|
|
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/**
* 复制仓库
* @param warehouseCode 仓库编码
* @param newWarehouseCode 新仓库编码
*/
@Override
@Transactional
public Boolean warehouseCopy(String warehouseCode, String newWarehouseCode) {
/* 复制地址表*/
if (!addressService.addressCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制地址表失败");
}
/* 复制系统参数配置表*/
if (!configValueService.configValueCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制系统参数配置表失败");
}
/* 复制容器类型表*/
if (!containerTypeService.containerTypeCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制容器类型表失败");
}
/* 复制库位类型表*/
if (!locationTypeService.locationTypeCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制库位类型表失败");
}
|
|
146
147
148
149
|
/* 复制库区表*/
if (!zoneService.zoneCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制库区类型表失败");
}
|
|
150
151
152
153
154
|
/* 复制盘点首选项表*/
if (!cycleCountPreferenceService.cycleCountPreferenceCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制盘点首选项表失败");
}
/* 复制入库首选项*/
|
|
155
156
157
|
if (!receiptPreferenceService.receiptPreferenceCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制入库首选项表失败");
}
|
|
158
|
/* 复制出库首选项*/
|
|
159
160
161
|
if (!shipmentPreferenceService.shipmentPreferenceCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制出库首选项表失败");
}
|
|
162
163
164
165
166
|
/* 复制入库类型*/
if (!receiptTypeService.receiptTypeCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制入库类型表失败");
}
/* 复制出库类型*/
|
|
167
168
169
|
if (!shipmentTypeService.ShipmentTypeCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制出库类型表失败");
}
|
|
170
171
172
173
|
/* 复制仓库货主关系*/
if (warehouseMapper.companyCopy(warehouseCode, newWarehouseCode) < 1){
throw new ServiceException("复制仓库货主关系表失败");
}
|
|
174
175
176
177
|
/* 复制仓库用户关系*/
if (warehouseMapper.userCopy(warehouseCode, newWarehouseCode) < 1){
throw new ServiceException("复制仓库货主关系表失败");
}
|
|
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
/* 复制角色*/
if (!roleService.roleCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制角色表失败");
}
/* 复制字典数据*/
if (!dictTypeService.dictTypeCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制字典数据表失败");
}
/* 复制菜单*/
if (!menuService.menuCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制菜单表失败");
}
/* 复制流程*/
if (!statusFlowHeaderService.statusFlowCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制流程表失败");
}
/* 复制规则配置*/
if (!filterConfigHeaderService.filterConfigCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制规则配置表失败");
}
/* 复制波次配置*/
if (!waveMasterService.waveMasterCopy(warehouseCode, newWarehouseCode)){
throw new ServiceException("复制波次配置表失败");
}
|
|
202
203
|
return true;
}
|
|
204
205
206
207
208
|
@Override
public List<Warehouse> selectListEntityByEqual(Warehouse condition) {
return warehouseMapper.selectListEntityByEqual(condition);
}
|
|
209
|
}
|