|
@@ -1,6 +1,5 @@
|
|
|
package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
-import com.steerinfo.dil.feign.TmsFeign;
|
|
|
import com.steerinfo.dil.mapper.TmstrainWeightResultMapper;
|
|
|
import com.steerinfo.dil.mapper.TmstruckReceiptResultMapper;
|
|
|
import com.steerinfo.dil.mapper.UtilsMapper;
|
|
@@ -10,16 +9,14 @@ import com.steerinfo.dil.model.TmstruckWeightResult;
|
|
|
import com.steerinfo.dil.mapper.TmstruckWeightResultMapper;
|
|
|
import com.steerinfo.dil.service.ITmstruckWeightResultService;
|
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
-import io.swagger.annotations.ApiModel;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.HashMap;
|
|
|
+
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -42,9 +39,6 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
@Autowired
|
|
|
TmstruckWeightResultMapper tmstruckWeightResultMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- TmsFeign tmsFeign;
|
|
|
-
|
|
|
@Autowired
|
|
|
UtilsServiceImpl utilsService;
|
|
|
|
|
@@ -110,14 +104,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
} catch (Exception e) {
|
|
|
return e.getMessage();
|
|
|
}
|
|
|
- int i = tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
- BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
|
- if("5678".contains(orderType.toString())){
|
|
|
- if(map.get("resultTareWeightTime") != null || map.get("resultCrossWeightTime") != null){
|
|
|
- //如果是采购订单 计皮后自动完成签收
|
|
|
- autoReceipt((String) map.get("orderNumber"));
|
|
|
- }
|
|
|
- }
|
|
|
+ tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
//推送数据
|
|
|
utilsService.pushMesToWebsocket((String) stringObjectMap.get("capacityNumber"), "计量");
|
|
|
return map.get("orderNumber") + "成功";
|
|
@@ -136,9 +123,9 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
|
//磅单号
|
|
|
tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
+ String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
//如果是采购订单 先计毛再计皮
|
|
|
if("5678".contains(orderType.toString())){
|
|
|
- String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
//如果毛重数据为空 则是第一次计量为毛重 此时第一次计量时间放皮重时间里面
|
|
|
if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
|
//设置毛重时间
|
|
@@ -159,40 +146,90 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
map.put("segmentSqe", map.get("grossSegmentSqe")); //毛重路段顺序
|
|
|
utilsService.updateOrderLineSequence(map);
|
|
|
}else {
|
|
|
- //设置皮重汽车衡
|
|
|
- Integer tareId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultTareCalculateNumber"));
|
|
|
+ addWeightResult(tmstruckWeightResult, map); //添加计量实绩数据
|
|
|
+ //更新订单中路段顺序号
|
|
|
+ map.put("segmentSqe", map.get("tareSegmentSqe")); //皮重路段顺序
|
|
|
+ utilsService.updateOrderLineSequence(map);
|
|
|
+ String orderNumber = (String) map.get("orderNumber");
|
|
|
+ //如果是采购订单 计皮后自动完成签收
|
|
|
+ //查询是此订单是否已签收过
|
|
|
+ Integer check = utilsMapper.checkoutReceipt(orderNumber);
|
|
|
+ if(check == null){
|
|
|
+ autoReceipt(orderNumber);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ addWeightResult(tmstruckWeightResult, map); //添加计量实绩数据
|
|
|
+ // 更新订单中路段顺序号,如果毛重时间为空则为计皮:也就是销售第一次计皮,反之有毛重时间则为计毛
|
|
|
+ if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
|
+ map.put("segmentSqe", map.get("tareSegmentSqe")); //皮重路段顺序
|
|
|
+ }else{
|
|
|
+ map.put("segmentSqe", map.get("grossSegmentSqe")); //毛重路段顺序
|
|
|
+ }
|
|
|
+ utilsService.updateOrderLineSequence(map);
|
|
|
+ }
|
|
|
+ return tmstruckWeightResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加计量实绩添加数据
|
|
|
+ * @param tmstruckWeightResult
|
|
|
+ * @param map
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void addWeightResult(TmstruckWeightResult tmstruckWeightResult, Map<String, Object> map) throws Exception{
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ //设置皮重汽车衡
|
|
|
+ String resultTareCalculateNumber = (String) map.get("resultTareCalculateNumber");
|
|
|
+ if(resultTareCalculateNumber != null){
|
|
|
+ if(!"".equals(resultTareCalculateNumber)){
|
|
|
+ Integer tareId = tmstruckWeightResultMapper.selectTruckCalculateId(resultTareCalculateNumber);
|
|
|
if(tareId == null){
|
|
|
throw new Exception("没有此皮重汽车衡:" + map.get("resultTareCalculateNumber"));
|
|
|
}
|
|
|
tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(tareId));
|
|
|
- //设置毛重汽车衡
|
|
|
- Integer crossId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultCrossCalculateNumber"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //设置毛重汽车衡
|
|
|
+ String resultCrossCalculateNumber = (String) map.get("resultCrossCalculateNumber");
|
|
|
+ if(resultCrossCalculateNumber != null){
|
|
|
+ if(!"".equals(resultCrossCalculateNumber)){
|
|
|
+ Integer crossId = tmstruckWeightResultMapper.selectTruckCalculateId(resultCrossCalculateNumber);
|
|
|
if(crossId == null){
|
|
|
throw new Exception("没有此毛重汽车衡:" + map.get("resultCrossCalculateNumber"));
|
|
|
}
|
|
|
tmstruckWeightResult.setResultGrossPlaceId(new BigDecimal(crossId));
|
|
|
- //毛重
|
|
|
- BigDecimal resultCrossWeight = DataChange.dataToBigDecimal(map.get("resultCrossWeight"));
|
|
|
- tmstruckWeightResult.setResultGrossWeight(resultCrossWeight);
|
|
|
- //皮重
|
|
|
- BigDecimal resultTareWeight = DataChange.dataToBigDecimal(map.get("resultTareWeight"));
|
|
|
- tmstruckWeightResult.setResultTareWeight(resultTareWeight);
|
|
|
- //净重
|
|
|
- tmstruckWeightResult.setResultNetWeight(DataChange.dataToBigDecimal(map.get("resultNetWeight")));
|
|
|
- //设置皮重时间
|
|
|
- String resultTareWeightTime = (String) map.get("resultTareWeightTime");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //毛重
|
|
|
+ if(map.get("resultCrossWeight") != null){
|
|
|
+ tmstruckWeightResult.setResultGrossWeight(DataChange.dataToBigDecimal(map.get("resultCrossWeight")));
|
|
|
+ }
|
|
|
+ //皮重
|
|
|
+ if(map.get("resultTareWeight") != null){
|
|
|
+ tmstruckWeightResult.setResultTareWeight(DataChange.dataToBigDecimal(map.get("resultTareWeight")));
|
|
|
+ }
|
|
|
+ //净重
|
|
|
+ if(map.get("resultNetWeight") != null){
|
|
|
+ tmstruckWeightResult.setResultNetWeight(DataChange.dataToBigDecimal(map.get("resultNetWeight")));
|
|
|
+ }
|
|
|
+ //设置皮重时间
|
|
|
+ if(map.get("resultTareWeightTime") != null){
|
|
|
+ String resultTareWeightTime = (String) map.get("resultTareWeightTime");
|
|
|
+ if(!"".equals(resultTareWeightTime)){
|
|
|
tmstruckWeightResult.setResultTareWeightTime(sdf.parse(resultTareWeightTime));
|
|
|
- //设置毛重时间
|
|
|
- String resultGrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //设置毛重时间
|
|
|
+ if(map.get("resultCrossWeightTime") != null){
|
|
|
+ String resultGrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
+ if(!"".equals(resultGrossWeightTime)){
|
|
|
tmstruckWeightResult.setResultGrossWeightTime(sdf.parse(resultGrossWeightTime));
|
|
|
- tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
- tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
- //更新订单中路段顺序号
|
|
|
- map.put("segmentSqe", map.get("tareSegmentSqe")); //皮重路段顺序
|
|
|
- utilsService.updateOrderLineSequence(map);
|
|
|
}
|
|
|
}
|
|
|
- return tmstruckWeightResult;
|
|
|
+ tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
+ tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
}
|
|
|
|
|
|
/**
|