using HH.WMS.BLL; using HH.WMS.BLL.External; using HH.WMS.BLL.InStock; using HH.WMS.BLL.SysMgr; using HH.WMS.Common; using HH.WMS.Common.External; using HH.WMS.Common.Response; using HH.WMS.DAL; using HH.WMS.DAL.Algorithm; using HH.WMS.Entitys; using HH.WMS.Entitys.Algorithm; using HH.WMS.Entitys.Common; using HH.WMS.Entitys.Dto; using HH.WMS.Entitys.External; using HH.WMS.WebApi.App_Start; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.Services; namespace HH.WMS.WebApi.WebService { /// /// WMSWebService 的摘要说明 /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 // [System.Web.Script.Services.ScriptService] public class WmsWebService : System.Web.Services.WebService { [WebMethod] public string InWorkArea(InWorkEntity inWorkEntity) { var logPara = LogType.LogPara("巨星调用InWorkArea WebService接口"); Log.Detail(logPara, "InWorkArea接口请求参数:" + JsonConvert.SerializeObject(inWorkEntity)); InWorkAreaEntity inWorkAreaEntity = new InWorkAreaEntity(); if (inWorkEntity == null) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "参数不正确" }; Log.Detail(logPara, "InWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } if (string.IsNullOrEmpty(inWorkEntity.trayCode)) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "托盘号不能为空" }; Log.Detail(logPara, "InWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } if (string.IsNullOrEmpty(inWorkEntity.startBit)) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "起点不能为空" }; Log.Detail(logPara, "InWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } //if (string.IsNullOrEmpty(inWorkEntity.locationGear)) //{ // ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "该托盘可入货位档位不能为空" }; // Log.Detail(logPara, "InWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); // return JsonConvert.SerializeObject(eResponse); //} inWorkAreaEntity.trayCode = inWorkEntity.trayCode; inWorkAreaEntity.startBit = inWorkEntity.startBit; inWorkAreaEntity.locationGear = inWorkEntity.locationGear; inWorkAreaEntity.endArea = inWorkEntity.endArea; inWorkAreaEntity.endBit = inWorkEntity.endBit; inWorkAreaEntity.isTransport = "N"; inWorkAreaEntity.needCreateAMSTask = "Y"; List lstInWork = new List(); lstInWork.Add(inWorkAreaEntity); return WmsApiBLLRoute.InWorkArea(lstInWork); } [WebMethod] public string OutWorkArea(OutWorkEntity outWorkEntity) { var logPara = LogType.LogPara("巨星调用OutWorkArea WebService接口"); Log.Detail(logPara, "OutWorkArea接口请求参数:" + JsonConvert.SerializeObject(outWorkEntity)); OutWorkAreaEntity outWorkAreaEntity = new OutWorkAreaEntity(); if (outWorkEntity == null) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "参数不正确" }; Log.Detail(logPara, "OutWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } if (string.IsNullOrEmpty(outWorkEntity.trayCode)) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "托盘号不能为空" }; Log.Detail(logPara, "OutWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } //if (string.IsNullOrEmpty(outWorkEntity.startBit)) //{ // ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "起点不能为空" }; // Log.Detail(logPara, "OutWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); // return JsonConvert.SerializeObject(eResponse); //} if (string.IsNullOrEmpty(outWorkEntity.trnSeqNo)) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "搬运任务号不能为空" }; Log.Detail(logPara, "OutWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } outWorkAreaEntity.startBit = outWorkEntity.startBit; outWorkAreaEntity.trayCode = outWorkEntity.trayCode; outWorkAreaEntity.priority = outWorkEntity.priority; outWorkAreaEntity.endBit = outWorkEntity.endBit; outWorkAreaEntity.endArea = outWorkEntity.endArea; outWorkAreaEntity.remark = outWorkEntity.trnSeqNo; outWorkAreaEntity.IsTransport = "Y"; outWorkAreaEntity.needCreateAMSTask = "Y"; List lstOutWork = new List(); lstOutWork.Add(outWorkAreaEntity); return WmsApiBLLRoute.OutWorkArea(lstOutWork); } [WebMethod] public string TranWorkArea(TranWorkEntity tranWorkEntity) { var logPara = LogType.LogPara("巨星调用TranWorkArea WebService接口"); Log.Detail(logPara, "TranWorkArea接口请求参数:" + JsonConvert.SerializeObject(tranWorkEntity)); InWorkAreaEntity inWorkAreaEntity = new InWorkAreaEntity(); if (tranWorkEntity == null) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "参数不正确" }; Log.Detail(logPara, "TranWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } if (string.IsNullOrEmpty(tranWorkEntity.trayCode)) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "托盘号不能为空" }; Log.Detail(logPara, "TranWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } if (string.IsNullOrEmpty(tranWorkEntity.startBit)) { ExternalResponse eResponse = new ExternalResponse { success = false, errMsg = "起点不能为空" }; Log.Detail(logPara, "TranWorkArea接口返回结果:" + JsonConvert.SerializeObject(eResponse)); return JsonConvert.SerializeObject(eResponse); } inWorkAreaEntity.trayCode = tranWorkEntity.trayCode; inWorkAreaEntity.startBit = tranWorkEntity.startBit; inWorkAreaEntity.locationGear = tranWorkEntity.locationGear; inWorkAreaEntity.endArea = tranWorkEntity.endArea; inWorkAreaEntity.endBit = tranWorkEntity.endBit; inWorkAreaEntity.isTransport = "Y"; inWorkAreaEntity.needCreateAMSTask = "Y"; inWorkAreaEntity.trnSeqNo = tranWorkEntity.trnSeqNo; inWorkAreaEntity.needCallJobDetail = "N"; List lstInWork = new List(); lstInWork.Add(inWorkAreaEntity); return WmsApiBLLRoute.InWorkArea(lstInWork); } [WebMethod] public string BindingAndUnBinding(BindingAndUnBindingDto bindEntity) { var logPara = LogType.LogPara("绑定与解绑"); Log.Detail(logPara, "BindingAndUnBinding接口请求参数:" + JsonConvert.SerializeObject(bindEntity)); var result = WmsApiBLLRoute.BindingAndUnBinding(bindEntity); Log.Detail(logPara, "BindingAndUnBinding接口返回结果:" + JsonConvert.SerializeObject(result)); return result; } [WebMethod] public string AGVLocationQuery(string stockCode, string strLocation) { OperateResult result = new OperateResult(); List dt = new List(); List listData = new List(); try { dt = BLLCreator.Create().GetAGVLocationStatus(stockCode,strLocation); List lstLogicEntity= DALCreator.Create().GetLogicAreaLocation(dt.Select(o => o.CN_S_LOCATION_CODE).ToList()); listData = lstLogicEntity.Join(dt, u => u.CN_S_LOCATION_CODE, d => d.CN_S_LOCATION_CODE, (u, d) => new { u, d }) .Select(o => new AgvLocationQuery { CN_S_TRAY_CODE = o.d.CN_S_TRAY_CODE, CN_S_LOCATION_CODE = o.d.CN_S_LOCATION_CODE, CN_S_LOCATION_STATE = o.d.CN_S_LOCATION_STATE, CN_S_USE_STATE = o.d.CN_S_USE_STATE, LOCATION_GEAR = o.u.CN_S_AREA_CODE }).ToList(); result.Success = true; result.Data = dt; } catch(Exception ex) { result.Success = true; result.Msg = "系统异常:"+ex.Message; } return JsonConvert.SerializeObject(result); ; } } }