| | |
| | | package com.zy.kingdee.controller; |
| | | |
| | | import cn.hutool.core.date.DatePattern; |
| | | import cn.hutool.http.HttpRequest; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.annotations.AppAuth; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.ICMO; |
| | | import com.zy.common.constant.ApiInterfaceConstant; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.kingdee.entity.PoInStockDTO; |
| | | import com.zy.kingdee.entity.ResDto; |
| | | import com.zy.kingdee.utils.ERPDateUtil; |
| | | import com.zy.kingdee.utils.K3ApiUtil; |
| | | import com.zy.kingdee.utils.KingDeeUtils; |
| | | |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import okhttp3.internal.http.HttpMethod; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.ParseException; |
| | | import java.time.LocalDate; |
| | | import java.time.OffsetDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("kingdee") |
| | |
| | | |
| | | return R.ok(parseObject.get("data")); |
| | | } |
| | | |
| | | |
| | | // @PostMapping("/other/synchronizeTheReceiptOrder/v1") |
| | | // @ManagerAuth() |
| | | // @AppAuth(memo = "金蝶新增收料通知单") |
| | | // public R synchronizeTheReceiptOrder(@RequestBody List<ICMO> icmos) { |
| | | // if (null == K3ApiUtil.TokenRes){ |
| | | // K3ApiUtil.init(); |
| | | // } |
| | | // Map<String, String> map = new LinkedHashMap<>(); |
| | | // map.put("access_token", K3ApiUtil.TokenRes.getAccessToken()); |
| | | // Map<String, Object> jsonMap = new HashMap<>(); |
| | | // jsonMap.put("AccountDB","004"); |
| | | // jsonMap.put("Object",getPoInStockDto(icmos)); |
| | | // |
| | | // |
| | | // String resStr = HttpRequest.post("api.kingdee.com" + "/koas/app007140/api/materialreceiptnotice/create" + K3ApiUtil.getMapStr(map)) |
| | | // .header("KIS-Timestamp", Long.toString(System.currentTimeMillis() / 1000L)) |
| | | // .header("KIS-State", "TEST" + K3ApiUtil.getNonce(12)) |
| | | // .header("KIS-TraceID", "TEST") |
| | | // .header("KIS-Ver", "1.0") |
| | | // .header("KIS-AuthData", K3ApiUtil.gatewayDto.getData().getAuthData()) |
| | | // .header("X-Api-SignHeaders", "X-Api-TimeStamp,X-Api-Nonce") |
| | | // .header("X-GW-Router-Addr", K3ApiUtil.gatewayDto.getData().getGwRouterAddr()) |
| | | // .contentType("application/json") |
| | | // .body(JSON.toJSONString(jsonMap)) |
| | | // .execute() |
| | | // .body(); |
| | | // |
| | | // JSONObject parseObject = JSON.parseObject(resStr); |
| | | // if (parseObject.get("errcode").hashCode() != 0) { |
| | | // throw new CoolException(parseObject.get("description").toString()); |
| | | // } |
| | | // return R.ok(parseObject.get("data")); |
| | | // } |
| | | // @SneakyThrows |
| | | // public PoInStockDTO getPoInStockDto(List<ICMO> icmos) { |
| | | // PoInStockDTO.HeadDTO headDTO = new PoInStockDTO.HeadDTO(); |
| | | // headDTO.setFBillNo("test001"); |
| | | // headDTO.setFSupplyID(icmos.get(0).getFSupplyID()); |
| | | // headDTO.setFCurrencyID(1); |
| | | // headDTO.setFdate(ERPDateUtil.getDateStr(new Date(), "yyyy-MM-dd")); |
| | | // headDTO.setFExchangeRate(1D); |
| | | // headDTO.setFDeptID(11376); |
| | | // headDTO.setFEmpID(11375); |
| | | // headDTO.setFPOStyle(252); |
| | | // headDTO.setFBizType(12510); |
| | | // headDTO.setFWWType(0); |
| | | // headDTO.setFAreaPS(20302); |
| | | // |
| | | // List<PoInStockDTO.EntryDTO> entryDTOS = new ArrayList<>(); |
| | | // for (ICMO icmo: icmos){ |
| | | // PoInStockDTO.EntryDTO entryDTO = new PoInStockDTO.EntryDTO(); |
| | | // entryDTO.setFAuxPropID(icmo.getFAuxPropID()); |
| | | // entryDTO.setFBatchNo(icmo.getFGMPBatchNo()); |
| | | // entryDTO.setFCheckMethod(352); |
| | | // entryDTO.setFMTONo(icmo.getFMTONo()); |
| | | // entryDTO.setFPlanMode(icmo.getFPlanMode()); |
| | | // entryDTO.setFSecCoefficient(1D); |
| | | // entryDTO.setFSecQty(icmo.getFQty()); |
| | | // entryDTO.setFUnitID(icmo.getFUnitID().toString()); |
| | | // entryDTOS.add(entryDTO); |
| | | // |
| | | // } |
| | | // PoInStockDTO poInStockDTO = new PoInStockDTO(); |
| | | // poInStockDTO.setHead(headDTO); |
| | | // poInStockDTO.setEntry(entryDTOS); |
| | | // |
| | | // |
| | | // return poInStockDTO; |
| | | // } |
| | | |
| | | |
| | | |
| | | } |