|
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -74,7 +75,7 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
|
|
|
//添加总实绩ID
|
|
|
tmstruckLeaveFactoryResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
//添加门岗ID 出厂门岗为线路的终点
|
|
|
- tmstruckLeaveFactoryResult.setGatepostId(DataChange.dataToBigDecimal(map.get("lineEndNodeId")));
|
|
|
+// tmstruckLeaveFactoryResult.setGatepostId(DataChange.dataToBigDecimal(map.get("lineEndNodeId")));
|
|
|
return tmstruckLeaveFactoryResultMapper.insertSelective(tmstruckLeaveFactoryResult);
|
|
|
}
|
|
|
|
|
@@ -169,6 +170,53 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 通过运输订单号查询物资并根据门岗规则计算出厂门岗
|
|
|
+ * @param map
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public int calculateGatepost(Map<String, Object> map){
|
|
|
+ BigDecimal materialId = tmstruckLeaveFactoryResultMapper.queryOrderMesByOrderId((String) map.get("orderNumber"));
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
+ map1.put("materialId", materialId);
|
|
|
+ //类型为出厂
|
|
|
+ map1.put("type", 1);
|
|
|
+ List<Map<String, Object>> list = tmstruckLeaveFactoryResultMapper.queryGatepostByMaterialId(map1);
|
|
|
+ for (Map<String, Object> mes : list) {
|
|
|
+ //从数据库中获取门岗开始时间结束时间 若当前时间满足该门岗进门时间 则下放 暂不考虑门岗优先级
|
|
|
+ boolean judgeTime = judgeTime((String)mes.get("startTime"), (String)mes.get("endTime"));
|
|
|
+ if(judgeTime){
|
|
|
+ //更新出厂实绩门岗ID
|
|
|
+ //通过运输订单号获取出厂实绩ID
|
|
|
+ Map<String, Object> map2 = tmstruckLeaveFactoryResultMapper.selectResultId((String) map.get("orderNumber"));
|
|
|
+ TmstruckLeaveFactoryResult tmstruckLeaveFactoryResult = new TmstruckLeaveFactoryResult();
|
|
|
+ tmstruckLeaveFactoryResult.setResultId(DataChange.dataToBigDecimal(map2.get("resultId")));
|
|
|
+ tmstruckLeaveFactoryResult.setGatepostId(DataChange.dataToBigDecimal(mes.get("gatepostId")));
|
|
|
+ return tmstruckLeaveFactoryResultMapper.updateByPrimaryKeySelective(tmstruckLeaveFactoryResult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断当前时间是否在时间区间范围内
|
|
|
+ * @param startTime
|
|
|
+ * @param endTime
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean judgeTime(String startTime, String endTime){
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("HHmmss");
|
|
|
+ String format = sdf.format(new Date());
|
|
|
+ int begin = Integer.parseInt(startTime);
|
|
|
+ int end = Integer.parseInt(endTime);
|
|
|
+ int now = Integer.parseInt(format);
|
|
|
+ if(begin < end){
|
|
|
+ return now < end && now >= begin;
|
|
|
+ }else {
|
|
|
+ return now < end || now >= begin;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 更新出厂实绩
|
|
|
* @param mapValue {运输订单号:orderNumber 门岗名称:gatepostName}
|