Commit 6b8254fb96a23e9871e873196bcbf352aa676197
Merge branch 'develop' of http://172.16.29.40:8010/wms/wms2 into develop
Showing
10 changed files
with
189 additions
and
117 deletions
src/main/java/com/huaheng/pc/config/material/controller/MaterialController.java
... | ... | @@ -108,35 +108,7 @@ public class MaterialController extends BaseController { |
108 | 108 | @ResponseBody |
109 | 109 | public AjaxResult addSave(Material material) { |
110 | 110 | |
111 | - LambdaQueryWrapper<Material> lambda = Wrappers.lambdaQuery(); | |
112 | - lambda.eq(Material::getCode, material.getCode()) | |
113 | - .eq(Material::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
114 | - .eq(Material::getDeleted, false); | |
115 | - Map<String, Object> map = materialService.getMap(lambda); | |
116 | - if (map != null) { | |
117 | - return AjaxResult.error("物料已经存在"); | |
118 | - } | |
119 | - LambdaQueryWrapper<MaterialUnit> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
120 | - lambdaQueryWrapper.eq(MaterialUnit::getMaterialCode, material.getCode()) | |
121 | - .eq(MaterialUnit::getUnit, material.getUnit()); | |
122 | - if (materialUnitService.getOne(lambdaQueryWrapper) == null){ | |
123 | - MaterialUnit materialUnit = new MaterialUnit(); | |
124 | - materialUnit.setMaterialCode(material.getCode()); | |
125 | - materialUnit.setMaterialName(material.getName()); | |
126 | - materialUnit.setMaterialSpec(material.getSpec()); | |
127 | - materialUnit.setCompanyCode(material.getCompanyCode()); | |
128 | - materialUnit.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
129 | - materialUnit.setUnit(material.getUnit()); | |
130 | - materialUnit.setCreatedBy(ShiroUtils.getLoginName()); | |
131 | - materialUnit.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
132 | - | |
133 | - materialUnitService.save(materialUnit); | |
134 | - } | |
135 | - | |
136 | - material.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
137 | - material.setCreatedBy(ShiroUtils.getLoginName()); | |
138 | - material.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
139 | - return AjaxResult.toAjax(materialService.save(material)); | |
111 | + return materialService.addSave(material); | |
140 | 112 | } |
141 | 113 | |
142 | 114 | /** |
... | ... |
src/main/java/com/huaheng/pc/config/material/service/MaterialService.java
... | ... | @@ -13,5 +13,10 @@ public interface MaterialService extends IService<Material>{ |
13 | 13 | |
14 | 14 | String importMaterial(List<Material> materialList, Boolean updateSupport,String operName); |
15 | 15 | |
16 | - | |
16 | + /** | |
17 | + * 添加物料 | |
18 | + * @param material | |
19 | + * @return | |
20 | + */ | |
21 | + AjaxResult addSave(Material material); | |
17 | 22 | } |
... | ... |
src/main/java/com/huaheng/pc/config/material/service/MaterialServiceImpl.java
... | ... | @@ -7,10 +7,15 @@ import com.huaheng.common.support.Convert; |
7 | 7 | import com.huaheng.common.utils.StringUtils; |
8 | 8 | import com.huaheng.common.utils.security.ShiroUtils; |
9 | 9 | import com.huaheng.framework.web.domain.AjaxResult; |
10 | +import com.huaheng.pc.config.materialType.domain.MaterialType; | |
11 | +import com.huaheng.pc.config.materialType.service.MaterialTypeService; | |
12 | +import com.huaheng.pc.config.materialUnit.domain.MaterialUnit; | |
13 | +import com.huaheng.pc.config.materialUnit.service.MaterialUnitService; | |
10 | 14 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
11 | 15 | import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; |
12 | 16 | import org.springframework.stereotype.Service; |
13 | 17 | import javax.annotation.Resource; |
18 | +import java.lang.ref.WeakReference; | |
14 | 19 | import java.util.List; |
15 | 20 | import java.util.Map; |
16 | 21 | |
... | ... | @@ -23,6 +28,10 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i |
23 | 28 | |
24 | 29 | @Resource |
25 | 30 | private ReceiptDetailService receiptDetailService; |
31 | + @Resource | |
32 | + private MaterialUnitService materialUnitService; | |
33 | + @Resource | |
34 | + private MaterialTypeService materialTypeService; | |
26 | 35 | |
27 | 36 | @Override |
28 | 37 | public AjaxResult removeByIds(String ids) { |
... | ... | @@ -94,4 +103,60 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i |
94 | 103 | } |
95 | 104 | return successMsg.toString(); |
96 | 105 | } |
106 | + | |
107 | + /** | |
108 | + * 添加物料 | |
109 | + * @param material | |
110 | + * @return | |
111 | + */ | |
112 | + @Override | |
113 | + public AjaxResult addSave(Material material) { | |
114 | + LambdaQueryWrapper<Material> lambda = Wrappers.lambdaQuery(); | |
115 | + //如果物料编码为空则生成物料编码 | |
116 | + if (material.getCode() == null) { | |
117 | + material.setCode(createCode(material.getType())); | |
118 | + } | |
119 | + lambda.eq(Material::getCode, material.getCode()) | |
120 | + .eq(Material::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
121 | + .eq(Material::getDeleted, false); | |
122 | + Map<String, Object> map = this.getMap(lambda); | |
123 | + if (map != null) { | |
124 | + return AjaxResult.error("物料已经存在"); | |
125 | + } | |
126 | + | |
127 | + LambdaQueryWrapper<MaterialUnit> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
128 | + lambdaQueryWrapper.eq(MaterialUnit::getMaterialCode, material.getCode()) | |
129 | + .eq(MaterialUnit::getUnit, material.getUnit()); | |
130 | + //如果不存在该物料的单位是新建物料单位 | |
131 | + if (materialUnitService.getOne(lambdaQueryWrapper) == null){ | |
132 | + MaterialUnit materialUnit = new MaterialUnit(); | |
133 | + materialUnit.setMaterialCode(material.getCode()); | |
134 | + materialUnit.setMaterialName(material.getName()); | |
135 | + materialUnit.setMaterialSpec(material.getSpec()); | |
136 | + materialUnit.setCompanyCode(material.getCompanyCode()); | |
137 | + materialUnit.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
138 | + materialUnit.setUnit(material.getUnit()); | |
139 | + materialUnit.setCreatedBy(ShiroUtils.getLoginName()); | |
140 | + materialUnit.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
141 | + | |
142 | + materialUnitService.save(materialUnit); | |
143 | + } | |
144 | + material.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
145 | + material.setCreatedBy(ShiroUtils.getLoginName()); | |
146 | + material.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
147 | + return null; | |
148 | + } | |
149 | + | |
150 | + /** | |
151 | + * 生成物料编码 | |
152 | + * @param code | |
153 | + * @return | |
154 | + */ | |
155 | + private String createCode(String code){ | |
156 | + LambdaQueryWrapper<MaterialType> lambda = Wrappers.lambdaQuery(); | |
157 | + lambda.eq(MaterialType::getCode, code); | |
158 | + MaterialType materialType = materialTypeService.getOne(lambda); | |
159 | + | |
160 | + return String.format(materialType.getAutoGenSerialNumFormat(), materialType.getTrackSerialNum()); | |
161 | + } | |
97 | 162 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailService.java
... | ... | @@ -3,6 +3,7 @@ package com.huaheng.pc.inventory.inventoryDetail.service; |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | 4 | import com.huaheng.framework.web.domain.AjaxResult; |
5 | 5 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
6 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
6 | 7 | |
7 | 8 | import java.util.List; |
8 | 9 | |
... | ... | @@ -11,7 +12,7 @@ public interface InventoryDetailService extends IService<InventoryDetail> { |
11 | 12 | |
12 | 13 | AjaxResult detailcreateCheckOutTask (Integer id); |
13 | 14 | |
14 | - List<InventoryDetail> selectBysql(String sql); | |
15 | + List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail); | |
15 | 16 | |
16 | 17 | } |
17 | 18 | |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailServiceImpl.java
... | ... | @@ -9,6 +9,7 @@ import com.huaheng.framework.web.domain.AjaxResult; |
9 | 9 | import com.huaheng.pc.config.location.domain.Location; |
10 | 10 | import com.huaheng.pc.config.location.service.LocationService; |
11 | 11 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
12 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
12 | 13 | import com.huaheng.pc.task.taskDetail.domain.TaskDetail; |
13 | 14 | import com.huaheng.pc.task.taskDetail.service.TaskDetailService; |
14 | 15 | import com.huaheng.pc.task.taskHeader.domain.TaskHeader; |
... | ... | @@ -103,7 +104,11 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
103 | 104 | } |
104 | 105 | |
105 | 106 | @Override |
106 | - public List<InventoryDetail> selectBysql(String sql) { | |
107 | + public List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail) { | |
108 | + sql=sql+" \n" +"and warehouseCode='" + shipmentDetail.getWarehouseCode()+"' \n" + | |
109 | + "and companyCode='" + shipmentDetail.getCompanyCode()+"' \n" + | |
110 | + "and materialCode='" + shipmentDetail.getMaterialCode() +"' \n" + | |
111 | + "and inventorySts='" + shipmentDetail.getInventorySts() + "'"; | |
107 | 112 | return inventoryDetailMapper.selectBysql(sql); |
108 | 113 | } |
109 | 114 | |
... | ... |
src/main/java/com/huaheng/pc/receipt/receiptDetail/service/ReceiptDetailServiceImpl.java
... | ... | @@ -156,7 +156,7 @@ public class ReceiptDetailServiceImpl extends ServiceImpl<ReceiptDetailMapper, R |
156 | 156 | */ |
157 | 157 | @Transactional |
158 | 158 | public ReceiptDetail queryflow(ReceiptDetail receiptDetail){ |
159 | - | |
159 | + //当单据状态为驳回或作废时不更新状态 | |
160 | 160 | if ("10".equals(receiptDetail.getProcessStamp()) || "20".equals(receiptDetail.getProcessStamp())){ |
161 | 161 | return receiptDetail; |
162 | 162 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java
... | ... | @@ -360,13 +360,13 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
360 | 360 | continue; |
361 | 361 | } |
362 | 362 | // 根据 仓库编码、货主编码、存货编码,物料状态,项目号来查找可以出库的物料 |
363 | - ShippingSearch search = new ShippingSearch(); | |
364 | - search.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
365 | - search.setCompanyCode(item.getCompanyCode()); | |
366 | - search.setMaterialCode(item.getMaterialCode()); | |
367 | - search.setInventorySts(item.getInventorySts()); //物料状态 | |
363 | +// ShippingSearch search = new ShippingSearch(); | |
364 | +// search.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
365 | +// search.setCompanyCode(item.getCompanyCode()); | |
366 | +// search.setMaterialCode(item.getMaterialCode()); | |
367 | +// search.setInventorySts(item.getInventorySts()); //物料状态 | |
368 | 368 | |
369 | - List<InventoryDetail> inventoryList = shippingCombinationService.getInventorys(search); | |
369 | + List<InventoryDetail> inventoryList = shippingCombinationService.getInventorys(item); | |
370 | 370 | if (inventoryList.size() < 1) { |
371 | 371 | num = num + 1; |
372 | 372 | } else { |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/controller/ShippingCombinationController.java
... | ... | @@ -42,8 +42,7 @@ public class ShippingCombinationController extends BaseController { |
42 | 42 | |
43 | 43 | private String prefix = "shipment/shippingCombination"; |
44 | 44 | |
45 | - @Autowired | |
46 | - MaterialServiceImpl materialService; | |
45 | + | |
47 | 46 | @Autowired |
48 | 47 | ShipmentDetailServiceImpl shipmentDetailService; |
49 | 48 | @Autowired |
... | ... | @@ -54,14 +53,6 @@ public class ShippingCombinationController extends BaseController { |
54 | 53 | ShipmentContainerDetailService shipmentContainerDetailService; |
55 | 54 | @Autowired |
56 | 55 | ShipmentHeaderService shipmentHeaderService; |
57 | - @Autowired | |
58 | - InventoryDetailService inventoryDetailService; | |
59 | - @Autowired | |
60 | - ConfigValueService configValueService; | |
61 | - @Autowired | |
62 | - FilterConfigDetailService filterConfigDetailService; | |
63 | - @Autowired | |
64 | - ShipmentPreferenceService shipmentPreferenceService; | |
65 | 56 | |
66 | 57 | |
67 | 58 | /** |
... | ... | @@ -152,72 +143,8 @@ public class ShippingCombinationController extends BaseController { |
152 | 143 | throw new ServiceException("找不到子单"); |
153 | 144 | } |
154 | 145 | |
146 | + List<InventoryDetail> list=shippingCombinationService.getInventorys(shipmentDetail); | |
155 | 147 | //查找分配规则 |
156 | - List<InventoryDetail> list=new ArrayList<>(); | |
157 | - FilterConfigDetail filterConfigDetail=new FilterConfigDetail(); | |
158 | - LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambdaQueryWrapper=Wrappers.lambdaQuery(); | |
159 | - filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getWarehouseCode,shipmentDetail.getWarehouseCode()); | |
160 | - | |
161 | - //出库子单的分配规则有时,优先出库子单的分配规则 | |
162 | - if(StringUtils.isNotEmpty(shipmentDetail.getAllocationRule())){ | |
163 | - filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getCode,shipmentDetail.getAllocationRule()); | |
164 | - filterConfigDetail=filterConfigDetailService.getOne(filterConfigDetailLambdaQueryWrapper); | |
165 | - if(filterConfigDetail==null){ | |
166 | - throw new ServiceException("出库子单出库规则配置不存在"); | |
167 | - } | |
168 | - | |
169 | - //根据sql查库存 | |
170 | - try { | |
171 | - list = inventoryDetailService.selectBysql(filterConfigDetail.getStatement()); | |
172 | - }catch (Exception e){ | |
173 | - throw new ServiceException("sql错误"); | |
174 | - } | |
175 | - return getDataTable(list); | |
176 | - } | |
177 | - | |
178 | - //出库子单的分配规则没有时,优先物料的分配规则 | |
179 | - LambdaQueryWrapper<Material> materialLambdaQueryWrapper=Wrappers.lambdaQuery(); | |
180 | - materialLambdaQueryWrapper.eq(Material::getCode,shipmentDetail.getMaterialCode()) | |
181 | - .eq(Material::getWarehouseCode,shipmentDetail.getWarehouseCode()); | |
182 | - Material material=materialService.getOne(materialLambdaQueryWrapper); | |
183 | - if(StringUtils.isNotEmpty(material.getAllocationRule())){ | |
184 | - filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getCode,material.getAllocationRule()); | |
185 | - filterConfigDetail=filterConfigDetailService.getOne(filterConfigDetailLambdaQueryWrapper); | |
186 | - if(filterConfigDetail==null){ | |
187 | - throw new ServiceException("物料出库规则配置不存在"); | |
188 | - } | |
189 | - | |
190 | - //根据sql查库存 | |
191 | - list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement()); | |
192 | - return getDataTable(list); | |
193 | - } | |
194 | - | |
195 | - //都没有时,默认仓库的分配规则 | |
196 | - LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper=Wrappers.lambdaQuery(); | |
197 | - configValueLambdaQueryWrapper.eq(ConfigValue::getModuleType,"shipment") | |
198 | - .eq(ConfigValue::getWarehouseCode,shipmentDetail.getWarehouseCode()); | |
199 | - ConfigValue configValue=configValueService.getOne(configValueLambdaQueryWrapper); | |
200 | - if(configValue==null){ | |
201 | - throw new ServiceException("仓库的出库配置不存在"); | |
202 | - } | |
203 | - | |
204 | - //查找出库首选项 | |
205 | - LambdaQueryWrapper<ShipmentPreference> slam=Wrappers.lambdaQuery(); | |
206 | - slam.eq(ShipmentPreference::getCode,configValue.getIdentifier()) | |
207 | - .eq(ShipmentPreference::getWarehouseCode,configValue.getWarehouseCode()); | |
208 | - ShipmentPreference shipmentPreference=shipmentPreferenceService.getOne(slam); | |
209 | - if(shipmentPreference==null){ | |
210 | - throw new ServiceException("仓库的出库配置中出库首选项不存在"); | |
211 | - } | |
212 | - //查找分配规则 | |
213 | - filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getCode,shipmentPreference.getAllocationRule()); | |
214 | - filterConfigDetail=filterConfigDetailService.getOne(filterConfigDetailLambdaQueryWrapper); | |
215 | - if(filterConfigDetail==null){ | |
216 | - throw new ServiceException("出库首选项中出库规则配置不存在"); | |
217 | - } | |
218 | - | |
219 | - //根据sql查库存 | |
220 | - list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement()); | |
221 | 148 | return getDataTable(list); |
222 | 149 | } |
223 | 150 | |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java
1 | 1 | package com.huaheng.pc.shipment.shippingCombination.service; |
2 | 2 | |
3 | 3 | |
4 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | +import com.huaheng.common.exception.service.ServiceException; | |
7 | +import com.huaheng.common.utils.StringUtils; | |
8 | +import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail; | |
9 | +import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService; | |
10 | +import com.huaheng.pc.config.configValue.domain.ConfigValue; | |
11 | +import com.huaheng.pc.config.configValue.service.ConfigValueService; | |
12 | +import com.huaheng.pc.config.material.domain.Material; | |
13 | +import com.huaheng.pc.config.material.service.MaterialServiceImpl; | |
14 | +import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; | |
15 | +import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService; | |
4 | 16 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
17 | +import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; | |
18 | +import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; | |
5 | 19 | import com.huaheng.pc.shipment.shippingCombination.domain.ShippingSearch; |
6 | 20 | import com.huaheng.pc.shipment.shippingCombination.mapper.ShippingCombinationMapper; |
21 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | 22 | import org.springframework.stereotype.Service; |
8 | 23 | |
9 | 24 | import javax.annotation.Resource; |
25 | +import java.util.ArrayList; | |
10 | 26 | import java.util.List; |
11 | 27 | |
12 | 28 | |
... | ... | @@ -15,10 +31,86 @@ public class ShippingCombinationService { |
15 | 31 | |
16 | 32 | @Resource |
17 | 33 | private ShippingCombinationMapper shippingCombinationMapper; |
34 | + @Autowired | |
35 | + InventoryDetailService inventoryDetailService; | |
36 | + @Autowired | |
37 | + ConfigValueService configValueService; | |
38 | + @Autowired | |
39 | + FilterConfigDetailService filterConfigDetailService; | |
40 | + @Autowired | |
41 | + ShipmentPreferenceService shipmentPreferenceService; | |
42 | + @Autowired | |
43 | + MaterialServiceImpl materialService; | |
18 | 44 | |
19 | 45 | |
20 | - public List<InventoryDetail> getInventorys(ShippingSearch search) { | |
21 | - List<InventoryDetail> list = shippingCombinationMapper.getInventorys(search); | |
46 | + | |
47 | + //根据分配规则查找库存 | |
48 | + public List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail) { | |
49 | + List<InventoryDetail> list=new ArrayList<>(); | |
50 | + FilterConfigDetail filterConfigDetail=new FilterConfigDetail(); | |
51 | + LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambdaQueryWrapper= Wrappers.lambdaQuery(); | |
52 | + filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getWarehouseCode,shipmentDetail.getWarehouseCode()); | |
53 | + | |
54 | + //出库子单的分配规则有时,优先出库子单的分配规则 | |
55 | + if(StringUtils.isNotEmpty(shipmentDetail.getAllocationRule())){ | |
56 | + filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getCode,shipmentDetail.getAllocationRule()); | |
57 | + filterConfigDetail=filterConfigDetailService.getOne(filterConfigDetailLambdaQueryWrapper); | |
58 | + if(filterConfigDetail==null){ | |
59 | + throw new ServiceException("出库子单出库规则配置不存在"); | |
60 | + } | |
61 | + | |
62 | + //根据sql查库存 | |
63 | + try { | |
64 | + list = inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail); | |
65 | + }catch (Exception e){ | |
66 | + throw new ServiceException("sql错误"); | |
67 | + } | |
68 | + return list; | |
69 | + } | |
70 | + | |
71 | + //出库子单的分配规则没有时,优先物料的分配规则 | |
72 | + LambdaQueryWrapper<Material> materialLambdaQueryWrapper=Wrappers.lambdaQuery(); | |
73 | + materialLambdaQueryWrapper.eq(Material::getCode,shipmentDetail.getMaterialCode()) | |
74 | + .eq(Material::getWarehouseCode,shipmentDetail.getWarehouseCode()); | |
75 | + Material material=materialService.getOne(materialLambdaQueryWrapper); | |
76 | + if(StringUtils.isNotEmpty(material.getAllocationRule())){ | |
77 | + filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getCode,material.getAllocationRule()); | |
78 | + filterConfigDetail=filterConfigDetailService.getOne(filterConfigDetailLambdaQueryWrapper); | |
79 | + if(filterConfigDetail==null){ | |
80 | + throw new ServiceException("物料出库规则配置不存在"); | |
81 | + } | |
82 | + | |
83 | + //根据sql查库存 | |
84 | + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail); | |
85 | + return list; | |
86 | + } | |
87 | + | |
88 | + //都没有时,默认仓库的分配规则 | |
89 | + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper=Wrappers.lambdaQuery(); | |
90 | + configValueLambdaQueryWrapper.eq(ConfigValue::getModuleType,"shipment") | |
91 | + .eq(ConfigValue::getWarehouseCode,shipmentDetail.getWarehouseCode()); | |
92 | + ConfigValue configValue=configValueService.getOne(configValueLambdaQueryWrapper); | |
93 | + if(configValue==null){ | |
94 | + throw new ServiceException("仓库的出库配置不存在"); | |
95 | + } | |
96 | + | |
97 | + //查找出库首选项 | |
98 | + LambdaQueryWrapper<ShipmentPreference> slam=Wrappers.lambdaQuery(); | |
99 | + slam.eq(ShipmentPreference::getCode,configValue.getIdentifier()) | |
100 | + .eq(ShipmentPreference::getWarehouseCode,configValue.getWarehouseCode()); | |
101 | + ShipmentPreference shipmentPreference=shipmentPreferenceService.getOne(slam); | |
102 | + if(shipmentPreference==null){ | |
103 | + throw new ServiceException("仓库的出库配置中出库首选项不存在"); | |
104 | + } | |
105 | + //查找分配规则 | |
106 | + filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getCode,shipmentPreference.getAllocationRule()); | |
107 | + filterConfigDetail=filterConfigDetailService.getOne(filterConfigDetailLambdaQueryWrapper); | |
108 | + if(filterConfigDetail==null){ | |
109 | + throw new ServiceException("出库首选项中出库规则配置不存在"); | |
110 | + } | |
111 | + | |
112 | + //根据sql查库存 | |
113 | + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail); | |
22 | 114 | return list; |
23 | 115 | } |
24 | 116 | |
... | ... |
src/main/resources/templates/shipment/shippingCombination/shippingCombination.html
... | ... | @@ -135,7 +135,12 @@ |
135 | 135 | id:row.id |
136 | 136 | }, |
137 | 137 | success:res=>{ |
138 | - $("#bootstrap-table1").bootstrapTable('load',res.data) | |
138 | + if(res.code===200){ | |
139 | + $("#bootstrap-table1").bootstrapTable('load',res.data) | |
140 | + } | |
141 | + else{ | |
142 | + $.modal.alertError(res.msg) | |
143 | + } | |
139 | 144 | } |
140 | 145 | }) |
141 | 146 | }, |
... | ... |