|
@@ -7,6 +7,7 @@ import com.steerinfo.dil.mapper.*;
|
|
|
import com.steerinfo.dil.model.TmstruckEnfactoryResult;
|
|
|
import com.steerinfo.dil.model.TmstruckLeaveFactoryResult;
|
|
|
import com.steerinfo.dil.model.TmstruckLoadResult;
|
|
|
+import com.steerinfo.dil.model.TmstruckWeightResult;
|
|
|
import com.steerinfo.dil.service.ITmstruckLoadResultService;
|
|
|
import com.steerinfo.dil.util.DataChange;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -14,6 +15,8 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -46,6 +49,8 @@ public class TmstruckLoadResultServiceImpl implements ITmstruckLoadResultService
|
|
|
|
|
|
@Autowired
|
|
|
private UtilsServiceImpl utilsService;
|
|
|
+ @Autowired
|
|
|
+ private TmstruckWeightResultMapper tmstruckWeightResultMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private TmstruckLeaveFactoryResultMapper tmstruckLeaveFactoryResultMapper;
|
|
@@ -70,6 +75,7 @@ public class TmstruckLoadResultServiceImpl implements ITmstruckLoadResultService
|
|
|
@Autowired
|
|
|
private TmstruckUnloadResultMapper tmstruckUnloadResultMapper;
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 生成销售装车实绩(虚拟装车实绩)
|
|
|
* @param map
|
|
@@ -698,4 +704,66 @@ public class TmstruckLoadResultServiceImpl implements ITmstruckLoadResultService
|
|
|
public List<Map<String, Object>> getCgNzLoadingResult(Map<String, Object> mapval) {
|
|
|
return tmstruckLoadResultMapper.getCgNzLoadingResult(mapval);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @author:zyf
|
|
|
+ * @version:1.0
|
|
|
+ * @Date:
|
|
|
+ * @Description:新增装货表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int addLoad1(Map<String, Object> map) {
|
|
|
+ //获取装货表主键ID
|
|
|
+ BigDecimal ResultId = tmstruckLoadResultMapper.selectMaxId();
|
|
|
+ TmstruckLoadResult tmstruckLoadResult = new TmstruckLoadResult();
|
|
|
+ //总实绩ID 开始时间 结束时间 装车时长 物资Id 装卸工ID 装货点Id 备注
|
|
|
+ //主键ID
|
|
|
+ tmstruckLoadResult.setResultId(ResultId);
|
|
|
+ //装卸工ID
|
|
|
+ tmstruckLoadResult.setLoaderId(DataChange.dataToBigDecimal(map.get("loadId")));
|
|
|
+ //装货开始时间
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ String loadStartTime =(String) map.get("loadStartTime");
|
|
|
+ try {
|
|
|
+ Date loadStartTime1 = sdf2.parse(loadStartTime);
|
|
|
+ tmstruckLoadResult.setResultLoadStartTime(loadStartTime1);
|
|
|
+ //结束时间
|
|
|
+ Date loadEndTime = new Date();
|
|
|
+ tmstruckLoadResult.setResultLoadEndTime(loadEndTime);
|
|
|
+ //装货时长
|
|
|
+ long duration = (loadEndTime.getTime() - loadStartTime1.getTime()) / 60000;
|
|
|
+ tmstruckLoadResult.setResultLoadDuration(new BigDecimal(duration));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ //总实绩ID
|
|
|
+ tmstruckLoadResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultid")));
|
|
|
+ //物资ID
|
|
|
+ tmstruckLoadResult.setMaterialId(BigDecimal.valueOf((int)map.get("materialId")));
|
|
|
+ //装货点ID
|
|
|
+ tmstruckLoadResult.setLoadingId(BigDecimal.valueOf((int)map.get("warehouseId")));
|
|
|
+ //理重
|
|
|
+ BigDecimal lz= (BigDecimal.valueOf((Double) map.get("calculateTW")));
|
|
|
+ tmstruckLoadResult.setResultMeasuredTonnage(lz);
|
|
|
+ int i=tmstruckLoadResultMapper.insertSelective(tmstruckLoadResult);
|
|
|
+ TmstruckWeightResult tmstruckWeightResult=new TmstruckWeightResult();
|
|
|
+ tmstruckWeightResult.setWeightTaskResultId(tmstruckWeightResultMapper.selectMaxId());
|
|
|
+ tmstruckWeightResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultid")));
|
|
|
+ tmstruckWeightResult.setResultNetWeight(lz);
|
|
|
+ tmstruckWeightResultMapper.insertSelective(tmstruckWeightResult);
|
|
|
+ //给运输订单的路段序列号加一
|
|
|
+ //1.先查询出来
|
|
|
+ BigDecimal orderId=BigDecimal.valueOf((int)map.get("orderId"));
|
|
|
+ BigDecimal orderlinesequence=tmstruckWeightResultMapper.queryRoadId(orderId);
|
|
|
+ if (orderlinesequence==null){
|
|
|
+ orderlinesequence=BigDecimal.ZERO;
|
|
|
+ }
|
|
|
+ //2.加一在赋值进去
|
|
|
+ tmstruckWeightResultMapper.updateToRoadId(orderlinesequence.add(BigDecimal.valueOf(1)),orderId);
|
|
|
+ if (i==1){
|
|
|
+ return i;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|