no message

main
HUOJIN\92525 2024-04-15 14:55:09 +08:00
parent b129e0f404
commit d47e09fdec
17 changed files with 185 additions and 54 deletions

View File

@ -24,7 +24,7 @@ package com.youchain.exception;
public class BadConfigurationException extends RuntimeException { public class BadConfigurationException extends RuntimeException {
/** /**
* Constructs a new runtime exception with {@code null} as its * Constructs a new runtime exception with {@code null} as its
* detail message. The cause is not initialized, and may subsequently be * detail . The cause is not initialized, and may subsequently be
* initialized by a call to {@link #initCause}. * initialized by a call to {@link #initCause}.
*/ */
public BadConfigurationException() { public BadConfigurationException() {

View File

@ -24,10 +24,10 @@ import org.springframework.util.StringUtils;
public class EntityNotFoundException extends RuntimeException { public class EntityNotFoundException extends RuntimeException {
public EntityNotFoundException(Class clazz, String field, String val) { public EntityNotFoundException(Class clazz, String field, String val) {
super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val)); super(EntityNotFoundException.generate(clazz.getSimpleName(), field, val));
} }
private static String generateMessage(String entity, String field, String val) { private static String generate(String entity, String field, String val) {
return StringUtils.capitalize(entity) return StringUtils.capitalize(entity)
+ " with " + field + " "+ val + " does not exist"; + " with " + field + " "+ val + " does not exist";
} }

View File

@ -5,8 +5,8 @@ import lombok.Data;
@Data @Data
public class ApiResult { public class ApiResult {
private Object data;//数据 private Object data;//数据
private String message;//内容 private String msg;//内容
private int status;//编码 private int code;//编码
public static ApiResult fail() { public static ApiResult fail() {
@ -29,14 +29,14 @@ public class ApiResult {
return result(200, msg, data); return result(200, msg, data);
} }
public static ApiResult success(int status, String msg, Object data) { public static ApiResult success(int code, String msg, Object data) {
return result(status, msg, data); return result(code, msg, data);
} }
public static ApiResult result(int status, String message, Object data) { public static ApiResult result(int code, String msg, Object data) {
ApiResult rs = new ApiResult(); ApiResult rs = new ApiResult();
rs.setStatus(status); rs.setCode(code);
rs.setMessage(message); rs.setMsg(msg);
rs.setData(data); rs.setData(data);
return rs; return rs;
} }

View File

@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
@Generated( @Generated(
value = "org.mapstruct.ap.MappingProcessor", value = "org.mapstruct.ap.MappingProcessor",
date = "2024-04-11T14:17:39+0800", date = "2024-04-12T19:52:30+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)" comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
) )
@Component @Component

View File

@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
@Generated( @Generated(
value = "org.mapstruct.ap.MappingProcessor", value = "org.mapstruct.ap.MappingProcessor",
date = "2024-04-11T14:17:40+0800", date = "2024-04-12T19:52:32+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)" comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
) )
@Component @Component

View File

@ -0,0 +1,30 @@
package com.youchain.businessdata.inputJson;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Set;
/**
*
*/
@Data
public class IssueInfo {
@ApiModelProperty(value = "任务号")
@Schema(example = "WQ202303290001")
String taskNumber;
@ApiModelProperty(value = "来源系统")
@Schema(example = "MLS")
String sourceSystem;
@ApiModelProperty(value = "库存组织id")
@Schema(example = "808")
int orgId;
@ApiModelProperty(value = "任务号")
@Schema(example = "[\"QZSC2108010201\"]")
Set workOrderName;
}

View File

@ -199,8 +199,8 @@ public class AsnDetailController {
} }
ApiResult r1= putawayInv(d,d.getPoint(),dstPoint); ApiResult r1= putawayInv(d,d.getPoint(),dstPoint);
if(r1.getStatus()==400){ if(r1.getCode()==400){
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMessage()); ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMsg());
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
} }
@ -275,21 +275,21 @@ public class AsnDetailController {
IScanPut s=new IScanPut(); IScanPut s=new IScanPut();
s.setScanCode(mo); s.setScanCode(mo);
ApiResult r1=analysisMO(s); ApiResult r1=analysisMO(s);
if(r1.getStatus()==400){ if(r1.getCode()==400){
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMessage()); ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMsg());
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
} }
RRkMo rmo=(RRkMo)r1.getData(); RRkMo rmo=(RRkMo)r1.getData();
ApiResult r2=retrievalStockCode(new IRkStockCode(rmo.getItemId(),stockCode)); ApiResult r2=retrievalStockCode(new IRkStockCode(rmo.getItemId(),stockCode));
if(r2.getStatus()==400){ if(r2.getCode()==400){
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r2.getMessage()); ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r2.getMsg());
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
} }
JSONObject obj=(JSONObject)r2.getData(); JSONObject obj=(JSONObject)r2.getData();
Long stockId=(Long)obj.get("stockId"); Long stockId=(Long)obj.get("stockId");
ApiResult r3=createAsnDetail(new IRkConfirm(mo,rmo.getItemId(),rmo.getItemCode(),stockId,stockCode,rmo.getQty(),rmo.getPch(),rmo.getCjbh())); ApiResult r3=createAsnDetail(new IRkConfirm(mo,rmo.getItemId(),rmo.getItemCode(),stockId,stockCode,rmo.getQty(),rmo.getPch(),rmo.getCjbh()));
if(r3.getStatus()==400){ if(r3.getCode()==400){
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r3.getMessage()); ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r3.getMsg());
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
} }
new_len++; new_len++;
@ -316,21 +316,21 @@ public class AsnDetailController {
IScanPut s=new IScanPut(); IScanPut s=new IScanPut();
s.setScanCode(MO); s.setScanCode(MO);
ApiResult r1=analysisMO(s); ApiResult r1=analysisMO(s);
if(r1.getStatus()==400){ if(r1.getCode()==400){
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMessage()); ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMsg());
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
} }
RRkMo rmo=(RRkMo)r1.getData(); RRkMo rmo=(RRkMo)r1.getData();
ApiResult r2=retrievalStockCode(new IRkStockCode(rmo.getItemId(),stockCode)); ApiResult r2=retrievalStockCode(new IRkStockCode(rmo.getItemId(),stockCode));
if(r2.getStatus()==400){ if(r2.getCode()==400){
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r2.getMessage()); ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r2.getMsg());
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
} }
JSONObject obj=(JSONObject)r2.getData(); JSONObject obj=(JSONObject)r2.getData();
Long stockId=(Long)obj.get("stockId"); Long stockId=(Long)obj.get("stockId");
ApiResult r3=createAsnDetail(new IRkConfirm(MO,rmo.getItemId(),rmo.getItemCode(),stockId,stockCode,rmo.getQty(),rmo.getPch(),rmo.getCjbh())); ApiResult r3=createAsnDetail(new IRkConfirm(MO,rmo.getItemId(),rmo.getItemCode(),stockId,stockCode,rmo.getQty(),rmo.getPch(),rmo.getCjbh()));
if(r3.getStatus()==400){ if(r3.getCode()==400){
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r3.getMessage()); ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r3.getMsg());
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
} }
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
@ -474,7 +474,7 @@ public class AsnDetailController {
return ApiResult.result(400,dstPoint+"找不到终点或状态不对",obj); return ApiResult.result(400,dstPoint+"找不到终点或状态不对",obj);
} }
ApiResult r1= putawayInv(ad,srcPoint,dstPoint); ApiResult r1= putawayInv(ad,srcPoint,dstPoint);
if(r1.getStatus()==400){ if(r1.getCode()==400){
return r1; return r1;
} }

View File

@ -3,10 +3,7 @@ package com.youchain.businessdata.rest;
import com.youchain.annotation.AnonymousAccess; import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log; import com.youchain.annotation.Log;
import com.youchain.appupdate.inputJson.MissionStateCallback; import com.youchain.appupdate.inputJson.MissionStateCallback;
import com.youchain.businessdata.inputJson.MoInfo; import com.youchain.businessdata.inputJson.*;
import com.youchain.businessdata.inputJson.OrderInfo;
import com.youchain.businessdata.inputJson.ReturnIssueInfo;
import com.youchain.businessdata.inputJson.ReturnMoInfo;
import com.youchain.businessdata.service.MlsService; import com.youchain.businessdata.service.MlsService;
import com.youchain.exception.handler.ApiResult; import com.youchain.exception.handler.ApiResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -95,6 +92,19 @@ public class MlsController {
} }
} }
@PostMapping("/getIssueInfo")
@AnonymousAccess
@Log("叫料指令")
@ApiOperation("叫料指令")
public ResponseEntity<Object> getIssueInfo(@RequestBody IssueInfo issueInfo) {
try {
mlsService.getIssueInfo(issueInfo);
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
}
}
@PostMapping("/returnIssue") @PostMapping("/returnIssue")
@AnonymousAccess @AnonymousAccess
@Log("叫料结果回传") @Log("叫料结果回传")

View File

@ -29,6 +29,7 @@ import org.springframework.data.domain.Pageable;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
import java.io.IOException; import java.io.IOException;
import java.util.Set;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** /**
@ -100,4 +101,6 @@ public interface InventoryService {
List<Inventory> queryInventory(Stock stock); List<Inventory> queryInventory(Stock stock);
List<Inventory> getInvForPlan(String type,Long areaId,Long itemId,Long deptId); List<Inventory> getInvForPlan(String type,Long areaId,Long itemId,Long deptId);
List<Inventory> findInvByBillCode(Set billCode);
} }

View File

@ -1,10 +1,7 @@
package com.youchain.businessdata.service; package com.youchain.businessdata.service;
import com.youchain.annotation.Log; import com.youchain.annotation.Log;
import com.youchain.businessdata.inputJson.MoInfo; import com.youchain.businessdata.inputJson.*;
import com.youchain.businessdata.inputJson.OrderInfo;
import com.youchain.businessdata.inputJson.ReturnIssueInfo;
import com.youchain.businessdata.inputJson.ReturnMoInfo;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/** /**
@ -43,6 +40,13 @@ public interface MlsService {
*/ */
void getMoInfo(String resultJson); void getMoInfo(String resultJson);
/**
*
* @return
*/
void getIssueInfo(IssueInfo issueInfo);
/** /**
* MO * MO
* @return * @return

View File

@ -218,6 +218,18 @@ public class InventoryServiceImpl implements InventoryService {
return list; return list;
} }
@Override
public List<Inventory> findInvByBillCode(Set billCode) {
if (billCode.isEmpty()) {
return null;
}
String hql = " from Inventory inv where 1=1 and inv.billCode in (:billCode) ";
Query query = entityManager.createQuery(hql);
query.setParameter("billCode", billCode);
List<Inventory> list = query.getResultList();
return list;
}
public List<Object[]> queryItemStock() { public List<Object[]> queryItemStock() {
String hql = "select inv.itemKey.item.code,max(inv.itemKey.item.name),count(inv.id) " + String hql = "select inv.itemKey.item.code,max(inv.itemKey.item.name),count(inv.id) " +
" from Inventory inv where 1=1 and inv.quantity>0 group by inv.itemKey.item.code order by inv.itemKey.item.code"; " from Inventory inv where 1=1 and inv.quantity>0 group by inv.itemKey.item.code order by inv.itemKey.item.code";

View File

@ -5,22 +5,20 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.youchain.basicdata.domain.Item; import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock;
import com.youchain.basicdata.service.ItemService; import com.youchain.basicdata.service.ItemService;
import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.dto.ItemDto; import com.youchain.basicdata.service.dto.ItemDto;
import com.youchain.businessdata.domain.Mo; import com.youchain.businessdata.domain.*;
import com.youchain.businessdata.domain.Order; import com.youchain.businessdata.inputJson.*;
import com.youchain.businessdata.inputJson.MoInfo; import com.youchain.businessdata.service.*;
import com.youchain.businessdata.inputJson.OrderInfo;
import com.youchain.businessdata.inputJson.ReturnIssueInfo;
import com.youchain.businessdata.inputJson.ReturnMoInfo;
import com.youchain.businessdata.service.MlsService;
import com.youchain.businessdata.service.MoService;
import com.youchain.businessdata.service.OrderService;
import com.youchain.businessdata.service.dto.MoDto; import com.youchain.businessdata.service.dto.MoDto;
import com.youchain.businessdata.service.dto.OrderDto; import com.youchain.businessdata.service.dto.OrderDto;
import com.youchain.modules.system.domain.Dept; import com.youchain.modules.system.domain.Dept;
import com.youchain.modules.system.service.DeptService; import com.youchain.modules.system.service.DeptService;
import com.youchain.modules.system.service.dto.DeptDto; import com.youchain.modules.system.service.dto.DeptDto;
import com.youchain.utils.BizStatus;
import com.youchain.utils.HttpPostUtil; import com.youchain.utils.HttpPostUtil;
import com.youchain.utils.StringUtils; import com.youchain.utils.StringUtils;
import com.youchain.utils.UrlApi; import com.youchain.utils.UrlApi;
@ -39,6 +37,9 @@ public class MlsServiceImpl implements MlsService {
private final ItemService itemService; private final ItemService itemService;
private final DeptService deptService; private final DeptService deptService;
private final MoService moService; private final MoService moService;
private final PointService pointService;
private final PickDetailService pickDetailService;
private final InventoryService inventoryService;
/** /**
* Token * Token
@ -102,6 +103,9 @@ public class MlsServiceImpl implements MlsService {
} }
JSONObject resulObject = JSON.parseObject(resultJson); JSONObject resulObject = JSON.parseObject(resultJson);
if (resulObject == null) {
throw new RuntimeException("获取送货单接口返回数据为空!");
}
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code"); String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg"); String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
//判断接口是否成功 //判断接口是否成功
@ -204,6 +208,9 @@ public class MlsServiceImpl implements MlsService {
} }
JSONObject resulObject = JSON.parseObject(resultJson); JSONObject resulObject = JSON.parseObject(resultJson);
if (resulObject == null) {
throw new RuntimeException("获取MO票接口返回数据为空!");
}
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code"); String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg"); String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
if (!"0".equals(code)) { if (!"0".equals(code)) {
@ -284,6 +291,70 @@ public class MlsServiceImpl implements MlsService {
} }
} }
@Override
public synchronized void getIssueInfo(IssueInfo issueInfo) {
Set workOrderNameSet = issueInfo.getWorkOrderName();
if (workOrderNameSet.size() == 0) {
throw new RuntimeException("没有获取到工单号!");
}
List<Inventory> inventoryList = inventoryService.findInvByBillCode(workOrderNameSet);//根据工单号查询库存信息
if (inventoryList.size() == 0) {
throw new RuntimeException("无库存信息!");
}
//目标点
Point endPoint = pointService.findByCode("",null,null,null,null);
for (Inventory inv : inventoryList) {
//根据库存信息生成叫料任务
Stock stock = inv.getStock();//容器
Point startPoint = inv.getPoint();//起始点位
inv.setQueuedQty(inv.getQueuedQty());
inventoryService.update(inv);
PickDetail pd = new PickDetail();
pd.setItem(inv.getItemKey().getItem());
pd.setPo(inv.getBillCode());
pd.setOrderQty(inv.getQuantity());
pd.setAllocatedQty(inv.getQuantity());
pd.setStatus(BizStatus.ALLOCATE);
pickDetailService.create(pd);
/*//生成搬运任务
AgvTask agvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "01");
agvTaskRepository.save(agvTask);
//生成Task
Task task = new Task();
task.setItem(item);
task.setItemKey(inv.getItemKey());
task.setPickDetail(pd);
task.setBillCode(pd.getPo());
task.setSrcStock(inv.getStock());
task.setDstStock(inv.getStock());
task.setSrcPoint(startPoint);
task.setDstPoint(endPoint);
task.setSrcStockCode(inv.getStock().getCode());
task.setSrcPointCode(startPoint.getCode());
task.setDstPointCode(endPoint.getCode());
task.setInvStatus(inv.getStatus());
task.setTaskStatus(BizStatus.OPEN);
task.setPlanQty(allocateQty);
task.setInvId(inv.getId());
task.setDept(dept);
task.setAgvTask(agvTask);
taskRepository.save(task);*/
}
}
/**
* Mo
*
* @param returnMoInfo
* @return
*/
@Override @Override
public String returnMo(ReturnMoInfo returnMoInfo) { public String returnMo(ReturnMoInfo returnMoInfo) {
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>()); JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
@ -297,6 +368,7 @@ public class MlsServiceImpl implements MlsService {
/** /**
* *
*
* @param returnIssueInfo * @param returnIssueInfo
* @return * @return
*/ */

View File

@ -10,8 +10,8 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
public class HttpUtils { public class HttpUtils {
public static ResponseEntity<Object> handle(ApiResult r){ public static ResponseEntity<Object> handle(ApiResult r){
if(r.getStatus()==400){ if(r.getCode()==400){
ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r.getMessage()); ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r.getMsg());
return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus())); return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
}else{ }else{
return new ResponseEntity<>(r.getData(),HttpStatus.OK); return new ResponseEntity<>(r.getData(),HttpStatus.OK);

View File

@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
@Generated( @Generated(
value = "org.mapstruct.ap.MappingProcessor", value = "org.mapstruct.ap.MappingProcessor",
date = "2024-04-11T14:17:42+0800", date = "2024-04-12T19:53:04+0800",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)" comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
) )
@Component @Component