刘磊
2025-04-19 823752496e2a4cdb6a1fb36227cd15b8b7135336
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using MailKit;
using Masuit.Tools;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_DTO;
 
namespace WIDESEA_StoragIntegrationServices
{
    public partial class MCSService
    {
        public WebResponseContent ModifyAccessStatus(object json)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                if (string.IsNullOrEmpty(json.ToString())) throw new Exception("上传参数为空");
 
                var result = JsonConvert.DeserializeObject<LocationWorkState>(json.ToString());
 
                var locationinfo = _locationRepository.QueryFirst(x => x.AreaId == result.LocationArea && x.LocationCode == result.LocationID);
                if (locationinfo != null)
                {
                    //检测柜提供的货位状态,只有wms未锁定且提供的状态为允许才允许放货
                    if (locationinfo.Remark != result.StateCode.ToString())
                    {
                        locationinfo.Remark = result.StateCode.ToString();
                        _locationRepository.UpdateData(locationinfo);
                    }
                }
                else
                    throw new Exception("货位不存在");
 
 
                LogFactory.GetLog("分容库位同步").Info(true, $"\r\r--------------------------------------");
                LogFactory.GetLog("分容库位同步").Info(true, result.ToJsonString());
                return content.OK();
            }
            catch (Exception ex)
            {
                return content.Error(ex.Message);
            }
        }
 
 
        //private static string LocationStatusByCode(int code)
        //{
        //    string str = null;
        //    switch (code)
        //    {
        //        case 1: str = "LocationState_Allows"; break;
        //        case 2: str = "LocationState_NotAllows"; break;
        //        //case 2: str = LocationState.LocationLock.ToString(); break;
        //        default:
        //            str = "LocationState_NotAllows"; break;
        //    }
        //    return str;
        //}
    }
}