Tiandele
2026-03-20 daea1a90c2fa1b5cc2f52e62be15bd95cc4155f6
ÏîÄ¿´úÂë/WMS/WMSServer/WIDESEA_StoragIntegrationServices/MES/Partial/PassPoint.cs
@@ -1,14 +1,24 @@
using Newtonsoft.Json;
using WIDESEA_Common;
using WIDESEA_Common.MES;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_StorageBasicRepository;
namespace WIDESEA_StoragIntegrationServices
{
    public partial class MESService
    {
        public WebResponseContent PassPoint(string stationCode, string rfid)
        /// <summary>
        /// è½¦èº«è¿‡ç‚¹
        /// </summary>
        /// <param name="stationCode"></param>
        /// <param name="rfidPrint">扫二维码信息</param>
        /// <returns></returns>
        /// <exception cref="InvalidOperationException"></exception>
        public WebResponseContent PassPoint(RequestTaskDto json)
        {
            WebResponseContent content = new WebResponseContent();
            try
@@ -20,37 +30,48 @@
                {
                    throw new InvalidOperationException("WMS IP æœªé…ç½®");
                }
                var wmsIpAddress = wmsBase + ipAddress;
                var wmsIpAddress = wmsBase + ipAddress;
                var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == stationCode);
                var carBodyInfo = _carBodyRepository.QueryFirst(x => x.RFID == json.PVI);
                if (carBodyInfo == null) throw new Exception($"未找到PVI{json.PVI}的车身数据");
                //将白车身更新成彩车身
                //carBodyInfo.CarType = 2;
                //_carBodyRepository.UpdateData(carBodyInfo);
                var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position);
                if (stationInfo == null) throw new Exception($"请求车身过点失败:点位{json.Position}未找到");
                PassPointInfo passPoint = new PassPointInfo()
                {
                    union_key = Guid.NewGuid().ToString(),
                    line_code = stationInfo.stationChildCode,
                    message_time = DateTime.Now,
                    line_code = stationInfo.stationEquipMES,
                    message_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    plant_code = "1052",
                    pvi = rfid,
                    station_code = stationInfo.stationChildCode,
                    pvi = json.PVI,
                    station_code = stationInfo.stationEquipMES,
                    vin = "",
                    pass_time = DateTime.Now
                    pass_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                };
                var MESrespon = HttpHelper.Post(wmsIpAddress, passPoint.ToJson());
                var MESrespon = HttpHelper.PostAsync(wmsIpAddress, passPoint.ToJson(), contentType, headers).Result;
                WebResponseContent responseContent = JsonConvert.DeserializeObject<WebResponseContent>(MESrespon);
                if (!responseContent.Status)
                MesResponse responseContent = JsonConvert.DeserializeObject<MesResponse>(MESrespon.ToString());
                if (responseContent.code != 200)
                {
                    throw new Exception($"车身过点异常:{responseContent.Message}");
                    //if (!responseContent.message.Contains("重复报工"))
                    throw new Exception($"车身过点异常:{responseContent.message}");
                }
                LogFactory.GetLog("车身过点").Info(true, $"\r\r--------------------------------------");
                LogFactory.GetLog("车身过点").Info(true, $"工位号:{stationCode},RFID:{rfid}");
                LogFactory.GetLog("车身过点").Info(true, $"工位号:{json.Position},RFID:{json.PVI},响应信息:{responseContent.ToJson}");
                return content;
                return content.OK();
            }
            catch (Exception ex)
            {
                LogFactory.GetLog("车身过点").Info(true, $"\r\r--------------------------------------");
                LogFactory.GetLog("车身过点").Info(true, $"工位号:{json.Position},RFID:{json.PVI},异常信息:{ex.Message}");
                return content.Error(ex.Message);
            }
        }