| | |
| | | /// <returns>反馈信息</returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public IsBaleModel2 HttpInConfirm(PortModel models) |
| | | public ResponseModel HttpInConfirm(PortModel models) |
| | | { |
| | | |
| | | ResponseModel result = new ResponseModel(); |
| | | result.StatusCode = 0; |
| | | try |
| | | { |
| | | string str = JsonConvert.SerializeObject(models); |
| | |
| | | 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") |
| | | if (val.ToString() == "120" || val.ToString() == "130") |
| | | { |
| | | //读取成功后写入130 |
| | | modDevice = _db.Queryable<WcsPosition>().Where(s => s.StationNum == portno && s.Text == "WCS").First(); |
| | |
| | | if (ret.IsSucceed) |
| | | { |
| | | //回传WMS可放信号 |
| | | return new IsBaleModel2() { Success = 0, Message = "接受成功" }; |
| | | result.Msg = "接受成功"; |
| | | return result; |
| | | } |
| | | } |
| | | return new IsBaleModel2() { Success = -1, Message = "读取PLC点位信息失败" }; |
| | | result.StatusCode = -1; |
| | | result.Msg = "读取PLC点位信息失败"; |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new IsBaleModel2() { Success = -1, Message = ex.Message }; |
| | | return new ResponseModel() { StatusCode = -1, Msg = ex.Message }; |
| | | } |
| | | } |
| | | |
| | |
| | | [AllowAnonymous] |
| | | public ResponseModel HttpInRequest(PortRequestModel models) |
| | | { |
| | | ResponseModel result = new ResponseModel(); |
| | | result.StatusCode = 0; |
| | | try |
| | | { |
| | | string str = JsonConvert.SerializeObject(models); |
| | |
| | | var ret = plcConn.SetPlcDBValue(modDevice.PosType, listPlcDevice.DbNumber, modDevice.PlcPos, "140");//写入开始放货信号 |
| | | if (ret.IsSucceed == true) |
| | | { |
| | | return new ResponseModel() { StatusCode = 0, Msg = "PLC允许放货" }; |
| | | result.Msg = "PLC允许放货"; |
| | | return result; |
| | | } |
| | | |
| | | return new ResponseModel() { StatusCode = -1, Msg = "读取PLC点位信息失败" }; |
| | | |
| | | result.StatusCode = -1; |
| | | result.Msg = "读取PLC点位信息失败"; |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// <returns>反馈信息</returns> |
| | | [HttpPost] |
| | | [AllowAnonymous] |
| | | public IsBaleModel2 HttpInFinish(PortModel models) |
| | | public ResponseModel HttpInFinish(PortModel models) |
| | | { |
| | | |
| | | ResponseModel result = new ResponseModel(); |
| | | result.StatusCode = 0; |
| | | try |
| | | { |
| | | string str = JsonConvert.SerializeObject(models); |
| | |
| | | if (ret.IsSucceed) |
| | | { |
| | | //回传WMS放货信号 |
| | | return new IsBaleModel2() { Success = 0, Message = "接受成功" }; |
| | | result.Msg = "接受成功"; |
| | | return result; |
| | | } |
| | | return new IsBaleModel2() { Success = -1, Message = "读取PLC点位信息失败" }; |
| | | result.StatusCode = -1; |
| | | result.Msg = "读取PLC点位信息失败"; |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new IsBaleModel2() { Success = -1, Message = ex.Message }; |
| | | return new ResponseModel() { StatusCode = -1, Msg = ex.Message }; |
| | | } |
| | | } |
| | | |