no message
parent
8d773f3630
commit
a74b651dce
|
|
@ -26,5 +26,5 @@ public class MoInfo {
|
||||||
int pageSize;
|
int pageSize;
|
||||||
|
|
||||||
@ApiModelProperty(value = "参数")
|
@ApiModelProperty(value = "参数")
|
||||||
Params params;
|
MoParams params;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
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 MoParams {
|
||||||
|
@ApiModelProperty(value = "库存组织id")
|
||||||
|
@Schema(example = "100059")
|
||||||
|
int orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "子库编码")
|
||||||
|
@Schema(example = "[\"MA2111\"]")
|
||||||
|
Set invCodes;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开始时间")
|
||||||
|
@Schema(example = "2023-07-03 00:00:00")
|
||||||
|
String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束时间")
|
||||||
|
@Schema(example = "2023-07-03 23:59:59")
|
||||||
|
String endTime;
|
||||||
|
|
||||||
|
public MoParams() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MoParams(int orgId, Set invCodes, String startTime, String endTime) {
|
||||||
|
this.orgId = orgId;
|
||||||
|
this.invCodes = invCodes;
|
||||||
|
this.startTime = startTime;
|
||||||
|
this.endTime = endTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package com.youchain.businessdata.inputJson;
|
package com.youchain.businessdata.inputJson;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,13 +18,13 @@ public class OrderInfo {
|
||||||
String sourceSystem;
|
String sourceSystem;
|
||||||
|
|
||||||
@ApiModelProperty(value = "参数")
|
@ApiModelProperty(value = "参数")
|
||||||
Params params;
|
OrderParams params;
|
||||||
|
|
||||||
public OrderInfo() {
|
public OrderInfo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderInfo(String ifaceCode, String sourceSystem, Params params) {
|
public OrderInfo(String ifaceCode, String sourceSystem, OrderParams params) {
|
||||||
this.ifaceCode = ifaceCode;
|
this.ifaceCode = ifaceCode;
|
||||||
this.sourceSystem = sourceSystem;
|
this.sourceSystem = sourceSystem;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,18 @@ package com.youchain.businessdata.inputJson;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class Params {
|
public class OrderParams {
|
||||||
@ApiModelProperty(value = "库存组织id")
|
@ApiModelProperty(value = "库存组织id")
|
||||||
@Schema(example = "100059")
|
@Schema(example = "100059")
|
||||||
int orgId;
|
int orgId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "子库编码")
|
@ApiModelProperty(value = "子库编码")
|
||||||
@Schema(example = "[\"MA1181\", \"MA1181\"]")
|
@Schema(example = "[\"MA2111\"]")
|
||||||
Set invCodes;
|
Set invCodes;
|
||||||
|
|
||||||
@ApiModelProperty(value = "检验结果")
|
@ApiModelProperty(value = "检验结果")
|
||||||
|
|
@ -36,11 +35,11 @@ public class Params {
|
||||||
@Schema(example = "100")
|
@Schema(example = "100")
|
||||||
int pageSize;
|
int pageSize;
|
||||||
|
|
||||||
public Params(){
|
public OrderParams(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Params(int orgId, Set invCodes, String iqcResult, String startTime, String endTime,int pageNo,int pageSize) {
|
public OrderParams(int orgId, Set invCodes, String iqcResult, String startTime, String endTime, int pageNo, int pageSize) {
|
||||||
this.orgId = orgId;
|
this.orgId = orgId;
|
||||||
this.invCodes = invCodes;
|
this.invCodes = invCodes;
|
||||||
this.iqcResult = iqcResult;
|
this.iqcResult = iqcResult;
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.youchain.businessdata.inputJson;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
/**
|
||||||
|
* @author <NAME>
|
||||||
|
* @date 2024/04/12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReturnIssueInfo {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "接口编码")
|
||||||
|
@Schema(example = "MLS-WQ-006")
|
||||||
|
String ifaceCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "来源系统")
|
||||||
|
@Schema(example = "WQ")
|
||||||
|
String sourceSystem;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "参数")
|
||||||
|
ReturnIssueInfoParams params;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
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 ReturnIssueInfoParams {
|
||||||
|
@ApiModelProperty(value = "类型")
|
||||||
|
@Schema(example = "ISSUE")
|
||||||
|
String billType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "库存组织id")
|
||||||
|
@Schema(example = "100219")
|
||||||
|
int orgId;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标签集合")
|
||||||
|
@Schema(example = "[\"DC0001\"]")
|
||||||
|
Set labelNos;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "子库编码")
|
||||||
|
@Schema(example = "MC1311")
|
||||||
|
String invCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "需求工单")
|
||||||
|
@Schema(example = "ZZ总部18210606021401")
|
||||||
|
String workOrderName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.youchain.businessdata.inputJson;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
/**
|
||||||
|
* @author <huojin>
|
||||||
|
* Description:回传MO信息入参
|
||||||
|
* @date 2024/04/12
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ReturnMoInfo {
|
||||||
|
@ApiModelProperty(value = "接口编码")
|
||||||
|
@Schema(example = "MLS-WQ-004")
|
||||||
|
String ifaceCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "来源系统")
|
||||||
|
@Schema(example = "WQ")
|
||||||
|
String sourceSystem;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "参数")
|
||||||
|
ReturnMoParams params;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
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 ReturnMoParams {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "库存组织id")
|
||||||
|
@Schema(example = "100059")
|
||||||
|
int orgId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "子库编码")
|
||||||
|
@Schema(example = "MC1311")
|
||||||
|
String invCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标签集合")
|
||||||
|
@Schema(example = "[\"DC220608000006\"]")
|
||||||
|
Set labelNos;
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,8 @@ 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.MoInfo;
|
||||||
import com.youchain.businessdata.inputJson.OrderInfo;
|
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;
|
||||||
|
|
@ -36,12 +38,18 @@ public class MlsController {
|
||||||
@ApiOperation("获取送货单信息")
|
@ApiOperation("获取送货单信息")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> getOrderInfo(@RequestBody OrderInfo orderInfo) {
|
public ResponseEntity<Object> getOrderInfo(@RequestBody OrderInfo orderInfo) {
|
||||||
String resultJson = mlsService.getOrderJson(orderInfo);
|
String resultJson = "";
|
||||||
|
try {
|
||||||
|
resultJson = mlsService.getOrderJson(orderInfo);//获取送货单JSON
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
if (resultJson == null || resultJson.length() == 0) {
|
if (resultJson == null || resultJson.length() == 0) {
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
mlsService.getOrderInfo(resultJson);
|
mlsService.getOrderInfo(resultJson);//获取送货单
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
|
@ -52,15 +60,21 @@ public class MlsController {
|
||||||
|
|
||||||
@PostMapping("/getMoInfo")
|
@PostMapping("/getMoInfo")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
@Log("获取Mo票信息")
|
@Log("获取MO票信息")
|
||||||
@ApiOperation("获取Mo票信息")
|
@ApiOperation("获取MO票信息")
|
||||||
public ResponseEntity<Object> getMoInfo(@RequestBody MoInfo moInfo) {
|
public ResponseEntity<Object> getMoInfo(@RequestBody MoInfo moInfo) {
|
||||||
String resultJson = mlsService.getMoJson(moInfo);
|
String resultJson = "";
|
||||||
|
try {
|
||||||
|
resultJson = mlsService.getMoJson(moInfo);//获取Mo票JSON
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
if (resultJson == null || resultJson.length() == 0) {
|
if (resultJson == null || resultJson.length() == 0) {
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
mlsService.getMoInfo(resultJson);
|
mlsService.getMoInfo(resultJson);//获取Mo票
|
||||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
|
@ -68,4 +82,31 @@ public class MlsController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/returnMo")
|
||||||
|
@AnonymousAccess
|
||||||
|
@Log("按MO票入库")
|
||||||
|
@ApiOperation("按MO票入库")
|
||||||
|
public ResponseEntity<Object> returnMo(@RequestBody ReturnMoInfo returnMoInfo) {
|
||||||
|
try {
|
||||||
|
String resultJson = mlsService.returnMo(returnMoInfo);//回传MO票J
|
||||||
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/returnIssue")
|
||||||
|
@AnonymousAccess
|
||||||
|
@Log("叫料结果回传")
|
||||||
|
@ApiOperation("叫料结果回传")
|
||||||
|
public ResponseEntity<Object> returnIssue(@RequestBody ReturnIssueInfo returnMoInfo) {
|
||||||
|
try {
|
||||||
|
String resultJson = mlsService.returnIssue(returnMoInfo);//叫料结果回传
|
||||||
|
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ 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.MoInfo;
|
||||||
import com.youchain.businessdata.inputJson.OrderInfo;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -10,6 +12,12 @@ import io.swagger.annotations.ApiOperation;
|
||||||
*/
|
*/
|
||||||
public interface MlsService {
|
public interface MlsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取ToKen
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getToKen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取送货单JSON
|
* 获取送货单JSON
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -34,4 +42,16 @@ public interface MlsService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void getMoInfo(String resultJson);
|
void getMoInfo(String resultJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回传MO票
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String returnMo(ReturnMoInfo returnMoInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 叫料结果回传
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String returnIssue(ReturnIssueInfo returnIssueInfo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ public interface MoService {
|
||||||
*/
|
*/
|
||||||
MoDto findById(Integer id);
|
MoDto findById(Integer id);
|
||||||
|
|
||||||
|
MoDto findByLabelNo(String labelNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
* @param resources /
|
* @param resources /
|
||||||
|
|
@ -80,4 +82,11 @@ public interface MoService {
|
||||||
* @throws IOException /
|
* @throws IOException /
|
||||||
*/
|
*/
|
||||||
void download(List<MoDto> all, HttpServletResponse response) throws IOException;
|
void download(List<MoDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将MoDto转换为Entity对象的方法
|
||||||
|
* @param moDto 要转换的对象
|
||||||
|
* @return 转换后的对象
|
||||||
|
*/
|
||||||
|
Mo toEntity(MoDto moDto);
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,9 @@
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service;
|
package com.youchain.businessdata.service;
|
||||||
|
|
||||||
|
import com.youchain.businessdata.domain.Mo;
|
||||||
import com.youchain.businessdata.domain.Order;
|
import com.youchain.businessdata.domain.Order;
|
||||||
|
import com.youchain.businessdata.service.dto.MoDto;
|
||||||
import com.youchain.businessdata.service.dto.OrderDto;
|
import com.youchain.businessdata.service.dto.OrderDto;
|
||||||
import com.youchain.businessdata.service.dto.OrderQueryCriteria;
|
import com.youchain.businessdata.service.dto.OrderQueryCriteria;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
@ -54,6 +56,13 @@ public interface OrderService {
|
||||||
*/
|
*/
|
||||||
OrderDto findById(Integer id);
|
OrderDto findById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据barcodeNumber查询
|
||||||
|
* @param barcodeNumber
|
||||||
|
* @return OrderDto
|
||||||
|
*/
|
||||||
|
OrderDto findByBarcodeNumber(String barcodeNumber);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
* @param resources /
|
* @param resources /
|
||||||
|
|
@ -81,4 +90,12 @@ public interface OrderService {
|
||||||
*/
|
*/
|
||||||
void download(List<OrderDto> all, HttpServletResponse response) throws IOException;
|
void download(List<OrderDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将MoDto转换为Entity对象的方法
|
||||||
|
* @param orderDto 要转换的对象
|
||||||
|
* @return 转换后的对象
|
||||||
|
*/
|
||||||
|
Order toEntity(OrderDto orderDto);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
package com.youchain.businessdata.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ToKen服务接口
|
|
||||||
*/
|
|
||||||
public interface ToKenService {
|
|
||||||
/**
|
|
||||||
* 获取ToKen
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String getToKen();
|
|
||||||
}
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
package com.youchain.businessdata.service.dto;
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.youchain.annotation.Query;
|
import com.youchain.annotation.Query;
|
||||||
|
|
||||||
|
|
@ -26,4 +28,25 @@ import com.youchain.annotation.Query;
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class MoQueryCriteria{
|
public class MoQueryCriteria{
|
||||||
|
|
||||||
|
/** 关联Id */
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String deliveryHeaderId;
|
||||||
|
|
||||||
|
/** Mo票 */
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String labelNo;
|
||||||
|
|
||||||
|
@Query(joinName = "item", propName="code",type = Query.Type.INNER_LIKE)
|
||||||
|
private long itemCode;
|
||||||
|
|
||||||
|
@Query(joinName = "item", propName="name",type = Query.Type.INNER_LIKE)
|
||||||
|
private long itemName;
|
||||||
|
|
||||||
|
/** Mo状态 */
|
||||||
|
@Query(type = Query.Type.EQUAL)
|
||||||
|
private String labelState;
|
||||||
|
|
||||||
|
@Query(type = Query.Type.BETWEEN)
|
||||||
|
private List<Timestamp> createTime;
|
||||||
}
|
}
|
||||||
|
|
@ -28,6 +28,11 @@ import com.youchain.annotation.Query;
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
public class OrderQueryCriteria{
|
public class OrderQueryCriteria{
|
||||||
|
|
||||||
|
/** 关联Id */
|
||||||
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
|
private String deliveryHeaderId;
|
||||||
|
|
||||||
/** 送货单条码号 */
|
/** 送货单条码号 */
|
||||||
@Query(type = Query.Type.INNER_LIKE)
|
@Query(type = Query.Type.INNER_LIKE)
|
||||||
private String barcodeNumber;
|
private String barcodeNumber;
|
||||||
|
|
|
||||||
|
|
@ -6,38 +6,72 @@ 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.service.ItemService;
|
import com.youchain.basicdata.service.ItemService;
|
||||||
|
import com.youchain.basicdata.service.dto.ItemDto;
|
||||||
import com.youchain.businessdata.domain.Mo;
|
import com.youchain.businessdata.domain.Mo;
|
||||||
import com.youchain.businessdata.domain.Order;
|
import com.youchain.businessdata.domain.Order;
|
||||||
import com.youchain.businessdata.inputJson.MoInfo;
|
import com.youchain.businessdata.inputJson.MoInfo;
|
||||||
import com.youchain.businessdata.inputJson.OrderInfo;
|
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.businessdata.service.MoService;
|
import com.youchain.businessdata.service.MoService;
|
||||||
import com.youchain.businessdata.service.OrderService;
|
import com.youchain.businessdata.service.OrderService;
|
||||||
import com.youchain.businessdata.service.ToKenService;
|
import com.youchain.businessdata.service.dto.MoDto;
|
||||||
|
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.HttpPostUtil;
|
import com.youchain.utils.HttpPostUtil;
|
||||||
|
import com.youchain.utils.StringUtils;
|
||||||
import com.youchain.utils.UrlApi;
|
import com.youchain.utils.UrlApi;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.Query;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MlsServiceImpl implements MlsService {
|
public class MlsServiceImpl implements MlsService {
|
||||||
private final ToKenService toKenService;
|
|
||||||
private final OrderService orderService;
|
private final OrderService orderService;
|
||||||
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 EntityManager entityMapper;
|
|
||||||
|
/**
|
||||||
|
* 获取Token
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getToKen() {
|
||||||
|
String toKen = "";
|
||||||
|
String mlsUser = "WMS";
|
||||||
|
String mlsPwd = "EDlsFOvn3xaJm*EH";
|
||||||
|
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||||
|
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||||
|
objMap.put("mlsUser", mlsUser);//快码代码
|
||||||
|
objMap.put("mlsPwd", mlsPwd);//快码值
|
||||||
|
jsonObject.putAll(objMap);
|
||||||
|
String resultJson = HttpPostUtil.sendPostReq(UrlApi.extSignIn, jsonObject.toString());//返回ResponseJson*/
|
||||||
|
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||||
|
//判断接口是否成功
|
||||||
|
if (resulObject == null) {
|
||||||
|
throw new RuntimeException("获取toKen接口返回数据为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
||||||
|
String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
|
||||||
|
|
||||||
|
if ("0".equals(code)) {
|
||||||
|
toKen = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
||||||
|
return toKen;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("MLS异常信息:" + msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取送货单JSON
|
* 获取送货单JSON
|
||||||
|
|
@ -52,8 +86,7 @@ public class MlsServiceImpl implements MlsService {
|
||||||
objMap.put("sourceSystem", orderInfo.getSourceSystem());//来源系统
|
objMap.put("sourceSystem", orderInfo.getSourceSystem());//来源系统
|
||||||
objMap.put("params", orderInfo.getParams());
|
objMap.put("params", orderInfo.getParams());
|
||||||
jsonObject.putAll(objMap);
|
jsonObject.putAll(objMap);
|
||||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), toKenService.getToKen());//返回ResponseJson*/
|
return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());//返回ResponseJson*/
|
||||||
return resultJson;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -64,14 +97,30 @@ public class MlsServiceImpl implements MlsService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public synchronized void getOrderInfo(String resultJson) {
|
public synchronized void getOrderInfo(String resultJson) {
|
||||||
if (resultJson != null && resultJson.length() > 0) {
|
if (StringUtils.isEmpty(resultJson)) {
|
||||||
|
throw new RuntimeException("获取送货单接口失败!");
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||||
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)) {
|
||||||
|
throw new RuntimeException("获取送货单接口异常信息:" + msg);
|
||||||
|
}
|
||||||
|
|
||||||
String data = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
String data = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
||||||
JSONObject dataObject = JSON.parseObject(data);
|
JSONObject dataObject = JSON.parseObject(data);
|
||||||
|
if (dataObject == null) {
|
||||||
|
throw new RuntimeException("获取送货单接口返回数据为空!");
|
||||||
|
}
|
||||||
JSONArray details = dataObject.getJSONArray("list");
|
JSONArray details = dataObject.getJSONArray("list");
|
||||||
|
//判断是否有送货单数据
|
||||||
|
if (details == null || details.size() == 0) {
|
||||||
|
throw new RuntimeException("没有获取到送货单数据!");
|
||||||
|
}
|
||||||
|
//循环处理每个送货单
|
||||||
|
log.info("送货单数量:"+details.size());
|
||||||
for (int i = 0; i < details.size(); i++) {
|
for (int i = 0; i < details.size(); i++) {
|
||||||
JSONObject detail = details.getJSONObject(i);
|
JSONObject detail = details.getJSONObject(i);
|
||||||
String barcodeNumber = detail.getString("barcodeNumber");//送货单条码号
|
String barcodeNumber = detail.getString("barcodeNumber");//送货单条码号
|
||||||
|
|
@ -101,36 +150,35 @@ public class MlsServiceImpl implements MlsService {
|
||||||
|
|
||||||
//直接接收已合格的送货单
|
//直接接收已合格的送货单
|
||||||
if ("Y".equals(isIqcInspected)) {
|
if ("Y".equals(isIqcInspected)) {
|
||||||
|
OrderDto orderdto = orderService.findByBarcodeNumber(barcodeNumber);
|
||||||
String order_hql = " from Order order where order.barcodeNumber= :barcodeNumber ";
|
if (orderdto == null) {
|
||||||
Query query = entityMapper.createQuery(order_hql);
|
|
||||||
query.setParameter("barcodeNumber", barcodeNumber);
|
|
||||||
List<Order> orderList = query.getResultList();
|
|
||||||
if (orderList.size() > 0) {
|
|
||||||
//更新
|
|
||||||
Order order = orderList.get(0);
|
|
||||||
order.setDeliveryStatus(deliveryStatus);
|
|
||||||
orderService.update(order);
|
|
||||||
} else {
|
|
||||||
//创建
|
//创建
|
||||||
Order newOrder = new Order(deliveryHeaderId, null, null,
|
Order newOrder = new Order(deliveryHeaderId, null, null,
|
||||||
deliveryNumber, barcodeNumber, deliveryStatus, receivedInvCode, receivedInvName,
|
deliveryNumber, barcodeNumber, deliveryStatus, receivedInvCode, receivedInvName,
|
||||||
receivedAreaCode, receivedAreaName, receivedLocationCode, receivedLocationName,
|
receivedAreaCode, receivedAreaName, receivedLocationCode, receivedLocationName,
|
||||||
itemCode, deliveryQty, inInspector, receivedQty, isIqcInspected, iqcResult, isCreatedLabel,
|
itemCode, deliveryQty, inInspector, receivedQty, isIqcInspected, iqcResult, isCreatedLabel,
|
||||||
supplierCode, supplierName,mlsUpdateTime == null ? null : DateUtil.parse(mlsUpdateTime).toTimestamp()
|
supplierCode, supplierName, mlsUpdateTime == null ? null : DateUtil.parse(mlsUpdateTime).toTimestamp()
|
||||||
);
|
);
|
||||||
orderService.create(newOrder);
|
orderService.create(newOrder);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("MLS异常信息:" + msg);
|
//更新
|
||||||
|
Order order = orderService.toEntity(orderdto);
|
||||||
|
order.setDeliveryStatus(deliveryStatus);
|
||||||
|
orderService.update(order);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new RuntimeException("获取送货单接口失败!");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取MO票JSON信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getMoJson(MoInfo moInfo) {
|
public String getMoJson(MoInfo moInfo) {
|
||||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||||
|
|
@ -139,8 +187,8 @@ public class MlsServiceImpl implements MlsService {
|
||||||
objMap.put("sourceSystem", moInfo.getSourceSystem());//来源系统
|
objMap.put("sourceSystem", moInfo.getSourceSystem());//来源系统
|
||||||
objMap.put("params", moInfo.getParams());
|
objMap.put("params", moInfo.getParams());
|
||||||
jsonObject.putAll(objMap);
|
jsonObject.putAll(objMap);
|
||||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), toKenService.getToKen());//返回ResponseJson*/
|
return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
|
||||||
return resultJson;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -151,14 +199,29 @@ public class MlsServiceImpl implements MlsService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public synchronized void getMoInfo(String resultJson) {
|
public synchronized void getMoInfo(String resultJson) {
|
||||||
if (resultJson != null && resultJson.length() > 0) {
|
if (StringUtils.isEmpty(resultJson)) {
|
||||||
|
throw new RuntimeException("获取MO票接口失败!");
|
||||||
|
}
|
||||||
|
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||||
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)) {
|
||||||
|
throw new RuntimeException("获取MO票接口异常信息:" + msg);
|
||||||
|
}
|
||||||
|
|
||||||
String data = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
String data = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
||||||
JSONObject dataObject = JSON.parseObject(data);
|
JSONObject dataObject = JSON.parseObject(data);
|
||||||
|
if (dataObject == null) {
|
||||||
|
throw new RuntimeException("获取MO票接口返回数据为空!");
|
||||||
|
}
|
||||||
JSONArray details = dataObject.getJSONArray("list");
|
JSONArray details = dataObject.getJSONArray("list");
|
||||||
|
//判断是否有MO票数据
|
||||||
|
if (details == null || details.size() == 0) {
|
||||||
|
throw new RuntimeException("没有获取到MO票数据!");
|
||||||
|
}
|
||||||
|
//循环处理每个MO票
|
||||||
|
log.info("MO票数量:"+details.size());
|
||||||
for (int i = 0; i < details.size(); i++) {
|
for (int i = 0; i < details.size(); i++) {
|
||||||
JSONObject detail = details.getJSONObject(i);
|
JSONObject detail = details.getJSONObject(i);
|
||||||
Integer selfWorkOrderId = detail.getInteger("selfWorkOrderId");//自制件工单id
|
Integer selfWorkOrderId = detail.getInteger("selfWorkOrderId");//自制件工单id
|
||||||
|
|
@ -187,34 +250,25 @@ public class MlsServiceImpl implements MlsService {
|
||||||
String invCode = detail.getString("invCode");//MLS子库
|
String invCode = detail.getString("invCode");//MLS子库
|
||||||
|
|
||||||
//接收有效的MO票
|
//接收有效的MO票
|
||||||
if ("0".equals(deleteFlag)) {
|
if ("PRINTED".equals(labelState)) {
|
||||||
//判断物料是否存在;不存在新增;
|
//判断物料是否存在;不存在新增;
|
||||||
Item item = null;
|
ItemDto itemDto = itemService.findByCode(itemCode);
|
||||||
String item_hql = " from Item item where item.code='" + itemCode + "' ";
|
Item item = itemService.toEntity(itemDto);
|
||||||
Query item_query = entityMapper.createQuery(item_hql);
|
if (item == null) {
|
||||||
List<Item> itemList = item_query.getResultList();
|
|
||||||
if (itemList.size() > 0) {
|
|
||||||
item = itemList.get(0);
|
|
||||||
} else {
|
|
||||||
item = new Item();
|
item = new Item();
|
||||||
item.setCode(itemCode);
|
item.setCode(itemCode);
|
||||||
item.setName(itemDesc);
|
item.setName(itemDesc);
|
||||||
item.setUnit(uom);
|
item.setUnit(uom);
|
||||||
DeptDto deptDto= deptService.findById(7L);
|
DeptDto deptDto = deptService.findById(7L);
|
||||||
Dept dept= deptService.toEntity(deptDto);
|
Dept dept = deptService.toEntity(deptDto);
|
||||||
item.setDept(dept);
|
item.setDept(dept);
|
||||||
item.setSourceName(sourceSystem);
|
item.setSourceName(sourceSystem);
|
||||||
item.setSourceId(itemId);
|
item.setSourceId(itemId);
|
||||||
itemService.create(item);
|
itemService.create(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断MO票是否存在;不存在新增;存在更新
|
MoDto moDto = moService.findByLabelNo(labelNo);
|
||||||
String mo_hql = " from Mo mo where mo.labelNo='" + labelNo + "' ";
|
if (moDto == null) {
|
||||||
Query mo_query = entityMapper.createQuery(mo_hql);
|
|
||||||
List<Mo> moList = mo_query.getResultList();
|
|
||||||
if (moList.size() > 0) {
|
|
||||||
Mo mo = moList.get(0);
|
|
||||||
} else {
|
|
||||||
Mo mo = new Mo(labelNo, labelType, labelState, deliveryHeaderId, sourceSystem, qty,
|
Mo mo = new Mo(labelNo, labelType, labelState, deliveryHeaderId, sourceSystem, qty,
|
||||||
workOrderId, workOrderName, selfWorkOrderId, selfWorkOrderName, null, item,
|
workOrderId, workOrderName, selfWorkOrderId, selfWorkOrderName, null, item,
|
||||||
checkResult, Boolean.parseBoolean(deleteFlag), null, null, null, null, invCode, goodsAreaCode, goodsLocationCode,
|
checkResult, Boolean.parseBoolean(deleteFlag), null, null, null, null, invCode, goodsAreaCode, goodsLocationCode,
|
||||||
|
|
@ -224,17 +278,37 @@ public class MlsServiceImpl implements MlsService {
|
||||||
createUserCode, updateUserCode
|
createUserCode, updateUserCode
|
||||||
);
|
);
|
||||||
moService.create(mo);
|
moService.create(mo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String returnMo(ReturnMoInfo returnMoInfo) {
|
||||||
|
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||||
|
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||||
|
objMap.put("ifaceCode", returnMoInfo.getIfaceCode());//获取送货单信息
|
||||||
|
objMap.put("sourceSystem", returnMoInfo.getSourceSystem());//来源系统
|
||||||
|
objMap.put("params", returnMoInfo.getParams());
|
||||||
|
jsonObject.putAll(objMap);
|
||||||
|
return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 叫料结果回传
|
||||||
|
* @param returnIssueInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String returnIssue(ReturnIssueInfo returnIssueInfo) {
|
||||||
|
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||||
|
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||||
|
objMap.put("ifaceCode", returnIssueInfo.getIfaceCode());//获取送货单信息
|
||||||
|
objMap.put("sourceSystem", returnIssueInfo.getSourceSystem());//来源系统
|
||||||
|
objMap.put("params", returnIssueInfo.getParams());
|
||||||
|
jsonObject.putAll(objMap);
|
||||||
|
return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new RuntimeException("MLS异常信息:" + msg);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException("获取MO票接口失败!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,21 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2019-2020 Zheng Jie
|
* Copyright 2019-2020 Zheng Jie
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
|
import com.youchain.basicdata.domain.Item;
|
||||||
import com.youchain.businessdata.domain.Mo;
|
import com.youchain.businessdata.domain.Mo;
|
||||||
import com.youchain.exception.EntityExistException;
|
import com.youchain.exception.EntityExistException;
|
||||||
import com.youchain.utils.FileUtil;
|
import com.youchain.utils.FileUtil;
|
||||||
|
|
@ -27,49 +28,67 @@ import com.youchain.businessdata.service.MoService;
|
||||||
import com.youchain.businessdata.service.dto.MoDto;
|
import com.youchain.businessdata.service.dto.MoDto;
|
||||||
import com.youchain.businessdata.service.dto.MoQueryCriteria;
|
import com.youchain.businessdata.service.dto.MoQueryCriteria;
|
||||||
import com.youchain.businessdata.service.mapstruct.MoMapper;
|
import com.youchain.businessdata.service.mapstruct.MoMapper;
|
||||||
|
import org.springframework.data.domain.Example;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.Query;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author huojin
|
||||||
* @description 服务实现
|
* @website https://eladmin.vip
|
||||||
* @author huojin
|
* @description 服务实现
|
||||||
* @date 2024-04-10
|
* @date 2024-04-10
|
||||||
**/
|
**/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class MoServiceImpl implements MoService {
|
public class MoServiceImpl implements MoService {
|
||||||
|
|
||||||
private final MoRepository moRepository;
|
private final MoRepository moRepository;
|
||||||
private final MoMapper moMapper;
|
private final MoMapper moMapper;
|
||||||
|
private final EntityManager entityManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String,Object> queryAll(MoQueryCriteria criteria, Pageable pageable){
|
public Map<String, Object> queryAll(MoQueryCriteria criteria, Pageable pageable) {
|
||||||
Page<Mo> page = moRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
Page<Mo> page = moRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
||||||
return PageUtil.toPage(page.map(moMapper::toDto));
|
return PageUtil.toPage(page.map(moMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MoDto> queryAll(MoQueryCriteria criteria){
|
public List<MoDto> queryAll(MoQueryCriteria criteria) {
|
||||||
return moMapper.toDto(moRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
return moMapper.toDto(moRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public MoDto findById(Integer id) {
|
public MoDto findById(Integer id) {
|
||||||
Mo mo = moRepository.findById(id).orElseGet(Mo::new);
|
Mo mo = moRepository.findById(id).orElseGet(Mo::new);
|
||||||
ValidationUtil.isNull(mo.getId(),"Mo","id",id);
|
ValidationUtil.isNull(mo.getId(), "Mo", "id", id);
|
||||||
return moMapper.toDto(mo);
|
return moMapper.toDto(mo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MoDto findByLabelNo(String labelNo) {
|
||||||
|
String hql = "from Mo where labelNo = :labelNo";
|
||||||
|
Query query = entityManager.createQuery(hql);
|
||||||
|
query.setParameter("labelNo", labelNo);
|
||||||
|
List<Mo> list = query.getResultList();
|
||||||
|
if (list.size() > 0) {
|
||||||
|
return moMapper.toDto(list.get(0));
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public MoDto create(Mo resources) {
|
public MoDto create(Mo resources) {
|
||||||
|
|
@ -80,7 +99,7 @@ public class MoServiceImpl implements MoService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(Mo resources) {
|
public void update(Mo resources) {
|
||||||
Mo mo = moRepository.findById(resources.getId()).orElseGet(Mo::new);
|
Mo mo = moRepository.findById(resources.getId()).orElseGet(Mo::new);
|
||||||
ValidationUtil.isNull( mo.getId(),"Mo","id",resources.getId());
|
ValidationUtil.isNull(mo.getId(), "Mo", "id", resources.getId());
|
||||||
mo.copy(resources);
|
mo.copy(resources);
|
||||||
moRepository.save(mo);
|
moRepository.save(mo);
|
||||||
}
|
}
|
||||||
|
|
@ -96,11 +115,16 @@ public class MoServiceImpl implements MoService {
|
||||||
public void download(List<MoDto> all, HttpServletResponse response) throws IOException {
|
public void download(List<MoDto> all, HttpServletResponse response) throws IOException {
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
for (MoDto mo : all) {
|
for (MoDto mo : all) {
|
||||||
Map<String,Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("自制件工单id", mo.getSelfWorkOrderId());
|
map.put("自制件工单id", mo.getSelfWorkOrderId());
|
||||||
|
|
||||||
list.add(map);
|
list.add(map);
|
||||||
}
|
}
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mo toEntity(MoDto moDto) {
|
||||||
|
return moMapper.toEntity(moDto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
package com.youchain.businessdata.service.impl;
|
package com.youchain.businessdata.service.impl;
|
||||||
|
|
||||||
import com.youchain.businessdata.domain.AsnDetail;
|
import com.youchain.businessdata.domain.AsnDetail;
|
||||||
|
import com.youchain.businessdata.domain.Mo;
|
||||||
import com.youchain.businessdata.domain.Order;
|
import com.youchain.businessdata.domain.Order;
|
||||||
import com.youchain.utils.FileUtil;
|
import com.youchain.utils.FileUtil;
|
||||||
import com.youchain.utils.PageUtil;
|
import com.youchain.utils.PageUtil;
|
||||||
|
|
@ -27,6 +28,7 @@ import com.youchain.businessdata.service.OrderService;
|
||||||
import com.youchain.businessdata.service.dto.OrderDto;
|
import com.youchain.businessdata.service.dto.OrderDto;
|
||||||
import com.youchain.businessdata.service.dto.OrderQueryCriteria;
|
import com.youchain.businessdata.service.dto.OrderQueryCriteria;
|
||||||
import com.youchain.businessdata.service.mapstruct.OrderMapper;
|
import com.youchain.businessdata.service.mapstruct.OrderMapper;
|
||||||
|
import org.springframework.data.domain.Example;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
@ -53,6 +55,7 @@ public class OrderServiceImpl implements OrderService {
|
||||||
|
|
||||||
private final OrderRepository orderRepository;
|
private final OrderRepository orderRepository;
|
||||||
private final OrderMapper orderMapper;
|
private final OrderMapper orderMapper;
|
||||||
|
private final EntityManager entityManager;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -74,6 +77,20 @@ public class OrderServiceImpl implements OrderService {
|
||||||
return orderMapper.toDto(order);
|
return orderMapper.toDto(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrderDto findByBarcodeNumber(String barcodeNumber) {
|
||||||
|
String hql = "from Order o where o.barcodeNumber = :barcodeNumber";
|
||||||
|
Query query = entityManager.createQuery(hql);
|
||||||
|
query.setParameter("barcodeNumber", barcodeNumber);
|
||||||
|
List<Order> orders = query.getResultList();
|
||||||
|
if (orders.size() > 0) {
|
||||||
|
return orderMapper.toDto(orders.get(0)); // 返回第一个订单
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public OrderDto create(Order resources) {
|
public OrderDto create(Order resources) {
|
||||||
|
|
@ -108,5 +125,9 @@ public class OrderServiceImpl implements OrderService {
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Order toEntity(OrderDto orderDto) {
|
||||||
|
return orderMapper.toEntity(orderDto);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
package com.youchain.businessdata.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.youchain.businessdata.service.ToKenService;
|
|
||||||
import com.youchain.utils.HttpPostUtil;
|
|
||||||
import com.youchain.utils.UrlApi;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Slf4j
|
|
||||||
public class ToKenServiceImpl implements ToKenService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getToKen() {
|
|
||||||
String toKen="";
|
|
||||||
String mlsUser="WMS";
|
|
||||||
String mlsPwd="EDlsFOvn3xaJm*EH";
|
|
||||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
|
||||||
Map<String, Object> objMap = new LinkedHashMap<>();
|
|
||||||
objMap.put("mlsUser", mlsUser);//快码代码
|
|
||||||
objMap.put("mlsPwd", mlsPwd);//快码值
|
|
||||||
jsonObject.putAll(objMap);
|
|
||||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.extSignIn, jsonObject.toString());//返回ResponseJson*/
|
|
||||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
|
||||||
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
|
||||||
String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
|
|
||||||
|
|
||||||
if("0".equals(code)){
|
|
||||||
toKen = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
|
||||||
return toKen;
|
|
||||||
}else{
|
|
||||||
throw new RuntimeException("MLS异常信息:"+msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.youchain.modules.quartz.task;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.youchain.businessdata.inputJson.OrderInfo;
|
import com.youchain.businessdata.inputJson.OrderInfo;
|
||||||
import com.youchain.businessdata.inputJson.Params;
|
import com.youchain.businessdata.inputJson.OrderParams;
|
||||||
import com.youchain.businessdata.rest.MlsController;
|
import com.youchain.businessdata.rest.MlsController;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -28,26 +28,26 @@ public class orderTask {
|
||||||
this.mlsController = mlsController;
|
this.mlsController = mlsController;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void orderTask(){
|
public void orderTask() {
|
||||||
Date date=new Date();
|
|
||||||
OrderInfo orderInfo=new OrderInfo();
|
Date date = new Date();
|
||||||
|
OrderInfo orderInfo = new OrderInfo();
|
||||||
orderInfo.setIfaceCode("MLS-WQ-002");
|
orderInfo.setIfaceCode("MLS-WQ-002");
|
||||||
orderInfo.setSourceSystem("WQ");
|
orderInfo.setSourceSystem("WQ");
|
||||||
|
|
||||||
Set invCodes=new HashSet<>();
|
Set invCodes = new HashSet<>();
|
||||||
invCodes.add("MA1181");
|
invCodes.add("MA2111");
|
||||||
invCodes.add("MD2211");
|
|
||||||
|
|
||||||
String startTime=DateUtil.format(DateUtil.beginOfDay(date), "yyyy-MM-dd HH:mm:ss");
|
String startTime = DateUtil.format(DateUtil.beginOfDay(date), "yyyy-MM-dd HH:mm:ss");
|
||||||
String endTime=DateUtil.format(DateUtil.endOfDay(date), "yyyy-MM-dd HH:mm:ss");
|
String endTime = DateUtil.format(DateUtil.endOfDay(date), "yyyy-MM-dd HH:mm:ss");
|
||||||
Params params=new Params(100059,invCodes,"",startTime,endTime,1,100);
|
OrderParams params = new OrderParams(100059, invCodes, "", startTime, endTime, 1, 100);
|
||||||
|
|
||||||
orderInfo.setParams(params);
|
orderInfo.setParams(params);
|
||||||
|
|
||||||
try{
|
try {
|
||||||
log.info("获取送货单信息");
|
log.info("获取送货单信息");
|
||||||
mlsController.getOrderInfo(orderInfo);
|
mlsController.getOrderInfo(orderInfo);
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("MLS异常信息:" + e);
|
throw new RuntimeException("MLS异常信息:" + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,10 @@
|
||||||
package com.youchain;
|
package com.youchain;
|
||||||
|
|
||||||
import com.youchain.businessdata.domain.AgvTask;
|
|
||||||
import com.youchain.businessdata.service.MlsService;
|
|
||||||
import com.youchain.businessdata.service.ToKenService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
|
||||||
import java.util.concurrent.BlockingQueue;
|
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue