package com.sunda.spmsweb.overseacontroller;


import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.sunda.spmscommon.ResponseResult;
import com.sunda.spmsorder.entity.MaterialSap;
import com.sunda.spmsorder.entity.OrderKeyValueConfig;
import com.sunda.spmsorder.service.IFileOperationService;
import com.sunda.spmsorder.service.IMaterialSapService;
import com.sunda.spmsorder.service.IOrderKeyValueConfigService;
import com.sunda.spmsoversea.dto.OverseaWhsDumpDTO;
import com.sunda.spmsoversea.dto.OverseaWhsDumpQueryDTO;
import com.sunda.spmsoversea.entity.OverseaWhsDumpDtl;
import com.sunda.spmsoversea.entity.SafetyInventory;
import com.sunda.spmsoversea.service.IOverseaWhsDumpService;
import com.sunda.spmsuser.entity.SpmsUser;
import com.sunda.spmsuser.service.ISpmsUserService;
import com.sunda.spmsweb.util.ExportExcel;
import com.sunda.spmsweb.util.JWTUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 海外仓转储任务表 前端控制器
 * </p>
 *
 * @author Wayne
 * @since 2021-11-02
 */
@RestController
@RequestMapping("/overseaWhsDump")
@Api(tags = "海外仓转储任务", description = "海外仓转储任务")
public class OverseaWhsDumpController {

    @Autowired
    IOverseaWhsDumpService iOverseaWhsDumpService;

    @Autowired
    ISpmsUserService iSpmsUserService;
    
    @Autowired
    IFileOperationService iFileOperationService;
    
    @Autowired
    IMaterialSapService iMaterialSapService;
    @Autowired
    IOrderKeyValueConfigService iOrderKeyValueConfigService;

    @RequestMapping("/getOverseaWhsDumpPage")
    @ApiOperation(value = "获取转储任务表头分页", notes = "获取转储任务表头分页\n" +
            "示例参数：\n" +
            "{\n" +
            "\t\"beginDate\": \"\",\n" +
            "\t\"current\": 1,\n" +
            "\t\"endDate\": \"\",\n" +
            "\t\"sapDeliveryNote\": \"\",\n" +
            "\t\"sapPurchaseNo\": \"\",\n" +
            "\t\"size\": 20,\n" +
            "\t\"spmsStatus\": \"\",\n" +
            "\t\"werksDumpIn\": \"\",\n" +
            "\t\"whsDumpNo\": \"\",\n" +
            "\t\"werksDumpOut\": \"\",\n" +
            "\t\"whsLocationCodeDumpIn\": \"\",\n" +
            "\t\"whsLocationCodeDumpOut\": \"\"\n" +
            "}", httpMethod = "POST")
    @RequiresPermissions("overseaWhsDump-getOverseaWhsDumpPage")
    public ResponseResult getOverseaWhsDumpPage(@RequestBody OverseaWhsDumpQueryDTO overseaWhsDumpQueryDTO){
        try {
            return iOverseaWhsDumpService.getWhsDumpPage(overseaWhsDumpQueryDTO);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/getWhsDumpDtls")
    @ApiOperation(value = "获取转储任务明细", notes = "获取转储任务明细\n" +
            "示例参数：\n" +
            "uuidWhsIn = cfc7014fa512597ee0530101007fd417 ", httpMethod = "GET")
    @RequiresPermissions("overseaWhsDump-getWhsDumpDtls")
    public ResponseResult getWhsDumpDtls(@RequestParam String whsDumpUuid){
        try {
            return ResponseResult.success().add("overseaWhsDumpDtls", iOverseaWhsDumpService.getWhsDumpDtls(whsDumpUuid));
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/exportWhsDumpDtls")
    @ApiOperation(value = "导出转储任务明细", notes = "导出转储任务明细\n" +
            "示例参数：\n" +
            "uuidWhsIn = cfc7014fa512597ee0530101007fd417 ", httpMethod = "GET")
    public ResponseResult exportWhsDumpDtls(@RequestParam String whsDumpUuid){
        try {
            List<Map<String, Object>> overseaWhsDumpDtls = iOverseaWhsDumpService.getWhsDumpDtlListExcel(whsDumpUuid);
            String filename = "overseaWhsDumpDtls_" + System.currentTimeMillis()+".xlsx";
            // 1.附件缓存路径
            String excelPath = iFileOperationService.saveWhsDumpDtlsExcel(overseaWhsDumpDtls, filename);
            if (StringUtils.isEmpty(excelPath)){
                return ResponseResult.error("附件创建失败");
            }
            // 2.上传附件至minIO文件服务器
            String fileUrl = iFileOperationService.fileUploader(filename, excelPath);
            if (fileUrl.isEmpty()){
                return ResponseResult.error("附件上传失败:" + excelPath + "--" + fileUrl);
            }
            // 3.返回附件地址，上传OA
            return ResponseResult.success()
                    .add("fileUrl",fileUrl);

        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/createWhsDump")
    @ApiOperation(value = "创建转储任务及明细", notes = "创建转储任务及明细\n" +
            "示例参数：\n" +
            "voucherType:凭证类型/订单类型(采购)公司内ZU01/公司间ZC01\n" +
            "purchaseGroup:采购组 240\n" +
            "purchaseOrg:采购组织 1000\n" +
            "approveFlag:是否需要OA审批：0否，1是\n" +
            "{\n" +
            "\t\"cancelPostingDate\": \"\",\n" +
            "\t\"createDate\": \"2021-11-03\",\n" +
            "\t\"deliveryDate\": \"2022-01-20\",\n" +
            "\t\"voucherType\": \"ZU01\",\n" +
            "\t\"purchaseGroup\": \"240\",\n" +
            "\t\"purchaseOrg\": \"1000\",\n" +
            "\t\"dumpOutDate\": \"\",\n" +
            "\t\"dumpOutRemark\": \"\",\n" +
            "\t\"oaRemark\": \"Apply remarks\",\n" +
            "\t\"postingDate\": \"\",\n" +
            "\t\"purchasePostingDate\": \"\",\n" +
            "\t\"spmsStatus\": \"1\",\n" +
            "\t\"submitOaDate\": \"\",\n" +
            "\t\"werksDumpIn\": \"TF02\",\n" +
            "\t\"werksDumpOut\": \"GF02\",\n" +
            "\t\"whsDumpUuid\": \"\",\n" +
            "\t\"whsLocationCodeDumpIn\": \"1006\",\n" +
            "\t\"whsLocationCodeDumpOut\": \"2006\",\n" +
            "\t\"overseaWhsDumpDtlList\": [{\n" +
            "\t\t\"actualQtyBasicUnit\": 0,\n" +
            "\t\t\"actualQtyUnitSales\": 0,\n" +
            "\t\t\"actualRemark\": \"\",\n" +
            "\t\t\"actualStorageInfo\": \"\",\n" +
            "\t\t\"applyQtyBasicUnit\": 10,\n" +
            "\t\t\"applyQtyUnitSales\": 10,\n" +
            "\t\t\"applyRemark\": \"REMARK123\",\n" +
            "\t\t\"autoIdDumpDtl\": 0,\n" +
            "\t\t\"basicUnit\": \"PCS\",\n" +
            "\t\t\"item\": 0,\n" +
            "\t\t\"materialNo\": \"210051422\",\n" +
            "\t\t\"unitSales\": \"PCS\",\n" +
            "\t\t\"approveFlag\": \"1\",\n" +
            "\t\t\"whsDumpUuid\": \"\"\n" +
            "\t}]\n" +
            "}", httpMethod = "POST")
    @RequiresPermissions("overseaWhsDump-createWhsDump")
    public ResponseResult createWhsDump(@RequestBody OverseaWhsDumpDTO overseaWhsDumpDTO){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            SpmsUser spmsUser = iSpmsUserService.getByUserId(userId);
            List<OrderKeyValueConfig> orderKeyValueConfigs = iOrderKeyValueConfigService.getByFieldKey("oaConfig");
            boolean newOa = false;
            if(orderKeyValueConfigs!=null && orderKeyValueConfigs.size()>0){
                String oaConfig = orderKeyValueConfigs.get(0).getKeyCode();
                if("0".equals(oaConfig)){//0:启用新OA接口
                    newOa = true;
                }
            }
            return iOverseaWhsDumpService.createWhsDump(overseaWhsDumpDTO, userId, spmsUser,newOa);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/closeWhsDump")
    @ApiOperation(value = "转储任务关闭", notes = "转储任务关闭\n" +
            "转储任务状态设置：海外SPMS转储单据状态:0删除；1草稿；2待审批；3SPMS审批通过(提交OA);4OA驳回(操作同1);5OA审批通过(出库中);" +
            "6出库完成;7提交SAP获取PO失败;8提交SAP获取PO;9提交SAP获取DN失败;10提交SAP获取DN成功(扣转出方库存);11转出已撤销(撤到状态5出库中，SAP撤回成功则加回库存);\n" +
            "转储任务关闭，状态变化为：1-0；4-0；5-0；\n" +
            "示例参数：uuidWhsIn = cfc7014fa512597ee0530101007fd417 ", httpMethod = "GET")
    @RequiresPermissions("overseaWhsDump-closeWhsDump")
    public ResponseResult closeWhsDump(@RequestParam String whsDumpUuid, @RequestParam Integer dataVersion){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaWhsDumpService.closeWhsDump(whsDumpUuid, dataVersion, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/addOverseaWhsDumpDtls")
    @ApiOperation(value = "新增转储明细行", notes = "新增转储明细行\n" +
            "\n", httpMethod = "POST")
    public ResponseResult addOverseaWhsDumpDtls(@RequestBody List<OverseaWhsDumpDtl> dumpDtls){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaWhsDumpService.addOverseaWhsDumpDtls(dumpDtls, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/deleteOverseaWhsDumpDtls")
    @ApiOperation(value = "删除转储明细行", notes = "删除转储明细行\n" +
            "\n", httpMethod = "POST")
    public ResponseResult deleteOverseaWhsDumpDtls(@RequestBody List<OverseaWhsDumpDtl> dumpDtls){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaWhsDumpService.deleteOverseaWhsDumpDtls(dumpDtls, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

//    @RequestMapping("/oaApproveWhsDump")
//    @ApiOperation(value = "OA审批通过模拟接口", notes = "OA审批通过模拟接口\n" +
//            "示例参数：oaBianhao = 1498718，oaStatus = S 审批通过，oaStatus = E 审批不通过；\n", httpMethod = "POST")
//    public ResponseResult oaApproveWhsDump(String oaBianhao, String oaStatus){
//        try {
//            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
//            return iOverseaWhsDumpService.oaApproveWhsDump(oaBianhao, oaStatus, userId);
//        }catch (Exception e){
//            e.printStackTrace();
//            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
//        }
//    }

    @RequestMapping("/updateWhsDump")
    @ApiOperation(value = "更新转储任务及明细", notes = "更新转储任务及明细\n" +
            "转储任务更新状态变化控制：1-1(保存), 1-3(提交OA), 4-4(驳回保存), 4-3(驳回重提), 5-6(出库完成)；\n" +
            "", httpMethod = "POST")
    public ResponseResult updateWhsDump(@RequestBody OverseaWhsDumpDTO overseaWhsDumpDTO){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            SpmsUser spmsUser = iSpmsUserService.getByUserId(userId);
            List<OrderKeyValueConfig> orderKeyValueConfigs = iOrderKeyValueConfigService.getByFieldKey("oaConfig");
            boolean newOa = false;
            if(orderKeyValueConfigs!=null && orderKeyValueConfigs.size()>0){
                String oaConfig = orderKeyValueConfigs.get(0).getKeyCode();
                if("0".equals(oaConfig)){//0:启用新OA接口
                    newOa = true;
                }
            }
            return iOverseaWhsDumpService.updateWhsDump(overseaWhsDumpDTO, userId, spmsUser,newOa);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/whsDumpToSapGetPo")
    @ApiOperation(value = "转储任务获取PO", notes = "转储任务获取PO\n" +
            "提交SAP状态变化控制：6/7-8/7(获取PO)；\n" +
            "", httpMethod = "POST")
    @RequiresPermissions("overseaWhsDump-whsDumpToSapGetPo")
    public ResponseResult whsDumpToSapGetPo(String whsDumpUuid, String purchasePostingDate, Integer dataVersion){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaWhsDumpService.whsDumpToSap(whsDumpUuid, purchasePostingDate, dataVersion, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/whsDumpToSapGetDn")
    @ApiOperation(value = "转储任务获取DN", notes = "转储任务获取DN\n" +
            "提交SAP状态变化控制：8/9-10/9(获取DN)，获取到DN扣库存；\n" +
            "", httpMethod = "POST")
    @RequiresPermissions("overseaWhsDump-whsDumpToSapGetDn")
    public ResponseResult whsDumpToSapGetDn(String whsDumpUuid, String postingDate, Integer dataVersion){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaWhsDumpService.whsDumpToSap(whsDumpUuid, postingDate, dataVersion, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }

    @RequestMapping("/cancelWhsDump")
    @ApiOperation(value = "转储任务撤销", notes = "转储任务撤销\n" +
            "海外SPMS转储单据状态:\n" +
            "     0删除；1草稿；2待审批；3SPMS审批通过(提交OA);4OA驳回(操作同1);5OA审批通过(出库中);6出库完成;7提交SAP获取PO失败;\n" +
            "     8提交SAP获取PO;9提交SAP获取DN失败;10提交SAP获取DN成功(扣转出方库存);11转出已撤销(撤到状态5出库中，SAP撤回成功则加回库存);\n" +
            "转储任务撤回状态变化及处理：\n" +
            "     2-1 更新状态; 5-1 更新状态;\n" +
            "     6-5 更新状态; 7-5 更新状态;\n" +
            "     8-5 从SAP撤回PO; 9-5 从SAP撤回PO;\n" +
            "     10-8,8-5 从SAP撤回DN、加回库存、从SAP撤回PO;\n", httpMethod = "POST")
    @RequiresPermissions("overseaWhsDump-cancelWhsDump")
    public ResponseResult cancelWhsDump(String whsDumpUuid, String cancelPostingDate, Integer dataVersion){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaWhsDumpService.cancelWhsDump(whsDumpUuid, cancelPostingDate, dataVersion, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }
    
    @SuppressWarnings({ "unchecked", "unused", "resource" })
	@RequestMapping("/importWhsDumpDtlExcel")
    @ApiOperation(value = "Excel导入转储申请行数据", notes = "请求参数示例：{ avatar: file}", httpMethod = "POST")
    @ResponseBody
    public ResponseResult importSafetyInventoryExcel(@RequestParam(value = "avatar") MultipartFile avatar){
    	List<OverseaWhsDumpDtl> safetyList = new ArrayList<OverseaWhsDumpDtl>();
    	if (avatar.isEmpty()) {
            return ResponseResult.error("不能上传空文件");
        }else {
            Sheet sheet = null;
            Row row;
            File temp = null;
            InputStream is;
            try {
                // 另存文件名
                SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
                Calendar calendar = Calendar.getInstance();
                String fileName = df.format(calendar.getTime()) + avatar.getOriginalFilename();
                // 1.附件缓存路径
                String filePath = iFileOperationService.saveMaterialApplicationPic(avatar, fileName);
                // 2.上传附件至minIO文件服务器
                //String fileUrl = iFileOperationService.fileUploader(fileName, filePath);
                //return ResponseResult.success().add("imageUrl",fileUrl);
                temp = new File(filePath);
                is = new FileInputStream(temp);
                Workbook wb;
                Map<String, PictureData> sheetIndexPicMap;
                if (temp.getName().toLowerCase().endsWith(".xls")) {
                    wb = new HSSFWorkbook(is);
                    sheet = wb.getSheetAt(0);// 读取第一个sheet
                } else if (temp.getName().toLowerCase().endsWith(".xlsx")) {
                    wb = new XSSFWorkbook(is);
                    sheet = wb.getSheetAt(0);// 读取第一个sheet
                } else {
                    return ResponseResult.error("只支持excel格式文件！");
                }
                // 得到总行数
                int rowNum = sheet.getLastRowNum();
                if (rowNum <= 1) {
                    return ResponseResult.error("请检查文件内容是否为空！");
                }
                try {
                    for (int i = 2; i <= rowNum; i++) {//正式数据从第三行开始
                        row = sheet.getRow(i);
                        // 手工转化
                        if (row == null){
                            continue;
                        }
                        OverseaWhsDumpDtl dtl = new OverseaWhsDumpDtl();
                        
                        String cell0 = ExportExcel.getCellFormatValue(row.getCell(0));
                        if(StringUtils.isNotEmpty(cell0)){
                        	dtl.setMaterialNo(cell0);//物料编码
                        }else{
                        	return ResponseResult.error("第"+(i+1)+"行“物料编码”不能为空！");
                        }
                        // 判断物料编码是否存在
                        ResponseResult materialSapXM = iMaterialSapService.getMaterialSapXM(dtl.getMaterialNo());
                        Map<String, Object> materialMap = materialSapXM.getData();
                        if (MapUtils.isEmpty(materialMap)) {
                        	return ResponseResult.error("第"+(i+1)+"行“物料编码”不存在！");
                        }
                        List<MaterialSap> materialList = (List<MaterialSap>) materialMap.get("materialList");
                        if (CollectionUtils.isEmpty(materialList)) {
                        	return ResponseResult.error("第"+(i+1)+"行“物料编码”不存在！");
                        }
                        dtl.setBasicUnit(materialList.get(0).getBasicUnit());//基本单位
                        dtl.setUnitSales(materialList.get(0).getUnitSales());// 销售单位
                        // 申请数量
                        String cell1 = ExportExcel.getCellFormatValue(row.getCell(1));
                    	if(StringUtils.isNotEmpty(cell1)){
                    		dtl.setApplyQtyBasicUnit(Double.valueOf(cell1));
                    		dtl.setApplyQtyUnitSales(Double.valueOf(cell1));
                        }else{
                        	dtl.setApplyQtyBasicUnit(0.0);
                        	dtl.setApplyQtyUnitSales(0.0);
                        }
                    	// 申请备注
                    	String cell3 = ExportExcel.getCellFormatValue(row.getCell(3));
                    	dtl.setApplyRemark(cell3);
                    	
                        safetyList.add(dtl);
                    }
//                    String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
//                    ResponseResult res = iOverseaWhsDumpService.batchCreateDumpDtl(safetyList, userId, whsDumpUuid);
//                    if(100 == res.getCode()){
//                        return ResponseResult.error(res.getMsg());
//                    }
                }catch (Exception e) {
                    return ResponseResult.error(e.getMessage());
                }
            }catch (Exception e) {
                return ResponseResult.error(e.getMessage());
            } finally {
                if (temp != null) {
                    boolean newFile = temp.delete();
                    if(!newFile){
                    }
                }
            }
            return ResponseResult.success().add("overseaWhsDumpDtls", safetyList).add("msg", "S");
        }
    }
    
    @RequestMapping("/getOverseaWhsDumpHead")
    @ApiOperation(value = "获取海外转储详情", notes = "获取海外转储详情\n" +
            "示例参数：\n" +
            "spmsId = GF03-1006-20220719-001 \n" +
            "\n", httpMethod = "POST")
    public ResponseResult getOverseaWhsDumpHead(String spmsId){
        try {
            return iOverseaWhsDumpService.getOverseaWhsDumpHead(spmsId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }



    @RequestMapping("/whsDumpToMdM")
    @ApiOperation(value = "转储任务详情推送工厂与物料到MDM", notes = "转储任务详情推送工厂与物料到MDM\n" +
            "", httpMethod = "POST")
    @RequiresPermissions("overseaWhsDump-whsDumpToMdM")
    public ResponseResult whsDumpToMdM(@RequestParam("whsDumpUuid") String whsDumpUuid){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaWhsDumpService.whsDumpToMdM(whsDumpUuid, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }
    
    @RequestMapping("/deleteWhsDumpToSap")
    @ApiOperation(value = "根据转储单号同步SAP，删除SAP的STO&DN单", notes = "根据转储单号同步SAP，删除SAP的STO&DN单\n" +
    		"示例参数：\n" +
            "whsDumpNo = GF03-1006-20220719-001 \n" +
            "\n", httpMethod = "POST")
    @RequiresPermissions("overseaWhsDump-deleteWhsDumpToSap")
    public ResponseResult deleteWhsDumpToSap(@RequestParam("whsDumpNo") String whsDumpNo){
        try {
            String userId = JWTUtil.getUserId(SecurityUtils.getSubject().getPrincipal().toString());
            return iOverseaWhsDumpService.deleteWhsDumpToSap(whsDumpNo, userId);
        }catch (Exception e){
            e.printStackTrace();
            return ResponseResult.error("请求数据失败").add("error", e.getMessage());
        }
    }


}
