1
1 天以前 e0921e578658cc5181bcb9ff76f61ba47e6f0d76
rsf-open-api/src/main/java/com/vincent/rsf/openApi/controller/phyz/ERPController.java
@@ -6,6 +6,7 @@
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.openApi.entity.dto.CommonResponse;
import com.vincent.rsf.openApi.entity.phyz.*;
import com.vincent.rsf.openApi.service.phyz.ErpReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -15,6 +16,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
@@ -25,6 +27,12 @@
@Api("银座新工厂(五期)ERP接口")
@Slf4j
public class ERPController {
    public static JSONArray map = new JSONArray();
    @Resource
    private ErpReportService erpReportService;
    @ApiOperation("仓库信息同步")
    @PostMapping("/wareHouse/sync")
@@ -108,7 +116,16 @@
        JSONArray params = paramsFormat(objParams);
        List<Order> orderList = JSON.parseArray(params.toJSONString(), Order.class);
        // 数据处理,转发server
        return CommonResponse.ok();
        StringBuffer errorMsg = new StringBuffer();
        for (Order order : orderList) {
            String i = erpReportService.addOrderToServer(order);
            if (i.equals("200")){
                errorMsg.append(order.getOrderNo()+"下发成功;");
            } else {
                errorMsg.append(order.getOrderNo()+"下发失败,原因:"+i+";");
            }
        }
        return CommonResponse.ok(errorMsg.toString());
    }
    @ApiOperation("入/出库任务通知单取消")
@@ -170,7 +187,10 @@
                    "    \"stockOrgId\": \"ORG001\"\n" +
                    "  }\n" +
                    "]";
            return CommonResponse.ok(JSONArray.parseArray(x, InventoryDetails.class));
            if (map == null || map.isEmpty()) {
                map = JSON.parseArray(x);
            }
            return CommonResponse.ok(JSONArray.parseArray(map.toJSONString(), InventoryDetails.class));
        }
        InventoryQueryCondition condition = JSON.parseObject(params.toJSONString(), InventoryQueryCondition.class);
@@ -281,4 +301,28 @@
        return new JSONArray();
    }
    // region 测试推送功能
    @ApiOperation("登录")
    @PostMapping("/loginBySign")
    public CommonResponse loginBySign() {
        try {
            return CommonResponse.ok(erpReportService.loginBySign());
        } catch (Exception e) {
            log.error("erp, loginBySign", e);
        }
        return CommonResponse.ok();
    }
    @ApiOperation("入/出库任务回调")
    @PostMapping("/reportInOrOutBound")
    public CommonResponse reportInOrOutBound(@RequestBody Object objParams) {
        try {
            return erpReportService.reportInOrOutBound(objParams);
        } catch (Exception e) {
            log.error("erp, reportInOrOutBound", e);
        }
        return CommonResponse.ok();
    }
    // endregion
}