package com.zy.api.controller;
|
|
import com.alibaba.fastjson.JSON;
|
import com.core.common.R;
|
import com.zy.api.entity.OrderParams;
|
import com.zy.api.service.KopenApiService;
|
import com.zy.asrs.entity.Mat;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Objects;
|
|
@RestController
|
@RequestMapping("/kopen")
|
public class KopenApiController {
|
|
@Autowired
|
private KopenApiService kopenApiService;
|
|
/**
|
* 上游下发派工单
|
*
|
* @author Ryan
|
* @date 2025/11/24 15:18
|
* @param params
|
* @return com.core.common.R
|
*/
|
@ApiOperation("上架派工单")
|
@PostMapping("/order/add")
|
public R receiveOrders(@RequestBody OrderParams params) {
|
if (Objects.isNull(params)) {
|
return R.error("参数不能为空!!");
|
}
|
if (Objects.isNull(params.getType())) {
|
return R.error("单据类型不能为空!");
|
}
|
return kopenApiService.receiveOrders(params);
|
}
|
|
/**
|
* 上游下发零件数据变更
|
* s
|
* @author Ryan
|
* @date 2025/11/24 15:19
|
* @param params
|
* @return com.core.common.R
|
*/
|
@ApiOperation("零件信息数据更新")
|
@PostMapping("/sync/mat")
|
public R basMatUpdate(@RequestBody Map<String, String> params) {
|
if (Objects.isNull(params.get("matnrs"))) {
|
return R.error("参数不能为空!!");
|
}
|
if (params.get("matnrs").isEmpty()) {
|
return R.error("变更零件明细不能为空!!");
|
}
|
List<Mat> mats = JSON.parseArray(params.get("matnrs"), Mat.class);
|
|
return kopenApiService.basMatupdate(mats);
|
}
|
|
|
|
}
|