Commit f052401c8e86d83b3c572f083f5dc6a7ab251615
1 parent
f53fb3ad
报错修改,以及库存分配规则加入物料种类
Showing
4 changed files
with
27 additions
and
4 deletions
src/main/java/com/huaheng/pc/receipt/receiving/service/ReceivingService.java
... | ... | @@ -97,14 +97,16 @@ public class ReceivingService { |
97 | 97 | if (StringUtils.isEmpty(locatingRule)){ |
98 | 98 | //入库单明细为空时,查询物料表中是否含有定位规则 |
99 | 99 | LambdaQueryWrapper<Material> materialLambda = Wrappers.lambdaQuery(); |
100 | - materialLambda.eq(Material::getCode, receiptContainerDetail.getMaterialCode()); | |
100 | + materialLambda.eq(Material::getCode, receiptContainerDetail.getMaterialCode()) | |
101 | + .eq(Material::getWarehouseCode,ShiroUtils.getWarehouseCode()); | |
101 | 102 | Material material = materialService.getOne(materialLambda); |
102 | 103 | locatingRule = material.getLocatingRule(); |
103 | 104 | |
104 | 105 | if (StringUtils.isEmpty(locatingRule)){ |
105 | 106 | //物料表中定位规则为空时,查询物料类别 |
106 | 107 | LambdaQueryWrapper<MaterialType> materialTypeLambda = Wrappers.lambdaQuery(); |
107 | - materialTypeLambda.eq(MaterialType::getCode, material.getType()); | |
108 | + materialTypeLambda.eq(MaterialType::getCode, material.getType()) | |
109 | + .eq(MaterialType::getWarehouseCode,ShiroUtils.getWarehouseCode()); | |
108 | 110 | MaterialType materialType = materialTypeService.getOne(materialTypeLambda); |
109 | 111 | locatingRule = materialType.getLocatingRule(); |
110 | 112 | if (StringUtils.isEmpty(locatingRule)){ |
... | ... |
src/main/java/com/huaheng/pc/shipment/shipmentContainerHeader/service/ShipmentContainerHeaderServiceImpl.java
... | ... | @@ -535,7 +535,7 @@ public class ShipmentContainerHeaderServiceImpl extends ServiceImpl<ShipmentCont |
535 | 535 | } |
536 | 536 | } |
537 | 537 | if(num==shipmentDetailList.size()){ |
538 | - throw new ServiceException("单据物料在此库区没有库存,无法出库"); | |
538 | + throw new ServiceException("单据物料的库存分配规则在此库区没有库存,无法出库"); | |
539 | 539 | } |
540 | 540 | return AjaxResult.success("成功",list); |
541 | 541 | } |
... | ... |
src/main/java/com/huaheng/pc/shipment/shippingCombination/service/ShippingCombinationService.java
... | ... | @@ -11,6 +11,8 @@ import com.huaheng.pc.config.configValue.domain.ConfigValue; |
11 | 11 | import com.huaheng.pc.config.configValue.service.ConfigValueService; |
12 | 12 | import com.huaheng.pc.config.material.domain.Material; |
13 | 13 | import com.huaheng.pc.config.material.service.MaterialServiceImpl; |
14 | +import com.huaheng.pc.config.materialType.domain.MaterialType; | |
15 | +import com.huaheng.pc.config.materialType.service.MaterialTypeService; | |
14 | 16 | import com.huaheng.pc.config.shipmentPreference.domain.ShipmentPreference; |
15 | 17 | import com.huaheng.pc.config.shipmentPreference.service.ShipmentPreferenceService; |
16 | 18 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
... | ... | @@ -41,6 +43,8 @@ public class ShippingCombinationService { |
41 | 43 | ShipmentPreferenceService shipmentPreferenceService; |
42 | 44 | @Autowired |
43 | 45 | MaterialServiceImpl materialService; |
46 | + @Autowired | |
47 | + MaterialTypeService materialTypeService; | |
44 | 48 | |
45 | 49 | |
46 | 50 | |
... | ... | @@ -102,6 +106,23 @@ public class ShippingCombinationService { |
102 | 106 | return list; |
103 | 107 | } |
104 | 108 | |
109 | + //物料的分配规则没有时,优先物料种类的分配规则 | |
110 | + LambdaQueryWrapper<MaterialType> materialTypelam=Wrappers.lambdaQuery(); | |
111 | + materialTypelam.eq(MaterialType::getCode,material.getType()) | |
112 | + .eq(MaterialType::getWarehouseCode,shipmentDetail.getWarehouseCode()); | |
113 | + MaterialType materialType=materialTypeService.getOne(materialTypelam); | |
114 | + if(StringUtils.isNotEmpty(materialType.getAllocationRule())){ | |
115 | + filterConfigDetailLambdaQueryWrapper.eq(FilterConfigDetail::getCode,materialType.getAllocationRule()); | |
116 | + filterConfigDetail=filterConfigDetailService.getOne(filterConfigDetailLambdaQueryWrapper); | |
117 | + if(filterConfigDetail==null){ | |
118 | + throw new ServiceException("物料种类出库规则配置不存在"); | |
119 | + } | |
120 | + | |
121 | + //根据sql查库存 | |
122 | + list=inventoryDetailService.selectBysql(filterConfigDetail.getStatement(),shipmentDetail,filterConfigDetail.getStatements(),shipmentPreference); | |
123 | + return list; | |
124 | + } | |
125 | + | |
105 | 126 | //都没有时,默认仓库的分配规则 |
106 | 127 | |
107 | 128 | //查找分配规则 |
... | ... |
src/main/resources/mybatis/task/TaskHeaderMapper.xml
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | <select id="getReceiptTask" resultType="java.util.Map"> |
48 | 48 | SELECT rd.id receiptDetailId,rd.receiptId,td.taskId, td.warehouseCode, td.id taskDetailId, td.status, |
49 | 49 | td.containerCode, td.qty, td.materialCode,rd.totalQty,td.materialSpec, |
50 | - rd.receiptCode,td.inventorySts, | |
50 | + rd.receiptCode,rd.inventorySts, | |
51 | 51 | td.materialName, rd.batch, rd.lot, |
52 | 52 | rd.manufactureDate, rd.expirationDate |
53 | 53 | FROM task_detail td |
... | ... |