public bool CreateTransportentry(string boxId, string binId) { logger.Debug("calling CreateTransportEntry"); Context c = new Context(); wmsdbEntities entities = c.GetWMSEntities(); bool result = false; try { Transportentry newTrEntry = new Transportentry() { box_id = boxId, bin_id = binId }; entities.AddToTransportentries(newTrEntry); entities.SaveChanges(); logger.Debug(string.Format("New transportentry created! box_id = {0}, bin_id = {1}", newTrEntry.box_id, newTrEntry.bin_id)); result = true; } catch (Exception ex) { logger.Error(ex.ToString()); result = false; } return(result); }
public void MoveFinished(string boxId, string locationId) { //logger.Debug("TransportFinished! boxId, locationId " + transported); // Getting Service Objects from Spring IApplicationContext ctx = ContextRegistry.GetContext(); IMaterialMgtService materialMgt = (IMaterialMgtService)ctx.GetObject("materialMgtServiceObjectWSBinding"); // set location bool locationSet = materialMgt.SetLocation(boxId, locationId); // getting transport entry to find the endDestinationId string endDestinationId; List <Transportentry> trEntries = materialMgt.GetTransportentries().ToList(); Transportentry entry = trEntries.Find( delegate(Transportentry t) { return(t.box_id == boxId); } ); endDestinationId = entry.bin_id; if (!(endDestinationId.Equals(locationId))) { // box is not at the endDestination => CallCCSTransport again! GeneralTransportServiceProp.CallCCSTransport(boxId, endDestinationId); } else { // callback to TransportPlanning that transport was finished //callback.TransportFinished(boxId, endDestinationId); TODO logger.Debug("Box was transported to " + endDestinationId); //IGeneralTransportServiceCallback gTcallback = OperationContext.Current.GetCallbackChannel<IGeneralTransportServiceCallback>(); //gTcallback.TransportFinished(boxId, endDestinationId); GeneralTransportServiceProp.GTcallback.TransportFinished(boxId, endDestinationId); //IGeneralTransportService ct = (IGeneralTransportService) OperationContext.Current.Channel; logger.Debug("fertig"); } //logger.Debug("TransportFinished! boxId =" + boxId + " new binId=" + endDestId); }
public bool DeleteTransportentry(string boxId) { logger.Debug("calling DeleteTransportentry"); Context c = new Context(); wmsdbEntities entities = c.GetWMSEntities(); var query = from t in entities.Transportentries select t; var transportentries = query.ToList(); Transportentry trEntry = transportentries.Find( delegate(Transportentry t) { return(t.box_id == boxId); } ); entities.Transportentries.DeleteObject(trEntry); entities.SaveChanges(); return(true); }