| | |
| | | using Dm.filter; |
| | | using DocumentFormat.OpenXml.Drawing.Charts; |
| | | using DocumentFormat.OpenXml.Presentation; |
| | | using Elastic.Clients.Elasticsearch; |
| | | using Furion.Logging; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// WCS接受WMS入库放货确认接口 |
| | | /// </summary> |
| | | /// <param name="models"></param> |
| | | /// <returns>反馈信息</returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public IsBaleModel2 HttpInConfirm(PortModel models) |
| | | { |
| | | |
| | | try |
| | | { |
| | | string str = JsonConvert.SerializeObject(models); |
| | | Log.Information("接收WMS入库放货确认,放货口:" + models.Port+"入库口"); |
| | | |
| | | var portno = ""; |
| | | switch (models.Port) |
| | | { |
| | | case "033": |
| | | portno = "33"; |
| | | break; |
| | | case "039": |
| | | portno = "39"; |
| | | break; |
| | | case "044": |
| | | portno = "44"; |
| | | break; |
| | | case "051": |
| | | portno = "51"; |
| | | break; |
| | | } |
| | | |
| | | //检测入库口状态,120为可放,占用则修改为130 |
| | | |
| | | WcsDeviceDto mod = new WcsDeviceDto(); |
| | | var plcConn = mod.PLCUtil; |
| | | //获取工位点位信息 |
| | | var listPlcDevice = _db.Queryable<WcsDevice>().Where(s => s.LedIP != null && s.StationNum == portno).First(); |
| | | var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "PLC流程字").First(); |
| | | |
| | | var (res1, val) = plcConn.GetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos); |
| | | if (val.ToString() == "120") |
| | | { |
| | | //读取成功后写入130 |
| | | modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS流程字").First(); |
| | | var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "130");//占用此工位 |
| | | if (ret.IsSucceed) |
| | | { |
| | | //回传WMS可放信号 |
| | | return new IsBaleModel2() { Success = 0, Message = "接受成功" }; |
| | | } |
| | | } |
| | | return new IsBaleModel2() { Success = -1, Message = "读取PLC点位信息失败" }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new IsBaleModel2() { Success = -1, Message = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// WCS接受WMS入库放货请求接口 |
| | | /// </summary> |
| | | /// <param name="models"></param> |
| | | /// <returns>反馈信息</returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public IsBaleModel2 HttpInRequest(PortRequestModel models) |
| | | { |
| | | try |
| | | { |
| | | string str = JsonConvert.SerializeObject(models); |
| | | Log.Information("接收WMS入库放货确认,放货口:" + models.Port + "入库口"); |
| | | |
| | | var portno = ""; |
| | | switch (models.Port) |
| | | { |
| | | case "033": |
| | | portno = "33"; |
| | | break; |
| | | case "039": |
| | | portno = "39"; |
| | | break; |
| | | case "044": |
| | | portno = "44"; |
| | | break; |
| | | case "051": |
| | | portno = "51"; |
| | | break; |
| | | } |
| | | |
| | | WcsDeviceDto mod = new WcsDeviceDto(); |
| | | var plcConn = mod.PLCUtil; |
| | | //获取工位点位信息 |
| | | var listPlcDevice = _db.Queryable<WcsDevice>().Where(s=>s.LedIP != null && s.StationNum == portno).First(); |
| | | var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "任务号").First(); |
| | | plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, models.TaskNo);//写入任务号 |
| | | // |
| | | modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS流程字").First(); |
| | | var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "140");//写入开始放货信号 |
| | | if (ret.IsSucceed) |
| | | { |
| | | //回传WMS放货信号 |
| | | return new IsBaleModel2() { Success = 0, Message = "接受成功" }; |
| | | } |
| | | return new IsBaleModel2() { Success = -1, Message = "读取PLC点位信息失败" }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new IsBaleModel2() { Success = -1, Message = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// WCS接受WMS小车放完成接口 |
| | | /// </summary> |
| | | /// <param name="models"></param> |
| | | /// <returns>反馈信息</returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public IsBaleModel2 HttpInFinish(PortModel models) |
| | | { |
| | | |
| | | try |
| | | { |
| | | string str = JsonConvert.SerializeObject(models); |
| | | Log.Information("接收WMS入库放货确认,放货口:" + models.Port + "入库口"); |
| | | |
| | | var portno = ""; |
| | | switch (models.Port) |
| | | { |
| | | case "033": |
| | | portno = "33"; |
| | | break; |
| | | case "039": |
| | | portno = "39"; |
| | | break; |
| | | case "044": |
| | | portno = "44"; |
| | | break; |
| | | case "051": |
| | | portno = "51"; |
| | | break; |
| | | } |
| | | |
| | | WcsDeviceDto mod = new WcsDeviceDto(); |
| | | var plcConn = mod.PLCUtil; |
| | | //获取工位点位信息 |
| | | var listPlcDevice = _db.Queryable<WcsDevice>().Where(s => s.LedIP != null && s.StationNum == portno).First(); |
| | | var modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS流程字").First(); |
| | | |
| | | var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "160");//放完成 |
| | | if (ret.IsSucceed) |
| | | { |
| | | //回传WMS放货信号 |
| | | return new IsBaleModel2() { Success = 0, Message = "接受成功" }; |
| | | } |
| | | return new IsBaleModel2() { Success = -1, Message = "读取PLC点位信息失败" }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new IsBaleModel2() { Success = -1, Message = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | } |