no message
							parent
							
								
									142718f5af
								
							
						
					
					
						commit
						c79a29817a
					
				| 
						 | 
				
			
			@ -11,11 +11,11 @@ import lombok.Data;
 | 
			
		|||
public class ReturnIssueInfo {
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "接口编码")
 | 
			
		||||
    @Schema(example = "MLS-WQ-006")
 | 
			
		||||
    @Schema(example = "MLS-YC-001")
 | 
			
		||||
    String ifaceCode;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "来源系统")
 | 
			
		||||
    @Schema(example = "WQ")
 | 
			
		||||
    @Schema(example = "WMS")
 | 
			
		||||
    String sourceSystem;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "参数")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,24 +8,17 @@ 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 = "YCJL2024040300001")
 | 
			
		||||
    String taskNumber;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "标签集合")
 | 
			
		||||
    @Schema(example = "[\"DC0001\"]")
 | 
			
		||||
    Set labelNos;
 | 
			
		||||
    Set labelNo;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "子库编码")
 | 
			
		||||
    @Schema(example = "MC1311")
 | 
			
		||||
    String invCode;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "需求工单")
 | 
			
		||||
    @Schema(example = "ZZ总部18210606021401")
 | 
			
		||||
    String workOrderName;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,8 @@ import com.youchain.appupdate.inputJson.MissionStateCallback;
 | 
			
		|||
import com.youchain.businessdata.domain.AgvTask;
 | 
			
		||||
import com.youchain.businessdata.domain.ItemKey;
 | 
			
		||||
import com.youchain.businessdata.domain.Task;
 | 
			
		||||
import com.youchain.businessdata.inputJson.ReturnIssueInfo;
 | 
			
		||||
import com.youchain.businessdata.inputJson.ReturnIssueInfoParams;
 | 
			
		||||
import com.youchain.businessdata.inputJson.ReturnMoInfo;
 | 
			
		||||
import com.youchain.businessdata.inputJson.ReturnMoParams;
 | 
			
		||||
import com.youchain.businessdata.repository.TaskRepository;
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +29,7 @@ import lombok.RequiredArgsConstructor;
 | 
			
		|||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.scheduling.annotation.Async;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
| 
						 | 
				
			
			@ -76,6 +79,8 @@ public class KMReSController {
 | 
			
		|||
            //回传
 | 
			
		||||
            if (agvTask.getType().equals(BizStatus.ASN)) {
 | 
			
		||||
                returnMo(task.getItemKey().getOrderNumber());
 | 
			
		||||
            } else if (agvTask.getType().equals(BizStatus.PICK)) {
 | 
			
		||||
                returnIssue(task);
 | 
			
		||||
            }
 | 
			
		||||
            return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
| 
						 | 
				
			
			@ -84,7 +89,13 @@ public class KMReSController {
 | 
			
		|||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void returnMo(String orderNumber) {
 | 
			
		||||
    /**
 | 
			
		||||
     * 回传MO信息
 | 
			
		||||
     *
 | 
			
		||||
     * @param orderNumber
 | 
			
		||||
     */
 | 
			
		||||
    @Async
 | 
			
		||||
    public void returnMo( String orderNumber) {
 | 
			
		||||
        OrderDto orderDto = orderService.findByBarcodeNumber(orderNumber);
 | 
			
		||||
 | 
			
		||||
        if (orderDto == null) {
 | 
			
		||||
| 
						 | 
				
			
			@ -92,11 +103,12 @@ public class KMReSController {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        double receivedQty = agvTaskService.queryOrderNumberSum(orderNumber);
 | 
			
		||||
        String resultJson="";
 | 
			
		||||
        if (receivedQty == orderDto.getReceivedQty()) {
 | 
			
		||||
            List<Task> tasks = taskService.findByOrderNumber(orderNumber);
 | 
			
		||||
            ReturnMoInfo returnMoInfo = getReturnMoInfo(tasks);
 | 
			
		||||
            long startTime = System.currentTimeMillis();
 | 
			
		||||
            String resultJson = mlsService.returnMo(returnMoInfo);
 | 
			
		||||
             resultJson = mlsService.returnMo(returnMoInfo);
 | 
			
		||||
            long endTime = System.currentTimeMillis();
 | 
			
		||||
            long time = endTime - startTime;
 | 
			
		||||
            JSONObject resulObject = JSON.parseObject(resultJson);
 | 
			
		||||
| 
						 | 
				
			
			@ -119,6 +131,38 @@ public class KMReSController {
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 叫料结果回传
 | 
			
		||||
     *
 | 
			
		||||
     * @param task
 | 
			
		||||
     */
 | 
			
		||||
    @Async
 | 
			
		||||
    public void returnIssue(@RequestBody Task task) {
 | 
			
		||||
 | 
			
		||||
        ReturnIssueInfo returnIssueInfo = getReturnIssueInfo(task);
 | 
			
		||||
        long startTime = System.currentTimeMillis();
 | 
			
		||||
        String resultJson = mlsService.returnIssue(returnIssueInfo);
 | 
			
		||||
        long endTime = System.currentTimeMillis();
 | 
			
		||||
        long time = endTime - startTime;
 | 
			
		||||
        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
			
		||||
        if (resulObject == null) {
 | 
			
		||||
            throw new RuntimeException("按MO票入库接口返回数据为空!");
 | 
			
		||||
        }
 | 
			
		||||
        com.youchain.domain.Log newlogs = new com.youchain.domain.Log();
 | 
			
		||||
        newlogs.setDescription("叫料结果回传");
 | 
			
		||||
        newlogs.setLogType("INFO");
 | 
			
		||||
        newlogs.setMethod(UrlApi.publicApi);
 | 
			
		||||
        newlogs.setParams(JSON.toJSONString(returnIssueInfo));
 | 
			
		||||
        newlogs.setReturnData(resultJson);
 | 
			
		||||
        newlogs.setRequestIp("127.0.0.1");
 | 
			
		||||
        newlogs.setTime(time);
 | 
			
		||||
        newlogs.setUsername("admin");
 | 
			
		||||
        newlogs.setAddress("内网IP");
 | 
			
		||||
        newlogs.setBrowser("Chrome 123");
 | 
			
		||||
        newlogs.setCreateTime(new Timestamp(new Date().getTime()));
 | 
			
		||||
        logService.saveLog(newlogs);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static ReturnMoInfo getReturnMoInfo(List<Task> tasks) {
 | 
			
		||||
        ReturnMoParams params = new ReturnMoParams();
 | 
			
		||||
        params.setOrgId(100059);
 | 
			
		||||
| 
						 | 
				
			
			@ -135,4 +179,20 @@ public class KMReSController {
 | 
			
		|||
        returnMoInfo.setParams(params);
 | 
			
		||||
        return returnMoInfo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static ReturnIssueInfo getReturnIssueInfo(Task task) {
 | 
			
		||||
        ReturnIssueInfoParams params = new ReturnIssueInfoParams();
 | 
			
		||||
        params.setOrgId(808);
 | 
			
		||||
        params.setTaskNumber(task.getBillCode());
 | 
			
		||||
        Set<String> labelNos = new HashSet<>();
 | 
			
		||||
        labelNos.add(task.getItemKey().getPropC1());
 | 
			
		||||
        params.setLabelNo(labelNos);
 | 
			
		||||
        ReturnIssueInfo returnIssueInfo = new ReturnIssueInfo();
 | 
			
		||||
        returnIssueInfo.setIfaceCode("MLS-YC-001");
 | 
			
		||||
        returnIssueInfo.setSourceSystem("WMS");
 | 
			
		||||
        returnIssueInfo.setParams(params);
 | 
			
		||||
        return returnIssueInfo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,7 @@ import com.youchain.businessdata.service.dto.AgvTaskDto;
 | 
			
		|||
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
 | 
			
		||||
import com.youchain.businessdata.service.mapstruct.AgvTaskMapper;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
import org.springframework.scheduling.annotation.Async;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.springframework.data.domain.Page;
 | 
			
		||||
| 
						 | 
				
			
			@ -468,6 +469,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
			
		|||
        } else if (status.equals("UP_CONTAINER")) {
 | 
			
		||||
 | 
			
		||||
        } else if (status.equals("COMPLETED")) {
 | 
			
		||||
            //入库
 | 
			
		||||
            if (agvTask.getType().equals(BizStatus.ASN)) {
 | 
			
		||||
                //增加库存
 | 
			
		||||
                AsnDetail ad = task.getAsnDetail();
 | 
			
		||||
| 
						 | 
				
			
			@ -478,7 +480,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
			
		|||
                task.setMoveQty(task.getPlanQty());
 | 
			
		||||
                taskService.update(task);
 | 
			
		||||
                Stock stock = task.getSrcStock();
 | 
			
		||||
 | 
			
		||||
                List<Inventory> inventoryList = inventoryService.queryInventory(stock);
 | 
			
		||||
                for (Inventory inventory : inventoryList) {
 | 
			
		||||
                    Long[] ids = new Long[1];
 | 
			
		||||
| 
						 | 
				
			
			@ -486,7 +487,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
			
		|||
                    inventoryService.deleteAll(ids);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                //生成库存
 | 
			
		||||
                Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), task.getSrcStock(), task.getDept(), BizStatus.RECEIVING_UP);
 | 
			
		||||
                inventory.setQuantity(task.getPlanQty());
 | 
			
		||||
| 
						 | 
				
			
			@ -494,14 +494,14 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
			
		|||
                inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, null, task.getItemKey(), task.getSrcPoint(), task.getDstPoint(), task.getSrcStock(), task.getSrcStock(), task.getPlanQty(), task.getPlanQty(), BizStatus.ASN, ad.getId(), inventory.getId(), ad.getRemark());
 | 
			
		||||
 | 
			
		||||
            } else if (agvTask.getType().equals(BizStatus.PICK)) {
 | 
			
		||||
                //处理实际逻辑
 | 
			
		||||
 | 
			
		||||
                //出库
 | 
			
		||||
                //扣除库存
 | 
			
		||||
                try {
 | 
			
		||||
                    taskService.pickConfirm(task.getId(), task.getPlanQty());
 | 
			
		||||
                } catch (Exception e) {
 | 
			
		||||
                    throw new RuntimeException(e.getMessage());
 | 
			
		||||
                }
 | 
			
		||||
                //回传
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,7 +19,9 @@ import cn.hutool.core.bean.BeanUtil;
 | 
			
		|||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
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.repository.PointRepository;
 | 
			
		||||
import com.youchain.basicdata.repository.StockRepository;
 | 
			
		||||
import com.youchain.basicdata.service.dto.StockSmallDto;
 | 
			
		||||
import com.youchain.businessdata.ReturnJson.RPTaskList;
 | 
			
		||||
| 
						 | 
				
			
			@ -69,6 +71,7 @@ public class TaskServiceImpl implements TaskService {
 | 
			
		|||
    private final InventoryLogService inventoryLogService;
 | 
			
		||||
    private final EntityManager entityMapper;
 | 
			
		||||
    private  final StockRepository stockRepository;
 | 
			
		||||
    private  final PointRepository pointRepository;
 | 
			
		||||
    @Override
 | 
			
		||||
    public Map<String, Object> queryAll(TaskQueryCriteria criteria, Pageable pageable) {
 | 
			
		||||
        Page<Task> page = taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
 | 
			
		||||
| 
						 | 
				
			
			@ -171,8 +174,12 @@ public class TaskServiceImpl implements TaskService {
 | 
			
		|||
                        inventoryRepository.delete(inv);
 | 
			
		||||
                    }
 | 
			
		||||
                    Stock stock=inv.getStock();
 | 
			
		||||
                    Point point=stock.getPoint();
 | 
			
		||||
                    stock.setStatus(BaseStatus.FREE);
 | 
			
		||||
                    stock.setPoint(null);
 | 
			
		||||
                    stockRepository.save(stock);
 | 
			
		||||
                    point.setStatus(BaseStatus.FREE);
 | 
			
		||||
                    pointRepository.save(point);
 | 
			
		||||
                    //添加库存日志
 | 
			
		||||
                    inventoryLogService.storeInventoryLog(BizStatus.PICK_DOWN,BizStatus.REDUCE,task.getPickDetail().getPo(),task.getItemKey(),task.getSrcPoint(),task.getDstPoint(),task.getSrcStock(),task.getDstStock(),srcQty,pickedQuantity, BizStatus.PICK,task.getId(),inv.getId(),"");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue