no message
							parent
							
								
									8d773f3630
								
							
						
					
					
						commit
						a74b651dce
					
				| 
						 | 
				
			
			@ -26,5 +26,5 @@ public class MoInfo {
 | 
			
		|||
    int pageSize;
 | 
			
		||||
 | 
			
		||||
    @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;
 | 
			
		||||
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import io.swagger.annotations.ApiParam;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.Builder;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -20,13 +18,13 @@ public class OrderInfo {
 | 
			
		|||
    String sourceSystem;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "参数")
 | 
			
		||||
    Params params;
 | 
			
		||||
    OrderParams params;
 | 
			
		||||
 | 
			
		||||
    public OrderInfo() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public OrderInfo(String ifaceCode, String sourceSystem, Params params) {
 | 
			
		||||
    public OrderInfo(String ifaceCode, String sourceSystem, OrderParams params) {
 | 
			
		||||
        this.ifaceCode = ifaceCode;
 | 
			
		||||
        this.sourceSystem = sourceSystem;
 | 
			
		||||
        this.params = params;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,19 +2,18 @@ package com.youchain.businessdata.inputJson;
 | 
			
		|||
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.Builder;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
public class Params {
 | 
			
		||||
public class OrderParams {
 | 
			
		||||
    @ApiModelProperty(value = "库存组织id")
 | 
			
		||||
    @Schema(example = "100059")
 | 
			
		||||
    int orgId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "子库编码")
 | 
			
		||||
    @Schema(example = "[\"MA1181\", \"MA1181\"]")
 | 
			
		||||
    @Schema(example = "[\"MA2111\"]")
 | 
			
		||||
    Set invCodes;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检验结果")
 | 
			
		||||
| 
						 | 
				
			
			@ -36,11 +35,11 @@ public class Params {
 | 
			
		|||
    @Schema(example = "100")
 | 
			
		||||
    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.invCodes = invCodes;
 | 
			
		||||
        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.businessdata.inputJson.MoInfo;
 | 
			
		||||
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.exception.handler.ApiResult;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
| 
						 | 
				
			
			@ -36,12 +38,18 @@ public class MlsController {
 | 
			
		|||
    @ApiOperation("获取送货单信息")
 | 
			
		||||
    @AnonymousAccess
 | 
			
		||||
    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) {
 | 
			
		||||
            return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
 | 
			
		||||
        } else {
 | 
			
		||||
            try {
 | 
			
		||||
                mlsService.getOrderInfo(resultJson);
 | 
			
		||||
                mlsService.getOrderInfo(resultJson);//获取送货单
 | 
			
		||||
                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);
 | 
			
		||||
| 
						 | 
				
			
			@ -52,15 +60,21 @@ public class MlsController {
 | 
			
		|||
 | 
			
		||||
    @PostMapping("/getMoInfo")
 | 
			
		||||
    @AnonymousAccess
 | 
			
		||||
    @Log("获取Mo票信息")
 | 
			
		||||
    @ApiOperation("获取Mo票信息")
 | 
			
		||||
    @Log("获取MO票信息")
 | 
			
		||||
    @ApiOperation("获取MO票信息")
 | 
			
		||||
    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) {
 | 
			
		||||
            return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
 | 
			
		||||
        } else {
 | 
			
		||||
            try {
 | 
			
		||||
                mlsService.getMoInfo(resultJson);
 | 
			
		||||
                mlsService.getMoInfo(resultJson);//获取Mo票
 | 
			
		||||
                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);
 | 
			
		||||
| 
						 | 
				
			
			@ -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.businessdata.inputJson.MoInfo;
 | 
			
		||||
import com.youchain.businessdata.inputJson.OrderInfo;
 | 
			
		||||
import com.youchain.businessdata.inputJson.ReturnIssueInfo;
 | 
			
		||||
import com.youchain.businessdata.inputJson.ReturnMoInfo;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -10,6 +12,12 @@ import io.swagger.annotations.ApiOperation;
 | 
			
		|||
 */
 | 
			
		||||
public interface MlsService {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取ToKen
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    String getToKen();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取送货单JSON
 | 
			
		||||
     * @return
 | 
			
		||||
| 
						 | 
				
			
			@ -34,4 +42,16 @@ public interface MlsService {
 | 
			
		|||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    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 findByLabelNo(String labelNo);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    * 创建
 | 
			
		||||
    * @param resources /
 | 
			
		||||
| 
						 | 
				
			
			@ -80,4 +82,11 @@ public interface MoService {
 | 
			
		|||
    * @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;
 | 
			
		||||
 | 
			
		||||
import com.youchain.businessdata.domain.Mo;
 | 
			
		||||
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.OrderQueryCriteria;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
| 
						 | 
				
			
			@ -54,6 +56,13 @@ public interface OrderService {
 | 
			
		|||
     */
 | 
			
		||||
    OrderDto findById(Integer id);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据barcodeNumber查询
 | 
			
		||||
     * @param  barcodeNumber
 | 
			
		||||
     * @return OrderDto
 | 
			
		||||
     */
 | 
			
		||||
    OrderDto findByBarcodeNumber(String barcodeNumber);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    * 创建
 | 
			
		||||
    * @param resources /
 | 
			
		||||
| 
						 | 
				
			
			@ -81,4 +90,12 @@ public interface OrderService {
 | 
			
		|||
    */
 | 
			
		||||
    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;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.sql.Timestamp;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import com.youchain.annotation.Query;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -26,4 +28,25 @@ import com.youchain.annotation.Query;
 | 
			
		|||
**/
 | 
			
		||||
@Data
 | 
			
		||||
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
 | 
			
		||||
public class OrderQueryCriteria{
 | 
			
		||||
 | 
			
		||||
    /** 关联Id */
 | 
			
		||||
    @Query(type = Query.Type.INNER_LIKE)
 | 
			
		||||
    private String deliveryHeaderId;
 | 
			
		||||
 | 
			
		||||
    /** 送货单条码号 */
 | 
			
		||||
    @Query(type = Query.Type.INNER_LIKE)
 | 
			
		||||
    private String barcodeNumber;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,38 +6,72 @@ import com.alibaba.fastjson.JSONArray;
 | 
			
		|||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.youchain.basicdata.domain.Item;
 | 
			
		||||
import com.youchain.basicdata.service.ItemService;
 | 
			
		||||
import com.youchain.basicdata.service.dto.ItemDto;
 | 
			
		||||
import com.youchain.businessdata.domain.Mo;
 | 
			
		||||
import com.youchain.businessdata.domain.Order;
 | 
			
		||||
import com.youchain.businessdata.inputJson.MoInfo;
 | 
			
		||||
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.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.service.DeptService;
 | 
			
		||||
import com.youchain.modules.system.service.dto.DeptDto;
 | 
			
		||||
import com.youchain.utils.HttpPostUtil;
 | 
			
		||||
import com.youchain.utils.StringUtils;
 | 
			
		||||
import com.youchain.utils.UrlApi;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import javax.persistence.EntityManager;
 | 
			
		||||
import javax.persistence.Query;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
@Service
 | 
			
		||||
@RequiredArgsConstructor
 | 
			
		||||
@Slf4j
 | 
			
		||||
public class MlsServiceImpl implements MlsService {
 | 
			
		||||
    private final ToKenService toKenService;
 | 
			
		||||
    private final OrderService orderService;
 | 
			
		||||
    private final ItemService itemService;
 | 
			
		||||
    private final DeptService deptService;
 | 
			
		||||
    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
 | 
			
		||||
| 
						 | 
				
			
			@ -52,8 +86,7 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        objMap.put("sourceSystem", orderInfo.getSourceSystem());//来源系统
 | 
			
		||||
        objMap.put("params", orderInfo.getParams());
 | 
			
		||||
        jsonObject.putAll(objMap);
 | 
			
		||||
        String resultJson = HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), toKenService.getToKen());//返回ResponseJson*/
 | 
			
		||||
        return resultJson;
 | 
			
		||||
        return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());//返回ResponseJson*/
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -64,14 +97,30 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public synchronized void getOrderInfo(String resultJson) {
 | 
			
		||||
        if (resultJson != null && resultJson.length() > 0) {
 | 
			
		||||
        if (StringUtils.isEmpty(resultJson)) {
 | 
			
		||||
            throw new RuntimeException("获取送货单接口失败!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        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)) {
 | 
			
		||||
        //判断接口是否成功
 | 
			
		||||
        if (!"0".equals(code)) {
 | 
			
		||||
            throw new RuntimeException("获取送货单接口异常信息:" + msg);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        String data = resulObject.getString("data") == null ? "" : resulObject.getString("data");
 | 
			
		||||
        JSONObject dataObject = JSON.parseObject(data);
 | 
			
		||||
        if (dataObject == null) {
 | 
			
		||||
            throw new RuntimeException("获取送货单接口返回数据为空!");
 | 
			
		||||
        }
 | 
			
		||||
        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++) {
 | 
			
		||||
            JSONObject detail = details.getJSONObject(i);
 | 
			
		||||
            String barcodeNumber = detail.getString("barcodeNumber");//送货单条码号
 | 
			
		||||
| 
						 | 
				
			
			@ -101,17 +150,8 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
 | 
			
		||||
            //直接接收已合格的送货单
 | 
			
		||||
            if ("Y".equals(isIqcInspected)) {
 | 
			
		||||
 | 
			
		||||
                        String order_hql = " from Order order where order.barcodeNumber= :barcodeNumber ";
 | 
			
		||||
                        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 {
 | 
			
		||||
                OrderDto orderdto = orderService.findByBarcodeNumber(barcodeNumber);
 | 
			
		||||
                if (orderdto == null) {
 | 
			
		||||
                    //创建
 | 
			
		||||
                    Order newOrder = new Order(deliveryHeaderId, null, null,
 | 
			
		||||
                            deliveryNumber, barcodeNumber, deliveryStatus, receivedInvCode, receivedInvName,
 | 
			
		||||
| 
						 | 
				
			
			@ -120,17 +160,25 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
                            supplierCode, supplierName, mlsUpdateTime == null ? null : DateUtil.parse(mlsUpdateTime).toTimestamp()
 | 
			
		||||
                    );
 | 
			
		||||
                    orderService.create(newOrder);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                } 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
 | 
			
		||||
    public String getMoJson(MoInfo moInfo) {
 | 
			
		||||
        JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
 | 
			
		||||
| 
						 | 
				
			
			@ -139,8 +187,8 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        objMap.put("sourceSystem", moInfo.getSourceSystem());//来源系统
 | 
			
		||||
        objMap.put("params", moInfo.getParams());
 | 
			
		||||
        jsonObject.putAll(objMap);
 | 
			
		||||
        String resultJson = HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), toKenService.getToKen());//返回ResponseJson*/
 | 
			
		||||
        return resultJson;
 | 
			
		||||
        return   HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -151,14 +199,29 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    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);
 | 
			
		||||
        String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
 | 
			
		||||
        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");
 | 
			
		||||
        JSONObject dataObject = JSON.parseObject(data);
 | 
			
		||||
        if (dataObject == null) {
 | 
			
		||||
            throw new RuntimeException("获取MO票接口返回数据为空!");
 | 
			
		||||
        }
 | 
			
		||||
        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++) {
 | 
			
		||||
            JSONObject detail = details.getJSONObject(i);
 | 
			
		||||
            Integer selfWorkOrderId = detail.getInteger("selfWorkOrderId");//自制件工单id
 | 
			
		||||
| 
						 | 
				
			
			@ -187,15 +250,11 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
            String invCode = detail.getString("invCode");//MLS子库
 | 
			
		||||
 | 
			
		||||
            //接收有效的MO票
 | 
			
		||||
                    if ("0".equals(deleteFlag)) {
 | 
			
		||||
            if ("PRINTED".equals(labelState)) {
 | 
			
		||||
                //判断物料是否存在;不存在新增;
 | 
			
		||||
                        Item item = null;
 | 
			
		||||
                        String item_hql = " from Item item where item.code='" + itemCode + "' ";
 | 
			
		||||
                        Query item_query = entityMapper.createQuery(item_hql);
 | 
			
		||||
                        List<Item> itemList = item_query.getResultList();
 | 
			
		||||
                        if (itemList.size() > 0) {
 | 
			
		||||
                            item = itemList.get(0);
 | 
			
		||||
                        } else {
 | 
			
		||||
                ItemDto itemDto = itemService.findByCode(itemCode);
 | 
			
		||||
                Item item = itemService.toEntity(itemDto);
 | 
			
		||||
                if (item == null) {
 | 
			
		||||
                    item = new Item();
 | 
			
		||||
                    item.setCode(itemCode);
 | 
			
		||||
                    item.setName(itemDesc);
 | 
			
		||||
| 
						 | 
				
			
			@ -208,13 +267,8 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
                    itemService.create(item);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                        //判断MO票是否存在;不存在新增;存在更新
 | 
			
		||||
                        String mo_hql = " from Mo mo where mo.labelNo='" + labelNo + "' ";
 | 
			
		||||
                        Query mo_query = entityMapper.createQuery(mo_hql);
 | 
			
		||||
                        List<Mo> moList = mo_query.getResultList();
 | 
			
		||||
                        if (moList.size() > 0) {
 | 
			
		||||
                            Mo mo = moList.get(0);
 | 
			
		||||
                        } else {
 | 
			
		||||
                MoDto moDto = moService.findByLabelNo(labelNo);
 | 
			
		||||
                if (moDto == null) {
 | 
			
		||||
                    Mo mo = new Mo(labelNo, labelType, labelState, deliveryHeaderId, sourceSystem, qty,
 | 
			
		||||
                            workOrderId, workOrderName, selfWorkOrderId, selfWorkOrderName, null, item,
 | 
			
		||||
                            checkResult, Boolean.parseBoolean(deleteFlag), null, null, null, null, invCode, goodsAreaCode, goodsLocationCode,
 | 
			
		||||
| 
						 | 
				
			
			@ -224,17 +278,37 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
                            createUserCode, updateUserCode
 | 
			
		||||
                    );
 | 
			
		||||
                    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票接口失败!");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@
 | 
			
		|||
 */
 | 
			
		||||
package com.youchain.businessdata.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.youchain.basicdata.domain.Item;
 | 
			
		||||
import com.youchain.businessdata.domain.Mo;
 | 
			
		||||
import com.youchain.exception.EntityExistException;
 | 
			
		||||
import com.youchain.utils.FileUtil;
 | 
			
		||||
| 
						 | 
				
			
			@ -27,21 +28,25 @@ import com.youchain.businessdata.service.MoService;
 | 
			
		|||
import com.youchain.businessdata.service.dto.MoDto;
 | 
			
		||||
import com.youchain.businessdata.service.dto.MoQueryCriteria;
 | 
			
		||||
import com.youchain.businessdata.service.mapstruct.MoMapper;
 | 
			
		||||
import org.springframework.data.domain.Example;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.springframework.data.domain.Page;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import javax.persistence.EntityManager;
 | 
			
		||||
import javax.persistence.Query;
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.LinkedHashMap;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author huojin
 | 
			
		||||
 * @website https://eladmin.vip
 | 
			
		||||
 * @description 服务实现
 | 
			
		||||
* @author huojin
 | 
			
		||||
 * @date 2024-04-10
 | 
			
		||||
 **/
 | 
			
		||||
@Service
 | 
			
		||||
| 
						 | 
				
			
			@ -50,6 +55,7 @@ public class MoServiceImpl implements MoService {
 | 
			
		|||
 | 
			
		||||
    private final MoRepository moRepository;
 | 
			
		||||
    private final MoMapper moMapper;
 | 
			
		||||
    private final EntityManager entityManager;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Map<String, Object> queryAll(MoQueryCriteria criteria, Pageable pageable) {
 | 
			
		||||
| 
						 | 
				
			
			@ -70,6 +76,19 @@ public class MoServiceImpl implements MoService {
 | 
			
		|||
        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
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public MoDto create(Mo resources) {
 | 
			
		||||
| 
						 | 
				
			
			@ -103,4 +122,9 @@ public class MoServiceImpl implements MoService {
 | 
			
		|||
        }
 | 
			
		||||
        FileUtil.downloadExcel(list, response);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Mo toEntity(MoDto moDto) {
 | 
			
		||||
        return moMapper.toEntity(moDto);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,7 @@
 | 
			
		|||
package com.youchain.businessdata.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.youchain.businessdata.domain.AsnDetail;
 | 
			
		||||
import com.youchain.businessdata.domain.Mo;
 | 
			
		||||
import com.youchain.businessdata.domain.Order;
 | 
			
		||||
import com.youchain.utils.FileUtil;
 | 
			
		||||
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.OrderQueryCriteria;
 | 
			
		||||
import com.youchain.businessdata.service.mapstruct.OrderMapper;
 | 
			
		||||
import org.springframework.data.domain.Example;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.springframework.data.domain.Page;
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +55,7 @@ public class OrderServiceImpl implements OrderService {
 | 
			
		|||
 | 
			
		||||
    private final OrderRepository orderRepository;
 | 
			
		||||
    private final OrderMapper orderMapper;
 | 
			
		||||
    private final EntityManager entityManager;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			@ -74,6 +77,20 @@ public class OrderServiceImpl implements OrderService {
 | 
			
		|||
        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
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public OrderDto create(Order resources) {
 | 
			
		||||
| 
						 | 
				
			
			@ -108,5 +125,9 @@ public class OrderServiceImpl implements OrderService {
 | 
			
		|||
        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 com.youchain.businessdata.inputJson.OrderInfo;
 | 
			
		||||
import com.youchain.businessdata.inputJson.Params;
 | 
			
		||||
import com.youchain.businessdata.inputJson.OrderParams;
 | 
			
		||||
import com.youchain.businessdata.rest.MlsController;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
| 
						 | 
				
			
			@ -29,18 +29,18 @@ public class orderTask {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    public void orderTask() {
 | 
			
		||||
 | 
			
		||||
        Date date = new Date();
 | 
			
		||||
        OrderInfo orderInfo = new OrderInfo();
 | 
			
		||||
        orderInfo.setIfaceCode("MLS-WQ-002");
 | 
			
		||||
        orderInfo.setSourceSystem("WQ");
 | 
			
		||||
 | 
			
		||||
        Set invCodes = new HashSet<>();
 | 
			
		||||
        invCodes.add("MA1181");
 | 
			
		||||
        invCodes.add("MD2211");
 | 
			
		||||
        invCodes.add("MA2111");
 | 
			
		||||
 | 
			
		||||
        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");
 | 
			
		||||
        Params params=new Params(100059,invCodes,"",startTime,endTime,1,100);
 | 
			
		||||
        OrderParams params = new OrderParams(100059, invCodes, "", startTime, endTime, 1, 100);
 | 
			
		||||
 | 
			
		||||
        orderInfo.setParams(params);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,16 +1,10 @@
 | 
			
		|||
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 org.junit.jupiter.api.Test;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.boot.test.context.SpringBootTest;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.concurrent.ArrayBlockingQueue;
 | 
			
		||||
import java.util.concurrent.BlockingQueue;
 | 
			
		||||
 | 
			
		||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
 | 
			
		||||
@Slf4j
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue