#
luxiaotao1123
2021-04-03 c9686962d78c018a89c5be7023b4ef74960e5d5b
src/main/java/zy/cloud/wms/common/service/erp/ErpService.java
@@ -7,9 +7,9 @@
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.entity.Comb;
import zy.cloud.wms.manager.utils.HttpHandler;
import java.util.ArrayList;
@@ -29,32 +29,37 @@
    /**
     * 单据上报
     */
    public Boolean uploadBill(List<Comb> combs, Integer docId, String docNumber){
    public Boolean uploadBill(List<BillDto> dtos, Integer docId, String docNumber){
        if (true) {
//            return true;
        }
        try {
            if (Cools.isEmpty(combs)) {
            if (Cools.isEmpty(dtos)) {
                return false;
            }
            UploadBill uploadBill = new UploadBill();
            uploadBill.setNumber(docNumber);
            uploadBill.setBillDate(DateUtils.convert(new Date(), DateUtils.yyyyMMdd_F));
            uploadBill.setBTypeID("宏挺客户");
            uploadBill.setBTypeID("SHHT");
            uploadBill.setKTypeID("宏挺仓库");
            uploadBill.setVchType(docId);
            List<UploadBillDetail> detail = new ArrayList<>();
            uploadBill.setDetail(detail);
            for (Comb comb : combs) {
            for (BillDto dto : dtos) {
                UploadBillDetail detl = new UploadBillDetail();
                detl.setUserCode(comb.getMatnr());
                detl.setQty(comb.getAnfme());
                detl.setPrice(0.0D);
                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);