#
luxiaotao1123
2021-04-14 75fe3256789a4c565f27099eba6e2cb34ee1b57d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//package zy.cloud.wms.common.service.erp;
//
//import com.alibaba.fastjson.JSON;
//import com.core.common.Cools;
//import com.core.common.DateUtils;
//import com.core.common.SnowflakeIdWorker;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import zy.cloud.wms.common.model.BillDto;
//import zy.cloud.wms.common.service.erp.entity.UploadBill;
//import zy.cloud.wms.common.service.erp.entity.UploadBillDetail;
//import zy.cloud.wms.manager.utils.HttpHandler;
//
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//
///**
// * Created by vincent on 2021/3/23
// */
//@Slf4j
//@Service("erpService")
//public class ErpService {
//
//    @Autowired
//    private SnowflakeIdWorker snowflakeIdWorker;
//
//    /**
//     * 单据上报
//     */
//    public Boolean uploadBill(List<BillDto> dtos, Integer docId, String docNumber){
//        if (true) {
////            return true;
//        }
//        try {
//            if (Cools.isEmpty(dtos)) {
//                return false;
//            }
//            UploadBill uploadBill = new UploadBill();
//            uploadBill.setNumber(docNumber);
//            uploadBill.setBillDate(DateUtils.convert(new Date(), DateUtils.yyyyMMdd_F));
//            uploadBill.setBTypeID("SHHT");
//            uploadBill.setKTypeID("宏挺仓库");
//            uploadBill.setVchType(docId);
//            List<UploadBillDetail> detail = new ArrayList<>();
//            uploadBill.setDetail(detail);
//            for (BillDto dto : dtos) {
//                UploadBillDetail detl = new UploadBillDetail();
//                detl.setUserCode(dto.getMatnr());
//                detl.setQty(dto.getQty());
//                detl.setPrice(0);
//                detail.add(detl);
//            }
//            System.out.println(JSON.toJSONString(uploadBill));
//            String response = new HttpHandler.Builder()
//                    .setUri(ErpScheduler.URI)
//                    .setPath(ErpScheduler.UPLOAD_BILL)
//                    .setJson(JSON.toJSONString(uploadBill))
//                    .build()
//                    .doPost();
//
//            if (!Cools.isEmpty(response)) {
//                log.warn(response);
//                Result result = JSON.parseObject(response, Result.class);
//                if (result.getCode() != 1) {
//                    return false;
//                }
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//            return false;
//        }
//        return Boolean.TRUE;
//    }
//
//
//}