no message
							parent
							
								
									b129e0f404
								
							
						
					
					
						commit
						d47e09fdec
					
				| 
						 | 
				
			
			@ -24,7 +24,7 @@ package com.youchain.exception;
 | 
			
		|||
public class BadConfigurationException extends RuntimeException {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new runtime exception with {@code null} as its
 | 
			
		||||
     * detail message.  The cause is not initialized, and may subsequently be
 | 
			
		||||
     * detail .  The cause is not initialized, and may subsequently be
 | 
			
		||||
     * initialized by a call to {@link #initCause}.
 | 
			
		||||
     */
 | 
			
		||||
    public BadConfigurationException() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,4 +31,4 @@ public class EntityExistException extends RuntimeException {
 | 
			
		|||
        return StringUtils.capitalize(entity)
 | 
			
		||||
                + " with " + field + " "+ val + " existed";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,11 +24,11 @@ import org.springframework.util.StringUtils;
 | 
			
		|||
public class EntityNotFoundException extends RuntimeException {
 | 
			
		||||
 | 
			
		||||
    public EntityNotFoundException(Class clazz, String field, String val) {
 | 
			
		||||
        super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val));
 | 
			
		||||
        super(EntityNotFoundException.generate(clazz.getSimpleName(), field, val));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static String generateMessage(String entity, String field, String val) {
 | 
			
		||||
    private static String generate(String entity, String field, String val) {
 | 
			
		||||
        return StringUtils.capitalize(entity)
 | 
			
		||||
                + " with " + field + " "+ val + " does not exist";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,8 +5,8 @@ import lombok.Data;
 | 
			
		|||
@Data
 | 
			
		||||
public class ApiResult {
 | 
			
		||||
    private Object data;//数据
 | 
			
		||||
    private String message;//内容
 | 
			
		||||
    private int status;//编码
 | 
			
		||||
    private String msg;//内容
 | 
			
		||||
    private int code;//编码
 | 
			
		||||
 | 
			
		||||
    public static ApiResult fail() {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,14 +29,14 @@ public class ApiResult {
 | 
			
		|||
        return result(200, msg, data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static ApiResult success(int status, String msg, Object data) {
 | 
			
		||||
        return result(status, msg, data);
 | 
			
		||||
    public static ApiResult success(int code, String msg, Object data) {
 | 
			
		||||
        return result(code, msg, data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static ApiResult result(int status, String message, Object data) {
 | 
			
		||||
    public static ApiResult result(int code, String msg, Object data) {
 | 
			
		||||
        ApiResult rs = new ApiResult();
 | 
			
		||||
        rs.setStatus(status);
 | 
			
		||||
        rs.setMessage(message);
 | 
			
		||||
        rs.setCode(code);
 | 
			
		||||
        rs.setMsg(msg);
 | 
			
		||||
        rs.setData(data);
 | 
			
		||||
        return rs;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
 | 
			
		|||
 | 
			
		||||
@Generated(
 | 
			
		||||
    value = "org.mapstruct.ap.MappingProcessor",
 | 
			
		||||
    date = "2024-04-11T14:17:39+0800",
 | 
			
		||||
    date = "2024-04-12T19:52:30+0800",
 | 
			
		||||
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
 | 
			
		||||
)
 | 
			
		||||
@Component
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
 | 
			
		|||
 | 
			
		||||
@Generated(
 | 
			
		||||
    value = "org.mapstruct.ap.MappingProcessor",
 | 
			
		||||
    date = "2024-04-11T14:17:40+0800",
 | 
			
		||||
    date = "2024-04-12T19:52:32+0800",
 | 
			
		||||
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
 | 
			
		||||
)
 | 
			
		||||
@Component
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
package com.youchain.businessdata.inputJson;
 | 
			
		||||
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 叫料入参
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class IssueInfo {
 | 
			
		||||
    @ApiModelProperty(value = "任务号")
 | 
			
		||||
    @Schema(example = "WQ202303290001")
 | 
			
		||||
    String taskNumber;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "来源系统")
 | 
			
		||||
    @Schema(example = "MLS")
 | 
			
		||||
    String sourceSystem;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "库存组织id")
 | 
			
		||||
    @Schema(example = "808")
 | 
			
		||||
    int orgId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "任务号")
 | 
			
		||||
    @Schema(example = "[\"QZSC2108010201\"]")
 | 
			
		||||
    Set workOrderName;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -199,8 +199,8 @@ public class AsnDetailController {
 | 
			
		|||
            }
 | 
			
		||||
 | 
			
		||||
            ApiResult r1= putawayInv(d,d.getPoint(),dstPoint);
 | 
			
		||||
            if(r1.getStatus()==400){
 | 
			
		||||
                ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMessage());
 | 
			
		||||
            if(r1.getCode()==400){
 | 
			
		||||
                ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMsg());
 | 
			
		||||
                return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -275,21 +275,21 @@ public class AsnDetailController {
 | 
			
		|||
                IScanPut s=new IScanPut();
 | 
			
		||||
                s.setScanCode(mo);
 | 
			
		||||
                ApiResult r1=analysisMO(s);
 | 
			
		||||
                if(r1.getStatus()==400){
 | 
			
		||||
                    ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMessage());
 | 
			
		||||
                if(r1.getCode()==400){
 | 
			
		||||
                    ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMsg());
 | 
			
		||||
                    return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
 | 
			
		||||
                }
 | 
			
		||||
                RRkMo rmo=(RRkMo)r1.getData();
 | 
			
		||||
                ApiResult r2=retrievalStockCode(new IRkStockCode(rmo.getItemId(),stockCode));
 | 
			
		||||
                if(r2.getStatus()==400){
 | 
			
		||||
                    ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r2.getMessage());
 | 
			
		||||
                if(r2.getCode()==400){
 | 
			
		||||
                    ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r2.getMsg());
 | 
			
		||||
                    return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
 | 
			
		||||
                }
 | 
			
		||||
                JSONObject obj=(JSONObject)r2.getData();
 | 
			
		||||
                Long stockId=(Long)obj.get("stockId");
 | 
			
		||||
                ApiResult r3=createAsnDetail(new IRkConfirm(mo,rmo.getItemId(),rmo.getItemCode(),stockId,stockCode,rmo.getQty(),rmo.getPch(),rmo.getCjbh()));
 | 
			
		||||
                if(r3.getStatus()==400){
 | 
			
		||||
                    ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r3.getMessage());
 | 
			
		||||
                if(r3.getCode()==400){
 | 
			
		||||
                    ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r3.getMsg());
 | 
			
		||||
                    return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
 | 
			
		||||
                }
 | 
			
		||||
                new_len++;
 | 
			
		||||
| 
						 | 
				
			
			@ -316,21 +316,21 @@ public class AsnDetailController {
 | 
			
		|||
        IScanPut s=new IScanPut();
 | 
			
		||||
        s.setScanCode(MO);
 | 
			
		||||
        ApiResult r1=analysisMO(s);
 | 
			
		||||
        if(r1.getStatus()==400){
 | 
			
		||||
            ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMessage());
 | 
			
		||||
        if(r1.getCode()==400){
 | 
			
		||||
            ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r1.getMsg());
 | 
			
		||||
            return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
 | 
			
		||||
        }
 | 
			
		||||
        RRkMo rmo=(RRkMo)r1.getData();
 | 
			
		||||
        ApiResult r2=retrievalStockCode(new IRkStockCode(rmo.getItemId(),stockCode));
 | 
			
		||||
        if(r2.getStatus()==400){
 | 
			
		||||
            ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r2.getMessage());
 | 
			
		||||
        if(r2.getCode()==400){
 | 
			
		||||
            ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r2.getMsg());
 | 
			
		||||
            return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
 | 
			
		||||
        }
 | 
			
		||||
        JSONObject obj=(JSONObject)r2.getData();
 | 
			
		||||
        Long stockId=(Long)obj.get("stockId");
 | 
			
		||||
        ApiResult r3=createAsnDetail(new IRkConfirm(MO,rmo.getItemId(),rmo.getItemCode(),stockId,stockCode,rmo.getQty(),rmo.getPch(),rmo.getCjbh()));
 | 
			
		||||
        if(r3.getStatus()==400){
 | 
			
		||||
            ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r3.getMessage());
 | 
			
		||||
        if(r3.getCode()==400){
 | 
			
		||||
            ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r3.getMsg());
 | 
			
		||||
            return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
 | 
			
		||||
        }
 | 
			
		||||
        return new ResponseEntity<>(HttpStatus.OK);
 | 
			
		||||
| 
						 | 
				
			
			@ -474,7 +474,7 @@ public class AsnDetailController {
 | 
			
		|||
            return ApiResult.result(400,dstPoint+"找不到终点或状态不对",obj);
 | 
			
		||||
        }
 | 
			
		||||
        ApiResult r1=  putawayInv(ad,srcPoint,dstPoint);
 | 
			
		||||
        if(r1.getStatus()==400){
 | 
			
		||||
        if(r1.getCode()==400){
 | 
			
		||||
            return r1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,10 +3,7 @@ package com.youchain.businessdata.rest;
 | 
			
		|||
import com.youchain.annotation.AnonymousAccess;
 | 
			
		||||
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.inputJson.*;
 | 
			
		||||
import com.youchain.businessdata.service.MlsService;
 | 
			
		||||
import com.youchain.exception.handler.ApiResult;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
| 
						 | 
				
			
			@ -95,6 +92,19 @@ public class MlsController {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/getIssueInfo")
 | 
			
		||||
    @AnonymousAccess
 | 
			
		||||
    @Log("叫料指令")
 | 
			
		||||
    @ApiOperation("叫料指令")
 | 
			
		||||
    public ResponseEntity<Object> getIssueInfo(@RequestBody IssueInfo issueInfo) {
 | 
			
		||||
        try {
 | 
			
		||||
            mlsService.getIssueInfo(issueInfo);
 | 
			
		||||
            return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/returnIssue")
 | 
			
		||||
    @AnonymousAccess
 | 
			
		||||
    @Log("叫料结果回传")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,6 +29,7 @@ import org.springframework.data.domain.Pageable;
 | 
			
		|||
import java.util.Map;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -100,4 +101,6 @@ public interface InventoryService {
 | 
			
		|||
    List<Inventory> queryInventory(Stock stock);
 | 
			
		||||
 | 
			
		||||
    List<Inventory> getInvForPlan(String type,Long areaId,Long itemId,Long deptId);
 | 
			
		||||
 | 
			
		||||
    List<Inventory> findInvByBillCode(Set billCode);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,10 +1,7 @@
 | 
			
		|||
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 com.youchain.businessdata.inputJson.*;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -43,6 +40,13 @@ public interface MlsService {
 | 
			
		|||
     */
 | 
			
		||||
    void getMoInfo(String resultJson);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取叫料指令
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    void getIssueInfo(IssueInfo issueInfo);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 回传MO票
 | 
			
		||||
     * @return
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -218,6 +218,18 @@ public class InventoryServiceImpl implements InventoryService {
 | 
			
		|||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<Inventory> findInvByBillCode(Set billCode) {
 | 
			
		||||
        if (billCode.isEmpty()) {
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        String hql = " from Inventory inv where 1=1 and inv.billCode in (:billCode) ";
 | 
			
		||||
        Query query = entityManager.createQuery(hql);
 | 
			
		||||
        query.setParameter("billCode", billCode);
 | 
			
		||||
        List<Inventory> list = query.getResultList();
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<Object[]> queryItemStock() {
 | 
			
		||||
        String hql = "select inv.itemKey.item.code,max(inv.itemKey.item.name),count(inv.id) " +
 | 
			
		||||
                " from Inventory inv where 1=1 and inv.quantity>0 group by inv.itemKey.item.code order by inv.itemKey.item.code";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,22 +5,20 @@ import com.alibaba.fastjson.JSON;
 | 
			
		|||
import com.alibaba.fastjson.JSONArray;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.youchain.basicdata.domain.Item;
 | 
			
		||||
import com.youchain.basicdata.domain.Point;
 | 
			
		||||
import com.youchain.basicdata.domain.Stock;
 | 
			
		||||
import com.youchain.basicdata.service.ItemService;
 | 
			
		||||
import com.youchain.basicdata.service.PointService;
 | 
			
		||||
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.domain.*;
 | 
			
		||||
import com.youchain.businessdata.inputJson.*;
 | 
			
		||||
import com.youchain.businessdata.service.*;
 | 
			
		||||
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.BizStatus;
 | 
			
		||||
import com.youchain.utils.HttpPostUtil;
 | 
			
		||||
import com.youchain.utils.StringUtils;
 | 
			
		||||
import com.youchain.utils.UrlApi;
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +37,9 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
    private final ItemService itemService;
 | 
			
		||||
    private final DeptService deptService;
 | 
			
		||||
    private final MoService moService;
 | 
			
		||||
    private final PointService pointService;
 | 
			
		||||
    private final PickDetailService pickDetailService;
 | 
			
		||||
    private final InventoryService inventoryService;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取Token
 | 
			
		||||
| 
						 | 
				
			
			@ -102,6 +103,9 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
			
		||||
        if (resulObject == null) {
 | 
			
		||||
            throw new RuntimeException("获取送货单接口返回数据为空!");
 | 
			
		||||
        }
 | 
			
		||||
        String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
 | 
			
		||||
        String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
 | 
			
		||||
        //判断接口是否成功
 | 
			
		||||
| 
						 | 
				
			
			@ -120,7 +124,7 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
            throw new RuntimeException("没有获取到送货单数据!");
 | 
			
		||||
        }
 | 
			
		||||
        //循环处理每个送货单
 | 
			
		||||
        log.info("送货单数量:"+details.size());
 | 
			
		||||
        log.info("送货单数量:" + details.size());
 | 
			
		||||
        for (int i = 0; i < details.size(); i++) {
 | 
			
		||||
            JSONObject detail = details.getJSONObject(i);
 | 
			
		||||
            String barcodeNumber = detail.getString("barcodeNumber");//送货单条码号
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +191,7 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        objMap.put("sourceSystem", moInfo.getSourceSystem());//来源系统
 | 
			
		||||
        objMap.put("params", moInfo.getParams());
 | 
			
		||||
        jsonObject.putAll(objMap);
 | 
			
		||||
        return   HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
 | 
			
		||||
        return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -204,6 +208,9 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
			
		||||
        if (resulObject == null) {
 | 
			
		||||
            throw new RuntimeException("获取MO票接口返回数据为空!");
 | 
			
		||||
        }
 | 
			
		||||
        String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
 | 
			
		||||
        String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
 | 
			
		||||
        if (!"0".equals(code)) {
 | 
			
		||||
| 
						 | 
				
			
			@ -221,7 +228,7 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
            throw new RuntimeException("没有获取到MO票数据!");
 | 
			
		||||
        }
 | 
			
		||||
        //循环处理每个MO票
 | 
			
		||||
        log.info("MO票数量:"+details.size());
 | 
			
		||||
        log.info("MO票数量:" + details.size());
 | 
			
		||||
        for (int i = 0; i < details.size(); i++) {
 | 
			
		||||
            JSONObject detail = details.getJSONObject(i);
 | 
			
		||||
            Integer selfWorkOrderId = detail.getInteger("selfWorkOrderId");//自制件工单id
 | 
			
		||||
| 
						 | 
				
			
			@ -284,6 +291,70 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public synchronized void getIssueInfo(IssueInfo issueInfo) {
 | 
			
		||||
        Set workOrderNameSet = issueInfo.getWorkOrderName();
 | 
			
		||||
        if (workOrderNameSet.size() == 0) {
 | 
			
		||||
            throw new RuntimeException("没有获取到工单号!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        List<Inventory> inventoryList = inventoryService.findInvByBillCode(workOrderNameSet);//根据工单号查询库存信息
 | 
			
		||||
        if (inventoryList.size() == 0) {
 | 
			
		||||
            throw new RuntimeException("无库存信息!");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //目标点
 | 
			
		||||
        Point endPoint = pointService.findByCode("",null,null,null,null);
 | 
			
		||||
        for (Inventory inv : inventoryList) {
 | 
			
		||||
            //根据库存信息生成叫料任务
 | 
			
		||||
            Stock stock = inv.getStock();//容器
 | 
			
		||||
            Point startPoint = inv.getPoint();//起始点位
 | 
			
		||||
 | 
			
		||||
            inv.setQueuedQty(inv.getQueuedQty());
 | 
			
		||||
            inventoryService.update(inv);
 | 
			
		||||
            PickDetail pd = new PickDetail();
 | 
			
		||||
            pd.setItem(inv.getItemKey().getItem());
 | 
			
		||||
            pd.setPo(inv.getBillCode());
 | 
			
		||||
 | 
			
		||||
            pd.setOrderQty(inv.getQuantity());
 | 
			
		||||
            pd.setAllocatedQty(inv.getQuantity());
 | 
			
		||||
            pd.setStatus(BizStatus.ALLOCATE);
 | 
			
		||||
            pickDetailService.create(pd);
 | 
			
		||||
 | 
			
		||||
            /*//生成搬运任务
 | 
			
		||||
            AgvTask agvTask = new AgvTask(BizStatus.PICK, stock.getCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "01");
 | 
			
		||||
            agvTaskRepository.save(agvTask);
 | 
			
		||||
            //生成Task
 | 
			
		||||
            Task task = new Task();
 | 
			
		||||
            task.setItem(item);
 | 
			
		||||
            task.setItemKey(inv.getItemKey());
 | 
			
		||||
            task.setPickDetail(pd);
 | 
			
		||||
            task.setBillCode(pd.getPo());
 | 
			
		||||
            task.setSrcStock(inv.getStock());
 | 
			
		||||
            task.setDstStock(inv.getStock());
 | 
			
		||||
            task.setSrcPoint(startPoint);
 | 
			
		||||
            task.setDstPoint(endPoint);
 | 
			
		||||
            task.setSrcStockCode(inv.getStock().getCode());
 | 
			
		||||
            task.setSrcPointCode(startPoint.getCode());
 | 
			
		||||
            task.setDstPointCode(endPoint.getCode());
 | 
			
		||||
            task.setInvStatus(inv.getStatus());
 | 
			
		||||
            task.setTaskStatus(BizStatus.OPEN);
 | 
			
		||||
            task.setPlanQty(allocateQty);
 | 
			
		||||
            task.setInvId(inv.getId());
 | 
			
		||||
            task.setDept(dept);
 | 
			
		||||
            task.setAgvTask(agvTask);
 | 
			
		||||
            taskRepository.save(task);*/
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Mo票回传
 | 
			
		||||
     *
 | 
			
		||||
     * @param returnMoInfo
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public String returnMo(ReturnMoInfo returnMoInfo) {
 | 
			
		||||
        JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
 | 
			
		||||
| 
						 | 
				
			
			@ -292,11 +363,12 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        objMap.put("sourceSystem", returnMoInfo.getSourceSystem());//来源系统
 | 
			
		||||
        objMap.put("params", returnMoInfo.getParams());
 | 
			
		||||
        jsonObject.putAll(objMap);
 | 
			
		||||
        return   HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
 | 
			
		||||
        return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 叫料结果回传
 | 
			
		||||
     *
 | 
			
		||||
     * @param returnIssueInfo
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
| 
						 | 
				
			
			@ -308,7 +380,7 @@ public class MlsServiceImpl implements MlsService {
 | 
			
		|||
        objMap.put("sourceSystem", returnIssueInfo.getSourceSystem());//来源系统
 | 
			
		||||
        objMap.put("params", returnIssueInfo.getParams());
 | 
			
		||||
        jsonObject.putAll(objMap);
 | 
			
		||||
        return   HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
 | 
			
		||||
        return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,8 +10,8 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
 | 
			
		|||
 | 
			
		||||
public class HttpUtils {
 | 
			
		||||
    public static ResponseEntity<Object> handle(ApiResult r){
 | 
			
		||||
        if(r.getStatus()==400){
 | 
			
		||||
            ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r.getMessage());
 | 
			
		||||
        if(r.getCode()==400){
 | 
			
		||||
            ApiError apiError = ApiError.errorJosn(BAD_REQUEST.value(),r.getMsg());
 | 
			
		||||
            return new ResponseEntity(apiError, HttpStatus.valueOf(apiError.getStatus()));
 | 
			
		||||
        }else{
 | 
			
		||||
            return new ResponseEntity<>(r.getData(),HttpStatus.OK);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
 | 
			
		|||
 | 
			
		||||
@Generated(
 | 
			
		||||
    value = "org.mapstruct.ap.MappingProcessor",
 | 
			
		||||
    date = "2024-04-11T14:17:42+0800",
 | 
			
		||||
    date = "2024-04-12T19:53:04+0800",
 | 
			
		||||
    comments = "version: 1.4.2.Final, compiler: javac, environment: Java 1.8.0_202 (Oracle Corporation)"
 | 
			
		||||
)
 | 
			
		||||
@Component
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue