| | |
| | | using Hanhe.iWCS.Common; |
| | | using Hanhe.iWCS.DeviceDriver; |
| | | using Hanhe.iWCS.MData; |
| | | using Hanhe.iWCS.Model; |
| | | using MongoDB.Bson; |
| | |
| | | using System.Net.NetworkInformation; |
| | | using System.Net.Sockets; |
| | | using System.Security.Cryptography; |
| | | using System.Security.Policy; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.ApiHelper; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.MESHelper; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.PLCControl; |
| | | using static Hanhe.iWCS.JingmenGEMTwoProtocol.ProtocolAnalysis; |
| | | |
| | | namespace Hanhe.iWCS.JingmenGEMTwoProtocol |
| | | { |
| | |
| | | static WebApiHelper api = new WebApiHelper(); |
| | | |
| | | public const string ERPSwitch01 = "1";// ERP变更流程开关 |
| | | public static HardwareAccessObject hao = HardwareAccessHelper.Instance.GetEquipmentsHAO(Constants.WMS_DEVICE_TYPE_WMS); |
| | | public static List<string> SendERPTaskType = Settings.SendERPTaskType.Split(',').ToList();//回报任务类型 |
| | | public static List<string> LoginInfo = Settings.LoginInfo.Split(',').ToList();// ERP登录接口传输信息 |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | internal static void senderpTaskDG(string startBit) |
| | | internal static void senderpTaskDG(string startBit, string trayCode) |
| | | { |
| | | try |
| | | { |
| | | //通过托盘号调用wms接口获取物料信息 |
| | | |
| | | CMMLog.Info("插入SendErpTaskInfoTable 表 开始:" + startBit); |
| | | var erpInfo = MongoDBSingleton.Instance.FindOne<SendErpTaskInfoTable>(Query.EQ("Bit", startBit), "SendErpTaskInfoTable"); |
| | | CMMLog.Info("SendErpTaskInfoTableDG 表 开始:" + startBit); |
| | | var url = hao.WebUrl + "GlmTrayItemSet"; |
| | | var erpInfo = MongoDBSingleton.Instance.FindOne<SendErpTaskInfoTableDG>(Query.EQ("Bit", startBit), "SendErpTaskInfoTableDG"); |
| | | if (erpInfo == null) |
| | | { |
| | | //string fEntryId = time.FEntryID_1.ToString() + (time.FEntryID_2 == 0 ? "" : ";" + time.FEntryID_2.ToString()) + (time.FEntryID_3 == 0 ? "" : ";" + time.FEntryID_3.ToString()) + (time.FEntryID_4 == 0 ? "" : ";" + time.FEntryID_4.ToString()); |
| | | string materiCode = ""; |
| | | string lotCode = ""; |
| | | int totalWeight = 0; |
| | | string productTime = ""; |
| | | |
| | | CMMLog.Info("插入SendErpTaskInfoTable 表 1"); |
| | | MongoDBSingleton.Instance.Insert<SendErpTaskInfoTable>(new SendErpTaskInfoTable |
| | | //根据托盘号获取入库物料信息 |
| | | CJWareNum model = new CJWareNum |
| | | { |
| | | TrayCode = trayCode |
| | | }; |
| | | |
| | | string msgData = JsonConvert.SerializeObject(model); |
| | | |
| | | var feedback = helper.WebPost(url, msgData).Replace(@"\", "").Trim(); |
| | | CMMLog.Info($"SendErpTaskInfoTableDG:【调用wms获取物料信息】:接收数据:" + feedback); |
| | | if (!string.IsNullOrEmpty(feedback)) |
| | | { |
| | | var wmsResponse = JsonConvert.DeserializeObject<LKInfoResModel>(feedback); |
| | | if (wmsResponse.Success == true) |
| | | { |
| | | materiCode = wmsResponse.Data.CN_S_MATERI_CODE; |
| | | lotCode = wmsResponse.Data.CN_S_LOT_NO; |
| | | totalWeight = wmsResponse.Data.CN_N_WEIGHT; |
| | | productTime = wmsResponse.Data.CN_S_Data; |
| | | } |
| | | } |
| | | |
| | | CMMLog.Info("SendErpTaskInfoTableDG 表 1"); |
| | | MongoDBSingleton.Instance.Insert<SendErpTaskInfoTableDG>(new SendErpTaskInfoTableDG |
| | | { |
| | | Bit = startBit, |
| | | //materiCode = time.materialCode, |
| | | //lotCode = time.batchNumber, |
| | | //productTime = Convert.ToDateTime(time.ProductionDate).AddHours(8), |
| | | //invalidationTime = Convert.ToDateTime(time.ProductionDate).AddHours(8).AddDays(365), |
| | | materiCode = materiCode, |
| | | lotCode = lotCode, |
| | | totalWeight = totalWeight, |
| | | productTime = Convert.ToDateTime(productTime).AddHours(8), |
| | | invalidationTime = Convert.ToDateTime(productTime).AddHours(8).AddDays(365), |
| | | dateTime = DateTime.Now.AddHours(8), |
| | | //变更注释 |
| | | mesSucess = "0" |