|
@@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
import java.io.FileInputStream;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
|
+import java.text.DateFormat;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -159,7 +160,11 @@ public class TMSController extends BaseRESTfulController {
|
|
|
return tmsFeign.syncWeightResult(map);
|
|
return tmsFeign.syncWeightResult(map);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+<<<<<<< .mine
|
|
|
|
|
|
|
|
|
|
+=======
|
|
|
|
|
+
|
|
|
|
|
+>>>>>>> .theirs
|
|
|
@ApiOperation(value="计时")
|
|
@ApiOperation(value="计时")
|
|
|
@ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
@ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
@RequestLimit()
|
|
@RequestLimit()
|
|
@@ -381,7 +386,7 @@ public class TMSController extends BaseRESTfulController {
|
|
|
@PostMapping(value = "/purchaseTrainLoad")
|
|
@PostMapping(value = "/purchaseTrainLoad")
|
|
|
// @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"装货实绩"})
|
|
// @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"装货实绩"})
|
|
|
public Map<String, Object> purchaseTrainLoad(@RequestBody MultipartFile file,
|
|
public Map<String, Object> purchaseTrainLoad(@RequestBody MultipartFile file,
|
|
|
- String materialType,
|
|
|
|
|
|
|
+ String businessType,
|
|
|
String userId,
|
|
String userId,
|
|
|
String userName) throws Exception {
|
|
String userName) throws Exception {
|
|
|
File excel = ExcelToolUtils.multipartFileToFile(file);
|
|
File excel = ExcelToolUtils.multipartFileToFile(file);
|
|
@@ -396,18 +401,19 @@ public class TMSController extends BaseRESTfulController {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
//获取Excel中包含的对象数组
|
|
//获取Excel中包含的对象数组
|
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(is, fileName, 0);
|
|
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);
|
|
map.put("list", list);
|
|
|
- //校验当前excel是否已经导过
|
|
|
|
|
- if (universalMapper.checkTrainOrder(map) > 0) {
|
|
|
|
|
- throw new Exception("存在24小时内的重复运单!不允许重复导入!");
|
|
|
|
|
- }
|
|
|
|
|
//统计通知单的重量车数和车牌号
|
|
//统计通知单的重量车数和车牌号
|
|
|
Set<String> capacitySet = new HashSet<>();//车牌号
|
|
Set<String> capacitySet = new HashSet<>();//车牌号
|
|
|
for (Map<String, Object> item : list) {
|
|
for (Map<String, Object> item : list) {
|
|
|
|
|
+ //校验行
|
|
|
|
|
+ if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
|
|
|
+ || item.get("车号")==null || item.get("车号").equals("")
|
|
|
|
|
+ || item.get("装车日期")==null || item.get("装车日期").equals("")
|
|
|
|
|
+ || item.get("净重")==null || item.get("净重").equals("")
|
|
|
|
|
+ || item.get("皮重")==null || item.get("皮重").equals("")
|
|
|
|
|
+ || item.get("毛重")==null || item.get("毛重").equals("")){
|
|
|
|
|
+ throw new Exception("单元格数据异常(通知单号/车号/装车日期/净重/皮重/毛重),请检查模板或数据是否正确!");
|
|
|
|
|
+ }
|
|
|
//通知单统计
|
|
//通知单统计
|
|
|
String requirementNumber = item.get("通知单号").toString();
|
|
String requirementNumber = item.get("通知单号").toString();
|
|
|
if (map.get("requirementNumber") != null) {
|
|
if (map.get("requirementNumber") != null) {
|
|
@@ -415,24 +421,34 @@ public class TMSController extends BaseRESTfulController {
|
|
|
//已存在,修改
|
|
//已存在,修改
|
|
|
BigDecimal weight = DataChange.dataToBigDecimal(map.get("weight"));
|
|
BigDecimal weight = DataChange.dataToBigDecimal(map.get("weight"));
|
|
|
BigDecimal truckNumber = DataChange.dataToBigDecimal(map.get("truckNumber"));
|
|
BigDecimal truckNumber = DataChange.dataToBigDecimal(map.get("truckNumber"));
|
|
|
|
|
+ String loadTime = map.get("loadTime").toString();
|
|
|
weight = weight.add(DataChange.dataToBigDecimal(item.get("净重")));
|
|
weight = weight.add(DataChange.dataToBigDecimal(item.get("净重")));
|
|
|
truckNumber = truckNumber.add(new BigDecimal(1));
|
|
truckNumber = truckNumber.add(new BigDecimal(1));
|
|
|
map.put("weight", weight);
|
|
map.put("weight", weight);
|
|
|
map.put("truckNumber", truckNumber);
|
|
map.put("truckNumber", truckNumber);
|
|
|
|
|
+ if(!loadTime.equals(item.get("装车日期").toString())){
|
|
|
|
|
+ throw new Exception("同一个Excel只允许一批车辆,请检查装车日期!");
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- throw new Exception("同一个Excel文件中只允许有一个采购订单号!");
|
|
|
|
|
|
|
+ throw new Exception("同一个Excel文件中只允许有一个通知单号!");
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
//不存在,新增
|
|
//不存在,新增
|
|
|
BigDecimal weight = DataChange.dataToBigDecimal(item.get("净重"));
|
|
BigDecimal weight = DataChange.dataToBigDecimal(item.get("净重"));
|
|
|
BigDecimal truckNumber = new BigDecimal(1);
|
|
BigDecimal truckNumber = new BigDecimal(1);
|
|
|
|
|
+ String loadTime = item.get("装车日期").toString();
|
|
|
map.put("requirementNumber", requirementNumber);
|
|
map.put("requirementNumber", requirementNumber);
|
|
|
map.put("weight", weight);
|
|
map.put("weight", weight);
|
|
|
map.put("truckNumber", truckNumber);
|
|
map.put("truckNumber", truckNumber);
|
|
|
|
|
+ map.put("loadTime",loadTime);
|
|
|
}
|
|
}
|
|
|
//车牌号去重
|
|
//车牌号去重
|
|
|
capacitySet.add(item.get("车号").toString());
|
|
capacitySet.add(item.get("车号").toString());
|
|
|
}
|
|
}
|
|
|
|
|
+ //校验当前excel是否已经导入过
|
|
|
|
|
+ if (universalMapper.countTrainLoad(map) > 0) {
|
|
|
|
|
+ throw new Exception("存在重复的装车信息!不允许重复导入!");
|
|
|
|
|
+ }
|
|
|
//新增火车运力资源
|
|
//新增火车运力资源
|
|
|
String[] capacities = capacitySet.toArray(new String[0]);//车牌号
|
|
String[] capacities = capacitySet.toArray(new String[0]);//车牌号
|
|
|
if (capacities.length != list.size()) {
|
|
if (capacities.length != list.size()) {
|
|
@@ -450,10 +466,10 @@ public class TMSController extends BaseRESTfulController {
|
|
|
}.run();
|
|
}.run();
|
|
|
}
|
|
}
|
|
|
//新增AMS及TMS
|
|
//新增AMS及TMS
|
|
|
- map.put("userId", userId);
|
|
|
|
|
- map.put("userName", userName);
|
|
|
|
|
- map.put("materialType", materialType);
|
|
|
|
|
- return tmsFeign.purchaseTrainLoad(map, userId, userName);
|
|
|
|
|
|
|
+ map.put("userId",userId);
|
|
|
|
|
+ map.put("userName",userName);
|
|
|
|
|
+ map.put("businessType",businessType);
|
|
|
|
|
+ return tmsFeign.purchaseTrainLoad(map);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询采购火运装货")
|
|
@ApiOperation(value = "查询采购火运装货")
|
|
@@ -465,6 +481,160 @@ public class TMSController extends BaseRESTfulController {
|
|
|
return tmsFeign.purchaseTrainLoadList(map == null ? new HashMap<>() : map, apiId, pageNum, 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 = "/purchaseTrainWeight")
|
|
|
|
|
+// @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"计量实绩"})
|
|
|
|
|
+ public Map<String, Object> purchaseTrainWeight(@RequestBody MultipartFile file,
|
|
|
|
|
+ String businessType,
|
|
|
|
|
+ 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);
|
|
|
|
|
+ map.put("list", list);
|
|
|
|
|
+ Set<String> capacitySet = new HashSet<>();//车牌号
|
|
|
|
|
+ for (Map<String, Object> item : list) {
|
|
|
|
|
+ //校验行
|
|
|
|
|
+ if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
|
|
|
+ || item.get("车号")==null || item.get("车号").equals("")
|
|
|
|
|
+ || item.get("计量日期")==null || item.get("计量日期").equals("")
|
|
|
|
|
+ || item.get("净重")==null || item.get("净重").equals("")
|
|
|
|
|
+ || item.get("皮重")==null || item.get("皮重").equals("")
|
|
|
|
|
+ || item.get("毛重")==null || item.get("毛重").equals("")){
|
|
|
|
|
+ throw new Exception("单元格数据异常(通知单号/车号/计量日期/净重/皮重/毛重),请检查模板或数据是否正确!");
|
|
|
|
|
+ }
|
|
|
|
|
+ //校验数据
|
|
|
|
|
+ String requirementNumber = item.get("通知单号").toString();
|
|
|
|
|
+ if (map.get("requirementNumber") != null) {
|
|
|
|
|
+ if (map.get("requirementNumber").equals(requirementNumber)) {
|
|
|
|
|
+ String weightTime = map.get("weightTime").toString();
|
|
|
|
|
+ if(!weightTime.equals(item.get("计量日期").toString())){
|
|
|
|
|
+ throw new Exception("同一个Excel只允许一批车辆,请检查计量日期!");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new Exception("同一个Excel文件中只允许有一个通知单号!");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //不存在,新增
|
|
|
|
|
+ map.put("requirementNumber", requirementNumber);
|
|
|
|
|
+ map.put("weightTime",item.get("计量日期").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ //车牌号去重
|
|
|
|
|
+ capacitySet.add(item.get("车号").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ String[] capacities = capacitySet.toArray(new String[0]);//车牌号
|
|
|
|
|
+ if (capacities.length != list.size()) {
|
|
|
|
|
+ throw new Exception("车号不允许重复!");
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("userId",userId);
|
|
|
|
|
+ map.put("userName",userName);
|
|
|
|
|
+ map.put("businessType",businessType);
|
|
|
|
|
+ //获取火车运单及计量详情
|
|
|
|
|
+ List<Map<String,Object>> orderList = universalMapper.findTrainWeight(map);
|
|
|
|
|
+ if (orderList.size() <= 0) {
|
|
|
|
|
+ throw new Exception("未查询到装车信息,请先上传装车作业!");
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("orderList",orderList);
|
|
|
|
|
+ //新增TMS
|
|
|
|
|
+ return tmsFeign.purchaseTrainWeight(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "查询采购火运计量")
|
|
|
|
|
+ @PostMapping("/purchaseTrainWeightList")
|
|
|
|
|
+ public Map<String, Object> purchaseTrainWeightList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
|
|
+ Integer apiId,
|
|
|
|
|
+ Integer pageNum,
|
|
|
|
|
+ Integer pageSize) {
|
|
|
|
|
+ return tmsFeign.purchaseTrainWeightList(map == null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "采购火运卸车作业")
|
|
|
|
|
+ @ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
|
|
+ @PostMapping(value = "/purchaseTrainUnload")
|
|
|
|
|
+// @LogAround(foreignKeys = {"resultId"},foreignKeyTypes = {"计量实绩"})
|
|
|
|
|
+ public Map<String, Object> purchaseTrainUnload(@RequestBody MultipartFile file,
|
|
|
|
|
+ String businessType,
|
|
|
|
|
+ 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);
|
|
|
|
|
+ map.put("list", list);
|
|
|
|
|
+ Set<String> capacitySet = new HashSet<>();//车牌号
|
|
|
|
|
+ for (Map<String, Object> item : list) {
|
|
|
|
|
+ //校验行
|
|
|
|
|
+ if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
|
|
|
+ || item.get("车号")==null || item.get("车号").equals("")
|
|
|
|
|
+ || item.get("卸车日期")==null || item.get("卸车日期").equals("")
|
|
|
|
|
+ || item.get("净重")==null || item.get("净重").equals("")){
|
|
|
|
|
+ throw new Exception("单元格数据异常(通知单号/车号/卸车日期/净重),请检查模板或数据是否正确!");
|
|
|
|
|
+ }
|
|
|
|
|
+ //校验数据
|
|
|
|
|
+ String requirementNumber = item.get("通知单号").toString();
|
|
|
|
|
+ if (map.get("requirementNumber") != null) {
|
|
|
|
|
+ if (map.get("requirementNumber").equals(requirementNumber)) {
|
|
|
|
|
+ String unloadTime = map.get("unloadTime").toString();
|
|
|
|
|
+ if(!unloadTime.equals(item.get("卸车日期").toString())){
|
|
|
|
|
+ throw new Exception("同一个Excel只允许一批车辆,请检查卸车日期!");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new Exception("同一个Excel文件中只允许有一个通知单号!");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //不存在,新增
|
|
|
|
|
+ map.put("requirementNumber", requirementNumber);
|
|
|
|
|
+ map.put("unloadTime",item.get("卸车日期").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ //车牌号去重
|
|
|
|
|
+ capacitySet.add(item.get("车号").toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ String[] capacities = capacitySet.toArray(new String[0]);//车牌号
|
|
|
|
|
+ if (capacities.length != list.size()) {
|
|
|
|
|
+ throw new Exception("车号不允许重复!");
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("userId",userId);
|
|
|
|
|
+ map.put("userName",userName);
|
|
|
|
|
+ map.put("businessType",businessType);
|
|
|
|
|
+ //获取火车运单及计量详情
|
|
|
|
|
+ List<Map<String,Object>> orderList = universalMapper.findTrainUnload(map);
|
|
|
|
|
+ if (orderList.size() <= 0) {
|
|
|
|
|
+ throw new Exception("未查询到装车信息,请先上传装车作业!");
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("orderList",orderList);
|
|
|
|
|
+ //新增TMS
|
|
|
|
|
+ return tmsFeign.purchaseTrainUnload(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "查询采购火运卸车")
|
|
|
|
|
+ @PostMapping("/purchaseTrainUnloadList")
|
|
|
|
|
+ public Map<String, Object> purchaseTrainUnloadList(@RequestBody(required = false) Map<String, Object> map,
|
|
|
|
|
+ Integer apiId,
|
|
|
|
|
+ Integer pageNum,
|
|
|
|
|
+ Integer pageSize) {
|
|
|
|
|
+ return tmsFeign.purchaseTrainUnloadList(map == null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@ApiOperation(value = "更改销售运输订单状态")
|
|
@ApiOperation(value = "更改销售运输订单状态")
|
|
|
@ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
@ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
@PostMapping(value = "/changeSaleTransOrder")
|
|
@PostMapping(value = "/changeSaleTransOrder")
|