|
@@ -4,12 +4,14 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.steerinfo.dil.mapper.RulesMapper;
|
|
|
import com.steerinfo.dil.mapper.TmstruckMeasureCommissionMapper;
|
|
|
+import com.steerinfo.dil.mapper.UtilsMapper;
|
|
|
import com.steerinfo.dil.model.TmstruckMeasureCommission;
|
|
|
import com.steerinfo.dil.service.ITmstruckMeasureCommissionService;
|
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
import com.steerinfo.dil.util.HTTPRequestUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
@@ -36,6 +38,10 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
|
|
|
@Autowired
|
|
|
private RulesMapper rulesMapper;
|
|
|
+ @Autowired
|
|
|
+ UtilsMapper utilsMapper;
|
|
|
+ @Autowired
|
|
|
+ private RulesServiceImpl rulesService;
|
|
|
/**
|
|
|
* 查询计量委托 0 :计皮 1:计毛
|
|
|
* @param map orderTypee 订单类型 type 是计皮还是计毛
|
|
@@ -87,6 +93,9 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
//发送数据给计量系统 必要数据 orderTypee:订单类型 resultTotalId: 总实绩Id orderId
|
|
|
//获取当前订单是属于哪个厂区订单
|
|
|
Integer receiveId = 0 ;
|
|
|
+ if (DataChange.dataToBigDecimal(map.get("orderTypee")).intValue() == 11){//判断如果是纯内转,向达州钢铁发送委托
|
|
|
+ i += sendMeasureCommissionMes(map);
|
|
|
+ }
|
|
|
if(DataChange.dataToBigDecimal(map.get("orderTypee")).intValue() == 10){
|
|
|
receiveId = tmstruckMeasureCommissionMapper.getReceiveIdByRequirementOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
}else{
|
|
@@ -101,22 +110,38 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
//发送委托给达兴能源
|
|
|
i += sendDXMeasureCommissionMes(map);
|
|
|
}
|
|
|
+
|
|
|
return i;
|
|
|
}
|
|
|
//发送计量委托
|
|
|
@Override
|
|
|
- public int sendMeasureCommssion(Map<String, Object> map) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int sendMeasureCommssion(Map<String, Object> map) throws Exception {
|
|
|
+ int i=0;
|
|
|
//获取订单类型
|
|
|
- Integer orderType = (Integer) map.get("orderTypee");
|
|
|
+ BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
|
|
|
+ BigDecimal orderType = utilsMapper.getOrderTypeByOrderId(orderId);
|
|
|
+ //根据运输订单id查找运输订单号
|
|
|
switch (orderType.intValue()){
|
|
|
- case 1:
|
|
|
+ case 1: //查询未装车实绩
|
|
|
+ List<Map<String, Object>> mapList = rulesService.judgeLastMaterial(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ map.put("materialId", mapList.get(0).get("materialId"));
|
|
|
+ i+=addXSMeasureCommission(map);
|
|
|
case 2:
|
|
|
- case 3:addXSMeasureCommission(map);
|
|
|
- break;
|
|
|
+ case 3: //通过物资ID查询订单ID(针对单拼)
|
|
|
+ List<Integer> materialIdList = utilsMapper.getMaterialIdByOrderId(orderId);
|
|
|
+ map.put("materialId", materialIdList.get(0));
|
|
|
+ i+=addXSMeasureCommission(map);
|
|
|
+ break;
|
|
|
case 12:
|
|
|
case 13:
|
|
|
case 15:
|
|
|
- case 16:addLXMeasureCommission(map);
|
|
|
+ case 20:
|
|
|
+ case 16: //发送计量委托(查询物资顺序第一个装卸货的物资)
|
|
|
+ //拿到需要计量的物资ID
|
|
|
+ Integer materialId = utilsMapper.getLxFirstMaterialId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ map.put("materialId", materialId);
|
|
|
+ i+=addLXMeasureCommission(map);
|
|
|
break;
|
|
|
case 5:
|
|
|
case 6:
|
|
@@ -124,10 +149,20 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
case 8:
|
|
|
case 9:
|
|
|
case 17:
|
|
|
- case 18:
|
|
|
+ case 18://通过订单ID查询物资Id
|
|
|
+ List<Integer> materialIds = utilsMapper.getMaterialIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ map.put("materialId", materialIds.get(0));
|
|
|
+ i+=addMaoMeasureCommission(map);
|
|
|
+ break;
|
|
|
+ case 10:
|
|
|
+ case 11:
|
|
|
+ i+=addMaoMeasureCommission(map);
|
|
|
|
|
|
}
|
|
|
- return 0;
|
|
|
+ if (i==0){
|
|
|
+ throw new Exception("委托发送失败");
|
|
|
+ }
|
|
|
+ return i;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -266,6 +301,8 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
|
|
|
measureCommission.put("IsAssembly", false);
|
|
|
measureCommission.put("deliveryMethod", "磅重交货");
|
|
|
measureCommission.put("packagesNum", 0);
|
|
|
+ measureCommission.put("ReceivUnit","四川省达州钢铁集团有限责任公司");
|
|
|
+ measureCommission.put("sendUnit","四川省达州钢铁集团有限责任公司");
|
|
|
break;
|
|
|
case 4:
|
|
|
break;
|