|
@@ -1929,66 +1929,73 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Map<String, Object> updateCapacityNumberInFactory(Map<String, Object> mapValue) {
|
|
|
+ public Map<String, Object> updateCapacityNumberInFactory(Map<String, Object> mapValue) throws Exception {
|
|
|
Object lineSequence = mapValue.get("lineSequence");
|
|
|
int result = 0;
|
|
|
- try{
|
|
|
- //查询输入进来的车牌号是否与原有车牌号一致,如果一致则退出
|
|
|
- BigDecimal oldCapacityId = omstruckOrderMapper.getOldCapacityId(DataChange.dataToBigDecimal(mapValue.get("orderId")));
|
|
|
- if(oldCapacityId.compareTo(DataChange.dataToBigDecimal(mapValue.get("capacityId"))) == 0) {
|
|
|
- mapValue.put("result",1);
|
|
|
- return mapValue;
|
|
|
+ //查询输入进来的车牌号是否与原有车牌号一致,如果一致则退出
|
|
|
+ BigDecimal oldCapacityId = omstruckOrderMapper.getOldCapacityId(DataChange.dataToBigDecimal(mapValue.get("orderId")));
|
|
|
+ if(oldCapacityId.compareTo(DataChange.dataToBigDecimal(mapValue.get("capacityId"))) == 0) {
|
|
|
+ mapValue.put("result",1);
|
|
|
+ return mapValue;
|
|
|
+ }
|
|
|
+ Integer isCheckGps = amsSaleOrderMapper.getDispachSwitch();
|
|
|
+ String capacityNo = (String) mapValue.get("capacityNo");
|
|
|
+ if(isCheckGps!=null && isCheckGps==0){
|
|
|
+ Map<String,Object> data = (Map<String,Object>)otmsFeign.getCurrentLocation(capacityNo).getData();
|
|
|
+ Map<String,Object> locationResult = (Map<String,Object>)data.get("result");
|
|
|
+ int isGPS=amsSaleOrderMapper.isGPS(capacityNo);
|
|
|
+ if(isGPS > 0){
|
|
|
+ System.out.println(capacityNo+"允许无GPS派车");
|
|
|
+ }else if(locationResult==null || locationResult.get("lon")==null || locationResult.get("lat")==null){
|
|
|
+ throw new Exception("该车没有GPS定位信息,请联系销售公司物流部,申请是否可以派车。");
|
|
|
}
|
|
|
- String capacityNo = (String) mapValue.get("capacityNo");
|
|
|
- BigDecimal capacityTel = omstruckOrderMapper.getCapacityTel(capacityNo);
|
|
|
- if (capacityTel.compareTo(BigDecimal.ZERO)!=0){
|
|
|
- mapValue.put("capacityTel",capacityTel);
|
|
|
- }else {
|
|
|
- mapValue.put("capacityTel",0);
|
|
|
+ }
|
|
|
+ BigDecimal capacityTel = omstruckOrderMapper.getCapacityTel(capacityNo);
|
|
|
+ if (capacityTel.compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ mapValue.put("capacityTel",capacityTel);
|
|
|
+ }else {
|
|
|
+ mapValue.put("capacityTel",0);
|
|
|
+ }
|
|
|
+ if (lineSequence == null || "0".equals(lineSequence.toString()) || "1".equals(lineSequence.toString()) || "2".equals(lineSequence.toString())) {
|
|
|
+ String capacityids="";
|
|
|
+ Integer capacityid1= (Integer) mapValue.get("capacityIds");
|
|
|
+ Integer capacityid2= (Integer) mapValue.get("capacityId");
|
|
|
+ if (capacityid1!=null && !("".equals(capacityid1))){
|
|
|
+ capacityids=capacityid1+","+capacityid2;
|
|
|
}
|
|
|
- if (lineSequence == null || "0".equals(lineSequence.toString()) || "1".equals(lineSequence.toString()) || "2".equals(lineSequence.toString())) {
|
|
|
- String capacityids="";
|
|
|
- Integer capacityid1= (Integer) mapValue.get("capacityIds");
|
|
|
- Integer capacityid2= (Integer) mapValue.get("capacityId");
|
|
|
- if (capacityid1!=null && !("".equals(capacityid1))){
|
|
|
- capacityids=capacityid1+","+capacityid2;
|
|
|
- }
|
|
|
- mapValue.put("capacityids",capacityids);
|
|
|
- //这是修改车牌号
|
|
|
- //将排队信息删掉
|
|
|
- Map<String, Object> isSpellingMap = omstruckOrderMapper.getSteelIsSpelling(DataChange.dataToBigDecimal(mapValue.get("orderId")));
|
|
|
- if(isSpellingMap != null && isSpellingMap.get("listId") != null){
|
|
|
- int isSpelling = DataChange.dataToBigDecimal(isSpellingMap.get("isSpelling")).intValue();
|
|
|
- if(isSpelling == 1 ){
|
|
|
- result += omstruckOrderMapper.deleteSpellingList(isSpellingMap.get("listId"));
|
|
|
- }else{
|
|
|
- result += omstruckOrderMapper.deleteQueueList(isSpellingMap.get("listId"));
|
|
|
- }
|
|
|
- }
|
|
|
- result += amsSaleOrderMapper.updateCapacityNumberInFactory(mapValue);
|
|
|
- //若是接单之后还需要删除实绩且将状态变为4
|
|
|
- //查询运输订单的状态和总实绩ID
|
|
|
- Map<String, Object> orderMesMap = amsSaleOrderMapper.getOrderMes(mapValue);
|
|
|
- BigDecimal resultTotalId = DataChange.dataToBigDecimal(orderMesMap.get("resultTotalId"));
|
|
|
- //删除排队实绩
|
|
|
- if (resultTotalId !=null && !("".equals(resultTotalId))){
|
|
|
- omstruckOrderMapper.deleteQueuingPerformance(resultTotalId);
|
|
|
- }
|
|
|
- if(DataChange.dataToBigDecimal(orderMesMap.get("orderStatus")).intValue() == 5){
|
|
|
- OmstruckOrder omstruckOrder = new OmstruckOrder();
|
|
|
- omstruckOrder.setOrderId(DataChange.dataToBigDecimal(mapValue.get("orderId")));
|
|
|
- omstruckOrder.setOrderStatus(new BigDecimal(4));
|
|
|
- omstruckOrder.setOrderLineSequence(new BigDecimal(0));
|
|
|
- /*omstruckOrder.set*/
|
|
|
- result += omstruckOrderMapper.updateByPrimaryKeySelective(omstruckOrder);
|
|
|
- result += omstruckOrderMapper.deleteEnResult(resultTotalId);
|
|
|
- result += omstruckOrderMapper.deleteWeightResult(resultTotalId);
|
|
|
- result += omstruckOrderMapper.deleteLoadResult(resultTotalId);
|
|
|
- result += omstruckOrderMapper.deleteLeaveResult(resultTotalId);
|
|
|
+ mapValue.put("capacityids",capacityids);
|
|
|
+ //这是修改车牌号
|
|
|
+ //将排队信息删掉
|
|
|
+ Map<String, Object> isSpellingMap = omstruckOrderMapper.getSteelIsSpelling(DataChange.dataToBigDecimal(mapValue.get("orderId")));
|
|
|
+ if(isSpellingMap != null && isSpellingMap.get("listId") != null){
|
|
|
+ int isSpelling = DataChange.dataToBigDecimal(isSpellingMap.get("isSpelling")).intValue();
|
|
|
+ if(isSpelling == 1 ){
|
|
|
+ result += omstruckOrderMapper.deleteSpellingList(isSpellingMap.get("listId"));
|
|
|
+ }else{
|
|
|
+ result += omstruckOrderMapper.deleteQueueList(isSpellingMap.get("listId"));
|
|
|
}
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- System.out.println("e"+e.getMessage());
|
|
|
+ result += amsSaleOrderMapper.updateCapacityNumberInFactory(mapValue);
|
|
|
+ //若是接单之后还需要删除实绩且将状态变为4
|
|
|
+ //查询运输订单的状态和总实绩ID
|
|
|
+ Map<String, Object> orderMesMap = amsSaleOrderMapper.getOrderMes(mapValue);
|
|
|
+ BigDecimal resultTotalId = DataChange.dataToBigDecimal(orderMesMap.get("resultTotalId"));
|
|
|
+ //删除排队实绩
|
|
|
+ if (resultTotalId !=null && !("".equals(resultTotalId))){
|
|
|
+ omstruckOrderMapper.deleteQueuingPerformance(resultTotalId);
|
|
|
+ }
|
|
|
+ if(DataChange.dataToBigDecimal(orderMesMap.get("orderStatus")).intValue() == 5){
|
|
|
+ OmstruckOrder omstruckOrder = new OmstruckOrder();
|
|
|
+ omstruckOrder.setOrderId(DataChange.dataToBigDecimal(mapValue.get("orderId")));
|
|
|
+ omstruckOrder.setOrderStatus(new BigDecimal(4));
|
|
|
+ omstruckOrder.setOrderLineSequence(new BigDecimal(0));
|
|
|
+ /*omstruckOrder.set*/
|
|
|
+ result += omstruckOrderMapper.updateByPrimaryKeySelective(omstruckOrder);
|
|
|
+ result += omstruckOrderMapper.deleteEnResult(resultTotalId);
|
|
|
+ result += omstruckOrderMapper.deleteWeightResult(resultTotalId);
|
|
|
+ result += omstruckOrderMapper.deleteLoadResult(resultTotalId);
|
|
|
+ result += omstruckOrderMapper.deleteLeaveResult(resultTotalId);
|
|
|
+ }
|
|
|
}
|
|
|
mapValue.put("result",result);
|
|
|
return mapValue;
|