|
|
@@ -2,9 +2,12 @@ package com.steerinfo.dil.controller;
|
|
|
|
|
|
|
|
|
import com.steerinfo.dil.annotaion.LogAround;
|
|
|
+import com.steerinfo.dil.feign.AmsFeign;
|
|
|
+import com.steerinfo.dil.feign.RmsFeign;
|
|
|
import com.steerinfo.dil.feign.TmsFeign;
|
|
|
import com.steerinfo.dil.mapper.UniversalMapper;
|
|
|
import com.steerinfo.dil.util.BaseRESTfulController;
|
|
|
+import com.steerinfo.dil.util.ExcelToolUtils;
|
|
|
import com.steerinfo.framework.controller.RESTfulResult;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
@@ -13,14 +16,16 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.concurrent.Callable;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import com.steerinfo.dil.util.DataChange;
|
|
|
+import org.springframework.web.multipart.MultipartRequest;
|
|
|
|
|
|
/**
|
|
|
* @author luobang
|
|
|
@@ -32,6 +37,16 @@ import java.util.concurrent.Callable;
|
|
|
public class TMSController extends BaseRESTfulController {
|
|
|
@Autowired
|
|
|
private TmsFeign tmsFeign;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AmsFeign amsFeign;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RmsFeign rmsFeign;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UniversalMapper universalMapper;
|
|
|
+
|
|
|
@ApiOperation(value = "车辆实绩")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "map", value = "参数", required = false, dataType = "map"),
|
|
|
@@ -94,6 +109,14 @@ public class TMSController extends BaseRESTfulController {
|
|
|
return tmsFeign.changeTransOrder(map);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value="司机接收运单")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/receiptOrder")
|
|
|
+ @LogAround(foreignKeys = {"transOrderId"},foreignKeyTypes = {"运输订单"})
|
|
|
+ public Map<String, Object> receiptOrder(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.receiptOrder(map);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "查询运输订单")
|
|
|
@PostMapping("/getTransOrderList")
|
|
|
public Map<String, Object> getTransOrderList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
@@ -103,6 +126,13 @@ public class TMSController extends BaseRESTfulController {
|
|
|
return tmsFeign.getTransOrderList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value="查询运输订单所有运输实绩")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/getTransResult")
|
|
|
+ public Map<String, Object> getTransResult(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.getTransResult(map);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value="同步进厂")
|
|
|
@ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
@PostMapping(value = "/syncEnfactoryResult")
|
|
|
@@ -127,6 +157,7 @@ public class TMSController extends BaseRESTfulController {
|
|
|
return tmsFeign.syncWeightResult(map);
|
|
|
}
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
@ApiOperation(value="计时")
|
|
|
@ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
@PostMapping(value = "/startend")
|
|
|
@@ -150,5 +181,290 @@ public class TMSController extends BaseRESTfulController {
|
|
|
@LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"修改计时"})
|
|
|
public Map<String, Object> tmstimingresultsUpdate(@RequestBody(required = false) Map<String, Object> map){
|
|
|
return tmsFeign.tmstimingresultsUpdate(map);
|
|
|
+=======
|
|
|
+
|
|
|
+ @ApiOperation(value="销售派发运输订单")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/saleDispatchOrder")
|
|
|
+ @LogAround(foreignKeys = {"transOrderId"},foreignKeyTypes = {"运输订单"})
|
|
|
+ public Map<String, Object> saleDispatchOrder(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.saleDispatchOrder(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询销售运输订单")
|
|
|
+ @PostMapping("/getSaleTransOrderList")
|
|
|
+ public Map<String, Object> getSaleTransOrderList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getSaleTransOrderList(map == null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+ @ApiOperation(value="同步质检")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/syncQualityResult")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"质检实绩"})
|
|
|
+ public Map<String, Object> syncQualityResult(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.syncQualityResult(map);
|
|
|
+ }
|
|
|
+ @ApiOperation(value="签到")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/signIn")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"签到实绩"})
|
|
|
+ public Map<String, Object> signIn(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.signIn(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="换车头")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/replaceFront")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"换车头实绩"})
|
|
|
+ public Map<String, Object> replaceFront(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.replaceFront(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="装货")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/load")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"装货实绩"})
|
|
|
+ public Map<String, Object> load(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.load(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="装货修改")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/loadUpd")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"装货实绩"})
|
|
|
+ public Map<String, Object> loadUpd(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.loadUpd(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="卸货")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/unload")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"卸货实绩"})
|
|
|
+ public Map<String, Object> unload(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.unload(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="卸货修改")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/unloadUpd")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"卸货实绩"})
|
|
|
+ public Map<String, Object> unloadUpd(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.unloadUpd(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="抵达")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/arrival")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"抵达实绩"})
|
|
|
+ public Map<String, Object> arrival(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.arrival(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="签收")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/receipt")
|
|
|
+ @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"签收实绩"})
|
|
|
+ public Map<String, Object> receipt(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.receipt(map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value="查询厂内车辆数")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/getCountEnfactory")
|
|
|
+ public Map<String, Object> getCountEnfactory(@RequestBody(required = false) Map<String, Object> map){
|
|
|
+ return tmsFeign.getCountEnfactory(map == null ? new HashMap<>():map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询签到")
|
|
|
+ @PostMapping("/getSignInResultList")
|
|
|
+ public Map<String, Object> getSignInResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getSignInResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询换车头")
|
|
|
+ @PostMapping("/getReplaceFrontResultList")
|
|
|
+ public Map<String, Object> getReplaceFrontResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getReplaceFrontResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询进厂")
|
|
|
+ @PostMapping("/getEnfactoryResultList")
|
|
|
+ public Map<String, Object> getEnfactoryResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getEnfactoryResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询出厂")
|
|
|
+ @PostMapping("/getOutfactoryResultList")
|
|
|
+ public Map<String, Object> getTmsOutfactoryResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getOutfactoryResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询装货")
|
|
|
+ @PostMapping("/getLoadResultList")
|
|
|
+ public Map<String, Object> getLoadResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getLoadResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询卸货")
|
|
|
+ @PostMapping("/getUnloadResultList")
|
|
|
+ public Map<String, Object> getUnloadResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getUnloadResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询计量")
|
|
|
+ @PostMapping("/getWeightResultList")
|
|
|
+ public Map<String, Object> getWeightResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getWeightResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询质检")
|
|
|
+ @PostMapping("/getQualityResultList")
|
|
|
+ public Map<String, Object> getQualityResult(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getQualityResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询抵达")
|
|
|
+ @PostMapping("/getArrivalResultList")
|
|
|
+ public Map<String, Object> getArrivalResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.getArrivalResultList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询签收")
|
|
|
+ @PostMapping("/getReceiptResultList")
|
|
|
+ public Map<String, Object> getReceiptResultList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize){
|
|
|
+ return tmsFeign.getReceiptResultList(map == null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="采购火运装货作业")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/purchaseTrainLoad")
|
|
|
+// @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"装货实绩"})
|
|
|
+ public Map<String, Object> purchaseTrainLoad(@RequestBody MultipartFile file,
|
|
|
+ String materialType,
|
|
|
+ String userId,
|
|
|
+ String userName) throws Exception {
|
|
|
+ File excel = ExcelToolUtils.multipartFileToFile(file);
|
|
|
+ FileInputStream is = null;
|
|
|
+ String fileName = excel.getName();
|
|
|
+ // 解决fileName兼容性问题
|
|
|
+ int lastindex = fileName.lastIndexOf("\\");
|
|
|
+ fileName = fileName.substring(lastindex + 1);
|
|
|
+ if (fileName != null && fileName.length() > 0) {
|
|
|
+ is = new FileInputStream(excel);
|
|
|
+ }
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ //获取Excel中包含的对象数组
|
|
|
+ List<Map<String,Object>> list = ExcelToolUtils.getExcelList(is, fileName, 0);
|
|
|
+ List<String> capacityIds = new ArrayList<>();
|
|
|
+ for(Map<String,Object> item:list){
|
|
|
+ capacityIds.add(item.get("车号").toString());
|
|
|
+ }
|
|
|
+ map.put("list",list);
|
|
|
+ //校验当前excel是否已经导过
|
|
|
+ if(universalMapper.checkTrainOrder(map) > 0){
|
|
|
+ throw new Exception("存在24小时内的重复运单!不允许重复导入!");
|
|
|
+ }
|
|
|
+ //统计通知单的重量车数和车牌号
|
|
|
+ Set<String> capacitySet = new HashSet<>();//车牌号
|
|
|
+ for (Map<String,Object> item : list){
|
|
|
+ //通知单统计
|
|
|
+ String requirementNumber = item.get("通知单号").toString();
|
|
|
+ if(map.get("requirementNumber") != null){
|
|
|
+ if(map.get("requirementNumber").equals(requirementNumber)){
|
|
|
+ //已存在,修改
|
|
|
+ BigDecimal weight = DataChange.dataToBigDecimal(map.get("weight"));
|
|
|
+ BigDecimal truckNumber = DataChange.dataToBigDecimal(map.get("truckNumber"));
|
|
|
+ weight = weight.add(DataChange.dataToBigDecimal(item.get("净重")));
|
|
|
+ truckNumber = truckNumber.add(new BigDecimal(1));
|
|
|
+ map.put("weight",weight);
|
|
|
+ map.put("truckNumber",truckNumber);
|
|
|
+ }else{
|
|
|
+ throw new Exception("同一个Excel文件中只允许有一个采购订单号!");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //不存在,新增
|
|
|
+ BigDecimal weight = DataChange.dataToBigDecimal(item.get("净重"));
|
|
|
+ BigDecimal truckNumber = new BigDecimal(1);
|
|
|
+ map.put("requirementNumber",requirementNumber);
|
|
|
+ map.put("weight",weight);
|
|
|
+ map.put("truckNumber",truckNumber);
|
|
|
+ }
|
|
|
+ //车牌号去重
|
|
|
+ capacitySet.add(item.get("车号").toString());
|
|
|
+ }
|
|
|
+ //新增火车运力资源
|
|
|
+ String[] capacities = capacitySet.toArray(new String[0]);//车牌号
|
|
|
+ if(capacities.length != list.size()){
|
|
|
+ throw new Exception("车号不允许重复!");
|
|
|
+ }else{
|
|
|
+ new Runnable(){
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ Map<String,Object> capacityMap = new HashMap<>();
|
|
|
+ capacityMap.put("capacities",capacities);
|
|
|
+ capacityMap.put("userId",userId);
|
|
|
+ capacityMap.put("userName",userName);
|
|
|
+ rmsFeign.batchInsertCapacityTrain(capacityMap);
|
|
|
+ }
|
|
|
+ }.run();
|
|
|
+ }
|
|
|
+ //新增AMS及TMS
|
|
|
+ map.put("userId",userId);
|
|
|
+ map.put("userName",userName);
|
|
|
+ map.put("materialType",materialType);
|
|
|
+ return tmsFeign.purchaseTrainLoad(map,userId,userName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询采购火运装货")
|
|
|
+ @PostMapping("/purchaseTrainLoadList")
|
|
|
+ public Map<String, Object> purchaseTrainLoadList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
+ Integer apiId,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize) {
|
|
|
+ return tmsFeign.purchaseTrainLoadList(map ==null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="更改销售运输订单状态")
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
+ @PostMapping(value = "/changeSaleTransOrder")
|
|
|
+ @LogAround(foreignKeys = {"transOrderId"},foreignKeyTypes = {"销售运输订单"})
|
|
|
+ public Map<String, Object> changeSaleTransOrder(@RequestBody(required = false) Map<String, Object> map) {
|
|
|
+ return tmsFeign.changeSaleTransOrder(map);
|
|
|
+>>>>>>> deadaae9127aedbf357007f7909d98950956f7ce
|
|
|
}
|
|
|
}
|