no message
							parent
							
								
									96f13dcf4e
								
							
						
					
					
						commit
						a0f73cd299
					
				| 
						 | 
					@ -94,40 +94,30 @@ public class KMReSController {
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param orderNumber
 | 
					     * @param orderNumber
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Async
 | 
					    public void returnMo(String orderNumber) {
 | 
				
			||||||
    public void returnMo( String orderNumber) {
 | 
					 | 
				
			||||||
        OrderDto orderDto = orderService.findByBarcodeNumber(orderNumber);
 | 
					        OrderDto orderDto = orderService.findByBarcodeNumber(orderNumber);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (orderDto == null) {
 | 
					        if (orderDto == null) {
 | 
				
			||||||
            throw new RuntimeException(orderNumber + "系统无此送货单号!");
 | 
					            throw new RuntimeException("系统无此送货单号: " + orderNumber);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        double receivedQty = agvTaskService.queryOrderNumberSum(orderNumber);
 | 
					        double receivedQty = agvTaskService.queryOrderNumberSum(orderNumber);
 | 
				
			||||||
        String resultJson="";
 | 
					 | 
				
			||||||
        if (receivedQty == orderDto.getReceivedQty()) {
 | 
					        if (receivedQty == orderDto.getReceivedQty()) {
 | 
				
			||||||
            List<Task> tasks = taskService.findByOrderNumber(orderNumber);
 | 
					            List<Task> tasks = taskService.findByOrderNumber(orderNumber);
 | 
				
			||||||
            ReturnMoInfo returnMoInfo = getReturnMoInfo(tasks);
 | 
					            ReturnMoInfo returnMoInfo = getReturnMoInfo(tasks);
 | 
				
			||||||
            long startTime = System.currentTimeMillis();
 | 
					            long startTime = System.currentTimeMillis();
 | 
				
			||||||
             resultJson = mlsService.returnMo(returnMoInfo);
 | 
					            //调用接口
 | 
				
			||||||
 | 
					            String resultJson = mlsService.returnMo(returnMoInfo);
 | 
				
			||||||
            long endTime = System.currentTimeMillis();
 | 
					            long endTime = System.currentTimeMillis();
 | 
				
			||||||
            long time = endTime - startTime;
 | 
					            long time = endTime - startTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            JSONObject resulObject = JSON.parseObject(resultJson);
 | 
					            JSONObject resulObject = JSON.parseObject(resultJson);
 | 
				
			||||||
            if (resulObject == null) {
 | 
					            if (resulObject == null) {
 | 
				
			||||||
                throw new RuntimeException("按MO票入库接口返回数据为空!");
 | 
					                throw new RuntimeException("按MO票入库接口返回数据为空!");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            com.youchain.domain.Log newlogs = new com.youchain.domain.Log();
 | 
					
 | 
				
			||||||
            newlogs.setDescription("按MO票入库");
 | 
					            // 保存日志
 | 
				
			||||||
            newlogs.setLogType("INFO");
 | 
					            saveLogInfo(returnMoInfo, resultJson, "按MO票入库", time);
 | 
				
			||||||
            newlogs.setMethod(UrlApi.publicApi);
 | 
					 | 
				
			||||||
            newlogs.setParams(JSON.toJSONString(returnMoInfo));
 | 
					 | 
				
			||||||
            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);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -136,7 +126,6 @@ public class KMReSController {
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param task
 | 
					     * @param task
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Async
 | 
					 | 
				
			||||||
    public void returnIssue(@RequestBody Task task) {
 | 
					    public void returnIssue(@RequestBody Task task) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ReturnIssueInfo returnIssueInfo = getReturnIssueInfo(task);
 | 
					        ReturnIssueInfo returnIssueInfo = getReturnIssueInfo(task);
 | 
				
			||||||
| 
						 | 
					@ -146,13 +135,20 @@ public class KMReSController {
 | 
				
			||||||
        long time = endTime - startTime;
 | 
					        long time = endTime - startTime;
 | 
				
			||||||
        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
					        JSONObject resulObject = JSON.parseObject(resultJson);
 | 
				
			||||||
        if (resulObject == null) {
 | 
					        if (resulObject == null) {
 | 
				
			||||||
            throw new RuntimeException("按MO票入库接口返回数据为空!");
 | 
					            throw new RuntimeException("叫料结果回传接口返回数据为空!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        // 保存日志
 | 
				
			||||||
 | 
					        saveLogInfo(returnIssueInfo, resultJson, "叫料结果回传", time);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void saveLogInfo(Object object, String resultJson, String description, long time) {
 | 
				
			||||||
 | 
					        // 设置日志信息
 | 
				
			||||||
        com.youchain.domain.Log newlogs = new com.youchain.domain.Log();
 | 
					        com.youchain.domain.Log newlogs = new com.youchain.domain.Log();
 | 
				
			||||||
        newlogs.setDescription("叫料结果回传");
 | 
					        newlogs.setDescription(description);
 | 
				
			||||||
        newlogs.setLogType("INFO");
 | 
					        newlogs.setLogType("INFO");
 | 
				
			||||||
        newlogs.setMethod(UrlApi.publicApi);
 | 
					        newlogs.setMethod(UrlApi.publicApi);
 | 
				
			||||||
        newlogs.setParams(JSON.toJSONString(returnIssueInfo));
 | 
					        newlogs.setParams(JSON.toJSONString(object));
 | 
				
			||||||
        newlogs.setReturnData(resultJson);
 | 
					        newlogs.setReturnData(resultJson);
 | 
				
			||||||
        newlogs.setRequestIp("127.0.0.1");
 | 
					        newlogs.setRequestIp("127.0.0.1");
 | 
				
			||||||
        newlogs.setTime(time);
 | 
					        newlogs.setTime(time);
 | 
				
			||||||
| 
						 | 
					@ -163,7 +159,7 @@ public class KMReSController {
 | 
				
			||||||
        logService.saveLog(newlogs);
 | 
					        logService.saveLog(newlogs);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static ReturnMoInfo getReturnMoInfo(List<Task> tasks) {
 | 
					    public static ReturnMoInfo getReturnMoInfo(List<Task> tasks) {
 | 
				
			||||||
        ReturnMoParams params = new ReturnMoParams();
 | 
					        ReturnMoParams params = new ReturnMoParams();
 | 
				
			||||||
        params.setOrgId(100059);
 | 
					        params.setOrgId(100059);
 | 
				
			||||||
        params.setInvCode("MA2111");
 | 
					        params.setInvCode("MA2111");
 | 
				
			||||||
| 
						 | 
					@ -180,7 +176,7 @@ public class KMReSController {
 | 
				
			||||||
        return returnMoInfo;
 | 
					        return returnMoInfo;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static ReturnIssueInfo getReturnIssueInfo(Task task) {
 | 
					    public static ReturnIssueInfo getReturnIssueInfo(Task task) {
 | 
				
			||||||
        ReturnIssueInfoParams params = new ReturnIssueInfoParams();
 | 
					        ReturnIssueInfoParams params = new ReturnIssueInfoParams();
 | 
				
			||||||
        params.setOrgId(808);
 | 
					        params.setOrgId(808);
 | 
				
			||||||
        params.setTaskNumber(task.getBillCode());
 | 
					        params.setTaskNumber(task.getBillCode());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -459,10 +459,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public synchronized void agvTaskCallback(AgvTask agvTask, Task task, String status) {
 | 
					    public  void agvTaskCallback(AgvTask agvTask, Task task, String status) {
 | 
				
			||||||
        String agv_on_off = "OFF";
 | 
					 | 
				
			||||||
        agv_on_off = dictService.getDictDescription("agv_on_off") == null ? "OFF" : dictService.getDictDescription("agv_on_off").getDescription();
 | 
					 | 
				
			||||||
        String code = "0";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (status.equals("ARRIVED")) {
 | 
					        if (status.equals("ARRIVED")) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -492,7 +489,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
				
			||||||
                inventory.setQuantity(task.getPlanQty());
 | 
					                inventory.setQuantity(task.getPlanQty());
 | 
				
			||||||
                inventoryService.update(inventory);
 | 
					                inventoryService.update(inventory);
 | 
				
			||||||
                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());
 | 
					                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)) {
 | 
					            } else if (agvTask.getType().equals(BizStatus.PICK)) {
 | 
				
			||||||
                //出库
 | 
					                //出库
 | 
				
			||||||
                //扣除库存
 | 
					                //扣除库存
 | 
				
			||||||
| 
						 | 
					@ -503,8 +499,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                //回传
 | 
					                //回传
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //任务完成
 | 
					            //任务完成
 | 
				
			||||||
            agvTask.setStatus(BizStatus.FINISH);
 | 
					            agvTask.setStatus(BizStatus.FINISH);
 | 
				
			||||||
            agvTask.setEndTime(new Timestamp(new Date().getTime()));
 | 
					            agvTask.setEndTime(new Timestamp(new Date().getTime()));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -224,7 +224,7 @@ public class InventoryServiceImpl implements InventoryService {
 | 
				
			||||||
        if (billCode.isEmpty()) {
 | 
					        if (billCode.isEmpty()) {
 | 
				
			||||||
            return null;
 | 
					            return null;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        String hql = " from Inventory inv where 1=1 and inv.billCode in (:billCode) and inv.quantity>0 ";
 | 
					        String hql = " from Inventory inv where 1=1 and inv.billCode in (:billCode) and inv.quantity-inv.queuedQty>0 ";
 | 
				
			||||||
        Query query = entityManager.createQuery(hql);
 | 
					        Query query = entityManager.createQuery(hql);
 | 
				
			||||||
        query.setParameter("billCode", billCode);
 | 
					        query.setParameter("billCode", billCode);
 | 
				
			||||||
        List<Inventory> list = query.getResultList();
 | 
					        List<Inventory> list = query.getResultList();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,7 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
    public synchronized void getOrderInfo(String resultJson) {
 | 
					    public  void getOrderInfo(String resultJson) {
 | 
				
			||||||
        if (StringUtils.isEmpty(resultJson)) {
 | 
					        if (StringUtils.isEmpty(resultJson)) {
 | 
				
			||||||
            throw new RuntimeException("获取送货单接口失败!");
 | 
					            throw new RuntimeException("获取送货单接口失败!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -222,7 +222,7 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
    public synchronized void getMoInfo(String resultJson) {
 | 
					    public  void getMoInfo(String resultJson) {
 | 
				
			||||||
        if (StringUtils.isEmpty(resultJson)) {
 | 
					        if (StringUtils.isEmpty(resultJson)) {
 | 
				
			||||||
            throw new RuntimeException("获取MO票接口失败!");
 | 
					            throw new RuntimeException("获取MO票接口失败!");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -332,7 +332,7 @@ public class MlsServiceImpl implements MlsService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
    public synchronized void getIssueInfo(IssueInfo issueInfo) {
 | 
					    public  void getIssueInfo(IssueInfo issueInfo) {
 | 
				
			||||||
        String taskNumber=issueInfo.getTaskNumber();//任务号
 | 
					        String taskNumber=issueInfo.getTaskNumber();//任务号
 | 
				
			||||||
        // 指定Set的类型
 | 
					        // 指定Set的类型
 | 
				
			||||||
        Set<String> workOrderNameSet = issueInfo.getWorkOrderName();
 | 
					        Set<String> workOrderNameSet = issueInfo.getWorkOrderName();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,7 +162,7 @@ public class MoServiceImpl implements MoService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    @Transactional(rollbackFor = Exception.class)
 | 
					    @Transactional(rollbackFor = Exception.class)
 | 
				
			||||||
    public synchronized void scanMo(String mo) {
 | 
					    public  void scanMo(String mo) {
 | 
				
			||||||
        //条码格式;12227000016951-qth1847-240411422924
 | 
					        //条码格式;12227000016951-qth1847-240411422924
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String[] arr = mo.split("-");
 | 
					        String[] arr = mo.split("-");
 | 
				
			||||||
| 
						 | 
					@ -232,7 +232,7 @@ public class MoServiceImpl implements MoService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void createTasks(Item item, Stock stock, Point srcPoint, Point endPoint, String propC1, MoDto moDto, OrderDto orderDto) {
 | 
					    public  void createTasks(Item item, Stock stock, Point srcPoint, Point endPoint, String propC1, MoDto moDto, OrderDto orderDto) {
 | 
				
			||||||
        // 生成AGV任务
 | 
					        // 生成AGV任务
 | 
				
			||||||
        AgvTask agvTask = new AgvTask(BizStatus.ASN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE_FULL");
 | 
					        AgvTask agvTask = new AgvTask(BizStatus.ASN, stock.getCode(), srcPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "RACK_MOVE_FULL");
 | 
				
			||||||
        agvTaskService.create(agvTask);
 | 
					        agvTaskService.create(agvTask);
 | 
				
			||||||
| 
						 | 
					@ -253,7 +253,7 @@ public class MoServiceImpl implements MoService {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 提取更新容器状态和目标点位状态的逻辑到单独方法
 | 
					    // 提取更新容器状态和目标点位状态的逻辑到单独方法
 | 
				
			||||||
    private void updateStockAndEndPoint(Stock stock,Point point) {
 | 
					    private  void updateStockAndEndPoint(Stock stock,Point point) {
 | 
				
			||||||
        stock.setStatus(BaseStatus.USED);
 | 
					        stock.setStatus(BaseStatus.USED);
 | 
				
			||||||
        stock.setPoint(point);
 | 
					        stock.setPoint(point);
 | 
				
			||||||
        stockService.update(stock);
 | 
					        stockService.update(stock);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue