Commit 8f1811b14c7c3f33fda2c329631f908d89974e43

Authored by yeqianyong
1 parent 725e51f0

楚江erp:获取生产工艺历史数据逻辑调整

... ... @@ -858,70 +858,39 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
858 858 if (CollectionUtils.isEmpty(orderLineList)) {
859 859 throw new DefaultClientException("订货单物料行数据不存在!");
860 860 }
  861 + List<String> proProcessList = new ArrayList<>();
861 862 String orderingUnit = orderInfo.getOrderingUnit();
862 863 String workshopId = orderInfo.getWorkshopId();
863   - List<String> industryList = new ArrayList<>();
864   - List<String> brandList = new ArrayList<>();
865   - List<String> statusList = new ArrayList<>();
866   - List<BigDecimal> thicknessList = new ArrayList<>();
867   - List<BigDecimal> thicknessTolNegList = new ArrayList<>();
868   - List<BigDecimal> thicknessTolPosList = new ArrayList<>();
869   - List<BigDecimal> widthList = new ArrayList<>();
870   - List<BigDecimal> widthTolNegList = new ArrayList<>();
871   - List<BigDecimal> widthTolPosList = new ArrayList<>();
872 864 for (PurchaseOrderLine orderLine : orderLineList) {
873 865 String industry = orderLine.getIndustry();
874   - if (StringUtils.isNotBlank(industry) && !industryList.contains(industry)) {
875   - industryList.add(industry);
876   - }
877 866 String brand = orderLine.getBrand();
878   - if (StringUtils.isNotBlank(brand) && !brandList.contains(brand)) {
879   - brandList.add(brand);
880   - }
881 867 String status = orderLine.getStatus();
882   - if (StringUtils.isNotBlank(status) && !statusList.contains(status)) {
883   - statusList.add(status);
884   - }
885 868 BigDecimal thickness = orderLine.getThickness();
886   - if (thickness != null && !isValueExists(thicknessList, thickness)) {
887   - thicknessList.add(thickness);
888   - }
889 869 BigDecimal thicknessTolNeg = orderLine.getThicknessTolNeg();
890   - if (thicknessTolNeg != null && !isValueExists(thicknessTolNegList, thicknessTolNeg)) {
891   - thicknessTolNegList.add(thicknessTolNeg);
892   - }
893 870 BigDecimal thicknessTolPos = orderLine.getThicknessTolPos();
894   - if (thicknessTolPos != null && !isValueExists(thicknessTolPosList, thicknessTolPos)) {
895   - thicknessTolPosList.add(thicknessTolPos);
896   - }
897 871 BigDecimal width = orderLine.getWidth();
898   - if (width != null && !isValueExists(widthList, width)) {
899   - widthList.add(width);
900   - }
901 872 BigDecimal widthTolNeg = orderLine.getWidthTolNeg();
902   - if (widthTolNeg != null && !isValueExists(widthTolNegList, widthTolNeg)) {
903   - widthTolNegList.add(widthTolNeg);
904   - }
905 873 BigDecimal widthTolPos = orderLine.getWidthTolPos();
906   - if (widthTolPos != null && !isValueExists(widthTolPosList, widthTolPos)) {
907   - widthTolPosList.add(widthTolPos);
  874 +
  875 + Map<String, Object> params = new HashMap<>();
  876 + params.put("orderId", orderId);
  877 + params.put("orderingUnit", orderingUnit);
  878 + params.put("workshopId", workshopId);
  879 + params.put("industry", industry);
  880 + params.put("brand", brand);
  881 + params.put("status", status);
  882 + params.put("thickness", thickness);
  883 + params.put("thicknessTolNeg", thicknessTolNeg);
  884 + params.put("thicknessTolPos", thicknessTolPos);
  885 + params.put("width", width);
  886 + params.put("widthTolNeg", widthTolNeg);
  887 + params.put("widthTolPos", widthTolPos);
  888 +
  889 + String proProcess = getBaseMapper().queryHisProProcess(params);
  890 + if (StringUtils.isNotBlank(proProcess) && !proProcessList.contains(proProcess)) {
  891 + proProcessList.add(proProcess);
908 892 }
909 893 }
910   - Map<String, Object> params = new HashMap<>();
911   - params.put("orderId", orderId);
912   - params.put("orderingUnit", orderingUnit);
913   - params.put("workshopId", workshopId);
914   - params.put("industryList", industryList);
915   - params.put("brandList", brandList);
916   - params.put("statusList", statusList);
917   - params.put("thicknessList", thicknessList);
918   - params.put("thicknessTolNegList", thicknessTolNegList);
919   - params.put("thicknessTolPosList", thicknessTolPosList);
920   - params.put("widthList", widthList);
921   - params.put("widthTolNegList", widthTolNegList);
922   - params.put("widthTolPosList", widthTolPosList);
923   -
924   - List<String> proProcessList = getBaseMapper().queryHisProProcess(params);
925 894 if (CollectionUtils.isEmpty(proProcessList)) {
926 895 return "";
927 896 }
... ...
... ... @@ -52,5 +52,5 @@ public interface PurchaseOrderInfoMapper extends BaseMapper<PurchaseOrderInfo> {
52 52 * @param params 查询参数
53 53 * @return List<String>
54 54 */
55   - List<String> queryHisProProcess(@Param("params") Map<String, Object> params);
  55 + String queryHisProProcess(@Param("params") Map<String, Object> params);
56 56 }
... ...
... ... @@ -296,105 +296,78 @@
296 296 where o.ordering_unit = #{params.orderingUnit} and o.workshop_id = #{params.workshopId}
297 297 and o.production_process is not null
298 298 <choose>
299   - <when test="params.industryList != null and params.industryList.size() > 0">
300   - and ol.industry in
301   - <foreach collection="params.industryList" open="(" separator="," close=")" item="item">
302   - #{item}
303   - </foreach>
  299 + <when test="params.industry != null and params.industry != ''">
  300 + and ol.industry = #{params.industry}
304 301 </when>
305 302 <otherwise>
306 303 and (ol.industry is null or ol.industry = '')
307 304 </otherwise>
308 305 </choose>
309 306 <choose>
310   - <when test="params.brandList != null and params.brandList.size() > 0">
311   - and ol.brand in
312   - <foreach collection="params.brandList" open="(" separator="," close=")" item="item">
313   - #{item}
314   - </foreach>
  307 + <when test="params.brand != null and params.brand != ''">
  308 + and ol.brand = #{params.brand}
315 309 </when>
316 310 <otherwise>
317 311 and (ol.brand is null or ol.brand = '')
318 312 </otherwise>
319 313 </choose>
320 314 <choose>
321   - <when test="params.statusList != null and params.statusList.size() > 0">
322   - and ol.status in
323   - <foreach collection="params.statusList" open="(" separator="," close=")" item="item">
324   - #{item}
325   - </foreach>
  315 + <when test="params.status != null and params.status != ''">
  316 + and ol.status = #{params.status}
326 317 </when>
327 318 <otherwise>
328 319 and (ol.status is null or ol.status = '')
329 320 </otherwise>
330 321 </choose>
331 322 <choose>
332   - <when test="params.thicknessList != null and params.thicknessList.size() > 0">
333   - and ol.thickness in
334   - <foreach collection="params.thicknessList" open="(" separator="," close=")" item="item">
335   - #{item}
336   - </foreach>
  323 + <when test="params.thickness != null">
  324 + and ol.thickness = #{params.thickness}
337 325 </when>
338 326 <otherwise>
339 327 and ol.thickness is null
340 328 </otherwise>
341 329 </choose>
342 330 <choose>
343   - <when test="params.thicknessTolNegList != null and params.thicknessTolNegList.size() > 0">
344   - and ol.thickness_tol_neg in
345   - <foreach collection="params.thicknessTolNegList" open="(" separator="," close=")" item="item">
346   - #{item}
347   - </foreach>
  331 + <when test="params.thicknessTolNeg != null">
  332 + and ol.thickness_tol_neg = #{params.thicknessTolNeg}
348 333 </when>
349 334 <otherwise>
350 335 and ol.thickness_tol_neg is null
351 336 </otherwise>
352 337 </choose>
353 338 <choose>
354   - <when test="params.thicknessTolPosList != null and params.thicknessTolPosList.size() > 0">
355   - and ol.thickness_tol_pos in
356   - <foreach collection="params.thicknessTolPosList" open="(" separator="," close=")" item="item">
357   - #{item}
358   - </foreach>
  339 + <when test="params.thicknessTolPos != null">
  340 + and ol.thickness_tol_pos = #{params.thicknessTolPos}
359 341 </when>
360 342 <otherwise>
361 343 and ol.thickness_tol_pos is null
362 344 </otherwise>
363 345 </choose>
364 346 <choose>
365   - <when test="params.widthList != null and params.widthList.size() > 0">
366   - and ol.width in
367   - <foreach collection="params.widthList" open="(" separator="," close=")" item="item">
368   - #{item}
369   - </foreach>
  347 + <when test="params.width != null">
  348 + and ol.width = #{params.width}
370 349 </when>
371 350 <otherwise>
372 351 and ol.width is null
373 352 </otherwise>
374 353 </choose>
375 354 <choose>
376   - <when test="params.widthTolNegList != null and params.widthTolNegList.size() > 0">
377   - and ol.width_tol_neg in
378   - <foreach collection="params.widthTolNegList" open="(" separator="," close=")" item="item">
379   - #{item}
380   - </foreach>
  355 + <when test="params.widthTolNeg != null">
  356 + and ol.width_tol_neg = #{params.widthTolNeg}
381 357 </when>
382 358 <otherwise>
383 359 and ol.width_tol_neg is null
384 360 </otherwise>
385 361 </choose>
386 362 <choose>
387   - <when test="params.widthTolPosList != null and params.widthTolPosList.size() > 0">
388   - and ol.width_tol_pos in
389   - <foreach collection="params.widthTolPosList" open="(" separator="," close=")" item="item">
390   - #{item}
391   - </foreach>
  363 + <when test="params.widthTolPos != null">
  364 + and ol.width_tol_pos = #{params.widthTolPos}
392 365 </when>
393 366 <otherwise>
394 367 and ol.width_tol_pos is null
395 368 </otherwise>
396 369 </choose>
397   - group by o.production_process
398   - order by max(o.update_time) desc
  370 + order by o.update_time desc
  371 + limit 1
399 372 </select>
400 373 </mapper>
... ...