WmspReboundResultServiceImpl.java 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. package com.steerinfo.dil.service.impl;
  2. import com.steerinfo.dil.mapper.WmspGridMaterialMapper;
  3. import com.steerinfo.dil.mapper.WmspInboundResultMapper;
  4. import com.steerinfo.dil.mapper.WmspInboundScanResultMapper;
  5. import com.steerinfo.dil.model.*;
  6. import com.steerinfo.dil.service.*;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Service;
  9. import java.math.BigDecimal;
  10. import java.util.Date;
  11. import java.util.HashMap;
  12. import java.util.List;
  13. import java.util.Map;
  14. @Service
  15. public class WmspReboundResultServiceImpl implements WmsReboundResultService {
  16. @Autowired
  17. private RmsStackingServiceImpl rmsStackingService;
  18. @Autowired
  19. private RmsPwarehouseGridServiceImpl rmsPwarehouseGridService;
  20. @Autowired
  21. private WmspGridMaterialServiceImpl wmspGridMaterialService;
  22. @Autowired
  23. private WmsInboundResultServiceImpl wmsInboundResultService;
  24. @Autowired
  25. private WmsInboundDrivingResultServiceImpl wmsInboundDrivingResultService;
  26. @Autowired
  27. private WmsInboundScanResultServiceImpl wmsInboundScanResultService;
  28. @Autowired
  29. private WmsInboundStackResultServiceImpl wmsInboundStackResultService;
  30. @Autowired
  31. WmspInboundResultMapper wmspInboundResultMapper;
  32. @Autowired
  33. RmsMaterialSteelServiceImpl rmsMaterialSteelServiceImpl;
  34. @Autowired
  35. RmsMaterialServiceImpl rmsMaterialService;
  36. @Autowired
  37. WmspInboundScanResultMapper wmspInboundScanResultMapper;
  38. @Autowired
  39. WmspGridMaterialMapper wmspGridMaterialMapper;
  40. @Override
  41. public int addReboundResult(List<Map<String, Object>> mapList) {
  42. //新增退库实绩
  43. for (Map<String, Object> map : mapList) {
  44. BigDecimal ST = new BigDecimal(map.get("stackingId").toString());
  45. //获取退库单ID
  46. BigDecimal reboundId = new BigDecimal((Integer) map.get("inboundId"));
  47. //根据垛位ID查询物资数,确定层次层序,即网格ID
  48. HashMap<String, Object> map1 = new HashMap<>();
  49. map1.put("stackingId", ST);
  50. //获取物资数
  51. Integer MN = rmsStackingService.selectMaterialNumber(map1);
  52. //计算层次号
  53. Integer CC = (MN + 1) / 24 + 1;
  54. //计算层序号
  55. Integer CX = (MN + 1) % 24;
  56. //更新垛位表
  57. rmsStackingService.updateStack(ST);
  58. //根据仓库id、垛位ID,层次号,层序号查找仓储网格
  59. HashMap<String, Object> map3 = new HashMap<>();
  60. map3.put("warehouseId", 1);
  61. map3.put("stackingID", ST);
  62. map3.put("gradationNumber", CC);
  63. map3.put("sequenceNumber", CX);
  64. BigDecimal gridId = rmsPwarehouseGridService.getGridId(map3);
  65. /*
  66. 插入一条网格物资中间表
  67. */
  68. WmspGridMaterial wmspGridMaterial = new WmspGridMaterial();
  69. //设置主键ID
  70. wmspGridMaterial.setGmId(wmspGridMaterialMapper.getCount());
  71. wmspGridMaterial.setGridId(gridId);
  72. wmspGridMaterial.setGmNumber(new BigDecimal(1));
  73. //设置网格物资表里面的物资ID
  74. BigDecimal materialId = (BigDecimal) map.get("materialId");
  75. wmspGridMaterial.setMaterialId(materialId);
  76. //设置标准字段
  77. wmspGridMaterial.setStandardDataId(new BigDecimal(1));
  78. //设置逻辑删除字段
  79. wmspGridMaterial.setDeleted(new BigDecimal(0));
  80. //设置常规字段
  81. wmspGridMaterial.setInsertUsername("admin");
  82. wmspGridMaterial.setInsertTime(new Date());
  83. wmspGridMaterial.setUpdateUsername("admin");
  84. wmspGridMaterial.setUpdateTime(new Date());
  85. wmspGridMaterial.setInsertUpdateRemark("无");
  86. wmspGridMaterialService.insertWmspGridMaterial(wmspGridMaterial);
  87. /*
  88. 根据退库实绩ID,更新退库实绩表
  89. */
  90. HashMap<String, Object> map9 = new HashMap<>();
  91. map9.put("inboundId", reboundId);
  92. map9.put("GridId", gridId);
  93. wmsInboundResultService.updateReboundResult(map9);
  94. /*
  95. 新增行车工接收实绩
  96. */
  97. WmspInboundDrivingResult wmspInboundDrivingResult = new WmspInboundDrivingResult();
  98. wmspInboundDrivingResult.setDrivingId(new BigDecimal(wmsInboundDrivingResultService.count() + 1));
  99. wmspInboundDrivingResult.setDriverId(new BigDecimal(3));
  100. wmspInboundDrivingResult.setDrivingReceiveTime(new Date());
  101. wmspInboundDrivingResult.setInboundResultId(reboundId);
  102. wmspInboundDrivingResult.setInsertUsername("admin");
  103. wmspInboundDrivingResult.setInsertTime(new Date());
  104. wmspInboundDrivingResult.setUpdateUsername("admin");
  105. wmspInboundDrivingResult.setUpdateTime(new Date());
  106. wmspInboundDrivingResult.setInsertUpdateRemark("无");
  107. wmspInboundDrivingResult.setResultDeleted(new BigDecimal(0));
  108. /*
  109. 新增选择垛位实绩
  110. */
  111. WmspInboundStackResult wmspInboundStackResult = new WmspInboundStackResult();
  112. wmspInboundStackResult.setResultId(new BigDecimal(wmsInboundStackResultService.count() + 1));
  113. wmspInboundStackResult.setInboundResultId(reboundId);
  114. wmspInboundStackResult.setStackingId(ST);
  115. wmspInboundStackResult.setResultDeleted(new BigDecimal(1));
  116. //设置常规字段
  117. wmspInboundStackResult.setInsertUsername("admin");
  118. wmspInboundStackResult.setInsertTime(new Date());
  119. wmspInboundStackResult.setUpdateUsername("admin");
  120. wmspInboundStackResult.setUpdateTime(new Date());
  121. wmspInboundStackResult.setInsertUpdateRemark("无");
  122. /*
  123. 编辑扫描实绩-根据前台返回的扫描实绩ID修改扫描实绩
  124. */
  125. BigDecimal RESULTID = new BigDecimal((Integer) map.get("RESULTID"));
  126. HashMap<String, Object> map5 = new HashMap<>();
  127. map5.put("RESULTID", RESULTID);
  128. wmsInboundScanResultService.updateWmsReboundScanById(map5);
  129. }
  130. return 5;
  131. }
  132. @Override
  133. public int IssueToCrane(Map<String, Object> map) {
  134. //下发给行车工
  135. return 0;
  136. }
  137. }