PDAController.cs 6.94 KB
using System;
using System.Collections.Generic;
using System.Linq;
using Hh.Mes.Api.Controllers;
using Hh.Mes.Common.Json;
using Hh.Mes.POJO.Entity;
using Hh.Mes.POJO.EnumEntitys;
using Hh.Mes.Service;
using Hh.Mes.Service.WebService.Planned;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Headers;
using Microsoft.AspNetCore.Mvc;

namespace Hh.Mes.Api.Controllers
{
    /// <summary>
    /// pda 查询接口
    /// ps:新增方法需要在SystemVariable 注册 APIList、EnumLog 新增枚举 ,方便接口日志定位查询
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PDAController :  BaseController
    {
        private readonly PDAService service;

        public PDAController(PDAService pdaService, IHttpContextAccessor accessor)
        {

            service = pdaService;
            context = accessor.HttpContext;

            var sysUserApi = base.GetUser(context);
            this.service.sysUserApi = sysUserApi;
        }


        /// <summary>
        /// PDA物料追溯查询
        /// 1:使用动态类型、或者使用实体类
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ActionName("Mes/V1/GetMaterialByPDABarCode")]
        public string GetMaterialInfoByBarCode(dynamic requestData)
        {
            var result = service.GetMaterialInfoByBarCode(requestData);
            return Serialize(result);
        }

        #region 组对、焊接

        /// <summary>
        /// 获取匹配的组对信息
        /// </summary>
        /// <param name="pipe">管段码</param>
        /// <param name="batch">批次码</param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/GetMatchTeamList")]
        public string GetMatchTeamList(string pipe, string batch)
        {
            var result = service.GetMatchTeamList(pipe, batch);
            return JsonHelper.Instance.Serialize(result);
        }

        /// <summary>
        /// 获取组对开始列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/GetTeamStartList")]
        public string GetTeamStartList()
        {
            var result = service.GetTeamStartList();
            return JsonHelper.Instance.Serialize(result);
        }


        /// <summary>
        /// 保存组对开始列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ActionName("Mes/V1/SaveTeamStartList")]
        public string SaveTeamStartList(List<bus_workOrder_detail> details)
        {
            var result = service.SaveTeamStartList(details);
            return JsonHelper.Instance.Serialize(result);
        }


        /// <summary>
        /// 保存组对结束列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ActionName("Mes/V1/SaveTeamEndList")]
        public string SaveTeamEndList(List<bus_workOrder_detail> details)
        {
            var result = service.SaveTeamEndList(details);
            return JsonHelper.Instance.Serialize(result);
        }


        /// <summary>
        /// 获取匹配的焊接信息
        /// </summary>
        /// <param name="pipe">管段码</param>
        /// <param name="batch">批次码</param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/GetMatchWeldList")]
        public string GetMatchWeldList(string pipe)
        {
            var result = service.GetMatchWeldList(pipe);
            return JsonHelper.Instance.Serialize(result);
        }

        /// <summary>
        /// 获取焊接开始列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/GetWeldStartList")]
        public string GetWeldStartList()
        {
            var result = service.GetWeldStartList();
            return JsonHelper.Instance.Serialize(result);
        }


        /// <summary>
        /// 保存焊接开始列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ActionName("Mes/V1/SaveWeldStartList")]
        public string SaveWeldStartList(List<bus_workOrder_detail> details)
        {
            var result = service.SaveWeldStartList(details);
            return JsonHelper.Instance.Serialize(result);
        }


        /// <summary>
        /// 保存焊接结束列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ActionName("Mes/V1/SaveWeldEndList")]
        public string SaveWeldEndList(List<bus_workOrder_detail> details)
        {
            var result = service.SaveWeldEndList(details);
            return JsonHelper.Instance.Serialize(result);
        }


        /// <summary>
        /// 焊接工艺下发保存
        /// </summary>
        /// <param name="equipmentCode">设备编码</param>
        /// <param name="barCode">管段码</param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/SaveWeldTechnology")]
        public string SaveWeldTechnology(string equipmentCode,string barCode)
        {
            var result = service.SaveWeldTechnology(equipmentCode,barCode);
            return JsonHelper.Instance.Serialize(result);
        }

        /// <summary>
        /// 批次码获取物料信息
        /// </summary>
        /// <param name="lotNo">批次码</param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/GetMaterialBylotNo")]
        public string GetMaterialBylotNo(string lotNo)
        {
            var result = service.GetMaterialBylotNo(lotNo);
            return JsonHelper.Instance.Serialize(result);
        }

        /// <summary>
        /// 设备编码获取设备信息
        /// </summary>
        /// <param name="equipmentCode">设备编码</param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/GetEquipmentByCode")]
        public string GetEquipmentByCode(string equipmentCode)
        {
            var result = service.GetEquipmentByCode(equipmentCode);
            return JsonHelper.Instance.Serialize(result);
        }

        /// <summary>
        /// 呼叫Agv接料
        /// </summary>
        /// <param name="equipmentCode">设备编码</param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/AgvCollectingStart")]
        public string AgvCollectingStart(string equipmentCode)
        {
            var result = service.AgvCollectingStart(equipmentCode);
            return JsonHelper.Instance.Serialize(result);
        }

        /// <summary>
        /// Agv接料完成
        /// </summary>
        /// <param name="equipmentCode">设备编码</param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("Mes/V1/AgvCollectingEnd")]
        public string AgvCollectingEnd(string equipmentCode)
        {
            var result = service.AgvCollectingEnd(equipmentCode);
            return JsonHelper.Instance.Serialize(result);
        }

        #endregion
    }
}