Commit 987ca86bf2f45d509c8ea56b7c0ec45c601433b6

Authored by yeqianyong
1 parent fd6064ed

楚江erp:发货计划添加bug修复(包括自动生成)

@@ -172,8 +172,17 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP @@ -172,8 +172,17 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
172 } 172 }
173 vo.setWorkshopId(plan.getWorkshopId()); 173 vo.setWorkshopId(plan.getWorkshopId());
174 // 获取已经存在的明细数据 174 // 获取已经存在的明细数据
175 - List<String> orderSpecIds = getBaseMapper().getExistsOrderSpecIds(plan.getAfTomoPreShipDate());  
176 - if (CollectionUtils.isNotEmpty(orderSpecIds)) { 175 + LambdaQueryWrapper<ShipmentsPlanDetail> queryWrapper = Wrappers.lambdaQuery(ShipmentsPlanDetail.class);
  176 + queryWrapper.eq(ShipmentsPlanDetail::getPreShipments, Boolean.FALSE)
  177 + .eq(ShipmentsPlanDetail::getDelFlag, Boolean.FALSE);
  178 + List<ShipmentsPlanDetail> detailList = getBaseMapper().selectList(queryWrapper);
  179 + if (CollectionUtils.isNotEmpty(detailList)) {
  180 + List<String> orderSpecIds = detailList.stream().map(ShipmentsPlanDetail::getOrderSpecId).collect(Collectors.toList());
  181 + vo.setOrderSpecIds(orderSpecIds);
  182 + }
  183 + detailList = listByPlanId(plan.getId(), true);
  184 + if (CollectionUtils.isNotEmpty(detailList)) {
  185 + List<String> orderSpecIds = detailList.stream().map(ShipmentsPlanDetail::getOrderSpecId).collect(Collectors.toList());
177 vo.setOrderSpecIds(orderSpecIds); 186 vo.setOrderSpecIds(orderSpecIds);
178 } 187 }
179 // 开启分页 188 // 开启分页
@@ -254,10 +263,12 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP @@ -254,10 +263,12 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
254 orderIds.add(orderId); 263 orderIds.add(orderId);
255 } 264 }
256 } 265 }
257 - QueryShipmentsPlanDetailVo detailVo = new QueryShipmentsPlanDetailVo();  
258 - detailVo.setOrderSpecIds(orderSpecIds);  
259 - detailVo.setCompleted(Boolean.TRUE);  
260 - List<ShipmentsPlanDetail> detailList = query(detailVo); 266 + // 获取已经加入过发货计划中的数据
  267 + LambdaQueryWrapper<ShipmentsPlanDetail> queryWrapper = Wrappers.lambdaQuery(ShipmentsPlanDetail.class);
  268 + queryWrapper.in(ShipmentsPlanDetail::getOrderSpecId, orderSpecIds)
  269 + .eq(ShipmentsPlanDetail::getDelFlag, Boolean.FALSE)
  270 + .eq(ShipmentsPlanDetail::getPreShipments, Boolean.FALSE);
  271 + List<ShipmentsPlanDetail> detailList = getBaseMapper().selectList(queryWrapper);
261 if (CollectionUtils.isNotEmpty(detailList)) { 272 if (CollectionUtils.isNotEmpty(detailList)) {
262 List<String> orderSpecIdList = detailList.stream().map(ShipmentsPlanDetail::getOrderSpecId).distinct().collect(Collectors.toList()); 273 List<String> orderSpecIdList = detailList.stream().map(ShipmentsPlanDetail::getOrderSpecId).distinct().collect(Collectors.toList());
263 // 过滤掉已发货的数据 274 // 过滤掉已发货的数据
@@ -64,13 +64,4 @@ public interface ShipmentsPlanDetailMapper extends BaseMapper<ShipmentsPlanDetai @@ -64,13 +64,4 @@ public interface ShipmentsPlanDetailMapper extends BaseMapper<ShipmentsPlanDetai
64 * @return ShipmentsPlanDetail 64 * @return ShipmentsPlanDetail
65 */ 65 */
66 ShipmentsPlanDetail findById(@Param("id") String id); 66 ShipmentsPlanDetail findById(@Param("id") String id);
67 -  
68 - /**  
69 - * 获取已经存在的规格ID  
70 - * 包含预发数据  
71 - *  
72 - * @param shipmentsDate 发货日期  
73 - * @return List<String>  
74 - */  
75 - List<String> getExistsOrderSpecIds(LocalDate shipmentsDate);  
76 } 67 }
@@ -185,7 +185,8 @@ @@ -185,7 +185,8 @@
185 ol.length, 185 ol.length,
186 ol.length_tol_pos, 186 ol.length_tol_pos,
187 ol.length_tol_neg, 187 ol.length_tol_neg,
188 - ol.quantity 188 + ol.quantity,
  189 + ol.delivery_date as shipments_date
189 from tbl_purchase_order_line ol 190 from tbl_purchase_order_line ol
190 inner join purchase_order_info o on ol.purchase_order_id = o.id 191 inner join purchase_order_info o on ol.purchase_order_id = o.id
191 left join base_data_customer c on o.ordering_unit = c.id 192 left join base_data_customer c on o.ordering_unit = c.id
@@ -296,10 +297,4 @@ @@ -296,10 +297,4 @@
296 </if> 297 </if>
297 </where> 298 </where>
298 </select> 299 </select>
299 -  
300 - <select id="getExistsOrderSpecIds" resultType="java.lang.String">  
301 - select distinct tb.order_spec_id  
302 - from shipments_plan_detail tb  
303 - where tb.pre_shipments = false or (tb.pre_shipments = true and tb.shipments_date = #{shipmentsDate})  
304 - </select>  
305 </mapper> 300 </mapper>