Kaynağa Gözat

Merge branch 'dev' of https://git.steerinfo.com/luobang/DIL-DAZHOU-WMS2 into dev

Tiroble 3 yıl önce
ebeveyn
işleme
9ad3549d9a

+ 6 - 1
src/main/java/com/steerinfo/dil/controller/WmspOutboundResultController.java

@@ -446,7 +446,12 @@ public class WmspOutboundResultController extends BaseRESTfulController {
     @ApiImplicitParam(name = "resultId",dataType = "BigDecimal",value = "出库实绩Id")
     @PostMapping("/outbountResultToSuccess")
     public RESTfulResult sureOutbount(@RequestParam BigDecimal resultId){
-        int result = wmspOutboundResultService.sureOutbount(resultId);
+        int result = 0;
+        try {
+            result = wmspOutboundResultService.sureOutbount(resultId);
+        } catch (Exception e) {
+            return failed(2, e.getMessage());
+        }
         if(result == 1){
             return success(1,"该类型已出库");
         }

+ 3 - 2
src/main/java/com/steerinfo/dil/feign/TmstruckFeign.java

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @Description:
@@ -17,6 +18,6 @@ import java.util.HashMap;
 @FeignClient(value = "DIL-TMS-TRUCK-DEV", url = "${openfeign.TmsTruckFeign.url}")
 public interface TmstruckFeign {
 
-    @PostMapping("/api/v1/tmsTruck/tmstruckloadresults")
-    Integer addSaleLoadResult(@RequestParam Integer orderId);
+    @PostMapping("/api/v1/truckTms/tmstruckloadresults/addSaleLoadResult")
+    Map<String, Object> addSaleLoadResult(@RequestBody Map<String, Object> map);
 }

+ 6 - 0
src/main/java/com/steerinfo/dil/mapper/WmspOutboundResultMapper.java

@@ -4,6 +4,7 @@ import com.steerinfo.dil.model.WmspOutboundResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -80,4 +81,9 @@ public interface WmspOutboundResultMapper extends IBaseMapper<WmspOutboundResult
     List<Map<String, Object>> selectOutResult(Map<String, Object> mapval);
 
     List<Map<String, Object>> getWmsOutboundResultStatistics(Map<String, Object> mapValue);
+
+    Map<String, Object> getOutboundMesByMateAndResultId(@Param("resultId") BigDecimal resultId, @Param("materialId")BigDecimal materialId);
+
+    //通过钢材物资ID查询仓库Id
+    Integer getWarehouseIdBySteelMaterialId(BigDecimal steelMaterialId);
 }

+ 1 - 1
src/main/java/com/steerinfo/dil/service/IWmspOutboundResultService.java

@@ -85,7 +85,7 @@ public interface IWmspOutboundResultService {
     //删除实时库存
     int deleteGridMaterial(String materialOnlyCode);
 
-    int sureOutbount(BigDecimal resultId);
+    int sureOutbount(BigDecimal resultId) throws Exception;
 
     List<Map<String, Object>> getWmsOutboundResultStatistics(Map<String, Object> mapValue);
 }

+ 6 - 2
src/main/java/com/steerinfo/dil/service/impl/WmsInboundScanResultServiceImpl.java

@@ -275,9 +275,13 @@ public class WmsInboundScanResultServiceImpl implements IWmsInboundScanResultSer
         //设置主键自增,这里需要修改
         wmspInboundScanResult.setId(count());
         //获取班次次序的吊牌信息
+
         String[] result = resultMaterial.split("-");
-        String shiftOrder = result[9];
-        wmspInboundScanResult.setShiftOrder(shiftOrder);
+        if(result.length == 10){
+            String shiftOrder = result[9];
+            wmspInboundScanResult.setShiftOrder(shiftOrder);
+        }
+
 
         //分组
         //根据用户名和分组状态查询到分组信息

+ 28 - 3
src/main/java/com/steerinfo/dil/service/impl/WmspOutboundResultServiceImpl.java

@@ -11,6 +11,7 @@ import com.steerinfo.dil.vo.OutBoundMaterialDetailedInfo;
 import com.steerinfo.dil.vo.OutBoundTypeDetailedInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
@@ -419,9 +420,9 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
     }
 
 
-
     @Override
-    public int sureOutbount(BigDecimal resultId) {
+    @Transactional(rollbackFor = Exception.class)
+    public int sureOutbount(BigDecimal resultId) throws Exception {
         //查询提货单,没有确定出库物资类型集合
         List<OutBoundTypeDetailedInfo> outBoundTypeDetailedInfos= wmspOutboundResultMaterialService.getOutBoundTypeDetailedInfo(resultId,1);
         //查询出库扫描实绩,并且在实时库存没有删除的出库扫描实绩
@@ -454,7 +455,7 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
                 typeDetailedInfo.setScanCodeNumber(count);
 
                 //统计,并且判断是否有某种物资已经扫满了
-                if (typeDetailedInfo.getNumber()==typeDetailedInfo.getScanCodeNumber()){
+                if (typeDetailedInfo.getNumber().equals(typeDetailedInfo.getScanCodeNumber())){
                     //如果有某一种物资扫满了,需要将这一类物资,在实时库存删除,并且修改出库物资类型状态,发送计量委托
                     int cunt= wmspGridMaterialService.deleteGridMaterial(thisMaterialDetailedInfos);
                     cunt2=wmspOutboundResultMaterialService.updateStatus(typeDetailedInfo.getResultMaterialId());
@@ -462,9 +463,11 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
                     if (outBoundTypeDetailedInfos==null||outBoundTypeDetailedInfos.size()-cunt2==0){
                         int cunt3=wmspOutboundResultMapper.updateStatus(resultId);
                         //表示全部完成
+                        finishLoadResult(outBoundMaterialDetailedInfos.get(0), resultId);
                         return 2;
                     }
                     //表示一项完成
+                    finishLoadResult(outBoundMaterialDetailedInfos.get(0), resultId);
                     return cunt2;
                 }
 
@@ -477,6 +480,28 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
         return 0;
     }
 
+    /**
+     * Notes:完成出库调用装车实绩
+     * @Author: TXF
+     * @DateTime: 2022/3/24 21:10
+     */
+    public void finishLoadResult(OutBoundMaterialDetailedInfo outBoundMaterialDetailedInfo, BigDecimal resultId) throws Exception {
+        BigDecimal materialId = new BigDecimal(outBoundMaterialDetailedInfo.getMaterialId());
+        //通过物资ID和出库实绩ID查询相关数据 :运输订单ID 物资ID 装车开始时间 备注
+        Map<String, Object> mesMap = wmspOutboundResultMapper.getOutboundMesByMateAndResultId(resultId, materialId);
+        //通过钢材物资ID查询仓库ID
+        Integer warehouseId = wmspOutboundResultMapper.getWarehouseIdBySteelMaterialId(new BigDecimal(outBoundMaterialDetailedInfo.getMaterialSteelId()));
+        mesMap.put("materialId", materialId);
+        mesMap.put("warehouseId", warehouseId);
+        Map<String, Object> returnMap = tmstruckFeign.addSaleLoadResult(mesMap);
+        String code = (String) returnMap.get("code");
+        if("200".equals(code)){
+            System.out.println("新增装车成功:" + mesMap.get("orderId"));
+        }else {
+            throw new Exception("新增装车失败");
+        }
+    }
+
     @Override
     public List<Map<String, Object>> getWmsOutboundResultStatistics(Map<String, Object> mapValue) {
         return wmspOutboundResultMapper.getWmsOutboundResultStatistics(mapValue);

+ 1 - 1
src/main/resources/application-dev.yml

@@ -27,5 +27,5 @@ piction:
 
 
 server:
-  port: 8093
+  port: 8012
 

+ 11 - 8
src/main/resources/bootstrap.yml

@@ -13,14 +13,17 @@ spring:
     static-path-pattern:
 
 #eureka设置
-#eureka:
-#  client:
-#    service-url:
-#      defaultZone: http://root:root@${EUREKA_HOST:172.16.33.161}:${EUREKA_PORT:8081}/eureka/
-#  instance:
-#    prefer-ip-address: true
-#    status-page-url: http://${spring.cloud.client.ip-address}:${server.port}/swagger-ui.html#/
-#    instance-id: ${spring.cloud.client.ip-address}:${server.port}
+eureka:
+  client:
+    service-url:
+      defaultZone: http://root:root@${EUREKA_HOST:172.16.33.161}:${EUREKA_PORT:8081}/eureka/
+    register-with-eureka: false #表示向EurekaServer注册自己 默认为true
+    fetch-registry: false #是否从EurekaServer抓取已有的注册信息,默认为true,单节点无所谓,集群必须设置为true才能配合ribbon使用负载均衡
+
+  instance:
+    prefer-ip-address: true
+    status-page-url: http://${spring.cloud.client.ip-address}:${server.port}/swagger-ui.html#/
+    instance-id: ${spring.cloud.client.ip-address}:${server.port}
 
 genxml:
   pth: com/a

+ 22 - 0
src/main/resources/com/steerinfo/dil/mapper/WmspOutboundResultMapper.xml

@@ -1142,6 +1142,28 @@
     </where>
      <include refid="orderBy"></include>
   </select>
+
+  <select id="getOutboundMesByMateAndResultId" resultType="java.util.Map">
+    select
+           MIN(WOSR.RESULT_LOAD_TIME)   "loadStartTime",
+           WOR.BILL_LADING_ID           "orderId",
+           WOSR.LOAD_ID                "loadId",
+           WOR.INSERT_UPDATE_REMARK    "insertUpdateRemark"
+
+    from WMSP_OUTBOUND_RESULT WOR
+    LEFT JOIN WMSP_OUTBOUND_RESULT_MATERIAL WORM on WOR.RESULT_ID = WORM.OUTBOUND_RESULT_ID
+    LEFT JOIN WMSP_OUTBOUND_SCAN_RESULT WOSR ON WORM.RESULT_MATERIAL_ID = WOSR.RESULT_MATERIAL_ID
+    WHERE WOR.RESULT_ID = #{resultId} and WORM.MATERIAL_ID = #{materialId}
+    group by WOSR.LOAD_ID, WOR.INSERT_UPDATE_REMARK,WOR.BILL_LADING_ID
+  </select>
+
+  <select id="getWarehouseIdBySteelMaterialId" parameterType="java.math.BigDecimal" resultType="int">
+    select RPG.WAREHOUSE_ID
+    from WMSP_GRID_MATERIAL WGM
+           LEFT JOIN RMS_PWAREHOUSE_GRID RPG on WGM.GRID_ID = RPG.GRID_ID
+    where WGM.MATERIAL_ID = #{steelMaterialId} and rownum = 1
+  </select>
+
   <sql id="orderBy">
     <if test="orderField != null and orderField != ''">
       order by "${orderField}"