|
@@ -12,6 +12,7 @@ import com.steerinfo.dil.service.ITmstrainWagonUnloadResultService;
|
|
import com.steerinfo.dil.util.DataChange;
|
|
import com.steerinfo.dil.util.DataChange;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
@@ -190,6 +191,7 @@ public class TmstrainWagonUnloadResultServiceImpl implements ITmstrainWagonUnloa
|
|
* @param map
|
|
* @param map
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
|
|
+ @Transactional
|
|
public int addTmsTrainUnloadResultForNZ(Map<String, Object> map) {
|
|
public int addTmsTrainUnloadResultForNZ(Map<String, Object> map) {
|
|
BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
|
|
BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
|
|
BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
@@ -197,8 +199,12 @@ public class TmstrainWagonUnloadResultServiceImpl implements ITmstrainWagonUnloa
|
|
List<Map<String, Object>> totalIdList = tmstrainWagonUnloadResultMapper.getTotalIdByOrderId(orderId);
|
|
List<Map<String, Object>> totalIdList = tmstrainWagonUnloadResultMapper.getTotalIdByOrderId(orderId);
|
|
Map<String, Object> mesMap = totalIdList.get(0);
|
|
Map<String, Object> mesMap = totalIdList.get(0);
|
|
BigDecimal trainTotalId = DataChange.dataToBigDecimal(mesMap.get("trainTotalId"));
|
|
BigDecimal trainTotalId = DataChange.dataToBigDecimal(mesMap.get("trainTotalId"));
|
|
- BigDecimal truckTotalId = DataChange.dataToBigDecimal(mesMap.get("truckTotalId"));
|
|
|
|
- mesMap.put("materialId", materialId);
|
|
|
|
|
|
+ //通过汽运总实绩ID、火运总实绩ID 查找中间表主键
|
|
|
|
+ Integer truckTrainId = tmstrainTruckTotalResultMapper.getIdByMateAndTruckAndTrainTotalId(mesMap);
|
|
|
|
+ //如果没有查出中间表数据 说明该订单已经卸过车
|
|
|
|
+ if(truckTrainId == null){
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
//通过火运总实绩ID查询装车实绩ID
|
|
//通过火运总实绩ID查询装车实绩ID
|
|
Integer loadingId = tmstrainWagonUnloadResultMapper.getLoadingIdByTrainTotalId(trainTotalId);
|
|
Integer loadingId = tmstrainWagonUnloadResultMapper.getLoadingIdByTrainTotalId(trainTotalId);
|
|
//拿到装车实绩ID后查询车皮号与发运计划号
|
|
//拿到装车实绩ID后查询车皮号与发运计划号
|
|
@@ -231,11 +237,9 @@ public class TmstrainWagonUnloadResultServiceImpl implements ITmstrainWagonUnloa
|
|
tmstrainTotalResult.setUpdateTime(new Date());
|
|
tmstrainTotalResult.setUpdateTime(new Date());
|
|
count += tmstrainTotalResultMapper.updateByPrimaryKeySelective(tmstrainTotalResult);
|
|
count += tmstrainTotalResultMapper.updateByPrimaryKeySelective(tmstrainTotalResult);
|
|
}
|
|
}
|
|
- //通过物资ID、汽运总实绩ID、火运总实绩ID 查找中间表主键
|
|
|
|
- Integer id = tmstrainTruckTotalResultMapper.getIdByMateAndTruckAndTrainTotalId(mesMap);
|
|
|
|
//修改火运物资中间表为已卸车
|
|
//修改火运物资中间表为已卸车
|
|
TmstrainTruckTotalResult tmstrainTruckTotalResult = new TmstrainTruckTotalResult();
|
|
TmstrainTruckTotalResult tmstrainTruckTotalResult = new TmstrainTruckTotalResult();
|
|
- tmstrainTruckTotalResult.setId(new BigDecimal(id));
|
|
|
|
|
|
+ tmstrainTruckTotalResult.setId(new BigDecimal(truckTrainId));
|
|
tmstrainTruckTotalResult.setLoadStatus(new BigDecimal(1));//已卸车
|
|
tmstrainTruckTotalResult.setLoadStatus(new BigDecimal(1));//已卸车
|
|
count += tmstrainTruckTotalResultMapper.updateByPrimaryKeySelective(tmstrainTruckTotalResult);
|
|
count += tmstrainTruckTotalResultMapper.updateByPrimaryKeySelective(tmstrainTruckTotalResult);
|
|
return count;
|
|
return count;
|