Commit 38ac9f6394d730fa17cc0e52e8fb85c10bf01cfc
1 parent
7e2462ff
sql修改
Showing
4 changed files
with
49 additions
and
31 deletions
src/main/java/com/huaheng/pc/config/shipmentPreference/service/ShipmentPreferenceServiceImpl.java
... | ... | @@ -7,6 +7,8 @@ import com.huaheng.common.exception.service.ServiceException; |
7 | 7 | import com.huaheng.common.support.Convert; |
8 | 8 | import com.huaheng.common.utils.StringUtils; |
9 | 9 | import com.huaheng.common.utils.security.ShiroUtils; |
10 | +import com.huaheng.pc.config.configValue.domain.ConfigValue; | |
11 | +import com.huaheng.pc.config.configValue.service.ConfigValueService; | |
10 | 12 | import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; |
11 | 13 | import com.huaheng.pc.config.shipmentPreference.mapper.ShipmentPreferenceMapper; |
12 | 14 | import com.huaheng.pc.config.statusFlow.domain.StatusFlowDetail; |
... | ... | @@ -32,6 +34,8 @@ public class ShipmentPreferenceServiceImpl extends ServiceImpl<ShipmentPreferenc |
32 | 34 | private StatusFlowDetailService statusFlowDetailService; |
33 | 35 | @Autowired |
34 | 36 | private ShipmentHeaderService shipmentHeaderService; |
37 | + @Autowired | |
38 | + private ConfigValueService configValueService; | |
35 | 39 | |
36 | 40 | |
37 | 41 | /** |
... | ... | @@ -46,6 +50,15 @@ public class ShipmentPreferenceServiceImpl extends ServiceImpl<ShipmentPreferenc |
46 | 50 | */ |
47 | 51 | @Override |
48 | 52 | public List<ShipmentHeader> checkShipmentProcess(String ids, Integer code) { |
53 | + | |
54 | + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper=Wrappers.lambdaQuery(); | |
55 | + configValueLambdaQueryWrapper.eq(ConfigValue::getModuleType,"shipment") | |
56 | + .eq(ConfigValue::getWarehouseCode,ShiroUtils.getWarehouseCode()); | |
57 | + ConfigValue configValue=configValueService.getOne(configValueLambdaQueryWrapper); | |
58 | + if(configValue==null){ | |
59 | + throw new ServiceException("仓库的出库配置不存在"); | |
60 | + } | |
61 | + | |
49 | 62 | //查找出库首选项 |
50 | 63 | ShipmentPreference shipmentPreference = shipmentPreferenceService.list().get(0); |
51 | 64 | if(shipmentPreference == null){ |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailService.java
... | ... | @@ -2,6 +2,7 @@ package com.huaheng.pc.inventory.inventoryDetail.service; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | 4 | import com.huaheng.framework.web.domain.AjaxResult; |
5 | +import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; | |
5 | 6 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
6 | 7 | import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; |
7 | 8 | |
... | ... | @@ -14,7 +15,7 @@ public interface InventoryDetailService extends IService<InventoryDetail> { |
14 | 15 | |
15 | 16 | void detailcreateCheckOutTask (Integer id); |
16 | 17 | |
17 | - List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail,String sqll); | |
18 | + List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail, String sqll, ShipmentPreference shipmentPreference); | |
18 | 19 | |
19 | 20 | |
20 | 21 | AjaxResult detailCheckTask (Integer[] ids) throws InvocationTargetException, IllegalAccessException; |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryDetail/service/InventoryDetailServiceImpl.java
... | ... | @@ -12,6 +12,7 @@ import com.huaheng.pc.check.checkHeader.domain.CheckHeader; |
12 | 12 | import com.huaheng.pc.check.checkHeader.service.CheckHeaderService; |
13 | 13 | import com.huaheng.pc.config.location.domain.Location; |
14 | 14 | import com.huaheng.pc.config.location.service.LocationService; |
15 | +import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; | |
15 | 16 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
16 | 17 | import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; |
17 | 18 | import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; |
... | ... | @@ -128,18 +129,19 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
128 | 129 | } |
129 | 130 | |
130 | 131 | @Override |
131 | - public List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail,String sqll) { | |
132 | - if(StringUtils.isEmpty(sqll)) { | |
133 | - sql = sql + " \n" + "and warehouseCode='" + shipmentDetail.getWarehouseCode() + "' \n" + | |
134 | - "and companyCode='" + shipmentDetail.getCompanyCode() + "' \n" + | |
135 | - "and materialCode='" + shipmentDetail.getMaterialCode() + "' \n" + | |
136 | - "and inventorySts='" + shipmentDetail.getInventorySts() + "'"; | |
137 | - }else { | |
138 | - sql = sql + " \n" + "and warehouseCode='" + shipmentDetail.getWarehouseCode() + "' \n" + | |
139 | - "and companyCode='" + shipmentDetail.getCompanyCode() + "' \n" + | |
140 | - "and materialCode='" + shipmentDetail.getMaterialCode() + "' \n" + | |
141 | - "and inventorySts='" + shipmentDetail.getInventorySts() + "'"+ " \n" +sqll; | |
142 | - } | |
132 | + public List<InventoryDetail> selectBysql(String sql, ShipmentDetail shipmentDetail, String sqll, ShipmentPreference shipmentPreference) { | |
133 | + if(shipmentPreference.getAllowQcCheckResult() == true) { | |
134 | + sql = sql + " \n" + "and warehouseCode='" + shipmentDetail.getWarehouseCode() + "' \n" + | |
135 | + "and companyCode='" + shipmentDetail.getCompanyCode() + "' \n" + | |
136 | + "and materialCode='" + shipmentDetail.getMaterialCode() + "' \n" + | |
137 | + "and inventorySts='" + shipmentDetail.getInventorySts() + "'\n"+ | |
138 | + "and inventorySts='" + shipmentDetail.getInventorySts() + "'\n"+ sqll; | |
139 | + }else { | |
140 | + sql = sql + " \n" + "and warehouseCode='" + shipmentDetail.getWarehouseCode() + "' \n" + | |
141 | + "and companyCode='" + shipmentDetail.getCompanyCode() + "' \n" + | |
142 | + "and materialCode='" + shipmentDetail.getMaterialCode() + "' \n" + | |
143 | + "and qcCheck=1\n"+ sqll; | |
144 | + } | |
143 | 145 | return inventoryDetailMapper.selectBysql(sql); |
144 | 146 | } |
145 | 147 | |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java
... | ... | @@ -46,6 +46,23 @@ public class ShippingCombinationService { |
46 | 46 | |
47 | 47 | //根据分配规则查找库存 |
48 | 48 | public List<InventoryDetail> getInventorys(ShipmentDetail shipmentDetail) { |
49 | + LambdaQueryWrapper<ConfigValue> configValueLambdaQueryWrapper=Wrappers.lambdaQuery(); | |
50 | + configValueLambdaQueryWrapper.eq(ConfigValue::getModuleType,"shipment") | |
51 | + .eq(ConfigValue::getWarehouseCode,shipmentDetail.getWarehouseCode()); | |
52 | + ConfigValue configValue=configValueService.getOne(configValueLambdaQueryWrapper); | |
53 | + if(configValue==null){ | |
54 | + throw new ServiceException("仓库的出库配置不存在"); | |
55 | + } | |
56 | + | |
57 | + //查找出库首选项 | |
58 | + LambdaQueryWrapper<ShipmentPreference> slam=Wrappers.lambdaQuery(); | |
59 | + slam.eq(ShipmentPreference::getCode,configValue.getIdentifier()) | |
60 | + .eq(ShipmentPreference::getWarehouseCode,configValue.getWarehouseCode()); | |
61 | + ShipmentPreference shipmentPreference=shipmentPreferenceService.getOne(slam); | |
62 | + if(shipmentPreference==null){ | |
63 | + throw new ServiceException("仓库的出库配置中出库首选项不存在"); | |
64 | + } | |
65 | + | |
49 | 66 | List<InventoryDetail> list=new ArrayList<>(); |
50 | 67 | FilterConfigDetail filterConfigDetail=new FilterConfigDetail(); |
51 | 68 | LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambdaQueryWrapper= Wrappers.lambdaQuery(); |
... | ... | @@ -61,7 +78,7 @@ public class ShippingCombinationService { |
61 | 78 | |
62 | 79 | //根据sql查库存 |
63 | 80 | try { |
64 | - list = inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll()); | |
81 | + list = inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll(),shipmentPreference); | |
65 | 82 | }catch (Exception e){ |
66 | 83 | throw new ServiceException("sql错误"); |
67 | 84 | } |
... | ... | @@ -81,27 +98,12 @@ public class ShippingCombinationService { |
81 | 98 | } |
82 | 99 | |
83 | 100 | //根据sql查库存 |
84 | - list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll()); | |
101 | + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll(),shipmentPreference); | |
85 | 102 | return list; |
86 | 103 | } |
87 | 104 | |
88 | 105 | //都没有时,默认仓库的分配规则 |
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 | 106 | |
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 | 107 | //查找分配规则 |
106 | 108 | filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getCode,shipmentPreference.getAllocationRule()); |
107 | 109 | filterConfigDetail=filterConfigDetailService.getOne(filterConfigDetailLambdaQueryWrapper); |
... | ... | @@ -110,7 +112,7 @@ public class ShippingCombinationService { |
110 | 112 | } |
111 | 113 | |
112 | 114 | //根据sql查库存 |
113 | - list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll()); | |
115 | + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getSqll(),shipmentPreference); | |
114 | 116 | return list; |
115 | 117 | } |
116 | 118 | |
... | ... |