package com.steerinfo.dil.controller; import com.alibaba.fastjson.JSONObject; import com.steerinfo.dil.config.WebExceptionHandler; import com.steerinfo.dil.feign.DzFeign; import com.steerinfo.dil.feign.ReportFeign; import com.steerinfo.dil.mapper.*; import com.steerinfo.dil.model.*; import com.steerinfo.dil.service.impl.OmsTransOrderServiceImpl; import com.steerinfo.dil.util.ColumnDataUtil; import com.steerinfo.dil.util.DaZongUtil; import com.steerinfo.dil.util.DataChange; import com.steerinfo.dil.util.PageListAdd; import com.steerinfo.framework.controller.BaseRESTfulController; import com.steerinfo.framework.controller.RESTfulResult; import com.steerinfo.framework.service.pagehelper.PageHelper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.SneakyThrows; import oracle.jdbc.proxy.annotation.Post; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; import java.util.logging.SimpleFormatter; /** * OmsTransOrder RESTful接口: * @author generator * @version 1.0-SNAPSHORT 2023-11-02 02:31 * 类描述 * 修订历史: * 日期:2023-11-02 * 作者:generator * 参考: * 描述:OmsTransOrder RESTful接口 * @see null * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved. */ @RestController @RequestMapping("/${api.version}/omstransorders") public class OmsTransOrderController extends BaseRESTfulController { static final Logger log = Logger.getLogger(OmsTransOrderController.class); @Autowired OmsTransOrderServiceImpl omsTransOrderService; @Autowired ColumnDataUtil columnDataUtil; @Autowired OmsTransOrderMapper omsTransOrderMapper; @Autowired SyncProductListMapper syncProductListMapper; @Autowired DzFeign dzFeign; @Autowired ReportFeign reportFeign; @Autowired DaZongUtil daZongUtil; @Autowired CommonMapper commonMapper; @Autowired AmsTransRequirementMapper amsTransRequirementMapper; @Autowired AmsRequirementChildMapper amsRequirementChildMapper; @ApiOperation(value="派单接口", notes="根据lineId、planChildId、capacityId来新增运输订单") @PostMapping("/dispatchOrder") public RESTfulResult dispatchOrder(@RequestBody Map map){ try{ String result = omsTransOrderService.dispatchOrder(map); return success(map,result); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value="批量派单接口", notes="根据lineId、planChildId、capacityId来新增运输订单") @PostMapping("/batchDispatch") public RESTfulResult batchDispatch(@RequestBody Map map){ try{ String result = omsTransOrderService.batchDispatch(map); return success(map.get("list"),result); }catch (NullPointerException e){ e.printStackTrace(); return failed(e.getMessage(),"操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value="批量派单接口", notes="根据lineId、planChildId、capacityId来新增运输订单") @PostMapping("/batchDispatchSc") public RESTfulResult batchDispatchSc(@RequestBody Map map){ try{ String result = omsTransOrderService.batchDispatchSc(map); return success(map.get("list"),result); }catch (NullPointerException e){ e.printStackTrace(); return failed(e.getMessage(),"操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value="修改运输订单", notes="仅允许修改司机、车号、运输路线") @PostMapping("/updateTransOrder") public RESTfulResult updateTransOrder(@RequestBody Map map){ try{ String result = omsTransOrderService.updateTransOrder(map); return success(map,result); }catch (IndexOutOfBoundsException e){ e.printStackTrace(); return failed(map,"操作失败,无法迁移实绩到目标线路!"); }catch (NullPointerException e){ e.printStackTrace(); return failed(map,"操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(map,e.getMessage()); } } @ApiOperation(value="合并运输订单", notes="list , lineId") @PostMapping("/mergeTransOrder") public RESTfulResult mergeTransOrder(@RequestBody Map map){ try{ String result = omsTransOrderService.mergeTransOrder(map); return success(map,result); }catch (NullPointerException e){ e.printStackTrace(); return failed(e.getMessage(),"操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value = "查询运输订单") @PostMapping("/getTransOrderList") public RESTfulResult getTransOrderList(@RequestBody(required = false) Map map, Integer apiId, Integer pageNum, Integer pageSize) { if("app".equals(map.get("terminalCode"))) { pageSize = 100; } PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> list = omsTransOrderService.getTransOrderList(map); PageListAdd pageList = columnDataUtil.tableColumnDataByUserId(apiId, null, list, map.get("userId").toString()); return success(pageList); } @ApiOperation(value="接单接口", notes="根据lineId、planChildId、capacityId来新增运输订单") @PostMapping("/receiptOrder") public RESTfulResult receiptOrder(@RequestBody Map map){ try{ String result = omsTransOrderService.receiptOrder(map); return success(map,result); }catch (NullPointerException e){ e.printStackTrace(); return failed(e.getMessage(),"操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getStackTrace(),e.getMessage()); } } @ApiOperation(value="修改运输订单状态", notes="") @PostMapping("/changeTransOrder") public RESTfulResult changeTransOrder(@RequestBody Map map){ try{ String result = omsTransOrderService.changeTransOrder(map); return success(map,result); }catch (NullPointerException e){ e.printStackTrace(); return failed("操作失败,缺乏必要参数!","操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value="火运大宗销售订单 删除销售运输订单", notes="") @PostMapping("/changeTransOrderH") public RESTfulResult changeSaleTransOrderH(@RequestBody Map map){ try{ String result = omsTransOrderService.changeTransOrderH(map); if (!result.equals("OK")){ return failed(null, "500", "运单删除失败!"); } return success(map); }catch (NullPointerException e){ e.printStackTrace(); return failed("操作失败,缺乏必要参数!","操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value="删除销售运输订单", notes="") @PostMapping("/changeSaleTransOrder") public RESTfulResult changeSaleTransOrder(@RequestBody Map map){ try{ // Integer integer = omsTransOrderService.selectDlivDirnoSeqCount(map.get("dlivDirnoSeq").toString()); // if (integer > 0) { // return failed("派车单已装车,删除失败!","派车单已装车,删除失败!"); // } String result = omsTransOrderService.changeTransOrder(map); if (!result.equals("OK")){ return failed(null, "500", "运单删除失败!"); } // String dlivDirnoSeq = omsTransOrderService.deleteSlmDlivDirListByDlivDirnoSeq(map.get("dlivDirnoSeq").toString()); // if (!dlivDirnoSeq.equals("OK")) { // return failed(null, "500", "WMS中派车单删除失败!"); // } return success(map); }catch (NullPointerException e){ e.printStackTrace(); return failed("操作失败,缺乏必要参数!","操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value="关闭计划底下所有运输订单", notes="关闭未接收运输订单") @PostMapping("/closeTransOrderByPlan") public RESTfulResult closeTransOrderByPlan(@RequestBody Map map){ try{ String result = omsTransOrderService.closeTransOrderByPlan(map); return success(map,result); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value = "查询运输订单所有运输实绩") @PostMapping("/getTransResult") public RESTfulResult getTransResult(@RequestBody(required = false) Map map) { try{ List> list = omsTransOrderService.getTransResult(map); return success(list,"查询成功!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value="销售派单接口", notes="根据lineId、planChildId、capacityId来新增运输订单") @PostMapping("/saleDispatchOrder") public RESTfulResult saleDispatchOrder(@RequestBody Map map){ try{ int max = 1; List> planChildren = (ArrayList) map.get("children"); for (Map planChild : planChildren) { planChild.put("dlivDirnoSeq", omsTransOrderService.selectMax(max)); max++; } String result = omsTransOrderService.saleDispatchOrder(map); return success(result); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value="批量销售派单接口", notes="根据lineId、planChildId、capacityId来新增运输订单") @PostMapping("/saleDispatchOrderList") public RESTfulResult saleDispatchOrderList(@RequestBody Map map){ try{ String result = omsTransOrderService.saleDispatchOrderList(map); return success(result); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value = "查询销售运输订单") @PostMapping("/getSaleTransOrderList") public RESTfulResult getSaleTransOrderList(@RequestBody(required = false) Map map, Integer apiId, Integer pageNum, Integer pageSize) { PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> list = omsTransOrderService.getSaleTransOrderList(map); PageListAdd pageList = columnDataUtil.tableColumnDataByUserId(apiId, null, list, map.get("userId").toString()); return success(pageList); } @ApiOperation(value = "查询厂内车辆数") @PostMapping("/getCountEnfactory") public RESTfulResult getCountEnfactory(@RequestBody(required = false) Map map) { return success(omsTransOrderService.getCountEnfactory(map)); } @ApiOperation(value = "查询司机运输汇总") @PostMapping("/getDriverTotalResult") public RESTfulResult getDriverTotalResult(@RequestBody(required = false) Map map, Integer apiId, Integer pageNum, Integer pageSize) { DataChange.getMonthStartEnd(map); if(map.containsKey("noPage")) { return success(omsTransOrderService.getDriverTotalResult(map)); }else{ PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> list = omsTransOrderService.getDriverTotalResult(map); PageListAdd pageList = columnDataUtil.tableColumnDataByUserId(apiId, null, list, map.get("userId").toString()); return success(pageList); } } @ApiOperation(value = "查询车辆运输汇总") @PostMapping("/getCapacityTotalResult") public RESTfulResult getCapacityTotalResult(@RequestBody(required = false) Map map, Integer apiId, Integer pageNum, Integer pageSize) { DataChange.getMonthStartEnd(map); if(map.containsKey("noPage")) { return success(omsTransOrderService.getCapacityTotalResult(map)); }else{ PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> list = omsTransOrderService.getCapacityTotalResult(map); PageListAdd pageList = columnDataUtil.tableColumnDataByUserId(apiId, null, list, map.get("userId").toString()); return success(pageList); } } @ApiOperation("生产物流-调度任务") @PostMapping("/dispatchTask") public RESTfulResult dispatchTask(@RequestBody Map map) throws Exception { Map resMap = omsTransOrderService.dispatchTask(map); if("failed".equals(resMap.get("status"))) { return failed(resMap.get("errorMessage"),resMap.get("errorMessage").toString()); } return success(map,"任务调度成功"); } @ApiOperation("获取销售派车单信息") @PostMapping("/getDlivDirnoSeqList/{id}") public RESTfulResult getDlivDirnoSeqList(@PathVariable("id") String id) { Map dlivDirnoSeqList = omsTransOrderService.getDlivDirnoSeqList(id); return success(dlivDirnoSeqList); } @ApiOperation("修改销售派车单信息") @PostMapping("/updateDlivDirnoSeq") public Map updateDlivDirnoSeq(@RequestBody Map map) throws Exception { Map params = omsTransOrderService.updateDlivDirnoSeq(map); return params; } @ApiOperation("获取销售派车单信息装货信息") @PostMapping("/selectDlivDirnoSeqDetails") public RESTfulResult selectDlivDirnoSeqDetails(@RequestBody Map map) { return success(omsTransOrderService.selectDlivDirnoSeqDetails(map)); } @SneakyThrows @ApiOperation("获取销售派车单信息装货信息") @PostMapping("/creatTransResult") public void creatTransResult(BigDecimal lineId, BigDecimal transOrderId,BigDecimal planChildId, String userName) throws Exception { omsTransOrderService.creatTransResult(lineId, transOrderId,planChildId,userName); } @ApiOperation("获取销售派车单信息装货信息") @PostMapping("/dispatchPush") public void dispatchPush(BigDecimal businessType, BigDecimal capacityId, BigDecimal driverId, OmsTransOrder omsTransOrder, OmsOrderChild omsOrderChild, Map planDetails) throws Exception { omsTransOrderService.dispatchPush(businessType, capacityId, driverId, omsTransOrder, omsOrderChild, planDetails); } @ApiOperation("匹配运输路径,并自动生产实绩") @PostMapping("/matchLineAndCreatResult") public RESTfulResult matchLineAndCreatResult(@RequestBody Map map) { try { Map result = omsTransOrderService.matchLineAndCreatResult(map); return success(result,"匹配成功!"); }catch (NullPointerException e){ e.printStackTrace(); return failed("操作失败,缺乏必要参数!","操作失败,缺乏必要参数!"); }catch (Exception e){ e.printStackTrace(); return failed(e.getMessage(),e.getMessage()); } } @ApiOperation(value = "发运通知单直接派车", notes = "发运通知单直接派车") @ApiImplicitParams({ @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map") }) @PostMapping(value = "/saleDispatchList") public RESTfulResult saleDispatchList(@RequestBody Map map) throws Exception { try { String result = omsTransOrderService.saleDispatchList(map); return success(map, result); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); log.info(e.getMessage()); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "多拼派单", notes = "多拼派单") @ApiImplicitParams({ @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map") }) @PostMapping("/saleDispatchDuoPin") public RESTfulResult saleDispatchDuoPin(@RequestBody Map map) throws Exception { try { String result = omsTransOrderService.saleDispatchDuoPin(map); return success(map, result); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "确认出库", notes = "确认出库") @ApiImplicitParams({ @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map") }) @PostMapping("/outBound") public RESTfulResult outBound(@RequestBody Map map) throws Exception { try { String result = omsTransOrderService.outBound(map); return success(map, result); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "撤销出库", notes = "撤销出库") @ApiImplicitParams({ @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map") }) @PostMapping("/revokeOutBound") public RESTfulResult revokeOutBound(@RequestBody Map map) throws Exception { try { String result = omsTransOrderService.revokeOutBound(map); return success(map, result); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "关闭过期运输订单", notes = "多拼派单") @PostMapping("/closeExpireTransOrder") public RESTfulResult closeExpireTransOrder(@RequestBody Map map) throws Exception { try { int affect = omsTransOrderMapper.closeExpireTransOrder(); return success(map, "关闭过期运输订单数量:"+affect); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "同步生产实绩", notes = "同步生产实绩") @PostMapping("/syncProductionResult") public RESTfulResult syncProductionResult(@RequestBody Map map){ try { if(map.containsKey("wlpl")) { List> mapList = (List>) map.get("mapList"); for(Map map1 : mapList) { if(map.containsKey("flag")) { map1.put("flag","update"); } omsTransOrderService.syncProductionResult(map1); //判断单据有没有同步成功 BigDecimal orderId = omsTransOrderMapper.selectOrderInfoByDB(map1); SyncProductList syncProductList = new SyncProductList(); if(orderId == null) { syncProductList.setDeleted(1); }else{ syncProductList.setDeleted(0); } JSONObject jsonObject = new JSONObject(map1); syncProductList.setPrimaryId(syncProductListMapper.nextId()); syncProductList.setDjlx("调拨"); syncProductList.setDjbh(map1.get("djbh").toString()); syncProductList.setMaterialName(map1.get("materialName") == null ? "" : map1.get("materialName").toString()); syncProductList.setProductList(jsonObject.toString()); syncProductListMapper.insert(syncProductList); } return success("更新成功"); } String result = omsTransOrderService.syncProductionResult(map); //判断单据有没有同步成功 BigDecimal orderId = omsTransOrderMapper.selectOrderInfoByDB(map); SyncProductList syncProductList = new SyncProductList(); if(orderId == null) { syncProductList.setDeleted(1); }else{ syncProductList.setDeleted(0); } JSONObject jsonObject = new JSONObject(map); syncProductList.setPrimaryId(syncProductListMapper.nextId()); syncProductList.setDjlx("调拨"); syncProductList.setDjbh(map.get("djbh").toString()); syncProductList.setMaterialName(map.get("materialName") == null ? "" : map.get("materialName").toString()); syncProductList.setProductList(jsonObject.toString()); syncProductListMapper.insert(syncProductList); return success(map, result); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "获取司机日工作量", notes = "获取司机日工作量") @PostMapping("/getDriverDayJobForApp") public RESTfulResult getDriverDayJobForApp(@RequestBody Map map,Integer apiId){ //分页查询数据 List> list = omsTransOrderService.getDriverDayJob(map); PageListAdd pageList = columnDataUtil.tableColumnDataByUserId(apiId, null, list, map.get("userId").toString()); return success(pageList); } @ApiOperation(value = "再次同步WMS派车单", notes = "再次同步WMS派车单") @PostMapping("/slmDlivDirList") public RESTfulResult slmDlivDirList(@RequestBody Map map) throws Exception { String s = omsTransOrderService.slmDlivDirList(map); return success(s); } @ApiOperation(value = "火运出库后修改车号", notes = "火运出库后修改车号") @PostMapping("/updateCarNo") public RESTfulResult updateCarNo(@RequestBody Map map) throws Exception { try { String s = omsTransOrderService.updateCarNo(map); return success(map, s); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "禁用/启用运输订单") @PostMapping("/banTransOrder") public RESTfulResult banTransOrder(@RequestBody Map map) throws Exception { try { String s = omsTransOrderService.banTransOrder(map); return success(map, s); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "查询销售火运装车", notes = "") @PostMapping("/loadingOperation") public RESTfulResult loadingOperation(@RequestBody Map map, Integer apiId, Integer pageNum, Integer pageSize) { PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> list = omsTransOrderService.loadingOperation(map); PageListAdd pageList = columnDataUtil.tableColumnDataByUserId(apiId, null, list, map.get("userId").toString()); return success(pageList); } @ApiOperation(value = "修改火运装车列序号") @PostMapping("/updateTrainOrderSeq") public RESTfulResult updateTrainOrderSeq(@RequestBody Map map) throws Exception { try { String s = omsTransOrderService.updateTrainOrderSeq(map); return success(map, s); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "查询销售火运装车明细", notes = "") @PostMapping("/purchaseTrainsOrderList") public RESTfulResult purchaseTrainsOrderList(@RequestBody Map map, Integer apiId, Integer pageNum, Integer pageSize) { PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> list = omsTransOrderService.purchaseTrainsOrderList(map); PageListAdd pageList = columnDataUtil.tableColumnDataByUserId(apiId, null, list, map.get("userId").toString()); return success(pageList); } @ApiOperation(value = "重传火运实绩->环保") @PostMapping("/trainResultResend") public RESTfulResult trainResultResend() throws Exception{ List> listXt = omsTransOrderMapper.getTrainResultForSend(null); //List> listHa = omsTransOrderMapper.getTrainResultForSend("宏安"); int index= 0,section = 300;//分片大小 while(index * section < listXt.size()) { index++; List> tempList = null; if (index * section < listXt.size()) { tempList = listXt.subList((index - 1) * section, index * section); } else { tempList = listXt.subList((index - 1) * section, listXt.size()); } Map[] paramArray = tempList.toArray(new Map[tempList.size()]); daZongUtil.executeEnvironment("/train/saveOrUpdate", paramArray); } //while(index * section < listHa.size()) { // index++; // List> tempList = null; // if (index * section < listHa.size()) { // tempList = listHa.subList((index - 1) * section, index * section); // } else { // tempList = listHa.subList((index - 1) * section, listHa.size()); // } // Map[] paramArray = tempList.toArray(new Map[tempList.size()]); // daZongUtil.executeEnvironment("/ha/train/saveOrUpdate", paramArray); //} return success("OK"); } @ApiOperation(value = "采购-修改原发数量") @PostMapping("/modifyChange") public RESTfulResult modifyChange(@RequestBody Map params) { try { String s = omsTransOrderService.modifyChange(params); return success(params, s); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "获取大宗净重") @PostMapping("/getNetWeight") public RESTfulResult getNetWeight(@RequestBody Map params) { try { String s = omsTransOrderService.getNetWeight(params); return success(params, s); } catch (NullPointerException e) { e.printStackTrace(); return failed(e.getMessage(), "操作失败,缺乏必要参数!"); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage(), e.getMessage()); } } @ApiOperation(value = "同步报表数据") @PostMapping("/getgenerateOperateDaily") public RESTfulResult generateOperateDaily(@RequestBody Map params) { try { List> omsTransOrder = omsTransOrderMapper.getTransOrderList(params); if (omsTransOrder!=null&&omsTransOrder.size()>0){ for (int i = 0; i map) { String result = null; try { result = omsTransOrderService.correctTransOrder(map); return success(result); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage()); } } @ApiOperation("固定派车") @PostMapping("/fixedDispatch") public RESTfulResult fixedDispatch() throws Exception { omsTransOrderService.fixedDispatch(); return success(); } @ApiOperation("查询需求派车") @PostMapping("/getDispatchRules") public RESTfulResult getDispatchRules(@RequestBody Map map) { //获取是否派车; List orderList = commonMapper.getOrderListByChild(DataChange.dataToBigDecimal(map.get("requirementChildId"))); if(orderList.size() > 0) { return failed("该需求已派车,无需查看!"); } //没有需求 Map objectMap = new HashMap<>(); AmsTransRequirement amsTransRequirement = amsTransRequirementMapper.selectByPrimaryKey(DataChange.dataToBigDecimal(map.get("transRequirementId"))); AmsRequirementChild amsRequirementChild = amsRequirementChildMapper.selectByPrimaryKey(DataChange.dataToBigDecimal(map.get("requirementChildId"))); Date dispatchTime = new Date((long) (amsTransRequirement.getRequirementStartTime().getTime() - 1.5 * 60 * 60 * 1000)); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); objectMap.put("dispatchTime",simpleDateFormat.format(dispatchTime)); //计算派车车号 BigDecimal capacityTypeId = amsTransRequirement.getCapacityTypeId(); Date requirementStartTime = amsTransRequirement.getRequirementStartTime(); Date requirementEndTime = amsTransRequirement.getRequirementEndTime(); Calendar startTimeCal = Calendar.getInstance(); startTimeCal.setTime(requirementStartTime); Calendar endTimeCal = Calendar.getInstance(); endTimeCal.setTime(requirementEndTime); // 获取开始时间 int startHours = startTimeCal.get(Calendar.HOUR_OF_DAY); // 获取结束时间 int endHours = endTimeCal.get(Calendar.HOUR_OF_DAY); List startArrayList1 = Arrays.asList(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); List endArrayList1 = Arrays.asList(7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19); List startArrayList2 = Arrays.asList(19, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 5, 6); List endArrayList2 = Arrays.asList(19, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 5, 6, 7,8); //如果开始时间大于七点,并且结束时间小于19点,就是早班 String flag = ""; if(startArrayList1.contains(startHours) && endArrayList1.contains(endHours)) { flag = "白班"; } if(startArrayList2.contains(startHours) && endArrayList2.contains(endHours)) { flag = "夜班"; } String personnelNo = map.get("alternateFields8").toString(); if("无".equals(personnelNo)) { //不需要吊挂工; personnelNo = "0"; } BigDecimal personnelNumber = DataChange.dataToBigDecimal(personnelNo); //空闲中的、运力、司机数据 Map objectObjectHashMap = new HashMap<>(); objectObjectHashMap.put("capacityTypeId",capacityTypeId); objectObjectHashMap.put("shift",flag); objectObjectHashMap.put("operationName",amsRequirementChild.getOperationName()); objectObjectHashMap.put("operationRangeName",amsRequirementChild.getOperationRangeName()); if(DataChange.dataToBigDecimal(map.get("dispatchSqe")).compareTo(new BigDecimal(7)) == 0) { objectObjectHashMap.put("allShift","1"); objectMap.put("operationNameType","外出业务"); }else{ objectMap.put("operationNameType","站台装卸业务"); } objectMap.put("capacityTypeName",amsTransRequirement.getCapacityTypeName()); // 查询该班次,所有异常的司机 List> capacityDriverList = commonMapper.selectAbnormalCapacityDriverList(objectObjectHashMap); objectMap.put("capacityDriverList",capacityDriverList); return success(objectMap); } @ApiOperation("查询站台装卸") @PostMapping("getZtZxShiji") public RESTfulResult getZtZxShiji(@RequestBody Map map, Integer apiId, Integer pageNum, Integer pageSize) { PageHelper.startPage(pageNum, pageSize); //分页查询数据 List> list = omsTransOrderService.getZtZxShiji(map); PageListAdd pageList = columnDataUtil.tableColumnDataByUserId(apiId, null, list, map.get("userId").toString()); return success(pageList); } @PostMapping("disposeMatchLoadData") public RESTfulResult disposeMatchLoadData(@RequestBody Map map) { String result = omsTransOrderService.disposeMatchLoadData(map); return success(result) ; } @PostMapping("resendWmsResult") public RESTfulResult resendWmsResult(@RequestBody Map map) { // 推送实绩 String result = null; try { result = omsTransOrderService.resendWmsResult(map); } catch (Exception e) { return failed(e.getMessage()); } return success(result); } @PostMapping("correctTransOrderTest") public RESTfulResult correctTransOrderTest(@RequestParam BigDecimal transOrderId) throws Exception { omsTransOrderService.correctTransOrder(transOrderId); return success(); } }