93 lines
3.7 KiB
Java
Raw Normal View History

2025-03-10 13:46:51 +08:00
package com.cim.idm.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
2025-03-24 08:41:44 +08:00
import com.cim.idm.service.Impl.MaterialUndoServiceImpl;
2025-03-10 13:46:51 +08:00
import com.cim.idm.service.MESToWMSService;
import com.cim.idm.service.Impl.MESToWMSServiceImpl;
import com.cim.idm.util.MessageLogUtil;
2025-03-10 13:46:51 +08:00
import com.cim.idm.utils.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
2025-03-10 13:46:51 +08:00
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Api("接收MES请求接口")
@RestController
@RequestMapping("/api/wms")
@Slf4j
public class MESToWMSController {
@Autowired
private MESToWMSServiceImpl mesToWMSService;
2025-05-04 23:23:08 +08:00
/**
* 转工单接口
*/
@ApiOperation(value = "物料转工单请求")
@RequestMapping(value = "/meswms_workorder_request", method = RequestMethod.POST)
public AjaxResult workOrder_Request(@RequestBody JSONArray in) {
log.info("Received work order request: {}", in.toJSONString());
try {
return mesToWMSService.workOrder_Request(in);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
2025-03-24 08:41:44 +08:00
2025-03-10 13:46:51 +08:00
@ApiOperation(value = "物料消耗请求")
@RequestMapping(value = "/meswms_materialconsume_request", method = RequestMethod.POST)
public AjaxResult materialConsume_Request(@RequestBody JSONArray in) {
log.info("Received material consume request: {}", in.toJSONString());
try {
return mesToWMSService.materialConsume_Request(in);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
2025-04-01 16:50:31 +08:00
@ApiOperation(value = "二次确认物料出库请求")
2025-03-10 13:46:51 +08:00
@RequestMapping(value = "/meswms_materialout_request", method = RequestMethod.POST)
public AjaxResult materialOutByMES(@RequestBody JSONArray in) {
log.info("Received material out request: {}", in.toJSONString());
try {
return mesToWMSService.materialOutByMES(in);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@ApiOperation(value = "物料冲销接口请求")
2025-03-10 13:46:51 +08:00
@RequestMapping(value = "/meswms_cancelship_request", method = RequestMethod.POST)
2025-04-01 17:31:06 +08:00
public AjaxResult cancelShipByMES(@RequestBody JSONArray in) {
2025-03-10 13:46:51 +08:00
log.info("Received cancel ship request: {}", in.toJSONString());
2025-03-24 08:41:44 +08:00
String undoId = in.getJSONObject(0).getString("undoId");
String userId = in.getJSONObject(0).getString("userId");
String payMentDate = in.getJSONObject(0).get("payMentDate") == null ? "" : in.getJSONObject(0).get("payMentDate").toString(); //过账日期
if (StringUtils.isBlank(payMentDate)) {
return AjaxResult.me().setSuccess(false).setErrorCode(500).setMessage("payMentDate过账日期不能为空");
}
2025-03-24 08:41:44 +08:00
// return mesToWMSService.cancelShipByMES(in);
2025-04-01 17:31:06 +08:00
try {
return mesToWMSService.sapcprkUndo(undoId, userId, payMentDate);
2025-04-01 17:31:06 +08:00
} catch (Exception e) {
throw new RuntimeException(e);
}
2025-03-10 13:46:51 +08:00
}
@ApiOperation(value = "物料入库请求")
@RequestMapping(value = "/meswms_ship_request", method = RequestMethod.POST)
2025-04-01 17:31:06 +08:00
public AjaxResult shipByMES(@RequestBody JSONArray in) {
2025-03-10 13:46:51 +08:00
log.info("Received ship request: {}", in.toJSONString());
2025-04-01 17:31:06 +08:00
try {
return mesToWMSService.shipByMES(in);
} catch (Exception e) {
throw new RuntimeException(e);
}
2025-03-10 13:46:51 +08:00
}
}